agent-tower 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/executors/__tests__/providers.test.js +53 -0
- package/dist/executors/__tests__/providers.test.js.map +1 -1
- package/dist/executors/providers.d.ts +2 -0
- package/dist/executors/providers.d.ts.map +1 -1
- package/dist/executors/providers.js +3 -2
- package/dist/executors/providers.js.map +1 -1
- package/dist/git/base-branch.d.ts +3 -0
- package/dist/git/base-branch.d.ts.map +1 -0
- package/dist/git/base-branch.js +17 -0
- package/dist/git/base-branch.js.map +1 -0
- package/dist/mcp/http-client.d.ts +2 -6
- package/dist/mcp/http-client.d.ts.map +1 -1
- package/dist/mcp/http-client.js.map +1 -1
- package/dist/mcp/tools/__tests__/providers.test.d.ts +2 -0
- package/dist/mcp/tools/__tests__/providers.test.d.ts.map +1 -0
- package/dist/mcp/tools/__tests__/providers.test.js +22 -0
- package/dist/mcp/tools/__tests__/providers.test.js.map +1 -0
- package/dist/mcp/tools/__tests__/tasks.test.d.ts +2 -0
- package/dist/mcp/tools/__tests__/tasks.test.d.ts.map +1 -0
- package/dist/mcp/tools/__tests__/tasks.test.js +17 -0
- package/dist/mcp/tools/__tests__/tasks.test.js.map +1 -0
- package/dist/mcp/tools/providers.d.ts.map +1 -1
- package/dist/mcp/tools/providers.js +3 -2
- package/dist/mcp/tools/providers.js.map +1 -1
- package/dist/mcp/tools/tasks.d.ts.map +1 -1
- package/dist/mcp/tools/tasks.js +1 -0
- package/dist/mcp/tools/tasks.js.map +1 -1
- package/dist/mcp/types.d.ts +3 -0
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/mcp/types.js +2 -0
- package/dist/mcp/types.js.map +1 -1
- package/dist/output/__tests__/text-block-lifecycle.test.js +37 -0
- package/dist/output/__tests__/text-block-lifecycle.test.js.map +1 -1
- package/dist/output/text-block-tracker.d.ts.map +1 -1
- package/dist/output/text-block-tracker.js +24 -1
- package/dist/output/text-block-tracker.js.map +1 -1
- package/dist/routes/__tests__/providers.test.js +67 -0
- package/dist/routes/__tests__/providers.test.js.map +1 -1
- package/dist/routes/__tests__/tasks.test.js +23 -0
- package/dist/routes/__tests__/tasks.test.js.map +1 -1
- package/dist/routes/providers.d.ts.map +1 -1
- package/dist/routes/providers.js +8 -0
- package/dist/routes/providers.js.map +1 -1
- package/dist/routes/tasks.d.ts.map +1 -1
- package/dist/routes/tasks.js +1 -0
- package/dist/routes/tasks.js.map +1 -1
- package/dist/runtime/acp/history-reconciler.js +1 -1
- package/dist/runtime/acp/history-reconciler.js.map +1 -1
- package/dist/services/__tests__/task.service.test.js +43 -0
- package/dist/services/__tests__/task.service.test.js.map +1 -1
- package/dist/services/__tests__/translation-protection.test.js +48 -18
- package/dist/services/__tests__/translation-protection.test.js.map +1 -1
- package/dist/services/__tests__/translation-session-blocks.test.js +66 -2
- package/dist/services/__tests__/translation-session-blocks.test.js.map +1 -1
- package/dist/services/__tests__/workspace.service.test.js +34 -0
- package/dist/services/__tests__/workspace.service.test.js.map +1 -1
- package/dist/services/message-delivery.service.d.ts +2 -1
- package/dist/services/message-delivery.service.d.ts.map +1 -1
- package/dist/services/project.service.d.ts +1 -0
- package/dist/services/project.service.d.ts.map +1 -1
- package/dist/services/provider-config.service.d.ts.map +1 -1
- package/dist/services/provider-config.service.js +1 -0
- package/dist/services/provider-config.service.js.map +1 -1
- package/dist/services/session-manager.d.ts +7 -4
- package/dist/services/session-manager.d.ts.map +1 -1
- package/dist/services/session-manager.js +1 -1
- package/dist/services/session-manager.js.map +1 -1
- package/dist/services/task.service.d.ts +10 -8
- package/dist/services/task.service.d.ts.map +1 -1
- package/dist/services/task.service.js +14 -1
- package/dist/services/task.service.js.map +1 -1
- package/dist/services/team-run.service.d.ts +1 -0
- package/dist/services/team-run.service.d.ts.map +1 -1
- package/dist/services/team-task-input.service.d.ts +1 -0
- package/dist/services/team-task-input.service.d.ts.map +1 -1
- package/dist/services/translation-protection.d.ts +3 -1
- package/dist/services/translation-protection.d.ts.map +1 -1
- package/dist/services/translation-protection.js +21 -67
- package/dist/services/translation-protection.js.map +1 -1
- package/dist/services/translation-settings.service.d.ts +4 -4
- package/dist/services/translation.service.d.ts.map +1 -1
- package/dist/services/translation.service.js +44 -20
- package/dist/services/translation.service.js.map +1 -1
- package/dist/services/workspace.service.d.ts +11 -6
- package/dist/services/workspace.service.d.ts.map +1 -1
- package/dist/services/workspace.service.js +6 -4
- package/dist/services/workspace.service.js.map +1 -1
- package/dist/web/assets/{AgentDemoPage-BfXkNCdN.js → AgentDemoPage-Dwux6TyV.js} +1 -1
- package/dist/web/assets/{AgentEnvironmentSettingsPage-GHjKIWpb.js → AgentEnvironmentSettingsPage-CvvkMKT1.js} +1 -1
- package/dist/web/assets/AttachmentPreview-CFJ6MZ1f.js +2 -0
- package/dist/web/assets/BranchSelect-Cv92vEjG.js +1 -0
- package/dist/web/assets/BrandLogo-H4nCbVzs.js +1 -0
- package/dist/web/assets/ConversationPage-CZzGME21.js +1 -0
- package/dist/web/assets/CreateTaskInput-BM2tx4hJ.js +1 -0
- package/dist/web/assets/{DemoPage-DK-ikg1_.js → DemoPage-CpYNBQhA.js} +1 -1
- package/dist/web/assets/DesignSystemPage-DLeH6DnV.js +12 -0
- package/dist/web/assets/EditableTaskTitle-BEsiULnD.js +70 -0
- package/dist/web/assets/{ExecutionPermissionSelector-B8befbxJ.js → ExecutionPermissionSelector-IoWR9YLb.js} +1 -1
- package/dist/web/assets/GeneralSettingsPage-BAYgxCqx.js +1 -0
- package/dist/web/assets/{LoadingPreviewPage-BDlf89rJ.js → LoadingPreviewPage-CumrzyxW.js} +1 -1
- package/dist/web/assets/McpSettingsPage-CFNwxT9Y.js +1 -0
- package/dist/web/assets/{MemberAvatar-YVr_erAr.js → MemberAvatar-BVXD0jTy.js} +1 -1
- package/dist/web/assets/{MobileTaskDetail-QNUHMq7u.js → MobileTaskDetail-IOQ1WnS8.js} +3 -3
- package/dist/web/assets/NotificationSettingsPage-B0s5YbG3.js +1 -0
- package/dist/web/assets/{ProfileSettingsPage-CHe4LlRp.js → ProfileSettingsPage-BuhoF-mL.js} +1 -1
- package/dist/web/assets/{ProjectKanbanPage-Bt_01giW.js → ProjectKanbanPage-DMtv15rq.js} +7 -7
- package/dist/web/assets/ProjectSettingsPage-DDMg6axy.js +2 -0
- package/dist/web/assets/ProviderSettingsPage-DRt9m4mF.js +67 -0
- package/dist/web/assets/{SettingsMasterDetail-DjWR9Sqk.js → SettingsMasterDetail-D7vStQjR.js} +1 -1
- package/dist/web/assets/TaskDetail-DzKbs5Jt.js +1 -0
- package/dist/web/assets/TeamSettingsPage-fjlaqaLo.js +1 -0
- package/dist/web/assets/{TranslationSettingsPage-Cod9c4Ug.js → TranslationSettingsPage-D2oks6OM.js} +1 -1
- package/dist/web/assets/{arc-DEy33vTc.js → arc-vYWCZsE_.js} +1 -1
- package/dist/web/assets/{architectureDiagram-3BPJPVTR-Ky1D1LBk.js → architectureDiagram-3BPJPVTR-Cu1VIpcJ.js} +1 -1
- package/dist/web/assets/{at-sign-C48_y345.js → at-sign-BhSPafOS.js} +1 -1
- package/dist/web/assets/{blockDiagram-GPEHLZMM-BNgB7kNT.js → blockDiagram-GPEHLZMM-C4x_nj5S.js} +1 -1
- package/dist/web/assets/{c4Diagram-AAUBKEIU-4GMrPMgQ.js → c4Diagram-AAUBKEIU-jHOo5lal.js} +1 -1
- package/dist/web/assets/channel-D1cEj22-.js +1 -0
- package/dist/web/assets/check-D_VFGpIy.js +1 -0
- package/dist/web/assets/{chevron-down-3y5Aiolp.js → chevron-down-BoS08pMa.js} +1 -1
- package/dist/web/assets/{chevron-up-DqaYcjpq.js → chevron-up-BWtKfdKT.js} +1 -1
- package/dist/web/assets/chip-Ck4dqxR3.js +1 -0
- package/dist/web/assets/{chunk-2J33WTMH-C439hRe_.js → chunk-2J33WTMH-BZcpjmfm.js} +1 -1
- package/dist/web/assets/{chunk-4BX2VUAB-D8GK3M3t.js → chunk-4BX2VUAB-DZGB3q-I.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-Dl4UhJ8X.js → chunk-55IACEB6-CcNrOmyy.js} +1 -1
- package/dist/web/assets/{chunk-727SXJPM-BSEeayBq.js → chunk-727SXJPM-dWrxio8O.js} +1 -1
- package/dist/web/assets/{chunk-AQP2D5EJ-B6chbZfT.js → chunk-AQP2D5EJ-K4gkVzqE.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-DaLkiLdQ.js → chunk-FMBD7UC4-CnHyY4qD.js} +1 -1
- package/dist/web/assets/{chunk-ND2GUHAM-DeQwZAAT.js → chunk-ND2GUHAM-CHUmcyDv.js} +1 -1
- package/dist/web/assets/{chunk-QZHKN3VN-CLRr4YRM.js → chunk-QZHKN3VN-Bzzjd-Qt.js} +1 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-DIrDMefa.js +1 -0
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-DIrDMefa.js +1 -0
- package/dist/web/assets/{code-block-OCS4YCEC-CnoxUpOx.js → code-block-OCS4YCEC-B2hHBO_G.js} +1 -1
- package/dist/web/assets/{confirm-dialog-ltNBFYCs.js → confirm-dialog-CL_1pF4K.js} +1 -1
- package/dist/web/assets/content-D0qmHfHK.js +2 -0
- package/dist/web/assets/{copy-HRMhTkIG.js → copy-C4WnOY6Y.js} +1 -1
- package/dist/web/assets/{cose-bilkent-S5V4N54A-C1UiYzfk.js → cose-bilkent-S5V4N54A-Dcn8tOhb.js} +1 -1
- package/dist/web/assets/cssMode-CXBMyfYY.js +1 -0
- package/dist/web/assets/{dagre-BM42HDAG-CTJpBgye.js → dagre-BM42HDAG-DWBV4UfP.js} +1 -1
- package/dist/web/assets/{diagram-2AECGRRQ-Dj1_TEYp.js → diagram-2AECGRRQ-CnNTJQ3q.js} +1 -1
- package/dist/web/assets/{diagram-5GNKFQAL-V-KUpwqh.js → diagram-5GNKFQAL-DlXJFzDF.js} +1 -1
- package/dist/web/assets/{diagram-KO2AKTUF-CXG1ZIeX.js → diagram-KO2AKTUF-DZ22YV4n.js} +1 -1
- package/dist/web/assets/{diagram-LMA3HP47-BZSJUwk9.js → diagram-LMA3HP47-B4pQJjG9.js} +1 -1
- package/dist/web/assets/{diagram-OG6HWLK6-CCr4gq4u.js → diagram-OG6HWLK6-DJBLjtgL.js} +1 -1
- package/dist/web/assets/dialog-1o8KQWoQ.js +5 -0
- package/dist/web/assets/{erDiagram-TEJ5UH35-Djtyzh6z.js → erDiagram-TEJ5UH35-CDsfoJUT.js} +1 -1
- package/dist/web/assets/file-6qwbIga1.js +1 -0
- package/dist/web/assets/{flowDiagram-I6XJVG4X-BmSVSiXJ.js → flowDiagram-I6XJVG4X-CuGOAYmY.js} +1 -1
- package/dist/web/assets/folder-picker-Cj1VZOZU.js +1 -0
- package/dist/web/assets/{freemarker2-DdptX5f1.js → freemarker2-BG8VyI2V.js} +1 -1
- package/dist/web/assets/{ganttDiagram-6RSMTGT7-r5vQX-b5.js → ganttDiagram-6RSMTGT7-BjrSOqAM.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-PVQCEYII-Zj9aloh9.js → gitGraphDiagram-PVQCEYII-4VVr4F8_.js} +1 -1
- package/dist/web/assets/{globe-B9I-jHBB.js → globe-CxeM27yy.js} +1 -1
- package/dist/web/assets/handlebars-Ci38FPsA.js +1 -0
- package/dist/web/assets/html-5hdYEgVF.js +1 -0
- package/dist/web/assets/htmlMode-BzU9qsw0.js +1 -0
- package/dist/web/assets/{icon-button-CYiKa-7C.js → icon-button-BmrJtYFC.js} +1 -1
- package/dist/web/assets/{index-BJObbxud.js → index-BR3Wg2fS.js} +3 -3
- package/dist/web/assets/{index-CThFsQNP.js → index-C1lMEjmZ.js} +1 -1
- package/dist/web/assets/{index-DkRy6eNX.js → index-CrKx8Yaz.js} +4 -4
- package/dist/web/assets/{index-DZLnTISJ.js → index-DSy5JLC1.js} +1 -1
- package/dist/web/assets/{index-Bhvt-E6d.js → index-DVdiOmqt.js} +2 -2
- package/dist/web/assets/index-DZLg4-xM.css +1 -0
- package/dist/web/assets/{index-DcOU2m2F.js → index-Da2mWAtm.js} +1 -1
- package/dist/web/assets/{index-BtUQYU5l.js → index-Db28hRe8.js} +1 -1
- package/dist/web/assets/{index-Dk3bRQAK.js → index-cu8sedJH.js} +1 -1
- package/dist/web/assets/{index-B1oVmCie.js → index-hHrknzh7.js} +1 -1
- package/dist/web/assets/{infoDiagram-5YYISTIA-BHtVaxZx.js → infoDiagram-5YYISTIA-Cy9ntb6t.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-BYmwjkbC.js → ishikawaDiagram-YF4QCWOH-D6UiVzRz.js} +1 -1
- package/dist/web/assets/javascript-Ib060GQ8.js +1 -0
- package/dist/web/assets/{journeyDiagram-JHISSGLW-c8BBqqRS.js → journeyDiagram-JHISSGLW-owdKzZoh.js} +1 -1
- package/dist/web/assets/{jsonMode-BJGOUeaV.js → jsonMode-CLmu6gzc.js} +1 -1
- package/dist/web/assets/{kanban-definition-UN3LZRKU-D4Vr-oFT.js → kanban-definition-UN3LZRKU-v5TBnyp0.js} +1 -1
- package/dist/web/assets/{kbd-C88ut3t9.js → kbd-Cl4AzzJp.js} +1 -1
- package/dist/web/assets/{key-round-Cjbj2qNa.js → key-round-CnYjSrCz.js} +1 -1
- package/dist/web/assets/{layers-eaHAVcc3.js → layers-XImbMX-P.js} +1 -1
- package/dist/web/assets/{linear-opi90s0L.js → linear-DNlKYt8R.js} +1 -1
- package/dist/web/assets/{link-BSGb85gq.js → link-DQk-Vapq.js} +1 -1
- package/dist/web/assets/liquid-Bc7OSAPR.js +1 -0
- package/dist/web/assets/{lspLanguageFeatures-DWu2Ubf0.js → lspLanguageFeatures-DD_y1bZa.js} +1 -1
- package/dist/web/assets/mdx-CxJNHHTn.js +1 -0
- package/dist/web/assets/{menu--sjyisSg.js → menu-DXF6iUsq.js} +1 -1
- package/dist/web/assets/{mermaid-NOHMQCX5-BSNbBj78.js → mermaid-NOHMQCX5-CG_LpwAI.js} +59 -59
- package/dist/web/assets/{message-square-BLEJN6p7.js → message-square-BviHdb67.js} +1 -1
- package/dist/web/assets/{mindmap-definition-RKZ34NQL-BN3ZjBh-.js → mindmap-definition-RKZ34NQL-Bn_rnnGT.js} +1 -1
- package/dist/web/assets/{modal-CSGOqphK.js → modal-D496f1fE.js} +1 -1
- package/dist/web/assets/{monaco-BkuNyOkP.js → monaco-yuGji-2E.js} +3 -3
- package/dist/web/assets/{paperclip-CTNoXpUW.js → paperclip-D9ka2IAB.js} +1 -1
- package/dist/web/assets/{pencil-Cp70ZwtG.js → pencil-isP1rXC-.js} +1 -1
- package/dist/web/assets/{people-DT78SebR.js → people-CbmH8m4i.js} +1 -1
- package/dist/web/assets/{pieDiagram-4H26LBE5-CfmFHpPI.js → pieDiagram-4H26LBE5-DIE_f9W_.js} +1 -1
- package/dist/web/assets/popover-D8VtO5qF.js +1 -0
- package/dist/web/assets/provider-selection-DSu7SCI7.js +1 -0
- package/dist/web/assets/python-C0E43gUo.js +1 -0
- package/dist/web/assets/{quadrantDiagram-W4KKPZXB-CeaumJAa.js → quadrantDiagram-W4KKPZXB-CavFxJCk.js} +1 -1
- package/dist/web/assets/razor-xarhYR9V.js +1 -0
- package/dist/web/assets/{requirementDiagram-4Y6WPE33-BWWCDXCE.js → requirementDiagram-4Y6WPE33-Dm1FwUUh.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-5OEKKPKP-DAJut743.js → sankeyDiagram-5OEKKPKP-qeqcO27M.js} +1 -1
- package/dist/web/assets/{search-DniD_AGC.js → search-DOMr5jPS.js} +1 -1
- package/dist/web/assets/{select-B5RYunTs.js → select-Cw5BaOLQ.js} +1 -1
- package/dist/web/assets/{select-BPdJrr5M.js → select-CzZNbe1Z.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-3UESZ5HK-CynjRGW4.js → sequenceDiagram-3UESZ5HK-Dqtb3BYG.js} +1 -1
- package/dist/web/assets/{server-xswxWpKD.js → server-u-PC-CcX.js} +1 -1
- package/dist/web/assets/{stateDiagram-AJRCARHV-amAtpx9w.js → stateDiagram-AJRCARHV-C_MqF9Fy.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-BxmbGAhh.js +1 -0
- package/dist/web/assets/{textarea-BVyPl9rM.js → textarea-xt2hLb-d.js} +1 -1
- package/dist/web/assets/{timeline-definition-PNZ67QCA-DZ9W7WlP.js → timeline-definition-PNZ67QCA-Bzov6t31.js} +1 -1
- package/dist/web/assets/{toggles-QcIz43DP.js → toggles-B6E1UBYN.js} +1 -1
- package/dist/web/assets/{tooltip-CPqGK_WZ.js → tooltip-C8--8CNX.js} +1 -1
- package/dist/web/assets/{track-Ckye0-tt.js → track-BeqaPopG.js} +1 -1
- package/dist/web/assets/{trash-2-CvUJsbtT.js → trash-2-5jI3_KHh.js} +1 -1
- package/dist/web/assets/{tsMode-c5x0d47n.js → tsMode-uT3sMVHt.js} +1 -1
- package/dist/web/assets/typescript-Dkdj2ks0.js +1 -0
- package/dist/web/assets/{upload-CsXAmAun.js → upload-DUteazR7.js} +1 -1
- package/dist/web/assets/{use-profiles-DuXaBRju.js → use-profiles-T3saKiBg.js} +1 -1
- package/dist/web/assets/{use-providers-Td1-gyrN.js → use-providers-CQwBj9hp.js} +1 -1
- package/dist/web/assets/{use-translation-settings-NYM0lmBx.js → use-translation-settings-DBzFqP-d.js} +1 -1
- package/dist/web/assets/useNormalizedLogs-DsdwmfS7.js +1 -0
- package/dist/web/assets/useTokenUsage-Drh3v3kx.js +1 -0
- package/dist/web/assets/{vennDiagram-CIIHVFJN-CB2Ubvy9.js → vennDiagram-CIIHVFJN-BqxICvT_.js} +1 -1
- package/dist/web/assets/{wardley-L42UT6IY-BXOkk77I.js → wardley-L42UT6IY-BTdLPFcA.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-YWT4CUSO-VA6ywdQQ.js → wardleyDiagram-YWT4CUSO-icnFsFn4.js} +1 -1
- package/dist/web/assets/xml-BO8gYu0L.js +1 -0
- package/dist/web/assets/{xychartDiagram-2RQKCTM6-FNcvDj5G.js → xychartDiagram-2RQKCTM6-BN2_ducK.js} +1 -1
- package/dist/web/assets/yaml-DlovbQzw.js +1 -0
- package/dist/web/index.html +2 -2
- package/node_modules/@agent-tower/shared/dist/translation.d.ts +12 -0
- package/node_modules/@agent-tower/shared/dist/translation.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/translation.js +19 -0
- package/node_modules/@agent-tower/shared/dist/translation.js.map +1 -1
- package/node_modules/@agent-tower/shared/dist/types.d.ts +13 -1
- package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/prisma/migrations/20261023000000_add_task_base_branch/migration.sql +2 -0
- package/prisma/schema.prisma +1 -0
- package/dist/web/assets/AttachmentPreview-CLN1lnLe.js +0 -2
- package/dist/web/assets/BranchSelect-Cofp8vYf.js +0 -1
- package/dist/web/assets/BrandLogo-BUimEX-9.js +0 -1
- package/dist/web/assets/ConversationPage-R7vNaOQv.js +0 -1
- package/dist/web/assets/CreateTaskInput-CasITF8y.js +0 -1
- package/dist/web/assets/DesignSystemPage-BhjNs2vP.js +0 -12
- package/dist/web/assets/EditableTaskTitle-BJ9Rxggf.js +0 -70
- package/dist/web/assets/GeneralSettingsPage-RMN2al8I.js +0 -1
- package/dist/web/assets/McpSettingsPage-CPNxFF67.js +0 -1
- package/dist/web/assets/NotificationSettingsPage-BEyuyu3Z.js +0 -1
- package/dist/web/assets/ProjectSettingsPage-cus6Ns97.js +0 -2
- package/dist/web/assets/ProviderSettingsPage-DqA_B1Ey.js +0 -67
- package/dist/web/assets/TaskDetail-rEXNe2h3.js +0 -1
- package/dist/web/assets/TeamSettingsPage-DwWROtW6.js +0 -1
- package/dist/web/assets/channel-DTP-syjA.js +0 -1
- package/dist/web/assets/check-BmiJ7qMY.js +0 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-CUKgurLa.js +0 -1
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-CUKgurLa.js +0 -1
- package/dist/web/assets/content-DPQMfMae.js +0 -2
- package/dist/web/assets/cssMode-DkuSsGeg.js +0 -1
- package/dist/web/assets/dialog-CuFEdqLg.js +0 -5
- package/dist/web/assets/handlebars-B34f-LAf.js +0 -1
- package/dist/web/assets/hooks-BLxb16IA.js +0 -1
- package/dist/web/assets/html-CnvOQ63o.js +0 -1
- package/dist/web/assets/htmlMode-RdxZ8Svp.js +0 -1
- package/dist/web/assets/index-0XPZayUU.css +0 -1
- package/dist/web/assets/javascript-BhombDEO.js +0 -1
- package/dist/web/assets/liquid-Czy1WpPz.js +0 -1
- package/dist/web/assets/mdx-DhXfoSnM.js +0 -1
- package/dist/web/assets/popover-BiVxGGgp.js +0 -1
- package/dist/web/assets/python-DIcQDjcf.js +0 -1
- package/dist/web/assets/razor-DYK6Rxer.js +0 -1
- package/dist/web/assets/search-field-CQLDXLeA.js +0 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-V-lSceg1.js +0 -1
- package/dist/web/assets/typescript-i7eYblLt.js +0 -1
- package/dist/web/assets/use-projects-Ddz0knyr.js +0 -1
- package/dist/web/assets/use-workspaces-CdJZLmGh.js +0 -1
- package/dist/web/assets/useNormalizedLogs--RbVywYa.js +0 -1
- package/dist/web/assets/useTokenUsage-DDXf7E4p.js +0 -1
- package/dist/web/assets/xml-D2EGActB.js +0 -1
- package/dist/web/assets/yaml-jeiIZSL4.js +0 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-yuGji-2E.js","assets/index-BR3Wg2fS.js","assets/index-DZLg4-xM.css","assets/monaco-Dvl_Svmm.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{q as Le,r as N,ci as Cn,cj as kn,c as fe,u as re,p as Ut,v as ae,j as t,ah as En,ck as Js,s as oe,o as Te,cl as rt,ae as ge,af as Ae,ag as mt,M as at,n as Q,av as qt,B as me,cm as Ur,cn as jn,aU as qr,co as Tn,au as An,X as Qe,a2 as Os,aw as Nn,cg as Is,a1 as Ye,cp as Kr,cq as Xr,aA as gt,$ as Fs,cr as Rn,Z as Gt,cs as Yr,an as Ie,ar as Be,N as Ln,ct as Mn,cu as Dn,cv as Pn,ad as Tt,t as ke,aS as Vr,aa as pe,S as _e,aQ as vt,ab as yt,a4 as ve,bu as Bn,ai as Ve,ap as Qt,cw as Ct,bw as On,b8 as Gr,w as Cs,bh as Qr,by as In,az as Ue,a5 as zt,bb as Fn,al as Hn,aT as Zr,cx as Jr,cy as ei,cz as er,cA as ti,cB as tr,aq as sr,a8 as zn,b1 as si,bt as Wn}from"./index-BR3Wg2fS.js";import{f as ks,u as Hs,M as $n,h as ri,i as Un,j as qn,k as Kn,l as Xn,m as ii,o as Yn,p as Vn,q as Gn,t as Qn,Q as Zn,v as Jn,w as Mt,x as eo,y as to,z as so,T as ro}from"./mermaid-NOHMQCX5-CG_LpwAI.js";import{a as io,u as no,A as oo,c as ao,p as ni,d as lo,e as co}from"./AttachmentPreview-CFJ6MZ1f.js";import{u as oi}from"./use-translation-settings-DBzFqP-d.js";import{u as zs}from"./use-providers-CQwBj9hp.js";import{M as He}from"./MemberAvatar-BVXD0jTy.js";import{C as ze}from"./chevron-down-BoS08pMa.js";import{C as ai}from"./chevron-up-BWtKfdKT.js";import{A as rr}from"./at-sign-BhSPafOS.js";import{P as ho}from"./paperclip-D9ka2IAB.js";import{C as kt}from"./check-D_VFGpIy.js";import{F as uo}from"./tooltip-C8--8CNX.js";import{u as fo,T as mo}from"./useTokenUsage-Drh3v3kx.js";import{a as po}from"./BrandLogo-H4nCbVzs.js";import{C as go}from"./confirm-dialog-CL_1pF4K.js";import{M as At}from"./modal-D496f1fE.js";import{S as $e}from"./select-CzZNbe1Z.js";import{i as li}from"./provider-selection-DSu7SCI7.js";import{P as xt,T as vo}from"./trash-2-5jI3_KHh.js";import{L as Es}from"./layers-XImbMX-P.js";import{M as _o}from"./message-square-BviHdb67.js";import{T as bo}from"./textarea-xt2hLb-d.js";import{r as xo,P as So,a as ci,h as yo,f as di,k as wo,H as Kt,F as hi,l as Co,C as ui}from"./content-D0qmHfHK.js";import{M as fi,a as mi,b as pi,p as ko,d as Eo,e as jo}from"./menu-DXF6iUsq.js";import{Z as To,c as Ao,b as No,j as ir,k as Ro}from"./CreateTaskInput-BM2tx4hJ.js";import{S as js}from"./server-u-PC-CcX.js";import{F as Ws,S as Lo,I as Mo}from"./popover-D8VtO5qF.js";import{I as Fe}from"./icon-button-BmrJtYFC.js";import{m as gi,f as Do,n as Po,B as Bo,b as Oo,o as vi,p as _i,u as bi,q as Io,r as Fo,d as Ho,k as zo,c as Wo}from"./BranchSelect-Cv92vEjG.js";import{U as $s}from"./upload-DUteazR7.js";import{G as xi}from"./globe-CxeM27yy.js";import{t as $o}from"./ProjectKanbanPage-DMtv15rq.js";import{a as ht,l as Uo}from"./ExecutionPermissionSelector-IoWR9YLb.js";import{S as qo}from"./select-Cw5BaOLQ.js";import{P as Ko}from"./pencil-isP1rXC-.js";function Si(e,i){const n=Le(i);return Xo({filters:{...e,status:"pending"}},n).length}function nr(e,i){return e.findAll(i.filters).map(n=>i.select?i.select(n):n.state)}function Xo(e={},i){const n=Le(i).getMutationCache(),d=N.useRef(e),v=N.useRef(null);return v.current===null&&(v.current=nr(n,e)),N.useEffect(()=>{d.current=e}),N.useSyncExternalStore(N.useCallback(_=>n.subscribe(()=>{const C=Cn(v.current,nr(n,d.current));v.current!==C&&(v.current=C,kn.schedule(_))}),[n]),()=>v.current,()=>v.current)}const Yo=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],yi=fe("arrow-right",Yo);const Vo=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],wi=fe("ban",Vo);const Go=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Qo=fe("chevron-left",Go);const Zo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Jo=fe("circle",Zo);const ea=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],ta=fe("clipboard-paste",ea);const sa=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],qe=fe("clock-3",sa);const ra=[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],or=fe("copy-plus",ra);const ia=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],na=fe("earth",ia);const oa=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Ef=fe("ellipsis-vertical",oa);const aa=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Ts=fe("file-code-corner",aa);const la=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ca=fe("file-exclamation-point",la);const da=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],Us=fe("git-graph",da);const ha=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],ua=fe("maximize",ha);const fa=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],ma=fe("panel-left-close",fa);const pa=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],ga=fe("panel-left-open",pa);const va=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],_a=fe("panel-right-close",va);const ba=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],As=fe("panel-right-open",ba);const xa=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Sa=fe("pen-line",xa);const ya=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Ci=fe("settings-2",ya);const wa=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Dt=fe("user-plus",wa);const Ca=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ka=fe("zoom-in",Ca);const Ea=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ja=fe("zoom-out",Ea);function ki({taskId:e,teamRunId:i,enabled:n=!0,showDeliveries:d=!0}){const{t:v}=re(),_=Le(),C=oi(),r=ks(n?`task:${e}`:"","pending","TEAM_TASK"),o=Hs({queryKey:["team-task-inputs",i],initialPageParam:void 0,queryFn:({pageParam:a})=>ae.get(`/team-runs/${i}/task-inputs${a?`?cursor=${encodeURIComponent(a)}`:""}`),getNextPageParam:a=>a.nextCursor??void 0,enabled:n&&!!i,refetchInterval:2e3}),u=Ut({mutationFn:({input:a,action:p})=>io(`task-input:${a.id}`,{action:p,expectedRevision:a.revision},m=>{const{clientSubmissionId:y,...b}=m;return ae.post(`/team-runs/${i}/task-inputs/${a.id}/actions`,{...b,actionId:y})}),onSettled:()=>{_.invalidateQueries({queryKey:["team-task-inputs",i]}),_.invalidateQueries({queryKey:["message-deliveries",`task:${e}`]})}}),f=Ut({mutationFn:a=>ae.get(`/team-runs/${i}/task-inputs/${a}`)});return n?t.jsxs("div",{className:"space-y-2 text-xs","aria-live":"polite",children:[d&&r.data?.pages.flatMap(a=>a.items).filter(a=>!["SENT","CANCELLED"].includes(a.state)).map(a=>t.jsx("div",{className:"flex justify-end","data-operation-id":a.id,children:t.jsxs("div",{className:"flex max-w-[85%] min-w-0 flex-col items-end",children:[a.origin==="TEAM_INITIAL"&&t.jsx("p",{className:"mb-1 px-0.5 text-xs text-muted-foreground",children:v("Team creation pending")}),t.jsxs("div",{className:"max-w-full rounded-2xl rounded-tr-sm bg-foreground/[0.08] px-5 py-3.5 text-sm",children:[t.jsx("p",{className:"whitespace-pre-wrap break-words",children:a.originalText}),t.jsx($n,{delivery:a})]}),t.jsx("div",{className:"mt-1 max-w-full px-0.5","data-message-feedback":!0,children:t.jsx(ri,{delivery:a})})]})},a.id)),o.data?.pages.flatMap(a=>a.items).filter(a=>a.state==="PENDING"&&a.consumerCount>0).map(a=>t.jsxs("div",{className:"ml-auto max-w-[85%] space-y-1 px-0.5 text-muted-foreground",children:[t.jsxs("p",{children:[v("Task input"),": ",a.translationState??"PENDING"," ",a.errorCode??""]}),t.jsxs("div",{className:"flex flex-wrap gap-3",children:[t.jsx("button",{type:"button",className:"underline",disabled:f.isPending,onClick:()=>f.mutate(a.id),children:v("查看原文")}),t.jsx("button",{type:"button",className:"underline",disabled:u.isPending,onClick:()=>u.mutate({input:a,action:"send_original"}),children:v("Send original")}),C.data?.enabled===!0&&["FAILED","CANCELLED","QUEUE_FULL","PAUSED_DISABLED","INTERRUPTED"].includes(a.translationState??"")&&t.jsx("button",{type:"button",className:"underline",disabled:u.isPending,onClick:()=>u.mutate({input:a,action:"retry_translation"}),children:v("Retry translation")})]}),f.data?.id===a.id&&t.jsx("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap",children:f.data.originalText})]},a.id)),o.hasNextPage&&t.jsx("button",{type:"button",className:"underline",onClick:()=>{o.fetchNextPage()},children:v("Load more task inputs")}),r.hasNextPage&&t.jsx("button",{type:"button",className:"underline",onClick:()=>{r.fetchNextPage()},children:v("Load more")}),(u.error||f.error)&&t.jsx("p",{role:"alert",children:v("Delivery action failed. Refresh and try again.")}),(r.error||o.error)&&t.jsx("p",{role:"alert",children:v("Failed to restore pending messages")})]}):null}function jf({taskId:e}){const{t:i}=re(),n=Le(),d=En(),[v,_]=N.useState(null);let C=!1,r=null;try{C=!!Js(e)}catch(f){r=f.message}const o=r??v,u=async()=>{try{const f=Js(e);f&&await d.mutateAsync({taskId:e,...f}),_(null),n.invalidateQueries({queryKey:["message-deliveries",`task:${e}`]})}catch(f){_(f.message)}};return t.jsxs("div",{className:"space-y-2 py-2","data-team-creation-status":!0,children:[C&&t.jsxs("div",{className:"rounded border p-2 text-xs",children:[t.jsx("p",{children:i("Team creation result unknown. Check the original request.")}),t.jsx("button",{type:"button",className:"underline",disabled:d.isPending,onClick:()=>{u()},children:i("Check team creation")})]}),o&&t.jsx("p",{role:"alert",className:"text-xs text-destructive",children:o}),t.jsx(ki,{taskId:e,teamRunId:""})]})}function Ta(e){return`${e.mimeType.startsWith("image/")?"!":""}[${e.originalName}](${e.storagePath})`}function Wt(e,i){if(i.length===0)return e;const n=new Set(i.map(Ta));return e.split(`
|
|
3
|
+
`).map(d=>{const v=d.match(/^\s*/)?.[0]??"",_=d.trimStart();for(const C of n){if(_===C)return null;if(_.startsWith(`${C} `)||_.startsWith(`${C} `))return`${v}${_.slice(C.length).trimStart()}`}return d}).filter(d=>d!=null).join(`
|
|
4
|
+
`).replace(/\n{3,}/g,`
|
|
5
|
+
|
|
6
|
+
`).trim()}function Aa({draft:e,attachmentMarkdown:i,attachmentIds:n,mentions:d}){const _=[e.trim(),i].filter(Boolean).join(`
|
|
7
|
+
|
|
8
|
+
`);return _?{content:_,mentions:d,senderType:"user",...n.length>0?{attachmentIds:n}:{}}:null}function Na({items:e,renderItem:i,scrollElementRef:n,compact:d}){const[v,_]=N.useState(null),[C,r]=N.useState(0),[o,u]=N.useState(!1),f=N.useCallback(m=>{if(!m)return;const y=n.current??m.closest("[data-room-scroll]");_(y),r(y?.clientHeight??0),u(!0)},[n]);N.useEffect(()=>{if(!v)return;const m=()=>r(v.clientHeight);if(m(),typeof ResizeObserver>"u")return;const y=new ResizeObserver(m);return y.observe(v),()=>y.disconnect()},[v]);const a=d?12:16,p=Un({count:e.length,getScrollElement:()=>v,getItemKey:N.useCallback(m=>e[m].key,[e]),estimateSize:()=>160,overscan:6,scrollMargin:a,measureElement:m=>m.getBoundingClientRect().height});return p.shouldAdjustScrollPositionOnItemSizeChange=qn,o?t.jsx("div",{ref:f,children:C>0?t.jsx("div",{style:{position:"relative",height:p.getTotalSize(),width:"100%"},children:p.getVirtualItems().map(m=>t.jsx("div",{"data-index":m.index,"data-room-row":m.key,ref:p.measureElement,style:{position:"absolute",top:m.start-a,left:0,width:"100%",paddingBottom:d?10:12},children:i(e[m.index])},m.key))},"virtual"):t.jsx("div",{className:d?"space-y-2.5":"space-y-3",children:e.slice(-20).map(m=>t.jsx("div",{"data-room-row":m.key,children:i(m)},m.key))},"unmeasured")}):t.jsx("div",{ref:f})}const Oe=new WeakMap,nt=()=>new DOMException("Aborted","AbortError"),as=e=>e instanceof at&&[401,403,404].includes(e.status);function Ra(e,i,n){let d=Oe.get(e);d||(d=new Map,Oe.set(e,d));let v=d.get(i);if(v)v.owners.add(n),n.permission(v.denied);else{const _=new Set;let C=0,r=!1;const o=()=>{v.epoch++,!r&&(r=!0,queueMicrotask(()=>{if(r=!1,d.get(i)===v)for(const p of _)p.refresh()}))},u=()=>{const p=++C;e.emit(mt.SUBSCRIBE,{topic:"team-run",id:i},m=>{if(!(p!==C||d.get(i)!==v)){v.denied=!m.success;for(const y of _)y.permission(!m.success);o()}}),o()},f=p=>{p.teamRunId===i&&o()},a=p=>{if(p==="io server disconnect"){C++,v.denied=!0,v.epoch++;for(const m of _)m.permission(!0)}};v={owners:_,epoch:0,itemGenerations:new Map,denied:!1,dispose:()=>{C++,e.off("connect",u),e.off("disconnect",a),e.off(Ae.TRANSLATION_INVALIDATED,f),e.emit(mt.UNSUBSCRIBE,{topic:"team-run",id:i})}},d.set(i,v),e.on("connect",u),e.on("disconnect",a),e.on(Ae.TRANSLATION_INVALIDATED,f),_.add(n),e.connected&&u()}return()=>{v.owners.delete(n),v.owners.size||(v.dispose(),d.delete(i))}}function Pt(e,i){return Oe.get(e)?.get(i)?.epoch??0}function ut(e,i,n){return Oe.get(e)?.get(i)?.itemGenerations.get(n)??0}function La(e,i){const n=new Map(e?.map(d=>[d.sourceId,d]));return i.map(d=>{const v=n.get(d.sourceId);return v&&(v.sourceRevision>d.sourceRevision||v.sourceRevision===d.sourceRevision&&v.overlayRevision>d.overlayRevision)?v:d})}async function Ma(e,i,n){const d=[];for(let v=0;v<i.length;v+=100){if(n.aborted)throw nt();const _=await ae.get(`/team-runs/${encodeURIComponent(e)}/translations`,{signal:n,params:{messageIds:i.slice(v,v+100).join(",")}});d.push(..._.items)}return d}function Da(e,i){const n=Le(),d=Si({mutationKey:oe.accessAuth.identityChange})>0,v=rt(),[_,C]=N.useState(!1),[,r]=N.useState(0),o=N.useMemo(()=>i.filter(w=>w.teamRunId===e&&w.senderType==="agent"&&w.visibility==="PUBLIC"&&!w.id.startsWith("pending-")),[i,e]),u=N.useMemo(()=>[...new Set(o.map(w=>w.id))].sort(),[o]),f=N.useMemo(()=>o.map(w=>[w.id,w.content,w.contentPreview,w.isTruncated,w.senderId,w.senderInvocationId]),[o]),a=N.useMemo(()=>({teamRunId:e,accessGeneration:v,active:!0,allowed:!1,generation:0,summaries:new Map}),[e,v]),p=N.useRef(new Set(u)),m=N.useRef(new Set(u));p.current=new Set(u);const y=()=>{n.cancelQueries({queryKey:oe.roomTranslations.scope(e)}),n.removeQueries({queryKey:oe.roomTranslations.scope(e)})},b=()=>{if(v!==rt())return;const w=Oe.get(ge.getSocket())?.get(e);if(w){w.denied=!0;for(const A of w.owners)A.permission(!0)}else a.allowed=!1,a.generation++,C(!0);y()},s=Te({queryKey:[...oe.roomTranslations.summaries(e),v,u,f],enabled:u.length>0&&!_&&!d,queryFn:async({signal:w})=>{const A=ge.getSocket();try{for(let L=0;L<3;L++){const R=Pt(A,e),M=Object.fromEntries(u.map(P=>[P,ut(A,e,P)])),I=await Ma(e,u,w);if(w.aborted||Oe.get(A)?.get(e)?.denied||v!==rt())throw nt();if(R===Pt(A,e)&&u.every(P=>M[P]===ut(A,e,P)))return{items:I.filter(P=>P.teamRunId===e&&u.includes(P.messageId)),generations:M}}throw new Error("Translation snapshot changed while reading")}catch(L){throw as(L)&&b(),L}},structuralSharing:(w,A)=>{const L=w,R=A;return{...R,items:La(L?.items.filter(M=>L.generations[M.messageId]===R.generations[M.messageId]),R.items)}},refetchOnMount:"always",refetchOnWindowFocus:!0,refetchInterval:5e3,retry:!1,gcTime:0});a.allowed=!_&&!d&&!s.isError&&s.isFetchedAfterMount&&v===rt();const c=s.data?.generations,l=N.useMemo(()=>a.allowed?s.data?.items??[]:[],[a.allowed,s.data]);a.summaries=new Map(l.filter(w=>p.current.has(w.messageId)&&c?.[w.messageId]===ut(ge.getSocket(),e,w.messageId)).map(w=>[w.messageId,w])),N.useEffect(()=>{a.active=!0;const w=ge.connect(),A=Ra(w,e,{client:n,candidates:()=>p.current,withdraw:L=>{a.summaries.delete(L),r(R=>R+1)},refresh:()=>{n.invalidateQueries({queryKey:oe.roomTranslations.scope(e)},{cancelRefetch:!1})},permission:L=>{L&&(a.allowed=!1,a.generation++,a.summaries.clear(),y()),C(L)}});return()=>{a.active=!1,a.allowed=!1,a.generation++,A(),Oe.get(w)?.has(e)||y()}},[n,e,a]),N.useLayoutEffect(()=>{const w=Oe.get(ge.getSocket())?.get(e),A=[...m.current].filter(L=>!p.current.has(L)&&![...w?.owners??[]].some(R=>R.candidates().has(L)));m.current=new Set(u);for(const L of A){const R=[...oe.roomTranslations.details(e),L];n.cancelQueries({queryKey:R}),n.removeQueries({queryKey:R})}},[n,e,u]),N.useEffect(()=>{if(!s.isSuccess||!s.isFetchedAfterMount)return;const w=new Set(l.map(L=>L.messageId)),A=n.getQueryCache().findAll({queryKey:oe.roomTranslations.details(e)}).filter(L=>u.includes(L.queryKey[3])&&!w.has(L.queryKey[3]));for(const L of A)n.cancelQueries({queryKey:L.queryKey,exact:!0}),n.removeQueries({queryKey:L.queryKey,exact:!0})},[n,e,l,u,s.isSuccess,s.isFetchedAfterMount]);const h=w=>{const A=a.summaries.get(w.messageId);return a.active&&a.allowed&&v===rt()&&p.current.has(w.messageId)&&c?.[w.messageId]===ut(ge.getSocket(),e,w.messageId)&&A?.sourceId===w.sourceId&&A.sourceRevision===w.sourceRevision&&A.overlayRevision===w.overlayRevision},g=async w=>{if(!h(w))throw nt();const A=a.generation,L=ut(ge.getSocket(),e,w.messageId),R=await n.fetchQuery({queryKey:oe.roomTranslations.full(e,w.messageId,w.sourceId,w.sourceRevision,w.overlayRevision),staleTime:0,gcTime:0,retry:!1,queryFn:async({signal:M})=>{try{for(let I=0;I<3;I++){const P=Pt(ge.getSocket(),e),H=await ae.get(`/team-runs/${encodeURIComponent(e)}/messages/${encodeURIComponent(w.messageId)}/translation`,{signal:M}),$=Oe.get(ge.getSocket())?.get(e);if(M.aborted||v!==rt()||!$||$.denied||L!==ut(ge.getSocket(),e,w.messageId)||![...$.owners].some(T=>T.candidates().has(w.messageId))||H.teamRunId!==e||H.messageId!==w.messageId||H.sourceId!==w.sourceId||H.sourceRevision!==w.sourceRevision)throw nt();if(H.overlayRevision>=w.overlayRevision&&P===Pt(ge.getSocket(),e))return H}throw new Error("Translation detail changed while reading")}catch(I){throw I instanceof at&&I.status===404?S(w):as(I)&&b(),I}}});if(A!==a.generation||!h(w))throw nt();return R},S=w=>{if(v!==rt())return;const A=Oe.get(ge.getSocket())?.get(e);if(A){A.itemGenerations.set(w.messageId,(A.itemGenerations.get(w.messageId)??0)+1);for(const L of A.owners)L.withdraw(w.messageId);for(const L of new Set([n,...[...A.owners].map(R=>R.client)])){const R=[...oe.roomTranslations.details(e),w.messageId];L.cancelQueries({queryKey:R}),L.removeQueries({queryKey:R});const M=oe.roomTranslations.summaries(e);L.cancelQueries({queryKey:M}),L.setQueriesData({queryKey:M},I=>I&&{...I,items:I.items.filter(P=>P.messageId!==w.messageId)}),L.invalidateQueries({queryKey:M},{cancelRefetch:!1})}}},k=async w=>{if(!h(w))throw nt();try{await ae.post(`/team-runs/${encodeURIComponent(e)}/translations/${encodeURIComponent(w.sourceId)}/retry`,{expectedRevision:w.sourceRevision})}catch(A){throw A instanceof at&&A.status===404?S(w):as(A)&&b(),A}finally{n.invalidateQueries({queryKey:oe.roomTranslations.summaries(e)},{cancelRefetch:!1})}},E=[...a.summaries.values()],x=Kn(`${e}:${v}`,o.map(w=>({id:w.id,revision:0})),E.map(w=>({id:w.messageId,version:`${w.sourceId}:${w.sourceRevision}`,state:w.state})),i.length>0);return{overlays:E,loadFull:g,isCurrent:h,retry:k,claimReveal:x}}const Pa=10,Ba=24,Ei=Pa*Ba,Oa=8;function Ia(e,i=Ei){return e>i+Oa}function Fa(e,i){return e.includes(i)?e:[...e,i]}function Ha(e,i){return e.filter(n=>n!==i)}function za(e,i){const n=new Map(i.map(d=>[d.id,d]));return e.map(d=>n.get(d)).filter(d=>!!d).map(d=>({memberId:d.id,label:d.name}))}const Zt=new Set(["RUNNING","WAITING_ROOM_REPLY","QUEUED","SESSION_ENDED"]);function ar(e){if(!e)return 0;const i=Date.parse(e);return Number.isNaN(i)?0:i}function Wa(e,i=[],n=[]){const d=new Set(n.filter(_=>Zt.has(_.status)).map(_=>_.workRequestId));return[...e.map(_=>({kind:"message",key:`message:${_.id}`,sortTime:_.createdAt,order:0,message:_})),...i.filter(_=>_.status==="PENDING_APPROVAL").filter(_=>!d.has(_.id)).map(_=>({kind:"pendingApproval",key:`pending-approval:${_.id}`,sortTime:_.updatedAt??_.createdAt,order:1,request:_}))].sort((_,C)=>{const r=ar(_.sortTime)-ar(C.sortTime);return r!==0?r:_.order!==C.order?_.order-C.order:_.key.localeCompare(C.key)})}function $a(e){switch(e){case"RUNNING":return"Working";case"QUEUED":return"Queued...";case"WAITING_ROOM_REPLY":return"Waiting reply...";case"SESSION_ENDED":return"Session ended";default:return e}}function Ua(e){switch(e){case"FAILED":return"text-destructive-ink";case"RUNNING":case"WAITING_ROOM_REPLY":case"QUEUED":case"SESSION_ENDED":return"text-muted-foreground";default:return"text-muted-foreground"}}function qa(e,i){const n=e.reduce((v,_)=>(v[_.status]=(v[_.status]??0)+1,v),{});return[["RUNNING","running"],["QUEUED","queued"],["WAITING_ROOM_REPLY","waiting"],["SESSION_ENDED","ended"]].map(([v,_])=>{const C=n[v];return C?`${C} ${i(_)}`:null}).filter(v=>!!v).join(" · ")}function Ka(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(min-width: 768px)").matches}function Xa({status:e}){const{t:i}=re();return e==="RUNNING"?t.jsxs(t.Fragment,{children:[i("Working"),t.jsxs("span",{className:"active-work-dots","aria-hidden":"true",children:[t.jsx("span",{children:"."}),t.jsx("span",{className:"active-work-dots__second",children:"."}),t.jsx("span",{className:"active-work-dots__third",children:"."})]})]}):t.jsx(t.Fragment,{children:i($a(e))})}function Ya({invocations:e,memberById:i,workRequestById:n,onViewInvocationSession:d,onStopMember:v,isStopPending:_,stoppingMemberId:C,stopPromptInvocationId:r,onToggleStopConfirm:o}){const{t:u}=re(),[f,a]=N.useState(Ka),p=N.useMemo(()=>e.filter(y=>Zt.has(y.status)).sort((y,b)=>Date.parse(b.updatedAt??b.createdAt??"")-Date.parse(y.updatedAt??y.createdAt??"")),[e]);if(p.length===0)return null;const m=qa(p,u);return t.jsxs("div",{className:"border-t border-border bg-muted/40",children:[t.jsxs("button",{type:"button",onClick:()=>a(y=>!y),"aria-expanded":f,className:"flex h-8 w-full items-center justify-between gap-3 px-3 text-left text-xs text-foreground/70 transition-colors hover:bg-accent",children:[t.jsxs("span",{className:"min-w-0 truncate",children:[t.jsx("span",{className:"font-medium text-foreground",children:u("Active work")}),t.jsx("span",{className:"mx-1.5 text-muted-foreground",children:"·"}),t.jsx("span",{children:m})]}),f?t.jsx(ze,{size:15,className:"shrink-0 text-muted-foreground/70"}):t.jsx(ai,{size:15,className:"shrink-0 text-muted-foreground/70"})]}),f&&t.jsx("div",{className:"max-h-32 overflow-y-auto border-t border-border",children:p.map(y=>{const b=i.get(y.memberId),s=n.get(y.workRequestId),c=!!(y.sessionId&&d),l=!!b,h=r===y.id,g=_&&C===y.memberId,S=s?.instruction??y.workRequestId;return t.jsxs("div",{className:"border-t border-border/60 first:border-t-0",children:[t.jsxs("div",{title:S,className:Q("group flex h-8 items-center gap-2 px-3 text-xs text-foreground/80",c?"cursor-pointer hover:bg-background":"cursor-default"),role:c?"button":void 0,tabIndex:c?0:void 0,onClick:()=>y.sessionId&&d?.(y.sessionId),onKeyDown:k=>{!c||!y.sessionId||(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),d?.(y.sessionId))},children:[t.jsx(He,{name:b?.name??u("Agent"),avatar:b?.avatar??null,size:"xs",className:"size-4"}),t.jsxs("div",{className:"flex min-w-0 flex-1 items-baseline gap-1.5",children:[t.jsx("span",{className:"truncate font-medium text-foreground",children:b?.name??u("Agent")}),t.jsx("span",{className:Q("shrink-0",Ua(y.status)),children:t.jsx(Xa,{status:y.status})})]}),c&&t.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),y.sessionId&&d?.(y.sessionId)},onKeyDown:k=>k.stopPropagation(),className:"hidden shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground/80 group-hover:inline-flex",title:u("View log"),"aria-label":`${u("View log")} ${b?.name??u("Agent")}`,children:t.jsx(As,{size:13})}),l&&t.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),o(y.id)},onKeyDown:k=>k.stopPropagation(),disabled:g,className:"shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive-ink disabled:cursor-not-allowed disabled:opacity-50",title:u("Stop"),"aria-label":`${u("Stop")} ${b?.name??u("Agent")}`,children:t.jsx(qt,{size:12})})]}),l&&h&&b&&t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-t border-border/60 bg-background px-3 py-2",children:[t.jsx("span",{className:"mr-1 text-xs text-foreground/70",children:u("Stop running work?")}),t.jsxs(me,{type:"button",size:"xs",variant:"outline",disabled:g,onClick:()=>v(b.id,!1),children:[t.jsx(qt,{size:11}),t.jsx("span",{children:u(g?"Stopping":"Stop only")})]}),t.jsxs(me,{type:"button",size:"xs",variant:"outline",disabled:g,className:"border-destructive/25 bg-destructive/10 text-destructive-ink hover:bg-destructive/15 hover:text-destructive-ink",onClick:()=>v(b.id,!0),children:[t.jsx(wi,{size:11}),t.jsx("span",{children:u(g?"Stopping":"Stop + clear queue")})]})]})]},y.id)})})]})}const Ns=Fs(),Va=240;function ls(e,i){return{id:i.clientSubmissionId??qr(),submissionInput:i,teamRunId:e,senderType:i.senderType??"user",senderId:i.senderId??null,senderInvocationId:i.senderInvocationId??null,kind:i.kind??((i.mentions?.length??0)>0?"work_request":"chat"),visibility:"PUBLIC",content:i.content,mentions:i.mentions??[],workRequestIds:[],artifactRefs:i.artifactRefs??[],attachmentIds:i.attachmentIds??[],createdAt:new Date().toISOString(),pendingStatus:"sending"}}function Xt(e){return"pendingStatus"in e}function Ga(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function Qa(e){if(!e)return"";const i=new Date(e);return Number.isNaN(i.getTime())?"":i.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function qs(e,i){return e instanceof Error?e.message:i}function Za(e,i=Va){const n=(e??"").replace(/\s+/g," ").trim();return n.length<=i?n:`${n.slice(0,i-3).trimEnd()}...`}function Ja(e,i){const d=e.slice(0,i).match(/(^|\s)@([^\s@]*)$/);return!d||d.index==null?null:{start:d.index+d[1].length,end:i,query:d[2]??""}}function el(e,i){const n=i.trim().toLowerCase();return n?[e.name,e.providerId,...e.aliases??[]].some(v=>v.toLowerCase().includes(n)):!0}function lr(e){return e.membershipStatus!=="REMOVED"}function tl(e,i){return e.label??i.get(e.memberId)?.name??e.memberId}function sl(e,i){return(e.recipientMemberIds??[]).map(n=>i.get(n)?.name??n)}function rl(e,i){const n=e.mentions??[],d=e.contentPreview??e.content;if(n.length===0)return d;const v=n.map(C=>tl(C,i)).filter(C=>C&&!d.includes(`@${C}`));if(v.length===0)return d;const _=v.map(C=>`@${C}`).join(" ");return d.trimEnd()?`${d.trimEnd()} ${_}`:_}function il(e,i,n){if(e.senderType!=="agent")return null;if(e.senderId&&i.has(e.senderId))return i.get(e.senderId)??null;if(e.senderInvocationId){const d=n.get(e.senderInvocationId);if(d?.memberId&&i.has(d.memberId))return i.get(d.memberId)??null}return null}function ji({content:e,workingDir:i,onOpenWorkspaceFile:n,onOpenPreviewUrl:d,onOpenVisualization:v,downloadSessionId:_}){const C=N.useMemo(()=>v||_?Vn(e):e,[e,_,v]),r=Gn(C),o=N.useMemo(()=>Qn({workingDir:i,onOpenWorkspaceFile:n,onOpenPreviewUrl:d,onOpenVisualization:v,downloadSessionId:_}),[_,d,v,n,i]);return t.jsx("div",{className:Q("team-room-message-markdown prose prose-sm max-w-none break-words [overflow-wrap:anywhere]","prose-p:my-2 prose-p:first:mt-0 prose-p:last:mb-0 prose-p:leading-6","prose-ul:my-2 prose-ol:my-2 prose-li:my-1 prose-li:pl-0 prose-li:leading-6 prose-li:marker:text-muted-foreground","prose-blockquote:my-2 prose-blockquote:border-l-2 prose-blockquote:border-border prose-blockquote:pl-3 prose-blockquote:text-foreground/70","prose-pre:my-3 prose-pre:max-w-full prose-pre:overflow-x-auto prose-pre:rounded-md prose-pre:border prose-pre:border-border/60 prose-pre:bg-foreground/[0.025] prose-pre:p-3 prose-pre:text-xs prose-pre:leading-relaxed","prose-code:break-words prose-code:rounded prose-code:bg-muted prose-code:px-1 prose-code:py-0.5 prose-code:text-[0.9em] prose-code:font-medium prose-code:text-foreground","prose-pre:prose-code:bg-transparent prose-pre:prose-code:p-0 prose-pre:prose-code:text-foreground","prose-headings:mb-2 prose-headings:mt-3 prose-headings:font-semibold prose-headings:leading-snug","prose-hr:my-3 prose-hr:border-border","text-foreground prose-strong:text-foreground"),children:t.jsx(Zn,{components:o,plugins:r,controls:r?Jn:void 0,children:C})})}function nl({hasAttachmentIds:e,attachments:i,isLoading:n,onOpenImage:d}){if(!e)return null;if(n&&i.length===0)return t.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:"Loading attachments..."});if(i.length===0)return null;const v=i.filter(C=>C.mimeType.startsWith("image/")),_=new Map(v.map((C,r)=>[C.id,r]));return t.jsx("div",{className:"mt-3 flex flex-wrap gap-2 text-foreground/80",children:i.map(C=>{const r=`${Ns}${C.url}`;if(C.mimeType.startsWith("image/")){const u=_.get(C.id)??0;return t.jsxs("button",{type:"button",onClick:()=>d(v,u),className:"group relative h-24 w-24 overflow-hidden rounded-lg border border-border bg-muted/50 shadow-raised transition-opacity hover:opacity-90",title:C.originalName,children:[t.jsx("img",{src:r,alt:C.originalName,className:"h-full w-full object-cover",loading:"lazy"}),t.jsx("span",{className:"absolute inset-x-0 bottom-0 truncate bg-inverse/60 px-1.5 py-1 text-left text-[11px] text-inverse-foreground",children:C.originalName})]},C.id)}return t.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"flex max-w-[220px] items-center gap-2 rounded-lg border border-border bg-background px-3 py-2 text-xs text-foreground/80 shadow-raised hover:bg-accent",title:C.originalName,children:[t.jsx(uo,{size:16,className:"shrink-0 text-muted-foreground/70","aria-hidden":!0}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate font-medium",children:C.originalName}),t.jsx("span",{className:"text-muted-foreground",children:Ga(C.sizeBytes)})]}),t.jsx(Is,{size:13,className:"shrink-0 text-muted-foreground/70","aria-hidden":!0})]},C.id)})})}function Ti({message:e,content:i,attachmentIds:n,isUser:d,tone:v,onOpenImage:_,workingDir:C,onOpenWorkspaceFile:r,onOpenPreviewUrl:o,onOpenVisualization:u,downloadSessionId:f,textVersion:a}){const p=N.useMemo(()=>Array.from(new Set(n??[])),[n]),{data:m=[],isLoading:y}=ao(p),b=m.length>0?Wt(i,m):i;return t.jsxs(t.Fragment,{children:[b.trim()&&t.jsx(al,{message:e,content:b,attachments:m,isUser:d,tone:v,workingDir:C,onOpenWorkspaceFile:r,onOpenPreviewUrl:o,onOpenVisualization:u,downloadSessionId:f,textVersion:a}),t.jsx(nl,{hasAttachmentIds:p.length>0,attachments:m,isLoading:y,onOpenImage:_})]})}function ol({images:e,index:i,onClose:n,onSelect:d}){const v=e[i];if(!v)return null;const _=i>0,C=i<e.length-1;return t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-inverse/90 p-4",role:"dialog","aria-modal":"true",children:[t.jsx("button",{type:"button",onClick:n,className:"absolute right-4 top-4 rounded-full bg-inverse-foreground/10 p-2 text-inverse-foreground transition-colors hover:bg-inverse-foreground/20","aria-label":"Close image preview",children:t.jsx(Qe,{size:20})}),_&&t.jsx("button",{type:"button",onClick:()=>d(i-1),className:"absolute left-4 top-1/2 flex h-10 w-10 -translate-y-1/2 items-center justify-center rounded-full bg-inverse-foreground/10 text-inverse-foreground transition-colors hover:bg-inverse-foreground/20","aria-label":"Previous image",children:t.jsx(Qo,{size:24,"aria-hidden":!0})}),t.jsxs("div",{className:"flex max-h-full max-w-full flex-col items-center gap-3",children:[t.jsx("img",{src:`${Ns}${v.url}`,alt:v.originalName,className:"max-h-[82vh] max-w-[92vw] rounded-lg object-contain"}),t.jsxs("div",{className:"flex items-center gap-3 text-sm text-inverse-foreground",children:[t.jsx("span",{className:"max-w-[70vw] truncate",children:v.originalName}),t.jsxs("a",{href:`${Ns}${v.url}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded-md bg-inverse-foreground/10 px-2 py-1 text-xs hover:bg-inverse-foreground/20",children:[t.jsx(Is,{size:13,"aria-hidden":!0}),"Open"]})]})]}),C&&t.jsx("button",{type:"button",onClick:()=>d(i+1),className:"absolute right-4 top-1/2 flex h-10 w-10 -translate-y-1/2 items-center justify-center rounded-full bg-inverse-foreground/10 text-inverse-foreground transition-colors hover:bg-inverse-foreground/20","aria-label":"Next image",children:t.jsx(Ye,{size:24,"aria-hidden":!0})})]})}const Ai=N.createContext(null);function al({message:e,content:i,attachments:n,isUser:d,tone:v=d?"user":"agent",workingDir:_,onOpenWorkspaceFile:C,onOpenPreviewUrl:r,onOpenVisualization:o,downloadSessionId:u,textVersion:f}){const{t:a}=re(),p=N.useId(),m=N.useRef(null),y=N.useContext(Ai),[b,s]=N.useState(()=>y?.get(e.id)??null),c=N.useCallback(T=>{T.expanded?y?.set(e.id,T):y?.delete(e.id),s(T)},[y,e.id]),[l,h]=N.useState(!1),[g,S]=N.useState(null),k=Yr(e.teamRunId,e.id,!1),E=f?f.full:k.data?.content,x=E?Wt(E,n):void 0,A=!!(x&&x!==i)?x:i,L=!!((f?f.truncated:e.isTruncated)&&!Xt(e)),R=b?.messageId===e.id&&b.content===A&&b.expanded,M=N.useCallback(()=>{const T=m.current;T&&h(Ia(T.scrollHeight))},[]);N.useLayoutEffect(()=>{M();const T=m.current;if(!T)return;const O=window.requestAnimationFrame(M),D=typeof ResizeObserver>"u"?null:new ResizeObserver(M);return D?.observe(T),window.addEventListener("resize",M),()=>{window.cancelAnimationFrame(O),D?.disconnect(),window.removeEventListener("resize",M)}},[A,M]);const I=N.useCallback(async()=>{if(S(null),R){c({messageId:e.id,content:A,expanded:!1});return}if(L&&!E){if(f){try{const D=await f.load();c({messageId:e.id,content:Wt(D,n),expanded:!0})}catch{S(a("Failed to load full message"))}return}const T=await k.refetch();if(T.error){S(qs(T.error,a("Failed to load full message")));return}const O=T.data?.content?Wt(T.data.content,n):A;c({messageId:e.id,content:O,expanded:!0});return}c({messageId:e.id,content:A,expanded:!0})},[n,L,E,k,R,e.id,A,c,a,f]),P=(l||L)&&!R,H=l||L,$=f?f.loading:k.isFetching;return t.jsxs("div",{className:"relative",children:[t.jsxs("div",{id:p,ref:m,onLoadCapture:M,className:Q("relative transition-[max-height] duration-200 ease-out",P?"overflow-hidden":""),style:P?{maxHeight:Ei}:void 0,children:[t.jsx(ji,{content:A,isUser:d,workingDir:_,onOpenWorkspaceFile:C,onOpenPreviewUrl:r,onOpenVisualization:o,downloadSessionId:u}),P&&t.jsx("div",{className:Q("pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-b from-transparent",v==="system"?"to-[color-mix(in_oklab,var(--color-warning)_8%,var(--color-background))]":v==="user"?"to-[color-mix(in_oklab,var(--color-foreground)_8%,var(--color-background))]":"to-background")})]}),H&&t.jsxs("button",{type:"button","aria-expanded":R,"aria-controls":p,"aria-label":a(R?"Collapse message":"Expand full message"),disabled:$,onClick:()=>{I()},className:Q("mt-2 inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",v==="system"?"bg-warning/10 text-warning-ink hover:bg-warning/20":v==="user"?"bg-background/70 text-foreground/70 hover:bg-background hover:text-foreground":"bg-muted text-foreground/70 hover:bg-foreground/10 hover:text-foreground",$?"cursor-wait opacity-70":""),children:[R?t.jsx(ai,{size:13}):t.jsx(ze,{size:13}),t.jsx("span",{children:a($?"Loading":R?"Collapse message":"Expand full message")})]}),g&&t.jsx("div",{className:Q("mt-1 text-xs","text-destructive-ink"),children:g})]})}function Ni({senderName:e,avatar:i,createdAt:n,isUser:d,isSystem:v,children:_,headerAddon:C,footer:r,bubbleClassName:o,isPending:u}){return v?t.jsx("div",{className:"flex justify-center",children:t.jsx("div",{className:"max-w-[min(100%,42rem)] rounded-lg border border-warning/25 bg-warning/10 px-3 py-2 text-xs text-warning-ink shadow-raised",children:_})}):t.jsxs("div",{className:Q("group flex items-start gap-3",d?"justify-end pl-8 sm:pl-14":"justify-start pr-8 sm:pr-14"),children:[!d&&t.jsx(He,{name:e,avatar:i??null,className:"mt-0.5 h-8 w-8 text-[11px]"}),t.jsxs("div",{className:Q("flex min-w-0 max-w-[min(86%,46rem)] flex-col",d?"items-end":"items-start"),children:[t.jsxs("div",{className:Q("mb-1.5 flex max-w-full items-center gap-1.5 px-0.5 text-xs text-muted-foreground",d?"justify-end":"justify-start"),children:[t.jsx("span",{className:"truncate font-semibold text-foreground/80",children:e}),t.jsx("span",{className:"h-1 w-1 rounded-full bg-foreground/15","aria-hidden":!0}),t.jsx(qe,{size:11,className:"text-muted-foreground/70"}),t.jsx("span",{className:"shrink-0",children:Qa(n)}),C]}),t.jsx("div",{className:Q("max-w-full rounded-lg px-3.5 py-3 text-sm leading-6 transition-colors",d?"rounded-tr-[4px] bg-foreground/[0.08] text-foreground":"rounded-tl-[4px] border border-border/70 bg-background text-foreground",o,u?"opacity-70":""),children:_}),r&&t.jsx("div",{className:"mt-1 max-w-full px-0.5","data-message-feedback":!0,children:r})]}),d&&t.jsx(He,{name:e,avatar:null,className:"mt-0.5 h-8 w-8 text-[11px]"})]})}function ll({provider:e}){return t.jsxs("span",{className:"ml-0.5 inline-flex max-w-[10rem] shrink items-center gap-1 rounded-full bg-foreground/5 px-1.5 py-0.5 text-xs font-medium leading-none text-muted-foreground",children:[t.jsx(Gt,{agentType:e.agentType,className:"size-2.5"}),t.jsx("span",{className:"truncate",children:e.name})]})}function cl({overlay:e,translations:i,enabled:n,body:d}){const{t:v}=re(),[_,C]=N.useState(null),[r,o]=N.useState(!1),[u,f]=N.useState(null),a=N.useRef(null),p=N.useRef(!0);N.useEffect(()=>(p.current=!0,()=>{p.current=!1}),[]);const m=()=>p.current&&i.isCurrent(e),y=async()=>{if(!m())throw new DOMException("Aborted","AbortError");return _||(a.current||(o(!0),f(null),a.current=i.loadFull(e).then(g=>{if(!m())throw new DOMException("Aborted","AbortError");if(!d.message.isTruncated&&d.message.contentMode==="full"&&d.message.content!==g.originalText)throw new Error("Message changed");return C(g),g}).catch(g=>{throw m()&&f(v("Failed to load full message")),g}).finally(()=>{a.current=null,p.current&&o(!1)})),a.current)},b=e.state==="SUCCESS"&&e.translatedTextPreview!==null,s=_?.originalText??e.originalTextPreview,c=_?.translatedText??e.translatedTextPreview??"",l=async()=>e.originalTextTruncated?(await y()).originalText:s,h=async()=>b?e.translatedTextTruncated?(await y()).translatedText??"":c:l();return t.jsxs("div",{className:`relative ${e.state==="NOT_REQUIRED"?"":"pr-8"}`,children:[t.jsx(Ti,{...d,content:b?c:d.content,textVersion:b?{kind:"translated",truncated:e.translatedTextTruncated,full:_?.translatedText??void 0,loading:r,load:h}:void 0}),e.state!=="NOT_REQUIRED"&&t.jsx("div",{className:"absolute bottom-0 right-0",children:t.jsxs(ii,{original:s,getOriginal:l,canCopy:m,onOpen:()=>{e.originalTextTruncated&&y().catch(()=>{})},loading:r,error:u,children:[t.jsx(ji,{content:s,workingDir:d.workingDir,onOpenWorkspaceFile:d.onOpenWorkspaceFile,onOpenPreviewUrl:d.onOpenPreviewUrl,onOpenVisualization:d.onOpenVisualization,downloadSessionId:d.downloadSessionId}),t.jsx(Yn,{state:e.state,errorCode:e.errorCode,enabled:n,onRetry:()=>i.retry(e)})]})})]})}function dl({message:e,senderName:i,senderMember:n,senderProvider:d,memberById:v,displayContent:_,onOpenImage:C,workingDir:r,onOpenWorkspaceFile:o,onOpenPreviewUrl:u,onOpenVisualization:f,previewWorkspaceId:a,previewSessionId:p,overlay:m,translations:y,translationEnabled:b,delivery:s,onRetrySubmission:c}){const{t:l}=re(),h=e.senderType==="user",g=e.senderType==="system",S=!s&&Xt(e)?e.pendingStatus:null,k=e.mentions??[],E=e.workRequestIds?.length??0,x=e.visibility==="PRIVATE",w=N.useCallback(I=>{u?.(I,a)},[u,a]),A=N.useCallback(I=>{p&&f?.(p,I,a)},[f,p,a]),L=x?sl(e,v):[],R={message:e,content:_,attachmentIds:e.attachmentIds,isUser:h&&S!=="failed",tone:g?"system":void 0,onOpenImage:C,workingDir:r,onOpenWorkspaceFile:o,onOpenPreviewUrl:u?w:void 0,onOpenVisualization:f&&p?A:void 0,downloadSessionId:p},M=t.jsxs(t.Fragment,{children:[!h&&!g&&d&&t.jsx(ll,{provider:d}),x&&t.jsxs("span",{className:"ml-0.5 inline-flex max-w-[18rem] shrink items-center gap-1 rounded-full bg-foreground/[0.06] px-1.5 py-0.5 text-xs font-medium leading-none text-foreground/70",title:L.join(", "),children:[t.jsx(Rn,{size:10}),t.jsxs("span",{className:"truncate",children:[l("Private"),L.length>0?`: ${L.join(", ")}`:""]})]}),!g&&E>0&&k.length===0&&t.jsxs("span",{className:"ml-0.5 shrink-0 rounded-full bg-foreground/[0.08] px-1.5 py-0.5 text-xs font-medium leading-none text-foreground/70",children:[l("Work requests"),": ",E]}),S==="failed"&&t.jsx("span",{className:"ml-0.5 shrink-0 rounded-full bg-destructive/10 px-1.5 py-0.5 text-xs font-medium leading-none text-destructive-ink",children:l("Acceptance unknown")})]});return t.jsx(Ni,{senderName:i,avatar:n?.avatar??null,createdAt:e.createdAt,isUser:h,isSystem:g,headerAddon:M,bubbleClassName:h&&S==="failed"?"border border-destructive/25 bg-destructive/10 text-destructive-ink":void 0,isPending:S==="sending",footer:s||e.userDelivery||S==="failed"?t.jsxs(t.Fragment,{children:[s&&t.jsx(ri,{delivery:s}),e.userDelivery&&!s&&t.jsx(hl,{message:e}),S==="failed"&&!s&&t.jsxs("div",{className:"text-xs",children:[t.jsx("p",{children:l("Acceptance unknown; check or retry the same submission.")}),Xt(e)&&e.error&&t.jsx("p",{children:e.error}),t.jsx("button",{type:"button",className:"underline",onClick:c,children:l("Retry original submission")})]})]}):void 0,children:t.jsx(Xn,{claim:y.claimReveal,version:m?.state==="SUCCESS"?`${m.sourceId}:${m.sourceRevision}`:null,children:m?t.jsx(cl,{overlay:m,translations:y,enabled:b,body:R},`${m.sourceId}:${m.sourceRevision}:${m.overlayRevision}`):t.jsx(Ti,{...R})})})}function hl({message:e}){const i=Yr(e.teamRunId,e.id,!1),n=e.userDelivery;if(n.sentMode!=="TRANSLATED")return null;const d=i.data?.userDelivery?.actualSentText??n.actualSentText??"",v=async()=>{if(!n.isTruncated)return d;const _=await i.refetch();if(_.error||!_.data?.userDelivery)throw new Error("Failed to load sent text");return _.data.userDelivery.actualSentText??""};return t.jsx(ii,{label:"Actual sent text",original:d,getOriginal:v,onOpen:()=>{n.isTruncated&&i.refetch()},loading:i.isFetching,error:i.error?.message,children:t.jsx("pre",{className:"whitespace-pre-wrap",children:d})})}function ul({request:e,member:i,onApprove:n,onReject:d,isActionPending:v,isApprovePending:_,isRejectPending:C}){const{t:r}=re();return t.jsx(Ni,{senderName:i?.name??r("Agent"),avatar:i?.avatar??null,createdAt:e.createdAt,bubbleClassName:"border border-warning/25 bg-warning/8",children:t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-warning/25 bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning-ink",children:[t.jsx(qe,{size:11}),r("Pending approval")]}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[r("Requester"),": ",r(e.requesterType==="user"?"User":e.requesterType==="system"?"System":"Agent")]})]}),t.jsx("div",{className:"text-sm leading-6 text-foreground [overflow-wrap:anywhere]",children:e.instructionPreview??Za(e.instruction)}),t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[t.jsxs(me,{type:"button",size:"xs",variant:"outline",disabled:v,className:"border-success/25 bg-success/10 text-success-ink hover:bg-success/15 hover:text-success-ink",onClick:n,children:[t.jsx(kt,{size:12}),t.jsx("span",{children:r(_?"Approving":"Approve")})]}),t.jsxs(me,{type:"button",size:"xs",variant:"outline",disabled:v,onClick:d,children:[t.jsx(Qe,{size:12}),t.jsx("span",{children:r(C?"Rejecting":"Reject")})]})]})]})})}const fl=N.memo(function({teamRun:i,messages:n,timelineItems:d,recovered:v,scrollElementRef:_,compact:C,onRetrySubmission:r,onOpenImage:o,workingDir:u,onOpenWorkspaceFile:f,onOpenPreviewUrl:a,onOpenVisualization:p}){const{t:m}=re(),y=Kr(i.id),b=Da(i.id,n),{data:s}=oi(),c=new Map(b.overlays.map(L=>[L.messageId,L])),l=Xr(i.id),{data:h}=zs(),g=N.useMemo(()=>{const L=new Map;for(const R of h??[])L.set(R.provider.id,R.provider);return L},[h]),S=N.useMemo(()=>new Map((i.members??[]).map(L=>[L.id,L])),[i.members]),k=N.useMemo(()=>new Map((i.invocations??[]).map(L=>[L.id,L])),[i.invocations]),E=y.isError?y.error:l.isError?l.error:null,x=y.isPending||l.isPending,[w]=N.useState(()=>new Map);N.useEffect(()=>{const L=new Set(n.map(R=>R.id));for(const R of w.keys())L.has(R)||w.delete(R)},[w,n]);const A=L=>{if(L.kind==="pendingApproval"){const D=L.request,B=S.get(D.targetMemberId),q=y.isPending&&y.variables===D.id,K=l.isPending&&l.variables===D.id;return t.jsx(ul,{request:D,member:B,onApprove:()=>y.mutate(D.id),onReject:()=>l.mutate(D.id),isActionPending:x,isApprovePending:q,isRejectPending:K},L.key)}const R=L.message,M=il(R,S,k),I=R.senderType==="user"?m("你"):R.senderType==="system"?m("System"):M?.name??m("Agent"),P=rl(R,S),H=M?.providerId?g.get(M.providerId)??null:null,$=R.senderInvocationId?k.get(R.senderInvocationId):void 0,T=$?.workspaceId??void 0,O=$?.sessionId??void 0;return t.jsx(dl,{message:R,senderName:I,senderMember:M,senderProvider:H,memberById:S,displayContent:P,overlay:c.get(R.id),translations:b,translationEnabled:s?.enabled===!0,delivery:v.get(R.userDelivery?.clientSubmissionId??R.id),onRetrySubmission:Xt(R)?()=>r(R):void 0,onOpenImage:o,workingDir:u,onOpenWorkspaceFile:f,onOpenPreviewUrl:a,onOpenVisualization:p,previewWorkspaceId:T,previewSessionId:O},L.key)};return t.jsxs(Ai.Provider,{value:w,children:[d.length===0?t.jsxs("div",{className:"flex min-h-[180px] flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border bg-background text-muted-foreground",children:[t.jsx(gt,{size:24,className:"text-muted-foreground/70"}),t.jsx("span",{className:"text-sm",children:m("No room messages yet")})]}):t.jsx(Na,{items:d,renderItem:A,scrollElementRef:_,compact:C}),E&&t.jsx("div",{className:"rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-ink",children:qs(E,m("Failed to update work request"))})]})});function Tf({teamRun:e,messages:i,readOnly:n,readOnlyMessage:d,onSendMessage:v,onViewInvocationSession:_,changeSummaryBar:C,compactComposer:r,centered:o,workingDir:u,onOpenWorkspaceFile:f,onOpenPreviewUrl:a,onOpenVisualization:p}){const{t:m}=re(),y=Ur(e.id),[b,s]=N.useState(""),[c,l]=N.useState(!1),[h,g]=N.useState(null),[S,k]=N.useState(0),[E,x]=N.useState([]),[w,A]=N.useState(!1),L=ks(n?"":`task:${e.taskId}`,"pending","TEAM_TASK"),R=ks(n?"":`task:${e.taskId}`,"sent","TEAM_TASK"),M=N.useMemo(()=>new Map([...L.data?.pages.flatMap(V=>V.items)??[],...R.data?.pages.flatMap(V=>V.items)??[]].filter(V=>V.destination.kind==="TEAM_ROOM"&&V.destination.teamRunId===e.id).sort((V,te)=>V.revision-te.revision).map(V=>[V.clientSubmissionId,V])),[L.data,R.data,e.id]),[I,P]=N.useState([]),[H,$]=N.useState(null),T=N.useRef(null),O=N.useRef(null),{files:D,addFiles:B,removeFile:q,clear:K,buildMarkdownLinks:U,getDoneAttachments:z,isUploading:W}=no(),j=D.some(V=>V.status==="done"&&V.attachment),[F,X]=N.useState(null),{scrollRef:Y,contentRef:ee,isAtBottom:G,scrollToBottom:J}=fo({resize:"instant",initial:"instant"}),ie=N.useRef(!1),Z=N.useRef(null),ce=N.useRef(e.id),se=N.useCallback(()=>(ie.current=!1,J({animation:"instant",ignoreEscapes:!0})),[J]);N.useEffect(()=>{if(ce.current===e.id)return;ce.current=e.id;const V=requestAnimationFrame(()=>{se()});return()=>cancelAnimationFrame(V)},[se,e.id]),N.useEffect(()=>{const V=Y.current;if(!V)return;const te=ne=>{if(ne.deltaY<0){ie.current=!0;return}ne.deltaY>0&&V.scrollHeight-V.scrollTop-V.clientHeight<=70&&(ie.current=!1)};return V.addEventListener("wheel",te,{passive:!0}),()=>V.removeEventListener("wheel",te)},[Y]);const we=N.useMemo(()=>new Map((e.members??[]).map(V=>[V.id,V])),[e.members]),Me=N.useMemo(()=>(e.members??[]).filter(lr),[e.members]),We=N.useMemo(()=>new Set([...i.flatMap(V=>V.userDelivery?[V.userDelivery.clientSubmissionId]:[]),...L.data?.pages.flatMap(V=>V.items.map(te=>te.clientSubmissionId))??[]]),[i,L.data]);N.useEffect(()=>{for(const V of We)jn(e.id,V);P(V=>V.some(te=>We.has(te.id))?V.filter(te=>!We.has(te.id)):V)},[We,e.id]);const lt=N.useMemo(()=>{const V=new Set(i.map(le=>le.id)),te=new Set(i.flatMap(le=>le.userDelivery?[le.userDelivery.clientSubmissionId]:[])),ne=[...M.values()].filter(le=>le.state!=="CANCELLED"&&!te.has(le.clientSubmissionId)).map(le=>({...ls(e.id,{content:le.originalText,clientSubmissionId:le.clientSubmissionId,attachmentIds:le.attachmentIds}),pendingStatus:"sending",createdAt:le.createdAt})),xe=I.filter(le=>!V.has(le.id)&&!te.has(le.id)&&!M.has(le.id));return[...i,...ne,...xe].sort((le,ye)=>Date.parse(le.createdAt??"")-Date.parse(ye.createdAt??""))},[i,I,M,e.id]),ct=N.useMemo(()=>new Map((e.workRequests??[]).map(V=>[V.id,V])),[e.workRequests]),Se=N.useMemo(()=>Wa(lt,e.workRequests??[],e.invocations??[]),[lt,e.invocations,e.workRequests]);N.useEffect(()=>{const V=Se.at(-1)?.key??null,te=Z.current;if(Z.current=V,te==null||V==null||V===te||ie.current)return;const ne=requestAnimationFrame(()=>{J({animation:"instant",preserveScrollPosition:!0})});return()=>cancelAnimationFrame(ne)},[J,Se]);const Je=N.useMemo(()=>(e.invocations??[]).filter(V=>Zt.has(V.status)),[e.invocations]),be=N.useMemo(()=>E.map(V=>we.get(V)).filter(V=>!!V).filter(lr),[we,E]),Ce=N.useMemo(()=>{const V=h?.query??"";return Me.filter(te=>el(te,V)).sort((te,ne)=>{const xe=E.includes(te.id),le=E.includes(ne.id);return xe!==le?xe?1:-1:te.name.localeCompare(ne.name)})},[Me,h?.query,E]),et=!n&&(c||!!h)&&Ce.length>0,Ee=N.useCallback((V,te)=>{if(te==null){g(null);return}g(Ja(V,te)),k(0)},[]),tt=N.useCallback(V=>{x(ye=>Fa(ye,V.id));const te=`@${V.name} `;if(h){const ye=`${b.slice(0,h.start)}${te}${b.slice(h.end)}`,dt=h.start+te.length;s(ye),g(null),l(!1),requestAnimationFrame(()=>{T.current?.focus(),T.current?.setSelectionRange(dt,dt)});return}const ne=b.length===0||/\s$/.test(b)?"":" ",xe=`${b}${ne}${te}`,le=xe.length;s(xe),l(!1),requestAnimationFrame(()=>{T.current?.focus(),T.current?.setSelectionRange(le,le)})},[b,h]),De=N.useCallback(V=>{x(te=>Ha(te,V))},[]),st=N.useCallback(V=>{const te=V.target.value;s(te);const ne=V.target;ne.style.height="auto",ne.style.height=`${Math.max(r?40:72,Math.min(ne.scrollHeight,r?140:240))}px`,l(!1),Ee(te,ne.selectionStart)},[r,Ee]),he=N.useCallback(V=>{const te=V.target.files;te&&te.length>0&&B(Array.from(te)),V.target.value=""},[B]),rs=N.useCallback(V=>{const te=[];for(const ne of V.clipboardData.items)if(ne.kind==="file"){const xe=ne.getAsFile();xe&&te.push(xe)}te.length>0&&(V.preventDefault(),B(te))},[B]),is=N.useCallback(async()=>{if(n||w||W)return;const V=U(),te=z().map(ye=>ye.id),ne=za(E,Me),xe=Aa({draft:b,attachmentMarkdown:V,attachmentIds:te,mentions:ne});if(!xe||!b.trim()&&!j)return;xe.clientSubmissionId=qr();const le=ls(e.id,xe);P(ye=>[...ye,le]),s(""),x([]),l(!1),g(null),K(),T.current&&(T.current.style.height=r?"40px":"72px"),requestAnimationFrame(()=>se()),A(!0);try{const ye=await v(xe);P(dt=>dt.filter(ns=>ns.id!==le.id)),ye&&typeof ye=="object"&&"id"in ye&&requestAnimationFrame(()=>se())}catch(ye){const dt=ye instanceof Error?ye.message:"Failed to send room message";P(ns=>ns.map(os=>os.id===le.id?{...os,pendingStatus:"failed",error:dt}:os)),requestAnimationFrame(()=>se())}finally{A(!1)}},[Me,U,K,r,b,z,j,w,W,se,v,n,E,e.id]),xn=N.useCallback(V=>{const te=V.nativeEvent.isComposing||V.nativeEvent.keyCode===229;if(et){if(V.key==="ArrowDown"){V.preventDefault(),k(ne=>(ne+1)%Ce.length);return}if(V.key==="ArrowUp"){V.preventDefault(),k(ne=>(ne-1+Ce.length)%Ce.length);return}if(V.key==="Enter"&&!te||V.key==="Tab"){V.preventDefault();const ne=Ce[S]??Ce[0];ne&&tt(ne);return}if(V.key==="Escape"){V.preventDefault(),g(null),l(!1);return}}V.key==="Enter"&&!V.shiftKey&&!V.repeat&&!te&&(V.preventDefault(),is())},[tt,is,S,Ce,et]);N.useEffect(()=>{s(""),x([]),l(!1),g(null),P(Tn(e.id).map(V=>({...ls(e.id,V),pendingStatus:"failed",error:"Acceptance unknown; check or retry the same submission."}))),K(),ie.current=!1,Z.current=null,$(null),T.current&&(T.current.style.height=r?"40px":"72px")},[K,r,e.id]);const Sn=N.useCallback((V,te)=>{X({images:V,index:te})},[]),yn=N.useCallback(V=>{w||(A(!0),v(V.submissionInput).then(()=>P(te=>te.filter(ne=>ne.id!==V.id))).finally(()=>A(!1)).catch(()=>{}))},[w,v]),wn=N.useCallback((V,te)=>{y.mutate({memberId:V,cancelQueued:te},{onSuccess:()=>$(null)})},[y]);return t.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[F&&t.jsx(ol,{images:F.images,index:F.index,onClose:()=>X(null),onSelect:V=>X(te=>te&&{...te,index:V})}),t.jsxs("div",{className:"relative flex-1 min-h-0",children:[t.jsx("div",{ref:Y,"data-room-scroll":!0,className:Q("h-full overflow-y-auto scrollbar-app-thin bg-background",r?"px-3 py-3":"px-4 py-4"),children:t.jsxs("div",{ref:ee,className:Q(r?"space-y-2.5":"space-y-3",o&&"max-w-4xl mx-auto"),children:[t.jsx(fl,{teamRun:e,messages:i,timelineItems:Se,recovered:M,scrollElementRef:Y,compact:r,onRetrySubmission:yn,onOpenImage:Sn,workingDir:u,onOpenWorkspaceFile:f,onOpenPreviewUrl:a,onOpenVisualization:p},e.id),t.jsx(ki,{taskId:e.taskId,teamRunId:e.id,enabled:!n,showDeliveries:!1}),y.isError&&t.jsx("div",{className:"rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-ink",children:qs(y.error,m("Failed to stop member work"))})]})}),!G&&t.jsxs("button",{type:"button",onClick:()=>se(),className:"absolute bottom-3 left-1/2 z-10 flex -translate-x-1/2 items-center gap-1.5 rounded-full border border-border bg-background/90 px-3 py-1.5 text-xs text-foreground/70 shadow-raised backdrop-blur-sm hover:bg-background hover:text-foreground transition-colors",children:[t.jsx(An,{size:14}),t.jsx("span",{children:m("Back to bottom")})]})]}),t.jsx("div",{className:Q("shrink-0 border-t border-transparent bg-background",r?"px-3 pb-2 pt-1.5":"px-6 pb-6 pt-2"),children:t.jsxs("div",{className:Q(o&&"max-w-4xl mx-auto"),children:[t.jsx(Ya,{invocations:Je,memberById:we,workRequestById:ct,onViewInvocationSession:_,onStopMember:wn,isStopPending:y.isPending,stoppingMemberId:y.variables?.memberId??null,stopPromptInvocationId:H,onToggleStopConfirm:V=>$(te=>te===V?null:V)}),!n&&C,n?t.jsx("div",{className:"rounded-xl border border-border bg-muted/50 px-4 py-3 text-sm text-muted-foreground",children:d??m("This project is read-only")}):t.jsxs("div",{className:"relative rounded-xl border border-border bg-background shadow-raised transition-all duration-200 hover:shadow-raised focus-within:border-ring focus-within:shadow-raised",children:[et&&t.jsxs("div",{className:"absolute bottom-full left-3 z-20 mb-2 w-[min(24rem,calc(100vw-3rem))] overflow-hidden rounded-xl border border-border bg-background shadow-popover",children:[t.jsx("div",{className:"border-b border-border/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:m(h?"Mention members":"Team members")}),t.jsx("div",{className:"max-h-64 overflow-y-auto p-1",children:Ce.map((V,te)=>{const ne=E.includes(V.id),xe=te===S;return t.jsxs("button",{type:"button",onMouseEnter:()=>k(te),onMouseDown:le=>{le.preventDefault(),tt(V)},className:Q("flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left transition-colors",xe?"bg-muted":"hover:bg-accent"),children:[t.jsx(He,{name:V.name,avatar:V.avatar,className:"h-8 w-8 text-[11px]"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:V.name}),ne&&t.jsx("span",{className:"rounded-full bg-primary px-1.5 py-0.5 text-xs font-medium text-primary-foreground",children:m("selected")})]}),t.jsx("div",{className:"truncate text-xs text-muted-foreground",children:[V.providerId,V.id.slice(0,8)].filter(Boolean).join(" · ")})]}),t.jsx(rr,{size:15,className:"text-muted-foreground/70"})]},V.id)})})]}),be.length>0&&t.jsx("div",{className:"flex flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-2",children:be.map(V=>t.jsxs("span",{className:"inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted/50 px-2 py-1 text-xs text-foreground/80",children:[t.jsxs("span",{className:"truncate font-medium",children:["@",V.name]}),t.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:V.id.slice(0,8)}),t.jsx("button",{type:"button",onClick:()=>De(V.id),className:"shrink-0 rounded-full p-0.5 text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground/80",title:m("Remove mention"),"aria-label":`${m("Remove mention")} ${V.name}`,children:t.jsx(Qe,{size:12})})]},V.id))}),t.jsx(oo,{files:D,onRemove:q}),t.jsx("textarea",{ref:T,value:b,rows:r?1:void 0,onChange:st,onKeyDown:xn,onPaste:rs,onClick:V=>Ee(b,V.currentTarget.selectionStart),onSelect:V=>Ee(b,V.currentTarget.selectionStart),placeholder:m("Message the team room..."),className:Q("w-full resize-none border-none bg-transparent text-foreground placeholder:text-muted-foreground/70 focus:outline-none",r?"px-3 pb-1 pt-2.5 text-[15px] leading-5":"px-4 pb-2 pt-4 text-sm leading-relaxed"),style:r?{minHeight:40,maxHeight:140}:{minHeight:60,maxHeight:220}}),t.jsxs("div",{className:Q("flex items-center justify-between",r?"px-2 pb-1.5 pt-0.5":"px-2 pb-2 pt-1"),children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("input",{ref:O,type:"file",multiple:!0,className:"hidden",onChange:he}),t.jsx("button",{type:"button",onClick:()=>O.current?.click(),title:m("Upload file"),"aria-label":m("Upload file"),className:"rounded-lg p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground/70",children:t.jsx(ho,{size:18})}),t.jsx("button",{type:"button",onClick:()=>{l(V=>!V),g(null),requestAnimationFrame(()=>T.current?.focus())},disabled:be.length===0&&Me.length===0,title:m("Mention members"),"aria-label":m("Mention members"),className:Q("rounded-lg transition-colors",r?"p-1.5":"p-2",c?"bg-muted text-foreground/80":"text-muted-foreground hover:bg-accent hover:text-foreground/70",be.length===0&&Me.length===0?"cursor-not-allowed opacity-50":""),children:t.jsx(rr,{size:r?15:18})}),be.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[be.length," ",m("selected")]})]}),t.jsx("button",{type:"button",onClick:()=>{is()},disabled:n||w||W||!b.trim()&&!j,"aria-busy":w,title:m(W?"Uploading...":w?"发送中...":"发送"),"aria-label":m(W?"Uploading...":w?"发送中...":"发送"),className:Q("rounded-lg transition-all duration-200",r?"p-1.5":"p-2",(b.trim()||j)&&!n&&!w&&!W?"bg-primary text-primary-foreground shadow-raised hover:bg-primary":"cursor-not-allowed bg-transparent text-muted-foreground",w||W?"opacity-70":""),children:w?t.jsx(Os,{size:r?15:18,className:"animate-spin"}):t.jsx(Nn,{size:r?15:18})})]})]})]})})]})}function ml(e){return e?e.slice(0,8):""}function cr(e){const i=e?Date.parse(e):0;return Number.isNaN(i)?0:i}function Ks(e){return e?.workspaceKind===Be.MAIN_DIRECTORY}function Et(e){return e?Ks(e)?"Project directory":e.branchName:"—"}function Af(e){return e?.workingDir||e?.worktreePath||void 0}function Xs(e,i){if(!e?.length)return[];const n=new Map((i?.members??[]).map(_=>[_.id,_])),d=new Map(e.map(_=>[_.id,_])),v=i?.mainWorkspaceId??null;return e.map(_=>{const C=_.parentWorkspaceId?d.get(_.parentWorkspaceId):void 0,r=_.ownerMemberId?n.get(_.ownerMemberId):void 0,o=!!(v&&_.id===v),u=o?"main":_.parentWorkspaceId?"child":"root",f=r?.name??(_.ownerMemberId?`Member ${ml(_.ownerMemberId)}`:void 0),a=Ks(_)?"Project directory":o?"Main workspace":u==="child"?f?`${f} workspace`:"Child workspace":i?"Root workspace":"Workspace";return{workspace:_,kind:u,roleLabel:o?"Main":u==="child"?"Child":"Root",displayName:a,ownerName:f,parentBranchName:C?Et(C):void 0,isMain:o}}).sort((_,C)=>{const r=u=>u.kind==="main"?0:u.kind==="child"?1:2,o=r(_)-r(C);return o!==0?o:cr(_.workspace.createdAt)-cr(C.workspace.createdAt)})}function Nf(e,i,n){if(e?.length)return n&&e.some(d=>d.id===n)?n:i?.mainWorkspaceId&&e.some(d=>d.id===i.mainWorkspaceId)?i.mainWorkspaceId:e.find(d=>d.status===Ie.ACTIVE)?.id??e[0]?.id}function Rf(e,i){return!e||e.status!==Ie.ACTIVE||Ks(e)?!1:!i||e.parentWorkspaceId?!0:!!(i.mainWorkspaceId&&e.id===i.mainWorkspaceId)}function Lf(e,i,n){return e?.parentWorkspaceId?i?.find(v=>v.id===e.parentWorkspaceId)?.branchName??e.baseBranch??n:e?.baseBranch||n}const Ys={readRoom:!1,postRoomMessage:!1,mentionMembers:!1,stopMemberWork:!1,markReadyForReview:!1,readFiles:!1,writeFiles:!1,runCommands:!1,readDiff:!1,mergeWorkspace:!1},pl=[{key:"readRoom",label:"读房间"},{key:"postRoomMessage",label:"发房间消息"},{key:"mentionMembers",label:"提及成员"},{key:"stopMemberWork",label:"停止成员工作"},{key:"markReadyForReview",label:"标记可审查"},{key:"readFiles",label:"读文件"},{key:"writeFiles",label:"写文件"},{key:"runCommands",label:"运行命令"},{key:"readDiff",label:"读 diff"},{key:"mergeWorkspace",label:"合并工作区"}],Ri=[{value:"none",label:"无"},{value:"shared",label:"共享"},{value:"dedicated",label:"独占"}],gl=[{value:"MENTION_ONLY",label:"仅提及"},{value:"USER_MESSAGES",label:"所有用户消息"}],Li=[{value:"new_per_request",label:"每次新会话"},{value:"resume_last",label:"复用上次会话"}],vl=[{value:"own_only",label:"仅自己队列"},{value:"team_pending",label:"全队列待处理"}];function _t(){return{name:"",aliasesText:"",providerId:"",rolePrompt:"",capabilities:{...Ys},workspacePolicy:"none",triggerPolicy:"MENTION_ONLY",sessionPolicy:"new_per_request",queueManagementPolicy:"own_only",avatar:""}}function ft(e){return{name:e.name,aliasesText:(e.aliases??[]).join(", "),providerId:e.providerId,rolePrompt:e.rolePrompt,capabilities:{...Ys,...e.capabilities},workspacePolicy:e.workspacePolicy,triggerPolicy:e.triggerPolicy,sessionPolicy:e.sessionPolicy,queueManagementPolicy:e.queueManagementPolicy,avatar:e.avatar??""}}function cs(e){return{name:e.name,aliasesText:(e.aliases??[]).join(", "),providerId:e.providerId,rolePrompt:e.rolePrompt,capabilities:{...Ys,...e.capabilities},workspacePolicy:e.workspacePolicy,triggerPolicy:e.triggerPolicy,sessionPolicy:e.sessionPolicy,queueManagementPolicy:e.queueManagementPolicy,avatar:e.avatar??""}}function _l(e){return Array.from(new Set(e.split(/[\n,]/).map(i=>i.trim()).filter(Boolean)))}function bl(e){return{name:e.name.trim(),aliases:_l(e.aliasesText),providerId:e.providerId.trim(),rolePrompt:e.rolePrompt.trim(),capabilities:{...e.capabilities},workspacePolicy:e.workspacePolicy,triggerPolicy:e.triggerPolicy,sessionPolicy:e.sessionPolicy,queueManagementPolicy:e.queueManagementPolicy,avatar:e.avatar.trim()||null}}function dr(e,i){return e instanceof Error?e.message:i}function hr(e){return e.membershipStatus!=="REMOVED"}function Rs(e){return e.status==="RUNNING"||e.status==="WAITING_ROOM_REPLY"||e.status==="SESSION_ENDED"||e.status==="QUEUED"}function ur(e){return Rs(e)?"bg-success":e.status==="FAILED"?"bg-destructive":"bg-foreground/15"}function fr(e){return Ri.find(i=>i.value===e)?.label??e}function xl(e){return Li.find(i=>i.value===e)?.label??e}function Pe({children:e}){return t.jsx("span",{className:"text-xs font-medium text-foreground/70",children:e})}function mr({icon:e,title:i,description:n,action:d}){return t.jsxs("div",{className:"flex min-h-[18rem] flex-col items-center justify-center rounded-lg border border-dashed border-border bg-background px-6 py-8 text-center",children:[t.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-muted text-muted-foreground",children:e}),t.jsx("div",{className:"text-sm font-medium text-foreground",children:i}),n?t.jsx("div",{className:"mt-1 max-w-sm text-xs leading-relaxed text-muted-foreground",children:n}):null,d?t.jsx("div",{className:"mt-4",children:d}):null]})}function Sl({isOpen:e,onClose:i,teamRun:n}){const{t:d}=re(),{data:v=[]}=Ln(),{data:_=[]}=zs(),C=Mn(n.id),r=Dn(n.id),o=Pn(n.id),u=N.useRef(!1),[f,a]=N.useState("edit"),[p,m]=N.useState(null),[y,b]=N.useState(""),[s,c]=N.useState(_t()),[l,h]=N.useState(null),[g,S]=N.useState(null),k=n.members??[],E=N.useMemo(()=>k.filter(hr),[k]),x=N.useMemo(()=>g&&hr(g)&&!E.some(W=>W.id===g.id)?[...E,g]:E,[g,E]),w=p?E.find(W=>W.id===p)??null:null,A=g?.id===p?g:w,L=y?v.find(W=>W.id===y)??null:null,R=C.isPending||r.isPending||o.isPending,M=x.filter(Rs).length,I=N.useMemo(()=>{const W=_.filter(li).map(({provider:j,availability:F})=>({value:j.id,label:j.name+(F.type==="NOT_FOUND"?d(" (不可用)"):""),icon:t.jsx(Gt,{agentType:j.agentType,className:"size-4"}),disabled:F.type==="NOT_FOUND"}));return s.providerId&&!_.some(j=>j.provider.id===s.providerId)&&!W.some(j=>j.value===s.providerId)&&W.unshift({value:s.providerId,label:`${s.providerId}${d(" (不可用)")}`,disabled:!0}),W},[s.providerId,_,d]);N.useEffect(()=>{if(!e){u.current=!1,S(null);return}if(u.current)return;u.current=!0;const W=x[0]??null;a(W?"edit":"add-preset"),m(W?.id??null),b(""),c(W?ft(W):_t()),h(null)},[x,e]),N.useEffect(()=>{g&&E.some(W=>W.id===g.id)&&S(null)},[g,E]),N.useEffect(()=>{f==="add-preset"&&L&&c(cs(L))},[f,L]);const P=(W,j)=>{c(F=>({...F,[W]:j}))},H=(W,j)=>{c(F=>({...F,capabilities:{...F.capabilities,[W]:j}}))},$=W=>{a("edit"),m(W.id),b(""),c(ft(W))},T=()=>{a("add-preset"),m(null);const W=L??v[0]??null;b(W?.id??""),c(W?cs(W):_t())},O=()=>{a("add-custom"),m(null),b(""),c(_t())},D=!!(s.name.trim()&&s.providerId.trim()&&s.rolePrompt.trim()),B=f==="add-preset"?!!y:f==="edit"?!!(A&&D):D,q=async()=>{try{if(f==="add-preset"){if(!y)return;const j=await C.mutateAsync({memberPresetId:y});ke.success(d("Member added")),S(j),a("edit"),m(j.id),b(""),c(ft(j));return}const W=bl(s);if(!W.name||!W.providerId||!W.rolePrompt){ke.error(d("Name, provider, and role prompt are required"));return}if(f==="add-custom"){const j=await C.mutateAsync({member:W});ke.success(d("Member added")),S(j),a("edit"),m(j.id),c(ft(j));return}if(A){const j=await r.mutateAsync({memberId:A.id,data:W});ke.success(d("Member updated")),S(F=>F?.id===j.id?j:F),m(j.id),c(ft(j))}}catch(W){ke.error(dr(W,d("Failed to save member")))}},K=async()=>{if(l)try{if(await o.mutateAsync({memberId:l.id,stopActive:!0,cancelQueued:!0}),p===l.id){const W=x.find(j=>j.id!==l.id)??null;m(W?.id??null),a(W?"edit":"add-preset"),c(W?ft(W):_t())}S(W=>W?.id===l.id?null:W),h(null),ke.success(d("Member removed"))}catch(W){ke.error(dr(W,d("Failed to remove member")))}},U=()=>t.jsxs("div",{className:"flex min-h-0 flex-col lg:flex-1",children:[t.jsx("div",{className:"border-b border-border/60 px-5 py-4",children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[t.jsx(Dt,{size:15,className:"text-muted-foreground"}),t.jsx("span",{children:d("Add member from preset")})]}),t.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:d("Choose a saved preset to add a ready-to-run member snapshot.")})]}),t.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:O,disabled:R,children:[t.jsx(or,{size:13}),d("Custom member")]})]})}),t.jsx("div",{className:"p-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto",children:v.length===0?t.jsx(mr,{icon:t.jsx(Dt,{size:18}),title:d("No member presets"),description:d("Create a custom member for this TeamRun, or add presets from Team Collaboration Settings."),action:t.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:O,disabled:R,children:[t.jsx(xt,{size:13}),d("Custom member")]})}):t.jsx("div",{className:"grid grid-cols-1 gap-2 xl:grid-cols-2",children:v.map(W=>{const j=y===W.id;return t.jsxs("button",{type:"button",onClick:()=>{b(W.id),c(cs(W))},className:Q("flex min-h-[4.25rem] items-center gap-3 rounded-lg border px-3 py-2.5 text-left transition-colors",j?"border-foreground bg-muted/50 shadow-raised":"border-border bg-background hover:border-foreground/20 hover:bg-accent"),children:[t.jsx(He,{name:W.name,avatar:W.avatar,className:"h-8 w-8 text-[11px]"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-sm font-medium text-foreground",children:W.name}),t.jsx("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:W.providerId}),t.jsxs("span",{className:"mt-1 block truncate text-xs text-muted-foreground",children:[d(fr(W.workspacePolicy))," · ",d(xl(W.sessionPolicy))]})]}),j?t.jsx(kt,{size:16,className:"shrink-0 text-foreground"}):null]},W.id)})})})]}),z=()=>{const W=f==="edit";return W&&!A?t.jsx("div",{className:"p-5",children:t.jsx(mr,{icon:t.jsx(gt,{size:18}),title:d("Select a member"),description:d("Choose a member on the left to edit its future TeamRun configuration."),action:t.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:T,disabled:R,children:[t.jsx(xt,{size:13}),d("Add member")]})})}):t.jsxs("div",{className:"flex min-h-0 flex-col lg:flex-1",children:[t.jsx("div",{className:"border-b border-border/60 px-5 py-4",children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[W?t.jsx(Ci,{size:15,className:"text-muted-foreground"}):t.jsx(xt,{size:15,className:"text-muted-foreground"}),t.jsx("span",{children:d(W?"Edit member":"Custom member")})]}),t.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:d(W?"Provider, role, workspace, and session changes apply to future work only.":"Create a one-off member snapshot for this TeamRun.")})]}),W&&A?t.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:()=>h(A),disabled:R,className:"border-destructive/25 text-destructive-ink hover:bg-destructive/10 hover:text-destructive-ink",children:[t.jsx(vo,{size:13}),d("Remove")]}):t.jsxs(me,{type:"button",variant:"outline",size:"sm",onClick:T,disabled:R,children:[t.jsx(Dt,{size:13}),d("Use preset")]})]})}),t.jsxs("div",{className:"p-5 lg:min-h-0 lg:flex-1 lg:overflow-y-auto",children:[W&&A?t.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-lg border border-border bg-muted/50 px-3 py-2.5",children:[t.jsx(He,{name:A.name,avatar:A.avatar,className:"h-9 w-9 text-xs"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:Q("h-2 w-2 shrink-0 rounded-full",ur(A))}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:A.name})]}),t.jsxs("div",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[A.providerId," · ",d(fr(A.workspacePolicy))]})]})]}):null,t.jsxs("div",{className:"space-y-5",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Pe,{children:d("Name")}),t.jsx("input",{value:s.name,onChange:j=>P("name",j.target.value),className:"h-9 w-full rounded-lg border border-border px-3 text-sm outline-none transition-colors focus:border-ring"})]}),t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Pe,{children:d("Aliases")}),t.jsx("input",{value:s.aliasesText,onChange:j=>P("aliasesText",j.target.value),placeholder:d("Comma separated"),className:"h-9 w-full rounded-lg border border-border px-3 text-sm outline-none transition-colors focus:border-ring"})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(Pe,{children:d("Provider")}),t.jsx($e,{value:s.providerId,onChange:j=>P("providerId",j),options:I,placeholder:_.find(j=>j.provider.id===s.providerId)?.provider.name})]}),t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Pe,{children:d("Avatar")}),t.jsx("input",{value:s.avatar,onChange:j=>P("avatar",j.target.value),className:"h-9 w-full rounded-lg border border-border px-3 text-sm outline-none transition-colors focus:border-ring"})]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Pe,{children:d("Workspace policy")}),t.jsx($e,{value:s.workspacePolicy,onChange:j=>P("workspacePolicy",j),options:Ri.map(j=>({value:j.value,label:d(j.label)}))})]}),t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Pe,{children:d("Trigger policy")}),t.jsx($e,{value:s.triggerPolicy,onChange:j=>P("triggerPolicy",j),options:gl.map(j=>({value:j.value,label:d(j.label)}))})]}),t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Pe,{children:d("Session policy")}),t.jsx($e,{value:s.sessionPolicy,onChange:j=>P("sessionPolicy",j),options:Li.map(j=>({value:j.value,label:d(j.label)}))})]}),t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Pe,{children:d("Queue policy")}),t.jsx($e,{value:s.queueManagementPolicy,onChange:j=>P("queueManagementPolicy",j),options:vl.map(j=>({value:j.value,label:d(j.label)}))})]})]}),t.jsxs("label",{className:"space-y-1.5",children:[t.jsx(Pe,{children:d("Role prompt")}),t.jsx("textarea",{value:s.rolePrompt,onChange:j=>P("rolePrompt",j.target.value),rows:7,className:"w-full resize-y rounded-lg border border-border px-3 py-2 text-sm leading-relaxed outline-none transition-colors focus:border-ring"})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(Pe,{children:d("Capabilities")}),t.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3",children:pl.map(j=>t.jsxs("label",{className:"flex min-h-9 items-center gap-2 rounded-md border border-border bg-background px-2.5 py-2 text-xs text-foreground/80",children:[t.jsx("input",{type:"checkbox",checked:!!s.capabilities[j.key],onChange:F=>H(j.key,F.target.checked)}),t.jsx("span",{className:"min-w-0 truncate",children:d(j.label)})]},j.key))})]})]})]})]})};return t.jsxs(t.Fragment,{children:[t.jsx(At,{isOpen:e,onClose:R?()=>{}:i,title:d("Manage Team Members"),className:"max-w-6xl",action:t.jsxs(t.Fragment,{children:[t.jsx(me,{type:"button",variant:"outline",onClick:i,disabled:R,children:d("Close")}),t.jsx(me,{type:"button",onClick:q,disabled:R||!B,children:d(R?"Processing...":f==="edit"?"Save member":"Add member")})]}),children:t.jsxs("div",{className:"grid min-h-0 grid-cols-1 overflow-visible rounded-lg border border-border bg-background lg:h-[min(42rem,calc(100vh-13rem))] lg:min-h-[34rem] lg:grid-cols-[20rem_minmax(0,1fr)] lg:overflow-hidden",children:[t.jsxs("aside",{className:"flex min-h-0 flex-col border-b border-border bg-muted/35 lg:border-b-0 lg:border-r",children:[t.jsx("div",{className:"border-b border-border px-4 py-4",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[t.jsx(gt,{size:15,className:"text-muted-foreground"}),t.jsx("span",{children:d("Members")})]}),t.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[x.length," ",d("active")," · ",M," ",d("working")]})]}),t.jsx(me,{type:"button",size:"icon-sm",variant:"outline",onClick:T,disabled:R,title:d("Add member"),children:t.jsx(xt,{size:14})})]})}),t.jsx("div",{className:"max-h-64 overflow-y-auto p-2 lg:min-h-0 lg:max-h-none lg:flex-1",children:x.length===0?t.jsx("div",{className:"rounded-lg border border-dashed border-border bg-background px-3 py-5 text-center text-xs text-muted-foreground",children:d("No active members")}):t.jsx("div",{className:"space-y-1",children:x.map(W=>{const j=f==="edit"&&p===W.id;return t.jsxs("button",{type:"button",onClick:()=>$(W),className:Q("group flex w-full items-center gap-2 rounded-lg border px-2.5 py-2 text-left transition-colors",j?"border-border bg-background shadow-raised":"border-transparent hover:border-border hover:bg-background"),children:[t.jsx(He,{name:W.name,avatar:W.avatar,className:"h-8 w-8 text-[11px]"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:Q("h-1.5 w-1.5 shrink-0 rounded-full",ur(W))}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:W.name})]}),t.jsx("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:W.providerId})]}),t.jsx(Sa,{size:13,className:Q("shrink-0 text-muted-foreground transition-opacity",j?"opacity-100":"opacity-0 group-hover:opacity-100")})]},W.id)})})}),t.jsx("div",{className:"border-t border-border p-2",children:t.jsx(po,{block:!0,"aria-label":d("Add member"),value:f,onValueChange:W=>W==="add-preset"?T():O(),options:[{value:"add-preset",label:d("Preset"),icon:t.jsx(Dt,{}),disabled:R},{value:"add-custom",label:d("Custom"),icon:t.jsx(or,{}),disabled:R}]})})]}),t.jsx("section",{className:"flex min-h-0 min-w-0 flex-col",children:f==="add-preset"?U():z()})]})}),t.jsx(go,{isOpen:!!l,onClose:()=>h(null),onConfirm:K,title:d("Remove member"),variant:"danger",isLoading:o.isPending,confirmText:d("Remove"),description:t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{children:l?d("Remove this member from future TeamRun work?"):""}),l&&Rs(l)?t.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-left text-destructive-ink",children:[t.jsx(Tt,{size:15,className:"mt-0.5 shrink-0"}),t.jsx("span",{className:"text-sm font-medium",children:d("确认后会停止当前工作并取消队列")})]}):null]})})]})}const yl=[],wl=[],Cl=[],kl=240;function El(e){switch(e){case"RUNNING":return"running";case"WAITING":case"WAITING_ROOM_REPLY":return"waiting room reply";case"QUEUED":return"queued";case"SESSION_ENDED":return"session ended";case"PENDING_APPROVAL":return"pending approval";case"REMOVED":return"removed";default:return"idle"}}const pr={running:0,"waiting room reply":1,queued:2,"session ended":3,"pending approval":4,idle:5,removed:6};function ds(e){if(!e)return"";const i=new Date(e);return Number.isNaN(i.getTime())?"":i.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function gr(e,i){return e instanceof Error?e.message:i}function jl(e,i=kl){const n=(e??"").replace(/\s+/g," ").trim();return n.length<=i?n:`${n.slice(0,i-3).trimEnd()}...`}function Bt(e){return e?e.instructionPreview??jl(e.instruction):""}function Tl(e){switch(e){case"running":return"Running";case"waiting room reply":return"Waiting room reply";case"queued":return"Queued";case"session ended":return"Session ended";case"pending approval":return"Pending approval";case"removed":return"Removed";case"idle":return"Idle"}}function Al(e){switch(e){case"running":return"border-success/25 bg-success/10 text-success-ink";case"waiting room reply":return"border-warning/25 bg-warning/10 text-warning-ink";case"queued":case"session ended":return"border-info/25 bg-info/10 text-info-ink";case"pending approval":return"border-border bg-muted/50 text-foreground/70";case"removed":return"border-border bg-muted/50 text-muted-foreground";case"idle":return"border-border bg-background text-muted-foreground"}}function Nl(e){switch(e){case"running":return"bg-success";case"waiting room reply":return"bg-warning";case"queued":case"session ended":return"bg-info";case"pending approval":return"bg-muted-foreground/60";case"removed":return"bg-foreground/15";case"idle":return"bg-foreground/15"}}function Rl(e){switch(e){case"user":return"User";case"agent":return"Agent";case"system":return"System"}}function Ll(e){switch(e){case"RUNNING":return"border-success/25 bg-success/10 text-success-ink";case"WAITING_ROOM_REPLY":return"border-warning/25 bg-warning/10 text-warning-ink";case"QUEUED":case"SESSION_ENDED":return"border-info/25 bg-info/10 text-info-ink";case"COMPLETED":return"border-border bg-muted/50 text-foreground/80";case"FAILED":return"border-destructive/25 bg-destructive/10 text-destructive-ink";case"CANCELLED":return"border-border bg-background text-muted-foreground"}}function Ml(e){switch(e){case Ie.ACTIVE:return"border-success/25 bg-success/10 text-success-ink";case Ie.MERGED:return"border-info/25 bg-info/10 text-info-ink";case Ie.HIBERNATED:return"border-warning/25 bg-warning/10 text-warning-ink";case Ie.ABANDONED:return"border-border bg-muted/50 text-muted-foreground"}}function Dl(e){switch(e){case"Main":return"border-border bg-muted/50 text-foreground/80";case"Child":return"border-border bg-muted/50 text-foreground/80";default:return"border-border bg-muted/50 text-foreground/70"}}function Pl(e){return[...e].sort((i,n)=>Date.parse(n.updatedAt??n.createdAt??"")-Date.parse(i.updatedAt??i.createdAt??""))}function Bl(e,i){return i.find(n=>n.memberId===e.id&&Zt.has(n.status))}function Mf({teamRun:e,workspaces:i,selectedWorkspaceId:n,onSelectWorkspace:d,onViewInvocationSession:v}){const{t:_}=re(),C=Kr(e.id),r=Xr(e.id),o=Ur(e.id),[u,f]=N.useState(null),[a,p]=N.useState(null),[m,y]=N.useState(!1),[b,s]=N.useState(!1),c=e.members??yl,l=N.useMemo(()=>c.filter(P=>P.membershipStatus!=="REMOVED"),[c]),h=e.workRequests??wl,g=e.invocations??Cl,S=N.useMemo(()=>Xs(i,e),[e,i]),k=N.useMemo(()=>new Map(h.map(P=>[P.id,P])),[h]),E=N.useMemo(()=>[...h].filter(P=>P.status==="PENDING_APPROVAL").sort((P,H)=>Date.parse(H.updatedAt??H.createdAt??"")-Date.parse(P.updatedAt??P.createdAt??"")),[h]),x=N.useMemo(()=>[...h].filter(P=>P.status==="QUEUED").sort((P,H)=>Date.parse(H.updatedAt??H.createdAt??"")-Date.parse(P.updatedAt??P.createdAt??"")),[h]),w=N.useMemo(()=>[...c].map(P=>({member:P,status:El(P.status)})).sort((P,H)=>pr[P.status]-pr[H.status]),[c]),A=C.isError?C.error:r.isError?r.error:null,L=C.isPending||r.isPending,R=S.find(P=>P.workspace.id===n),M=e.messages??[],I=w.filter(({status:P})=>P==="running"||P==="waiting room reply").length;return t.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[t.jsx(Sl,{isOpen:b,onClose:()=>s(!1),teamRun:e}),t.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-4 py-3 shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx(Es,{size:14,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-xs font-semibold text-foreground",children:_("Team Status")})]}),t.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border border-border bg-muted/50 px-2 py-0.5 text-xs font-medium text-muted-foreground",children:[t.jsx("span",{children:_("Team mode")}),t.jsx("span",{className:"text-foreground/80",children:e.mode})]})]}),t.jsxs("div",{className:"flex items-center gap-3 border-b border-border/60 px-4 py-1.5 shrink-0 text-xs text-muted-foreground",children:[t.jsxs("span",{className:"inline-flex items-center gap-1",title:_("Messages"),children:[t.jsx(_o,{size:11,className:"text-muted-foreground/70"}),t.jsx("span",{className:"tabular-nums",children:M.length})]}),t.jsxs("span",{className:"inline-flex items-center gap-1",title:_("Members"),children:[t.jsx(gt,{size:11,className:"text-muted-foreground/70"}),t.jsx("span",{className:"tabular-nums",children:I>0?`${I}/${l.length}`:l.length}),I>0&&t.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-success"})]}),x.length>0&&t.jsxs("span",{className:"inline-flex items-center gap-1",title:_("Queue"),children:[t.jsx(qe,{size:11,className:"text-muted-foreground/70"}),t.jsx("span",{className:"tabular-nums",children:x.length})]}),E.length>0&&t.jsxs("span",{className:"inline-flex items-center gap-1 text-warning-ink",title:_("Pending approval"),children:[t.jsx(qe,{size:11}),t.jsx("span",{className:"tabular-nums",children:E.length})]})]}),t.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-app-thin px-4 py-3 space-y-3",children:[E.length>0&&t.jsxs("section",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-warning-ink",children:[t.jsx(qe,{size:13}),t.jsx("span",{children:_("Pending approval")}),t.jsx("span",{className:"ml-auto rounded-full bg-warning/10 px-1.5 py-0.5 text-[11px] font-semibold text-warning-ink",children:E.length})]}),t.jsx("div",{className:"space-y-1.5",children:E.map(P=>{const H=c.find(O=>O.id===P.targetMemberId),$=C.isPending&&C.variables===P.id,T=r.isPending&&r.variables===P.id;return t.jsxs("div",{className:"rounded-md border border-warning/25 bg-warning/5 px-3 py-2",children:[t.jsx("div",{className:"flex items-start justify-between gap-2",children:t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(He,{name:H?.name??"Agent",avatar:H?.avatar??null,size:"xs",className:"size-4"}),t.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:H?.name??P.targetMemberId})]}),t.jsx("div",{className:"mt-1 text-xs leading-relaxed text-foreground/70 line-clamp-2",children:Bt(P)})]})}),t.jsxs("div",{className:"mt-1.5 flex items-center gap-x-2 text-xs text-muted-foreground",children:[t.jsx("span",{children:_(Rl(P.requesterType))}),t.jsx("span",{children:ds(P.createdAt)})]}),t.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[t.jsxs("button",{type:"button",onClick:()=>C.mutate(P.id),disabled:L,className:"inline-flex h-6 min-w-0 items-center gap-1 rounded-md border border-success/25 bg-success/10 px-2 text-xs font-medium text-success-ink transition-colors hover:bg-success/15 disabled:cursor-not-allowed disabled:opacity-50",children:[t.jsx(kt,{size:11}),t.jsx("span",{className:"truncate",children:_($?"Approving":"Approve")})]}),t.jsxs("button",{type:"button",onClick:()=>r.mutate(P.id),disabled:L,className:"inline-flex h-6 min-w-0 items-center gap-1 rounded-md border border-border bg-muted/50 px-2 text-xs font-medium text-foreground/80 transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:[t.jsx(Qe,{size:11}),t.jsx("span",{className:"truncate",children:_(T?"Rejecting":"Reject")})]})]})]},P.id)})}),A&&t.jsx("div",{className:"rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-ink",children:gr(A,_("Failed to update work request"))})]}),t.jsxs("section",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[t.jsx(gt,{size:13}),t.jsx("span",{children:_("Members")}),t.jsx("span",{className:"ml-auto text-[11px] font-normal text-muted-foreground",children:l.length}),t.jsx("button",{type:"button",onClick:()=>s(!0),className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground/80",title:_("Manage Team Members"),"aria-label":_("Manage Team Members"),children:t.jsx(Ci,{size:13})})]}),c.length===0?t.jsx("div",{className:"py-3 text-center text-xs text-muted-foreground",children:_("No members")}):t.jsx("div",{className:"space-y-px rounded-md border border-border overflow-hidden",children:w.map(({member:P,status:H})=>{const $=Bl(P,g),T=Pl(g.filter(z=>z.memberId===P.id)),O=$?k.get($.workRequestId):void 0,D=a===P.id,B=H==="running"||H==="waiting room reply",q=B&&!!$,K=u===P.id,U=o.isPending&&o.variables?.memberId===P.id;return t.jsxs("div",{className:Q("bg-background",D&&"bg-muted/25"),children:[t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[t.jsx(He,{name:P.name,avatar:P.avatar,className:"h-6 w-6 text-[10px] shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:Q("h-1.5 w-1.5 shrink-0 rounded-full",Nl(H))}),t.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:P.name}),t.jsx("span",{className:Q("shrink-0 rounded-full border px-1.5 py-px text-xs font-medium leading-tight",Al(H)),children:_(Tl(H))})]}),B&&O?.instruction&&t.jsx("div",{className:"mt-0.5 truncate pl-3 text-xs text-muted-foreground",children:Bt(O)})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[q&&t.jsx("button",{type:"button",onClick:()=>f(K?null:P.id),disabled:o.isPending,className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive-ink disabled:cursor-not-allowed disabled:opacity-50",title:_("Stop"),"aria-label":_("Stop"),children:t.jsx(qt,{size:12})}),$?.sessionId&&v&&t.jsx("button",{type:"button",onClick:()=>v($.sessionId),className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground/80",title:_("View log"),"aria-label":_("View log"),children:t.jsx(As,{size:12})}),t.jsx("button",{type:"button",onClick:()=>p(D?null:P.id),className:"rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground/70",title:_("Details"),"aria-label":_("Details"),"aria-expanded":D,children:D?t.jsx(ze,{size:13}):t.jsx(Ye,{size:13})})]})]}),q&&K&&t.jsxs("div",{className:"mx-3 mb-2 rounded-md border border-border bg-muted/50 p-2",children:[t.jsx("div",{className:"mb-1.5 text-xs text-foreground/70",children:_("Stop running work?")}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.jsxs("button",{type:"button",onClick:()=>{o.mutate({memberId:P.id,cancelQueued:!1},{onSuccess:()=>f(null)})},disabled:o.isPending,className:"inline-flex h-6 items-center gap-1 rounded-md border border-border bg-background px-2 text-xs font-medium text-foreground/80 transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:[t.jsx(qt,{size:10}),t.jsx("span",{children:U&&o.variables?.cancelQueued===!1?_("Stopping"):_("Stop only")})]}),t.jsxs("button",{type:"button",onClick:()=>{o.mutate({memberId:P.id,cancelQueued:!0},{onSuccess:()=>f(null)})},disabled:o.isPending,className:"inline-flex h-6 items-center gap-1 rounded-md border border-destructive/25 bg-destructive/10 px-2 text-xs font-medium text-destructive-ink transition-colors hover:bg-destructive/15 disabled:cursor-not-allowed disabled:opacity-50",children:[t.jsx(wi,{size:10}),t.jsx("span",{children:U&&o.variables?.cancelQueued===!0?_("Stopping"):_("Stop + clear queue")})]})]})]}),D&&t.jsxs("div",{className:"border-t border-border/60 px-3 py-2",children:[t.jsxs("div",{className:"mb-1.5 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[t.jsx("span",{children:P.providerId}),t.jsx("span",{className:"h-0.5 w-0.5 rounded-full bg-foreground/15"}),t.jsx("span",{children:P.workspacePolicy}),t.jsx("span",{className:"h-0.5 w-0.5 rounded-full bg-foreground/15"}),t.jsx("span",{children:P.sessionPolicy==="resume_last"?_("Resume last session"):_("New session per request")})]}),t.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:_("Invocation history")}),t.jsx("span",{className:"text-[11px] text-muted-foreground",children:T.length})]}),T.length===0?t.jsx("div",{className:"py-2 text-center text-xs text-muted-foreground",children:_("No invocations yet")}):t.jsx("div",{className:"space-y-1",children:T.map(z=>{const W=k.get(z.workRequestId),j=!!(z.sessionId&&v);return t.jsx("div",{className:"rounded-md border border-border/60 bg-background px-2.5 py-1.5",children:t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[t.jsx("span",{className:Q("rounded-full border px-1.5 py-px text-[10px] font-medium leading-tight",Ll(z.status)),children:z.status}),t.jsx("span",{className:"text-[11px] text-muted-foreground",children:ds(z.updatedAt??z.createdAt)})]}),t.jsx("div",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:Bt(W)||z.workRequestId})]}),j&&t.jsxs("button",{type:"button",onClick:()=>z.sessionId&&v?.(z.sessionId),className:"inline-flex h-5 shrink-0 items-center gap-1 rounded border border-border bg-background px-1.5 text-xs font-medium text-foreground/70 transition-colors hover:bg-accent",title:_("View log"),"aria-label":_("View log"),children:[t.jsx(As,{size:10}),t.jsx("span",{children:_("Log")})]})]})},z.id)})})]}),w[w.length-1]?.member.id!==P.id&&!D&&t.jsx("div",{className:"mx-3 border-b border-border/60"})]},P.id)})}),o.isError&&t.jsx("div",{className:"rounded-md border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-ink",children:gr(o.error,_("Failed to stop member work"))})]}),x.length>0&&t.jsxs("section",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[t.jsx(qe,{size:13}),t.jsx("span",{children:_("Queue")}),t.jsx("span",{className:"ml-auto rounded-full bg-muted px-1.5 py-0.5 text-[11px] font-semibold text-foreground/70",children:x.length})]}),t.jsx("div",{className:"space-y-1",children:x.map(P=>{const H=c.find($=>$.id===P.targetMemberId);return t.jsx("div",{className:"rounded-md border border-border bg-background px-3 py-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(He,{name:H?.name??"Agent",avatar:H?.avatar??null,size:"xs",className:"size-4"}),t.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:H?.name??P.targetMemberId})]}),t.jsx("div",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:Bt(P)})]}),t.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:ds(P.createdAt)})]})},P.id)})})]}),S.length>0&&t.jsxs("section",{className:"space-y-1.5",children:[t.jsxs("button",{type:"button",onClick:()=>y(P=>!P),className:"flex w-full items-center gap-2 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground/80","aria-expanded":m,"aria-label":_("Workspaces"),children:[t.jsx(Es,{size:13}),t.jsx("span",{children:_("Workspaces")}),t.jsxs("span",{className:"ml-auto flex items-center gap-1.5",children:[R&&t.jsx("span",{className:"max-w-[120px] truncate font-mono text-[11px] font-normal text-muted-foreground",children:Et(R.workspace)}),t.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-[11px] font-semibold text-foreground/70",children:S.length}),m?t.jsx(ze,{size:13,className:"text-muted-foreground/70"}):t.jsx(Ye,{size:13,className:"text-muted-foreground/70"})]})]}),m&&t.jsx("div",{className:"space-y-1.5",children:S.map(P=>{const H=n===P.workspace.id;return t.jsx("div",{className:Q("rounded-md border bg-background px-3 py-2",H?"border-foreground/25 shadow-raised":"border-border"),children:t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[t.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:_(P.displayName)}),t.jsx("span",{className:Q("shrink-0 rounded-full border px-1.5 py-px text-[11px] font-medium leading-tight",Dl(P.roleLabel)),children:_(P.roleLabel)}),t.jsx("span",{className:Q("shrink-0 rounded-full border px-1.5 py-px text-[11px] font-medium leading-tight",Ml(P.workspace.status)),children:P.workspace.status})]}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px] text-muted-foreground",children:Et(P.workspace)}),t.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground",children:[P.ownerName&&t.jsxs("span",{children:[_("Owner"),": ",P.ownerName]}),P.parentBranchName&&t.jsxs("span",{children:[_("Parent"),": ",P.parentBranchName]})]})]}),t.jsxs("button",{type:"button",onClick:()=>d?.(P.workspace.id),disabled:!d||H,className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-md border border-border bg-muted/50 px-2 text-xs font-medium text-foreground/80 transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",title:_("View workspace"),children:[H?t.jsx(kt,{size:11}):t.jsx(Vr,{size:11}),t.jsx("span",{children:_(H?"Selected":"Select")})]})]})},P.workspace.id)})})]}),E.length===0&&x.length===0&&w.every(({status:P})=>P==="idle")&&t.jsx("div",{className:"py-2 text-center text-xs text-muted-foreground",children:_("All members idle")})]})]})}var hs={exports:{}},vr;function Ol(){return vr||(vr=1,(function(e,i){(function(n,d){e.exports=d()})(self,(()=>(()=>{var n={4567:function(C,r,o){var u=this&&this.__decorate||function(h,g,S,k){var E,x=arguments.length,w=x<3?g:k===null?k=Object.getOwnPropertyDescriptor(g,S):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,g,S,k);else for(var A=h.length-1;A>=0;A--)(E=h[A])&&(w=(x<3?E(w):x>3?E(g,S,w):E(g,S))||w);return x>3&&w&&Object.defineProperty(g,S,w),w},f=this&&this.__param||function(h,g){return function(S,k){g(S,k,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const a=o(9042),p=o(6114),m=o(9924),y=o(844),b=o(5596),s=o(4725),c=o(3656);let l=r.AccessibilityManager=class extends y.Disposable{constructor(h,g){super(),this._terminal=h,this._renderService=g,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let S=0;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);if(this._topBoundaryFocusListener=S=>this._handleBoundaryFocus(S,0),this._bottomBoundaryFocusListener=S=>this._handleBoundaryFocus(S,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new m.TimeBasedDebouncer(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((S=>this._handleResize(S.rows)))),this.register(this._terminal.onRender((S=>this._refreshRows(S.start,S.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((S=>this._handleChar(S)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
9
|
+
`)))),this.register(this._terminal.onA11yTab((S=>this._handleTab(S)))),this.register(this._terminal.onKey((S=>this._handleKey(S.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this._screenDprMonitor=new b.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener((()=>this._refreshRowsDimensions())),this.register((0,c.addDisposableDomListener)(window,"resize",(()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,y.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(h){for(let g=0;g<h;g++)this._handleChar(" ")}_handleChar(h){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==h&&(this._charsToAnnounce+=h):this._charsToAnnounce+=h,h===`
|
|
10
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)),p.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((()=>{this._accessibilityContainer.appendChild(this._liveRegion)}),0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,p.isMac&&this._liveRegion.remove()}_handleKey(h){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(h)||this._charsToConsume.push(h)}_refreshRows(h,g){this._liveRegionDebouncer.refresh(h,g,this._terminal.rows)}_renderRows(h,g){const S=this._terminal.buffer,k=S.lines.length.toString();for(let E=h;E<=g;E++){const x=S.translateBufferLineToString(S.ydisp+E,!0),w=(S.ydisp+E+1).toString(),A=this._rowElements[E];A&&(x.length===0?A.innerText=" ":A.textContent=x,A.setAttribute("aria-posinset",w),A.setAttribute("aria-setsize",k))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(h,g){const S=h.target,k=this._rowElements[g===0?1:this._rowElements.length-2];if(S.getAttribute("aria-posinset")===(g===0?"1":`${this._terminal.buffer.lines.length}`)||h.relatedTarget!==k)return;let E,x;if(g===0?(E=S,x=this._rowElements.pop(),this._rowContainer.removeChild(x)):(E=this._rowElements.shift(),x=S,this._rowContainer.removeChild(E)),E.removeEventListener("focus",this._topBoundaryFocusListener),x.removeEventListener("focus",this._bottomBoundaryFocusListener),g===0){const w=this._createAccessibilityTreeNode();this._rowElements.unshift(w),this._rowContainer.insertAdjacentElement("afterbegin",w)}else{const w=this._createAccessibilityTreeNode();this._rowElements.push(w),this._rowContainer.appendChild(w)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(g===0?-1:1),this._rowElements[g===0?1:this._rowElements.length-2].focus(),h.preventDefault(),h.stopImmediatePropagation()}_handleResize(h){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let g=this._rowContainer.children.length;g<this._terminal.rows;g++)this._rowElements[g]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[g]);for(;this._rowElements.length>h;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const h=document.createElement("div");return h.setAttribute("role","listitem"),h.tabIndex=-1,this._refreshRowDimensions(h),h}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let h=0;h<this._terminal.rows;h++)this._refreshRowDimensions(this._rowElements[h])}}_refreshRowDimensions(h){h.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=l=u([f(1,s.IRenderService)],l)},3614:(C,r)=>{function o(p){return p.replace(/\r?\n/g,"\r")}function u(p,m){return m?"\x1B[200~"+p+"\x1B[201~":p}function f(p,m,y,b){p=u(p=o(p),y.decPrivateModes.bracketedPasteMode&&b.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(p,!0),m.value=""}function a(p,m,y){const b=y.getBoundingClientRect(),s=p.clientX-b.left-10,c=p.clientY-b.top-10;m.style.width="20px",m.style.height="20px",m.style.left=`${s}px`,m.style.top=`${c}px`,m.style.zIndex="1000",m.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=o,r.bracketTextForPaste=u,r.copyHandler=function(p,m){p.clipboardData&&p.clipboardData.setData("text/plain",m.selectionText),p.preventDefault()},r.handlePasteEvent=function(p,m,y,b){p.stopPropagation(),p.clipboardData&&f(p.clipboardData.getData("text/plain"),m,y,b)},r.paste=f,r.moveTextAreaUnderMouseCursor=a,r.rightClickHandler=function(p,m,y,b,s){a(p,m,y),s&&b.rightClickSelect(p),m.value=b.selectionText,m.select()}},7239:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const u=o(1505);r.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(f,a,p){this._css.set(f,a,p)}getCss(f,a){return this._css.get(f,a)}setColor(f,a,p){this._color.set(f,a,p)}getColor(f,a){return this._color.get(f,a)}clear(){this._color.clear(),this._css.clear()}}},3656:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(o,u,f,a){o.addEventListener(u,f,a);let p=!1;return{dispose:()=>{p||(p=!0,o.removeEventListener(u,f,a))}}}},6465:function(C,r,o){var u=this&&this.__decorate||function(s,c,l,h){var g,S=arguments.length,k=S<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(s,c,l,h);else for(var E=s.length-1;E>=0;E--)(g=s[E])&&(k=(S<3?g(k):S>3?g(c,l,k):g(c,l))||k);return S>3&&k&&Object.defineProperty(c,l,k),k},f=this&&this.__param||function(s,c){return function(l,h){c(l,h,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier2=void 0;const a=o(3656),p=o(8460),m=o(844),y=o(2585);let b=r.Linkifier2=class extends m.Disposable{get currentLink(){return this._currentLink}constructor(s){super(),this._bufferService=s,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,m.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,m.toDisposable)((()=>{this._lastMouseEvent=void 0}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0})))}registerLinkProvider(s){return this._linkProviders.push(s),{dispose:()=>{const c=this._linkProviders.indexOf(s);c!==-1&&this._linkProviders.splice(c,1)}}}attachToDom(s,c,l){this._element=s,this._mouseService=c,this._renderService=l,this.register((0,a.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(s){if(this._lastMouseEvent=s,!this._element||!this._mouseService)return;const c=this._positionFromMouseEvent(s,this._element,this._mouseService);if(!c)return;this._isMouseOut=!1;const l=s.composedPath();for(let h=0;h<l.length;h++){const g=l[h];if(g.classList.contains("xterm"))break;if(g.classList.contains("xterm-hover"))return}this._lastBufferCell&&c.x===this._lastBufferCell.x&&c.y===this._lastBufferCell.y||(this._handleHover(c),this._lastBufferCell=c)}_handleHover(s){if(this._activeLine!==s.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(s,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,s)||(this._clearCurrentLink(),this._askForLink(s,!0))}_askForLink(s,c){var l,h;this._activeProviderReplies&&c||((l=this._activeProviderReplies)===null||l===void 0||l.forEach((S=>{S?.forEach((k=>{k.link.dispose&&k.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=s.y);let g=!1;for(const[S,k]of this._linkProviders.entries())c?!((h=this._activeProviderReplies)===null||h===void 0)&&h.get(S)&&(g=this._checkLinkProviderResult(S,s,g)):k.provideLinks(s.y,(E=>{var x,w;if(this._isMouseOut)return;const A=E?.map((L=>({link:L})));(x=this._activeProviderReplies)===null||x===void 0||x.set(S,A),g=this._checkLinkProviderResult(S,s,g),((w=this._activeProviderReplies)===null||w===void 0?void 0:w.size)===this._linkProviders.length&&this._removeIntersectingLinks(s.y,this._activeProviderReplies)}))}_removeIntersectingLinks(s,c){const l=new Set;for(let h=0;h<c.size;h++){const g=c.get(h);if(g)for(let S=0;S<g.length;S++){const k=g[S],E=k.link.range.start.y<s?0:k.link.range.start.x,x=k.link.range.end.y>s?this._bufferService.cols:k.link.range.end.x;for(let w=E;w<=x;w++){if(l.has(w)){g.splice(S--,1);break}l.add(w)}}}}_checkLinkProviderResult(s,c,l){var h;if(!this._activeProviderReplies)return l;const g=this._activeProviderReplies.get(s);let S=!1;for(let k=0;k<s;k++)this._activeProviderReplies.has(k)&&!this._activeProviderReplies.get(k)||(S=!0);if(!S&&g){const k=g.find((E=>this._linkAtPosition(E.link,c)));k&&(l=!0,this._handleNewLink(k))}if(this._activeProviderReplies.size===this._linkProviders.length&&!l)for(let k=0;k<this._activeProviderReplies.size;k++){const E=(h=this._activeProviderReplies.get(k))===null||h===void 0?void 0:h.find((x=>this._linkAtPosition(x.link,c)));if(E){l=!0,this._handleNewLink(E);break}}return l}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(s){if(!this._element||!this._mouseService||!this._currentLink)return;const c=this._positionFromMouseEvent(s,this._element,this._mouseService);c&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,c)&&this._currentLink.link.activate(s,this._currentLink.link.text)}_clearCurrentLink(s,c){this._element&&this._currentLink&&this._lastMouseEvent&&(!s||!c||this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=c)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,m.disposeArray)(this._linkCacheDisposables))}_handleNewLink(s){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const c=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);c&&this._linkAtPosition(s.link,c)&&(this._currentLink=s,this._currentLink.state={decorations:{underline:s.link.decorations===void 0||s.link.decorations.underline,pointerCursor:s.link.decorations===void 0||s.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,s.link,this._lastMouseEvent),s.link.decorations={},Object.defineProperties(s.link.decorations,{pointerCursor:{get:()=>{var l,h;return(h=(l=this._currentLink)===null||l===void 0?void 0:l.state)===null||h===void 0?void 0:h.decorations.pointerCursor},set:l=>{var h,g;!((h=this._currentLink)===null||h===void 0)&&h.state&&this._currentLink.state.decorations.pointerCursor!==l&&(this._currentLink.state.decorations.pointerCursor=l,this._currentLink.state.isHovered&&((g=this._element)===null||g===void 0||g.classList.toggle("xterm-cursor-pointer",l)))}},underline:{get:()=>{var l,h;return(h=(l=this._currentLink)===null||l===void 0?void 0:l.state)===null||h===void 0?void 0:h.decorations.underline},set:l=>{var h,g,S;!((h=this._currentLink)===null||h===void 0)&&h.state&&((S=(g=this._currentLink)===null||g===void 0?void 0:g.state)===null||S===void 0?void 0:S.decorations.underline)!==l&&(this._currentLink.state.decorations.underline=l,this._currentLink.state.isHovered&&this._fireUnderlineEvent(s.link,l))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((l=>{if(!this._currentLink)return;const h=l.start===0?0:l.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+l.end;if(this._currentLink.link.range.start.y>=h&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(h,g),this._lastMouseEvent&&this._element)){const S=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);S&&this._askForLink(S,!1)}}))))}_linkHover(s,c,l){var h;!((h=this._currentLink)===null||h===void 0)&&h.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(c,!0),this._currentLink.state.decorations.pointerCursor&&s.classList.add("xterm-cursor-pointer")),c.hover&&c.hover(l,c.text)}_fireUnderlineEvent(s,c){const l=s.range,h=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(l.start.x-1,l.start.y-h-1,l.end.x,l.end.y-h-1,void 0);(c?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_linkLeave(s,c,l){var h;!((h=this._currentLink)===null||h===void 0)&&h.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(c,!1),this._currentLink.state.decorations.pointerCursor&&s.classList.remove("xterm-cursor-pointer")),c.leave&&c.leave(l,c.text)}_linkAtPosition(s,c){const l=s.range.start.y*this._bufferService.cols+s.range.start.x,h=s.range.end.y*this._bufferService.cols+s.range.end.x,g=c.y*this._bufferService.cols+c.x;return l<=g&&g<=h}_positionFromMouseEvent(s,c,l){const h=l.getCoords(s,c,this._bufferService.cols,this._bufferService.rows);if(h)return{x:h[0],y:h[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(s,c,l,h,g){return{x1:s,y1:c,x2:l,y2:h,cols:this._bufferService.cols,fg:g}}};r.Linkifier2=b=u([f(0,y.IBufferService)],b)},9042:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(C,r,o){var u=this&&this.__decorate||function(b,s,c,l){var h,g=arguments.length,S=g<3?s:l===null?l=Object.getOwnPropertyDescriptor(s,c):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(b,s,c,l);else for(var k=b.length-1;k>=0;k--)(h=b[k])&&(S=(g<3?h(S):g>3?h(s,c,S):h(s,c))||S);return g>3&&S&&Object.defineProperty(s,c,S),S},f=this&&this.__param||function(b,s){return function(c,l){s(c,l,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const a=o(511),p=o(2585);let m=r.OscLinkProvider=class{constructor(b,s,c){this._bufferService=b,this._optionsService=s,this._oscLinkService=c}provideLinks(b,s){var c;const l=this._bufferService.buffer.lines.get(b-1);if(!l)return void s(void 0);const h=[],g=this._optionsService.rawOptions.linkHandler,S=new a.CellData,k=l.getTrimmedLength();let E=-1,x=-1,w=!1;for(let A=0;A<k;A++)if(x!==-1||l.hasContent(A)){if(l.loadCell(A,S),S.hasExtendedAttrs()&&S.extended.urlId){if(x===-1){x=A,E=S.extended.urlId;continue}w=S.extended.urlId!==E}else x!==-1&&(w=!0);if(w||x!==-1&&A===k-1){const L=(c=this._oscLinkService.getLinkData(E))===null||c===void 0?void 0:c.uri;if(L){const R={start:{x:x+1,y:b},end:{x:A+(w||A!==k-1?0:1),y:b}};let M=!1;if(!g?.allowNonHttpProtocols)try{const I=new URL(L);["http:","https:"].includes(I.protocol)||(M=!0)}catch{M=!0}M||h.push({text:L,range:R,activate:(I,P)=>g?g.activate(I,P,R):y(0,P),hover:(I,P)=>{var H;return(H=g?.hover)===null||H===void 0?void 0:H.call(g,I,P,R)},leave:(I,P)=>{var H;return(H=g?.leave)===null||H===void 0?void 0:H.call(g,I,P,R)}})}w=!1,S.hasExtendedAttrs()&&S.extended.urlId?(x=A,E=S.extended.urlId):(x=-1,E=-1)}}s(h)}};function y(b,s){if(confirm(`Do you want to navigate to ${s}?
|
|
11
|
+
|
|
12
|
+
WARNING: This link could potentially be dangerous`)){const c=window.open();if(c){try{c.opener=null}catch{}c.location.href=s}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=m=u([f(0,p.IBufferService),f(1,p.IOptionsService),f(2,p.IOscLinkService)],m)},6193:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(o,u){this._parentWindow=o,this._renderCallback=u,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(o,u,f){this._rowCount=f,o=o!==void 0?o:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u,this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const o=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,u),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},5596:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScreenDprMonitor=void 0;const u=o(844);class f extends u.Disposable{constructor(p){super(),this._parentWindow=p,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,u.toDisposable)((()=>{this.clearListener()})))}setListener(p){this._listener&&this.clearListener(),this._listener=p,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var p;this._outerListener&&((p=this._resolutionMediaMatchList)===null||p===void 0||p.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._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}r.ScreenDprMonitor=f},3236:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const u=o(3614),f=o(3656),a=o(6465),p=o(9042),m=o(3730),y=o(1680),b=o(3107),s=o(5744),c=o(2950),l=o(1296),h=o(428),g=o(4269),S=o(5114),k=o(8934),E=o(3230),x=o(9312),w=o(4725),A=o(6731),L=o(8055),R=o(8969),M=o(8460),I=o(844),P=o(6114),H=o(8437),$=o(2584),T=o(7399),O=o(5941),D=o(9074),B=o(2585),q=o(5435),K=o(4567),U=typeof window<"u"?window.document:null;class z extends R.CoreTerminal{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}constructor(j={}){super(j),this.browser=P,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new I.MutableDisposable),this._onCursorMove=this.register(new M.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new M.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new M.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new M.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new M.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new M.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new M.EventEmitter),this._onBlur=this.register(new M.EventEmitter),this._onA11yCharEmitter=this.register(new M.EventEmitter),this._onA11yTabEmitter=this.register(new M.EventEmitter),this._onWillOpen=this.register(new M.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(a.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(m.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(D.DecorationService),this._instantiationService.setService(B.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((F,X)=>this.refresh(F,X)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((F=>this._reportWindowsOptions(F)))),this.register(this._inputHandler.onColor((F=>this._handleColorEvent(F)))),this.register((0,M.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,M.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,M.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,M.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((F=>this._afterResize(F.cols,F.rows)))),this.register((0,I.toDisposable)((()=>{var F,X;this._customKeyEventHandler=void 0,(X=(F=this.element)===null||F===void 0?void 0:F.parentNode)===null||X===void 0||X.removeChild(this.element)})))}_handleColorEvent(j){if(this._themeService)for(const F of j){let X,Y="";switch(F.index){case 256:X="foreground",Y="10";break;case 257:X="background",Y="11";break;case 258:X="cursor",Y="12";break;default:X="ansi",Y="4;"+F.index}switch(F.type){case 0:const ee=L.color.toColorRGB(X==="ansi"?this._themeService.colors.ansi[F.index]:this._themeService.colors[X]);this.coreService.triggerDataEvent(`${$.C0.ESC}]${Y};${(0,O.toRgbString)(ee)}${$.C1_ESCAPED.ST}`);break;case 1:if(X==="ansi")this._themeService.modifyColors((G=>G.ansi[F.index]=L.rgba.toColor(...F.color)));else{const G=X;this._themeService.modifyColors((J=>J[G]=L.rgba.toColor(...F.color)))}break;case 2:this._themeService.restoreColor(F.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(j){j?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(K.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(j){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[I"),this.updateCursorStyle(j),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var j;return(j=this.textarea)===null||j===void 0?void 0:j.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const j=this.buffer.ybase+this.buffer.y,F=this.buffer.lines.get(j);if(!F)return;const X=Math.min(this.buffer.x,this.cols-1),Y=this._renderService.dimensions.css.cell.height,ee=F.getWidth(X),G=this._renderService.dimensions.css.cell.width*ee,J=this.buffer.y*this._renderService.dimensions.css.cell.height,ie=X*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ie+"px",this.textarea.style.top=J+"px",this.textarea.style.width=G+"px",this.textarea.style.height=Y+"px",this.textarea.style.lineHeight=Y+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(F=>{this.hasSelection()&&(0,u.copyHandler)(F,this._selectionService)})));const j=F=>(0,u.handlePasteEvent)(F,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",j)),this.register((0,f.addDisposableDomListener)(this.element,"paste",j)),P.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(F=>{F.button===2&&(0,u.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(F=>{(0,u.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),P.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(F=>{F.button===1&&(0,u.moveTextAreaUnderMouseCursor)(F,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(j=>this._keyUp(j)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(j=>this._keyDown(j)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(j=>this._keyPress(j)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(j=>this._compositionHelper.compositionupdate(j)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(j=>this._inputEvent(j)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(j){var F;if(!j)throw new Error("Terminal requires a parent element.");j.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=j.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),j.appendChild(this.element);const X=U.createDocumentFragment();this._viewportElement=U.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),X.appendChild(this._viewportElement),this._viewportScrollArea=U.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=U.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=U.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),X.appendChild(this.screenElement),this.textarea=U.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),P.isChromeOS||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._coreBrowserService=this._instantiationService.createInstance(S.CoreBrowserService,this.textarea,(F=this._document.defaultView)!==null&&F!==void 0?F:window),this._instantiationService.setService(w.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(Y=>this._handleTextAreaFocus(Y)))),this.register((0,f.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(h.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(w.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(A.ThemeService),this._instantiationService.setService(w.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(g.CharacterJoinerService),this._instantiationService.setService(w.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(E.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(w.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((Y=>this._onRender.fire(Y)))),this.onResize((Y=>this._renderService.resize(Y.cols,Y.rows))),this._compositionView=U.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(c.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(X);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(k.MouseService),this._instantiationService.setService(w.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(y.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((Y=>this.scrollLines(Y.amount,Y.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(x.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(w.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((Y=>this.scrollLines(Y.amount,Y.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((Y=>this._renderService.handleSelectionChanged(Y.start,Y.end,Y.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((Y=>{this.textarea.value=Y,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((Y=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(b.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(Y=>this._selectionService.handleMouseDown(Y)))),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(K.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(Y=>this._handleScreenReaderModeOptionChange(Y)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(s.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(Y=>{!this._overviewRulerRenderer&&Y&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(s.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(l.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const j=this,F=this.element;function X(G){const J=j._mouseService.getMouseReportCoords(G,j.screenElement);if(!J)return!1;let ie,Z;switch(G.overrideType||G.type){case"mousemove":Z=32,G.buttons===void 0?(ie=3,G.button!==void 0&&(ie=G.button<3?G.button:3)):ie=1&G.buttons?0:4&G.buttons?1:2&G.buttons?2:3;break;case"mouseup":Z=0,ie=G.button<3?G.button:3;break;case"mousedown":Z=1,ie=G.button<3?G.button:3;break;case"wheel":if(j.viewport.getLinesScrolled(G)===0)return!1;Z=G.deltaY<0?0:1,ie=4;break;default:return!1}return!(Z===void 0||ie===void 0||ie>4)&&j.coreMouseService.triggerMouseEvent({col:J.col,row:J.row,x:J.x,y:J.y,button:ie,action:Z,ctrl:G.ctrlKey,alt:G.altKey,shift:G.shiftKey})}const Y={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ee={mouseup:G=>(X(G),G.buttons||(this._document.removeEventListener("mouseup",Y.mouseup),Y.mousedrag&&this._document.removeEventListener("mousemove",Y.mousedrag)),this.cancel(G)),wheel:G=>(X(G),this.cancel(G,!0)),mousedrag:G=>{G.buttons&&X(G)},mousemove:G=>{G.buttons||X(G)}};this.register(this.coreMouseService.onProtocolChange((G=>{G?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(G)),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()),8&G?Y.mousemove||(F.addEventListener("mousemove",ee.mousemove),Y.mousemove=ee.mousemove):(F.removeEventListener("mousemove",Y.mousemove),Y.mousemove=null),16&G?Y.wheel||(F.addEventListener("wheel",ee.wheel,{passive:!1}),Y.wheel=ee.wheel):(F.removeEventListener("wheel",Y.wheel),Y.wheel=null),2&G?Y.mouseup||(F.addEventListener("mouseup",ee.mouseup),Y.mouseup=ee.mouseup):(this._document.removeEventListener("mouseup",Y.mouseup),F.removeEventListener("mouseup",Y.mouseup),Y.mouseup=null),4&G?Y.mousedrag||(Y.mousedrag=ee.mousedrag):(this._document.removeEventListener("mousemove",Y.mousedrag),Y.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(F,"mousedown",(G=>{if(G.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(G))return X(G),Y.mouseup&&this._document.addEventListener("mouseup",Y.mouseup),Y.mousedrag&&this._document.addEventListener("mousemove",Y.mousedrag),this.cancel(G)}))),this.register((0,f.addDisposableDomListener)(F,"wheel",(G=>{if(!Y.wheel){if(!this.buffer.hasScrollback){const J=this.viewport.getLinesScrolled(G);if(J===0)return;const ie=$.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(G.deltaY<0?"A":"B");let Z="";for(let ce=0;ce<Math.abs(J);ce++)Z+=ie;return this.coreService.triggerDataEvent(Z,!0),this.cancel(G,!0)}return this.viewport.handleWheel(G)?this.cancel(G):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(F,"touchstart",(G=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(G),this.cancel(G)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(F,"touchmove",(G=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(G)?void 0:this.cancel(G)}),{passive:!1}))}refresh(j,F){var X;(X=this._renderService)===null||X===void 0||X.refreshRows(j,F)}updateCursorStyle(j){var F;!((F=this._selectionService)===null||F===void 0)&&F.shouldColumnSelect(j)?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(j,F,X=0){var Y;X===1?(super.scrollLines(j,F,X),this.refresh(0,this.rows-1)):(Y=this.viewport)===null||Y===void 0||Y.scrollLines(j)}paste(j){(0,u.paste)(j,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(j){this._customKeyEventHandler=j}registerLinkProvider(j){return this.linkifier2.registerLinkProvider(j)}registerCharacterJoiner(j){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const F=this._characterJoinerService.register(j);return this.refresh(0,this.rows-1),F}deregisterCharacterJoiner(j){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(j)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(j){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+j)}registerDecoration(j){return this._decorationService.registerDecoration(j)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(j,F,X){this._selectionService.setSelection(j,F,X)}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 j;(j=this._selectionService)===null||j===void 0||j.clearSelection()}selectAll(){var j;(j=this._selectionService)===null||j===void 0||j.selectAll()}selectLines(j,F){var X;(X=this._selectionService)===null||X===void 0||X.selectLines(j,F)}_keyDown(j){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(j)===!1)return!1;const F=this.browser.isMac&&this.options.macOptionIsMeta&&j.altKey;if(!F&&!this._compositionHelper.keydown(j))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;F||j.key!=="Dead"&&j.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const X=(0,T.evaluateKeyboardEvent)(j,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(j),X.type===3||X.type===2){const Y=this.rows-1;return this.scrollLines(X.type===2?-Y:Y),this.cancel(j,!0)}return X.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,j)||(X.cancel&&this.cancel(j,!0),!X.key||!!(j.key&&!j.ctrlKey&&!j.altKey&&!j.metaKey&&j.key.length===1&&j.key.charCodeAt(0)>=65&&j.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(X.key!==$.C0.ETX&&X.key!==$.C0.CR||(this.textarea.value=""),this._onKey.fire({key:X.key,domEvent:j}),this._showCursor(),this.coreService.triggerDataEvent(X.key,!0),!this.optionsService.rawOptions.screenReaderMode||j.altKey||j.ctrlKey?this.cancel(j,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(j,F){const X=j.isMac&&!this.options.macOptionIsMeta&&F.altKey&&!F.ctrlKey&&!F.metaKey||j.isWindows&&F.altKey&&F.ctrlKey&&!F.metaKey||j.isWindows&&F.getModifierState("AltGraph");return F.type==="keypress"?X:X&&(!F.keyCode||F.keyCode>47)}_keyUp(j){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(j)===!1||((function(F){return F.keyCode===16||F.keyCode===17||F.keyCode===18})(j)||this.focus(),this.updateCursorStyle(j),this._keyPressHandled=!1)}_keyPress(j){let F;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(j)===!1)return!1;if(this.cancel(j),j.charCode)F=j.charCode;else if(j.which===null||j.which===void 0)F=j.keyCode;else{if(j.which===0||j.charCode===0)return!1;F=j.which}return!(!F||(j.altKey||j.ctrlKey||j.metaKey)&&!this._isThirdLevelShift(this.browser,j)||(F=String.fromCharCode(F),this._onKey.fire({key:F,domEvent:j}),this._showCursor(),this.coreService.triggerDataEvent(F,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(j){if(j.data&&j.inputType==="insertText"&&(!j.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const F=j.data;return this.coreService.triggerDataEvent(F,!0),this.cancel(j),!0}return!1}resize(j,F){j!==this.cols||F!==this.rows?super.resize(j,F):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(j,F){var X,Y;(X=this._charSizeService)===null||X===void 0||X.measure(),(Y=this.viewport)===null||Y===void 0||Y.syncScrollArea(!0)}clear(){var j;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 F=1;F<this.rows;F++)this.buffer.lines.push(this.buffer.getBlankLine(H.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(j=this.viewport)===null||j===void 0||j.reset(),this.refresh(0,this.rows-1)}}reset(){var j,F;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(j=this._selectionService)===null||j===void 0||j.reset(),this._decorationService.reset(),(F=this.viewport)===null||F===void 0||F.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var j;(j=this._renderService)===null||j===void 0||j.clearTextureAtlas()}_reportFocus(){var j;!((j=this.element)===null||j===void 0)&&j.classList.contains("focus")?this.coreService.triggerDataEvent($.C0.ESC+"[I"):this.coreService.triggerDataEvent($.C0.ESC+"[O")}_reportWindowsOptions(j){if(this._renderService)switch(j){case q.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const F=this._renderService.dimensions.css.canvas.width.toFixed(0),X=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[4;${X};${F}t`);break;case q.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const Y=this._renderService.dimensions.css.cell.width.toFixed(0),ee=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.C0.ESC}[6;${ee};${Y}t`)}}cancel(j,F){if(this.options.cancelEvents||F)return j.preventDefault(),j.stopPropagation(),!1}}r.Terminal=z},9924:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(o,u=1e3){this._renderCallback=o,this._debounceThresholdMS=u,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,u,f){this._rowCount=f,o=o!==void 0?o:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u;const a=Date.now();if(a-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=a,this._innerRefresh();else if(!this._additionalRefreshRequested){const p=a-this._lastRefreshMs,m=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),m)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,u)}}},1680:function(C,r,o){var u=this&&this.__decorate||function(c,l,h,g){var S,k=arguments.length,E=k<3?l:g===null?g=Object.getOwnPropertyDescriptor(l,h):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(c,l,h,g);else for(var x=c.length-1;x>=0;x--)(S=c[x])&&(E=(k<3?S(E):k>3?S(l,h,E):S(l,h))||E);return k>3&&E&&Object.defineProperty(l,h,E),E},f=this&&this.__param||function(c,l){return function(h,g){l(h,g,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const a=o(3656),p=o(4725),m=o(8460),y=o(844),b=o(2585);let s=r.Viewport=class extends y.Disposable{constructor(c,l,h,g,S,k,E,x){super(),this._viewportElement=c,this._scrollArea=l,this._bufferService=h,this._optionsService=g,this._charSizeService=S,this._renderService=k,this._coreBrowserService=E,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new m.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((w=>this._activeBuffer=w.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((w=>this._renderDimensions=w))),this._handleThemeChange(x.colors),this.register(x.onChangeColors((w=>this._handleThemeChange(w)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(c){this._viewportElement.style.backgroundColor=c.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(c){if(c)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const l=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==l&&(this._lastRecordedBufferHeight=l,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const c=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==c&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=c),this._refreshAnimationFrame=null}syncScrollArea(c=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(c);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(c)}_handleScroll(c){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const l=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:l,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const c=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(c*(this._smoothScrollState.target-this._smoothScrollState.origin)),c<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(c,l){const h=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(l<0&&this._viewportElement.scrollTop!==0||l>0&&h<this._lastRecordedBufferHeight)||(c.cancelable&&c.preventDefault(),!1)}handleWheel(c){const l=this._getPixelsScrolled(c);return l!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+l:this._smoothScrollState.target+=l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=l,this._bubbleScroll(c,l))}scrollLines(c){if(c!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const l=c*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:c,suppressScrollEvent:!1})}_getPixelsScrolled(c){if(c.deltaY===0||c.shiftKey)return 0;let l=this._applyScrollModifier(c.deltaY,c);return c.deltaMode===WheelEvent.DOM_DELTA_LINE?l*=this._currentRowHeight:c.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._currentRowHeight*this._bufferService.rows),l}getBufferElements(c,l){var h;let g,S="";const k=[],E=l??this._bufferService.buffer.lines.length,x=this._bufferService.buffer.lines;for(let w=c;w<E;w++){const A=x.get(w);if(!A)continue;const L=(h=x.get(w+1))===null||h===void 0?void 0:h.isWrapped;if(S+=A.translateToString(!L),!L||w===x.length-1){const R=document.createElement("div");R.textContent=S,k.push(R),S.length>0&&(g=R),S=""}}return{bufferElements:k,cursorElement:g}}getLinesScrolled(c){if(c.deltaY===0||c.shiftKey)return 0;let l=this._applyScrollModifier(c.deltaY,c);return c.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=this._currentRowHeight+0,this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):c.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(c,l){const h=this._optionsService.rawOptions.fastScrollModifier;return h==="alt"&&l.altKey||h==="ctrl"&&l.ctrlKey||h==="shift"&&l.shiftKey?c*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:c*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(c){this._lastTouchY=c.touches[0].pageY}handleTouchMove(c){const l=this._lastTouchY-c.touches[0].pageY;return this._lastTouchY=c.touches[0].pageY,l!==0&&(this._viewportElement.scrollTop+=l,this._bubbleScroll(c,l))}};r.Viewport=s=u([f(2,b.IBufferService),f(3,b.IOptionsService),f(4,p.ICharSizeService),f(5,p.IRenderService),f(6,p.ICoreBrowserService),f(7,p.IThemeService)],s)},3107:function(C,r,o){var u=this&&this.__decorate||function(s,c,l,h){var g,S=arguments.length,k=S<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(s,c,l,h);else for(var E=s.length-1;E>=0;E--)(g=s[E])&&(k=(S<3?g(k):S>3?g(c,l,k):g(c,l))||k);return S>3&&k&&Object.defineProperty(c,l,k),k},f=this&&this.__param||function(s,c){return function(l,h){c(l,h,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const a=o(3656),p=o(4725),m=o(844),y=o(2585);let b=r.BufferDecorationRenderer=class extends m.Disposable{constructor(s,c,l,h){super(),this._screenElement=s,this._bufferService=c,this._decorationService=l,this._renderService=h,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((0,a.addDisposableDomListener)(window,"resize",(()=>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((g=>this._removeDecoration(g)))),this.register((0,m.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const s of this._decorationService.decorations)this._renderDecoration(s);this._dimensionsChanged=!1}_renderDecoration(s){this._refreshStyle(s),this._dimensionsChanged&&this._refreshXPosition(s)}_createElement(s){var c,l;const h=document.createElement("div");h.classList.add("xterm-decoration"),h.classList.toggle("xterm-decoration-top-layer",((c=s?.options)===null||c===void 0?void 0:c.layer)==="top"),h.style.width=`${Math.round((s.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,h.style.height=(s.options.height||1)*this._renderService.dimensions.css.cell.height+"px",h.style.top=(s.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",h.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const g=(l=s.options.x)!==null&&l!==void 0?l:0;return g&&g>this._bufferService.cols&&(h.style.display="none"),this._refreshXPosition(s,h),h}_refreshStyle(s){const c=s.marker.line-this._bufferService.buffers.active.ydisp;if(c<0||c>=this._bufferService.rows)s.element&&(s.element.style.display="none",s.onRenderEmitter.fire(s.element));else{let l=this._decorationElements.get(s);l||(l=this._createElement(s),s.element=l,this._decorationElements.set(s,l),this._container.appendChild(l),s.onDispose((()=>{this._decorationElements.delete(s),l.remove()}))),l.style.top=c*this._renderService.dimensions.css.cell.height+"px",l.style.display=this._altBufferIsActive?"none":"block",s.onRenderEmitter.fire(l)}}_refreshXPosition(s,c=s.element){var l;if(!c)return;const h=(l=s.options.x)!==null&&l!==void 0?l:0;(s.options.anchor||"left")==="right"?c.style.right=h?h*this._renderService.dimensions.css.cell.width+"px":"":c.style.left=h?h*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(s){var c;(c=this._decorationElements.get(s))===null||c===void 0||c.remove(),this._decorationElements.delete(s),s.dispose()}};r.BufferDecorationRenderer=b=u([f(1,y.IBufferService),f(2,y.IDecorationService),f(3,p.IRenderService)],b)},5871:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=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(o){if(o.options.overviewRulerOptions){for(const u of this._zones)if(u.color===o.options.overviewRulerOptions.color&&u.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(u,o.marker.line))return;if(this._lineAdjacentToZone(u,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(u,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,u){return u>=o.startBufferLine&&u<=o.endBufferLine}_lineAdjacentToZone(o,u,f){return u>=o.startBufferLine-this._linePadding[f||"full"]&&u<=o.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(o,u){o.startBufferLine=Math.min(o.startBufferLine,u),o.endBufferLine=Math.max(o.endBufferLine,u)}}},5744:function(C,r,o){var u=this&&this.__decorate||function(g,S,k,E){var x,w=arguments.length,A=w<3?S:E===null?E=Object.getOwnPropertyDescriptor(S,k):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(g,S,k,E);else for(var L=g.length-1;L>=0;L--)(x=g[L])&&(A=(w<3?x(A):w>3?x(S,k,A):x(S,k))||A);return w>3&&A&&Object.defineProperty(S,k,A),A},f=this&&this.__param||function(g,S){return function(k,E){S(k,E,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const a=o(5871),p=o(3656),m=o(4725),y=o(844),b=o(2585),s={full:0,left:0,center:0,right:0},c={full:0,left:0,center:0,right:0},l={full:0,left:0,center:0,right:0};let h=r.OverviewRulerRenderer=class extends y.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(g,S,k,E,x,w,A){var L;super(),this._viewportElement=g,this._screenElement=S,this._bufferService=k,this._decorationService=E,this._renderService=x,this._optionsService=w,this._coreBrowseService=A,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(L=this._viewportElement.parentElement)===null||L===void 0||L.insertBefore(this._canvas,this._viewportElement);const R=this._canvas.getContext("2d");if(!R)throw new Error("Ctx cannot be null");this._ctx=R,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,y.toDisposable)((()=>{var M;(M=this._canvas)===null||M===void 0||M.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register((0,p.addDisposableDomListener)(this._coreBrowseService.window,"resize",(()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const g=Math.floor(this._canvas.width/3),S=Math.ceil(this._canvas.width/3);c.full=this._canvas.width,c.left=g,c.center=S,c.right=g,this._refreshDrawHeightConstants(),l.full=0,l.left=0,l.center=c.left,l.right=c.left+c.center}_refreshDrawHeightConstants(){s.full=Math.round(2*this._coreBrowseService.dpr);const g=this._canvas.height/this._bufferService.buffer.lines.length,S=Math.round(Math.max(Math.min(g,12),6)*this._coreBrowseService.dpr);s.left=S,s.center=S,s.right=S}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*s.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*s.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*s.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*s.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._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.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(const S of this._decorationService.decorations)this._colorZoneStore.addDecoration(S);this._ctx.lineWidth=1;const g=this._colorZoneStore.zones;for(const S of g)S.position!=="full"&&this._renderColorZone(S);for(const S of g)S.position==="full"&&this._renderColorZone(S);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(g){this._ctx.fillStyle=g.color,this._ctx.fillRect(l[g.position||"full"],Math.round((this._canvas.height-1)*(g.startBufferLine/this._bufferService.buffers.active.lines.length)-s[g.position||"full"]/2),c[g.position||"full"],Math.round((this._canvas.height-1)*((g.endBufferLine-g.startBufferLine)/this._bufferService.buffers.active.lines.length)+s[g.position||"full"]))}_queueRefresh(g,S){this._shouldUpdateDimensions=g||this._shouldUpdateDimensions,this._shouldUpdateAnchor=S||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=h=u([f(2,b.IBufferService),f(3,b.IDecorationService),f(4,m.IRenderService),f(5,b.IOptionsService),f(6,m.ICoreBrowserService)],h)},2950:function(C,r,o){var u=this&&this.__decorate||function(b,s,c,l){var h,g=arguments.length,S=g<3?s:l===null?l=Object.getOwnPropertyDescriptor(s,c):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(b,s,c,l);else for(var k=b.length-1;k>=0;k--)(h=b[k])&&(S=(g<3?h(S):g>3?h(s,c,S):h(s,c))||S);return g>3&&S&&Object.defineProperty(s,c,S),S},f=this&&this.__param||function(b,s){return function(c,l){s(c,l,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const a=o(4725),p=o(2585),m=o(2584);let y=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(b,s,c,l,h,g){this._textarea=b,this._compositionView=s,this._bufferService=c,this._optionsService=l,this._coreService=h,this._renderService=g,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(b){this._compositionView.textContent=b.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(b){if(this._isComposing||this._isSendingComposition){if(b.keyCode===229||b.keyCode===16||b.keyCode===17||b.keyCode===18)return!1;this._finalizeComposition(!1)}return b.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(b){if(this._compositionView.classList.remove("active"),this._isComposing=!1,b){const s={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let c;this._isSendingComposition=!1,s.start+=this._dataAlreadySent.length,c=this._isComposing?this._textarea.value.substring(s.start,s.end):this._textarea.value.substring(s.start),c.length>0&&this._coreService.triggerDataEvent(c,!0)}}),0)}else{this._isSendingComposition=!1;const s=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(s,!0)}}_handleAnyTextareaChanges(){const b=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const s=this._textarea.value,c=s.replace(b,"");this._dataAlreadySent=c,s.length>b.length?this._coreService.triggerDataEvent(c,!0):s.length<b.length?this._coreService.triggerDataEvent(`${m.C0.DEL}`,!0):s.length===b.length&&s!==b&&this._coreService.triggerDataEvent(s,!0)}}),0)}updateCompositionElements(b){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const s=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),c=this._renderService.dimensions.css.cell.height,l=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,h=s*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=h+"px",this._compositionView.style.top=l+"px",this._compositionView.style.height=c+"px",this._compositionView.style.lineHeight=c+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const g=this._compositionView.getBoundingClientRect();this._textarea.style.left=h+"px",this._textarea.style.top=l+"px",this._textarea.style.width=Math.max(g.width,1)+"px",this._textarea.style.height=Math.max(g.height,1)+"px",this._textarea.style.lineHeight=g.height+"px"}b||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=y=u([f(2,p.IBufferService),f(3,p.IOptionsService),f(4,p.ICoreService),f(5,a.IRenderService)],y)},9806:(C,r)=>{function o(u,f,a){const p=a.getBoundingClientRect(),m=u.getComputedStyle(a),y=parseInt(m.getPropertyValue("padding-left")),b=parseInt(m.getPropertyValue("padding-top"));return[f.clientX-p.left-y,f.clientY-p.top-b]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=o,r.getCoords=function(u,f,a,p,m,y,b,s,c){if(!y)return;const l=o(u,f,a);return l?(l[0]=Math.ceil((l[0]+(c?b/2:0))/b),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),p+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),m),l):void 0}},9504:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const u=o(2584);function f(s,c,l,h){const g=s-a(s,l),S=c-a(c,l),k=Math.abs(g-S)-(function(E,x,w){let A=0;const L=E-a(E,w),R=x-a(x,w);for(let M=0;M<Math.abs(L-R);M++){const I=p(E,x)==="A"?-1:1,P=w.buffer.lines.get(L+I*M);P?.isWrapped&&A++}return A})(s,c,l);return b(k,y(p(s,c),h))}function a(s,c){let l=0,h=c.buffer.lines.get(s),g=h?.isWrapped;for(;g&&s>=0&&s<c.rows;)l++,h=c.buffer.lines.get(--s),g=h?.isWrapped;return l}function p(s,c){return s>c?"A":"B"}function m(s,c,l,h,g,S){let k=s,E=c,x="";for(;k!==l||E!==h;)k+=g?1:-1,g&&k>S.cols-1?(x+=S.buffer.translateBufferLineToString(E,!1,s,k),k=0,s=0,E++):!g&&k<0&&(x+=S.buffer.translateBufferLineToString(E,!1,0,s+1),k=S.cols-1,s=k,E--);return x+S.buffer.translateBufferLineToString(E,!1,s,k)}function y(s,c){const l=c?"O":"[";return u.C0.ESC+l+s}function b(s,c){s=Math.floor(s);let l="";for(let h=0;h<s;h++)l+=c;return l}r.moveToCellSequence=function(s,c,l,h){const g=l.buffer.x,S=l.buffer.y;if(!l.buffer.hasScrollback)return(function(x,w,A,L,R,M){return f(w,L,R,M).length===0?"":b(m(x,w,x,w-a(w,R),!1,R).length,y("D",M))})(g,S,0,c,l,h)+f(S,c,l,h)+(function(x,w,A,L,R,M){let I;I=f(w,L,R,M).length>0?L-a(L,R):w;const P=L,H=(function($,T,O,D,B,q){let K;return K=f(O,D,B,q).length>0?D-a(D,B):T,$<O&&K<=D||$>=O&&K<D?"C":"D"})(x,w,A,L,R,M);return b(m(x,I,A,P,H==="C",R).length,y(H,M))})(g,S,s,c,l,h);let k;if(S===c)return k=g>s?"D":"C",b(Math.abs(g-s),y(k,h));k=S>c?"D":"C";const E=Math.abs(S-c);return b((function(x,w){return w.cols-x})(S>c?s:g,l)+(E-1)*l.cols+1+((S>c?g:s)-1),y(k,h))}},1296:function(C,r,o){var u=this&&this.__decorate||function(R,M,I,P){var H,$=arguments.length,T=$<3?M:P===null?P=Object.getOwnPropertyDescriptor(M,I):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(R,M,I,P);else for(var O=R.length-1;O>=0;O--)(H=R[O])&&(T=($<3?H(T):$>3?H(M,I,T):H(M,I))||T);return $>3&&T&&Object.defineProperty(M,I,T),T},f=this&&this.__param||function(R,M){return function(I,P){M(I,P,R)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const a=o(3787),p=o(2550),m=o(2223),y=o(6171),b=o(4725),s=o(8055),c=o(8460),l=o(844),h=o(2585),g="xterm-dom-renderer-owner-",S="xterm-rows",k="xterm-fg-",E="xterm-bg-",x="xterm-focus",w="xterm-selection";let A=1,L=r.DomRenderer=class extends l.Disposable{constructor(R,M,I,P,H,$,T,O,D,B){super(),this._element=R,this._screenElement=M,this._viewportElement=I,this._linkifier2=P,this._charSizeService=$,this._optionsService=T,this._bufferService=O,this._coreBrowserService=D,this._themeService=B,this._terminalClass=A++,this._rowElements=[],this.onRequestRedraw=this.register(new c.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(S),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(w),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,y.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((q=>this._injectCss(q)))),this._injectCss(this._themeService.colors),this._rowFactory=H.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(g+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((q=>this._handleLinkHover(q)))),this.register(this._linkifier2.onHideLinkUnderline((q=>this._handleLinkLeave(q)))),this.register((0,l.toDisposable)((()=>{this._element.classList.remove(g+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new p.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const R=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*R,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*R),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/R),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/R),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(const I of this._rowElements)I.style.width=`${this.dimensions.css.canvas.width}px`,I.style.height=`${this.dimensions.css.cell.height}px`,I.style.lineHeight=`${this.dimensions.css.cell.height}px`,I.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const M=`${this._terminalSelector} .${S} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=M,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(R){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let M=`${this._terminalSelector} .${S} { color: ${R.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;M+=`${this._terminalSelector} .${S} .xterm-dim { color: ${s.color.multiplyOpacity(R.foreground,.5).css};}`,M+=`${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;}`,M+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",M+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css}; } 50% { background-color: inherit; color: ${R.cursor.css}; }}`,M+=`${this._terminalSelector} .${S}.${x} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${S}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-block { background-color: ${R.cursor.css}; color: ${R.cursorAccent.css};}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${R.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${R.cursor.css} inset;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${R.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,M+=`${this._terminalSelector} .${w} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${w} div { position: absolute; background-color: ${R.selectionBackgroundOpaque.css};}${this._terminalSelector} .${w} div { position: absolute; background-color: ${R.selectionInactiveBackgroundOpaque.css};}`;for(const[I,P]of R.ansi.entries())M+=`${this._terminalSelector} .${k}${I} { color: ${P.css}; }${this._terminalSelector} .${k}${I}.xterm-dim { color: ${s.color.multiplyOpacity(P,.5).css}; }${this._terminalSelector} .${E}${I} { background-color: ${P.css}; }`;M+=`${this._terminalSelector} .${k}${m.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(R.background).css}; }${this._terminalSelector} .${k}${m.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${s.color.multiplyOpacity(s.color.opaque(R.background),.5).css}; }${this._terminalSelector} .${E}${m.INVERTED_DEFAULT_COLOR} { background-color: ${R.foreground.css}; }`,this._themeStyleElement.textContent=M}_setDefaultSpacing(){const R=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${R}px`,this._rowFactory.defaultSpacing=R}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(R,M){for(let I=this._rowElements.length;I<=M;I++){const P=document.createElement("div");this._rowContainer.appendChild(P),this._rowElements.push(P)}for(;this._rowElements.length>M;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(R,M){this._refreshRowElements(R,M),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(x)}handleFocus(){this._rowContainer.classList.add(x),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(R,M,I){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(R,M,I),this.renderRows(0,this._bufferService.rows-1),!R||!M)return;const P=R[1]-this._bufferService.buffer.ydisp,H=M[1]-this._bufferService.buffer.ydisp,$=Math.max(P,0),T=Math.min(H,this._bufferService.rows-1);if($>=this._bufferService.rows||T<0)return;const O=document.createDocumentFragment();if(I){const D=R[0]>M[0];O.appendChild(this._createSelectionElement($,D?M[0]:R[0],D?R[0]:M[0],T-$+1))}else{const D=P===$?R[0]:0,B=$===H?M[0]:this._bufferService.cols;O.appendChild(this._createSelectionElement($,D,B));const q=T-$-1;if(O.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,q)),$!==T){const K=H===T?M[0]:this._bufferService.cols;O.appendChild(this._createSelectionElement(T,0,K))}}this._selectionContainer.appendChild(O)}_createSelectionElement(R,M,I,P=1){const H=document.createElement("div");return H.style.height=P*this.dimensions.css.cell.height+"px",H.style.top=R*this.dimensions.css.cell.height+"px",H.style.left=M*this.dimensions.css.cell.width+"px",H.style.width=this.dimensions.css.cell.width*(I-M)+"px",H}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(const R of this._rowElements)R.replaceChildren()}renderRows(R,M){const I=this._bufferService.buffer,P=I.ybase+I.y,H=Math.min(I.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,T=this._optionsService.rawOptions.cursorStyle,O=this._optionsService.rawOptions.cursorInactiveStyle;for(let D=R;D<=M;D++){const B=D+I.ydisp,q=this._rowElements[D],K=I.lines.get(B);if(!q||!K)break;q.replaceChildren(...this._rowFactory.createRow(K,B,B===P,T,O,H,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${g}${this._terminalClass}`}_handleLinkHover(R){this._setCellUnderline(R.x1,R.x2,R.y1,R.y2,R.cols,!0)}_handleLinkLeave(R){this._setCellUnderline(R.x1,R.x2,R.y1,R.y2,R.cols,!1)}_setCellUnderline(R,M,I,P,H,$){I<0&&(R=0),P<0&&(M=0);const T=this._bufferService.rows-1;I=Math.max(Math.min(I,T),0),P=Math.max(Math.min(P,T),0),H=Math.min(H,this._bufferService.cols);const O=this._bufferService.buffer,D=O.ybase+O.y,B=Math.min(O.x,H-1),q=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,U=this._optionsService.rawOptions.cursorInactiveStyle;for(let z=I;z<=P;++z){const W=z+O.ydisp,j=this._rowElements[z],F=O.lines.get(W);if(!j||!F)break;j.replaceChildren(...this._rowFactory.createRow(F,W,W===D,K,U,B,q,this.dimensions.css.cell.width,this._widthCache,$?z===I?R:0:-1,$?(z===P?M:H)-1:-1))}}};r.DomRenderer=L=u([f(4,h.IInstantiationService),f(5,b.ICharSizeService),f(6,h.IOptionsService),f(7,h.IBufferService),f(8,b.ICoreBrowserService),f(9,b.IThemeService)],L)},3787:function(C,r,o){var u=this&&this.__decorate||function(k,E,x,w){var A,L=arguments.length,R=L<3?E:w===null?w=Object.getOwnPropertyDescriptor(E,x):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(k,E,x,w);else for(var M=k.length-1;M>=0;M--)(A=k[M])&&(R=(L<3?A(R):L>3?A(E,x,R):A(E,x))||R);return L>3&&R&&Object.defineProperty(E,x,R),R},f=this&&this.__param||function(k,E){return function(x,w){E(x,w,k)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const a=o(2223),p=o(643),m=o(511),y=o(2585),b=o(8055),s=o(4725),c=o(4269),l=o(6171),h=o(3734);let g=r.DomRendererRowFactory=class{constructor(k,E,x,w,A,L,R){this._document=k,this._characterJoinerService=E,this._optionsService=x,this._coreBrowserService=w,this._coreService=A,this._decorationService=L,this._themeService=R,this._workCell=new m.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(k,E,x){this._selectionStart=k,this._selectionEnd=E,this._columnSelectMode=x}createRow(k,E,x,w,A,L,R,M,I,P,H){const $=[],T=this._characterJoinerService.getJoinedCharacters(E),O=this._themeService.colors;let D,B=k.getNoBgTrimmedLength();x&&B<L+1&&(B=L+1);let q=0,K="",U=0,z=0,W=0,j=!1,F=0,X=!1,Y=0;const ee=[],G=P!==-1&&H!==-1;for(let J=0;J<B;J++){k.loadCell(J,this._workCell);let ie=this._workCell.getWidth();if(ie===0)continue;let Z=!1,ce=J,se=this._workCell;if(T.length>0&&J===T[0][0]){Z=!0;const he=T.shift();se=new c.JoinedCellData(this._workCell,k.translateToString(!0,he[0],he[1]),he[1]-he[0]),ce=he[1]-1,ie=se.getWidth()}const we=this._isCellInSelection(J,E),Me=x&&J===L,We=G&&J>=P&&J<=H;let lt=!1;this._decorationService.forEachDecorationAtCell(J,E,void 0,(he=>{lt=!0}));let ct=se.getChars()||p.WHITESPACE_CELL_CHAR;if(ct===" "&&(se.isUnderline()||se.isOverline())&&(ct=" "),Y=ie*M-I.get(ct,se.isBold(),se.isItalic()),D){if(q&&(we&&X||!we&&!X&&se.bg===U)&&(we&&X&&O.selectionForeground||se.fg===z)&&se.extended.ext===W&&We===j&&Y===F&&!Me&&!Z&&!lt){K+=ct,q++;continue}q&&(D.textContent=K),D=this._document.createElement("span"),q=0,K=""}else D=this._document.createElement("span");if(U=se.bg,z=se.fg,W=se.extended.ext,j=We,F=Y,X=we,Z&&L>=J&&L<=ce&&(L=J),!this._coreService.isCursorHidden&&Me){if(ee.push("xterm-cursor"),this._coreBrowserService.isFocused)R&&ee.push("xterm-cursor-blink"),ee.push(w==="bar"?"xterm-cursor-bar":w==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(A)switch(A){case"outline":ee.push("xterm-cursor-outline");break;case"block":ee.push("xterm-cursor-block");break;case"bar":ee.push("xterm-cursor-bar");break;case"underline":ee.push("xterm-cursor-underline")}}if(se.isBold()&&ee.push("xterm-bold"),se.isItalic()&&ee.push("xterm-italic"),se.isDim()&&ee.push("xterm-dim"),K=se.isInvisible()?p.WHITESPACE_CELL_CHAR:se.getChars()||p.WHITESPACE_CELL_CHAR,se.isUnderline()&&(ee.push(`xterm-underline-${se.extended.underlineStyle}`),K===" "&&(K=" "),!se.isUnderlineColorDefault()))if(se.isUnderlineColorRGB())D.style.textDecorationColor=`rgb(${h.AttributeData.toColorRGB(se.getUnderlineColor()).join(",")})`;else{let he=se.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&se.isBold()&&he<8&&(he+=8),D.style.textDecorationColor=O.ansi[he].css}se.isOverline()&&(ee.push("xterm-overline"),K===" "&&(K=" ")),se.isStrikethrough()&&ee.push("xterm-strikethrough"),We&&(D.style.textDecoration="underline");let Se=se.getFgColor(),Je=se.getFgColorMode(),be=se.getBgColor(),Ce=se.getBgColorMode();const et=!!se.isInverse();if(et){const he=Se;Se=be,be=he;const rs=Je;Je=Ce,Ce=rs}let Ee,tt,De,st=!1;switch(this._decorationService.forEachDecorationAtCell(J,E,void 0,(he=>{he.options.layer!=="top"&&st||(he.backgroundColorRGB&&(Ce=50331648,be=he.backgroundColorRGB.rgba>>8&16777215,Ee=he.backgroundColorRGB),he.foregroundColorRGB&&(Je=50331648,Se=he.foregroundColorRGB.rgba>>8&16777215,tt=he.foregroundColorRGB),st=he.options.layer==="top")})),!st&&we&&(Ee=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,be=Ee.rgba>>8&16777215,Ce=50331648,st=!0,O.selectionForeground&&(Je=50331648,Se=O.selectionForeground.rgba>>8&16777215,tt=O.selectionForeground)),st&&ee.push("xterm-decoration-top"),Ce){case 16777216:case 33554432:De=O.ansi[be],ee.push(`xterm-bg-${be}`);break;case 50331648:De=b.rgba.toColor(be>>16,be>>8&255,255&be),this._addStyle(D,`background-color:#${S((be>>>0).toString(16),"0",6)}`);break;default:et?(De=O.foreground,ee.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):De=O.background}switch(Ee||se.isDim()&&(Ee=b.color.multiplyOpacity(De,.5)),Je){case 16777216:case 33554432:se.isBold()&&Se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Se+=8),this._applyMinimumContrast(D,De,O.ansi[Se],se,Ee,void 0)||ee.push(`xterm-fg-${Se}`);break;case 50331648:const he=b.rgba.toColor(Se>>16&255,Se>>8&255,255&Se);this._applyMinimumContrast(D,De,he,se,Ee,tt)||this._addStyle(D,`color:#${S(Se.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(D,De,O.foreground,se,Ee,void 0)||et&&ee.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}ee.length&&(D.className=ee.join(" "),ee.length=0),Me||Z||lt?D.textContent=K:q++,Y!==this.defaultSpacing&&(D.style.letterSpacing=`${Y}px`),$.push(D),J=ce}return D&&q&&(D.textContent=K),$}_applyMinimumContrast(k,E,x,w,A,L){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,l.excludeFromContrastRatioDemands)(w.getCode()))return!1;const R=this._getContrastCache(w);let M;if(A||L||(M=R.getColor(E.rgba,x.rgba)),M===void 0){const I=this._optionsService.rawOptions.minimumContrastRatio/(w.isDim()?2:1);M=b.color.ensureContrastRatio(A||E,L||x,I),R.setColor((A||E).rgba,(L||x).rgba,M??null)}return!!M&&(this._addStyle(k,`color:${M.css}`),!0)}_getContrastCache(k){return k.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(k,E){k.setAttribute("style",`${k.getAttribute("style")||""}${E};`)}_isCellInSelection(k,E){const x=this._selectionStart,w=this._selectionEnd;return!(!x||!w)&&(this._columnSelectMode?x[0]<=w[0]?k>=x[0]&&E>=x[1]&&k<w[0]&&E<=w[1]:k<x[0]&&E>=x[1]&&k>=w[0]&&E<=w[1]:E>x[1]&&E<w[1]||x[1]===w[1]&&E===x[1]&&k>=x[0]&&k<w[0]||x[1]<w[1]&&E===w[1]&&k<w[0]||x[1]<w[1]&&E===x[1]&&k>=x[0])}};function S(k,E,x){for(;k.length<x;)k=E+k;return k}r.DomRendererRowFactory=g=u([f(1,s.ICharacterJoinerService),f(2,y.IOptionsService),f(3,s.ICoreBrowserService),f(4,y.ICoreService),f(5,y.IDecorationService),f(6,s.IThemeService)],g)},2550:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(o){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.createElement("div"),this._container.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const u=o.createElement("span"),f=o.createElement("span");f.style.fontWeight="bold";const a=o.createElement("span");a.style.fontStyle="italic";const p=o.createElement("span");p.style.fontWeight="bold",p.style.fontStyle="italic",this._measureElements=[u,f,a,p],this._container.appendChild(u),this._container.appendChild(f),this._container.appendChild(a),this._container.appendChild(p),o.body.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(o,u,f,a){o===this._font&&u===this._fontSize&&f===this._weight&&a===this._weightBold||(this._font=o,this._fontSize=u,this._weight=f,this._weightBold=a,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${a}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${a}`,this.clear())}get(o,u,f){let a=0;if(!u&&!f&&o.length===1&&(a=o.charCodeAt(0))<256)return this._flat[a]!==-9999?this._flat[a]:this._flat[a]=this._measure(o,0);let p=o;u&&(p+="B"),f&&(p+="I");let m=this._holey.get(p);if(m===void 0){let y=0;u&&(y|=1),f&&(y|=2),m=this._measure(o,y),this._holey.set(p,m)}return m}_measure(o,u){const f=this._measureElements[u];return f.textContent=o.repeat(32),f.offsetWidth/32}}},2223:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const u=o(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=u.isFirefox||u.isLegacyEdge?"bottom":"ideographic"},6171:(C,r)=>{function o(u){return 57508<=u&&u<=57558}Object.defineProperty(r,"__esModule",{value:!0}),r.createRenderDimensions=r.excludeFromContrastRatioDemands=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(u){if(!u)throw new Error("value must not be falsy");return u},r.isPowerlineGlyph=o,r.isRestrictedPowerlineGlyph=function(u){return 57520<=u&&u<=57527},r.excludeFromContrastRatioDemands=function(u){return o(u)||(function(f){return 9472<=f&&f<=9631})(u)},r.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}},456:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(o){this._bufferService=o,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.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()){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,u=this.selectionEnd;return!(!o||!u)&&(o[1]>u[1]||o[1]===u[1]&&o[0]>u[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(C,r,o){var u=this&&this.__decorate||function(s,c,l,h){var g,S=arguments.length,k=S<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(s,c,l,h);else for(var E=s.length-1;E>=0;E--)(g=s[E])&&(k=(S<3?g(k):S>3?g(c,l,k):g(c,l))||k);return S>3&&k&&Object.defineProperty(c,l,k),k},f=this&&this.__param||function(s,c){return function(l,h){c(l,h,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const a=o(2585),p=o(8460),m=o(844);let y=r.CharSizeService=class extends m.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(s,c,l){super(),this._optionsService=l,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new b(s,c,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const s=this._measureStrategy.measure();s.width===this.width&&s.height===this.height||(this.width=s.width,this.height=s.height,this._onCharSizeChange.fire())}};r.CharSizeService=y=u([f(2,a.IOptionsService)],y);class b{constructor(c,l,h){this._document=c,this._parentElement=l,this._optionsService=h,this._result={width:0,height:0},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(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const c={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return c.width!==0&&c.height!==0&&(this._result.width=c.width/32,this._result.height=Math.ceil(c.height)),this._result}}},4269:function(C,r,o){var u=this&&this.__decorate||function(c,l,h,g){var S,k=arguments.length,E=k<3?l:g===null?g=Object.getOwnPropertyDescriptor(l,h):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(c,l,h,g);else for(var x=c.length-1;x>=0;x--)(S=c[x])&&(E=(k<3?S(E):k>3?S(l,h,E):S(l,h))||E);return k>3&&E&&Object.defineProperty(l,h,E),E},f=this&&this.__param||function(c,l){return function(h,g){l(h,g,c)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const a=o(3734),p=o(643),m=o(511),y=o(2585);class b extends a.AttributeData{constructor(l,h,g){super(),this.content=0,this.combinedData="",this.fg=l.fg,this.bg=l.bg,this.combinedData=h,this._width=g}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(l){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=b;let s=r.CharacterJoinerService=class Mi{constructor(l){this._bufferService=l,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new m.CellData}register(l){const h={id:this._nextCharacterJoinerId++,handler:l};return this._characterJoiners.push(h),h.id}deregister(l){for(let h=0;h<this._characterJoiners.length;h++)if(this._characterJoiners[h].id===l)return this._characterJoiners.splice(h,1),!0;return!1}getJoinedCharacters(l){if(this._characterJoiners.length===0)return[];const h=this._bufferService.buffer.lines.get(l);if(!h||h.length===0)return[];const g=[],S=h.translateToString(!0);let k=0,E=0,x=0,w=h.getFg(0),A=h.getBg(0);for(let L=0;L<h.getTrimmedLength();L++)if(h.loadCell(L,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==w||this._workCell.bg!==A){if(L-k>1){const R=this._getJoinedRanges(S,x,E,h,k);for(let M=0;M<R.length;M++)g.push(R[M])}k=L,x=E,w=this._workCell.fg,A=this._workCell.bg}E+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-k>1){const L=this._getJoinedRanges(S,x,E,h,k);for(let R=0;R<L.length;R++)g.push(L[R])}return g}_getJoinedRanges(l,h,g,S,k){const E=l.substring(h,g);let x=[];try{x=this._characterJoiners[0].handler(E)}catch(w){console.error(w)}for(let w=1;w<this._characterJoiners.length;w++)try{const A=this._characterJoiners[w].handler(E);for(let L=0;L<A.length;L++)Mi._mergeRanges(x,A[L])}catch(A){console.error(A)}return this._stringRangesToCellRanges(x,S,k),x}_stringRangesToCellRanges(l,h,g){let S=0,k=!1,E=0,x=l[S];if(x){for(let w=g;w<this._bufferService.cols;w++){const A=h.getWidth(w),L=h.getString(w).length||p.WHITESPACE_CELL_CHAR.length;if(A!==0){if(!k&&x[0]<=E&&(x[0]=w,k=!0),x[1]<=E){if(x[1]=w,x=l[++S],!x)break;x[0]<=E?(x[0]=w,k=!0):k=!1}E+=L}}x&&(x[1]=this._bufferService.cols)}}static _mergeRanges(l,h){let g=!1;for(let S=0;S<l.length;S++){const k=l[S];if(g){if(h[1]<=k[0])return l[S-1][1]=h[1],l;if(h[1]<=k[1])return l[S-1][1]=Math.max(h[1],k[1]),l.splice(S,1),l;l.splice(S,1),S--}else{if(h[1]<=k[0])return l.splice(S,0,h),l;if(h[1]<=k[1])return k[0]=Math.min(h[0],k[0]),l;h[0]<k[1]&&(k[0]=Math.min(h[0],k[0]),g=!0)}}return g?l[l.length-1][1]=h[1]:l.push(h),l}};r.CharacterJoinerService=s=u([f(0,y.IBufferService)],s)},5114:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0,r.CoreBrowserService=class{constructor(o,u){this._textarea=o,this.window=u,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}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}}},8934:function(C,r,o){var u=this&&this.__decorate||function(y,b,s,c){var l,h=arguments.length,g=h<3?b:c===null?c=Object.getOwnPropertyDescriptor(b,s):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(y,b,s,c);else for(var S=y.length-1;S>=0;S--)(l=y[S])&&(g=(h<3?l(g):h>3?l(b,s,g):l(b,s))||g);return h>3&&g&&Object.defineProperty(b,s,g),g},f=this&&this.__param||function(y,b){return function(s,c){b(s,c,y)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const a=o(4725),p=o(9806);let m=r.MouseService=class{constructor(y,b){this._renderService=y,this._charSizeService=b}getCoords(y,b,s,c,l){return(0,p.getCoords)(window,y,b,s,c,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(y,b){const s=(0,p.getCoordsRelativeToElement)(window,y,b);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])}}};r.MouseService=m=u([f(0,a.IRenderService),f(1,a.ICharSizeService)],m)},3230:function(C,r,o){var u=this&&this.__decorate||function(g,S,k,E){var x,w=arguments.length,A=w<3?S:E===null?E=Object.getOwnPropertyDescriptor(S,k):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(g,S,k,E);else for(var L=g.length-1;L>=0;L--)(x=g[L])&&(A=(w<3?x(A):w>3?x(S,k,A):x(S,k))||A);return w>3&&A&&Object.defineProperty(S,k,A),A},f=this&&this.__param||function(g,S){return function(k,E){S(k,E,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const a=o(3656),p=o(6193),m=o(5596),y=o(4725),b=o(8460),s=o(844),c=o(7226),l=o(2585);let h=r.RenderService=class extends s.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(g,S,k,E,x,w,A,L){if(super(),this._rowCount=g,this._charSizeService=E,this._renderer=this.register(new s.MutableDisposable),this._pausedResizeTask=new c.DebouncedIdleTask,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 b.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new b.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new b.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new b.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new p.RenderDebouncer(A.window,((R,M)=>this._renderRows(R,M))),this.register(this._renderDebouncer),this._screenDprMonitor=new m.ScreenDprMonitor(A.window),this._screenDprMonitor.setListener((()=>this.handleDevicePixelRatioChange())),this.register(this._screenDprMonitor),this.register(w.onResize((()=>this._fullRefresh()))),this.register(w.buffers.onBufferActivate((()=>{var R;return(R=this._renderer.value)===null||R===void 0?void 0:R.clear()}))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(x.onDecorationRegistered((()=>this._fullRefresh()))),this.register(x.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],(()=>{this.clear(),this.handleResize(w.cols,w.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(w.buffer.y,w.buffer.y,!0)))),this.register((0,a.addDisposableDomListener)(A.window,"resize",(()=>this.handleDevicePixelRatioChange()))),this.register(L.onChangeColors((()=>this._fullRefresh()))),"IntersectionObserver"in A.window){const R=new A.window.IntersectionObserver((M=>this._handleIntersectionChange(M[M.length-1])),{threshold:0});R.observe(S),this.register({dispose:()=>R.disconnect()})}}_handleIntersectionChange(g){this._isPaused=g.isIntersecting===void 0?g.intersectionRatio===0:!g.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(g,S,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(g,S,this._rowCount))}_renderRows(g,S){this._renderer.value&&(g=Math.min(g,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(g,S),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:g,end:S}),this._onRender.fire({start:g,end:S}),this._isNextRenderRedrawOnly=!0)}resize(g,S){this._rowCount=S,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(g){this._renderer.value=g,this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(g){return this._renderDebouncer.addRefreshCallback(g)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var g,S;this._renderer.value&&((S=(g=this._renderer.value).clearTextureAtlas)===null||S===void 0||S.call(g),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(g,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value.handleResize(g,S))):this._renderer.value.handleResize(g,S),this._fullRefresh())}handleCharSizeChanged(){var g;(g=this._renderer.value)===null||g===void 0||g.handleCharSizeChanged()}handleBlur(){var g;(g=this._renderer.value)===null||g===void 0||g.handleBlur()}handleFocus(){var g;(g=this._renderer.value)===null||g===void 0||g.handleFocus()}handleSelectionChanged(g,S,k){var E;this._selectionState.start=g,this._selectionState.end=S,this._selectionState.columnSelectMode=k,(E=this._renderer.value)===null||E===void 0||E.handleSelectionChanged(g,S,k)}handleCursorMove(){var g;(g=this._renderer.value)===null||g===void 0||g.handleCursorMove()}clear(){var g;(g=this._renderer.value)===null||g===void 0||g.clear()}};r.RenderService=h=u([f(2,l.IOptionsService),f(3,y.ICharSizeService),f(4,l.IDecorationService),f(5,l.IBufferService),f(6,y.ICoreBrowserService),f(7,y.IThemeService)],h)},9312:function(C,r,o){var u=this&&this.__decorate||function(x,w,A,L){var R,M=arguments.length,I=M<3?w:L===null?L=Object.getOwnPropertyDescriptor(w,A):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(x,w,A,L);else for(var P=x.length-1;P>=0;P--)(R=x[P])&&(I=(M<3?R(I):M>3?R(w,A,I):R(w,A))||I);return M>3&&I&&Object.defineProperty(w,A,I),I},f=this&&this.__param||function(x,w){return function(A,L){w(A,L,x)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const a=o(9806),p=o(9504),m=o(456),y=o(4725),b=o(8460),s=o(844),c=o(6114),l=o(4841),h=o(511),g=o(2585),S=" ",k=new RegExp(S,"g");let E=r.SelectionService=class extends s.Disposable{constructor(x,w,A,L,R,M,I,P,H){super(),this._element=x,this._screenElement=w,this._linkifier=A,this._bufferService=L,this._coreService=R,this._mouseService=M,this._optionsService=I,this._renderService=P,this._coreBrowserService=H,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new h.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new b.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new b.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new b.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new b.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=$=>this._handleMouseMove($),this._mouseUpListener=$=>this._handleMouseUp($),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim(($=>this._handleTrim($))),this.register(this._bufferService.buffers.onBufferActivate(($=>this._handleBufferActivate($)))),this.enable(),this._model=new m.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,s.toDisposable)((()=>{this._removeMouseDownListeners()})))}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(){const x=this._model.finalSelectionStart,w=this._model.finalSelectionEnd;return!(!x||!w||x[0]===w[0]&&x[1]===w[1])}get selectionText(){const x=this._model.finalSelectionStart,w=this._model.finalSelectionEnd;if(!x||!w)return"";const A=this._bufferService.buffer,L=[];if(this._activeSelectionMode===3){if(x[0]===w[0])return"";const R=x[0]<w[0]?x[0]:w[0],M=x[0]<w[0]?w[0]:x[0];for(let I=x[1];I<=w[1];I++){const P=A.translateBufferLineToString(I,!0,R,M);L.push(P)}}else{const R=x[1]===w[1]?w[0]:void 0;L.push(A.translateBufferLineToString(x[1],!0,x[0],R));for(let M=x[1]+1;M<=w[1]-1;M++){const I=A.lines.get(M),P=A.translateBufferLineToString(M,!0);I?.isWrapped?L[L.length-1]+=P:L.push(P)}if(x[1]!==w[1]){const M=A.lines.get(w[1]),I=A.translateBufferLineToString(w[1],!0,0,w[0]);M&&M.isWrapped?L[L.length-1]+=I:L.push(I)}}return L.map((R=>R.replace(k," "))).join(c.isWindows?`\r
|
|
13
|
+
`:`
|
|
14
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(x){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),c.isLinux&&x&&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(x){const w=this._getMouseBufferCoords(x),A=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!!(A&&L&&w)&&this._areCoordsInSelection(w,A,L)}isCellInSelection(x,w){const A=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!A||!L)&&this._areCoordsInSelection([x,w],A,L)}_areCoordsInSelection(x,w,A){return x[1]>w[1]&&x[1]<A[1]||w[1]===A[1]&&x[1]===w[1]&&x[0]>=w[0]&&x[0]<A[0]||w[1]<A[1]&&x[1]===A[1]&&x[0]<A[0]||w[1]<A[1]&&x[1]===w[1]&&x[0]>=w[0]}_selectWordAtCursor(x,w){var A,L;const R=(L=(A=this._linkifier.currentLink)===null||A===void 0?void 0:A.link)===null||L===void 0?void 0:L.range;if(R)return this._model.selectionStart=[R.start.x-1,R.start.y-1],this._model.selectionStartLength=(0,l.getRangeLength)(R,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const M=this._getMouseBufferCoords(x);return!!M&&(this._selectWordAt(M,w),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(x,w){this._model.clearSelection(),x=Math.max(x,0),w=Math.min(w,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,x],this._model.selectionEnd=[this._bufferService.cols,w],this.refresh(),this._onSelectionChange.fire()}_handleTrim(x){this._model.handleTrim(x)&&this.refresh()}_getMouseBufferCoords(x){const w=this._mouseService.getCoords(x,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(w)return w[0]--,w[1]--,w[1]+=this._bufferService.buffer.ydisp,w}_getMouseEventScrollAmount(x){let w=(0,a.getCoordsRelativeToElement)(this._coreBrowserService.window,x,this._screenElement)[1];const A=this._renderService.dimensions.css.canvas.height;return w>=0&&w<=A?0:(w>A&&(w-=A),w=Math.min(Math.max(w,-50),50),w/=50,w/Math.abs(w)+Math.round(14*w))}shouldForceSelection(x){return c.isMac?x.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:x.shiftKey}handleMouseDown(x){if(this._mouseDownTimeStamp=x.timeStamp,(x.button!==2||!this.hasSelection)&&x.button===0){if(!this._enabled){if(!this.shouldForceSelection(x))return;x.stopPropagation()}x.preventDefault(),this._dragScrollAmount=0,this._enabled&&x.shiftKey?this._handleIncrementalClick(x):x.detail===1?this._handleSingleClick(x):x.detail===2?this._handleDoubleClick(x):x.detail===3&&this._handleTripleClick(x),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()),50)}_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(x){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(x))}_handleSingleClick(x){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(x)?3:0,this._model.selectionStart=this._getMouseBufferCoords(x),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const w=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);w&&w.length!==this._model.selectionStart[0]&&w.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(x){this._selectWordAtCursor(x,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(x){const w=this._getMouseBufferCoords(x);w&&(this._activeSelectionMode=2,this._selectLineAt(w[1]))}shouldColumnSelect(x){return x.altKey&&!(c.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(x){if(x.stopImmediatePropagation(),!this._model.selectionStart)return;const w=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(x),!this._model.selectionEnd)return void this.refresh(!0);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(x),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const A=this._bufferService.buffer;if(this._model.selectionEnd[1]<A.lines.length){const L=A.lines.get(this._model.selectionEnd[1]);L&&L.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}w&&w[0]===this._model.selectionEnd[0]&&w[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});const x=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(x.ydisp+this._bufferService.rows,x.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=x.ydisp),this.refresh()}}_handleMouseUp(x){const w=x.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&w<500&&x.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const A=this._mouseService.getCoords(x,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(A&&A[0]!==void 0&&A[1]!==void 0){const L=(0,p.moveToCellSequence)(A[0]-1,A[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(L,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const x=this._model.finalSelectionStart,w=this._model.finalSelectionEnd,A=!(!x||!w||x[0]===w[0]&&x[1]===w[1]);A?x&&w&&(this._oldSelectionStart&&this._oldSelectionEnd&&x[0]===this._oldSelectionStart[0]&&x[1]===this._oldSelectionStart[1]&&w[0]===this._oldSelectionEnd[0]&&w[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(x,w,A)):this._oldHasSelection&&this._fireOnSelectionChange(x,w,A)}_fireOnSelectionChange(x,w,A){this._oldSelectionStart=x,this._oldSelectionEnd=w,this._oldHasSelection=A,this._onSelectionChange.fire()}_handleBufferActivate(x){this.clearSelection(),this._trimListener.dispose(),this._trimListener=x.activeBuffer.lines.onTrim((w=>this._handleTrim(w)))}_convertViewportColToCharacterIndex(x,w){let A=w;for(let L=0;w>=L;L++){const R=x.loadCell(L,this._workCell).getChars().length;this._workCell.getWidth()===0?A--:R>1&&w!==L&&(A+=R-1)}return A}setSelection(x,w,A){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[x,w],this._model.selectionStartLength=A,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(x){this._isClickInSelection(x)||(this._selectWordAtCursor(x,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(x,w,A=!0,L=!0){if(x[0]>=this._bufferService.cols)return;const R=this._bufferService.buffer,M=R.lines.get(x[1]);if(!M)return;const I=R.translateBufferLineToString(x[1],!1);let P=this._convertViewportColToCharacterIndex(M,x[0]),H=P;const $=x[0]-P;let T=0,O=0,D=0,B=0;if(I.charAt(P)===" "){for(;P>0&&I.charAt(P-1)===" ";)P--;for(;H<I.length&&I.charAt(H+1)===" ";)H++}else{let U=x[0],z=x[0];M.getWidth(U)===0&&(T++,U--),M.getWidth(z)===2&&(O++,z++);const W=M.getString(z).length;for(W>1&&(B+=W-1,H+=W-1);U>0&&P>0&&!this._isCharWordSeparator(M.loadCell(U-1,this._workCell));){M.loadCell(U-1,this._workCell);const j=this._workCell.getChars().length;this._workCell.getWidth()===0?(T++,U--):j>1&&(D+=j-1,P-=j-1),P--,U--}for(;z<M.length&&H+1<I.length&&!this._isCharWordSeparator(M.loadCell(z+1,this._workCell));){M.loadCell(z+1,this._workCell);const j=this._workCell.getChars().length;this._workCell.getWidth()===2?(O++,z++):j>1&&(B+=j-1,H+=j-1),H++,z++}}H++;let q=P+$-T+D,K=Math.min(this._bufferService.cols,H-P+T+O-D-B);if(w||I.slice(P,H).trim()!==""){if(A&&q===0&&M.getCodePoint(0)!==32){const U=R.lines.get(x[1]-1);if(U&&M.isWrapped&&U.getCodePoint(this._bufferService.cols-1)!==32){const z=this._getWordAt([this._bufferService.cols-1,x[1]-1],!1,!0,!1);if(z){const W=this._bufferService.cols-z.start;q-=W,K+=W}}}if(L&&q+K===this._bufferService.cols&&M.getCodePoint(this._bufferService.cols-1)!==32){const U=R.lines.get(x[1]+1);if(U?.isWrapped&&U.getCodePoint(0)!==32){const z=this._getWordAt([0,x[1]+1],!1,!1,!0);z&&(K+=z.length)}}return{start:q,length:K}}}_selectWordAt(x,w){const A=this._getWordAt(x,w);if(A){for(;A.start<0;)A.start+=this._bufferService.cols,x[1]--;this._model.selectionStart=[A.start,x[1]],this._model.selectionStartLength=A.length}}_selectToWordAt(x){const w=this._getWordAt(x,!0);if(w){let A=x[1];for(;w.start<0;)w.start+=this._bufferService.cols,A--;if(!this._model.areSelectionValuesReversed())for(;w.start+w.length>this._bufferService.cols;)w.length-=this._bufferService.cols,A++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?w.start:w.start+w.length,A]}}_isCharWordSeparator(x){return x.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(x.getChars())>=0}_selectLineAt(x){const w=this._bufferService.buffer.getWrappedRangeForLine(x),A={start:{x:0,y:w.first},end:{x:this._bufferService.cols-1,y:w.last}};this._model.selectionStart=[0,w.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,l.getRangeLength)(A,this._bufferService.cols)}};r.SelectionService=E=u([f(3,g.IBufferService),f(4,g.ICoreService),f(5,y.IMouseService),f(6,g.IOptionsService),f(7,y.IRenderService),f(8,y.ICoreBrowserService)],E)},4725:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const u=o(8343);r.ICharSizeService=(0,u.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),r.IMouseService=(0,u.createDecorator)("MouseService"),r.IRenderService=(0,u.createDecorator)("RenderService"),r.ISelectionService=(0,u.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,u.createDecorator)("ThemeService")},6731:function(C,r,o){var u=this&&this.__decorate||function(E,x,w,A){var L,R=arguments.length,M=R<3?x:A===null?A=Object.getOwnPropertyDescriptor(x,w):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(E,x,w,A);else for(var I=E.length-1;I>=0;I--)(L=E[I])&&(M=(R<3?L(M):R>3?L(x,w,M):L(x,w))||M);return R>3&&M&&Object.defineProperty(x,w,M),M},f=this&&this.__param||function(E,x){return function(w,A){x(w,A,E)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const a=o(7239),p=o(8055),m=o(8460),y=o(844),b=o(2585),s=p.css.toColor("#ffffff"),c=p.css.toColor("#000000"),l=p.css.toColor("#ffffff"),h=p.css.toColor("#000000"),g={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const E=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],x=[0,95,135,175,215,255];for(let w=0;w<216;w++){const A=x[w/36%6|0],L=x[w/6%6|0],R=x[w%6];E.push({css:p.channels.toCss(A,L,R),rgba:p.channels.toRgba(A,L,R)})}for(let w=0;w<24;w++){const A=8+10*w;E.push({css:p.channels.toCss(A,A,A),rgba:p.channels.toRgba(A,A,A)})}return E})());let S=r.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(E){super(),this._optionsService=E,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.ColorContrastCache,this._onChangeColors=this.register(new m.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:s,background:c,cursor:l,cursorAccent:h,selectionForeground:void 0,selectionBackgroundTransparent:g,selectionBackgroundOpaque:p.color.blend(c,g),selectionInactiveBackgroundTransparent:g,selectionInactiveBackgroundOpaque:p.color.blend(c,g),ansi:r.DEFAULT_ANSI_COLORS.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))))}_setTheme(E={}){const x=this._colors;if(x.foreground=k(E.foreground,s),x.background=k(E.background,c),x.cursor=k(E.cursor,l),x.cursorAccent=k(E.cursorAccent,h),x.selectionBackgroundTransparent=k(E.selectionBackground,g),x.selectionBackgroundOpaque=p.color.blend(x.background,x.selectionBackgroundTransparent),x.selectionInactiveBackgroundTransparent=k(E.selectionInactiveBackground,x.selectionBackgroundTransparent),x.selectionInactiveBackgroundOpaque=p.color.blend(x.background,x.selectionInactiveBackgroundTransparent),x.selectionForeground=E.selectionForeground?k(E.selectionForeground,p.NULL_COLOR):void 0,x.selectionForeground===p.NULL_COLOR&&(x.selectionForeground=void 0),p.color.isOpaque(x.selectionBackgroundTransparent)&&(x.selectionBackgroundTransparent=p.color.opacity(x.selectionBackgroundTransparent,.3)),p.color.isOpaque(x.selectionInactiveBackgroundTransparent)&&(x.selectionInactiveBackgroundTransparent=p.color.opacity(x.selectionInactiveBackgroundTransparent,.3)),x.ansi=r.DEFAULT_ANSI_COLORS.slice(),x.ansi[0]=k(E.black,r.DEFAULT_ANSI_COLORS[0]),x.ansi[1]=k(E.red,r.DEFAULT_ANSI_COLORS[1]),x.ansi[2]=k(E.green,r.DEFAULT_ANSI_COLORS[2]),x.ansi[3]=k(E.yellow,r.DEFAULT_ANSI_COLORS[3]),x.ansi[4]=k(E.blue,r.DEFAULT_ANSI_COLORS[4]),x.ansi[5]=k(E.magenta,r.DEFAULT_ANSI_COLORS[5]),x.ansi[6]=k(E.cyan,r.DEFAULT_ANSI_COLORS[6]),x.ansi[7]=k(E.white,r.DEFAULT_ANSI_COLORS[7]),x.ansi[8]=k(E.brightBlack,r.DEFAULT_ANSI_COLORS[8]),x.ansi[9]=k(E.brightRed,r.DEFAULT_ANSI_COLORS[9]),x.ansi[10]=k(E.brightGreen,r.DEFAULT_ANSI_COLORS[10]),x.ansi[11]=k(E.brightYellow,r.DEFAULT_ANSI_COLORS[11]),x.ansi[12]=k(E.brightBlue,r.DEFAULT_ANSI_COLORS[12]),x.ansi[13]=k(E.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),x.ansi[14]=k(E.brightCyan,r.DEFAULT_ANSI_COLORS[14]),x.ansi[15]=k(E.brightWhite,r.DEFAULT_ANSI_COLORS[15]),E.extendedAnsi){const w=Math.min(x.ansi.length-16,E.extendedAnsi.length);for(let A=0;A<w;A++)x.ansi[A+16]=k(E.extendedAnsi[A],r.DEFAULT_ANSI_COLORS[A+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)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]}else for(let x=0;x<this._restoreColors.ansi.length;++x)this._colors.ansi[x]=this._restoreColors.ansi[x]}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()}}};function k(E,x){if(E!==void 0)try{return p.css.toColor(E)}catch{}return x}r.ThemeService=S=u([f(0,b.IOptionsService)],S)},6349:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const u=o(8460),f=o(844);class a extends f.Disposable{constructor(m){super(),this._maxLength=m,this.onDeleteEmitter=this.register(new u.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new u.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new u.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(m){if(this._maxLength===m)return;const y=new Array(m);for(let b=0;b<Math.min(m,this.length);b++)y[b]=this._array[this._getCyclicIndex(b)];this._array=y,this._maxLength=m,this._startIndex=0}get length(){return this._length}set length(m){if(m>this._length)for(let y=this._length;y<m;y++)this._array[y]=void 0;this._length=m}get(m){return this._array[this._getCyclicIndex(m)]}set(m,y){this._array[this._getCyclicIndex(m)]=y}push(m){this._array[this._getCyclicIndex(this._length)]=m,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(m,y,...b){if(y){for(let s=m;s<this._length-y;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+y)];this._length-=y,this.onDeleteEmitter.fire({index:m,amount:y})}for(let s=this._length-1;s>=m;s--)this._array[this._getCyclicIndex(s+b.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<b.length;s++)this._array[this._getCyclicIndex(m+s)]=b[s];if(b.length&&this.onInsertEmitter.fire({index:m,amount:b.length}),this._length+b.length>this._maxLength){const s=this._length+b.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=b.length}trimStart(m){m>this._length&&(m=this._length),this._startIndex+=m,this._length-=m,this.onTrimEmitter.fire(m)}shiftElements(m,y,b){if(!(y<=0)){if(m<0||m>=this._length)throw new Error("start argument out of range");if(m+b<0)throw new Error("Cannot shift elements in list beyond index 0");if(b>0){for(let c=y-1;c>=0;c--)this.set(m+c+b,this.get(m+c));const s=m+y+b-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<y;s++)this.set(m+s+b,this.get(m+s))}}_getCyclicIndex(m){return(this._startIndex+m)%this._maxLength}}r.CircularList=a},1439:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function o(u,f=5){if(typeof u!="object")return u;const a=Array.isArray(u)?[]:{};for(const p in u)a[p]=f<=1?u[p]:u[p]&&o(u[p],f-1);return a}},8055:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;const u=o(6114);let f=0,a=0,p=0,m=0;var y,b,s,c,l;function h(S){const k=S.toString(16);return k.length<2?"0"+k:k}function g(S,k){return S<k?(k+.05)/(S+.05):(S+.05)/(k+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(S){S.toCss=function(k,E,x,w){return w!==void 0?`#${h(k)}${h(E)}${h(x)}${h(w)}`:`#${h(k)}${h(E)}${h(x)}`},S.toRgba=function(k,E,x,w=255){return(k<<24|E<<16|x<<8|w)>>>0}})(y||(r.channels=y={})),(function(S){function k(E,x){return m=Math.round(255*x),[f,a,p]=l.toChannels(E.rgba),{css:y.toCss(f,a,p,m),rgba:y.toRgba(f,a,p,m)}}S.blend=function(E,x){if(m=(255&x.rgba)/255,m===1)return{css:x.css,rgba:x.rgba};const w=x.rgba>>24&255,A=x.rgba>>16&255,L=x.rgba>>8&255,R=E.rgba>>24&255,M=E.rgba>>16&255,I=E.rgba>>8&255;return f=R+Math.round((w-R)*m),a=M+Math.round((A-M)*m),p=I+Math.round((L-I)*m),{css:y.toCss(f,a,p),rgba:y.toRgba(f,a,p)}},S.isOpaque=function(E){return(255&E.rgba)==255},S.ensureContrastRatio=function(E,x,w){const A=l.ensureContrastRatio(E.rgba,x.rgba,w);if(A)return l.toColor(A>>24&255,A>>16&255,A>>8&255)},S.opaque=function(E){const x=(255|E.rgba)>>>0;return[f,a,p]=l.toChannels(x),{css:y.toCss(f,a,p),rgba:x}},S.opacity=k,S.multiplyOpacity=function(E,x){return m=255&E.rgba,k(E,m*x/255)},S.toColorRGB=function(E){return[E.rgba>>24&255,E.rgba>>16&255,E.rgba>>8&255]}})(b||(r.color=b={})),(function(S){let k,E;if(!u.isNode){const x=document.createElement("canvas");x.width=1,x.height=1;const w=x.getContext("2d",{willReadFrequently:!0});w&&(k=w,k.globalCompositeOperation="copy",E=k.createLinearGradient(0,0,1,1))}S.toColor=function(x){if(x.match(/#[\da-f]{3,8}/i))switch(x.length){case 4:return f=parseInt(x.slice(1,2).repeat(2),16),a=parseInt(x.slice(2,3).repeat(2),16),p=parseInt(x.slice(3,4).repeat(2),16),l.toColor(f,a,p);case 5:return f=parseInt(x.slice(1,2).repeat(2),16),a=parseInt(x.slice(2,3).repeat(2),16),p=parseInt(x.slice(3,4).repeat(2),16),m=parseInt(x.slice(4,5).repeat(2),16),l.toColor(f,a,p,m);case 7:return{css:x,rgba:(parseInt(x.slice(1),16)<<8|255)>>>0};case 9:return{css:x,rgba:parseInt(x.slice(1),16)>>>0}}const w=x.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(w)return f=parseInt(w[1]),a=parseInt(w[2]),p=parseInt(w[3]),m=Math.round(255*(w[5]===void 0?1:parseFloat(w[5]))),l.toColor(f,a,p,m);if(!k||!E)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=E,k.fillStyle=x,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[f,a,p,m]=k.getImageData(0,0,1,1).data,m!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:y.toRgba(f,a,p,m),css:x}}})(s||(r.css=s={})),(function(S){function k(E,x,w){const A=E/255,L=x/255,R=w/255;return .2126*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))}S.relativeLuminance=function(E){return k(E>>16&255,E>>8&255,255&E)},S.relativeLuminance2=k})(c||(r.rgb=c={})),(function(S){function k(x,w,A){const L=x>>24&255,R=x>>16&255,M=x>>8&255;let I=w>>24&255,P=w>>16&255,H=w>>8&255,$=g(c.relativeLuminance2(I,P,H),c.relativeLuminance2(L,R,M));for(;$<A&&(I>0||P>0||H>0);)I-=Math.max(0,Math.ceil(.1*I)),P-=Math.max(0,Math.ceil(.1*P)),H-=Math.max(0,Math.ceil(.1*H)),$=g(c.relativeLuminance2(I,P,H),c.relativeLuminance2(L,R,M));return(I<<24|P<<16|H<<8|255)>>>0}function E(x,w,A){const L=x>>24&255,R=x>>16&255,M=x>>8&255;let I=w>>24&255,P=w>>16&255,H=w>>8&255,$=g(c.relativeLuminance2(I,P,H),c.relativeLuminance2(L,R,M));for(;$<A&&(I<255||P<255||H<255);)I=Math.min(255,I+Math.ceil(.1*(255-I))),P=Math.min(255,P+Math.ceil(.1*(255-P))),H=Math.min(255,H+Math.ceil(.1*(255-H))),$=g(c.relativeLuminance2(I,P,H),c.relativeLuminance2(L,R,M));return(I<<24|P<<16|H<<8|255)>>>0}S.ensureContrastRatio=function(x,w,A){const L=c.relativeLuminance(x>>8),R=c.relativeLuminance(w>>8);if(g(L,R)<A){if(R<L){const P=k(x,w,A),H=g(L,c.relativeLuminance(P>>8));if(H<A){const $=E(x,w,A);return H>g(L,c.relativeLuminance($>>8))?P:$}return P}const M=E(x,w,A),I=g(L,c.relativeLuminance(M>>8));if(I<A){const P=k(x,w,A);return I>g(L,c.relativeLuminance(P>>8))?M:P}return M}},S.reduceLuminance=k,S.increaseLuminance=E,S.toChannels=function(x){return[x>>24&255,x>>16&255,x>>8&255,255&x]},S.toColor=function(x,w,A,L){return{css:y.toCss(x,w,A,L),rgba:y.toRgba(x,w,A,L)}}})(l||(r.rgba=l={})),r.toPaddedHex=h,r.contrastRatio=g},8969:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const u=o(844),f=o(2585),a=o(4348),p=o(7866),m=o(744),y=o(7302),b=o(6975),s=o(8460),c=o(1753),l=o(1480),h=o(7994),g=o(9282),S=o(5435),k=o(5981),E=o(2660);let x=!1;class w extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new s.EventEmitter),this._onScroll.event((L=>{var R;(R=this._onScrollApi)===null||R===void 0||R.fire(L.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(L){for(const R in L)this.optionsService.options[R]=L[R]}constructor(L){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new s.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new s.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new s.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new s.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new s.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new s.EventEmitter),this._instantiationService=new a.InstantiationService,this.optionsService=this.register(new y.OptionsService(L)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(m.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(b.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(c.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(l.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(h.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(E.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new S.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,s.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,s.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,s.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,s.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((R=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((R=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new k.WriteBuffer(((R,M)=>this._inputHandler.parse(R,M)))),this.register((0,s.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(L,R){this._writeBuffer.write(L,R)}writeSync(L,R){this._logService.logLevel<=f.LogLevelEnum.WARN&&!x&&(this._logService.warn("writeSync is unreliable and will be removed soon."),x=!0),this._writeBuffer.writeSync(L,R)}resize(L,R){isNaN(L)||isNaN(R)||(L=Math.max(L,m.MINIMUM_COLS),R=Math.max(R,m.MINIMUM_ROWS),this._bufferService.resize(L,R))}scroll(L,R=!1){this._bufferService.scroll(L,R)}scrollLines(L,R,M){this._bufferService.scrollLines(L,R,M)}scrollPages(L){this.scrollLines(L*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(L){const R=L-this._bufferService.buffer.ydisp;R!==0&&this.scrollLines(R)}registerEscHandler(L,R){return this._inputHandler.registerEscHandler(L,R)}registerDcsHandler(L,R){return this._inputHandler.registerDcsHandler(L,R)}registerCsiHandler(L,R){return this._inputHandler.registerCsiHandler(L,R)}registerOscHandler(L,R){return this._inputHandler.registerOscHandler(L,R)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let L=!1;const R=this.optionsService.rawOptions.windowsPty;R&&R.buildNumber!==void 0&&R.buildNumber!==void 0?L=R.backend==="conpty"&&R.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(L=!0),L?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const L=[];L.push(this.onLineFeed(g.updateWindowsModeWrappedState.bind(null,this._bufferService))),L.push(this.registerCsiHandler({final:"H"},(()=>((0,g.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const R of L)R.dispose()}))}}}r.CoreTerminal=w},8460:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let u=0;u<this._listeners.length;u++)if(this._listeners[u]===o)return void this._listeners.splice(u,1)}}})),this._event}fire(o,u){const f=[];for(let a=0;a<this._listeners.length;a++)f.push(this._listeners[a]);for(let a=0;a<f.length;a++)f[a].call(void 0,o,u)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(o,u){return o((f=>u.fire(f)))}},5435:function(C,r,o){var u=this&&this.__decorate||function($,T,O,D){var B,q=arguments.length,K=q<3?T:D===null?D=Object.getOwnPropertyDescriptor(T,O):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate($,T,O,D);else for(var U=$.length-1;U>=0;U--)(B=$[U])&&(K=(q<3?B(K):q>3?B(T,O,K):B(T,O))||K);return q>3&&K&&Object.defineProperty(T,O,K),K},f=this&&this.__param||function($,T){return function(O,D){T(O,D,$)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const a=o(2584),p=o(7116),m=o(2015),y=o(844),b=o(482),s=o(8437),c=o(8460),l=o(643),h=o(511),g=o(3734),S=o(2585),k=o(6242),E=o(6351),x=o(5941),w={"(":0,")":1,"*":2,"+":3,"-":1,".":2},A=131072;function L($,T){if($>24)return T.setWinLines||!1;switch($){case 1:return!!T.restoreWin;case 2:return!!T.minimizeWin;case 3:return!!T.setWinPosition;case 4:return!!T.setWinSizePixels;case 5:return!!T.raiseWin;case 6:return!!T.lowerWin;case 7:return!!T.refreshWin;case 8:return!!T.setWinSizeChars;case 9:return!!T.maximizeWin;case 10:return!!T.fullscreenWin;case 11:return!!T.getWinState;case 13:return!!T.getWinPosition;case 14:return!!T.getWinSizePixels;case 15:return!!T.getScreenSizePixels;case 16:return!!T.getCellSizePixels;case 18:return!!T.getWinSizeChars;case 19:return!!T.getScreenSizeChars;case 20:return!!T.getIconTitle;case 21:return!!T.getWinTitle;case 22:return!!T.pushTitle;case 23:return!!T.popTitle;case 24:return!!T.setWinLines}return!1}var R;(function($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(R||(r.WindowsOptionsReportType=R={}));let M=0;class I extends y.Disposable{getAttrData(){return this._curAttrData}constructor(T,O,D,B,q,K,U,z,W=new m.EscapeSequenceParser){super(),this._bufferService=T,this._charsetService=O,this._coreService=D,this._logService=B,this._optionsService=q,this._oscLinkService=K,this._coreMouseService=U,this._unicodeService=z,this._parser=W,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new b.StringToUtf32,this._utf8Decoder=new b.Utf8ToUtf32,this._workCell=new h.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=s.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=s.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new c.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new c.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new c.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new c.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new c.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new c.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new c.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new c.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new c.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new c.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new c.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new c.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new c.EventEmitter),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 P(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((j=>this._activeBuffer=j.activeBuffer))),this._parser.setCsiHandlerFallback(((j,F)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(j),params:F.toArray()})})),this._parser.setEscHandlerFallback((j=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(j)})})),this._parser.setExecuteHandlerFallback((j=>{this._logService.debug("Unknown EXECUTE code: ",{code:j})})),this._parser.setOscHandlerFallback(((j,F,X)=>{this._logService.debug("Unknown OSC code: ",{identifier:j,action:F,data:X})})),this._parser.setDcsHandlerFallback(((j,F,X)=>{F==="HOOK"&&(X=X.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(j),action:F,payload:X})})),this._parser.setPrintHandler(((j,F,X)=>this.print(j,F,X))),this._parser.registerCsiHandler({final:"@"},(j=>this.insertChars(j))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(j=>this.scrollLeft(j))),this._parser.registerCsiHandler({final:"A"},(j=>this.cursorUp(j))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(j=>this.scrollRight(j))),this._parser.registerCsiHandler({final:"B"},(j=>this.cursorDown(j))),this._parser.registerCsiHandler({final:"C"},(j=>this.cursorForward(j))),this._parser.registerCsiHandler({final:"D"},(j=>this.cursorBackward(j))),this._parser.registerCsiHandler({final:"E"},(j=>this.cursorNextLine(j))),this._parser.registerCsiHandler({final:"F"},(j=>this.cursorPrecedingLine(j))),this._parser.registerCsiHandler({final:"G"},(j=>this.cursorCharAbsolute(j))),this._parser.registerCsiHandler({final:"H"},(j=>this.cursorPosition(j))),this._parser.registerCsiHandler({final:"I"},(j=>this.cursorForwardTab(j))),this._parser.registerCsiHandler({final:"J"},(j=>this.eraseInDisplay(j,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(j=>this.eraseInDisplay(j,!0))),this._parser.registerCsiHandler({final:"K"},(j=>this.eraseInLine(j,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(j=>this.eraseInLine(j,!0))),this._parser.registerCsiHandler({final:"L"},(j=>this.insertLines(j))),this._parser.registerCsiHandler({final:"M"},(j=>this.deleteLines(j))),this._parser.registerCsiHandler({final:"P"},(j=>this.deleteChars(j))),this._parser.registerCsiHandler({final:"S"},(j=>this.scrollUp(j))),this._parser.registerCsiHandler({final:"T"},(j=>this.scrollDown(j))),this._parser.registerCsiHandler({final:"X"},(j=>this.eraseChars(j))),this._parser.registerCsiHandler({final:"Z"},(j=>this.cursorBackwardTab(j))),this._parser.registerCsiHandler({final:"`"},(j=>this.charPosAbsolute(j))),this._parser.registerCsiHandler({final:"a"},(j=>this.hPositionRelative(j))),this._parser.registerCsiHandler({final:"b"},(j=>this.repeatPrecedingCharacter(j))),this._parser.registerCsiHandler({final:"c"},(j=>this.sendDeviceAttributesPrimary(j))),this._parser.registerCsiHandler({prefix:">",final:"c"},(j=>this.sendDeviceAttributesSecondary(j))),this._parser.registerCsiHandler({final:"d"},(j=>this.linePosAbsolute(j))),this._parser.registerCsiHandler({final:"e"},(j=>this.vPositionRelative(j))),this._parser.registerCsiHandler({final:"f"},(j=>this.hVPosition(j))),this._parser.registerCsiHandler({final:"g"},(j=>this.tabClear(j))),this._parser.registerCsiHandler({final:"h"},(j=>this.setMode(j))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(j=>this.setModePrivate(j))),this._parser.registerCsiHandler({final:"l"},(j=>this.resetMode(j))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(j=>this.resetModePrivate(j))),this._parser.registerCsiHandler({final:"m"},(j=>this.charAttributes(j))),this._parser.registerCsiHandler({final:"n"},(j=>this.deviceStatus(j))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(j=>this.deviceStatusPrivate(j))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(j=>this.softReset(j))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(j=>this.setCursorStyle(j))),this._parser.registerCsiHandler({final:"r"},(j=>this.setScrollRegion(j))),this._parser.registerCsiHandler({final:"s"},(j=>this.saveCursor(j))),this._parser.registerCsiHandler({final:"t"},(j=>this.windowOptions(j))),this._parser.registerCsiHandler({final:"u"},(j=>this.restoreCursor(j))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(j=>this.insertColumns(j))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(j=>this.deleteColumns(j))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(j=>this.selectProtected(j))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(j=>this.requestMode(j,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(j=>this.requestMode(j,!1))),this._parser.setExecuteHandler(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new k.OscHandler((j=>(this.setTitle(j),this.setIconName(j),!0)))),this._parser.registerOscHandler(1,new k.OscHandler((j=>this.setIconName(j)))),this._parser.registerOscHandler(2,new k.OscHandler((j=>this.setTitle(j)))),this._parser.registerOscHandler(4,new k.OscHandler((j=>this.setOrReportIndexedColor(j)))),this._parser.registerOscHandler(8,new k.OscHandler((j=>this.setHyperlink(j)))),this._parser.registerOscHandler(10,new k.OscHandler((j=>this.setOrReportFgColor(j)))),this._parser.registerOscHandler(11,new k.OscHandler((j=>this.setOrReportBgColor(j)))),this._parser.registerOscHandler(12,new k.OscHandler((j=>this.setOrReportCursorColor(j)))),this._parser.registerOscHandler(104,new k.OscHandler((j=>this.restoreIndexedColor(j)))),this._parser.registerOscHandler(110,new k.OscHandler((j=>this.restoreFgColor(j)))),this._parser.registerOscHandler(111,new k.OscHandler((j=>this.restoreBgColor(j)))),this._parser.registerOscHandler(112,new k.OscHandler((j=>this.restoreCursorColor(j)))),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(const j in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:j},(()=>this.selectCharset("("+j))),this._parser.registerEscHandler({intermediates:")",final:j},(()=>this.selectCharset(")"+j))),this._parser.registerEscHandler({intermediates:"*",final:j},(()=>this.selectCharset("*"+j))),this._parser.registerEscHandler({intermediates:"+",final:j},(()=>this.selectCharset("+"+j))),this._parser.registerEscHandler({intermediates:"-",final:j},(()=>this.selectCharset("-"+j))),this._parser.registerEscHandler({intermediates:".",final:j},(()=>this.selectCharset("."+j))),this._parser.registerEscHandler({intermediates:"/",final:j},(()=>this.selectCharset("/"+j)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((j=>(this._logService.error("Parsing error: ",j),j))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new E.DcsHandler(((j,F)=>this.requestStatusString(j,F))))}_preserveStack(T,O,D,B){this._parseStack.paused=!0,this._parseStack.cursorStartX=T,this._parseStack.cursorStartY=O,this._parseStack.decodedLength=D,this._parseStack.position=B}_logSlowResolvingAsync(T){this._logService.logLevel<=S.LogLevelEnum.WARN&&Promise.race([T,new Promise(((O,D)=>setTimeout((()=>D("#SLOW_TIMEOUT")),5e3)))]).catch((O=>{if(O!=="#SLOW_TIMEOUT")throw O;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(T,O){let D,B=this._activeBuffer.x,q=this._activeBuffer.y,K=0;const U=this._parseStack.paused;if(U){if(D=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,O))return this._logSlowResolvingAsync(D),D;B=this._parseStack.cursorStartX,q=this._parseStack.cursorStartY,this._parseStack.paused=!1,T.length>A&&(K=this._parseStack.position+A)}if(this._logService.logLevel<=S.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof T=="string"?` "${T}"`:` "${Array.prototype.map.call(T,(z=>String.fromCharCode(z))).join("")}"`),typeof T=="string"?T.split("").map((z=>z.charCodeAt(0))):T),this._parseBuffer.length<T.length&&this._parseBuffer.length<A&&(this._parseBuffer=new Uint32Array(Math.min(T.length,A))),U||this._dirtyRowTracker.clearRange(),T.length>A)for(let z=K;z<T.length;z+=A){const W=z+A<T.length?z+A:T.length,j=typeof T=="string"?this._stringDecoder.decode(T.substring(z,W),this._parseBuffer):this._utf8Decoder.decode(T.subarray(z,W),this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,j))return this._preserveStack(B,q,j,z),this._logSlowResolvingAsync(D),D}else if(!U){const z=typeof T=="string"?this._stringDecoder.decode(T,this._parseBuffer):this._utf8Decoder.decode(T,this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,z))return this._preserveStack(B,q,z,0),this._logSlowResolvingAsync(D),D}this._activeBuffer.x===B&&this._activeBuffer.y===q||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(T,O,D){let B,q;const K=this._charsetService.charset,U=this._optionsService.rawOptions.screenReaderMode,z=this._bufferService.cols,W=this._coreService.decPrivateModes.wraparound,j=this._coreService.modes.insertMode,F=this._curAttrData;let X=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&D-O>0&&X.getWidth(this._activeBuffer.x-1)===2&&X.setCellFromCodePoint(this._activeBuffer.x-1,0,1,F.fg,F.bg,F.extended);for(let Y=O;Y<D;++Y){if(B=T[Y],q=this._unicodeService.wcwidth(B),B<127&&K){const ee=K[String.fromCharCode(B)];ee&&(B=ee.charCodeAt(0))}if(U&&this._onA11yChar.fire((0,b.stringFromCodePoint)(B)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),q||!this._activeBuffer.x){if(this._activeBuffer.x+q-1>=z){if(W){for(;this._activeBuffer.x<z;)X.setCellFromCodePoint(this._activeBuffer.x++,0,1,F.fg,F.bg,F.extended);this._activeBuffer.x=0,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),X=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=z-1,q===2)continue}if(j&&(X.insertCells(this._activeBuffer.x,q,this._activeBuffer.getNullCell(F),F),X.getWidth(z-1)===2&&X.setCellFromCodePoint(z-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,F.fg,F.bg,F.extended)),X.setCellFromCodePoint(this._activeBuffer.x++,B,q,F.fg,F.bg,F.extended),q>0)for(;--q;)X.setCellFromCodePoint(this._activeBuffer.x++,0,0,F.fg,F.bg,F.extended)}else X.getWidth(this._activeBuffer.x-1)?X.addCodepointToCell(this._activeBuffer.x-1,B):X.addCodepointToCell(this._activeBuffer.x-2,B)}D-O>0&&(X.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<z&&D-O>0&&X.getWidth(this._activeBuffer.x)===0&&!X.hasContent(this._activeBuffer.x)&&X.setCellFromCodePoint(this._activeBuffer.x,0,1,F.fg,F.bg,F.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(T,O){return T.final!=="t"||T.prefix||T.intermediates?this._parser.registerCsiHandler(T,O):this._parser.registerCsiHandler(T,(D=>!L(D.params[0],this._optionsService.rawOptions.windowOptions)||O(D)))}registerDcsHandler(T,O){return this._parser.registerDcsHandler(T,new E.DcsHandler(O))}registerEscHandler(T,O){return this._parser.registerEscHandler(T,O)}registerOscHandler(T,O){return this._parser.registerOscHandler(T,new k.OscHandler(O))}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===void 0)&&T.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);O.hasWidth(this._activeBuffer.x)&&!O.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const 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,O){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=T,this._activeBuffer.y=this._activeBuffer.scrollTop+O):(this._activeBuffer.x=T,this._activeBuffer.y=O),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(T,O){this._restrictCursor(),this._setCursor(this._activeBuffer.x+T,this._activeBuffer.y+O)}cursorUp(T){const O=this._activeBuffer.y-this._activeBuffer.scrollTop;return O>=0?this._moveCursor(0,-Math.min(O,T.params[0]||1)):this._moveCursor(0,-(T.params[0]||1)),!0}cursorDown(T){const O=this._activeBuffer.scrollBottom-this._activeBuffer.y;return O>=0?this._moveCursor(0,Math.min(O,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){const O=T.params[0];return O===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:O===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(T){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let O=T.params[0]||1;for(;O--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(T){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let O=T.params[0]||1;for(;O--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(T){const O=T.params[0];return O===1&&(this._curAttrData.bg|=536870912),O!==2&&O!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(T,O,D,B=!1,q=!1){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);K.replaceCells(O,D,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),q),B&&(K.isWrapped=!1)}_resetBufferLine(T,O=!1){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+T);D&&(D.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),O),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+T),D.isWrapped=!1)}eraseInDisplay(T,O=!1){let D;switch(this._restrictCursor(this._bufferService.cols),T.params[0]){case 0:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,O);D<this._bufferService.rows;D++)this._resetBufferLine(D,O);this._dirtyRowTracker.markDirty(D);break;case 1:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D,0,this._activeBuffer.x+1,!0,O),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(D+1).isWrapped=!1);D--;)this._resetBufferLine(D,O);this._dirtyRowTracker.markDirty(0);break;case 2:for(D=this._bufferService.rows,this._dirtyRowTracker.markDirty(D-1);D--;)this._resetBufferLine(D,O);this._dirtyRowTracker.markDirty(0);break;case 3:const B=this._activeBuffer.lines.length-this._bufferService.rows;B>0&&(this._activeBuffer.lines.trimStart(B),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-B,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-B,0),this._onScroll.fire(0))}return!0}eraseInLine(T,O=!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,O);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,O);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,O)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(T){this._restrictCursor();let O=T.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=this._activeBuffer.ybase+this._activeBuffer.y,B=this._bufferService.rows-1-this._activeBuffer.scrollBottom,q=this._bufferService.rows-1+this._activeBuffer.ybase-B+1;for(;O--;)this._activeBuffer.lines.splice(q-1,1),this._activeBuffer.lines.splice(D,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 O=T.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=this._activeBuffer.ybase+this._activeBuffer.y;let B;for(B=this._bufferService.rows-1-this._activeBuffer.scrollBottom,B=this._bufferService.rows-1+this._activeBuffer.ybase-B;O--;)this._activeBuffer.lines.splice(D,1),this._activeBuffer.lines.splice(B,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();const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return O&&(O.insertCells(this._activeBuffer.x,T.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(T){this._restrictCursor();const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return O&&(O.deleteCells(this._activeBuffer.x,T.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(T){let O=T.params[0]||1;for(;O--;)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 O=T.params[0]||1;for(;O--;)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(s.DEFAULT_ATTR_DATA));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;const O=T.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);B.deleteCells(0,O,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),B.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;const O=T.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);B.insertCells(0,O,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),B.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;const O=T.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);B.insertCells(this._activeBuffer.x,O,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),B.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;const O=T.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);B.deleteCells(this._activeBuffer.x,O,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),B.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(T){this._restrictCursor();const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return O&&(O.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(T.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(T){if(!this._parser.precedingCodepoint)return!0;const O=T.params[0]||1,D=new Uint32Array(O);for(let B=0;B<O;++B)D[B]=this._parser.precedingCodepoint;return this.print(D,0,D.length),!0}sendDeviceAttributesPrimary(T){return T.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(a.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(a.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(T){return T.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(a.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(a.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(T.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(a.C0.ESC+"[>83;40003;0c")),!0}_is(T){return(this._optionsService.rawOptions.termName+"").indexOf(T)===0}setMode(T){for(let O=0;O<T.length;O++)switch(T.params[O]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(T){for(let O=0;O<T.length;O++)switch(T.params[O]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.DEFAULT_CHARSET);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(T){for(let O=0;O<T.length;O++)switch(T.params[O]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(T){for(let O=0;O<T.length;O++)switch(T.params[O]){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:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");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[O]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(T,O){const D=this._coreService.decPrivateModes,{activeProtocol:B,activeEncoding:q}=this._coreMouseService,K=this._coreService,{buffers:U,cols:z}=this._bufferService,{active:W,alt:j}=U,F=this._optionsService.rawOptions,X=J=>J?1:2,Y=T.params[0];return ee=Y,G=O?Y===2?4:Y===4?X(K.modes.insertMode):Y===12?3:Y===20?X(F.convertEol):0:Y===1?X(D.applicationCursorKeys):Y===3?F.windowOptions.setWinLines?z===80?2:z===132?1:0:0:Y===6?X(D.origin):Y===7?X(D.wraparound):Y===8?3:Y===9?X(B==="X10"):Y===12?X(F.cursorBlink):Y===25?X(!K.isCursorHidden):Y===45?X(D.reverseWraparound):Y===66?X(D.applicationKeypad):Y===67?4:Y===1e3?X(B==="VT200"):Y===1002?X(B==="DRAG"):Y===1003?X(B==="ANY"):Y===1004?X(D.sendFocus):Y===1005?4:Y===1006?X(q==="SGR"):Y===1015?4:Y===1016?X(q==="SGR_PIXELS"):Y===1048?1:Y===47||Y===1047||Y===1049?X(W===j):Y===2004?X(D.bracketedPasteMode):0,K.triggerDataEvent(`${a.C0.ESC}[${O?"":"?"}${ee};${G}$y`),!0;var ee,G}_updateAttrColor(T,O,D,B,q){return O===2?(T|=50331648,T&=-16777216,T|=g.AttributeData.fromColorRGB([D,B,q])):O===5&&(T&=-50331904,T|=33554432|255&D),T}_extractColor(T,O,D){const B=[0,0,-1,0,0,0];let q=0,K=0;do{if(B[K+q]=T.params[O+K],T.hasSubParams(O+K)){const U=T.getSubParams(O+K);let z=0;do B[1]===5&&(q=1),B[K+z+1+q]=U[z];while(++z<U.length&&z+K+1+q<B.length);break}if(B[1]===5&&K+q>=2||B[1]===2&&K+q>=5)break;B[1]&&(q=1)}while(++K+O<T.length&&K+q<B.length);for(let U=2;U<B.length;++U)B[U]===-1&&(B[U]=0);switch(B[0]){case 38:D.fg=this._updateAttrColor(D.fg,B[1],B[3],B[4],B[5]);break;case 48:D.bg=this._updateAttrColor(D.bg,B[1],B[3],B[4],B[5]);break;case 58:D.extended=D.extended.clone(),D.extended.underlineColor=this._updateAttrColor(D.extended.underlineColor,B[1],B[3],B[4],B[5])}return K}_processUnderline(T,O){O.extended=O.extended.clone(),(!~T||T>5)&&(T=1),O.extended.underlineStyle=T,O.fg|=268435456,T===0&&(O.fg&=-268435457),O.updateExtended()}_processSGR0(T){T.fg=s.DEFAULT_ATTR_DATA.fg,T.bg=s.DEFAULT_ATTR_DATA.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;const O=T.length;let D;const B=this._curAttrData;for(let q=0;q<O;q++)D=T.params[q],D>=30&&D<=37?(B.fg&=-50331904,B.fg|=16777216|D-30):D>=40&&D<=47?(B.bg&=-50331904,B.bg|=16777216|D-40):D>=90&&D<=97?(B.fg&=-50331904,B.fg|=16777224|D-90):D>=100&&D<=107?(B.bg&=-50331904,B.bg|=16777224|D-100):D===0?this._processSGR0(B):D===1?B.fg|=134217728:D===3?B.bg|=67108864:D===4?(B.fg|=268435456,this._processUnderline(T.hasSubParams(q)?T.getSubParams(q)[0]:1,B)):D===5?B.fg|=536870912:D===7?B.fg|=67108864:D===8?B.fg|=1073741824:D===9?B.fg|=2147483648:D===2?B.bg|=134217728:D===21?this._processUnderline(2,B):D===22?(B.fg&=-134217729,B.bg&=-134217729):D===23?B.bg&=-67108865:D===24?(B.fg&=-268435457,this._processUnderline(0,B)):D===25?B.fg&=-536870913:D===27?B.fg&=-67108865:D===28?B.fg&=-1073741825:D===29?B.fg&=2147483647:D===39?(B.fg&=-67108864,B.fg|=16777215&s.DEFAULT_ATTR_DATA.fg):D===49?(B.bg&=-67108864,B.bg|=16777215&s.DEFAULT_ATTR_DATA.bg):D===38||D===48||D===58?q+=this._extractColor(T,q,B):D===53?B.bg|=1073741824:D===55?B.bg&=-1073741825:D===59?(B.extended=B.extended.clone(),B.extended.underlineColor=-1,B.updateExtended()):D===100?(B.fg&=-67108864,B.fg|=16777215&s.DEFAULT_ATTR_DATA.fg,B.bg&=-67108864,B.bg|=16777215&s.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",D);return!0}deviceStatus(T){switch(T.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:const O=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[${O};${D}R`)}return!0}deviceStatusPrivate(T){if(T.params[0]===6){const O=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[?${O};${D}R`)}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=s.DEFAULT_ATTR_DATA.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){const O=T.params[0]||1;switch(O){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const D=O%2==1;return this._optionsService.options.cursorBlink=D,!0}setScrollRegion(T){const O=T.params[0]||1;let D;return(T.length<2||(D=T.params[1])>this._bufferService.rows||D===0)&&(D=this._bufferService.rows),D>O&&(this._activeBuffer.scrollTop=O-1,this._activeBuffer.scrollBottom=D-1,this._setCursor(0,0)),!0}windowOptions(T){if(!L(T.params[0],this._optionsService.rawOptions.windowOptions))return!0;const O=T.length>1?T.params[1]:0;switch(T.params[0]){case 14:O!==2&&this._onRequestWindowsOptionsReport.fire(R.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(R.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:O!==0&&O!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),O!==0&&O!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:O!==0&&O!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),O!==0&&O!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}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){const O=[],D=T.split(";");for(;D.length>1;){const B=D.shift(),q=D.shift();if(/^\d+$/.exec(B)){const K=parseInt(B);if(H(K))if(q==="?")O.push({type:0,index:K});else{const U=(0,x.parseColor)(q);U&&O.push({type:1,index:K,color:U})}}}return O.length&&this._onColor.fire(O),!0}setHyperlink(T){const O=T.split(";");return!(O.length<2)&&(O[1]?this._createHyperlink(O[0],O[1]):!O[0]&&this._finishHyperlink())}_createHyperlink(T,O){this._getCurrentLinkId()&&this._finishHyperlink();const D=T.split(":");let B;const q=D.findIndex((K=>K.startsWith("id=")));return q!==-1&&(B=D[q].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:B,uri:O}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(T,O){const D=T.split(";");for(let B=0;B<D.length&&!(O>=this._specialColors.length);++B,++O)if(D[B]==="?")this._onColor.fire([{type:0,index:this._specialColors[O]}]);else{const q=(0,x.parseColor)(D[B]);q&&this._onColor.fire([{type:1,index:this._specialColors[O],color:q}])}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;const O=[],D=T.split(";");for(let B=0;B<D.length;++B)if(/^\d+$/.exec(D[B])){const q=parseInt(D[B]);H(q)&&O.push({type:2,index:q})}return O.length&&this._onColor.fire(O),!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,p.DEFAULT_CHARSET),!0}selectCharset(T){return T.length!==2?(this.selectDefaultCharset(),!0):(T[0]==="/"||this._charsetService.setgCharset(w[T[0]],p.CHARSETS[T[1]]||p.DEFAULT_CHARSET),!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){const 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=s.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=s.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(T){return this._charsetService.setgLevel(T),!0}screenAlignmentPattern(){const T=new h.CellData;T.content=4194373,T.fg=this._curAttrData.fg,T.bg=this._curAttrData.bg,this._setCursor(0,0);for(let O=0;O<this._bufferService.rows;++O){const D=this._activeBuffer.ybase+this._activeBuffer.y+O,B=this._activeBuffer.lines.get(D);B&&(B.fill(T),B.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(T,O){const D=this._bufferService.buffer,B=this._optionsService.rawOptions;return(q=>(this._coreService.triggerDataEvent(`${a.C0.ESC}${q}${a.C0.ESC}\\`),!0))(T==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:T==='"p'?'P1$r61;1"p':T==="r"?`P1$r${D.scrollTop+1};${D.scrollBottom+1}r`:T==="m"?"P1$r0m":T===" q"?`P1$r${{block:2,underline:4,bar:6}[B.cursorStyle]-(B.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(T,O){this._dirtyRowTracker.markRangeDirty(T,O)}}r.InputHandler=I;let P=class{constructor($){this._bufferService=$,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty($){$<this.start?this.start=$:$>this.end&&(this.end=$)}markRangeDirty($,T){$>T&&(M=$,$=T,T=M),$<this.start&&(this.start=$),T>this.end&&(this.end=T)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function H($){return 0<=$&&$<256}P=u([f(0,S.IBufferService)],P)},844:(C,r)=>{function o(u){for(const f of u)f.dispose();u.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const f=this._disposables.indexOf(u);f!==-1&&this._disposables.splice(f,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var f;this._isDisposed||u===this._value||((f=this._value)===null||f===void 0||f.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){var u;this._isDisposed=!0,(u=this._value)===null||u===void 0||u.dispose(),this._value=void 0}},r.toDisposable=function(u){return{dispose:u}},r.disposeArray=o,r.getDisposeArrayDisposable=function(u){return{dispose:()=>o(u)}}},1505:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(f,a,p){this._data[f]||(this._data[f]={}),this._data[f][a]=p}get(f,a){return this._data[f]?this._data[f][a]:void 0}clear(){this._data={}}}r.TwoKeyMap=o,r.FourKeyMap=class{constructor(){this._data=new o}set(u,f,a,p,m){this._data.get(u,f)||this._data.set(u,f,new o),this._data.get(u,f).set(a,p,m)}get(u,f,a,p){var m;return(m=this._data.get(u,f))===null||m===void 0?void 0:m.get(a,p)}clear(){this._data.clear()}}},6114:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof navigator>"u";const o=r.isNode?"node":navigator.userAgent,u=r.isNode?"node":navigator.platform;r.isFirefox=o.includes("Firefox"),r.isLegacyEdge=o.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(o),r.getSafariVersion=function(){if(!r.isSafari)return 0;const f=o.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),r.isIpad=u==="iPad",r.isIphone=u==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),r.isLinux=u.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(o)},6106:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let o=0;r.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(o=this._search(this._getKey(u)),this._array.splice(o,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const f=this._getKey(u);if(f===void 0||(o=this._search(f),o===-1)||this._getKey(this._array[o])!==f)return!1;do if(this._array[o]===u)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===f);return!1}*getKeyIterator(u){if(this._array.length!==0&&(o=this._search(u),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===u))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===u)}forEachByKey(u,f){if(this._array.length!==0&&(o=this._search(u),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===u))do f(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===u)}values(){return[...this._array].values()}_search(u){let f=0,a=this._array.length-1;for(;a>=f;){let p=f+a>>1;const m=this._getKey(this._array[p]);if(m>u)a=p-1;else{if(!(m<u)){for(;p>0&&this._getKey(this._array[p-1])===u;)p--;return p}f=p+1}}return f}}},7226:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const u=o(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(m){this._tasks.push(m),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(m){this._idleCallback=void 0;let y=0,b=0,s=m.timeRemaining(),c=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),b=Math.max(y,b),c=m.timeRemaining(),1.5*b>c)return s-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-y))}ms`),void this._start();s=c}this.clear()}}class a extends f{_requestCallback(m){return setTimeout((()=>m(this._createDeadline(16))))}_cancelCallback(m){clearTimeout(m)}_createDeadline(m){const y=Date.now()+m;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}r.PriorityTaskQueue=a,r.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:a,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const u=o(643);r.updateWindowsModeWrappedState=function(f){const a=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),p=a?.get(f.cols-1),m=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);m&&p&&(m.isWrapped=p[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&p[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(a){return[a>>>16&255,a>>>8&255,255&a]}static fromColorRGB(a){return(255&a[0])<<16|(255&a[1])<<8|255&a[2]}clone(){const a=new o;return a.fg=this.fg,a.bg=this.bg,a.extended=this.extended.clone(),a}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}r.AttributeData=o;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(a){this._ext=a}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(a){this._ext&=-469762049,this._ext|=a<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(a){this._ext&=-67108864,this._ext|=67108863&a}get urlId(){return this._urlId}set urlId(a){this._urlId=a}constructor(a=0,p=0){this._ext=0,this._urlId=0,this._ext=a,this._urlId=p}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=u},9092:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const u=o(6349),f=o(7226),a=o(3734),p=o(8437),m=o(4634),y=o(511),b=o(643),s=o(4863),c=o(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(l,h,g){this._hasScrollback=l,this._optionsService=h,this._bufferService=g,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=c.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,b.NULL_CELL_CHAR,b.NULL_CELL_WIDTH,b.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,b.WHITESPACE_CELL_CHAR,b.WHITESPACE_CELL_WIDTH,b.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(l){return l?(this._nullCell.fg=l.fg,this._nullCell.bg=l.bg,this._nullCell.extended=l.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new a.ExtendedAttrs),this._nullCell}getWhitespaceCell(l){return l?(this._whitespaceCell.fg=l.fg,this._whitespaceCell.bg=l.bg,this._whitespaceCell.extended=l.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new a.ExtendedAttrs),this._whitespaceCell}getBlankLine(l,h){return new p.BufferLine(this._bufferService.cols,this.getNullCell(l),h)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const l=this.ybase+this.y-this.ydisp;return l>=0&&l<this._rows}_getCorrectBufferLength(l){if(!this._hasScrollback)return l;const h=l+this._optionsService.rawOptions.scrollback;return h>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:h}fillViewportRows(l){if(this.lines.length===0){l===void 0&&(l=p.DEFAULT_ATTR_DATA);let h=this._rows;for(;h--;)this.lines.push(this.getBlankLine(l))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(l,h){const g=this.getNullCell(p.DEFAULT_ATTR_DATA);let S=0;const k=this._getCorrectBufferLength(h);if(k>this.lines.maxLength&&(this.lines.maxLength=k),this.lines.length>0){if(this._cols<l)for(let x=0;x<this.lines.length;x++)S+=+this.lines.get(x).resize(l,g);let E=0;if(this._rows<h)for(let x=this._rows;x<h;x++)this.lines.length<h+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(l,g)):this.ybase>0&&this.lines.length<=this.ybase+this.y+E+1?(this.ybase--,E++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(l,g)));else for(let x=this._rows;x>h;x--)this.lines.length>h+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(k<this.lines.maxLength){const x=this.lines.length-k;x>0&&(this.lines.trimStart(x),this.ybase=Math.max(this.ybase-x,0),this.ydisp=Math.max(this.ydisp-x,0),this.savedY=Math.max(this.savedY-x,0)),this.lines.maxLength=k}this.x=Math.min(this.x,l-1),this.y=Math.min(this.y,h-1),E&&(this.y+=E),this.savedX=Math.min(this.savedX,l-1),this.scrollTop=0}if(this.scrollBottom=h-1,this._isReflowEnabled&&(this._reflow(l,h),this._cols>l))for(let E=0;E<this.lines.length;E++)S+=+this.lines.get(E).resize(l,g);this._cols=l,this._rows=h,this._memoryCleanupQueue.clear(),S>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let l=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,l=!1);let h=0;for(;this._memoryCleanupPosition<this.lines.length;)if(h+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),h>100)return!0;return l}get _isReflowEnabled(){const l=this._optionsService.rawOptions.windowsPty;return l&&l.buildNumber?this._hasScrollback&&l.backend==="conpty"&&l.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(l,h){this._cols!==l&&(l>this._cols?this._reflowLarger(l,h):this._reflowSmaller(l,h))}_reflowLarger(l,h){const g=(0,m.reflowLargerGetLinesToRemove)(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(g.length>0){const S=(0,m.reflowLargerCreateNewLayout)(this.lines,g);(0,m.reflowLargerApplyNewLayout)(this.lines,S.layout),this._reflowLargerAdjustViewport(l,h,S.countRemoved)}}_reflowLargerAdjustViewport(l,h,g){const S=this.getNullCell(p.DEFAULT_ATTR_DATA);let k=g;for(;k-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<h&&this.lines.push(new p.BufferLine(l,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-g,0)}_reflowSmaller(l,h){const g=this.getNullCell(p.DEFAULT_ATTR_DATA),S=[];let k=0;for(let E=this.lines.length-1;E>=0;E--){let x=this.lines.get(E);if(!x||!x.isWrapped&&x.getTrimmedLength()<=l)continue;const w=[x];for(;x.isWrapped&&E>0;)x=this.lines.get(--E),w.unshift(x);const A=this.ybase+this.y;if(A>=E&&A<E+w.length)continue;const L=w[w.length-1].getTrimmedLength(),R=(0,m.reflowSmallerGetNewLineLengths)(w,this._cols,l),M=R.length-w.length;let I;I=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+M):Math.max(0,this.lines.length-this.lines.maxLength+M);const P=[];for(let B=0;B<M;B++){const q=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);P.push(q)}P.length>0&&(S.push({start:E+w.length+k,newLines:P}),k+=P.length),w.push(...P);let H=R.length-1,$=R[H];$===0&&(H--,$=R[H]);let T=w.length-M-1,O=L;for(;T>=0;){const B=Math.min(O,$);if(w[H]===void 0)break;if(w[H].copyCellsFrom(w[T],O-B,$-B,B,!0),$-=B,$===0&&(H--,$=R[H]),O-=B,O===0){T--;const q=Math.max(T,0);O=(0,m.getWrappedLineTrimmedLength)(w,q,this._cols)}}for(let B=0;B<w.length;B++)R[B]<l&&w[B].setCell(R[B],g);let D=M-I;for(;D-- >0;)this.ybase===0?this.y<h-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+k)-h&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+M,this.ybase+h-1)}if(S.length>0){const E=[],x=[];for(let H=0;H<this.lines.length;H++)x.push(this.lines.get(H));const w=this.lines.length;let A=w-1,L=0,R=S[L];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+k);let M=0;for(let H=Math.min(this.lines.maxLength-1,w+k-1);H>=0;H--)if(R&&R.start>A+M){for(let $=R.newLines.length-1;$>=0;$--)this.lines.set(H--,R.newLines[$]);H++,E.push({index:A+1,amount:R.newLines.length}),M+=R.newLines.length,R=S[++L]}else this.lines.set(H,x[A--]);let I=0;for(let H=E.length-1;H>=0;H--)E[H].index+=I,this.lines.onInsertEmitter.fire(E[H]),I+=E[H].amount;const P=Math.max(0,w+k-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}}translateBufferLineToString(l,h,g=0,S){const k=this.lines.get(l);return k?k.translateToString(h,g,S):""}getWrappedRangeForLine(l){let h=l,g=l;for(;h>0&&this.lines.get(h).isWrapped;)h--;for(;g+1<this.lines.length&&this.lines.get(g+1).isWrapped;)g++;return{first:h,last:g}}setupTabStops(l){for(l!=null?this.tabs[l]||(l=this.prevStop(l)):(this.tabs={},l=0);l<this._cols;l+=this._optionsService.rawOptions.tabStopWidth)this.tabs[l]=!0}prevStop(l){for(l==null&&(l=this.x);!this.tabs[--l]&&l>0;);return l>=this._cols?this._cols-1:l<0?0:l}nextStop(l){for(l==null&&(l=this.x);!this.tabs[++l]&&l<this._cols;);return l>=this._cols?this._cols-1:l<0?0:l}clearMarkers(l){this._isClearing=!0;for(let h=0;h<this.markers.length;h++)this.markers[h].line===l&&(this.markers[h].dispose(),this.markers.splice(h--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let l=0;l<this.markers.length;l++)this.markers[l].dispose(),this.markers.splice(l--,1);this._isClearing=!1}addMarker(l){const h=new s.Marker(l);return this.markers.push(h),h.register(this.lines.onTrim((g=>{h.line-=g,h.line<0&&h.dispose()}))),h.register(this.lines.onInsert((g=>{h.line>=g.index&&(h.line+=g.amount)}))),h.register(this.lines.onDelete((g=>{h.line>=g.index&&h.line<g.index+g.amount&&h.dispose(),h.line>g.index&&(h.line-=g.amount)}))),h.register(h.onDispose((()=>this._removeMarker(h)))),h}_removeMarker(l){this._isClearing||this.markers.splice(this.markers.indexOf(l),1)}}},8437:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const u=o(3734),f=o(511),a=o(643),p=o(482);r.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let m=0;class y{constructor(s,c,l=!1){this.isWrapped=l,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*s);const h=c||f.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let g=0;g<s;++g)this.setCell(g,h);this.length=s}get(s){const c=this._data[3*s+0],l=2097151&c;return[this._data[3*s+1],2097152&c?this._combined[s]:l?(0,p.stringFromCodePoint)(l):"",c>>22,2097152&c?this._combined[s].charCodeAt(this._combined[s].length-1):l]}set(s,c){this._data[3*s+1]=c[a.CHAR_DATA_ATTR_INDEX],c[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[s]=c[1],this._data[3*s+0]=2097152|s|c[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*s+0]=c[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|c[a.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(s){return this._data[3*s+0]>>22}hasWidth(s){return 12582912&this._data[3*s+0]}getFg(s){return this._data[3*s+1]}getBg(s){return this._data[3*s+2]}hasContent(s){return 4194303&this._data[3*s+0]}getCodePoint(s){const c=this._data[3*s+0];return 2097152&c?this._combined[s].charCodeAt(this._combined[s].length-1):2097151&c}isCombined(s){return 2097152&this._data[3*s+0]}getString(s){const c=this._data[3*s+0];return 2097152&c?this._combined[s]:2097151&c?(0,p.stringFromCodePoint)(2097151&c):""}isProtected(s){return 536870912&this._data[3*s+2]}loadCell(s,c){return m=3*s,c.content=this._data[m+0],c.fg=this._data[m+1],c.bg=this._data[m+2],2097152&c.content&&(c.combinedData=this._combined[s]),268435456&c.bg&&(c.extended=this._extendedAttrs[s]),c}setCell(s,c){2097152&c.content&&(this._combined[s]=c.combinedData),268435456&c.bg&&(this._extendedAttrs[s]=c.extended),this._data[3*s+0]=c.content,this._data[3*s+1]=c.fg,this._data[3*s+2]=c.bg}setCellFromCodePoint(s,c,l,h,g,S){268435456&g&&(this._extendedAttrs[s]=S),this._data[3*s+0]=c|l<<22,this._data[3*s+1]=h,this._data[3*s+2]=g}addCodepointToCell(s,c){let l=this._data[3*s+0];2097152&l?this._combined[s]+=(0,p.stringFromCodePoint)(c):(2097151&l?(this._combined[s]=(0,p.stringFromCodePoint)(2097151&l)+(0,p.stringFromCodePoint)(c),l&=-2097152,l|=2097152):l=c|4194304,this._data[3*s+0]=l)}insertCells(s,c,l,h){if((s%=this.length)&&this.getWidth(s-1)===2&&this.setCellFromCodePoint(s-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new u.ExtendedAttrs),c<this.length-s){const g=new f.CellData;for(let S=this.length-s-c-1;S>=0;--S)this.setCell(s+c+S,this.loadCell(s+S,g));for(let S=0;S<c;++S)this.setCell(s+S,l)}else for(let g=s;g<this.length;++g)this.setCell(g,l);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new u.ExtendedAttrs)}deleteCells(s,c,l,h){if(s%=this.length,c<this.length-s){const g=new f.CellData;for(let S=0;S<this.length-s-c;++S)this.setCell(s+S,this.loadCell(s+c+S,g));for(let S=this.length-c;S<this.length;++S)this.setCell(S,l)}else for(let g=s;g<this.length;++g)this.setCell(g,l);s&&this.getWidth(s-1)===2&&this.setCellFromCodePoint(s-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new u.ExtendedAttrs),this.getWidth(s)!==0||this.hasContent(s)||this.setCellFromCodePoint(s,0,1,h?.fg||0,h?.bg||0,h?.extended||new u.ExtendedAttrs)}replaceCells(s,c,l,h,g=!1){if(g)for(s&&this.getWidth(s-1)===2&&!this.isProtected(s-1)&&this.setCellFromCodePoint(s-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new u.ExtendedAttrs),c<this.length&&this.getWidth(c-1)===2&&!this.isProtected(c)&&this.setCellFromCodePoint(c,0,1,h?.fg||0,h?.bg||0,h?.extended||new u.ExtendedAttrs);s<c&&s<this.length;)this.isProtected(s)||this.setCell(s,l),s++;else for(s&&this.getWidth(s-1)===2&&this.setCellFromCodePoint(s-1,0,1,h?.fg||0,h?.bg||0,h?.extended||new u.ExtendedAttrs),c<this.length&&this.getWidth(c-1)===2&&this.setCellFromCodePoint(c,0,1,h?.fg||0,h?.bg||0,h?.extended||new u.ExtendedAttrs);s<c&&s<this.length;)this.setCell(s++,l)}resize(s,c){if(s===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const l=3*s;if(s>this.length){if(this._data.buffer.byteLength>=4*l)this._data=new Uint32Array(this._data.buffer,0,l);else{const h=new Uint32Array(l);h.set(this._data),this._data=h}for(let h=this.length;h<s;++h)this.setCell(h,c)}else{this._data=this._data.subarray(0,l);const h=Object.keys(this._combined);for(let S=0;S<h.length;S++){const k=parseInt(h[S],10);k>=s&&delete this._combined[k]}const g=Object.keys(this._extendedAttrs);for(let S=0;S<g.length;S++){const k=parseInt(g[S],10);k>=s&&delete this._extendedAttrs[k]}}return this.length=s,4*l*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const s=new Uint32Array(this._data.length);return s.set(this._data),this._data=s,1}return 0}fill(s,c=!1){if(c)for(let l=0;l<this.length;++l)this.isProtected(l)||this.setCell(l,s);else{this._combined={},this._extendedAttrs={};for(let l=0;l<this.length;++l)this.setCell(l,s)}}copyFrom(s){this.length!==s.length?this._data=new Uint32Array(s._data):this._data.set(s._data),this.length=s.length,this._combined={};for(const c in s._combined)this._combined[c]=s._combined[c];this._extendedAttrs={};for(const c in s._extendedAttrs)this._extendedAttrs[c]=s._extendedAttrs[c];this.isWrapped=s.isWrapped}clone(){const s=new y(0);s._data=new Uint32Array(this._data),s.length=this.length;for(const c in this._combined)s._combined[c]=this._combined[c];for(const c in this._extendedAttrs)s._extendedAttrs[c]=this._extendedAttrs[c];return s.isWrapped=this.isWrapped,s}getTrimmedLength(){for(let s=this.length-1;s>=0;--s)if(4194303&this._data[3*s+0])return s+(this._data[3*s+0]>>22);return 0}getNoBgTrimmedLength(){for(let s=this.length-1;s>=0;--s)if(4194303&this._data[3*s+0]||50331648&this._data[3*s+2])return s+(this._data[3*s+0]>>22);return 0}copyCellsFrom(s,c,l,h,g){const S=s._data;if(g)for(let E=h-1;E>=0;E--){for(let x=0;x<3;x++)this._data[3*(l+E)+x]=S[3*(c+E)+x];268435456&S[3*(c+E)+2]&&(this._extendedAttrs[l+E]=s._extendedAttrs[c+E])}else for(let E=0;E<h;E++){for(let x=0;x<3;x++)this._data[3*(l+E)+x]=S[3*(c+E)+x];268435456&S[3*(c+E)+2]&&(this._extendedAttrs[l+E]=s._extendedAttrs[c+E])}const k=Object.keys(s._combined);for(let E=0;E<k.length;E++){const x=parseInt(k[E],10);x>=c&&(this._combined[x-c+l]=s._combined[x])}}translateToString(s=!1,c=0,l=this.length){s&&(l=Math.min(l,this.getTrimmedLength()));let h="";for(;c<l;){const g=this._data[3*c+0],S=2097151&g;h+=2097152&g?this._combined[c]:S?(0,p.stringFromCodePoint)(S):a.WHITESPACE_CELL_CHAR,c+=g>>22||1}return h}}r.BufferLine=y},4841:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(o,u){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return u*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(C,r)=>{function o(u,f,a){if(f===u.length-1)return u[f].getTrimmedLength();const p=!u[f].hasContent(a-1)&&u[f].getWidth(a-1)===1,m=u[f+1].getWidth(0)===2;return p&&m?a-1:a}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(u,f,a,p,m){const y=[];for(let b=0;b<u.length-1;b++){let s=b,c=u.get(++s);if(!c.isWrapped)continue;const l=[u.get(b)];for(;s<u.length&&c.isWrapped;)l.push(c),c=u.get(++s);if(p>=b&&p<s){b+=l.length-1;continue}let h=0,g=o(l,h,f),S=1,k=0;for(;S<l.length;){const x=o(l,S,f),w=x-k,A=a-g,L=Math.min(w,A);l[h].copyCellsFrom(l[S],k,g,L,!1),g+=L,g===a&&(h++,g=0),k+=L,k===x&&(S++,k=0),g===0&&h!==0&&l[h-1].getWidth(a-1)===2&&(l[h].copyCellsFrom(l[h-1],a-1,g++,1,!1),l[h-1].setCell(a-1,m))}l[h].replaceCells(g,a,m);let E=0;for(let x=l.length-1;x>0&&(x>h||l[x].getTrimmedLength()===0);x--)E++;E>0&&(y.push(b+l.length-E),y.push(E)),b+=l.length-1}return y},r.reflowLargerCreateNewLayout=function(u,f){const a=[];let p=0,m=f[p],y=0;for(let b=0;b<u.length;b++)if(m===b){const s=f[++p];u.onDeleteEmitter.fire({index:b-y,amount:s}),b+=s-1,y+=s,m=f[++p]}else a.push(b);return{layout:a,countRemoved:y}},r.reflowLargerApplyNewLayout=function(u,f){const a=[];for(let p=0;p<f.length;p++)a.push(u.get(f[p]));for(let p=0;p<a.length;p++)u.set(p,a[p]);u.length=f.length},r.reflowSmallerGetNewLineLengths=function(u,f,a){const p=[],m=u.map(((c,l)=>o(u,l,f))).reduce(((c,l)=>c+l));let y=0,b=0,s=0;for(;s<m;){if(m-s<a){p.push(m-s);break}y+=a;const c=o(u,b,f);y>c&&(y-=c,b++);const l=u[b].getWidth(y-1)===2;l&&y--;const h=l?a-1:a;p.push(h),s+=h}return p},r.getWrappedLineTrimmedLength=o},5295:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const u=o(8460),f=o(844),a=o(9092);class p extends f.Disposable{constructor(y,b){super(),this._optionsService=y,this._bufferService=b,this._onBufferActivate=this.register(new u.EventEmitter),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 a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.Buffer(!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(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),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(y,b){this._normal.resize(y,b),this._alt.resize(y,b),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}r.BufferSet=p},511:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const u=o(482),f=o(643),a=o(3734);class p extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const b=new p;return b.setFromCharData(y),b}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let b=!1;if(y[f.CHAR_DATA_CHAR_INDEX].length>2)b=!0;else if(y[f.CHAR_DATA_CHAR_INDEX].length===2){const s=y[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=s&&s<=56319){const c=y[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=c&&c<=57343?this.content=1024*(s-55296)+c-56320+65536|y[f.CHAR_DATA_WIDTH_INDEX]<<22:b=!0}else b=!0}else this.content=y[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[f.CHAR_DATA_WIDTH_INDEX]<<22;b&&(this.combinedData=y[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=p},643:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const u=o(8460),f=o(844);class a{get id(){return this._id}constructor(m){this.line=m,this.isDisposed=!1,this._disposables=[],this._id=a._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(m){return this._disposables.push(m),m}}r.Marker=a,a._nextId=1},7116:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(C,r)=>{var o,u,f;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(a){a.NUL="\0",a.SOH="",a.STX="",a.ETX="",a.EOT="",a.ENQ="",a.ACK="",a.BEL="\x07",a.BS="\b",a.HT=" ",a.LF=`
|
|
15
|
+
`,a.VT="\v",a.FF="\f",a.CR="\r",a.SO="",a.SI="",a.DLE="",a.DC1="",a.DC2="",a.DC3="",a.DC4="",a.NAK="",a.SYN="",a.ETB="",a.CAN="",a.EM="",a.SUB="",a.ESC="\x1B",a.FS="",a.GS="",a.RS="",a.US="",a.SP=" ",a.DEL=""})(o||(r.C0=o={})),(function(a){a.PAD="",a.HOP="",a.BPH="",a.NBH="",a.IND="",a.NEL="
",a.SSA="",a.ESA="",a.HTS="",a.HTJ="",a.VTS="",a.PLD="",a.PLU="",a.RI="",a.SS2="",a.SS3="",a.DCS="",a.PU1="",a.PU2="",a.STS="",a.CCH="",a.MW="",a.SPA="",a.EPA="",a.SOS="",a.SGCI="",a.SCI="",a.CSI="",a.ST="",a.OSC="",a.PM="",a.APC=""})(u||(r.C1=u={})),(function(a){a.ST=`${o.ESC}\\`})(f||(r.C1_ESCAPED=f={}))},7399:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const u=o(2584),f={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:["'",'"']};r.evaluateKeyboardEvent=function(a,p,m,y){const b={type:0,cancel:!1,key:void 0},s=(a.shiftKey?1:0)|(a.altKey?2:0)|(a.ctrlKey?4:0)|(a.metaKey?8:0);switch(a.keyCode){case 0:a.key==="UIKeyInputUpArrow"?b.key=p?u.C0.ESC+"OA":u.C0.ESC+"[A":a.key==="UIKeyInputLeftArrow"?b.key=p?u.C0.ESC+"OD":u.C0.ESC+"[D":a.key==="UIKeyInputRightArrow"?b.key=p?u.C0.ESC+"OC":u.C0.ESC+"[C":a.key==="UIKeyInputDownArrow"&&(b.key=p?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:if(a.altKey){b.key=u.C0.ESC+u.C0.DEL;break}b.key=u.C0.DEL;break;case 9:if(a.shiftKey){b.key=u.C0.ESC+"[Z";break}b.key=u.C0.HT,b.cancel=!0;break;case 13:b.key=a.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,b.cancel=!0;break;case 27:b.key=u.C0.ESC,a.altKey&&(b.key=u.C0.ESC+u.C0.ESC),b.cancel=!0;break;case 37:if(a.metaKey)break;s?(b.key=u.C0.ESC+"[1;"+(s+1)+"D",b.key===u.C0.ESC+"[1;3D"&&(b.key=u.C0.ESC+(m?"b":"[1;5D"))):b.key=p?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(a.metaKey)break;s?(b.key=u.C0.ESC+"[1;"+(s+1)+"C",b.key===u.C0.ESC+"[1;3C"&&(b.key=u.C0.ESC+(m?"f":"[1;5C"))):b.key=p?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(a.metaKey)break;s?(b.key=u.C0.ESC+"[1;"+(s+1)+"A",m||b.key!==u.C0.ESC+"[1;3A"||(b.key=u.C0.ESC+"[1;5A")):b.key=p?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(a.metaKey)break;s?(b.key=u.C0.ESC+"[1;"+(s+1)+"B",m||b.key!==u.C0.ESC+"[1;3B"||(b.key=u.C0.ESC+"[1;5B")):b.key=p?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:a.shiftKey||a.ctrlKey||(b.key=u.C0.ESC+"[2~");break;case 46:b.key=s?u.C0.ESC+"[3;"+(s+1)+"~":u.C0.ESC+"[3~";break;case 36:b.key=s?u.C0.ESC+"[1;"+(s+1)+"H":p?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:b.key=s?u.C0.ESC+"[1;"+(s+1)+"F":p?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:a.shiftKey?b.type=2:a.ctrlKey?b.key=u.C0.ESC+"[5;"+(s+1)+"~":b.key=u.C0.ESC+"[5~";break;case 34:a.shiftKey?b.type=3:a.ctrlKey?b.key=u.C0.ESC+"[6;"+(s+1)+"~":b.key=u.C0.ESC+"[6~";break;case 112:b.key=s?u.C0.ESC+"[1;"+(s+1)+"P":u.C0.ESC+"OP";break;case 113:b.key=s?u.C0.ESC+"[1;"+(s+1)+"Q":u.C0.ESC+"OQ";break;case 114:b.key=s?u.C0.ESC+"[1;"+(s+1)+"R":u.C0.ESC+"OR";break;case 115:b.key=s?u.C0.ESC+"[1;"+(s+1)+"S":u.C0.ESC+"OS";break;case 116:b.key=s?u.C0.ESC+"[15;"+(s+1)+"~":u.C0.ESC+"[15~";break;case 117:b.key=s?u.C0.ESC+"[17;"+(s+1)+"~":u.C0.ESC+"[17~";break;case 118:b.key=s?u.C0.ESC+"[18;"+(s+1)+"~":u.C0.ESC+"[18~";break;case 119:b.key=s?u.C0.ESC+"[19;"+(s+1)+"~":u.C0.ESC+"[19~";break;case 120:b.key=s?u.C0.ESC+"[20;"+(s+1)+"~":u.C0.ESC+"[20~";break;case 121:b.key=s?u.C0.ESC+"[21;"+(s+1)+"~":u.C0.ESC+"[21~";break;case 122:b.key=s?u.C0.ESC+"[23;"+(s+1)+"~":u.C0.ESC+"[23~";break;case 123:b.key=s?u.C0.ESC+"[24;"+(s+1)+"~":u.C0.ESC+"[24~";break;default:if(!a.ctrlKey||a.shiftKey||a.altKey||a.metaKey)if(m&&!y||!a.altKey||a.metaKey)!m||a.altKey||a.ctrlKey||a.shiftKey||!a.metaKey?a.key&&!a.ctrlKey&&!a.altKey&&!a.metaKey&&a.keyCode>=48&&a.key.length===1?b.key=a.key:a.key&&a.ctrlKey&&(a.key==="_"&&(b.key=u.C0.US),a.key==="@"&&(b.key=u.C0.NUL)):a.keyCode===65&&(b.type=1);else{const c=f[a.keyCode],l=c?.[a.shiftKey?1:0];if(l)b.key=u.C0.ESC+l;else if(a.keyCode>=65&&a.keyCode<=90){const h=a.ctrlKey?a.keyCode-64:a.keyCode+32;let g=String.fromCharCode(h);a.shiftKey&&(g=g.toUpperCase()),b.key=u.C0.ESC+g}else if(a.keyCode===32)b.key=u.C0.ESC+(a.ctrlKey?u.C0.NUL:" ");else if(a.key==="Dead"&&a.code.startsWith("Key")){let h=a.code.slice(3,4);a.shiftKey||(h=h.toLowerCase()),b.key=u.C0.ESC+h,b.cancel=!0}}else a.keyCode>=65&&a.keyCode<=90?b.key=String.fromCharCode(a.keyCode-64):a.keyCode===32?b.key=u.C0.NUL:a.keyCode>=51&&a.keyCode<=55?b.key=String.fromCharCode(a.keyCode-51+27):a.keyCode===56?b.key=u.C0.DEL:a.keyCode===219?b.key=u.C0.ESC:a.keyCode===220?b.key=u.C0.FS:a.keyCode===221&&(b.key=u.C0.GS)}return b}},482:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},r.utf32ToString=function(o,u=0,f=o.length){let a="";for(let p=u;p<f;++p){let m=o[p];m>65535?(m-=65536,a+=String.fromCharCode(55296+(m>>10))+String.fromCharCode(m%1024+56320)):a+=String.fromCharCode(m)}return a},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,u){const f=o.length;if(!f)return 0;let a=0,p=0;if(this._interim){const m=o.charCodeAt(p++);56320<=m&&m<=57343?u[a++]=1024*(this._interim-55296)+m-56320+65536:(u[a++]=this._interim,u[a++]=m),this._interim=0}for(let m=p;m<f;++m){const y=o.charCodeAt(m);if(55296<=y&&y<=56319){if(++m>=f)return this._interim=y,a;const b=o.charCodeAt(m);56320<=b&&b<=57343?u[a++]=1024*(y-55296)+b-56320+65536:(u[a++]=y,u[a++]=b)}else y!==65279&&(u[a++]=y)}return a}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,u){const f=o.length;if(!f)return 0;let a,p,m,y,b=0,s=0,c=0;if(this.interim[0]){let g=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let k,E=0;for(;(k=63&this.interim[++E])&&E<4;)S<<=6,S|=k;const x=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,w=x-E;for(;c<w;){if(c>=f)return 0;if(k=o[c++],(192&k)!=128){c--,g=!0;break}this.interim[E++]=k,S<<=6,S|=63&k}g||(x===2?S<128?c--:u[b++]=S:x===3?S<2048||S>=55296&&S<=57343||S===65279||(u[b++]=S):S<65536||S>1114111||(u[b++]=S)),this.interim.fill(0)}const l=f-4;let h=c;for(;h<f;){for(;!(!(h<l)||128&(a=o[h])||128&(p=o[h+1])||128&(m=o[h+2])||128&(y=o[h+3]));)u[b++]=a,u[b++]=p,u[b++]=m,u[b++]=y,h+=4;if(a=o[h++],a<128)u[b++]=a;else if((224&a)==192){if(h>=f)return this.interim[0]=a,b;if(p=o[h++],(192&p)!=128){h--;continue}if(s=(31&a)<<6|63&p,s<128){h--;continue}u[b++]=s}else if((240&a)==224){if(h>=f)return this.interim[0]=a,b;if(p=o[h++],(192&p)!=128){h--;continue}if(h>=f)return this.interim[0]=a,this.interim[1]=p,b;if(m=o[h++],(192&m)!=128){h--;continue}if(s=(15&a)<<12|(63&p)<<6|63&m,s<2048||s>=55296&&s<=57343||s===65279)continue;u[b++]=s}else if((248&a)==240){if(h>=f)return this.interim[0]=a,b;if(p=o[h++],(192&p)!=128){h--;continue}if(h>=f)return this.interim[0]=a,this.interim[1]=p,b;if(m=o[h++],(192&m)!=128){h--;continue}if(h>=f)return this.interim[0]=a,this.interim[1]=p,this.interim[2]=m,b;if(y=o[h++],(192&y)!=128){h--;continue}if(s=(7&a)<<18|(63&p)<<12|(63&m)<<6|63&y,s<65536||s>1114111)continue;u[b++]=s}}return b}}},225:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const o=[[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]],u=[[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]];let f;r.UnicodeV6=class{constructor(){if(this.version="6",!f){f=new Uint8Array(65536),f.fill(1),f[0]=0,f.fill(0,1,32),f.fill(0,127,160),f.fill(2,4352,4448),f[9001]=2,f[9002]=2,f.fill(2,11904,42192),f[12351]=1,f.fill(2,44032,55204),f.fill(2,63744,64256),f.fill(2,65040,65050),f.fill(2,65072,65136),f.fill(2,65280,65377),f.fill(2,65504,65511);for(let a=0;a<o.length;++a)f.fill(0,o[a][0],o[a][1]+1)}}wcwidth(a){return a<32?0:a<127?1:a<65536?f[a]:(function(p,m){let y,b=0,s=m.length-1;if(p<m[0][0]||p>m[s][1])return!1;for(;s>=b;)if(y=b+s>>1,p>m[y][1])b=y+1;else{if(!(p<m[y][0]))return!0;s=y-1}return!1})(a,u)?0:a>=131072&&a<=196605||a>=196608&&a<=262141?2:1}}},5981:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const u=o(8460),f=o(844);class a extends f.Disposable{constructor(m){super(),this._action=m,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(m,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let b;for(this._isSyncWriting=!0;b=this._writeBuffer.shift();){this._action(b);const s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(m,y){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(y),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(y)}_innerWrite(m=0,y=!0){const b=m||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const s=this._writeBuffer[this._bufferOffset],c=this._action(s,y);if(c){const h=g=>Date.now()-b>=12?setTimeout((()=>this._innerWrite(0,g))):this._innerWrite(b,g);return void c.catch((g=>(queueMicrotask((()=>{throw g})),Promise.resolve(!1)))).then(h)}const l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=s.length,Date.now()-b>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}}r.WriteBuffer=a},5941:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const o=/^([\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})$/,u=/^[\da-f]+$/;function f(a,p){const m=a.toString(16),y=m.length<2?"0"+m:m;switch(p){case 4:return m[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}r.parseColor=function(a){if(!a)return;let p=a.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const m=o.exec(p);if(m){const y=m[1]?15:m[4]?255:m[7]?4095:65535;return[Math.round(parseInt(m[1]||m[4]||m[7]||m[10],16)/y*255),Math.round(parseInt(m[2]||m[5]||m[8]||m[11],16)/y*255),Math.round(parseInt(m[3]||m[6]||m[9]||m[12],16)/y*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),u.exec(p)&&[3,6,9,12].includes(p.length))){const m=p.length/3,y=[0,0,0];for(let b=0;b<3;++b){const s=parseInt(p.slice(m*b,m*b+m),16);y[b]=m===1?s<<4:m===2?s:m===3?s>>4:s>>8}return y}},r.toRgbString=function(a,p=16){const[m,y,b]=a;return`rgb:${f(m,p)}/${f(y,p)}/${f(b,p)}`}},5770:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const u=o(482),f=o(8742),a=o(5770),p=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(y,b){this._handlers[y]===void 0&&(this._handlers[y]=[]);const s=this._handlers[y];return s.push(b),{dispose:()=>{const c=s.indexOf(b);c!==-1&&s.splice(c,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(y,b){if(this.reset(),this._ident=y,this._active=this._handlers[y]||p,this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(b);else this._handlerFb(this._ident,"HOOK",b)}put(y,b,s){if(this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].put(y,b,s);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(y,b,s))}unhook(y,b=!0){if(this._active.length){let s=!1,c=this._active.length-1,l=!1;if(this._stack.paused&&(c=this._stack.loopPosition-1,s=b,l=this._stack.fallThrough,this._stack.paused=!1),!l&&s===!1){for(;c>=0&&(s=this._active[c].unhook(y),s!==!0);c--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=c,this._stack.fallThrough=!1,s;c--}for(;c>=0;c--)if(s=this._active[c].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=c,this._stack.fallThrough=!0,s}else this._handlerFb(this._ident,"UNHOOK",y);this._active=p,this._ident=0}};const m=new f.Params;m.addParam(0),r.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=m,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():m,this._data="",this._hitLimit=!1}put(y,b,s){this._hitLimit||(this._data+=(0,u.utf32ToString)(y,b,s),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let b=!1;if(this._hitLimit)b=!1;else if(y&&(b=this._handler(this._data,this._params),b instanceof Promise))return b.then((s=>(this._params=m,this._data="",this._hitLimit=!1,s)));return this._params=m,this._data="",this._hitLimit=!1,b}}},2015:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const u=o(844),f=o(8742),a=o(6242),p=o(6351);class m{constructor(c){this.table=new Uint8Array(c)}setDefault(c,l){this.table.fill(c<<4|l)}add(c,l,h,g){this.table[l<<8|c]=h<<4|g}addMany(c,l,h,g){for(let S=0;S<c.length;S++)this.table[l<<8|c[S]]=h<<4|g}}r.TransitionTable=m;const y=160;r.VT500_TRANSITION_TABLE=(function(){const s=new m(4095),c=Array.apply(null,Array(256)).map(((E,x)=>x)),l=(E,x)=>c.slice(E,x),h=l(32,127),g=l(0,24);g.push(25),g.push.apply(g,l(28,32));const S=l(0,14);let k;for(k in s.setDefault(1,0),s.addMany(h,0,2,0),S)s.addMany([24,26,153,154],k,3,0),s.addMany(l(128,144),k,3,0),s.addMany(l(144,152),k,3,0),s.add(156,k,0,0),s.add(27,k,11,1),s.add(157,k,4,8),s.addMany([152,158,159],k,0,7),s.add(155,k,11,3),s.add(144,k,11,9);return s.addMany(g,0,3,0),s.addMany(g,1,3,1),s.add(127,1,0,1),s.addMany(g,8,0,8),s.addMany(g,3,3,3),s.add(127,3,0,3),s.addMany(g,4,3,4),s.add(127,4,0,4),s.addMany(g,6,3,6),s.addMany(g,5,3,5),s.add(127,5,0,5),s.addMany(g,2,3,2),s.add(127,2,0,2),s.add(93,1,4,8),s.addMany(h,8,5,8),s.add(127,8,5,8),s.addMany([156,27,24,26,7],8,6,0),s.addMany(l(28,32),8,0,8),s.addMany([88,94,95],1,0,7),s.addMany(h,7,0,7),s.addMany(g,7,0,7),s.add(156,7,0,0),s.add(127,7,0,7),s.add(91,1,11,3),s.addMany(l(64,127),3,7,0),s.addMany(l(48,60),3,8,4),s.addMany([60,61,62,63],3,9,4),s.addMany(l(48,60),4,8,4),s.addMany(l(64,127),4,7,0),s.addMany([60,61,62,63],4,0,6),s.addMany(l(32,64),6,0,6),s.add(127,6,0,6),s.addMany(l(64,127),6,0,0),s.addMany(l(32,48),3,9,5),s.addMany(l(32,48),5,9,5),s.addMany(l(48,64),5,0,6),s.addMany(l(64,127),5,7,0),s.addMany(l(32,48),4,9,5),s.addMany(l(32,48),1,9,2),s.addMany(l(32,48),2,9,2),s.addMany(l(48,127),2,10,0),s.addMany(l(48,80),1,10,0),s.addMany(l(81,88),1,10,0),s.addMany([89,90,92],1,10,0),s.addMany(l(96,127),1,10,0),s.add(80,1,11,9),s.addMany(g,9,0,9),s.add(127,9,0,9),s.addMany(l(28,32),9,0,9),s.addMany(l(32,48),9,9,12),s.addMany(l(48,60),9,8,10),s.addMany([60,61,62,63],9,9,10),s.addMany(g,11,0,11),s.addMany(l(32,128),11,0,11),s.addMany(l(28,32),11,0,11),s.addMany(g,10,0,10),s.add(127,10,0,10),s.addMany(l(28,32),10,0,10),s.addMany(l(48,60),10,8,10),s.addMany([60,61,62,63],10,0,11),s.addMany(l(32,48),10,9,12),s.addMany(g,12,0,12),s.add(127,12,0,12),s.addMany(l(28,32),12,0,12),s.addMany(l(32,48),12,9,12),s.addMany(l(48,64),12,0,11),s.addMany(l(64,127),12,12,13),s.addMany(l(64,127),10,12,13),s.addMany(l(64,127),9,12,13),s.addMany(g,13,13,13),s.addMany(h,13,13,13),s.add(127,13,0,13),s.addMany([27,156,24,26],13,14,0),s.add(y,0,2,0),s.add(y,8,5,8),s.add(y,6,0,6),s.add(y,11,0,11),s.add(y,13,13,13),s})();class b extends u.Disposable{constructor(c=r.VT500_TRANSITION_TABLE){super(),this._transitions=c,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(l,h,g)=>{},this._executeHandlerFb=l=>{},this._csiHandlerFb=(l,h)=>{},this._escHandlerFb=l=>{},this._errorHandlerFb=l=>l,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,u.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(c,l=[64,126]){let h=0;if(c.prefix){if(c.prefix.length>1)throw new Error("only one byte as prefix supported");if(h=c.prefix.charCodeAt(0),h&&60>h||h>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(c.intermediates){if(c.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let S=0;S<c.intermediates.length;++S){const k=c.intermediates.charCodeAt(S);if(32>k||k>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");h<<=8,h|=k}}if(c.final.length!==1)throw new Error("final must be a single byte");const g=c.final.charCodeAt(0);if(l[0]>g||g>l[1])throw new Error(`final must be in range ${l[0]} .. ${l[1]}`);return h<<=8,h|=g,h}identToString(c){const l=[];for(;c;)l.push(String.fromCharCode(255&c)),c>>=8;return l.reverse().join("")}setPrintHandler(c){this._printHandler=c}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(c,l){const h=this._identifier(c,[48,126]);this._escHandlers[h]===void 0&&(this._escHandlers[h]=[]);const g=this._escHandlers[h];return g.push(l),{dispose:()=>{const S=g.indexOf(l);S!==-1&&g.splice(S,1)}}}clearEscHandler(c){this._escHandlers[this._identifier(c,[48,126])]&&delete this._escHandlers[this._identifier(c,[48,126])]}setEscHandlerFallback(c){this._escHandlerFb=c}setExecuteHandler(c,l){this._executeHandlers[c.charCodeAt(0)]=l}clearExecuteHandler(c){this._executeHandlers[c.charCodeAt(0)]&&delete this._executeHandlers[c.charCodeAt(0)]}setExecuteHandlerFallback(c){this._executeHandlerFb=c}registerCsiHandler(c,l){const h=this._identifier(c);this._csiHandlers[h]===void 0&&(this._csiHandlers[h]=[]);const g=this._csiHandlers[h];return g.push(l),{dispose:()=>{const S=g.indexOf(l);S!==-1&&g.splice(S,1)}}}clearCsiHandler(c){this._csiHandlers[this._identifier(c)]&&delete this._csiHandlers[this._identifier(c)]}setCsiHandlerFallback(c){this._csiHandlerFb=c}registerDcsHandler(c,l){return this._dcsParser.registerHandler(this._identifier(c),l)}clearDcsHandler(c){this._dcsParser.clearHandler(this._identifier(c))}setDcsHandlerFallback(c){this._dcsParser.setHandlerFallback(c)}registerOscHandler(c,l){return this._oscParser.registerHandler(c,l)}clearOscHandler(c){this._oscParser.clearHandler(c)}setOscHandlerFallback(c){this._oscParser.setHandlerFallback(c)}setErrorHandler(c){this._errorHandler=c}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.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(c,l,h,g,S){this._parseStack.state=c,this._parseStack.handlers=l,this._parseStack.handlerPos=h,this._parseStack.transition=g,this._parseStack.chunkPos=S}parse(c,l,h){let g,S=0,k=0,E=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,E=this._parseStack.chunkPos+1;else{if(h===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const x=this._parseStack.handlers;let w=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(h===!1&&w>-1){for(;w>=0&&(g=x[w](this._params),g!==!0);w--)if(g instanceof Promise)return this._parseStack.handlerPos=w,g}this._parseStack.handlers=[];break;case 4:if(h===!1&&w>-1){for(;w>=0&&(g=x[w](),g!==!0);w--)if(g instanceof Promise)return this._parseStack.handlerPos=w,g}this._parseStack.handlers=[];break;case 6:if(S=c[this._parseStack.chunkPos],g=this._dcsParser.unhook(S!==24&&S!==26,h),g)return g;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=c[this._parseStack.chunkPos],g=this._oscParser.end(S!==24&&S!==26,h),g)return g;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,E=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let x=E;x<l;++x){switch(S=c[x],k=this._transitions.table[this.currentState<<8|(S<160?S:y)],k>>4){case 2:for(let M=x+1;;++M){if(M>=l||(S=c[M])<32||S>126&&S<y){this._printHandler(c,x,M),x=M-1;break}if(++M>=l||(S=c[M])<32||S>126&&S<y){this._printHandler(c,x,M),x=M-1;break}if(++M>=l||(S=c[M])<32||S>126&&S<y){this._printHandler(c,x,M),x=M-1;break}if(++M>=l||(S=c[M])<32||S>126&&S<y){this._printHandler(c,x,M),x=M-1;break}}break;case 3:this._executeHandlers[S]?this._executeHandlers[S]():this._executeHandlerFb(S),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:x,code:S,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const w=this._csiHandlers[this._collect<<8|S];let A=w?w.length-1:-1;for(;A>=0&&(g=w[A](this._params),g!==!0);A--)if(g instanceof Promise)return this._preserveStack(3,w,A,k,x),g;A<0&&this._csiHandlerFb(this._collect<<8|S,this._params),this.precedingCodepoint=0;break;case 8:do switch(S){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(S-48)}while(++x<l&&(S=c[x])>47&&S<60);x--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:const L=this._escHandlers[this._collect<<8|S];let R=L?L.length-1:-1;for(;R>=0&&(g=L[R](),g!==!0);R--)if(g instanceof Promise)return this._preserveStack(4,L,R,k,x),g;R<0&&this._escHandlerFb(this._collect<<8|S),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|S,this._params);break;case 13:for(let M=x+1;;++M)if(M>=l||(S=c[M])===24||S===26||S===27||S>127&&S<y){this._dcsParser.put(c,x,M),x=M-1;break}break;case 14:if(g=this._dcsParser.unhook(S!==24&&S!==26),g)return this._preserveStack(6,[],0,k,x),g;S===27&&(k|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let M=x+1;;M++)if(M>=l||(S=c[M])<32||S>127&&S<y){this._oscParser.put(c,x,M),x=M-1;break}break;case 6:if(g=this._oscParser.end(S!==24&&S!==26),g)return this._preserveStack(5,[],0,k,x),g;S===27&&(k|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&k}}}r.EscapeSequenceParser=b},6242:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const u=o(5770),f=o(482),a=[];r.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,m){this._handlers[p]===void 0&&(this._handlers[p]=[]);const y=this._handlers[p];return y.push(m),{dispose:()=>{const b=y.indexOf(m);b!==-1&&y.splice(b,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,m,y){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(p,m,y);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(p,m,y))}start(){this.reset(),this._state=1}put(p,m,y){if(this._state!==3){if(this._state===1)for(;m<y;){const b=p[m++];if(b===59){this._state=2,this._start();break}if(b<48||57<b)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+b-48}this._state===2&&y-m>0&&this._put(p,m,y)}}end(p,m=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,b=this._active.length-1,s=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,y=m,s=this._stack.fallThrough,this._stack.paused=!1),!s&&y===!1){for(;b>=0&&(y=this._active[b].end(p),y!==!0);b--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,y;b--}for(;b>=0;b--)if(y=this._active[b].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",p);this._active=a,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,m,y){this._hitLimit||(this._data+=(0,f.utf32ToString)(p,m,y),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let m=!1;if(this._hitLimit)m=!1;else if(p&&(m=this._handler(this._data),m instanceof Promise))return m.then((y=>(this._data="",this._hitLimit=!1,y)));return this._data="",this._hitLimit=!1,m}}},8742:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const o=2147483647;class u{static fromArray(a){const p=new u;if(!a.length)return p;for(let m=Array.isArray(a[0])?1:0;m<a.length;++m){const y=a[m];if(Array.isArray(y))for(let b=0;b<y.length;++b)p.addSubParam(y[b]);else p.addParam(y)}return p}constructor(a=32,p=32){if(this.maxLength=a,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(a),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(a),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const a=new u(this.maxLength,this.maxSubParamsLength);return a.params.set(this.params),a.length=this.length,a._subParams.set(this._subParams),a._subParamsLength=this._subParamsLength,a._subParamsIdx.set(this._subParamsIdx),a._rejectDigits=this._rejectDigits,a._rejectSubDigits=this._rejectSubDigits,a._digitIsSub=this._digitIsSub,a}toArray(){const a=[];for(let p=0;p<this.length;++p){a.push(this.params[p]);const m=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-m>0&&a.push(Array.prototype.slice.call(this._subParams,m,y))}return a}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(a){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(a<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=a>o?o:a}}addSubParam(a){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(a<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=a>o?o:a,this._subParamsIdx[this.length-1]++}}hasSubParams(a){return(255&this._subParamsIdx[a])-(this._subParamsIdx[a]>>8)>0}getSubParams(a){const p=this._subParamsIdx[a]>>8,m=255&this._subParamsIdx[a];return m-p>0?this._subParams.subarray(p,m):null}getSubParamsAll(){const a={};for(let p=0;p<this.length;++p){const m=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-m>0&&(a[p]=this._subParams.slice(m,y))}return a}addDigit(a){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const m=this._digitIsSub?this._subParams:this.params,y=m[p-1];m[p-1]=~y?Math.min(10*y+a,o):a}}r.Params=u},5741:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,u){const f={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(f),u.dispose=()=>this._wrappedAddonDispose(f),u.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let u=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===o){u=f;break}if(u===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(u,1)}}},8771:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const u=o(3785),f=o(511);r.BufferApiView=class{constructor(a,p){this._buffer=a,this.type=p}init(a){return this._buffer=a,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(a){const p=this._buffer.lines.get(a);if(p)return new u.BufferLineApiView(p)}getNullCell(){return new f.CellData}}},3785:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const u=o(511);r.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,a){if(!(f<0||f>=this._line.length))return a?(this._line.loadCell(f,a),a):this._line.loadCell(f,new u.CellData)}translateToString(f,a,p){return this._line.translateToString(f,a,p)}}},8285:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const u=o(8771),f=o(8460),a=o(844);class p extends a.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.BufferApiView(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)}}r.BufferNamespaceApi=p},7975:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,u){return this._core.registerCsiHandler(o,(f=>u(f.toArray())))}addCsiHandler(o,u){return this.registerCsiHandler(o,u)}registerDcsHandler(o,u){return this._core.registerDcsHandler(o,((f,a)=>u(f,a.toArray())))}addDcsHandler(o,u){return this.registerDcsHandler(o,u)}registerEscHandler(o,u){return this._core.registerEscHandler(o,u)}addEscHandler(o,u){return this.registerEscHandler(o,u)}registerOscHandler(o,u){return this._core.registerOscHandler(o,u)}addOscHandler(o,u){return this.registerOscHandler(o,u)}}},7090:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(C,r,o){var u=this&&this.__decorate||function(s,c,l,h){var g,S=arguments.length,k=S<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(s,c,l,h);else for(var E=s.length-1;E>=0;E--)(g=s[E])&&(k=(S<3?g(k):S>3?g(c,l,k):g(c,l))||k);return S>3&&k&&Object.defineProperty(c,l,k),k},f=this&&this.__param||function(s,c){return function(l,h){c(l,h,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const a=o(8460),p=o(844),m=o(5295),y=o(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let b=r.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(s){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(s.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(s.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new m.BufferSet(s,this))}resize(s,c){this.cols=s,this.rows=c,this.buffers.resize(s,c),this._onResize.fire({cols:s,rows:c})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(s,c=!1){const l=this.buffer;let h;h=this._cachedBlankLine,h&&h.length===this.cols&&h.getFg(0)===s.fg&&h.getBg(0)===s.bg||(h=l.getBlankLine(s,c),this._cachedBlankLine=h),h.isWrapped=c;const g=l.ybase+l.scrollTop,S=l.ybase+l.scrollBottom;if(l.scrollTop===0){const k=l.lines.isFull;S===l.lines.length-1?k?l.lines.recycle().copyFrom(h):l.lines.push(h.clone()):l.lines.splice(S+1,0,h.clone()),k?this.isUserScrolling&&(l.ydisp=Math.max(l.ydisp-1,0)):(l.ybase++,this.isUserScrolling||l.ydisp++)}else{const k=S-g+1;l.lines.shiftElements(g+1,k-1,-1),l.lines.set(S,h.clone())}this.isUserScrolling||(l.ydisp=l.ybase),this._onScroll.fire(l.ydisp)}scrollLines(s,c,l){const h=this.buffer;if(s<0){if(h.ydisp===0)return;this.isUserScrolling=!0}else s+h.ydisp>=h.ybase&&(this.isUserScrolling=!1);const g=h.ydisp;h.ydisp=Math.max(Math.min(h.ydisp+s,h.ybase),0),g!==h.ydisp&&(c||this._onScroll.fire(h.ydisp))}};r.BufferService=b=u([f(0,y.IOptionsService)],b)},7994:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,u){this._charsets[o]=u,this.glevel===o&&(this.charset=u)}}},1753:function(C,r,o){var u=this&&this.__decorate||function(h,g,S,k){var E,x=arguments.length,w=x<3?g:k===null?k=Object.getOwnPropertyDescriptor(g,S):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(h,g,S,k);else for(var A=h.length-1;A>=0;A--)(E=h[A])&&(w=(x<3?E(w):x>3?E(g,S,w):E(g,S))||w);return x>3&&w&&Object.defineProperty(g,S,w),w},f=this&&this.__param||function(h,g){return function(S,k){g(S,k,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const a=o(2585),p=o(8460),m=o(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:h=>h.button!==4&&h.action===1&&(h.ctrl=!1,h.alt=!1,h.shift=!1,!0)},VT200:{events:19,restrict:h=>h.action!==32},DRAG:{events:23,restrict:h=>h.action!==32||h.button!==3},ANY:{events:31,restrict:h=>!0}};function b(h,g){let S=(h.ctrl?16:0)|(h.shift?4:0)|(h.alt?8:0);return h.button===4?(S|=64,S|=h.action):(S|=3&h.button,4&h.button&&(S|=64),8&h.button&&(S|=128),h.action===32?S|=32:h.action!==0||g||(S|=3)),S}const s=String.fromCharCode,c={DEFAULT:h=>{const g=[b(h,!1)+32,h.col+32,h.row+32];return g[0]>255||g[1]>255||g[2]>255?"":`\x1B[M${s(g[0])}${s(g[1])}${s(g[2])}`},SGR:h=>{const g=h.action===0&&h.button!==4?"m":"M";return`\x1B[<${b(h,!0)};${h.col};${h.row}${g}`},SGR_PIXELS:h=>{const g=h.action===0&&h.button!==4?"m":"M";return`\x1B[<${b(h,!0)};${h.x};${h.y}${g}`}};let l=r.CoreMouseService=class extends m.Disposable{constructor(h,g){super(),this._bufferService=h,this._coreService=g,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const S of Object.keys(y))this.addProtocol(S,y[S]);for(const S of Object.keys(c))this.addEncoding(S,c[S]);this.reset()}addProtocol(h,g){this._protocols[h]=g}addEncoding(h,g){this._encodings[h]=g}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(h){if(!this._protocols[h])throw new Error(`unknown protocol "${h}"`);this._activeProtocol=h,this._onProtocolChange.fire(this._protocols[h].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(h){if(!this._encodings[h])throw new Error(`unknown encoding "${h}"`);this._activeEncoding=h}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(h){if(h.col<0||h.col>=this._bufferService.cols||h.row<0||h.row>=this._bufferService.rows||h.button===4&&h.action===32||h.button===3&&h.action!==32||h.button!==4&&(h.action===2||h.action===3)||(h.col++,h.row++,h.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,h,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(h))return!1;const g=this._encodings[this._activeEncoding](h);return g&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(g):this._coreService.triggerDataEvent(g,!0)),this._lastEvent=h,!0}explainEvents(h){return{down:!!(1&h),up:!!(2&h),drag:!!(4&h),move:!!(8&h),wheel:!!(16&h)}}_equalEvents(h,g,S){if(S){if(h.x!==g.x||h.y!==g.y)return!1}else if(h.col!==g.col||h.row!==g.row)return!1;return h.button===g.button&&h.action===g.action&&h.ctrl===g.ctrl&&h.alt===g.alt&&h.shift===g.shift}};r.CoreMouseService=l=u([f(0,a.IBufferService),f(1,a.ICoreService)],l)},6975:function(C,r,o){var u=this&&this.__decorate||function(l,h,g,S){var k,E=arguments.length,x=E<3?h:S===null?S=Object.getOwnPropertyDescriptor(h,g):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(l,h,g,S);else for(var w=l.length-1;w>=0;w--)(k=l[w])&&(x=(E<3?k(x):E>3?k(h,g,x):k(h,g))||x);return E>3&&x&&Object.defineProperty(h,g,x),x},f=this&&this.__param||function(l,h){return function(g,S){h(g,S,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const a=o(1439),p=o(8460),m=o(844),y=o(2585),b=Object.freeze({insertMode:!1}),s=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let c=r.CoreService=class extends m.Disposable{constructor(l,h,g){super(),this._bufferService=l,this._logService=h,this._optionsService=g,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(b),this.decPrivateModes=(0,a.clone)(s)}reset(){this.modes=(0,a.clone)(b),this.decPrivateModes=(0,a.clone)(s)}triggerDataEvent(l,h=!1){if(this._optionsService.rawOptions.disableStdin)return;const g=this._bufferService.buffer;h&&this._optionsService.rawOptions.scrollOnUserInput&&g.ybase!==g.ydisp&&this._onRequestScrollToBottom.fire(),h&&this._onUserInput.fire(),this._logService.debug(`sending data "${l}"`,(()=>l.split("").map((S=>S.charCodeAt(0))))),this._onData.fire(l)}triggerBinaryEvent(l){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${l}"`,(()=>l.split("").map((h=>h.charCodeAt(0))))),this._onBinary.fire(l))}};r.CoreService=c=u([f(0,y.IBufferService),f(1,y.ILogService),f(2,y.IOptionsService)],c)},9074:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const u=o(8055),f=o(8460),a=o(844),p=o(6106);let m=0,y=0;class b extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList((l=>l?.marker.line)),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(l){if(l.marker.isDisposed)return;const h=new s(l);if(h){const g=h.marker.onDispose((()=>h.dispose()));h.onDispose((()=>{h&&(this._decorations.delete(h)&&this._onDecorationRemoved.fire(h),g.dispose())})),this._decorations.insert(h),this._onDecorationRegistered.fire(h)}return h}reset(){for(const l of this._decorations.values())l.dispose();this._decorations.clear()}*getDecorationsAtCell(l,h,g){var S,k,E;let x=0,w=0;for(const A of this._decorations.getKeyIterator(h))x=(S=A.options.x)!==null&&S!==void 0?S:0,w=x+((k=A.options.width)!==null&&k!==void 0?k:1),l>=x&&l<w&&(!g||((E=A.options.layer)!==null&&E!==void 0?E:"bottom")===g)&&(yield A)}forEachDecorationAtCell(l,h,g,S){this._decorations.forEachByKey(h,(k=>{var E,x,w;m=(E=k.options.x)!==null&&E!==void 0?E:0,y=m+((x=k.options.width)!==null&&x!==void 0?x:1),l>=m&&l<y&&(!g||((w=k.options.layer)!==null&&w!==void 0?w:"bottom")===g)&&S(k)}))}}r.DecorationService=b;class s extends a.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=u.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=u.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(l){super(),this.options=l,this.onRenderEmitter=this.register(new f.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=l.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const u=o(2585),f=o(8343);class a{constructor(...m){this._entries=new Map;for(const[y,b]of m)this.set(y,b)}set(m,y){const b=this._entries.get(m);return this._entries.set(m,y),b}forEach(m){for(const[y,b]of this._entries.entries())m(y,b)}has(m){return this._entries.has(m)}get(m){return this._entries.get(m)}}r.ServiceCollection=a,r.InstantiationService=class{constructor(){this._services=new a,this._services.set(u.IInstantiationService,this)}setService(p,m){this._services.set(p,m)}getService(p){return this._services.get(p)}createInstance(p,...m){const y=(0,f.getServiceDependencies)(p).sort(((c,l)=>c.index-l.index)),b=[];for(const c of y){const l=this._services.get(c.id);if(!l)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${c.id}.`);b.push(l)}const s=y.length>0?y[0].index:m.length;if(m.length!==s)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${s+1} conflicts with ${m.length} static arguments`);return new p(...m,...b)}}},7866:function(C,r,o){var u=this&&this.__decorate||function(s,c,l,h){var g,S=arguments.length,k=S<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,l):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(s,c,l,h);else for(var E=s.length-1;E>=0;E--)(g=s[E])&&(k=(S<3?g(k):S>3?g(c,l,k):g(c,l))||k);return S>3&&k&&Object.defineProperty(c,l,k),k},f=this&&this.__param||function(s,c){return function(l,h){c(l,h,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const a=o(844),p=o(2585),m={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let y,b=r.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(s){super(),this._optionsService=s,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),y=this}_updateLogLevel(){this._logLevel=m[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(s){for(let c=0;c<s.length;c++)typeof s[c]=="function"&&(s[c]=s[c]())}_log(s,c,l){this._evalLazyOptionalParams(l),s.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+c,...l)}trace(s,...c){var l,h;this._logLevel<=p.LogLevelEnum.TRACE&&this._log((h=(l=this._optionsService.options.logger)===null||l===void 0?void 0:l.trace.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.log,s,c)}debug(s,...c){var l,h;this._logLevel<=p.LogLevelEnum.DEBUG&&this._log((h=(l=this._optionsService.options.logger)===null||l===void 0?void 0:l.debug.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.log,s,c)}info(s,...c){var l,h;this._logLevel<=p.LogLevelEnum.INFO&&this._log((h=(l=this._optionsService.options.logger)===null||l===void 0?void 0:l.info.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.info,s,c)}warn(s,...c){var l,h;this._logLevel<=p.LogLevelEnum.WARN&&this._log((h=(l=this._optionsService.options.logger)===null||l===void 0?void 0:l.warn.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.warn,s,c)}error(s,...c){var l,h;this._logLevel<=p.LogLevelEnum.ERROR&&this._log((h=(l=this._optionsService.options.logger)===null||l===void 0?void 0:l.error.bind(this._optionsService.options.logger))!==null&&h!==void 0?h:console.error,s,c)}};r.LogService=b=u([f(0,p.IOptionsService)],b),r.setTraceLogger=function(s){y=s},r.traceCall=function(s,c,l){if(typeof l.value!="function")throw new Error("not supported");const h=l.value;l.value=function(...g){if(y.logLevel!==p.LogLevelEnum.TRACE)return h.apply(this,g);y.trace(`GlyphRenderer#${h.name}(${g.map((k=>JSON.stringify(k))).join(", ")})`);const S=h.apply(this,g);return y.trace(`GlyphRenderer#${h.name} return`,S),S}}},7302:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const u=o(8460),f=o(844),a=o(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:a.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const p=["normal","bold","100","200","300","400","500","600","700","800","900"];class m extends f.Disposable{constructor(b){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const s=Object.assign({},r.DEFAULT_OPTIONS);for(const c in b)if(c in s)try{const l=b[c];s[c]=this._sanitizeAndValidateOption(c,l)}catch(l){console.error(l)}this.rawOptions=s,this.options=Object.assign({},s),this._setupOptions()}onSpecificOptionChange(b,s){return this.onOptionChange((c=>{c===b&&s(this.rawOptions[b])}))}onMultipleOptionChange(b,s){return this.onOptionChange((c=>{b.indexOf(c)!==-1&&s()}))}_setupOptions(){const b=c=>{if(!(c in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${c}"`);return this.rawOptions[c]},s=(c,l)=>{if(!(c in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${c}"`);l=this._sanitizeAndValidateOption(c,l),this.rawOptions[c]!==l&&(this.rawOptions[c]=l,this._onOptionChange.fire(c))};for(const c in this.rawOptions){const l={get:b.bind(this,c),set:s.bind(this,c)};Object.defineProperty(this.options,c,l)}}_sanitizeAndValidateOption(b,s){switch(b){case"cursorStyle":if(s||(s=r.DEFAULT_OPTIONS[b]),!(function(c){return c==="block"||c==="underline"||c==="bar"})(s))throw new Error(`"${s}" is not a valid value for ${b}`);break;case"wordSeparator":s||(s=r.DEFAULT_OPTIONS[b]);break;case"fontWeight":case"fontWeightBold":if(typeof s=="number"&&1<=s&&s<=1e3)break;s=p.includes(s)?s:r.DEFAULT_OPTIONS[b];break;case"cursorWidth":s=Math.floor(s);case"lineHeight":case"tabStopWidth":if(s<1)throw new Error(`${b} cannot be less than 1, value: ${s}`);break;case"minimumContrastRatio":s=Math.max(1,Math.min(21,Math.round(10*s)/10));break;case"scrollback":if((s=Math.min(s,4294967295))<0)throw new Error(`${b} cannot be less than 0, value: ${s}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(s<=0)throw new Error(`${b} cannot be less than or equal to 0, value: ${s}`);break;case"rows":case"cols":if(!s&&s!==0)throw new Error(`${b} must be numeric, value: ${s}`);break;case"windowsPty":s=s??{}}return s}}r.OptionsService=m},2660:function(C,r,o){var u=this&&this.__decorate||function(m,y,b,s){var c,l=arguments.length,h=l<3?y:s===null?s=Object.getOwnPropertyDescriptor(y,b):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(m,y,b,s);else for(var g=m.length-1;g>=0;g--)(c=m[g])&&(h=(l<3?c(h):l>3?c(y,b,h):c(y,b))||h);return l>3&&h&&Object.defineProperty(y,b,h),h},f=this&&this.__param||function(m,y){return function(b,s){y(b,s,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const a=o(2585);let p=r.OscLinkService=class{constructor(m){this._bufferService=m,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(m){const y=this._bufferService.buffer;if(m.id===void 0){const g=y.addMarker(y.ybase+y.y),S={data:m,id:this._nextId++,lines:[g]};return g.onDispose((()=>this._removeMarkerFromLink(S,g))),this._dataByLinkId.set(S.id,S),S.id}const b=m,s=this._getEntryIdKey(b),c=this._entriesWithId.get(s);if(c)return this.addLineToLink(c.id,y.ybase+y.y),c.id;const l=y.addMarker(y.ybase+y.y),h={id:this._nextId++,key:this._getEntryIdKey(b),data:b,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(h,l))),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(m,y){const b=this._dataByLinkId.get(m);if(b&&b.lines.every((s=>s.line!==y))){const s=this._bufferService.buffer.addMarker(y);b.lines.push(s),s.onDispose((()=>this._removeMarkerFromLink(b,s)))}}getLinkData(m){var y;return(y=this._dataByLinkId.get(m))===null||y===void 0?void 0:y.data}_getEntryIdKey(m){return`${m.id};;${m.uri}`}_removeMarkerFromLink(m,y){const b=m.lines.indexOf(y);b!==-1&&(m.lines.splice(b,1),m.lines.length===0&&(m.data.id!==void 0&&this._entriesWithId.delete(m.key),this._dataByLinkId.delete(m.id)))}};r.OscLinkService=p=u([f(0,a.IBufferService)],p)},8343:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const o="di$target",u="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(f){return f[u]||[]},r.createDecorator=function(f){if(r.serviceRegistry.has(f))return r.serviceRegistry.get(f);const a=function(p,m,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(b,s,c){s[o]===s?s[u].push({id:b,index:c}):(s[u]=[{id:b,index:c}],s[o]=s)})(a,p,y)};return a.toString=()=>f,r.serviceRegistry.set(f,a),a}},2585:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const u=o(8343);var f;r.IBufferService=(0,u.createDecorator)("BufferService"),r.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),r.ICoreService=(0,u.createDecorator)("CoreService"),r.ICharsetService=(0,u.createDecorator)("CharsetService"),r.IInstantiationService=(0,u.createDecorator)("InstantiationService"),(function(a){a[a.TRACE=0]="TRACE",a[a.DEBUG=1]="DEBUG",a[a.INFO=2]="INFO",a[a.WARN=3]="WARN",a[a.ERROR=4]="ERROR",a[a.OFF=5]="OFF"})(f||(r.LogLevelEnum=f={})),r.ILogService=(0,u.createDecorator)("LogService"),r.IOptionsService=(0,u.createDecorator)("OptionsService"),r.IOscLinkService=(0,u.createDecorator)("OscLinkService"),r.IUnicodeService=(0,u.createDecorator)("UnicodeService"),r.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(C,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const u=o(8460),f=o(225);r.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const a=new f.UnicodeV6;this.register(a),this._active=a.version,this._activeProvider=a}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(a){if(!this._providers[a])throw new Error(`unknown Unicode version "${a}"`);this._active=a,this._activeProvider=this._providers[a],this._onChange.fire(a)}register(a){this._providers[a.version]=a}wcwidth(a){return this._activeProvider.wcwidth(a)}getStringCellWidth(a){let p=0;const m=a.length;for(let y=0;y<m;++y){let b=a.charCodeAt(y);if(55296<=b&&b<=56319){if(++y>=m)return p+this.wcwidth(b);const s=a.charCodeAt(y);56320<=s&&s<=57343?b=1024*(b-55296)+s-56320+65536:p+=this.wcwidth(s)}p+=this.wcwidth(b)}return p}}}},d={};function v(C){var r=d[C];if(r!==void 0)return r.exports;var o=d[C]={exports:{}};return n[C].call(o.exports,o,o.exports,v),o.exports}var _={};return(()=>{var C=_;Object.defineProperty(C,"__esModule",{value:!0}),C.Terminal=void 0;const r=v(9042),o=v(3236),u=v(844),f=v(5741),a=v(8285),p=v(7975),m=v(7090),y=["cols","rows"];class b extends u.Disposable{constructor(c){super(),this._core=this.register(new o.Terminal(c)),this._addonManager=this.register(new f.AddonManager),this._publicOptions=Object.assign({},this._core.options);const l=g=>this._core.options[g],h=(g,S)=>{this._checkReadonlyOptions(g),this._core.options[g]=S};for(const g in this._core.options){const S={get:l.bind(this,g),set:h.bind(this,g)};Object.defineProperty(this._publicOptions,g,S)}}_checkReadonlyOptions(c){if(y.includes(c))throw new Error(`Option "${c}" 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 p.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new m.UnicodeApi(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 a.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const c=this._core.coreService.decPrivateModes;let l="none";switch(this._core.coreMouseService.activeProtocol){case"X10":l="x10";break;case"VT200":l="vt200";break;case"DRAG":l="drag";break;case"ANY":l="any"}return{applicationCursorKeysMode:c.applicationCursorKeys,applicationKeypadMode:c.applicationKeypad,bracketedPasteMode:c.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:l,originMode:c.origin,reverseWraparoundMode:c.reverseWraparound,sendFocusMode:c.sendFocus,wraparoundMode:c.wraparound}}get options(){return this._publicOptions}set options(c){for(const l in c)this._publicOptions[l]=c[l]}blur(){this._core.blur()}focus(){this._core.focus()}resize(c,l){this._verifyIntegers(c,l),this._core.resize(c,l)}open(c){this._core.open(c)}attachCustomKeyEventHandler(c){this._core.attachCustomKeyEventHandler(c)}registerLinkProvider(c){return this._core.registerLinkProvider(c)}registerCharacterJoiner(c){return this._checkProposedApi(),this._core.registerCharacterJoiner(c)}deregisterCharacterJoiner(c){this._checkProposedApi(),this._core.deregisterCharacterJoiner(c)}registerMarker(c=0){return this._verifyIntegers(c),this._core.registerMarker(c)}registerDecoration(c){var l,h,g;return this._checkProposedApi(),this._verifyPositiveIntegers((l=c.x)!==null&&l!==void 0?l:0,(h=c.width)!==null&&h!==void 0?h:0,(g=c.height)!==null&&g!==void 0?g:0),this._core.registerDecoration(c)}hasSelection(){return this._core.hasSelection()}select(c,l,h){this._verifyIntegers(c,l,h),this._core.select(c,l,h)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(c,l){this._verifyIntegers(c,l),this._core.selectLines(c,l)}dispose(){super.dispose()}scrollLines(c){this._verifyIntegers(c),this._core.scrollLines(c)}scrollPages(c){this._verifyIntegers(c),this._core.scrollPages(c)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(c){this._verifyIntegers(c),this._core.scrollToLine(c)}clear(){this._core.clear()}write(c,l){this._core.write(c,l)}writeln(c,l){this._core.write(c),this._core.write(`\r
|
|
16
|
+
`,l)}paste(c){this._core.paste(c)}refresh(c,l){this._verifyIntegers(c,l),this._core.refresh(c,l)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(c){this._addonManager.loadAddon(this,c)}static get strings(){return r}_verifyIntegers(...c){for(const l of c)if(l===1/0||isNaN(l)||l%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...c){for(const l of c)if(l&&(l===1/0||isNaN(l)||l%1!=0||l<0))throw new Error("This API only accepts positive integers")}}C.Terminal=b})(),_})()))})(hs)),hs.exports}var Il=Ol();var Fl=2,Hl=1,zl=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let i=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(i._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let i=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),d=parseInt(n.getPropertyValue("height")),v=Math.max(0,parseInt(n.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),C={top:parseInt(_.getPropertyValue("padding-top")),bottom:parseInt(_.getPropertyValue("padding-bottom")),right:parseInt(_.getPropertyValue("padding-right")),left:parseInt(_.getPropertyValue("padding-left"))},r=C.top+C.bottom,o=C.right+C.left,u=d-r,f=v-o-i;return{cols:Math.max(Fl,Math.floor(f/e.css.cell.width)),rows:Math.max(Hl,Math.floor(u/e.css.cell.height))}}};function Wl(e={}){const{cwd:i,cols:n,rows:d,onOutput:v,onExit:_}=e,[C,r]=N.useState(null),[o,u]=N.useState(()=>ge.isConnected()),[f,a]=N.useState(!1),[p,m]=N.useState(!1),[y,b]=N.useState(!1),s=N.useRef({onOutput:v,onExit:_});s.current={onOutput:v,onExit:_};const c=N.useRef(null);c.current=C,N.useEffect(()=>{if(!C)return;const k=ge.getSocket(),E=()=>{u(!0),a(!1),r(null),b(!0)},x=()=>{u(!1),a(!1)},w=M=>{M.terminalId===C&&s.current.onOutput?.(M.data)},A=M=>{M.terminalId===C&&(a(!1),s.current.onExit?.(M.exitCode),r(null))},L=M=>{M.terminalId===C&&a(!0)},R=M=>{M.terminalId===C&&a(!1)};return k.on("connect",E),k.on("disconnect",x),k.on(Ae.TERMINAL_STDOUT,w),k.on(Ae.TERMINAL_EXIT,A),k.on(Ae.TERMINAL_SUBSCRIBED,L),k.on(Ae.TERMINAL_UNSUBSCRIBED,R),u(k.connected),k.connected&&k.emit(mt.SUBSCRIBE,{topic:"terminal",id:C},M=>{M.success&&a(!0)}),()=>{k.off("connect",E),k.off("disconnect",x),k.off(Ae.TERMINAL_STDOUT,w),k.off(Ae.TERMINAL_EXIT,A),k.off(Ae.TERMINAL_SUBSCRIBED,L),k.off(Ae.TERMINAL_UNSUBSCRIBED,R),k.emit(mt.UNSUBSCRIBE,{topic:"terminal",id:C})}},[C]);const l=N.useCallback(async()=>{const k=ge.getSocket();if(!k.connected)return null;m(!0);try{const E=await ae.post("/terminals",{socketId:k.id,cwd:i,cols:n,rows:d});return r(E.terminalId),b(!1),E.terminalId}catch(E){return console.error("[useStandaloneTerminal] Failed to create terminal:",E),null}finally{m(!1)}},[i,n,d]),h=N.useCallback(async()=>{const k=c.current;if(k){try{await ae.delete(`/terminals/${k}`)}catch(E){console.error("[useStandaloneTerminal] Failed to destroy terminal:",E)}r(null),a(!1)}},[]),g=N.useCallback(k=>{const E=c.current;if(!E)return;ge.getSocket().emit(mt.TERMINAL_INPUT,{terminalId:E,data:k})},[]),S=N.useCallback((k,E)=>{const x=c.current;if(!x)return;ge.getSocket().emit(mt.TERMINAL_RESIZE,{terminalId:x,cols:k,rows:E})},[]);return N.useEffect(()=>()=>{const k=c.current;k&&ae.delete(`/terminals/${k}`).catch(()=>{})},[]),{terminalId:C,isConnected:o,isAttached:f,isCreating:p,needsRecreate:y,create:l,destroy:h,sendInput:g,resize:S}}function $l({terminalRef:e,xtermRef:i,fitAddonRef:n,isVisible:d=!0,onResize:v}){const _=N.useRef(null),C=N.useRef(null),r=N.useRef(0),o=N.useCallback(()=>{_.current!=null&&(window.clearTimeout(_.current),_.current=null),C.current!=null&&(window.cancelAnimationFrame(C.current),C.current=null)},[]),u=N.useCallback(()=>{const p=n.current,m=i.current,y=e.current;if(!p||!m||!y||y.clientWidth<=0||y.clientHeight<=0)return!1;try{return p.fit(),m.cols>0&&m.rows>0&&v(m.cols,m.rows),!0}catch{return!1}},[n,v,e,i]),f=N.useCallback((p=6)=>{o();const m=r.current+1;r.current=m;let y=0;const b=()=>{r.current===m&&(C.current=window.requestAnimationFrame(()=>{if(C.current=null,r.current!==m)return;const s=u(),c=y<2;y<p&&(!s||c)&&(y+=1,_.current=window.setTimeout(b,50))}))};b()},[o,u]),a=N.useCallback(()=>{r.current+=1,o()},[o]);return N.useEffect(()=>a,[a]),N.useEffect(()=>{d&&f(8)},[d,f]),N.useEffect(()=>{const p=e.current;if(!p)return;if(typeof ResizeObserver>"u"){f(8);return}const m=new ResizeObserver(()=>{f(4)});return m.observe(p),p.parentElement&&m.observe(p.parentElement),f(8),()=>{m.disconnect()}},[f,e]),{fitNow:u,scheduleFit:f}}const Ul=pe.memo(function({cwd:i,isVisible:n=!0,onExit:d,onReady:v}){const _=N.useRef(null),C=N.useRef(null),r=N.useRef(null),o=N.useRef(!1),{terminalId:u,isAttached:f,needsRecreate:a,create:p,sendInput:m,resize:y}=Wl({cwd:i,onOutput:N.useCallback(c=>{C.current?.write(c)},[]),onExit:N.useCallback(c=>{C.current?.writeln(`\r
|
|
17
|
+
\x1B[90m[Process exited with code ${c}]\x1B[0m`),d?.(c)},[d])}),{scheduleFit:b}=$l({terminalRef:_,xtermRef:C,fitAddonRef:r,isVisible:n,onResize:y}),s=N.useCallback(c=>{C.current?.paste(c)},[]);return N.useEffect(()=>{n||C.current?.blur()},[n]),N.useEffect(()=>{if(!a)return;const c=C.current;c&&c.writeln(`\r
|
|
18
|
+
\x1B[33m[Terminal disconnected — reconnecting...]\x1B[0m`),p()},[a,p]),N.useLayoutEffect(()=>{if(!_.current)return;const c=new Il.Terminal({cursorBlink:!0,fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo, Monaco, 'Courier New', monospace",lineHeight:1.4,theme:xo(),scrollback:5e3,convertEol:!0}),l=new zl;return c.loadAddon(l),c.open(_.current),C.current=c,r.current=l,b(8),()=>{c.dispose(),C.current=null,r.current=null}},[b]),N.useEffect(()=>{o.current||(o.current=!0,p())},[p]),N.useEffect(()=>{const c=C.current;if(!c||!f)return;const l=c.onData(h=>{m(h)});return()=>l.dispose()},[m,f]),N.useEffect(()=>{f&&(b(4),v?.({sendInput:m,paste:s}))},[f,v,s,b,m]),t.jsxs("div",{className:"relative flex h-full w-full min-h-0 min-w-0 flex-col overflow-hidden bg-terminal",children:[!u&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-terminal-muted-foreground text-xs z-10 bg-terminal",children:"Starting terminal..."}),t.jsx("div",{ref:_,className:"terminal-xterm-host flex-1 min-h-0 min-w-0 w-full overflow-hidden"})]})}),ql=pe.memo(function({commands:i,onSelect:n}){const{t:d}=re();return i.length===0?null:t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"w-px h-4 bg-terminal-border mx-1 shrink-0"}),t.jsxs(fi,{children:[t.jsxs(mi,{className:"group mx-1 flex shrink-0 items-center gap-1.5 rounded px-2.5 py-1 text-xs font-medium text-terminal-muted-foreground transition-colors hover:bg-terminal-accent hover:text-terminal-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-terminal-muted-foreground data-[state=open]:bg-terminal-accent data-[state=open]:text-terminal-foreground",children:[t.jsx(To,{size:12}),t.jsx("span",{children:d("快捷命令")}),t.jsx(ze,{size:10,className:"transition-transform group-data-[state=open]:rotate-180"})]}),t.jsx(pi,{align:"end",className:"w-72",children:t.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:i.map((v,_)=>t.jsxs(ko,{icon:t.jsx(So,{className:"mt-0.5"}),onSelect:()=>n(v.command),className:"items-start",children:[t.jsx("span",{className:"block truncate font-medium text-foreground",children:v.name}),t.jsx("span",{className:"block truncate font-mono text-xs text-muted-foreground",children:v.command})]},_))})})]})]})}),Di="\x1B",Kl="\x07",Xl="";function Yl(e){const i=e.charCodeAt(0);return i>=64&&i<=126}function _r(e,i){let n=i;for(;n<e.length;){if(e[n]===Kl||e[n]===Xl)return n+1;if(e[n]===Di&&e[n+1]==="\\")return n+2;n+=1}return n}function br(e,i){let n=i;for(;n<e.length&&!Yl(e[n]);)n+=1;return n<e.length?n+1:n}function Vl(e){let i="";for(let n=0;n<e.length;){if(e[n]===""){n=br(e,n+1);continue}if(e[n]===""){n=_r(e,n+1);continue}if(e[n]!==Di){i+=e[n],n+=1;continue}const d=e[n+1];if(d==="["){n=br(e,n+2);continue}if(d==="]"||d==="P"||d==="X"||d==="^"||d==="_"){n=_r(e,n+2);continue}for(n+=1;n<e.length;){const v=e.charCodeAt(n);if(v<32||v>47)break;n+=1}n<e.length&&(n+=1)}return i}const Gl=200,Ql=1e3,Zl=512*1024;function Jl(e){let i=e.reduce((d,v)=>d+v.data.length,0),n=0;for(;e.length-n>Ql||i>Zl&&e.length-n>1;)i-=e[n].data.length,n+=1;return{entries:n>0?e.slice(n):e,trimmed:n>0}}function ec(e,i){const n=!!e&&e.runtimeInstanceId!==i.runtimeInstanceId,d=n||i.reset,v=d?[]:e?.entries??[],_=new Set(v.map(o=>o.seq)),C=[...v,...i.entries.filter(o=>!_.has(o.seq))].sort((o,u)=>o.seq-u.seq),r=Jl(C);return{...i,entries:r.entries,reset:i.reset||n||!d&&(e?.reset??!1),truncated:i.truncated||!d&&(e?.truncated??!1)||r.trimmed}}function Vs(e,i=!0){return Te({queryKey:oe.workspaceServices.list(e),queryFn:async()=>(await ae.get(`/workspaces/${encodeURIComponent(e)}/services`)).services,enabled:i&&!!e,refetchInterval:i&&e?3e3:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:"always",refetchOnReconnect:"always"})}function tc(e,i,n,d=!0){const v=Le(),_=oe.workspaceServices.logs(e,i);return Te({queryKey:_,queryFn:async()=>{const C=v.getQueryData(_),r=C?Math.max(0,C.nextSeq-1):0,o=C===void 0?n:C.runtimeInstanceId,u=new URLSearchParams({limit:String(Gl)});o!==null&&u.set("runtimeInstanceId",o),u.set("afterSeq",String(r));const f=await ae.get(`/workspaces/${encodeURIComponent(e)}/services/${encodeURIComponent(i)}/logs?${u}`);return ec(C,f)},enabled:d&&!!e&&!!i,refetchInterval:C=>C.state.data?.hasMore?250:1e3,refetchIntervalInBackground:!1,refetchOnWindowFocus:"always",refetchOnReconnect:"always"})}const sc=[];function us(e){return JSON.stringify([e.command,...e.args])}function xr(e,i,n){if(!e)return n;const d=new Date(e);return Number.isNaN(d.getTime())?n:new Intl.DateTimeFormat(i,{dateStyle:"medium",timeStyle:"medium"}).format(d)}function rc(e){switch(e){case"RUNNING":return{label:"Running",dotClassName:"bg-terminal-green"};case"STARTING":return{label:"Starting",dotClassName:"bg-terminal-yellow"};case"STOPPING":return{label:"Stopping",dotClassName:"bg-terminal-yellow"};case"FAILED":return{label:"Failed",dotClassName:"bg-terminal-red"};case"EXITED":return{label:"Exited",dotClassName:"bg-terminal-muted-foreground"};default:return{label:"Stopped",dotClassName:"bg-terminal-bright-black"}}}function Sr({state:e}){const{t:i}=re(),n=rc(e);return t.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-xs text-terminal-foreground",children:[t.jsx("span",{className:Q("h-1.5 w-1.5 rounded-full",n.dotClassName),"aria-hidden":"true"}),i(n.label)]})}function ic({message:e,onRetry:i}){const{t:n}=re();return t.jsxs("div",{className:"flex min-h-24 items-center justify-center gap-2 px-4 text-xs text-terminal-foreground",role:"alert",children:[t.jsx(Tt,{size:14,className:"shrink-0 text-terminal-red","aria-hidden":"true"}),t.jsx("span",{children:e}),t.jsx("button",{type:"button",onClick:i,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded text-terminal-muted-foreground transition-colors hover:bg-terminal-accent hover:text-terminal-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-terminal-muted-foreground",title:n("Retry"),"aria-label":n("Retry"),children:t.jsx(vt,{size:13})})]})}function nc({workspaceId:e,enabled:i=!0}){const{locale:n,t:d}=re(),v=Vs(e,i),_=v.data??sc,[C,r]=N.useState(null),o=_.find(m=>m.name===C)??_[0]??null,u=tc(e,o?.name??"",o?.runtimeInstanceId??null,i&&!!o),f=N.useMemo(()=>Vl(u.data?.entries.map(m=>m.data).join("")??""),[u.data?.entries]),a=N.useRef(null),p=N.useRef(!0);return N.useEffect(()=>{p.current=!0},[o?.id,o?.runtimeInstanceId]),N.useEffect(()=>{const m=a.current;m&&p.current&&(m.scrollTop=m.scrollHeight)},[f]),t.jsxs("div",{className:"flex h-full min-h-0 w-full min-w-0 flex-col bg-terminal text-terminal-foreground md:flex-row",children:[t.jsxs("aside",{className:"flex max-h-[44%] min-h-32 shrink-0 flex-col border-b border-terminal-border bg-terminal-chrome md:max-h-none md:min-h-0 md:w-72 md:border-b-0 md:border-r",children:[t.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between border-b border-terminal-border px-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx(js,{size:13,className:"shrink-0 text-terminal-muted-foreground","aria-hidden":"true"}),t.jsx("h2",{className:"truncate text-xs font-medium",children:d("Background services")})]}),!v.isLoading&&!v.isError&&t.jsx("span",{className:"text-[11px] tabular-nums text-terminal-muted-foreground",children:_.length})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto scrollbar-app-thin",children:v.isLoading?t.jsxs("div",{className:"flex min-h-24 items-center justify-center gap-2 text-xs text-terminal-muted-foreground",children:[t.jsx(_e,{size:"sm"}),d("Loading background services...")]}):v.isError?t.jsx(ic,{message:d("Failed to load background services."),onRetry:()=>{v.refetch()}}):_.length===0?t.jsxs("div",{className:"flex min-h-24 flex-col items-center justify-center gap-2 px-4 text-center text-xs text-terminal-muted-foreground",children:[t.jsx(js,{size:22,"aria-hidden":"true"}),t.jsx("span",{children:d("No background services")})]}):_.map(m=>{const y=m.name===o?.name;return t.jsxs("button",{type:"button",onClick:()=>r(m.name),"aria-pressed":y,className:Q("block w-full border-b border-terminal-border px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-terminal-muted-foreground",y?"bg-terminal":"hover:bg-terminal-accent"),children:[t.jsxs("span",{className:"flex min-w-0 items-center justify-between gap-2",children:[t.jsx("span",{className:"truncate text-xs font-medium text-terminal-foreground",children:m.name}),t.jsx(Sr,{state:m.runtimeState})]}),t.jsx("span",{className:"mt-1 block truncate font-mono text-[11px] text-terminal-muted-foreground",title:us(m),children:us(m)}),t.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-[11px] text-terminal-muted-foreground",children:[t.jsx(Ws,{size:10,className:"shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"truncate",children:m.relativeCwd||"."})]}),t.jsxs("span",{className:`mt-1 flex min-w-0 items-center gap-1 ${m.startedAt?"text-[11px]":"text-xs"} text-terminal-muted-foreground`,children:[t.jsx(qe,{size:10,className:"shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"truncate",children:xr(m.startedAt,n,d("Not started"))})]})]},m.id)})})]}),t.jsx("section",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-terminal","aria-label":d("Background service logs"),children:o?t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"shrink-0 border-b border-terminal-border bg-terminal-chrome",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 px-3 pt-2",children:[t.jsx("span",{className:"min-w-0 truncate text-xs font-semibold text-terminal-foreground",children:o.name}),t.jsx(Sr,{state:o.runtimeState})]}),t.jsxs("div",{className:"max-h-32 overflow-y-auto overscroll-y-contain px-3 pb-2 scrollbar-app-thin focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-terminal-muted-foreground",tabIndex:0,"aria-label":`${o.name} ${d("Details")}`,children:[t.jsxs("dl",{className:"mt-1.5 grid min-w-0 gap-x-4 gap-y-1 text-xs text-terminal-muted-foreground sm:grid-cols-2",children:[t.jsxs("div",{className:"flex min-w-0 gap-1.5",children:[t.jsxs("dt",{className:"shrink-0",children:[d("Command"),":"]}),t.jsx("dd",{className:"min-w-0 break-all font-mono text-terminal-foreground",children:us(o)})]}),t.jsxs("div",{className:"flex min-w-0 gap-1.5",children:[t.jsxs("dt",{className:"shrink-0",children:[d("Working directory"),":"]}),t.jsx("dd",{className:"min-w-0 break-all font-mono text-terminal-foreground",children:o.relativeCwd||"."})]}),t.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 sm:col-span-2",children:[t.jsx(qe,{size:10,className:"shrink-0","aria-hidden":"true"}),t.jsxs("dt",{className:"shrink-0",children:[d("Started"),":"]}),t.jsx("dd",{className:"truncate text-terminal-foreground",children:xr(o.startedAt,n,d("Not started"))})]})]}),o.lastError&&t.jsxs("p",{className:"mt-1.5 flex min-w-0 items-start gap-1.5 break-words text-xs text-terminal-foreground",role:"alert",children:[t.jsx(Tt,{size:12,className:"mt-0.5 shrink-0 text-terminal-red","aria-hidden":"true"}),t.jsx("span",{className:"min-w-0",children:o.lastError})]})]})]}),(u.data?.truncated||u.data?.reset)&&t.jsx("div",{className:"shrink-0 border-b border-terminal-yellow/20 bg-terminal-yellow/10 px-3 py-1.5 text-xs text-terminal-foreground",children:d("Earlier log output is unavailable.")}),u.isError&&t.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-terminal-red/20 bg-terminal-red/10 px-3 py-1.5 text-xs text-terminal-foreground",role:"alert",children:[t.jsx("span",{children:d("Failed to refresh service logs.")}),t.jsx("button",{type:"button",onClick:()=>{u.refetch()},className:"flex h-6 w-6 items-center justify-center rounded text-terminal-foreground transition-colors hover:bg-terminal-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-terminal-muted-foreground",title:d("Retry"),"aria-label":d("Retry"),children:t.jsx(vt,{size:11})})]}),t.jsx("div",{ref:a,onScroll:m=>{const y=m.currentTarget;p.current=y.scrollHeight-y.scrollTop-y.clientHeight<32},className:"min-h-0 flex-1 overflow-auto p-3 scrollbar-app-thin",role:"log","aria-live":"off",tabIndex:0,children:u.isLoading&&!u.data?t.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-terminal-muted-foreground",children:[t.jsx(_e,{size:"sm"}),d("Loading service logs...")]}):f?t.jsx("pre",{className:"m-0 whitespace-pre-wrap break-words font-mono text-xs leading-5 text-terminal-foreground",children:f}):t.jsx("div",{className:"flex h-full items-center justify-center text-xs text-terminal-muted-foreground",children:d("No logs yet")})})]}):t.jsx("div",{className:"flex h-full items-center justify-center px-4 text-center text-xs text-terminal-muted-foreground",children:v.isLoading?d("Loading background services..."):d("Select a background service")})})]})}let fs=0;function yr(){return fs+=1,{id:`shell-${fs}`,order:fs}}const oc=pe.memo(function({cwd:i,isVisible:n=!0,workspaceId:d,quickCommands:v=[]}){const{t:_}=re(),[C,r]=N.useState(()=>[yr()]),[o,u]=N.useState(()=>C[0].id),[f,a]=N.useState(()=>new Set),[p,m]=N.useState(!1),[y,b]=N.useState(!1),[s,c]=N.useState(""),[l,h]=N.useState(null),[g,S]=N.useState("terminals"),k=N.useRef(new Map),E=d?g:"terminals",x=N.useCallback(D=>{k.current.delete(D),a(B=>{if(!B.has(D))return B;const q=new Set(B);return q.delete(D),q})},[]),w=N.useCallback(()=>{const D=yr();r(B=>[...B,D]),u(D.id)},[]),A=N.useCallback((D,B)=>{B.stopPropagation(),x(D),r(q=>{const K=q.filter(U=>U.id!==D);return D===o&&K.length>0&&u(K[K.length-1].id),K})},[o,x]),L=N.useCallback(D=>{x(D),r(B=>{const q=B.filter(K=>K.id!==D);return D===o&&q.length>0&&u(q[q.length-1].id),q})},[o,x]),R=N.useCallback((D,B)=>{k.current.set(D,B),a(q=>{if(q.has(D))return q;const K=new Set(q);return K.add(D),K})},[]),M=N.useCallback(D=>{const B=k.current.get(o);B&&B.sendInput(D+"\r")},[o]),I=N.useCallback((D,B="")=>{h(D),c(B),b(!0)},[]),P=N.useCallback((D,B)=>{const q=k.current.get(D);return q?(q.paste(B),ke.success(_("Pasted into terminal")),!0):(ke.error(_("Terminal is not ready")),!1)},[_]),H=N.useCallback(async()=>{if(!k.current.has(o)){ke.error(_("Terminal is not ready"));return}const D=navigator.clipboard;if(!D?.readText){I(o);return}m(!0);try{const B=await D.readText();if(!B||B.includes(`
|
|
19
|
+
`)||B.includes("\r")){I(o,B);return}P(o,B)}catch{I(o)}finally{m(!1)}},[o,I,P,_]),$=N.useCallback(()=>{!s||!l||!P(l,s)||(b(!1),c(""),h(null))},[s,P,l]),T=N.useCallback(()=>{b(!1),c(""),h(null)},[]),O=f.has(o);return t.jsxs("div",{className:"flex h-full w-full min-h-0 min-w-0 flex-col overflow-hidden bg-terminal",children:[d&&t.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-b border-terminal-border bg-terminal-chrome px-2 select-none",children:[t.jsxs("button",{type:"button",onClick:()=>S("terminals"),"aria-pressed":E==="terminals",className:Q("flex h-7 items-center gap-1.5 rounded px-2.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-terminal-muted-foreground",E==="terminals"?"bg-terminal text-terminal-foreground":"text-terminal-muted-foreground hover:bg-terminal-accent hover:text-terminal-foreground"),children:[t.jsx(yt,{size:12,"aria-hidden":"true"}),_("Interactive terminals")]}),t.jsxs("button",{type:"button",onClick:()=>S("services"),"aria-pressed":E==="services",className:Q("flex h-7 items-center gap-1.5 rounded px-2.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-terminal-muted-foreground",E==="services"?"bg-terminal text-terminal-foreground":"text-terminal-muted-foreground hover:bg-terminal-accent hover:text-terminal-foreground"),children:[t.jsx(js,{size:12,"aria-hidden":"true"}),_("Background services")]})]}),t.jsxs("div",{"aria-hidden":E!=="terminals",className:Q("min-h-0 flex-1 flex-col",E==="terminals"?"flex":"hidden"),children:[t.jsxs("div",{className:"flex items-center bg-terminal-chrome border-b border-terminal-border shrink-0 select-none",children:[t.jsx("div",{className:"flex items-center overflow-x-auto scrollbar-app-thin flex-1 min-w-0",children:C.map(D=>t.jsxs("button",{onClick:()=>u(D.id),className:Q("flex items-center gap-1.5 px-3 py-1.5 text-xs border-r border-terminal-border whitespace-nowrap group transition-colors",D.id===o?"bg-terminal text-terminal-foreground":"text-terminal-muted-foreground hover:bg-terminal-accent hover:text-terminal-foreground"),children:[t.jsx(yt,{size:11,className:"shrink-0"}),t.jsx("span",{children:_("Shell {count}",{count:D.order})}),C.length>1&&t.jsx("span",{onClick:B=>A(D.id,B),className:"ml-1 p-0.5 rounded hover:bg-terminal-accent opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:t.jsx(Qe,{size:10})})]},D.id))}),C.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mx-0.5 block h-5 w-px shrink-0 bg-terminal-border md:hidden","aria-hidden":"true"}),t.jsx("button",{type:"button",onClick:H,disabled:!O||p,className:"flex h-11 w-11 shrink-0 items-center justify-center text-terminal-muted-foreground transition-colors hover:bg-terminal-accent hover:text-terminal-foreground active:bg-terminal-accent disabled:cursor-not-allowed disabled:opacity-40 md:hidden",title:_("Paste into terminal"),"aria-label":_("Paste into terminal"),children:p?t.jsx(_e,{size:"lg",className:"size-[18px]"}):t.jsx(ta,{size:18})})]}),t.jsx("button",{type:"button",onClick:w,className:"flex h-11 w-11 shrink-0 items-center justify-center text-terminal-muted-foreground transition-colors hover:bg-terminal-accent hover:text-terminal-foreground active:bg-terminal-accent md:h-auto md:w-auto md:px-2 md:py-1.5",title:_("New Terminal"),"aria-label":_("New Terminal"),children:t.jsx(xt,{size:14})}),v.length>0&&t.jsx(ql,{commands:v,onSelect:M})]}),t.jsx("div",{className:"flex-1 min-h-0 min-w-0 overflow-hidden relative",children:C.length===0?t.jsx("div",{className:"flex-1 flex items-center justify-center h-full text-terminal-muted-foreground",children:t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.jsx(yt,{size:28}),t.jsx("span",{className:"text-xs",children:_("No terminals open")}),t.jsx("button",{onClick:w,className:"mt-1 rounded bg-terminal-chrome px-3 py-1 text-xs text-terminal-foreground ring-1 ring-inset ring-terminal-border transition-colors hover:bg-terminal-accent",children:_("New Terminal")})]})}):C.map(D=>t.jsx("div",{"aria-hidden":D.id!==o,className:Q("absolute inset-0 h-full w-full min-h-0 min-w-0 overflow-hidden",D.id===o?"visible pointer-events-auto":"invisible pointer-events-none"),children:t.jsx(Ul,{cwd:i,isVisible:n&&E==="terminals"&&D.id===o,onExit:()=>L(D.id),onReady:B=>R(D.id,B)})},D.id))})]}),d&&E==="services"&&t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(nc,{workspaceId:d,enabled:n})}),t.jsx(At,{isOpen:y,onClose:T,title:_("Paste into terminal"),className:"max-sm:inset-x-0 max-sm:top-auto max-sm:bottom-0 max-sm:max-h-[70dvh] max-sm:w-full max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-lg max-sm:border-x-0 max-sm:border-b-0",action:t.jsxs(t.Fragment,{children:[t.jsx(ve,{variant:"ghost",size:"lg",onClick:T,className:"max-sm:h-11",children:_("Cancel")}),t.jsx(ve,{variant:"primary",size:"lg",onClick:$,disabled:!s,className:"max-sm:h-11",children:_("Paste")})]}),children:t.jsx(bo,{autoFocus:!0,value:s,onChange:D=>c(D.target.value),placeholder:_("Paste terminal input here"),"aria-label":_("Terminal paste content"),className:"min-h-32 resize-none bg-background font-mono"})})]})});function wr(e,i){(i==null||i>e.length)&&(i=e.length);for(var n=0,d=Array(i);n<i;n++)d[n]=e[n];return d}function ac(e){if(Array.isArray(e))return e}function lc(e,i,n){return(i=pc(i))in e?Object.defineProperty(e,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[i]=n,e}function cc(e,i){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var d,v,_,C,r=[],o=!0,u=!1;try{if(_=(n=n.call(e)).next,i!==0)for(;!(o=(d=_.call(n)).done)&&(r.push(d.value),r.length!==i);o=!0);}catch(f){u=!0,v=f}finally{try{if(!o&&n.return!=null&&(C=n.return(),Object(C)!==C))return}finally{if(u)throw v}}return r}}function dc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
20
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cr(e,i){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);i&&(d=d.filter(function(v){return Object.getOwnPropertyDescriptor(e,v).enumerable})),n.push.apply(n,d)}return n}function kr(e){for(var i=1;i<arguments.length;i++){var n=arguments[i]!=null?arguments[i]:{};i%2?Cr(Object(n),!0).forEach(function(d){lc(e,d,n[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cr(Object(n)).forEach(function(d){Object.defineProperty(e,d,Object.getOwnPropertyDescriptor(n,d))})}return e}function hc(e,i){if(e==null)return{};var n,d,v=uc(e,i);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(e);for(d=0;d<_.length;d++)n=_[d],i.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(v[n]=e[n])}return v}function uc(e,i){if(e==null)return{};var n={};for(var d in e)if({}.hasOwnProperty.call(e,d)){if(i.indexOf(d)!==-1)continue;n[d]=e[d]}return n}function fc(e,i){return ac(e)||cc(e,i)||gc(e,i)||dc()}function mc(e,i){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var d=n.call(e,i);if(typeof d!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(e)}function pc(e){var i=mc(e,"string");return typeof i=="symbol"?i:i+""}function gc(e,i){if(e){if(typeof e=="string")return wr(e,i);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wr(e,i):void 0}}function vc(e,i,n){return i in e?Object.defineProperty(e,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[i]=n,e}function Er(e,i){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);i&&(d=d.filter(function(v){return Object.getOwnPropertyDescriptor(e,v).enumerable})),n.push.apply(n,d)}return n}function jr(e){for(var i=1;i<arguments.length;i++){var n=arguments[i]!=null?arguments[i]:{};i%2?Er(Object(n),!0).forEach(function(d){vc(e,d,n[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Er(Object(n)).forEach(function(d){Object.defineProperty(e,d,Object.getOwnPropertyDescriptor(n,d))})}return e}function _c(){for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return function(d){return i.reduceRight(function(v,_){return _(v)},d)}}function St(e){return function i(){for(var n=this,d=arguments.length,v=new Array(d),_=0;_<d;_++)v[_]=arguments[_];return v.length>=e.length?e.apply(this,v):function(){for(var C=arguments.length,r=new Array(C),o=0;o<C;o++)r[o]=arguments[o];return i.apply(n,[].concat(v,r))}}}function Yt(e){return{}.toString.call(e).includes("Object")}function bc(e){return!Object.keys(e).length}function jt(e){return typeof e=="function"}function xc(e,i){return Object.prototype.hasOwnProperty.call(e,i)}function Sc(e,i){return Yt(i)||Ke("changeType"),Object.keys(i).some(function(n){return!xc(e,n)})&&Ke("changeField"),i}function yc(e){jt(e)||Ke("selectorType")}function wc(e){jt(e)||Yt(e)||Ke("handlerType"),Yt(e)&&Object.values(e).some(function(i){return!jt(i)})&&Ke("handlersType")}function Cc(e){e||Ke("initialIsRequired"),Yt(e)||Ke("initialType"),bc(e)&&Ke("initialContent")}function kc(e,i){throw new Error(e[i]||e.default)}var Ec={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Ke=St(kc)(Ec),Ot={changes:Sc,selector:yc,handler:wc,initial:Cc};function jc(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ot.initial(e),Ot.handler(i);var n={current:e},d=St(Nc)(n,i),v=St(Ac)(n),_=St(Ot.changes)(e),C=St(Tc)(n);function r(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(f){return f};return Ot.selector(u),u(n.current)}function o(u){_c(d,v,_,C)(u)}return[r,o]}function Tc(e,i){return jt(i)?i(e.current):i}function Ac(e,i){return e.current=jr(jr({},e.current),i),i}function Nc(e,i,n){return jt(i)?i(e.current):Object.keys(n).forEach(function(d){var v;return(v=i[d])===null||v===void 0?void 0:v.call(i,e.current[d])}),n}var Rc={create:jc},Lc={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Mc(e){return function i(){for(var n=this,d=arguments.length,v=new Array(d),_=0;_<d;_++)v[_]=arguments[_];return v.length>=e.length?e.apply(this,v):function(){for(var C=arguments.length,r=new Array(C),o=0;o<C;o++)r[o]=arguments[o];return i.apply(n,[].concat(v,r))}}}function Dc(e){return{}.toString.call(e).includes("Object")}function Pc(e){return e||Tr("configIsRequired"),Dc(e)||Tr("configType"),e.urls?(Bc(),{paths:{vs:e.urls.monacoBase}}):e}function Bc(){console.warn(Pi.deprecation)}function Oc(e,i){throw new Error(e[i]||e.default)}var Pi={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
21
|
+
You are using deprecated way of configuration.
|
|
22
|
+
|
|
23
|
+
Instead of using
|
|
24
|
+
monaco.config({ urls: { monacoBase: '...' } })
|
|
25
|
+
use
|
|
26
|
+
monaco.config({ paths: { vs: '...' } })
|
|
27
|
+
|
|
28
|
+
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
29
|
+
`},Tr=Mc(Oc)(Pi),Ic={config:Pc},Fc=function(){for(var i=arguments.length,n=new Array(i),d=0;d<i;d++)n[d]=arguments[d];return function(v){return n.reduceRight(function(_,C){return C(_)},v)}};function Bi(e,i){return Object.keys(i).forEach(function(n){i[n]instanceof Object&&e[n]&&Object.assign(i[n],Bi(e[n],i[n]))}),kr(kr({},e),i)}var Hc={type:"cancelation",msg:"operation is manually canceled"};function ms(e){var i=!1,n=new Promise(function(d,v){e.then(function(_){return i?v(Hc):d(_)}),e.catch(v)});return n.cancel=function(){return i=!0},n}var zc=["monaco"],Wc=Rc.create({config:Lc,isInitialized:!1,resolve:null,reject:null,monaco:null}),Oi=fc(Wc,2),Nt=Oi[0],Jt=Oi[1];function $c(e){var i=Ic.config(e),n=i.monaco,d=hc(i,zc);Jt(function(v){return{config:Bi(v.config,d),monaco:n}})}function Uc(){var e=Nt(function(i){var n=i.monaco,d=i.isInitialized,v=i.resolve;return{monaco:n,isInitialized:d,resolve:v}});if(!e.isInitialized){if(Jt({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),ms(ps);if(window.monaco&&window.monaco.editor)return Ii(window.monaco),e.resolve(window.monaco),ms(ps);Fc(qc,Xc)(Yc)}return ms(ps)}function qc(e){return document.body.appendChild(e)}function Kc(e){var i=document.createElement("script");return e&&(i.src=e),i}function Xc(e){var i=Nt(function(d){var v=d.config,_=d.reject;return{config:v,reject:_}}),n=Kc("".concat(i.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=i.reject,n}function Yc(){var e=Nt(function(n){var d=n.config,v=n.resolve,_=n.reject;return{config:d,resolve:v,reject:_}}),i=window.require;i.config(e.config),i(["vs/editor/editor.main"],function(n){var d=n.m||n;Ii(d),e.resolve(d)},function(n){e.reject(n)})}function Ii(e){Nt().monaco||Jt({monaco:e})}function Vc(){return Nt(function(e){var i=e.monaco;return i})}var ps=new Promise(function(e,i){return Jt({resolve:e,reject:i})}),Fi={config:$c,init:Uc,__getMonacoInstance:Vc},Gc={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},gs=Gc,Qc={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Zc=Qc;function Jc({children:e}){return pe.createElement("div",{style:Zc.container},e)}var ed=Jc,td=ed;function sd({width:e,height:i,isEditorReady:n,loading:d,_ref:v,className:_,wrapperProps:C}){return pe.createElement("section",{style:{...gs.wrapper,width:e,height:i},...C},!n&&pe.createElement(td,null,d),pe.createElement("div",{ref:v,style:{...gs.fullWidth,...!n&&gs.hide},className:_}))}var rd=sd,Hi=N.memo(rd);function id(e){N.useEffect(e,[])}var zi=id;function nd(e,i,n=!0){let d=N.useRef(!0);N.useEffect(d.current||!n?()=>{d.current=!1}:e,i)}var je=nd;function wt(){}function pt(e,i,n,d){return od(e,d)||ad(e,i,n,d)}function od(e,i){return e.editor.getModel(Wi(e,i))}function ad(e,i,n,d){return e.editor.createModel(i,n,d?Wi(e,d):void 0)}function Wi(e,i){return e.Uri.parse(i)}function ld({original:e,modified:i,language:n,originalLanguage:d,modifiedLanguage:v,originalModelPath:_,modifiedModelPath:C,keepCurrentOriginalModel:r=!1,keepCurrentModifiedModel:o=!1,theme:u="light",loading:f="Loading...",options:a={},height:p="100%",width:m="100%",className:y,wrapperProps:b={},beforeMount:s=wt,onMount:c=wt}){let[l,h]=N.useState(!1),[g,S]=N.useState(!0),k=N.useRef(null),E=N.useRef(null),x=N.useRef(null),w=N.useRef(c),A=N.useRef(s),L=N.useRef(!1);zi(()=>{let P=Fi.init();return P.then(H=>(E.current=H)&&S(!1)).catch(H=>H?.type!=="cancelation"&&console.error("Monaco initialization: error:",H)),()=>k.current?I():P.cancel()}),je(()=>{if(k.current&&E.current){let P=k.current.getOriginalEditor(),H=pt(E.current,e||"",d||n||"text",_||"");H!==P.getModel()&&P.setModel(H)}},[_],l),je(()=>{if(k.current&&E.current){let P=k.current.getModifiedEditor(),H=pt(E.current,i||"",v||n||"text",C||"");H!==P.getModel()&&P.setModel(H)}},[C],l),je(()=>{let P=k.current.getModifiedEditor();P.getOption(E.current.editor.EditorOption.readOnly)?P.setValue(i||""):i!==P.getValue()&&(P.executeEdits("",[{range:P.getModel().getFullModelRange(),text:i||"",forceMoveMarkers:!0}]),P.pushUndoStop())},[i],l),je(()=>{k.current?.getModel()?.original.setValue(e||"")},[e],l),je(()=>{let{original:P,modified:H}=k.current.getModel();E.current.editor.setModelLanguage(P,d||n||"text"),E.current.editor.setModelLanguage(H,v||n||"text")},[n,d,v],l),je(()=>{E.current?.editor.setTheme(u)},[u],l),je(()=>{k.current?.updateOptions(a)},[a],l);let R=N.useCallback(()=>{if(!E.current)return;A.current(E.current);let P=pt(E.current,e||"",d||n||"text",_||""),H=pt(E.current,i||"",v||n||"text",C||"");k.current?.setModel({original:P,modified:H})},[n,i,v,e,d,_,C]),M=N.useCallback(()=>{!L.current&&x.current&&(k.current=E.current.editor.createDiffEditor(x.current,{automaticLayout:!0,...a}),R(),E.current?.editor.setTheme(u),h(!0),L.current=!0)},[a,u,R]);N.useEffect(()=>{l&&w.current(k.current,E.current)},[l]),N.useEffect(()=>{!g&&!l&&M()},[g,l,M]);function I(){let P=k.current?.getModel();r||P?.original?.dispose(),o||P?.modified?.dispose(),k.current?.dispose()}return pe.createElement(Hi,{width:m,height:p,isEditorReady:l,loading:f,_ref:x,className:y,wrapperProps:b})}var cd=ld;N.memo(cd);function dd(e){let i=N.useRef();return N.useEffect(()=>{i.current=e},[e]),i.current}var hd=dd,It=new Map;function ud({defaultValue:e,defaultLanguage:i,defaultPath:n,value:d,language:v,path:_,theme:C="light",line:r,loading:o="Loading...",options:u={},overrideServices:f={},saveViewState:a=!0,keepCurrentModel:p=!1,width:m="100%",height:y="100%",className:b,wrapperProps:s={},beforeMount:c=wt,onMount:l=wt,onChange:h,onValidate:g=wt}){let[S,k]=N.useState(!1),[E,x]=N.useState(!0),w=N.useRef(null),A=N.useRef(null),L=N.useRef(null),R=N.useRef(l),M=N.useRef(c),I=N.useRef(),P=N.useRef(d),H=hd(_),$=N.useRef(!1),T=N.useRef(!1);zi(()=>{let B=Fi.init();return B.then(q=>(w.current=q)&&x(!1)).catch(q=>q?.type!=="cancelation"&&console.error("Monaco initialization: error:",q)),()=>A.current?D():B.cancel()}),je(()=>{let B=pt(w.current,e||d||"",i||v||"",_||n||"");B!==A.current?.getModel()&&(a&&It.set(H,A.current?.saveViewState()),A.current?.setModel(B),a&&A.current?.restoreViewState(It.get(_)))},[_],S),je(()=>{A.current?.updateOptions(u)},[u],S),je(()=>{!A.current||d===void 0||(A.current.getOption(w.current.editor.EditorOption.readOnly)?A.current.setValue(d):d!==A.current.getValue()&&(T.current=!0,A.current.executeEdits("",[{range:A.current.getModel().getFullModelRange(),text:d,forceMoveMarkers:!0}]),A.current.pushUndoStop(),T.current=!1))},[d],S),je(()=>{let B=A.current?.getModel();B&&v&&w.current?.editor.setModelLanguage(B,v)},[v],S),je(()=>{r!==void 0&&A.current?.revealLine(r)},[r],S),je(()=>{w.current?.editor.setTheme(C)},[C],S);let O=N.useCallback(()=>{if(!(!L.current||!w.current)&&!$.current){M.current(w.current);let B=_||n,q=pt(w.current,d||e||"",i||v||"",B||"");A.current=w.current?.editor.create(L.current,{model:q,automaticLayout:!0,...u},f),a&&A.current.restoreViewState(It.get(B)),w.current.editor.setTheme(C),r!==void 0&&A.current.revealLine(r),k(!0),$.current=!0}},[e,i,n,d,v,_,u,f,a,C,r]);N.useEffect(()=>{S&&R.current(A.current,w.current)},[S]),N.useEffect(()=>{!E&&!S&&O()},[E,S,O]),P.current=d,N.useEffect(()=>{S&&h&&(I.current?.dispose(),I.current=A.current?.onDidChangeModelContent(B=>{T.current||h(A.current.getValue(),B)}))},[S,h]),N.useEffect(()=>{if(S){let B=w.current.editor.onDidChangeMarkers(q=>{let K=A.current.getModel()?.uri;if(K&&q.find(U=>U.path===K.path)){let U=w.current.editor.getModelMarkers({resource:K});g?.(U)}});return()=>{B?.dispose()}}return()=>{}},[S,g]);function D(){I.current?.dispose(),p?a&&It.set(_,A.current.saveViewState()):A.current.getModel()?.dispose(),A.current.dispose()}return pe.createElement(Hi,{width:m,height:y,isEditorReady:S,loading:o,_ref:L,className:b,wrapperProps:s})}var fd=ud,md=N.memo(fd),pd=md,Ne=function(e,i){return Number(e.toFixed(i))},gd=function(e,i){return typeof e=="number"?e:i},ue=function(e,i,n){n&&typeof n=="function"&&n(e,i)},vd=function(e){return-Math.cos(e*Math.PI)/2+.5},_d=function(e){return e},bd=function(e){return e*e},xd=function(e){return e*(2-e)},Sd=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},yd=function(e){return e*e*e},wd=function(e){return--e*e*e+1},Cd=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},kd=function(e){return e*e*e*e},Ed=function(e){return 1- --e*e*e*e},jd=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},Td=function(e){return e*e*e*e*e},Ad=function(e){return 1+--e*e*e*e*e},Nd=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},$i={easeOut:vd,linear:_d,easeInQuad:bd,easeOutQuad:xd,easeInOutQuad:Sd,easeInCubic:yd,easeOutCubic:wd,easeInOutCubic:Cd,easeInQuart:kd,easeOutQuart:Ed,easeInOutQuart:jd,easeInQuint:Td,easeOutQuint:Ad,easeInOutQuint:Nd},Ui=function(e){typeof e=="number"&&cancelAnimationFrame(e)},Re=function(e){e.mounted&&(Ui(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function qi(e,i,n,d){if(e.mounted){var v=new Date().getTime(),_=1;Re(e),e.animation=function(){if(!e.mounted)return Ui(e.animation);var C=new Date().getTime()-v,r=C/n,o=$i[i],u=o(r);C>=n?(d(_),e.animation=null):e.animation&&(d(u),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function Rd(e){var i=e.scale,n=e.positionX,d=e.positionY;return!(Number.isNaN(i)||Number.isNaN(n)||Number.isNaN(d))}function Ze(e,i,n,d){var v=Rd(i);if(!(!e.mounted||!v)){var _=e.setTransformState,C=e.transformState,r=C.scale,o=C.positionX,u=C.positionY,f=i.scale-r,a=i.positionX-o,p=i.positionY-u;n===0?_(i.scale,i.positionX,i.positionY):qi(e,d,n,function(m){var y=r+f*m,b=o+a*m,s=u+p*m;_(y,b,s)})}}function Ld(e,i,n){var d=e.offsetWidth,v=e.offsetHeight,_=i.offsetWidth,C=i.offsetHeight,r=_*n,o=C*n,u=d-r,f=v-o;return{wrapperWidth:d,wrapperHeight:v,newContentWidth:r,newDiffWidth:u,newContentHeight:o,newDiffHeight:f}}var Md=function(e,i,n,d,v,_,C){var r=e>i?n*(C?1:.5):0,o=d>v?_*(C?1:.5):0,u=e-i-r,f=r,a=d-v-o,p=o;return{minPositionX:u,maxPositionX:f,minPositionY:a,maxPositionY:p}},Gs=function(e,i){var n=e.wrapperComponent,d=e.contentComponent,v=e.setup.centerZoomedOut;if(!n||!d)throw new Error("Components are not mounted");var _=Ld(n,d,i),C=_.wrapperWidth,r=_.wrapperHeight,o=_.newContentWidth,u=_.newDiffWidth,f=_.newContentHeight,a=_.newDiffHeight,p=Md(C,o,u,r,f,a,!!v);return p},Ls=function(e,i,n,d){return d?e<i?Ne(i,2):e>n?Ne(n,2):Ne(e,2):Ne(e,2)},ot=function(e,i){var n=Gs(e,i);return e.bounds=n,n};function Rt(e,i,n,d,v,_,C){var r=n.minPositionX,o=n.minPositionY,u=n.maxPositionX,f=n.maxPositionY,a=0,p=0;C&&(a=v,p=_);var m=Ls(e,r-a,u+a,d),y=Ls(i,o-p,f+p,d);return{x:m,y}}function es(e,i,n,d,v,_){var C=e.transformState,r=C.scale,o=C.positionX,u=C.positionY,f=d-r;if(typeof i!="number"||typeof n!="number")return console.error("Mouse X and Y position were not provided!"),{x:o,y:u};var a=o-i*f,p=u-n*f,m=Rt(a,p,v,_,0,0,null);return m}function Lt(e,i,n,d,v){var _=v?d:0,C=i-_;return!Number.isNaN(n)&&e>=n?n:!Number.isNaN(i)&&e<=C?C:e}var Ar=function(e,i){var n=e.setup.panning.excluded,d=e.isInitialized,v=e.wrapperComponent,_=i.target,C="shadowRoot"in _&&"composedPath"in i,r=C?i.composedPath().some(function(f){return f instanceof Element?v?.contains(f):!1}):v?.contains(_),o=d&&_&&r;if(!o)return!1;var u=ts(_,n);return!u},Nr=function(e){var i=e.isInitialized,n=e.isPanning,d=e.setup,v=d.panning.disabled,_=i&&n&&!v;return!!_},Dd=function(e,i){var n=e.transformState,d=n.positionX,v=n.positionY;e.isPanning=!0;var _=i.clientX,C=i.clientY;e.startCoords={x:_-d,y:C-v}},Pd=function(e,i){var n=i.touches,d=e.transformState,v=d.positionX,_=d.positionY;e.isPanning=!0;var C=n.length===1;if(C){var r=n[0].clientX,o=n[0].clientY;e.startCoords={x:r-v,y:o-_}}};function Bd(e){var i=e.transformState,n=i.positionX,d=i.positionY,v=i.scale,_=e.setup,C=_.disabled,r=_.limitToBounds,o=_.centerZoomedOut,u=e.wrapperComponent;if(!(C||!u||!e.bounds)){var f=e.bounds,a=f.maxPositionX,p=f.minPositionX,m=f.maxPositionY,y=f.minPositionY,b=n>a||n<p,s=d>m||d<y,c=n>a?u.offsetWidth:e.setup.minPositionX||0,l=d>m?u.offsetHeight:e.setup.minPositionY||0,h=es(e,c,l,v,e.bounds,r||o),g=h.x,S=h.y;return{scale:v,positionX:b?g:n,positionY:s?S:d}}}function Ki(e,i,n,d,v){var _=e.setup.limitToBounds,C=e.wrapperComponent,r=e.bounds,o=e.transformState,u=o.scale,f=o.positionX,a=o.positionY;if(!(C===null||r===null||i===f&&n===a)){var p=Rt(i,n,r,_,d,v,C),m=p.x,y=p.y;e.setTransformState(u,m,y)}}var Od=function(e,i,n){var d=e.startCoords,v=e.transformState,_=e.setup.panning,C=_.lockAxisX,r=_.lockAxisY,o=v.positionX,u=v.positionY;if(!d)return{x:o,y:u};var f=i-d.x,a=n-d.y,p=C?o:f,m=r?u:a;return{x:p,y:m}},Ge=function(e,i){var n=e.setup,d=e.transformState,v=d.scale,_=n.minScale,C=n.disablePadding;return i>0&&v>=_&&!C?i:0},Id=function(e){var i=e.mounted,n=e.setup,d=n.disabled,v=n.velocityAnimation,_=e.transformState.scale,C=v.disabled,r=!C||_>1||!d||i;return!!r},Fd=function(e){var i=e.mounted,n=e.velocity,d=e.bounds,v=e.setup,_=v.disabled,C=v.velocityAnimation,r=e.transformState.scale,o=C.disabled,u=!o||r>1||!_||i;return!(!u||!n||!d)};function Hd(e,i){var n=e.setup.velocityAnimation,d=n.equalToMove,v=n.animationTime,_=n.sensitivity;return d?v*i*_:v}function Rr(e,i,n,d,v,_,C,r,o,u){if(v){if(i>C&&n>C){var f=C+(e-C)*u;return f>o?o:f<C?C:f}if(i<_&&n<_){var f=_+(e-_)*u;return f<r?r:f>_?_:f}}return d?i:Ls(e,_,C,v)}function zd(e,i){var n=1;return i?Math.min(n,e.offsetWidth/window.innerWidth):n}function Wd(e,i){var n=Id(e);if(n){var d=e.lastMousePosition,v=e.velocityTime,_=e.setup,C=e.wrapperComponent,r=_.velocityAnimation.equalToMove,o=Date.now();if(d&&v&&C){var u=zd(C,r),f=i.x-d.x,a=i.y-d.y,p=f/u,m=a/u,y=o-v,b=f*f+a*a,s=Math.sqrt(b)/y;e.velocity={velocityX:p,velocityY:m,total:s}}e.lastMousePosition=i,e.velocityTime=o}}function $d(e){var i=e.velocity,n=e.bounds,d=e.setup,v=e.wrapperComponent,_=Fd(e);if(!(!_||!i||!n||!v)){var C=i.velocityX,r=i.velocityY,o=i.total,u=n.maxPositionX,f=n.minPositionX,a=n.maxPositionY,p=n.minPositionY,m=d.limitToBounds,y=d.alignmentAnimation,b=d.zoomAnimation,s=d.panning,c=s.lockAxisY,l=s.lockAxisX,h=b.animationType,g=y.sizeX,S=y.sizeY,k=y.velocityAlignmentTime,E=k,x=Hd(e,o),w=Math.max(x,E),A=Ge(e,g),L=Ge(e,S),R=A*v.offsetWidth/100,M=L*v.offsetHeight/100,I=u+R,P=f-R,H=a+M,$=p-M,T=e.transformState,O=new Date().getTime();qi(e,h,w,function(D){var B=e.transformState,q=B.scale,K=B.positionX,U=B.positionY,z=new Date().getTime()-O,W=z/E,j=$i[y.animationType],F=1-j(Math.min(1,W)),X=1-D,Y=K+C*X,ee=U+r*X,G=Rr(Y,T.positionX,K,l,m,f,u,P,I,F),J=Rr(ee,T.positionY,U,c,m,p,a,$,H,F);(K!==Y||U!==ee)&&e.setTransformState(q,G,J)})}}function Lr(e,i){var n=e.transformState.scale;Re(e),ot(e,n),window.TouchEvent!==void 0&&i instanceof TouchEvent?Pd(e,i):Dd(e,i)}function Qs(e,i){var n=e.transformState.scale,d=e.setup,v=d.minScale,_=d.alignmentAnimation,C=_.disabled,r=_.sizeX,o=_.sizeY,u=_.animationTime,f=_.animationType,a=C||n<v||!r&&!o;if(!a){var p=Bd(e);p&&Ze(e,p,i??u,f)}}function Mr(e,i,n){var d=e.startCoords,v=e.setup,_=v.alignmentAnimation,C=_.sizeX,r=_.sizeY;if(d){var o=Od(e,i,n),u=o.x,f=o.y,a=Ge(e,C),p=Ge(e,r);Wd(e,{x:u,y:f}),Ki(e,u,f,a,p)}}function Ud(e){if(e.isPanning){var i=e.setup.panning.velocityDisabled,n=e.velocity,d=e.wrapperComponent,v=e.contentComponent;e.isPanning=!1,e.animate=!1,e.animation=null;var _=d?.getBoundingClientRect(),C=v?.getBoundingClientRect(),r=_?.width||0,o=_?.height||0,u=C?.width||0,f=C?.height||0,a=r<u||o<f,p=!i&&n&&n?.total>.1&&a;p?$d(e):Qs(e)}}function Zs(e,i,n,d){var v=e.setup,_=v.minScale,C=v.maxScale,r=v.limitToBounds,o=Lt(Ne(i,2),_,C,0,!1),u=ot(e,o),f=es(e,n,d,o,u,r),a=f.x,p=f.y;return{scale:o,positionX:a,positionY:p}}function Xi(e,i,n){var d=e.transformState.scale,v=e.wrapperComponent,_=e.setup,C=_.minScale,r=_.limitToBounds,o=_.zoomAnimation,u=o.disabled,f=o.animationTime,a=o.animationType,p=u||d>=C;if((d>=1||r)&&Qs(e),!(p||!v||!e.mounted)){var m=i||v.offsetWidth/2,y=n||v.offsetHeight/2,b=Zs(e,C,m,y);b&&Ze(e,b,f,a)}}var Xe=function(){return Xe=Object.assign||function(i){for(var n,d=1,v=arguments.length;d<v;d++){n=arguments[d];for(var _ in n)Object.prototype.hasOwnProperty.call(n,_)&&(i[_]=n[_])}return i},Xe.apply(this,arguments)};function Dr(e,i,n){for(var d=0,v=i.length,_;d<v;d++)(_||!(d in i))&&(_||(_=Array.prototype.slice.call(i,0,d)),_[d]=i[d]);return e.concat(_||Array.prototype.slice.call(i))}var Ft={scale:1,positionX:0,positionY:0},bt={disabled:!1,minPositionX:null,maxPositionX:null,minPositionY:null,maxPositionY:null,minScale:1,maxScale:8,limitToBounds:!0,centerZoomedOut:!1,centerOnInit:!1,disablePadding:!1,smooth:!0,wheel:{step:.2,disabled:!1,smoothStep:.001,wheelDisabled:!1,touchPadDisabled:!1,activationKeys:[],excluded:[]},panning:{disabled:!1,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,allowLeftClickPan:!0,allowMiddleClickPan:!0,allowRightClickPan:!0,wheelPanning:!1,activationKeys:[],excluded:[]},pinch:{step:5,disabled:!1,excluded:[]},doubleClick:{disabled:!1,step:.7,mode:"zoomIn",animationType:"easeOut",animationTime:200,excluded:[]},zoomAnimation:{disabled:!1,size:.4,animationTime:200,animationType:"easeOut"},alignmentAnimation:{disabled:!1,sizeX:100,sizeY:100,animationTime:200,velocityAlignmentTime:400,animationType:"easeOut"},velocityAnimation:{disabled:!1,sensitivity:1,animationTime:400,animationType:"easeOut",equalToMove:!0}},Ms={wrapperClass:"react-transform-wrapper",contentClass:"react-transform-component"},Yi=function(e){var i,n,d,v;return{previousScale:(i=e.initialScale)!==null&&i!==void 0?i:Ft.scale,scale:(n=e.initialScale)!==null&&n!==void 0?n:Ft.scale,positionX:(d=e.initialPositionX)!==null&&d!==void 0?d:Ft.positionX,positionY:(v=e.initialPositionY)!==null&&v!==void 0?v:Ft.positionY}},Pr=function(e){var i=Xe({},bt);return Object.keys(e).forEach(function(n){var d=typeof e[n]<"u",v=typeof bt[n]<"u";if(v&&d){var _=Object.prototype.toString.call(bt[n]),C=_==="[object Object]",r=_==="[object Array]";C?i[n]=Xe(Xe({},bt[n]),e[n]):r?i[n]=Dr(Dr([],bt[n],!0),e[n]):i[n]=e[n]}}),i},Vi=function(e,i,n){var d=e.transformState.scale,v=e.wrapperComponent,_=e.setup,C=_.maxScale,r=_.minScale,o=_.zoomAnimation,u=_.smooth,f=o.size;if(!v)throw new Error("Wrapper is not mounted");var a=u?d*Math.exp(i*n):d+i*n,p=Lt(Ne(a,3),r,C,f,!1);return p};function Gi(e,i,n,d,v){var _=e.wrapperComponent,C=e.transformState,r=C.scale,o=C.positionX,u=C.positionY;if(!_)return console.error("No WrapperComponent found");var f=_.offsetWidth,a=_.offsetHeight,p=(f/2-o)/r,m=(a/2-u)/r,y=Vi(e,i,n),b=Zs(e,y,p,m);if(!b)return console.error("Error during zoom event. New transformation state was not calculated.");Ze(e,b,d,v)}function Qi(e,i,n,d){var v=e.setup,_=e.wrapperComponent,C=v.limitToBounds,r=Yi(e.props),o=e.transformState,u=o.scale,f=o.positionX,a=o.positionY;if(_){var p=Gs(e,r.scale),m=Rt(r.positionX,r.positionY,p,C,0,0,_),y={scale:r.scale,positionX:m.x,positionY:m.y};u===r.scale&&f===r.positionX&&a===r.positionY||(d?.(),Ze(e,y,i,n))}}function qd(e,i,n,d){var v=e.getBoundingClientRect(),_=i.getBoundingClientRect(),C=n.getBoundingClientRect(),r=_.x*d.scale,o=_.y*d.scale;return{x:(v.x-C.x+r)/d.scale,y:(v.y-C.y+o)/d.scale}}function Kd(e,i,n){var d=e.wrapperComponent,v=e.contentComponent,_=e.transformState,C=e.setup,r=C.limitToBounds,o=C.minScale,u=C.maxScale;if(!d||!v)return _;var f=d.getBoundingClientRect(),a=i.getBoundingClientRect(),p=qd(i,d,v,_),m=p.x,y=p.y,b=a.width/_.scale,s=a.height/_.scale,c=d.offsetWidth/b,l=d.offsetHeight/s,h=Lt(n||Math.min(c,l),o,u,0,!1),g=(f.width-b*h)/2,S=(f.height-s*h)/2,k=(f.left-m)*h+g,E=(f.top-y)*h+S,x=Gs(e,h),w=Rt(k,E,x,r,0,0,d),A=w.x,L=w.y;return{positionX:A,positionY:L,scale:h}}var Xd=function(e){return function(i,n,d){i===void 0&&(i=.5),n===void 0&&(n=300),d===void 0&&(d="easeOut"),Gi(e,1,i,n,d)}},Yd=function(e){return function(i,n,d){i===void 0&&(i=.5),n===void 0&&(n=300),d===void 0&&(d="easeOut"),Gi(e,-1,i,n,d)}},Vd=function(e){return function(i,n,d,v,_){v===void 0&&(v=300),_===void 0&&(_="easeOut");var C=e.transformState,r=C.positionX,o=C.positionY,u=C.scale,f=e.wrapperComponent,a=e.contentComponent,p=e.setup.disabled;if(!(p||!f||!a)){var m={positionX:Number.isNaN(i)?r:i,positionY:Number.isNaN(n)?o:n,scale:Number.isNaN(d)?u:d};Ze(e,m,v,_)}}},Gd=function(e){return function(i,n){i===void 0&&(i=200),n===void 0&&(n="easeOut"),Qi(e,i,n)}},Qd=function(e){return function(i,n,d){n===void 0&&(n=200),d===void 0&&(d="easeOut");var v=e.transformState,_=e.wrapperComponent,C=e.contentComponent;if(_&&C){var r=Zi(i||v.scale,_,C);Ze(e,r,n,d)}}},Zd=function(e){return function(i,n,d,v){d===void 0&&(d=600),v===void 0&&(v="easeOut"),Re(e);var _=e.wrapperComponent,C=typeof i=="string"?document.getElementById(i):i;if(_&&C&&_.contains(C)){var r=Kd(e,C,n);Ze(e,r,d,v)}}},Vt=function(e){return{instance:e,zoomIn:Xd(e),zoomOut:Yd(e),setTransform:Vd(e),resetTransform:Gd(e),centerView:Qd(e),zoomToElement:Zd(e)}},Ds=function(e){return{instance:e,state:e.transformState}},de=function(e){var i={};return Object.assign(i,Ds(e)),Object.assign(i,Vt(e)),i},vs=!1;function _s(){try{var e={get passive(){return vs=!0,!1}};return e}catch{return vs=!1,vs}}var Ht=".".concat(Ms.wrapperClass),ts=function(e,i){return i.some(function(n){return e.matches("".concat(Ht," ").concat(n,", ").concat(Ht," .").concat(n,", ").concat(Ht," ").concat(n," *, ").concat(Ht," .").concat(n," *"))})},Ps=function(e){e&&clearTimeout(e)},Jd=function(e,i,n){return"translate(".concat(e,"px, ").concat(i,"px) scale(").concat(n,")")},Zi=function(e,i,n){var d=n.offsetWidth*e,v=n.offsetHeight*e,_=(i.offsetWidth-d)/2,C=(i.offsetHeight-v)/2;return{scale:e,positionX:_,positionY:C}};function eh(e){return function(i){e.forEach(function(n){typeof n=="function"?n(i):n!=null&&(n.current=i)})}}var th=function(e,i){var n=e.setup.wheel,d=n.disabled,v=n.wheelDisabled,_=n.touchPadDisabled,C=n.excluded,r=e.isInitialized,o=e.isPanning,u=i.target,f=r&&!o&&!d&&u;if(!f||v&&!i.ctrlKey||_&&i.ctrlKey)return!1;var a=ts(u,C);return!a},sh=function(e){return e?e.deltaY<0?1:-1:0};function rh(e,i){var n=sh(e),d=gd(i,n);return d}function Ji(e,i,n){var d=i.getBoundingClientRect(),v=0,_=0;if("clientX"in e)v=(e.clientX-d.left)/n,_=(e.clientY-d.top)/n;else{var C=e.touches[0];v=(C.clientX-d.left)/n,_=(C.clientY-d.top)/n}return(Number.isNaN(v)||Number.isNaN(_))&&console.error("No mouse or touch offset found"),{x:v,y:_}}var ih=function(e,i,n,d,v){var _=e.transformState.scale,C=e.wrapperComponent,r=e.setup,o=r.maxScale,u=r.minScale,f=r.zoomAnimation,a=r.disablePadding,p=f.size,m=f.disabled;if(!C)throw new Error("Wrapper is not mounted");var y=_+i*n,b=d?!1:!m,s=Lt(Ne(y,3),u,o,p,b&&!a);return s},nh=function(e,i){var n=e.previousWheelEvent,d=e.transformState.scale,v=e.setup,_=v.maxScale,C=v.minScale;return n?d<_||d>C||Math.sign(n.deltaY)!==Math.sign(i.deltaY)||n.deltaY>0&&n.deltaY<i.deltaY||n.deltaY<0&&n.deltaY>i.deltaY||Math.sign(n.deltaY)!==Math.sign(i.deltaY):!1},oh=function(e,i){var n=e.setup.pinch,d=n.disabled,v=n.excluded,_=e.isInitialized,C=i.target,r=_&&!d&&C;if(!r)return!1;var o=ts(C,v);return!o},ah=function(e){var i=e.setup.pinch.disabled,n=e.isInitialized,d=e.pinchStartDistance,v=n&&!i&&d;return!!v},lh=function(e,i,n){var d=n.getBoundingClientRect(),v=e.touches,_=Ne(v[0].clientX-d.left,5),C=Ne(v[0].clientY-d.top,5),r=Ne(v[1].clientX-d.left,5),o=Ne(v[1].clientY-d.top,5);return{x:(_+r)/2/i,y:(C+o)/2/i}},en=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},ch=function(e,i){var n=e.pinchStartScale,d=e.pinchStartDistance,v=e.setup,_=v.maxScale,C=v.minScale,r=v.zoomAnimation,o=v.disablePadding,u=r.size,f=r.disabled;if(!n||d===null||!i)throw new Error("Pinch touches distance was not provided");if(i<0)return e.transformState.scale;var a=i/d,p=a*n;return Lt(Ne(p,2),C,_,u,!f&&!o)},dh=160,hh=100,uh=function(e,i){var n=e.props,d=n.onWheelStart,v=n.onZoomStart;e.wheelStopEventTimer||(Re(e),ue(de(e),i,d),ue(de(e),i,v))},fh=function(e,i){var n=e.props,d=n.onWheel,v=n.onZoom,_=e.contentComponent,C=e.setup,r=e.transformState,o=r.scale,u=C.limitToBounds,f=C.centerZoomedOut,a=C.zoomAnimation,p=C.wheel,m=C.disablePadding,y=C.smooth,b=a.size,s=a.disabled,c=p.step,l=p.smoothStep;if(!_)throw new Error("Component not mounted");i.preventDefault(),i.stopPropagation();var h=rh(i,null),g=y?l*Math.abs(i.deltaY):c,S=ih(e,h,g,!i.ctrlKey);if(o!==S){var k=ot(e,S),E=Ji(i,_,o),x=s||b===0||f||m,w=u&&x,A=es(e,E.x,E.y,S,k,w),L=A.x,R=A.y;e.previousWheelEvent=i,e.setTransformState(S,L,R),ue(de(e),i,d),ue(de(e),i,v)}},mh=function(e,i){var n=e.props,d=n.onWheelStop,v=n.onZoomStop;Ps(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(Xi(e,i.x,i.y),e.wheelAnimationTimer=null)},hh);var _=nh(e,i);_&&(Ps(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,ue(de(e),i,d),ue(de(e),i,v))},dh))},tn=function(e){for(var i=0,n=0,d=0;d<2;d+=1)i+=e.touches[d].clientX,n+=e.touches[d].clientY;var v=i/2,_=n/2;return{x:v,y:_}},ph=function(e,i){var n=en(i);e.pinchStartDistance=n,e.lastDistance=n,e.pinchStartScale=e.transformState.scale,e.isPanning=!1;var d=tn(i);e.pinchLastCenterX=d.x,e.pinchLastCenterY=d.y,Re(e)},gh=function(e,i){var n=e.contentComponent,d=e.pinchStartDistance,v=e.wrapperComponent,_=e.transformState.scale,C=e.setup,r=C.limitToBounds,o=C.centerZoomedOut,u=C.zoomAnimation,f=C.alignmentAnimation,a=u.disabled,p=u.size;if(!(d===null||!n)){var m=lh(i,_,n);if(!(!Number.isFinite(m.x)||!Number.isFinite(m.y))){var y=en(i),b=ch(e,y),s=tn(i),c=s.x-(e.pinchLastCenterX||0),l=s.y-(e.pinchLastCenterY||0);if(!(b===_&&c===0&&l===0)){e.pinchLastCenterX=s.x,e.pinchLastCenterY=s.y;var h=ot(e,b),g=a||p===0||o,S=r&&g,k=es(e,m.x,m.y,b,h,S),E=k.x,x=k.y;e.pinchMidpoint=m,e.lastDistance=y;var w=f.sizeX,A=f.sizeY,L=Ge(e,w),R=Ge(e,A),M=E+c,I=x+l,P=Rt(M,I,h,r,L,R,v),H=P.x,$=P.y;e.setTransformState(b,H,$)}}}},vh=function(e){var i=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,Xi(e,i?.x,i?.y)},sn=function(e,i){var n=e.props.onZoomStop,d=e.setup.doubleClick.animationTime;Ps(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,ue(de(e),i,n)},d)},_h=function(e,i){var n=e.props,d=n.onZoomStart,v=n.onZoom,_=e.setup.doubleClick,C=_.animationTime,r=_.animationType;ue(de(e),i,d),Qi(e,C,r,function(){return ue(de(e),i,v)}),sn(e,i)};function bh(e,i){return e==="toggle"?i===1?1:-1:e==="zoomOut"?-1:1}function xh(e,i){var n=e.setup,d=e.doubleClickStopEventTimer,v=e.transformState,_=e.contentComponent,C=v.scale,r=e.props,o=r.onZoomStart,u=r.onZoom,f=n.doubleClick,a=f.disabled,p=f.mode,m=f.step,y=f.animationTime,b=f.animationType;if(!a&&!d){if(p==="reset")return _h(e,i);if(!_)return console.error("No ContentComponent found");var s=bh(p,e.transformState.scale),c=Vi(e,s,m);if(C!==c){ue(de(e),i,o);var l=Ji(i,_,C),h=Zs(e,c,l.x,l.y);if(!h)return console.error("Error during zoom event. New transformation state was not calculated.");ue(de(e),i,u),Ze(e,h,y,b),sn(e,i)}}}var Sh=function(e,i){var n=e.isInitialized,d=e.setup,v=e.wrapperComponent,_=d.doubleClick,C=_.disabled,r=_.excluded,o=i.target,u=v?.contains(o),f=n&&o&&u&&!C;if(!f)return!1;var a=ts(o,r);return!a},yh=(function(){function e(i){var n=this;this.mounted=!0,this.pinchLastCenterX=null,this.pinchLastCenterY=null,this.onChangeCallbacks=new Set,this.onInitCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.isWheelPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){n.initializeWindowEvents()},this.unmount=function(){n.cleanupWindowEvents()},this.update=function(d){n.props=d,ot(n,n.transformState.scale),n.setup=Pr(d)},this.initializeWindowEvents=function(){var d,v,_=_s(),C=(d=n.wrapperComponent)===null||d===void 0?void 0:d.ownerDocument,r=C?.defaultView;(v=n.wrapperComponent)===null||v===void 0||v.addEventListener("wheel",n.onWheelPanning,_),r?.addEventListener("mousedown",n.onPanningStart,_),r?.addEventListener("mousemove",n.onPanning,_),r?.addEventListener("mouseup",n.onPanningStop,_),C?.addEventListener("mouseleave",n.clearPanning,_),r?.addEventListener("keyup",n.setKeyUnPressed,_),r?.addEventListener("keydown",n.setKeyPressed,_)},this.cleanupWindowEvents=function(){var d,v,_=_s(),C=(d=n.wrapperComponent)===null||d===void 0?void 0:d.ownerDocument,r=C?.defaultView;r?.removeEventListener("mousedown",n.onPanningStart,_),r?.removeEventListener("mousemove",n.onPanning,_),r?.removeEventListener("mouseup",n.onPanningStop,_),C?.removeEventListener("mouseleave",n.clearPanning,_),r?.removeEventListener("keyup",n.setKeyUnPressed,_),r?.removeEventListener("keydown",n.setKeyPressed,_),document.removeEventListener("mouseleave",n.clearPanning,_),Re(n),(v=n.observer)===null||v===void 0||v.disconnect()},this.handleInitializeWrapperEvents=function(d){var v=_s();d.addEventListener("wheel",n.onWheelZoom,v),d.addEventListener("dblclick",n.onDoubleClick,v),d.addEventListener("touchstart",n.onTouchPanningStart,v),d.addEventListener("touchmove",n.onTouchPanning,v),d.addEventListener("touchend",n.onTouchPanningStop,v)},this.handleInitialize=function(d,v){var _=!1,C=n.setup.centerOnInit,r=function(o,u){for(var f=0,a=o;f<a.length;f++){var p=a[f];if(p.target===u)return!0}return!1};n.applyTransformation(),n.onInitCallbacks.forEach(function(o){o(de(n))}),n.observer=new ResizeObserver(function(o){if(r(o,d)||r(o,v))if(C&&!_){var u=v.offsetWidth,f=v.offsetHeight;(u>0||f>0)&&(_=!0,n.setCenter())}else Re(n),ot(n,n.transformState.scale),Qs(n,0)}),n.observer.observe(d),n.observer.observe(v)},this.onWheelZoom=function(d){var v=n.setup.disabled;if(!v){var _=th(n,d);if(_){var C=n.isPressingKeys(n.setup.wheel.activationKeys);C&&(uh(n,d),fh(n,d),mh(n,d))}}},this.onWheelPanning=function(d){var v=n.setup,_=v.disabled,C=v.wheel,r=v.panning;if(!(!n.wrapperComponent||!n.contentComponent||_||!C.wheelDisabled||r.disabled||!r.wheelPanning||d.ctrlKey)){d.preventDefault(),d.stopPropagation();var o=n.transformState,u=o.positionX,f=o.positionY,a=u-d.deltaX,p=f-d.deltaY,m=r.lockAxisX?u:a,y=r.lockAxisY?f:p,b=n.setup.alignmentAnimation,s=b.sizeX,c=b.sizeY,l=Ge(n,s),h=Ge(n,c);m===u&&y===f||Ki(n,m,y,l,h)}},this.onPanningStart=function(d){var v=n.setup.disabled,_=n.props.onPanningStart;if(!v){var C=Ar(n,d);if(C){var r=n.isPressingKeys(n.setup.panning.activationKeys);r&&(d.button===0&&!n.setup.panning.allowLeftClickPan||d.button===1&&!n.setup.panning.allowMiddleClickPan||d.button===2&&!n.setup.panning.allowRightClickPan||(d.preventDefault(),d.stopPropagation(),Re(n),Lr(n,d),ue(de(n),d,_)))}}},this.onPanning=function(d){var v=n.setup.disabled,_=n.props.onPanning;if(!v){var C=Nr(n);if(C){var r=n.isPressingKeys(n.setup.panning.activationKeys);r&&(d.preventDefault(),d.stopPropagation(),Mr(n,d.clientX,d.clientY),ue(de(n),d,_))}}},this.onPanningStop=function(d){var v=n.props.onPanningStop;n.isPanning&&(Ud(n),ue(de(n),d,v))},this.onPinchStart=function(d){var v=n.setup.disabled,_=n.props,C=_.onPinchingStart,r=_.onZoomStart;if(!v){var o=oh(n,d);o&&(ph(n,d),Re(n),ue(de(n),d,C),ue(de(n),d,r))}},this.onPinch=function(d){var v=n.setup.disabled,_=n.props,C=_.onPinching,r=_.onZoom;if(!v){var o=ah(n);o&&(d.preventDefault(),d.stopPropagation(),gh(n,d),ue(de(n),d,C),ue(de(n),d,r))}},this.onPinchStop=function(d){var v=n.props,_=v.onPinchingStop,C=v.onZoomStop;n.pinchStartScale&&(vh(n),ue(de(n),d,_),ue(de(n),d,C))},this.onTouchPanningStart=function(d){var v=n.setup.disabled,_=n.props.onPanningStart;if(!v){var C=Ar(n,d);if(C){var r=n.lastTouch&&+new Date-n.lastTouch<200&&d.touches.length===1;if(!r){n.lastTouch=+new Date,Re(n);var o=d.touches,u=o.length===1,f=o.length===2;u&&(Re(n),Lr(n,d),ue(de(n),d,_)),f&&n.onPinchStart(d)}}}},this.onTouchPanning=function(d){var v=n.setup.disabled,_=n.props.onPanning;if(n.isPanning&&d.touches.length===1){if(v)return;var C=Nr(n);if(!C)return;d.preventDefault(),d.stopPropagation();var r=d.touches[0];Mr(n,r.clientX,r.clientY),ue(de(n),d,_)}else d.touches.length>1&&n.onPinch(d)},this.onTouchPanningStop=function(d){n.onPanningStop(d),n.onPinchStop(d)},this.onDoubleClick=function(d){var v=n.setup.disabled;if(!v){var _=Sh(n,d);_&&xh(n,d)}},this.clearPanning=function(d){n.isPanning&&n.onPanningStop(d)},this.setKeyPressed=function(d){n.pressedKeys[d.key]=!0},this.setKeyUnPressed=function(d){n.pressedKeys[d.key]=!1},this.isPressingKeys=function(d){return d.length?!!d.find(function(v){return n.pressedKeys[v]}):!0},this.setTransformState=function(d,v,_){var C=n.props.onTransformed;if(!Number.isNaN(d)&&!Number.isNaN(v)&&!Number.isNaN(_)){d!==n.transformState.scale&&(n.transformState.previousScale=n.transformState.scale,n.transformState.scale=d),n.transformState.positionX=v,n.transformState.positionY=_,n.applyTransformation();var r=de(n);n.onChangeCallbacks.forEach(function(o){return o(r)}),ue(r,{scale:d,positionX:v,positionY:_},C)}else console.error("Detected NaN set state values")},this.setCenter=function(){if(n.wrapperComponent&&n.contentComponent){var d=Zi(n.transformState.scale,n.wrapperComponent,n.contentComponent);n.setTransformState(d.scale,d.positionX,d.positionY)}},this.handleTransformStyles=function(d,v,_){return n.props.customTransform?n.props.customTransform(d,v,_):Jd(d,v,_)},this.applyTransformation=function(){if(!(!n.mounted||!n.contentComponent)){var d=n.transformState,v=d.scale,_=d.positionX,C=d.positionY,r=n.handleTransformStyles(_,C,v);n.contentComponent.style.transform=r}},this.getContext=function(){return de(n)},this.onChange=function(d){return n.onChangeCallbacks.has(d)||n.onChangeCallbacks.add(d),function(){n.onChangeCallbacks.delete(d)}},this.onInit=function(d){return n.onInitCallbacks.has(d)||n.onInitCallbacks.add(d),function(){n.onInitCallbacks.delete(d)}},this.init=function(d,v){n.cleanupWindowEvents(),n.wrapperComponent=d,n.contentComponent=v,ot(n,n.transformState.scale),n.handleInitializeWrapperEvents(d),n.handleInitialize(d,v),n.initializeWindowEvents(),n.isInitialized=!0;var _=de(n);ue(_,void 0,n.props.onInit)},this.props=i,this.setup=Pr(this.props),this.transformState=Yi(this.props)}return e})(),ss=pe.createContext(null),wh=function(e,i){return typeof e=="function"?e(i):e},Ch=pe.forwardRef(function(e,i){var n=N.useRef(new yh(e)).current,d=wh(e.children,Vt(n));return N.useImperativeHandle(i,function(){return Vt(n)},[n]),N.useEffect(function(){n.update(e)},[n,e]),pe.createElement(ss.Provider,{value:n},d)});pe.forwardRef(function(e,i){var n=N.useRef(null),d=N.useContext(ss);return N.useEffect(function(){return d.onChange(function(v){if(n.current){var _=0,C=0;n.current.style.transform=d.handleTransformStyles(_,C,1/v.instance.transformState.scale)}})},[d]),pe.createElement("div",Xe({},e,{ref:eh([n,i])}))});function kh(e,i){i===void 0&&(i={});var n=i.insertAt;if(!(typeof document>"u")){var d=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css",n==="top"&&d.firstChild?d.insertBefore(v,d.firstChild):d.appendChild(v),v.styleSheet?v.styleSheet.cssText=e:v.appendChild(document.createTextNode(e))}}var Eh=`.transform-component-module_wrapper__SPB86 {
|
|
30
|
+
position: relative;
|
|
31
|
+
width: -moz-fit-content;
|
|
32
|
+
width: fit-content;
|
|
33
|
+
height: -moz-fit-content;
|
|
34
|
+
height: fit-content;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
37
|
+
-webkit-user-select: none; /* Safari */
|
|
38
|
+
-khtml-user-select: none; /* Konqueror HTML */
|
|
39
|
+
-moz-user-select: none; /* Firefox */
|
|
40
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
41
|
+
user-select: none;
|
|
42
|
+
margin: 0;
|
|
43
|
+
padding: 0;
|
|
44
|
+
transform: translate3d(0, 0, 0);
|
|
45
|
+
}
|
|
46
|
+
.transform-component-module_content__FBWxo {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-wrap: wrap;
|
|
49
|
+
width: -moz-fit-content;
|
|
50
|
+
width: fit-content;
|
|
51
|
+
height: -moz-fit-content;
|
|
52
|
+
height: fit-content;
|
|
53
|
+
margin: 0;
|
|
54
|
+
padding: 0;
|
|
55
|
+
transform-origin: 0% 0%;
|
|
56
|
+
}
|
|
57
|
+
.transform-component-module_content__FBWxo img {
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
}
|
|
60
|
+
`,Br={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo"};kh(Eh);var jh=function(e){var i=e.children,n=e.wrapperClass,d=n===void 0?"":n,v=e.contentClass,_=v===void 0?"":v,C=e.wrapperStyle,r=e.contentStyle,o=e.wrapperProps,u=o===void 0?{}:o,f=e.contentProps,a=f===void 0?{}:f,p=N.useContext(ss),m=p.init,y=p.cleanupWindowEvents,b=N.useRef(null),s=N.useRef(null);return N.useEffect(function(){var c=b.current,l=s.current;return c!==null&&l!==null&&m&&m?.(c,l),function(){y?.()}},[]),pe.createElement("div",Xe({},u,{ref:b,className:"".concat(Ms.wrapperClass," ").concat(Br.wrapper," ").concat(d),style:C}),pe.createElement("div",Xe({},a,{ref:s,className:"".concat(Ms.contentClass," ").concat(Br.content," ").concat(_),style:r}),i))},rn=function(){var e=N.useContext(ss);if(!e)throw new Error("Transform context must be placed inside TransformWrapper");return e},Th=function(){var e=rn();return Vt(e)};function Ah(e){var i=rn(),n=N.useState(e(Ds(i))),d=n[0],v=n[1];return N.useEffect(function(){var _=!0,C=i.onChange(function(r){_&&v(e(Ds(r.instance)))});return function(){C(),_=!1}},[e,i]),d}function Nh(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}function Rh(e,i){return Te({queryKey:oe.files.tree(e||"",i),queryFn:()=>ae.get("/files/tree",{params:{workingDir:e||"",path:i}}),enabled:!!e})}function Lh(e,i){return Te({queryKey:oe.files.content(e||"",i||""),queryFn:()=>ae.get("/files/read",{params:{workingDir:e||"",path:i||""}}),enabled:!!e&&!!i})}function Mh(e){const i=Le();return N.useCallback(()=>{e&&i.invalidateQueries({queryKey:["files","tree",e]})},[i,e])}function Dh(){const e=Le();return Ut({mutationFn:i=>ae.post("/files/write",i),onSuccess:(i,n)=>{const d=oe.files.content(n.workingDir,n.path),v=e.getQueryData(d);e.setQueryData(d,{content:n.content,language:v?.language||Nh(n.path)})}})}function Ph(e,i){return e==="/"?`/${i}`:`${e}/${i}`}function Bh(e,i){return e==="/"?i:`${e.slice(1)}/${i}`}const Or=({depth:e,active:i,onClick:n,leftIcon:d,rightIcon:v,label:_})=>t.jsxs("button",{type:"button",onClick:n,"aria-current":i||void 0,className:Q("w-full flex items-center gap-2 rounded-md px-2 py-1 text-left text-xs transition-colors outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/60",i?"bg-foreground/[0.06] font-medium text-foreground":"text-foreground/90 hover:bg-accent"),style:{paddingLeft:8+e*14},children:[t.jsx("span",{className:"shrink-0",children:v}),t.jsx("span",{className:"shrink-0 text-muted-foreground",children:d}),t.jsx("span",{className:"truncate",children:_})]}),nn=({workingDir:e,path:i,depth:n,expanded:d,toggleDir:v,onFileSelect:_,selectedFilePath:C})=>{const{t:r}=re(),{data:o,isLoading:u,isError:f}=Rh(e,i),a=N.useMemo(()=>o?.items??[],[o?.items]);return u?t.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1",style:{paddingLeft:8+n*14},children:r("Loading...")}):f?t.jsx("div",{className:"text-xs text-destructive-ink px-2 py-1",style:{paddingLeft:8+n*14},children:r("Failed to load")}):t.jsx("div",{className:"space-y-0.5",children:a.map(p=>{if(p.type==="directory"){const b=Ph(i,p.name),s=d.has(b);return t.jsxs("div",{children:[t.jsx(Or,{depth:n,onClick:()=>v(b),rightIcon:s?t.jsx(ze,{size:14,className:"text-muted-foreground/70"}):t.jsx(Ye,{size:14,className:"text-muted-foreground/70"}),leftIcon:s?t.jsx(ci,{size:14}):t.jsx(Ws,{size:14}),label:p.name}),s&&t.jsx(nn,{workingDir:e,path:b,depth:n+1,expanded:d,toggleDir:v,onFileSelect:_,selectedFilePath:C})]},b)}const m=Bh(i,p.name),y=C===m;return t.jsx(Or,{depth:n,active:y,onClick:()=>_(m),rightIcon:t.jsx("span",{className:"inline-block w-[14px]"}),leftIcon:t.jsx(yo,{name:p.name}),label:p.name},m)})})},Oh=({workingDir:e,className:i,onFileSelect:n,selectedFilePath:d,onCollapse:v})=>{const{t:_}=re(),[C,r]=N.useState(()=>new Set),o=Mh(e),u=N.useCallback(f=>{r(a=>{const p=new Set(a);return p.has(f)?p.delete(f):p.add(f),p})},[]);return t.jsxs("div",{className:Q("h-full flex flex-col",i),children:[t.jsxs("div",{className:"px-3 py-2 border-b border-border bg-muted/40 flex items-center justify-between",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:_("Files")}),e?t.jsx("div",{title:e,className:"truncate font-mono text-[11px] text-muted-foreground",children:e}):t.jsx("div",{className:"truncate text-xs text-muted-foreground",children:_("No working directory")})]}),t.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e&&t.jsx(Fe,{size:"xs",label:_("Refresh file tree"),onClick:o,children:t.jsx(vt,{})}),v&&t.jsx(Fe,{size:"xs",label:_("Collapse file tree"),onClick:v,children:t.jsx(ma,{})})]})]}),t.jsx("div",{className:"flex-1 overflow-auto scrollbar-app-thin p-2",children:e?t.jsx(nn,{workingDir:e,path:"/",depth:0,expanded:C,toggleDir:u,onFileSelect:n,selectedFilePath:d}):t.jsx("div",{className:"text-xs text-muted-foreground px-2 py-2",children:_("No workspace selected.")})})]})},Ih=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function Fh(e){const i=e.split(".").pop()?.toLowerCase();return i?Ih.has(i):!1}function Hh(e,i){const n=Fs(),d=new URLSearchParams({workingDir:e,path:i});return`${n}/files/image?${d.toString()}`}const zh=({filePath:e})=>{const{t:i}=re(),{zoomIn:n,zoomOut:d,centerView:v}=Th(),_=Ah(r=>r.state.scale),C=Math.round(_*100);return t.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-border bg-muted/40 shrink-0",children:[t.jsx(Fe,{size:"xs",label:i("Zoom out"),onClick:()=>d(.5),children:t.jsx(ja,{})}),t.jsxs(ve,{variant:"ghost",size:"xs",className:"min-w-10 tabular-nums",onClick:()=>v(1),title:i("Reset zoom"),children:[C,"%"]}),t.jsx(Fe,{size:"xs",label:i("Zoom in"),onClick:()=>n(.5),children:t.jsx(ka,{})}),t.jsx(Fe,{size:"xs",label:i("Fit to view"),className:"ml-1",onClick:()=>v(1),children:t.jsx(ua,{})}),t.jsx("span",{title:e,className:"ml-2 truncate font-mono text-[11px] text-muted-foreground",children:e})]})},Wh=({workingDir:e,filePath:i})=>{const{t:n}=re(),[d,v]=N.useState(!1),_=Hh(e,i);return d?t.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:n("Failed to load image.")}):t.jsx(Ch,{initialScale:1,minScale:.1,maxScale:10,centerOnInit:!0,doubleClick:{mode:"toggle"},children:t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx(zh,{filePath:i}),t.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-[repeating-conic-gradient(#f3f3f3_0%_25%,#fff_0%_50%)] bg-[length:16px_16px]",children:t.jsx(jh,{wrapperStyle:{width:"100%",height:"100%"},contentStyle:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:t.jsx("img",{src:_,alt:i,className:"max-w-full max-h-full object-contain rounded shadow-raised",draggable:!1,onError:()=>v(!0)})})})]})})};function $h(e){const i=e.split("/");return i[i.length-1]||e}function Uh(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}const qh=({active:e,name:i,isDirty:n,onClick:d,onClose:v})=>{const{t:_}=re();return t.jsxs("button",{type:"button",onClick:d,className:Q("group flex items-center gap-2 px-3 py-2 rounded-t-md border-t border-x -mb-px min-w-[120px] max-w-[240px] outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/60",e?"bg-background border-border text-foreground":"bg-foreground/[0.03] border-transparent text-muted-foreground hover:text-foreground hover:bg-foreground/[0.05]"),children:[t.jsx("span",{className:Q("w-2 h-2 rounded-full",n?"bg-warning":"bg-transparent")}),t.jsx("span",{className:"truncate flex-1 text-left text-xs",children:i}),t.jsx("span",{onClick:v,className:"opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 pointer-coarse:opacity-100 p-0.5 hover:bg-foreground/[0.08] rounded transition-all shrink-0","aria-label":_("Close tab"),title:_("Close"),children:t.jsx(Qe,{size:12})})]})},Kh=pe.forwardRef(function({workingDir:i,className:n,readOnly:d=!1},v){const{t:_}=re(),[C,r]=N.useState([]),[o,u]=N.useState(null),[f,a]=N.useState(!1),[p,m]=N.useState(!1),[y,b]=N.useState(0),[s,c]=N.useState(null),l=N.useRef(null),h=Dh();N.useEffect(()=>{let U=!1;return Bn(async()=>{const{preloadMonaco:z}=await import("./monaco-yuGji-2E.js").then(W=>W.m);return{preloadMonaco:z}},__vite__mapDeps([0,1,2,3])).then(({preloadMonaco:z})=>z()).then(()=>{U||a(!0)}).catch(()=>{U||m(!0)}),()=>{U=!0}},[]);const[g,S]=N.useState(280),[k,E]=N.useState(!1),[x,w]=N.useState(!1),A=N.useRef(280),L=N.useCallback(()=>{E(U=>(U?S(A.current):A.current=g,!U))},[g]),R=N.useCallback(U=>{U.preventDefault(),w(!0);const z=U.clientX,W=g,j=X=>{const Y=X.clientX-z,ee=Math.min(480,Math.max(160,W+Y));S(ee)},F=()=>{w(!1),document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",F)};document.addEventListener("mousemove",j),document.addEventListener("mouseup",F)},[g]);N.useEffect(()=>{r([]),u(null),c(null)},[i]);const M=N.useMemo(()=>C.find(U=>U.path===o)||null,[C,o]),{data:I,isFetching:P,isError:H,error:$}=Lh(i,M?.isImage?null:o);N.useEffect(()=>{!o||!I||r(U=>U.map(z=>z.path!==o||z.isDirty||z.loaded?z:{...z,language:I.language||z.language,content:I.content,savedContent:I.content,isDirty:!1,loaded:!0}))},[o,I]);const T=N.useCallback((U,z,W)=>{r(j=>{if(j.find(Y=>Y.path===U))return j;const X=Fh(U);return[...j,{path:U,name:$h(U),language:Uh(U),content:"",savedContent:"",isDirty:!1,loaded:X,isImage:X}]}),u(U),c(z?{path:U,line:z,column:W}:null)},[]);pe.useImperativeHandle(v,()=>({openFile:T}),[T]);const O=N.useCallback(U=>{r(z=>{const W=z.filter(j=>j.path!==U);return u(j=>j!==U?j:W.length?W[W.length-1].path:null),W})},[]),D=N.useCallback(U=>{r(z=>z.map(W=>{if(W.path!==o)return W;const j=U!==W.savedContent;return{...W,content:U,isDirty:j}}))},[o]),B=N.useCallback(async()=>{d||!i||!M||(await h.mutateAsync({workingDir:i,path:M.path,content:M.content}),r(U=>U.map(z=>z.path===M.path?{...z,savedContent:z.content,isDirty:!1,loaded:!0}:z)))},[M,d,h,i]),q=N.useRef(()=>{});N.useEffect(()=>{q.current=()=>{B().catch(()=>{})}},[B]),N.useEffect(()=>{const U=z=>{d||(z.metaKey||z.ctrlKey)&&z.key.toLowerCase()==="s"&&(z.preventDefault(),q.current())};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[d]);const K=N.useCallback((U,z)=>{l.current=U,b(W=>W+1),U.addCommand(z.KeyMod.CtrlCmd|z.KeyCode.KeyS,()=>{q.current()})},[]);return N.useEffect(()=>{if(!s||s.path!==o||!M?.loaded)return;const U=l.current,z=U?.getModel();if(!U||!z)return;const W=Math.min(s.line,z.getLineCount()),j=Math.min(s.column??1,z.getLineMaxColumn(W)),F={lineNumber:W,column:j};U.setPosition(F),U.revealPositionInCenter(F),U.focus(),c(null)},[o,M?.loaded,y,s]),t.jsxs("div",{className:Q("flex h-full overflow-hidden bg-background",n),style:x?{userSelect:"none",cursor:"col-resize"}:void 0,children:[t.jsx("div",{className:"border-r border-border bg-background shrink-0 overflow-hidden relative",style:{width:k?36:g,transition:x?"none":"width 0.15s ease"},children:k?t.jsx("div",{className:"h-full flex items-start pt-2 justify-center",children:t.jsx(Fe,{size:"sm",label:_("Expand file tree"),onClick:L,children:t.jsx(ga,{className:"size-4"})})}):t.jsx(t.Fragment,{children:t.jsx(Oh,{workingDir:i,onFileSelect:T,selectedFilePath:M?.path||null,onCollapse:L},i||"no-working-dir")})}),!k&&t.jsx("div",{onMouseDown:R,className:Q("w-1 shrink-0 cursor-col-resize transition-colors",x?"bg-ring/40":"bg-transparent hover:bg-border")}),t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1 px-2 pt-2 border-b border-border bg-muted overflow-x-auto shrink-0",children:[C.length===0?t.jsx("div",{className:"px-2 pb-2 text-xs text-muted-foreground",children:_("No open files")}):C.map(U=>t.jsx(qh,{active:U.path===o,name:U.name,isDirty:U.isDirty,onClick:()=>u(U.path),onClose:z=>{z.stopPropagation(),O(U.path)}},U.path)),t.jsxs("div",{className:"ml-auto flex items-center gap-2 pb-2 pr-1",children:[d&&t.jsx("span",{className:"text-xs text-muted-foreground",children:_("Read-only")}),h.isPending&&t.jsxs("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(_e,{}),_("Saving")]}),M?.isDirty&&!h.isPending&&t.jsx("span",{className:"text-xs text-warning-ink",children:_("Unsaved")})]})]}),t.jsx("div",{className:"flex-1 min-h-0 relative",children:i?M?M.isImage?t.jsx(Wh,{workingDir:i,filePath:M.path}):p?t.jsx("div",{className:"h-full flex items-center justify-center text-destructive-ink text-sm",children:_("Failed to load editor.")}):f?t.jsxs(t.Fragment,{children:[t.jsx(pd,{path:M.path,value:M.content,language:M.language,theme:"vs-light",height:"100%",onChange:d?void 0:U=>D(U??""),onMount:K,options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"off",automaticLayout:!0,readOnly:d}}),P&&!M.loaded&&t.jsx("div",{className:"absolute inset-0 bg-background/60 flex items-center justify-center",children:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx(_e,{}),_("Loading file...")]})}),H&&t.jsx("div",{className:"absolute bottom-2 left-2 right-2 rounded-md bg-background shadow-raised",children:t.jsxs(Ve,{tone:"danger",size:"sm",children:[_("Failed to load file"),$ instanceof Error?`: ${$.message}`:""]})})]}):t.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:[t.jsx(_e,{className:"mr-2"}),_("Loading editor...")]}):t.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:_("Select a file from the tree to open.")}):t.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:_("No workspace selected.")})})]})]})});function Xh(e,i={}){const n=Qt(v=>v.visibleContext),d=gi(e,n);return Te({queryKey:oe.git.changes(e||""),queryFn:()=>ae.get("/git/changes",{params:{workingDir:e||""}}),enabled:!!e&&(i.enabled??!0),refetchInterval:d,refetchIntervalInBackground:!1,refetchOnWindowFocus:d?"always":!1,refetchOnReconnect:d?"always":!1})}function Yh(e,i,n){const d=Qt(_=>_.visibleContext),v=gi(e,d);return Te({queryKey:oe.git.diff(e||"",i||"",n),queryFn:()=>ae.get("/git/diff",{params:{workingDir:e||"",path:i||"",type:n}}),enabled:!!e&&!!i,refetchInterval:v,refetchIntervalInBackground:!1,refetchOnWindowFocus:v?"always":!1,refetchOnReconnect:v?"always":!1})}function on(e,i){return Te({queryKey:oe.git.commitFiles(e||"",i||""),queryFn:()=>ae.get("/git/commit-files",{params:{workingDir:e||"",hash:i||""}}),enabled:!!e&&!!i})}function an(e,i,n){return Te({queryKey:oe.git.commitDiff(e||"",i||"",n||""),queryFn:()=>ae.get("/git/commit-diff",{params:{workingDir:e||"",hash:i||"",path:n||""}}),enabled:!!e&&!!i&&!!n})}const Vh=new Set(["STARTING","RUNNING","STOPPING"]);function ln(e){return Vh.has(e.runtimeState)||e.runtimeInstanceId!==null}function cn(e){return e instanceof at&&e.status===409&&e.details.code==="WORKSPACE_HAS_ACTIVE_SERVICE"}const Ir="h-6 min-w-0 truncate rounded-md bg-foreground/[0.05] px-2 font-mono text-xs leading-6 text-foreground/85";function Gh({from:e,to:i}){return t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx("span",{title:e,className:Ir,children:e}),t.jsx(yi,{size:14,className:"shrink-0 text-muted-foreground/70"}),t.jsx("span",{title:i,className:Ir,children:i})]})}function Qh({services:e,isLoading:i,isError:n}){const{t:d}=re();return i?t.jsx(_e,{size:"xs",label:d("正在检查后台服务..."),className:"text-xs"}):e.length>0?t.jsxs(Ve,{tone:"warning",title:d("合并前将停止 {count} 个后台服务",{count:e.length}),children:[t.jsx("p",{className:"break-all font-mono text-xs",children:e.map(v=>v.name).join(", ")}),t.jsx("p",{className:"mt-1",children:d("停止后不会自动恢复。")})]}):n?t.jsx("p",{className:"text-xs text-warning-ink",role:"status",children:d("无法检查后台服务状态,提交时会再次确认。")}):null}const Zh={INVALID_BASE_BRANCH:"Choose an existing local branch different from the workspace branch.",BASE_BRANCH_UNRELATED:"The selected branch has no shared commit history with this workspace.",WORKSPACE_BASE_BRANCH_BUSY:"Wait for the Agent to finish or stop it before changing the base branch.",WORKSPACE_GIT_OPERATION_IN_PROGRESS:"Finish or abort the current Git operation before changing the base branch.",WORKSPACE_BASE_BRANCH_CHANGED:"The workspace changed. Refresh and select the base branch again.",INVALID_WORKSPACE_STATE:"Only active workspaces can change base branch. Refresh the list.",WORKSPACE_BASE_BRANCH_MANAGED:"TeamRun member base branches are managed by their parent workspace."};function dn(e){return e.isOpen?t.jsx(Jh,{...e},e.workspaceId):null}function Jh({isOpen:e,onClose:i,onBaseBranchSaved:n,projectId:d,workspaceId:v,branchName:_,targetBranch:C,commitMessage:r,isPending:o,canMerge:u,activeServices:f,isCheckingServices:a,serviceCheckFailed:p,error:m,onConfirm:y}){const{t:b}=re(),s=N.useId(),c=Do(d),l=Po(),h=c.data?.workspaces.find(T=>T.id===v),g=h?.baseBranch||c.data?.mainBranch||C,[S,k]=N.useState(null),E=S??g,x=c.data?.branches.filter(T=>T!==_)??[],w=!!h&&E!==g,A=o||l.isPending,L=c.isPending||c.isFetching||c.isError,R=l.error instanceof at?String(l.error.details.code):"",[M,I]=N.useState(null),P=M??r??"",H=()=>{A||i()},$=async()=>{if(!(!h||!w))try{await l.mutateAsync({id:v,baseBranch:E,expectedBaseBranch:h.baseBranch}),ke.success(b("Workspace base branch saved. Review the changes before merging.")),i(),n?.()}catch{}};return t.jsx(At,{isOpen:e,onClose:H,title:b("提交变更"),className:"max-w-md",action:t.jsxs(t.Fragment,{children:[t.jsx(ve,{variant:"ghost",onClick:H,disabled:A,children:b("取消")}),t.jsx(ve,{variant:"primary",onClick:()=>y(P.trim()||void 0,f.length>0),disabled:A||a||L||w||!u,loading:o||a,children:o||a?a?b("正在检查后台服务..."):f.length>0?b("正在停止服务并提交..."):b("正在提交..."):t.jsxs(t.Fragment,{children:[t.jsx($s,{}),f.length>0?b("停止服务并提交"):b("确认提交")]})})]}),children:t.jsxs("div",{className:"space-y-4",children:[t.jsx(Gh,{from:_,to:h?g:C}),c.isPending?t.jsx("p",{className:"text-xs text-muted-foreground",children:b("Loading...")}):c.isError?t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{role:"alert",className:"text-xs text-destructive-ink",children:b("Could not load branches. Refresh to try again.")}),t.jsx(ve,{size:"sm",onClick:()=>{c.refetch()},children:b("Refresh")})]}):h&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:s,className:"block text-[13px] font-medium text-foreground",children:b("Base branch for this workspace")}),t.jsx(Bo,{id:s,label:b("Base branch for this workspace"),value:E,branches:x,disabled:A,isRefreshing:c.isFetching,onOpen:()=>{c.refetch()},onChange:T=>{k(T),l.reset()}}),t.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:b("Changing this base branch updates the comparison, update and merge target for this workspace only. Save and review the changes before merging.")}),w&&t.jsx(ve,{variant:"primary",size:"sm",onClick:()=>{$()},disabled:A||L||!x.includes(E),children:l.isPending?b("Saving"):b("Save base branch and review changes")}),l.isError&&t.jsx("p",{role:"alert",className:"text-xs text-destructive-ink",children:b(Zh[R]??"Could not save the base branch. Refresh and try again.")})]}),!u&&t.jsx("p",{className:"text-xs text-muted-foreground",children:b("Review the changes and sync the base branch before submitting.")}),t.jsx(di,{label:b("提交消息"),description:t.jsxs(t.Fragment,{children:[b("建议以 feat、fix、docs、refactor、chore 开头,保持提交记录清晰。feat 新增功能,fix 修复问题,docs 文档更新,refactor 代码重构,chore 日常维护。"),!P.trim()&&t.jsx("span",{className:"mt-1 block",children:b("留空将使用默认消息")})]}),children:t.jsx(wo,{value:P,onChange:T=>I(T.target.value),placeholder:b("请描述本次修改的内容"),minRows:4,className:"font-mono"})}),t.jsx(Qh,{services:f,isLoading:a,isError:p}),m&&t.jsx(Ve,{tone:"danger",children:m})]})})}function it(e,i){const n=e[i];return typeof n=="string"&&n.length>0?n:void 0}function hn(e){if(!(e instanceof at)||e.status!==409)return;const i=e.details;if(i.code!=="MERGE_CONFLICT"||i.conflictOp!==Ct.REBASE&&i.conflictOp!==Ct.MERGE||!Array.isArray(i.conflictedFiles)||!i.conflictedFiles.every(d=>typeof d=="string"))return;const n=i.mergeStrategy==="squash"||i.mergeStrategy==="no_ff"?i.mergeStrategy:void 0;return{conflictOp:i.conflictOp,conflictedFiles:i.conflictedFiles,mergeAborted:typeof i.mergeAborted=="boolean"?i.mergeAborted:void 0,mergeStrategy:n,sourceBranch:it(i,"sourceBranch"),targetBranch:it(i,"targetBranch"),sourceWorktreePath:it(i,"sourceWorktreePath"),targetWorktreePath:it(i,"targetWorktreePath"),sourceWorkspaceId:it(i,"sourceWorkspaceId"),targetWorkspaceId:it(i,"targetWorkspaceId"),resolutionContextToken:it(i,"resolutionContextToken")}}function Fr(e,i,n,d){const v=hn(e);if(v){n(v);return}d(e instanceof Error?e.message:i)}function eu({projectId:e,workspaceId:i,branchName:n,targetBranch:d,commitMessage:v,committedFileCount:_,onRefreshCommitMessage:C,onConflict:r,onResolveConflicts:o}){const{t:u}=re(),{data:f,isLoading:a}=Oo(i),p=vi(),m=_i(),y=bi(),[b,s]=N.useState(!1),[c,l]=N.useState(null),h=Vs(i,b),g=(h.data??[]).filter(ln);if(N.useEffect(()=>{b&&C?.()},[b,C]),a||!f)return t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-muted-foreground border-b border-border/60",children:[t.jsx(_e,{}),t.jsx("span",{className:"text-xs",children:u("正在检查工作区状态...")})]});const S=f.conflictedFiles.length>0,k=f.operation!=="idle",E=f.hasUncommittedChanges||f.untrackedCount>0,x=f.uncommittedCount+f.untrackedCount,w=!S&&!k&&!E,A=!E,L=f.operation==="idle"&&f.ahead===0&&f.behind===0&&!E&&!S,R=()=>{l(null),p.mutate(i,{onError:H=>{Fr(H,u("更新失败,请稍后重试"),$=>r($),l)}})},M=()=>{l(null),s(!0)},I=(H,$)=>{l(null),m.mutate({id:i,commitMessage:H,stopActiveServices:$},{onSuccess:()=>s(!1),onError:T=>{if(cn(T)){l(u("后台服务仍在运行,请确认停止服务后再提交。"));return}Fr(T,u("提交失败,请稍后重试"),O=>{s(!1),r(O)},l)}})},P=()=>{m.isPending||(s(!1),l(null))};return L?t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-muted-foreground border-b border-border/60",children:[t.jsx(On,{size:13,className:"shrink-0 text-muted-foreground/70"}),t.jsx("span",{className:"text-xs",children:u("当前分支还没有任何变更")})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border-b border-border bg-background",children:t.jsxs("div",{className:"px-3 py-2",children:[c&&t.jsx(Ve,{tone:"danger",size:"sm",className:"mb-2",children:c}),E&&t.jsx(Ve,{tone:"warning",size:"sm",icon:t.jsx(ca,{}),className:"mb-2",children:u("{count} 个本地改动未处理,需要先整理后再继续",{count:x})}),S&&t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-foreground",children:[t.jsx(Tt,{size:13,className:"shrink-0 text-warning"}),t.jsx("span",{children:u("{count} 个文件存在冲突,需要处理后继续",{count:f.conflictedFiles.length})})]}),t.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[t.jsx(ve,{variant:"primary",size:"sm",onClick:o,children:u("处理冲突")}),t.jsx(ve,{variant:"secondary",size:"sm",onClick:()=>y.mutate(i),loading:y.isPending,children:y.isPending?u("正在撤销..."):u("撤销操作")})]})]}),k&&!S&&t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-foreground",children:[t.jsx(_e,{size:"xs",className:"text-info"}),t.jsx("span",{children:f.operation==="rebase"?u("正在同步源分支更新..."):u("正在提交变更...")})]}),t.jsxs(ve,{variant:"secondary",size:"sm",className:"ml-auto",onClick:()=>y.mutate(i),loading:y.isPending,children:[!y.isPending&&t.jsx(Gr,{}),y.isPending?u("正在撤销..."):u("撤销操作")]})]}),!S&&!k&&(f.behind>0||f.ahead>0)&&t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[f.behind>0&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:u("源分支 {branch} 有 {count} 个更新",{branch:d,count:f.behind})}),t.jsxs(ve,{variant:"primary",size:"sm",onClick:R,disabled:!w,loading:p.isPending,children:[!p.isPending&&t.jsx(vt,{}),p.isPending?u("正在同步..."):u("同步更新")]})]}),f.ahead>0&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:u("{count} 个文件变更,可以安全提交",{count:_??f.ahead})}),t.jsx("span",{title:A?void 0:u("需要先处理本地改动"),className:Q("inline-flex",!A&&"cursor-not-allowed"),children:t.jsxs(ve,{variant:"primary",size:"sm",onClick:M,disabled:!A||m.isPending,children:[t.jsx($s,{}),u("提交变更")]})})]})]})]})}),t.jsx(dn,{projectId:e,workspaceId:i,canMerge:w&&f.ahead>0&&f.behind===0,isOpen:b,onClose:P,branchName:n,targetBranch:d,commitMessage:v,isPending:m.isPending,activeServices:g,isCheckingServices:h.isLoading,serviceCheckFailed:h.isError,error:c,onConfirm:I})]})}const un=({line:e,lineNum:i})=>{let n="",d="text-foreground/90";return e.startsWith("+")&&!e.startsWith("+++")?n="bg-success/10":e.startsWith("-")&&!e.startsWith("---")?n="bg-destructive/10":e.startsWith("@@")?(n="bg-info/5",d="text-info-ink"):(e.startsWith("diff ")||e.startsWith("index "))&&(d="text-muted-foreground"),t.jsxs("div",{className:Q("flex",n),children:[t.jsx("span",{"aria-hidden":"true",className:"w-10 shrink-0 select-none border-r border-border/60 pr-2 text-right text-muted-foreground/50",children:i}),t.jsx("span",{className:Q("whitespace-pre pl-2",d),children:e})]})},bs=50,xs=400;function fn(e){const i=e.split("/");return i[i.length-1]||e}function tu(e){const i=e.lastIndexOf("/");return i>0?e.slice(0,i):""}function su(e){const n=Math.floor(Date.now()/1e3)-e;return n<60?Ue("{count}s ago",{count:n}):n<3600?Ue("{count}m ago",{count:Math.floor(n/60)}):n<86400?Ue("{count}h ago",{count:Math.floor(n/3600)}):n<604800?Ue("{count}d ago",{count:Math.floor(n/86400)}):new Date(e*1e3).toLocaleDateString()}function $t(e,i){return e.kind==="working"?`${e.diffType}:${i}`:`${e.hash}:${i}`}const Bs=({additions:e,deletions:i,className:n})=>e===void 0&&i===void 0?null:t.jsx(Qr,{additions:e,deletions:i,className:n}),mn=({diff:e})=>{const{t:i}=re(),[n,d]=N.useState(!1),v=N.useMemo(()=>e.split(`
|
|
61
|
+
`),[e]);if(!e.trim())return t.jsx("div",{className:"py-6 text-center text-muted-foreground text-xs",children:i("没有可显示的差异内容")});const _=!n&&v.length>xs,C=_?v.slice(0,xs):v;return t.jsxs("div",{className:"overflow-x-auto scrollbar-app-thin font-mono text-xs leading-5",children:[C.map((r,o)=>t.jsx(un,{line:r,lineNum:o+1},o)),_&&t.jsx("button",{type:"button",onClick:()=>d(!0),className:"w-full py-2 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:i("还有 {count} 行变更被折叠,点击展开全部",{count:v.length-xs})})]})},ru=({workingDir:e,path:i,diffType:n,enabled:d})=>{const{t:v}=re(),{data:_,isLoading:C,isError:r}=Yh(e,d?i:null,n);return!d||C?t.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-muted-foreground",children:[t.jsx(_e,{size:"sm"}),t.jsx("span",{className:"text-xs",children:v("正在加载差异...")})]}):r?t.jsx("div",{className:"py-6 text-center text-destructive-ink text-xs",children:v("差异加载失败")}):t.jsx(mn,{diff:_?.diff||""})},iu=({workingDir:e,hash:i,path:n,enabled:d})=>{const{t:v}=re(),{data:_,isLoading:C,isError:r}=an(e,d?i:null,d?n:null);return!d||C?t.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-muted-foreground",children:[t.jsx(_e,{size:"sm"}),t.jsx("span",{className:"text-xs",children:v("正在加载差异...")})]}):r?t.jsx("div",{className:"py-6 text-center text-destructive-ink text-xs",children:v("差异加载失败")}):t.jsx(mn,{diff:_?.diff||""})},Ss=({entry:e,source:i,workingDir:n,flash:d,registerNode:v})=>{const[_,C]=N.useState(!1),[r,o]=N.useState(!1),u=N.useRef(null),f=$t(i,e.path);N.useEffect(()=>(v(f,u.current),()=>v(f,null)),[f,v]),N.useEffect(()=>{const p=u.current;if(!p||r)return;const m=new IntersectionObserver(y=>{y.some(b=>b.isIntersecting)&&(o(!0),m.disconnect())},{rootMargin:"300px 0px"});return m.observe(p),()=>m.disconnect()},[r]);const a=tu(e.path);return t.jsxs("div",{ref:u,"data-card-key":f,className:Q("rounded-md border border-border bg-background overflow-hidden transition-shadow",d&&"ring-2 ring-info/40"),children:[t.jsxs("button",{type:"button",onClick:()=>C(p=>!p),className:"w-full flex items-center gap-2 px-3 py-2 bg-muted/40 hover:bg-muted/70 transition-colors text-left",children:[_?t.jsx(Ye,{size:13,className:"text-muted-foreground/70 shrink-0"}):t.jsx(ze,{size:13,className:"text-muted-foreground/70 shrink-0"}),t.jsx(hi,{status:e.status}),t.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:fn(e.path)}),a&&t.jsx("span",{className:"font-mono text-[11px] text-muted-foreground truncate",children:a}),t.jsx("span",{className:"ml-auto"}),t.jsx(Bs,{additions:e.additions,deletions:e.deletions})]}),!_&&t.jsx("div",{className:"border-t border-border/60",children:i.kind==="working"?t.jsx(ru,{workingDir:n,path:e.path,diffType:i.diffType,enabled:r}):t.jsx(iu,{workingDir:n,hash:i.hash,path:e.path,enabled:r})})]})};function nu(e){const i={name:"",path:"",dirs:new Map,files:[]};for(const n of e){const d=n.path.split("/");let v=i;for(let _=0;_<d.length-1;_++){const C=d[_];v.dirs.has(C)||v.dirs.set(C,{name:C,path:v.path?`${v.path}/${C}`:C,dirs:new Map,files:[]}),v=v.dirs.get(C)}v.files.push(n)}return pn(i)}function pn(e){const i=new Map;for(const n of e.dirs.values()){let d=pn(n);for(;d.dirs.size===1&&d.files.length===0;){const v=[...d.dirs.values()][0];d={...v,name:`${d.name}/${v.name}`}}i.set(d.name,d)}return{...e,dirs:i}}const ou=({dir:e,depth:i,activeKey:n,onSelect:d})=>{const[v,_]=N.useState(!0);return t.jsxs("div",{children:[t.jsxs("button",{type:"button",onClick:()=>_(C=>!C),className:"flex items-center gap-1.5 w-full px-2 py-1 rounded-sm hover:bg-muted/60 text-left",style:{paddingLeft:8+i*12},children:[v?t.jsx(ci,{size:12,className:"text-muted-foreground/70 shrink-0"}):t.jsx(Ws,{size:12,className:"text-muted-foreground/70 shrink-0"}),t.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:e.name})]}),v&&t.jsx(gn,{node:e,depth:i+1,activeKey:n,onSelect:d})]})},gn=({node:e,depth:i,activeKey:n,onSelect:d})=>t.jsxs(t.Fragment,{children:[[...e.dirs.values()].sort((v,_)=>v.name.localeCompare(_.name)).map(v=>t.jsx(ou,{dir:v,depth:i,activeKey:n,onSelect:d},v.path)),e.files.slice().sort((v,_)=>v.path.localeCompare(_.path)).map(v=>{const _=n===v.cardKey;return t.jsxs("button",{type:"button",onClick:()=>d(v),className:Q("flex items-center gap-1.5 w-full px-2 py-1 rounded-sm text-left",_?"bg-muted":"hover:bg-muted/60"),style:{paddingLeft:8+i*12},title:v.path,children:[t.jsx("span",{className:Q("w-1.5 h-1.5 rounded-full shrink-0",In[Co(v.status)])}),t.jsx("span",{className:Q("text-xs truncate",_?"text-foreground font-medium":"text-foreground/90"),children:fn(v.path)})]},v.cardKey)})]}),au=({workingDir:e,selectedHash:i,onSelectCommit:n})=>{const{t:d}=re(),{data:v,isLoading:_,fetchNextPage:C,hasNextPage:r,isFetchingNextPage:o}=Hs({queryKey:oe.git.log(e),queryFn:({pageParam:f=0})=>ae.get("/git/log",{params:{workingDir:e,limit:String(bs),skip:String(f)}}),initialPageParam:0,getNextPageParam:(f,a)=>f.commits.length<bs?void 0:a.length*bs}),u=v?.pages.flatMap(f=>f.commits)||[];return _?t.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 text-muted-foreground text-xs",children:[t.jsx(_e,{size:"xs"}),t.jsx("span",{children:d("正在加载提交记录...")})]}):u.length===0?t.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:d("暂无提交记录")}):t.jsxs("div",{className:"space-y-px px-1.5 pb-1.5",children:[u.map(f=>{const a=i===f.hash;return t.jsxs("button",{type:"button",onClick:()=>n(f),className:Q("flex items-start gap-1.5 w-full px-1.5 py-1 rounded-sm text-left group",a?"bg-muted":"hover:bg-muted/60"),title:f.message,children:[t.jsx("span",{className:Q("w-1.5 h-1.5 rounded-full mt-1.5 shrink-0 transition-colors",a?"bg-primary":"bg-border group-hover:bg-muted-foreground/60")}),t.jsxs("span",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:Q("block text-xs truncate",a?"text-foreground font-medium":"text-foreground/90"),children:f.message}),t.jsxs("span",{className:"block text-[11px] text-muted-foreground truncate",children:[t.jsx("span",{className:"font-mono",children:f.shortHash})," · ",f.author," · ",su(f.timestamp)]})]})]},f.hash)}),r&&t.jsx("button",{type:"button",onClick:()=>C(),disabled:o,className:"w-full py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/60 rounded-sm transition-colors flex items-center justify-center gap-1.5",children:o?t.jsxs(t.Fragment,{children:[t.jsx(_e,{size:"xs"})," ",d("正在加载...")]}):d("加载更多提交")})]})},lu=({projectId:e,workingDir:i,workspaceId:n,branchName:d,targetBranch:v,commitMessage:_,canRunGitOperations:C,onRefreshCommitMessage:r,onConflict:o,onResolveConflicts:u})=>{const{t:f}=re(),[a,p]=N.useState({kind:"overview"}),[m,y]=N.useState(""),[b,s]=N.useState(null),[c,l]=N.useState(null),{data:h,isLoading:g,isError:S}=Xh(i),k=a.kind==="commit"?a.commit.hash:null,{data:E,isLoading:x}=on(i,k),w=N.useRef(new Map),A=N.useRef(null),L=N.useRef(null),R=N.useCallback((z,W)=>{W?w.current.set(z,W):w.current.delete(z)},[]),{uncommitted:M,committed:I,commitFiles:P}=N.useMemo(()=>{const z=F=>!m.trim()||F.path.toLowerCase().includes(m.trim().toLowerCase());if(a.kind==="commit"){const F={kind:"commit",hash:a.commit.hash},X=(E?.files||[]).filter(z).map(Y=>({...Y,cardKey:$t(F,Y.path)}));return{uncommitted:[],committed:[],commitFiles:X}}const W=(h?.uncommitted||[]).filter(z).map(F=>({...F,cardKey:$t({kind:"working",diffType:"uncommitted"},F.path)})),j=(h?.committed||[]).filter(z).map(F=>({...F,cardKey:$t({kind:"working",diffType:"committed"},F.path)}));return{uncommitted:W,committed:j,commitFiles:[]}},[a,h,E,m]),H=a.kind==="commit"?P:[...M,...I],$=N.useMemo(()=>nu(H),[H]),T=N.useMemo(()=>{let z=0,W=0;for(const j of H)z+=j.additions??0,W+=j.deletions??0;return{additions:z,deletions:W,files:H.length}},[H]),O=N.useCallback(()=>{const z=A.current;if(!z)return;const W=z.getBoundingClientRect().top;let j=null,F=Number.NEGATIVE_INFINITY;for(const[X,Y]of w.current){const ee=Y.getBoundingClientRect().top-W;ee<=48&&ee>F&&(F=ee,j=X)}if(!j){let X=null,Y=Number.POSITIVE_INFINITY;for(const[ee,G]of w.current){const J=G.getBoundingClientRect().top-W;J<Y&&(Y=J,X=ee)}j=X}s(j)},[]);N.useEffect(()=>{const z=A.current;if(!z)return;let W=0;const j=()=>{cancelAnimationFrame(W),W=requestAnimationFrame(O)};return z.addEventListener("scroll",j,{passive:!0}),()=>{z.removeEventListener("scroll",j),cancelAnimationFrame(W)}},[O]);const D=N.useCallback(z=>{const W=w.current.get(z.cardKey);W&&(W.scrollIntoView({behavior:"smooth",block:"start"}),s(z.cardKey),l(z.cardKey),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>l(null),1200))},[]),B=N.useCallback(z=>{p(W=>W.kind==="commit"&&W.commit.hash===z.hash?{kind:"overview"}:{kind:"commit",commit:z}),y(""),s(null),A.current?.scrollTo({top:0})},[]),q=N.useCallback(()=>{p({kind:"overview"}),y(""),s(null),A.current?.scrollTo({top:0})},[]);if(!i)return t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm bg-background h-full",children:f("未选择工作区")});const K=C&&e&&n&&d&&v,U=a.kind==="commit"?x:g;return t.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col bg-background",children:[K&&o&&u&&t.jsx(eu,{projectId:e,workspaceId:n,branchName:d,targetBranch:v,commitMessage:_,committedFileCount:h?.committed?.length,onRefreshCommitMessage:r,onConflict:o,onResolveConflicts:u}),t.jsx("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border/60 shrink-0 min-h-[37px]",children:a.kind==="overview"?t.jsxs(t.Fragment,{children:[t.jsx(Us,{size:14,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-xs font-semibold text-foreground",children:f("代码审查")}),t.jsx("span",{className:"text-xs text-muted-foreground",children:f("{count} 个文件",{count:T.files})}),t.jsx(Bs,{additions:T.additions,deletions:T.deletions}),d&&v&&t.jsxs("span",{className:"ml-auto flex items-center gap-1 text-[11px] text-muted-foreground font-mono truncate",children:[t.jsx("span",{className:"truncate",children:d}),t.jsx(Cs,{size:10,className:"rotate-180 shrink-0"}),t.jsx("span",{className:"truncate",children:v})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",onClick:q,className:"flex items-center gap-1 px-1.5 py-0.5 -ml-1.5 rounded-sm text-xs text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors shrink-0",children:[t.jsx(Cs,{size:12}),f("全部变更")]}),t.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/50 text-xs",children:"/"}),t.jsx("span",{className:"text-[11px] font-mono text-muted-foreground shrink-0",children:a.commit.shortHash}),t.jsx("span",{className:"text-xs text-foreground truncate",children:a.commit.message}),t.jsx(Bs,{className:"ml-auto",additions:T.additions,deletions:T.deletions})]})}),t.jsxs("div",{className:"flex flex-1 min-h-0",children:[t.jsx("div",{ref:A,className:"flex-1 min-w-0 overflow-y-auto scrollbar-app-thin",children:U?t.jsx("div",{className:"p-3 space-y-3",children:[0,1].map(z=>t.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[t.jsx("div",{className:"h-8 bg-muted/60 animate-pulse motion-reduce:animate-none"}),t.jsxs("div",{className:"p-3 space-y-2",children:[t.jsx("div",{className:"h-3 w-2/3 bg-muted animate-pulse motion-reduce:animate-none rounded-sm"}),t.jsx("div",{className:"h-3 w-1/2 bg-muted animate-pulse motion-reduce:animate-none rounded-sm"}),t.jsx("div",{className:"h-3 w-3/4 bg-muted animate-pulse motion-reduce:animate-none rounded-sm"})]})]},z))}):S&&a.kind==="overview"?t.jsx("div",{className:"flex-1 flex items-center justify-center py-16 text-destructive-ink text-sm",children:f("变更加载失败")}):H.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground",children:[t.jsx(Ts,{size:28,className:"mb-2 text-muted-foreground/70"}),t.jsx("span",{className:"text-xs",children:m.trim()?f("没有匹配筛选条件的文件"):a.kind==="commit"?f("该提交没有文件变更"):f("没有待审查的变更")})]}):a.kind==="commit"?t.jsx("div",{className:"p-3 space-y-3",children:P.map(z=>t.jsx(Ss,{entry:z,source:{kind:"commit",hash:a.commit.hash},workingDir:i,flash:c===z.cardKey,registerNode:R},z.cardKey))}):t.jsxs("div",{className:"p-3 space-y-4",children:[M.length>0&&t.jsxs("section",{children:[t.jsxs("div",{className:"sticky top-0 z-10 -mx-3 px-5 py-1.5 bg-background/95 backdrop-blur-sm",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("未提交")}),t.jsx("span",{className:"ml-2 text-[11px] tabular-nums text-muted-foreground",children:M.length})]}),t.jsx("div",{className:"space-y-3 mt-1",children:M.map(z=>t.jsx(Ss,{entry:z,source:{kind:"working",diffType:"uncommitted"},workingDir:i,flash:c===z.cardKey,registerNode:R},z.cardKey))})]}),I.length>0&&t.jsxs("section",{children:[t.jsxs("div",{className:"sticky top-0 z-10 -mx-3 px-5 py-1.5 bg-background/95 backdrop-blur-sm",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("已提交")}),t.jsx("span",{className:"ml-2 text-[11px] tabular-nums text-muted-foreground",children:I.length})]}),t.jsx("div",{className:"space-y-3 mt-1",children:I.map(z=>t.jsx(Ss,{entry:z,source:{kind:"working",diffType:"committed"},workingDir:i,flash:c===z.cardKey,registerNode:R},z.cardKey))})]})]})}),t.jsxs("aside",{className:"shrink-0 border-l border-border flex flex-col min-h-0",style:{width:"clamp(15rem, 24%, 22rem)"},children:[t.jsx("div",{className:"p-2 shrink-0",children:t.jsx(Lo,{size:"sm",value:m,onValueChange:y,placeholder:f("筛选文件...")})}),t.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin px-1.5 pb-1.5 min-h-0",children:H.length===0?t.jsx("div",{className:"px-2 py-3 text-xs text-muted-foreground",children:m.trim()?f("无匹配文件"):f("暂无变更文件")}):t.jsx(gn,{node:$,depth:0,activeKey:b,onSelect:D})}),t.jsxs("div",{className:"shrink-0 border-t border-border/60 max-h-[40%] flex flex-col min-h-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 shrink-0",children:[t.jsx(Kt,{size:12,className:"text-muted-foreground"}),t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("提交记录")})]}),t.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin min-h-0",children:t.jsx(au,{workingDir:i,selectedHash:k,onSelectCommit:B})})]})]})]})]})},ys=50;function cu(e){const n=Math.floor(Date.now()/1e3)-e;return n<60?Ue("{count}s ago",{count:n}):n<3600?Ue("{count}m ago",{count:Math.floor(n/60)}):n<86400?Ue("{count}h ago",{count:Math.floor(n/3600)}):n<604800?Ue("{count}d ago",{count:Math.floor(n/86400)}):new Date(e*1e3).toLocaleDateString()}function du(e){const i=e.split("/");return i[i.length-1]||e}function hu(e){const i=e.lastIndexOf("/");return i>0?e.slice(0,i):""}const uu=({workingDir:e,hash:i,filePath:n})=>{const{t:d}=re(),{data:v,isLoading:_,isError:C}=an(e,i,n);if(_)return t.jsxs("div",{className:"flex-1 flex items-center justify-center gap-2 text-muted-foreground",children:[t.jsx(_e,{size:"md"}),t.jsx("span",{className:"text-xs",children:d("Loading diff...")})]});if(C)return t.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive-ink text-xs",children:d("Failed to load diff.")});const r=v?.diff||"";if(!r.trim())return t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-xs",children:d("No diff content available.")});const o=r.split(`
|
|
62
|
+
`);return t.jsx("div",{className:"flex-1 overflow-auto scrollbar-app-thin font-mono text-xs leading-5",children:o.map((u,f)=>t.jsx(un,{line:u,lineNum:f+1},f))})},fu=({workingDir:e,hash:i,selectedPath:n,onSelectFile:d})=>{const{t:v}=re(),{data:_,isLoading:C}=on(e,i);if(C)return t.jsxs("div",{className:"pl-7 py-1 text-xs text-muted-foreground flex items-center gap-1",children:[t.jsx(_e,{size:"xs"}),t.jsx("span",{children:v("Loading...")})]});const r=_?.files||[];return r.length===0?t.jsx("div",{className:"pl-7 py-1 text-xs text-muted-foreground",children:v("No files changed")}):t.jsx("div",{className:"pl-7 pb-1 space-y-0.5",children:r.map(o=>{const u=hu(o.path);return t.jsxs("button",{type:"button",onClick:f=>{f.stopPropagation(),d(o.path)},className:Q("flex items-center gap-2 px-1.5 py-1 rounded-sm cursor-pointer w-full text-left",n===o.path?"bg-muted":"hover:bg-muted/60"),children:[t.jsx(hi,{status:o.status}),t.jsx("span",{className:"min-w-0 text-xs text-foreground truncate",children:du(o.path)}),u&&t.jsx("span",{className:"min-w-0 flex-1 truncate text-right font-mono text-[11px] text-muted-foreground [direction:rtl]",children:t.jsx("span",{dir:"ltr",children:u})})]},o.path)})})},mu=({workingDir:e})=>{const{t:i}=re(),n=Qt(E=>E.visibleContext),d=Io(e,n),{data:v,isLoading:_,isError:C,fetchNextPage:r,hasNextPage:o,isFetchingNextPage:u}=Hs({queryKey:oe.git.log(e||""),queryFn:({pageParam:E=0})=>ae.get("/git/log",{params:{workingDir:e||"",limit:String(ys),skip:String(E)}}),initialPageParam:0,getNextPageParam:(E,x)=>E.commits.length<ys?void 0:x.length*ys,enabled:!!e,refetchInterval:d,refetchIntervalInBackground:!1,refetchOnWindowFocus:d?"always":!1,refetchOnReconnect:d?"always":!1}),f=v?.pages.flatMap(E=>E.commits)||[],[a,p]=N.useState(null),[m,y]=N.useState(null),[b,s]=N.useState(280),[c,l]=N.useState(!1),h=N.useCallback(E=>{E.preventDefault(),l(!0);const x=E.clientX,w=b,A=R=>{const M=Math.min(480,Math.max(180,w+(R.clientX-x)));s(M)},L=()=>{l(!1),document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",L)};document.addEventListener("mousemove",A),document.addEventListener("mouseup",L)},[b]),g=E=>{a===E?(p(null),y(null)):(p(E),y(null))},S=N.useRef(null);if(!e)return t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm bg-background h-full",children:i("No workspace selected.")});if(_)return t.jsxs("div",{className:"flex-1 flex items-center justify-center gap-2 text-muted-foreground bg-background h-full",children:[t.jsx(_e,{size:"md"}),t.jsx("span",{className:"text-sm",children:i("Loading history...")})]});if(C)return t.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive-ink text-sm bg-background h-full",children:i("Failed to load history.")});if(f.length===0)return t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-muted-foreground bg-background h-full",children:[t.jsx(Kt,{size:28,className:"mb-2 text-muted-foreground/70"}),t.jsx("span",{className:"text-xs",children:i("No commit history")})]});const k=f.find(E=>E.hash===a);return t.jsxs("div",{className:"flex h-full bg-background",style:c?{userSelect:"none",cursor:"col-resize"}:void 0,children:[t.jsxs("div",{className:"border-r border-border flex flex-col shrink-0",style:{width:b},children:[t.jsx("div",{className:"px-3 py-2.5 border-b border-border/60 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Kt,{size:14,className:"text-muted-foreground"}),t.jsx("span",{className:"text-xs font-semibold text-foreground",children:i("History")}),t.jsx("span",{className:"text-[11px] tabular-nums bg-muted px-1.5 py-0.5 rounded-full text-muted-foreground",children:f.length})]})}),t.jsxs("div",{ref:S,className:"flex-1 overflow-auto scrollbar-app-thin p-1.5",children:[f.map(E=>{const x=a===E.hash;return t.jsxs("div",{children:[t.jsxs("button",{type:"button",onClick:()=>g(E.hash),className:Q("flex items-start gap-2 px-2 py-1.5 rounded-sm cursor-pointer w-full text-left group",x?"bg-muted":"hover:bg-muted/60"),children:[t.jsx("div",{className:"flex flex-col items-center shrink-0 pt-1",children:t.jsx("div",{className:Q("w-2 h-2 rounded-full shrink-0 transition-colors",x?"bg-primary":"bg-border group-hover:bg-muted-foreground/60")})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"text-[11px] font-mono text-muted-foreground shrink-0",children:E.shortHash}),t.jsx("span",{className:"text-xs text-foreground truncate flex-1",children:E.message}),t.jsx(Ye,{size:12,className:Q("shrink-0 text-muted-foreground/70 transition-transform",x&&"rotate-90")})]}),t.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[t.jsx("span",{className:"text-xs text-muted-foreground truncate",children:E.author}),t.jsx("span",{className:"text-[11px] text-muted-foreground",children:cu(E.timestamp)})]})]})]}),x&&t.jsxs(t.Fragment,{children:[E.body&&t.jsx("div",{className:"pl-7 pr-2 py-1.5 text-xs text-muted-foreground whitespace-pre-wrap leading-5 border-l-2 border-border ml-3",children:E.body}),t.jsx(fu,{workingDir:e,hash:E.hash,selectedPath:m,onSelectFile:y})]})]},E.hash)}),o&&t.jsx("button",{type:"button",onClick:()=>r(),disabled:u,className:"w-full py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/60 rounded-sm transition-colors flex items-center justify-center gap-1.5",children:u?t.jsxs(t.Fragment,{children:[t.jsx(_e,{size:"xs"})," ",i("Loading...")]}):i("Load more")})]})]}),t.jsx("div",{onMouseDown:h,className:Q("w-1 shrink-0 cursor-col-resize transition-colors",c?"bg-ring/40":"bg-transparent hover:bg-border")}),t.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:m&&a?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"px-3 py-2 border-b border-border/60 flex items-center gap-2 shrink-0",children:[t.jsx(Ts,{size:14,className:"text-muted-foreground"}),t.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:m}),t.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["(",k?.shortHash,")"]})]}),t.jsx(uu,{workingDir:e,hash:a,filePath:m})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.jsx(Ts,{size:28,className:"text-muted-foreground/70"}),t.jsx("span",{className:"text-xs",children:i(a?"Select a file to view diff":"Select a commit to view changes")})]})})})]})},Hr=Fs();function pu(e){if(!Hr)return e;try{const i=new URL(Hr);return new URL(e,i.origin).toString()}catch{return e}}function vn(e){return{...e,viewUrl:e.viewUrl?pu(e.viewUrl):null}}function gu(e,i=!0){return Te({queryKey:oe.previews.status(e??""),queryFn:async()=>{const n=await ae.get(`/previews/${e}/status`);return vn(n)},enabled:!!e&&i,refetchOnWindowFocus:!1})}function vu(e){const i=Le();return Ut({mutationFn:async n=>{const d=await ae.put(`/previews/${e}/config`,{target:n});return vn(d)},onSuccess:n=>{e&&(i.setQueryData(oe.previews.status(e),n),i.invalidateQueries({queryKey:oe.workspaces.all}))}})}function _u(){return window.location.protocol==="https:"?"remote":"local"}function bu(e,i,n=!0){const[d,v]=N.useState(null),[_,C]=N.useState(!1),[r,o]=N.useState(null),[u,f]=N.useState(0);return N.useEffect(()=>{if(!n||!e||!i?.ready||!i.target){v(null),C(!1),o(null);return}let a=!1,p=null,m=null;v(null);const y=s=>{ae.delete(`/previews/${e}/sessions/${s}`).catch(()=>{})};return(async()=>{C(!0),o(null);try{const s={mode:_u(),localHostname:window.location.hostname},c=await ae.post(`/previews/${e}/sessions`,s);if(a){y(c.id);return}p=c.id,v(c),m=window.setInterval(async()=>{if(p)try{const l=await ae.post(`/previews/${e}/sessions/${p}/heartbeat`);a||(v(l),o(null))}catch(l){!a&&l instanceof at&&l.status===404?f(h=>h+1):a||o(l instanceof Error?l:new Error("Preview session heartbeat failed"))}},3e4)}catch(s){a||(v(null),o(s instanceof Error?s:new Error("Failed to open preview session")))}finally{a||C(!1)}})(),()=>{a=!0,m!==null&&window.clearInterval(m),p&&y(p)}},[n,u,i?.ready,i?.target,e]),{session:d,isOpening:_,error:r,retry:()=>f(a=>a+1)}}const xu="agent-tower-preview",Su="agent-tower-preview-host";function yu(){return"3000, localhost:3000, http://127.0.0.1:5173"}function wu(e){if(!e)return null;try{return new URL(e).origin}catch{return null}}function Cu(e){return t.jsx(ku,{...e},e.workspaceId??"no-workspace")}function ku({workspaceId:e,readOnly:i,navigationRequest:n,onNavigationRequestHandled:d}){const{t:v}=re(),[_,C]=N.useState(null),o=!(n?.source.kind==="visualization")&&!_,{data:u,isLoading:f,refetch:a,isFetching:p}=gu(e,o),m=vu(e),{session:y,isOpening:b,error:s,retry:c}=bu(e,u,o),l=N.useRef(null),h=N.useRef(null),g=N.useRef(null),S=N.useRef(null),k=N.useRef(null),E=N.useRef(null),[x,w]=N.useState(0),[A,L]=N.useState({target:null,address:"",iframeSrc:null,isFrameLoading:!1}),R=wu(y?.viewUrl),M=u&&A.target!==u.target?{target:u.target,address:u.target??"",iframeSrc:null,isFrameLoading:!1}:u&&!u.ready&&A.iframeSrc?{...A,iframeSrc:null,isFrameLoading:!1}:A,I=N.useCallback(K=>{L(U=>({...u&&U.target!==u.target?{target:u.target,address:u.target??"",iframeSrc:null,isFrameLoading:!1}:U,...K}))},[u]);N.useEffect(()=>{if(!y||y.target!==u?.target)return;const K=k.current!==R;k.current=R,L(U=>{const z=n?.source.kind==="web"&&E.current!==n.id?Mt(n.source.url,y.target,y.viewUrl):null;if(!K&&U.iframeSrc&&U.target===y.target&&z?.kind!=="proxy")return U;let W=U.iframeSrc;if(z?.kind==="proxy")W=z.url;else if(!W||U.target!==y.target||K){const F=g.current;if(F)W=eo(y.viewUrl,F);else{const X=Mt(U.address||y.target,y.target,y.viewUrl);W=X?.kind==="proxy"?X.url:y.viewUrl}}g.current=null;const j=S.current;return j&&!j.closed&&W&&j.location.replace(W),S.current=null,{target:y.target,address:z?.kind==="proxy"?n?.source.kind==="web"?n.source.url:U.address:U.address||y.target,iframeSrc:W,isFrameLoading:!!W}})},[n,y,R,u?.target]),N.useEffect(()=>()=>{S.current?.close()},[]);const P=N.useCallback(async(K,U=!1)=>{const z=Mt(K,u?.target??null,y?.viewUrl??null);if(!z||!e)return;if(C(null),z.kind==="proxy"){if(U){window.open(z.url,"_blank","noopener,noreferrer");return}L({target:u?.target??null,address:K,iframeSrc:z.url,isFrameLoading:!0});return}if(i)return;const W=U?window.open("about:blank","_blank"):null;W&&(W.opener=null);try{g.current=z.path,S.current=W;const j=await m.mutateAsync(z.target);L({target:j.target,address:K.trim(),iframeSrc:null,isFrameLoading:!!j.ready}),w(F=>F+1),ke.success(v("Preview target saved")),j.ready||(S.current?.close(),S.current=null)}catch(j){S.current?.close(),S.current=null,g.current=null;const F=j instanceof Error?j.message:v("Failed to save preview target");ke.error(F)}},[y?.viewUrl,i,u?.target,v,m,e]);N.useEffect(()=>{if(!n||E.current===n.id||n.source.kind==="web"&&f)return;const K=window.setTimeout(()=>{E.current=n.id,d?.(n.id),n.source.kind==="visualization"?(C({source:n.source,iframeSrc:to(n.source.sessionId,n.source.file),isFrameLoading:!0}),w(U=>U+1)):(C(null),P(n.source.url))},0);return()=>window.clearTimeout(K)},[f,P,n,d]),N.useEffect(()=>{if(_)return;const K=U=>{if(U.source!==l.current?.contentWindow)return;const z=U.data;if(!(!z||z.source!==xu)){if(z.type==="location"&&typeof z.href=="string"){const W=so(u?.target??null,y?.viewUrl??null,z.href,window.location.href);W&&document.activeElement!==h.current&&I({target:u?.target??M.target,address:W,isFrameLoading:!1});return}z.type==="navigate-loopback"&&typeof z.href=="string"&&P(z.href,z.newTab===!0)}};return window.addEventListener("message",K),()=>window.removeEventListener("message",K)},[M.target,P,I,y?.viewUrl,u?.target,_]);const H=K=>{l.current?.contentWindow?.postMessage({source:Su,action:K},"*")},$=K=>{K.preventDefault(),P(M.address)},T=async()=>{if(_){C(U=>U&&{...U,isFrameLoading:!0}),w(U=>U+1);return}const K=await a();if(!K.data?.ready){I({target:K.data?.target??M.target,iframeSrc:null,isFrameLoading:!1});return}if(!y||!M.iframeSrc){c();return}I({isFrameLoading:!0}),H("reload")},O=()=>{if(_){window.open(_.iframeSrc,"_blank","noopener,noreferrer");return}if(!y?.viewUrl)return;const K=Mt(M.address||y.target,y.target,y.viewUrl),U=K?.kind==="proxy"?K.url:y.viewUrl;window.open(U,"_blank","noopener,noreferrer")};if(!e)return t.jsx("div",{className:"h-full flex items-center justify-center bg-background text-sm text-muted-foreground",children:v("No active workspace.")});const D=_?.iframeSrc??M.iframeSrc,B=!!_,q=!B&&(f||p||m.isPending||b);return t.jsxs("div",{className:"h-full flex flex-col bg-background",children:[t.jsxs("div",{className:"shrink-0 border-b border-border bg-muted/40 px-2 py-2",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(Fe,{label:v("Back"),onClick:()=>{B?C(null):H("back")},disabled:!B&&!M.iframeSrc,children:t.jsx(Cs,{})}),t.jsx(Fe,{label:v("Forward"),onClick:()=>H("forward"),disabled:B||!M.iframeSrc,children:t.jsx(yi,{})}),t.jsx(Fe,{label:!B&&M.isFrameLoading?v("Stop loading"):v("Refresh preview"),onClick:!B&&M.isFrameLoading?()=>{H("stop"),I({isFrameLoading:!1})}:T,disabled:!B&&!M.isFrameLoading&&p,children:!B&&M.isFrameLoading?t.jsx(Qe,{}):p?t.jsx(_e,{}):t.jsx(vt,{})}),t.jsx("form",{className:"min-w-0 flex-1",onSubmit:$,children:t.jsx(Mo,{ref:h,size:"sm",prefix:t.jsx(na,{}),value:_?.source.file??M.address,onChange:K=>I({address:K.target.value}),onKeyDown:K=>{K.key==="Enter"&&K.nativeEvent.isComposing&&K.preventDefault()},disabled:B||i||m.isPending,placeholder:yu(),"aria-label":v("Preview address")})}),t.jsx(Fe,{label:v("Open preview in new tab"),onClick:O,disabled:!D,children:t.jsx(Is,{})})]}),t.jsxs("div",{className:"mt-1 flex min-h-4 items-center justify-between gap-2 px-1 text-xs leading-4",children:[t.jsx("span",{className:"truncate text-muted-foreground",children:B?v("Viewing agent visualization"):q?v("Checking preview target..."):s?s.message:u?.ready?`${v("Proxying")} ${u.target}`:u?.configured?`${v("Preview target is not reachable")}${u.error?`: ${u.error}`:""}`:v("Enter a local preview URL on the Agent Tower machine.")}),t.jsx("span",{className:"shrink-0 text-muted-foreground",children:v(B?"Session file":"Loopback only")})]})]}),t.jsx("div",{className:"relative flex-1 min-h-0 bg-background",children:D?t.jsx("iframe",{ref:l,src:D,title:v("Preview"),className:"absolute inset-0 h-full w-full border-0 bg-white",sandbox:B?"allow-modals allow-pointer-lock allow-presentation allow-scripts":"allow-downloads allow-forms allow-modals allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts",allow:"clipboard-read; clipboard-write; fullscreen",onLoad:()=>{B?C(K=>K&&{...K,isFrameLoading:!1}):I({isFrameLoading:!1})}},x):t.jsx("div",{className:"absolute inset-0 flex items-center justify-center px-4 text-center text-sm text-muted-foreground",children:u?.configured?u.ready&&b?v("Checking preview target..."):v("Start the preview server, then refresh."):v("Configure a local preview target to display it here.")})})]})}const Eu={[Ie.ACTIVE]:"success",[Ie.MERGED]:"info",[Ie.HIBERNATED]:"warning",[Ie.ABANDONED]:"neutral"};function ju(e){return e.length<=34?e:`...${e.slice(-31)}`}function Tu({workspaces:e,teamRun:i,selectedWorkspaceId:n,onSelectWorkspace:d,disabled:v,className:_,buttonClassName:C}){const{t:r}=re(),o=N.useMemo(()=>Xs(e,i),[e,i]),u=o.find(f=>f.workspace.id===n)??o[0];return o.length<=1?null:t.jsx("div",{className:Q("relative",_),children:t.jsxs(fi,{children:[t.jsxs(mi,{disabled:v,className:Q("group inline-flex h-8 max-w-[340px] items-center gap-2 rounded-md border border-border bg-background px-2.5 text-left text-xs text-foreground/80 outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/60 disabled:cursor-not-allowed disabled:opacity-40 data-[state=open]:bg-accent",C),title:r("Workspace"),children:[t.jsx(Es,{size:14,className:"shrink-0 text-muted-foreground"}),t.jsx(zt,{size:"sm",shape:"tag",children:r(u.roleLabel)}),t.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:r(u.displayName)}),t.jsx("span",{className:"min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:ju(Et(u.workspace))}),t.jsx(ze,{size:13,className:"shrink-0 text-muted-foreground/70 transition-transform group-data-[state=open]:rotate-180"})]}),t.jsx(pi,{className:"w-[420px] max-w-[calc(100vw-2rem)]",children:t.jsx(Eo,{value:u.workspace.id,onValueChange:d,children:o.map(f=>t.jsxs(jo,{value:f.workspace.id,icon:t.jsx(Vr,{className:"mt-0.5 size-3.5"}),className:"items-start",children:[t.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[t.jsx("span",{className:"truncate",children:r(f.displayName)}),t.jsx(zt,{size:"sm",shape:"tag",children:r(f.roleLabel)}),t.jsx(zt,{size:"sm",tone:Eu[f.workspace.status],children:f.workspace.status})]}),t.jsx("span",{className:"mt-0.5 block truncate font-mono text-[11px] font-normal text-muted-foreground",children:Et(f.workspace)}),t.jsxs("span",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs font-normal text-muted-foreground",children:[f.ownerName&&t.jsxs("span",{children:[r("Owner"),": ",f.ownerName]}),f.parentBranchName&&t.jsxs("span",{children:[r("Parent"),": ",f.parentBranchName]}),t.jsx("span",{className:"font-mono text-[11px]",children:f.workspace.id.slice(0,8)})]})]},f.workspace.id))})})]})})}const Au=[{key:"review",label:"Changes",icon:t.jsx(Us,{size:14})},{key:"editor",label:"Editor",icon:t.jsx(ui,{size:14})},{key:"terminal",label:"Terminal",icon:t.jsx(yt,{size:14})},{key:"preview",label:"Preview",icon:t.jsx(xi,{size:14})}],Nu=[{key:"history",label:"History",icon:t.jsx(Kt,{size:14})},{key:"editor",label:"Editor",icon:t.jsx(ui,{size:14})},{key:"terminal",label:"Terminal",icon:t.jsx(yt,{size:14})},{key:"preview",label:"Preview",icon:t.jsx(xi,{size:14})}],Ru=({active:e,onClick:i,icon:n,label:d})=>t.jsxs("button",{type:"button",onClick:i,className:Q("flex shrink-0 items-center gap-2 px-4 py-2 text-xs font-medium transition-all rounded-t-md border-t border-x -mb-px whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/60",e?"bg-background border-border text-foreground z-10":"bg-transparent border-transparent text-muted-foreground hover:text-foreground hover:bg-foreground/[0.05]"),children:[n,t.jsx("span",{children:d})]}),Lu=({active:e,onClick:i,icon:n,label:d})=>t.jsx("button",{type:"button",onClick:i,title:d,"aria-label":d,"aria-pressed":e,className:Q("flex h-9 w-9 items-center justify-center rounded-lg transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",e?"bg-background text-foreground shadow-raised ring-1 ring-border/80":"text-muted-foreground hover:bg-foreground/[0.05] hover:text-foreground"),children:n}),Df=pe.memo(function({className:i,sessionId:n,workspaceId:d,workingDir:v,projectId:_,hideChanges:C,gitAvailable:r=!0,readOnly:o,repoDeleted:u,teamRun:f,teamStatus:a,gitProps:p,workspaces:m,selectedWorkspaceId:y,onSelectWorkspace:b,variant:s="tabs",expanded:c,onExpandedChange:l,minContentWidth:h=520,tabRef:g,previewRequest:S,onPreviewRequestHandled:k}){const{t:E}=re(),x=Qt(Z=>Z.setVisibleContext),w=s==="rail",[A,L]=N.useState(!1),R=w?c??A:!0,M=N.useCallback(Z=>{c===void 0&&L(Z),l?.(Z)},[c,l]),I=N.useMemo(()=>{const Z=C?Nu:Au,ce=r?Z:Z.filter(we=>we.key!=="review"&&we.key!=="history"),se=o?ce.filter(we=>we.key!=="terminal"):ce;return f?[{key:"team-status",label:"Team Status",icon:t.jsx(gt,{size:14})},...se]:se},[r,C,o,f]),[P,H]=N.useState(()=>S?"preview":r?C?"history":"review":"editor"),$=N.useRef(null),T=N.useRef(0),[O,D]=N.useState(),B=N.useCallback(Z=>{H(Z),w&&M(!0)},[w,M]);N.useImperativeHandle(g,()=>({setTab:Z=>B(Z),openFile:(Z,ce,se)=>{B("editor"),requestAnimationFrame(()=>$.current?.openFile(Z,ce,se))},openPreview:(Z,ce)=>{T.current+=1,D({id:T.current,source:Z,workspaceId:ce}),B("preview")}}),[B]);const q=S??O,K=q?.workspaceId&&q.workspaceId!==d?void 0:q,U=N.useCallback(Z=>{D(ce=>ce?.id===Z?void 0:ce),k?.(Z)},[k]),{data:z}=Fo(_??""),W=N.useMemo(()=>{if(!z?.quickCommands)return[];try{return JSON.parse(z.quickCommands)}catch{return[]}},[z?.quickCommands]),[j,F]=N.useState([]),X=N.useRef(void 0);N.useEffect(()=>{v&&v!==X.current&&(X.current=v,F(Z=>Z.includes(v)?Z:[...Z,v]))},[v]),N.useEffect(()=>{I.some(Z=>Z.key===P)||H(I[0]?.key??"editor")},[P,I]),N.useEffect(()=>{if(w&&!R)return;const Z=P==="review"?"changes":P==="history"?"history":null;if(!d||!v||!Z){x(null);return}return x({workspaceId:d,workingDir:v,tab:Z}),()=>{x(null)}},[P,R,w,x,v,d]);const Y=!!b&&Xs(m,f).length>1,ee=I.find(Z=>Z.key===P)??I[0],G=ee?E(ee.label):"",J=o?t.jsx(Ve,{size:"sm",className:"mx-2 mt-2",children:E(u?"项目已删除且本地仓库文件已清理。这里只保留历史视图。":"项目已删除。Workspace 以只读模式展示历史内容。")}):null,ie=t.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[Y&&t.jsx("div",{className:"shrink-0 px-3 py-1.5 border-b border-border/60 bg-muted/40",children:t.jsx(Tu,{workspaces:m,teamRun:f,selectedWorkspaceId:y,onSelectWorkspace:b,buttonClassName:"h-7"})}),t.jsxs("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:[P==="team-status"&&f&&a,P==="editor"&&t.jsx(Kh,{ref:$,workingDir:v,readOnly:o}),j.map(Z=>{const ce=P==="terminal"&&v===Z;return t.jsx("div",{"aria-hidden":!ce,className:"absolute inset-0 h-full w-full min-h-0 min-w-0 overflow-hidden",style:{display:ce?"block":"none"},children:t.jsx(oc,{cwd:Z,workspaceId:ce?d:void 0,isVisible:ce,quickCommands:W})},Z)}),P==="preview"&&t.jsx(Cu,{workspaceId:d,readOnly:o,navigationRequest:K,onNavigationRequestHandled:U}),P==="review"&&t.jsx(lu,{projectId:_,workingDir:v,workspaceId:d,branchName:p?.branchName,targetBranch:p?.targetBranch,commitMessage:p?.commitMessage,canRunGitOperations:p?.canRunGitOperations,onRefreshCommitMessage:p?.onRefreshCommitMessage,onConflict:p?.onConflict,onResolveConflicts:p?.onResolveConflicts}),P==="history"&&t.jsx(mu,{workingDir:v})]})]});return w?t.jsxs("div",{className:Q("flex h-full w-full min-w-0 bg-background",i),children:[t.jsx("div",{className:"flex h-full w-12 shrink-0 flex-col items-center gap-1 border-l border-border bg-muted/35 px-1.5 py-2",children:I.map(Z=>t.jsx(Lu,{active:R&&P===Z.key,onClick:()=>B(Z.key),icon:Z.icon,label:E(Z.label)},Z.key))}),R&&t.jsxs("div",{className:"flex h-full min-w-0 flex-1 flex-col border-l border-border bg-background",style:{minWidth:h},children:[J,t.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between gap-3 border-b border-border bg-background px-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-sm font-semibold text-foreground",children:[t.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border bg-muted/35 text-muted-foreground",children:ee?.icon}),t.jsx("span",{className:"truncate",children:G})]}),t.jsx("button",{type:"button",onClick:()=>M(!1),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",title:E("收起"),"aria-label":E("收起"),children:t.jsx(_a,{size:15})})]}),ie]})]}):t.jsxs("div",{className:Q("flex h-full w-full min-w-0 flex-col bg-background",i),children:[o&&J,t.jsx("div",{className:"flex items-center overflow-x-auto scrollbar-app-thin px-2 pt-2 border-b border-border bg-muted shrink-0 gap-1 select-none",children:I.map(Z=>t.jsx(Ru,{active:P===Z.key,onClick:()=>B(Z.key),icon:Z.icon,label:E(Z.label)},Z.key))}),ie]})}),Mu=3e3;function zr(e,i){const n=new Map(e.map(d=>[d.workspaceId,d]));for(const d of i){const v=n.get(d.workspaceId);(!v||d.updatedAt>=v.updatedAt)&&n.set(d.workspaceId,d)}return[...n.values()]}function Pf(e){const i=Le(),n=N.useRef({version:0,values:new Map}),[d,v]=N.useState(0),{data:_=[]}=Te({queryKey:oe.workspaces.setupProgress(e??""),enabled:!!e,refetchOnMount:"always",refetchInterval:u=>u.state.data?.some(f=>f.status==="running")?3e3:!1,queryFn:async({signal:u})=>{const f=n.current.version,a=await ae.get(`/tasks/${e}/setup-progress`,{signal:u}),p=[...n.current.values.values()].filter(m=>m.version>f&&m.progress.taskId===e).map(m=>m.progress);return zr(a,p)}});N.useEffect(()=>{if(!e)return;const u=ge.connect(),f=oe.workspaces.setupProgress(e),a=m=>{if(m.taskId!==e)return;const y=n.current.values.get(m.workspaceId);y&&y.progress.updatedAt>m.updatedAt||(n.current.values.set(m.workspaceId,{version:++n.current.version,progress:m}),i.setQueryData(f,b=>zr(b??[],[m])))},p=()=>{i.invalidateQueries({queryKey:f})};return u.on(Ae.WORKSPACE_SETUP_PROGRESS,a),u.on("connect",p),()=>{u.off(Ae.WORKSPACE_SETUP_PROGRESS,a),u.off("connect",p)}},[e,i]);const C=[..._].sort((u,f)=>f.updatedAt-u.updatedAt),r=C.find(u=>u.status==="running")??C.find(u=>u.status!=="running"&&u.updatedAt>d),o=r?.status!=="running"?r?.updatedAt??null:null;return N.useEffect(()=>{if(o===null)return;const u=setTimeout(()=>v(o),Mu);return()=>clearTimeout(u)},[o]),r??null}function Bf({isOpen:e,onClose:i,onStarted:n,taskId:d,projectId:v,taskTitle:_,taskDescription:C,taskPrompt:r,projectIsGitRepo:o=!0,projectWorktreeReady:u=!0,projectGitReason:f}){const{t:a}=re(),[p,m]=N.useState(""),[y,b]=N.useState(""),[s,c]=N.useState(Be.WORKTREE),[l,h]=N.useState(null),[g,S]=N.useState("idle"),[k,E]=N.useState(null),x=Le(),w=Ho(d),A=Ao(),L=zo(),{data:R,isLoading:M}=zs(),I=N.useMemo(()=>R?.filter(li),[R]),P=l?.isGitRepo??o,H=l?.worktreeReady??u,$=l?.reason??f,T=P!==!1&&H!==!1;N.useEffect(()=>{if(!e||!I)return;const G=I.find(J=>!ht(J));m(J=>J&&I.some(ie=>ie.provider.id===J)?J:G?.provider.id??"")},[e,I]),N.useEffect(()=>{if(e){const G=[_];C&&G.push(C),b(r?.trim()||G.join(`
|
|
63
|
+
|
|
64
|
+
`)),h(null),c(o!==!1&&u!==!1?Be.WORKTREE:Be.MAIN_DIRECTORY),S("idle"),E(null)}},[e,o,u,d,_,C,r]),N.useEffect(()=>{T||c(Be.MAIN_DIRECTORY)},[T]);const O=async()=>{if(!v||L.isPending)return;const G=await L.mutateAsync({id:v});h(G),G.worktreeReady&&c(Be.WORKTREE)},D=g!=="idle",B=async()=>{if(!p||!y.trim())return;const G=I?.find(J=>J.provider.id===p);if(!(!G||ht(G))){E(null);try{await $o(d,{providerId:p,prompt:y.trim(),workspaceKind:T?s:Be.MAIN_DIRECTORY},{createWorkspace:J=>w.mutateAsync({clientSubmissionId:J,workspaceKind:T?s:Be.MAIN_DIRECTORY}),startSession:J=>A.mutateAsync(J),onStep:S}),await x.invalidateQueries({queryKey:oe.workspaces.list(d)}),S("idle"),n?.(),i()}catch(J){S("idle"),E(J instanceof Error?J.message:a("启动失败,请重试"))}}},q={idle:a("启动"),"creating-workspace":a("创建工作空间..."),"creating-session":a("创建会话..."),"starting-session":a("启动 Agent...")},K=(I??[]).map(G=>{const J=G.provider,ie=ht(G),Z=!ie,ce=J.executionPermission?a("Required permission: {mode}",{mode:a(Uo[J.executionPermission])}):void 0;return{value:J.id,label:Z?J.name:`${J.name}${a(" (不可用)")}`,description:[ce,ie&&a(ie)].filter(Boolean).join(" · "),icon:t.jsx(Gt,{agentType:J.agentType,className:"size-4"}),disabled:!Z}}),U=I?.find(G=>G.provider.id===p),z=U?ht(U):void 0,W=!!I?.length&&I.every(G=>!!ht(G)),j=!M&&!I?.length,F=a("工作树隔离改动,支持 TeamRun、Merge、Rebase 和冲突解决。"),X=a("本地模式会直接修改项目主目录,不会自动提交,也不能使用 Merge、Rebase 或冲突解决。"),Y=a($==="NO_HEAD"?"已检测到 Git,但需要先提交一次才能使用工作树模式。":"非 Git 项目只能使用本地模式。"),ee=[{value:Be.WORKTREE,label:a("工作树模式"),description:F,disabled:!T},{value:Be.MAIN_DIRECTORY,label:a("本地模式"),description:X}];return t.jsx(At,{isOpen:e,onClose:D?()=>{}:i,title:a("启动 Agent"),action:t.jsxs(t.Fragment,{children:[t.jsx(me,{variant:"outline",onClick:i,disabled:D,children:a("取消")}),t.jsx(me,{onClick:B,disabled:D||!U||!y.trim()||!!z,children:q[g]})]}),children:t.jsxs("div",{className:"space-y-5",children:[t.jsx("div",{children:t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground/80 mb-2",children:a("Agent")}),t.jsx($e,{value:p,onChange:m,options:K,placeholder:a(M?"加载中...":"选择 Agent"),disabled:D||M}),z?t.jsx("p",{role:"alert",className:"mt-2 break-words text-xs leading-snug text-destructive-ink",children:a(z)}):null,W&&!U?t.jsxs("div",{role:"alert",className:"mt-2 space-y-1 break-words text-xs leading-snug text-destructive-ink",children:[t.jsx("p",{children:a("No available Provider for this session.")}),t.jsx("ul",{className:"space-y-1",children:I.map(G=>t.jsxs("li",{children:[G.provider.name,": ",a(ht(G))]},G.provider.id))})]}):null,j?t.jsx("p",{role:"alert",className:"mt-2 text-xs text-destructive-ink",children:a("No available Provider for this session.")}):null]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground/80 mb-2",children:a("模式")}),T?t.jsx($e,{value:s,onChange:G=>c(G),options:ee,disabled:D}):t.jsx(ro,{side:"bottom",className:"w-full",content:Y,children:t.jsxs("div",{tabIndex:0,"aria-label":Y,className:"rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[t.jsx($e,{value:s,onChange:G=>c(G),options:ee,disabled:!0}),t.jsx("button",{type:"button",onClick:O,disabled:D||L.isPending,className:"mt-2 text-xs text-muted-foreground transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:L.isPending?a("检测中..."):a("重新检测 Git 状态")})]})})]})]})}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground/80 mb-2",children:a("任务描述")}),t.jsx("textarea",{value:y,onChange:G=>b(G.target.value),rows:5,disabled:D,placeholder:a("描述你想让 Agent 完成的任务..."),className:"w-full px-3 py-2 border border-border rounded-lg text-sm text-foreground placeholder:text-muted-foreground/70 focus:outline-none focus:ring-1 focus:ring-ring/60 focus:border-ring resize-none disabled:opacity-50 disabled:bg-muted/50"})]}),k&&t.jsx("div",{className:"text-sm text-destructive-ink bg-destructive/10 border border-destructive/25 rounded-lg px-3 py-2",children:k})]})})}function Of(e){const i=e?.tokenUsage;if(!(!i||typeof i.totalTokens!="number"))return i}function Du(e,i,n){const d=e?.providerId??n?.providerId??null,v=d?i?.find(o=>o.provider.id===d)?.provider:null,_=v?.name??d??e?.agentType??n?.agentType??null;if(!_)return null;const C=e?.agentType??v?.agentType??n?.agentType??null,r=d&&v?.name&&d!==v.name?`${v.name} (${d})`:_;return{label:_,title:r,agentType:C}}function If({session:e,providers:i,usage:n,compact:d=!1,providerIdFallback:v,agentTypeFallback:_,tokenTooltipSide:C="top"}){const{t:r}=re(),o=Du(e,i,{providerId:v,agentType:_});return!o&&!n?null:t.jsxs("div",{className:`flex shrink-0 items-center ${d?"gap-1":"gap-2"}`,children:[o&&t.jsxs("div",{className:`flex shrink-0 items-center rounded-lg text-muted-foreground ${d?"max-w-[130px] min-w-[82px] gap-1 px-1.5 py-1 text-xs":"max-w-[220px] min-w-[110px] gap-1.5 px-2 py-1.5 text-xs"}`,title:`${r("Provider")}: ${o.title}`,children:[t.jsx(Gt,{agentType:o.agentType,className:d?"size-3":"size-3.5"}),t.jsx("span",{className:"min-w-0 truncate",children:Fn(o.label,d?12:18)})]}),t.jsx(mo,{usage:n,tooltipSide:C})]})}function _n(e){return e.length>0?e.map(i=>`- ${i}`).join(`
|
|
65
|
+
`):"- 未获取到冲突文件列表"}function bn(e){if(!e)return[];const i=[];return e.workspaceId&&i.push(`- Workspace: \`${e.workspaceId}\``),e.worktreePath&&i.push(`- Worktree: \`${e.worktreePath}\``),e.sourceWorkspaceId&&i.push(`- Source workspace: \`${e.sourceWorkspaceId}\``),e.targetWorkspaceId&&i.push(`- Target workspace: \`${e.targetWorkspaceId}\``),e.sourceWorktreePath&&i.push(`- Source worktree: \`${e.sourceWorktreePath}\``),e.targetWorktreePath&&i.push(`- Target worktree: \`${e.targetWorktreePath}\``),e.operation&&e.operation!=="idle"&&i.push(`- Git 状态: \`${e.operation}\``),e.mergeStrategy&&i.push(`- Merge strategy: \`${e.mergeStrategy}\``),e.mergeAborted&&i.push("- Merge state: conflict detected and already aborted by Agent Tower"),i}function Pu(e,i){if(!i?.mergeAborted)return["1. 打开上述冲突文件,解决所有冲突标记(`<<<<<<<`、`=======`、`>>>>>>>`)","2. 对每个已解决的文件执行 `git add <file>`","3. 执行 `git commit` 完成合并"];const n=i.mergeStrategy==="squash"?`git merge --squash --no-commit ${e}`:`git merge --no-ff ${e}`,d=i.mergeStrategy==="squash"?"`git commit`":"`git merge --continue` 或 `git commit`";return["1. 注意:Agent Tower 检测到 merge 冲突后已经执行 abort,当前不要假设存在冲突标记或 `MERGE_HEAD`","2. 切换到 Target worktree / Target branch 上下文,确认工作区干净",`3. 重新执行 \`${n}\` 复现冲突`,"4. 打开上述冲突文件,解决所有冲突标记(`<<<<<<<`、`=======`、`>>>>>>>`)","5. 对每个已解决的文件执行 `git add <file>`",`6. 执行 ${d} 完成合并`]}function Bu(e){if(!e.mergeAborted)return"请确认当前 Git 状态,解决所有冲突标记,完成必要的 `git add` 与后续 merge 提交,然后说明处理结果。";const i=e.targetWorktreePath?`目标 worktree \`${e.targetWorktreePath}\``:`目标分支 \`${e.targetBranch}\``,n=e.mergeStrategy==="squash"?`git merge --squash --no-commit ${e.sourceBranch}`:`git merge --no-ff ${e.sourceBranch}`;return`Agent Tower 已在检测到冲突后 abort 了 merge;请在${i}中确认工作区干净,重新执行 \`${n}\` 复现冲突,解决后完成提交并汇报验证结果。`}function Ou(e,i,n,d,v){const _=_n(n),C=bn(v);return d===Ct.REBASE?["## Rebase 冲突解决","",`在将分支 \`${e}\` rebase 到 \`${i}\` 时发生了冲突。`,...C.length>0?["","### 上下文",...C]:[],"","### 冲突文件",_,"","### 解决步骤","1. 打开上述冲突文件,解决所有冲突标记(`<<<<<<<`、`=======`、`>>>>>>>`)","2. 对每个已解决的文件执行 `git add <file>`","3. 执行 `git rebase --continue` 继续 rebase 流程"].join(`
|
|
66
|
+
`):["## Merge 冲突解决","",`在将分支 \`${e}\` 合并到 \`${i}\` 时发生了冲突。`,...C.length>0?["","### 上下文",...C]:[],"","### 冲突文件",_,"","### 解决步骤",...Pu(e,v)].join(`
|
|
67
|
+
`)}function Iu(e){const i=e.conflictOp===Ct.REBASE?"Rebase":"Merge",n=_n(e.conflictedFiles),d=[...bn(e),`- Source branch: \`${e.sourceBranch}\``,`- Target branch: \`${e.targetBranch}\``,`- Conflict type: \`${e.conflictOp}\``];return[`## 请求处理 ${i} 冲突`,"",`用户点击了“AI 辅助解决”,请在对应 workspace 中处理当前 ${i} 冲突,并在 Team Room 汇报处理结果和验证情况。`,"","### 上下文",...d,"","### 冲突文件",n,"","### 用户意图",e.conflictOp===Ct.REBASE?"请确认当前 Git 状态,解决所有冲突标记,完成必要的 `git add` 与后续 `git rebase --continue`,然后说明处理结果。":Bu(e)].join(`
|
|
68
|
+
`)}function Fu(e){if(e.teamRunId)return{type:"team_room",message:Iu(e)};const i=e.currentSessionId||e.selectedSessionId;return i?{type:"session",sessionId:i,message:Ou(e.sourceBranch,e.targetBranch,e.conflictedFiles,e.conflictOp,e)}:{type:"none"}}function Ff({open:e,onOpenChange:i,workspaceId:n,resolutionContextToken:d,conflictOp:v,conflictedFiles:_,sourceBranch:C,targetBranch:r,operation:o,worktreePath:u,mergeAborted:f,mergeStrategy:a,sourceWorkspaceId:p,targetWorkspaceId:m,sourceWorktreePath:y,targetWorktreePath:b,sessions:s,currentSessionId:c,teamRunId:l}){const{t:h}=re(),[g,S]=N.useState(),[k,E]=N.useState(""),[x,w]=N.useState(!1),[A,L]=N.useState(""),R=N.useRef(!0);N.useEffect(()=>(R.current=!0,()=>{R.current=!1}),[]);const M=No(),I=Hn(l??""),P=Wo(),H=!!l,$=Zr(d),T=$?Jr($.actor).find(j=>j.operationId===$.operationId):void 0,O=ni(d),D=O||T?.receiverSessionId||c||A,B=H?I.isPending:M.isPending,q=()=>{const j=Fu({workspaceId:n,worktreePath:u,operation:o,mergeAborted:f,mergeStrategy:a,sourceWorkspaceId:p,targetWorkspaceId:m,sourceWorktreePath:y,targetWorktreePath:b,sourceBranch:C,targetBranch:r,conflictedFiles:_,conflictOp:v,teamRunId:l,currentSessionId:D,selectedSessionId:A});if(j.type==="team_room"){I.mutate({content:j.message,kind:"chat"},{onSuccess:()=>{ke.success(h("已受理,等待发送到 Team Room")),i(!1)}});return}if(j.type!=="session")return;const F=g&&g.workspaceId===n&&g.original===d?g.token:d;er({conflictOp:v,conflictedFiles:_,sourceBranch:C,targetBranch:r,mergeAborted:f,mergeStrategy:a,sourceWorkspaceId:p??n,targetWorkspaceId:m,sourceWorktreePath:y,targetWorktreePath:b,resolutionContextToken:F},j.sessionId),M.mutate({id:j.sessionId,message:j.message,systemAction:"resolve_conflicts",resolutionContextToken:F},{onSuccess:()=>{R.current&&(ti(F),i(!1))},onError:X=>{R.current&&E(X instanceof Error?X.message:String(X))}})},K=()=>{P.mutate({workspaceId:n},{onSuccess:()=>i(!1)})},U=v==="REBASE"?"Rebase":"Merge",z=!H&&!c&&!O&&!T?.receiverSessionId&&s.length>0,W=H||!!D;return t.jsx(At,{isOpen:e,onClose:()=>i(!1),title:h("解决 {opLabel} 冲突",{opLabel:U}),action:t.jsxs(t.Fragment,{children:[t.jsx(ve,{variant:"secondary",onClick:K,disabled:!!(b&&!m&&y!==b),children:h("在 IDE 中打开")}),t.jsx(ve,{variant:"primary",onClick:q,disabled:!W,loading:B,children:h(B?"发送中...":"AI 辅助解决")})]}),children:t.jsxs("div",{className:"space-y-4",children:[!H&&t.jsxs("div",{className:"space-y-2 text-sm",children:[k&&t.jsx("p",{role:"alert",className:"text-red-700",children:k}),t.jsx("p",{children:h("重新核验仅读取 Git,不自动发送。现场变化(包括部分 stage)可能无法继续 AI 恢复;请保留成果,在实际目标手工继续,或确认后明确中止并重做原操作。")}),t.jsxs("p",{children:[h("实际冲突目标目录"),":",t.jsx("code",{children:b??u})]}),(ei()||lo())&&t.jsx("p",{role:"alert",children:h("浏览器存储不可用或资料损坏;本页仅在内存中保留,刷新后可能无法恢复。请先保存操作资料。")}),T?.expiresAt&&t.jsxs("p",{children:[h("恢复截止时间"),":",new Date(T.expiresAt).toLocaleString()]}),O&&t.jsx("p",{children:h("结果未知或待重试的原提交将先使用原 Session、UUID 和原请求核对;明确未受理后才使用新凭据。")}),t.jsx(ve,{variant:"secondary",disabled:x||B,onClick:async()=>{w(!0);try{const j=p??n,F=d?await ae.post(`/workspaces/${j}/conflict-context`,{resolutionContextToken:d}):await ae.get(`/workspaces/${j}/git-status`);if(!R.current)return;if(!F.resolutionContextToken)throw new Error(h("没有可核验的当前冲突。请求尚未受理;请保留原操作资料,确认 Git 状态后明确重新执行原操作。刷新或重试发送不会执行 Git。"));S({original:d,workspaceId:n,token:F.resolutionContextToken}),er({conflictOp:v,conflictedFiles:_,sourceBranch:C,targetBranch:r,mergeAborted:f,mergeStrategy:a,sourceWorkspaceId:j,targetWorkspaceId:m,sourceWorktreePath:y,targetWorktreePath:b,resolutionContextToken:F.resolutionContextToken},D),E("")}catch(j){R.current&&E(j instanceof Error?j.message:String(j))}finally{R.current&&w(!1)}},children:h("只读核验当前冲突")})]}),t.jsxs("div",{children:[t.jsx("h4",{className:"text-[13px] font-medium text-foreground mb-1.5",children:h("冲突文件({count})",{count:_.length})}),t.jsx("div",{className:"max-h-40 overflow-y-auto rounded-lg border border-border/60 bg-foreground/[0.025]",children:_.map(j=>t.jsx("div",{className:"px-3 py-1.5 text-xs font-mono break-all text-foreground/85 border-b border-border/60 last:border-b-0",children:j},j))})]}),H&&t.jsx(Ve,{tone:"info",children:h("TeamRun 模式下会把处理冲突请求发送到 Team Room,由团队调度处理。")}),z&&t.jsx(di,{label:h("选择 Session(AI 辅助解决)"),children:t.jsx(qo,{value:A,onValueChange:L,placeholder:h("选择一个 Session..."),options:s.map(j=>({value:j.id,label:`${j.agentType} — ${j.status}`}))})}),!H&&!D&&s.length===0&&t.jsx("p",{className:"text-sm text-muted-foreground",children:h("没有可用的 Session,请在 IDE 中手动解决冲突。")})]})})}function Hf({recovery:e,onRecover:i}){const{t:n}=re(),[d,v]=N.useState(()=>Date.now());N.useEffect(()=>{const o=setInterval(()=>v(Date.now()),3e4);return()=>clearInterval(o)},[]);const{drafts:_,storageUnavailable:C,identityError:r}=e;return t.jsxs("div",{className:"space-y-2 px-4 text-sm",children:[C&&t.jsx("p",{role:"alert",children:n("浏览器存储不可用或资料损坏;本页仅在内存中保留,刷新后可能无法恢复。请先保存操作资料。")}),r&&t.jsx("p",{role:"alert",children:n("无法确认当前身份,暂不展示已保存的冲突资料。")}),_.map(o=>t.jsxs("div",{className:"rounded border p-2 space-y-1",children:[t.jsx("p",{children:n("已保留原冲突资料;关闭弹窗后可在此重新打开。仅当前身份和本标签页可恢复,关闭标签页或清理浏览器数据会删除资料。")}),t.jsx("p",{children:o.expiresAt&&o.expiresAt<=d?n("恢复证明已过期;保留成果,在实际目标手工继续,或确认后明确中止并重做。已提交但结果未知的请求仍可核对原 UUID。"):`${n("恢复截止时间")}:${o.expiresAt?new Date(o.expiresAt).toLocaleString():n("未知")}`}),t.jsx(me,{variant:"outline",onClick:()=>i(o.details),children:n("恢复上次冲突资料")}),t.jsx(me,{variant:"ghost",onClick:()=>ti(o.details.resolutionContextToken),children:n("清理本地操作资料")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:n("清理不会取消服务端已受理请求;结果未知时请先核对原提交。")})]},o.operationId))]})}function zf(e,i=!0){const[,n]=N.useState(0),d=Si({mutationKey:oe.accessAuth.identityChange})>0,v=Te({queryKey:oe.accessAuth.conflictRecoveryIdentity,queryFn:({signal:a})=>ae.get("/conflict-recovery-identity",{signal:a}),enabled:i&&!d,staleTime:0,gcTime:0,retry:!1}),_=i&&!d&&v.isSuccess&&!v.isFetching?v.data.actor:void 0,[C,r]=N.useState({actor:_,enabled:i});(C.actor!==_||C.enabled!==i)&&r({actor:_,enabled:i}),N.useEffect(()=>{const a=()=>n(p=>p+1);return window.addEventListener(tr,a),()=>window.removeEventListener(tr,a)},[]);const o=_?Jr(_).filter(a=>e.includes(a.details.sourceWorkspaceId??"")):[],u=C.enabled===i&&(!i||_&&C.actor===_)?C.details??null:null;return{drafts:o,actor:_,pendingConflictDetails:u,openDialog:a=>{let p=sr(a);if(i){if(!_||(Zr(p.resolutionContextToken)?.actor??_)!==_)return;const m=p.sourceWorkspaceId;if(!m||!e.includes(m))return;const y=co(_,m),b=o.find(s=>s.details.sourceWorkspaceId===m&&ni(s.details.resolutionContextToken));y?p=sr({conflictOp:p.conflictOp,conflictedFiles:[],resolutionContextToken:y.token}):b&&(p=b.details)}r({actor:_,enabled:i,details:p})},closeDialog:()=>r({actor:_,enabled:i}),storageUnavailable:ei(),identityError:i&&v.isError}}function Hu(e){return[...e?.uncommitted??[],...e?.committed??[]].reduce((n,d)=>({files:n.files+1,additions:n.additions+(d.additions??0),deletions:n.deletions+(d.deletions??0)}),{files:0,additions:0,deletions:0})}function Wr(e,i,n,d){const v=hn(e);if(v){n(v);return}d(e instanceof Error?e.message:i)}function Wf({projectId:e,workspaceId:i,branchName:n,targetBranch:d,commitMessage:v,changes:_,gitStatus:C,isGitStatusLoading:r,canRunGitOperations:o,onOpenChanges:u,onRefreshCommitMessage:f,onConflict:a,className:p}){const{t:m}=re(),y=vi(),b=_i(),s=bi(),[c,l]=N.useState(!1),[h,g]=N.useState(null),S=Vs(i,c),k=(S.data??[]).filter(ln),E=N.useMemo(()=>Hu(_),[_]),x=E.additions+E.deletions,w=E.files>0&&x>0,A=(C?.conflictedFiles.length??0)>0,L=!!(C&&C.operation!=="idle"),R=!!(C&&(C.hasUncommittedChanges||C.untrackedCount>0)),M=(C?.uncommittedCount??0)+(C?.untrackedCount??0),I=(C?.behind??0)>0,P=(C?.ahead??0)>0,H=r||!C&&o,$=!!(o&&i&&C&&I&&!A&&!L&&!R),T=!!(o&&i&&C&&P&&!I&&!A&&!L&&!R),O=!!(o&&i&&C&&!A&&!L&&!R);if(N.useEffect(()=>{c&&f?.()},[c,f]),!w)return null;const D=A?m("冲突"):C?.operation==="rebase"?m("变基中"):C?.operation==="merge"?m("合并中"):M>0?m("{count} 未提交",{count:M}):I?m("落后 {count}",{count:C?.behind??0}):m(P?"可合并":"已是最新"),B=m("{files} 个文件 · {lines} 行",{files:E.files,lines:x}),q=()=>{$&&(g(null),y.mutate(i,{onError:W=>{Wr(W,m("更新失败,请稍后重试"),j=>a(j),g)}}))},K=()=>{O&&(g(null),l(!0))},U=(W,j)=>{g(null),b.mutate({id:i,commitMessage:W,stopActiveServices:j},{onSuccess:()=>l(!1),onError:F=>{if(cn(F)){g(m("后台服务仍在运行,请确认停止服务后再提交。"));return}Wr(F,m("提交失败,请稍后重试"),X=>{l(!1),a(X)},g)}})},z=()=>{b.isPending||(l(!1),g(null))};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:Q("space-y-1",p),children:[t.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg bg-muted/25 px-2 py-1.5",children:[t.jsxs("button",{type:"button",onClick:u,className:"flex min-w-0 flex-1 items-center gap-1.5 rounded-md px-1.5 py-0.5 text-left transition-colors hover:bg-muted/55 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40","aria-label":m("查看变更详情"),children:[t.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-background/70 text-muted-foreground",children:t.jsx(Us,{size:13})}),t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:B}),t.jsx(Qr,{additions:E.additions,deletions:E.deletions,className:"hidden sm:inline-flex"}),A&&t.jsx(Tt,{size:13,className:"shrink-0 text-warning"}),t.jsxs("span",{className:"hidden min-w-0 basis-0 grow max-w-fit items-center gap-1 text-[11px] text-muted-foreground md:flex",children:[t.jsx("span",{className:"truncate font-mono",children:n}),t.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground/70",children:"→"}),t.jsx("span",{className:"truncate font-mono",children:d})]}),t.jsx(zt,{className:"bg-background/75",children:D})]}),t.jsx(Ye,{size:15,className:"shrink-0 text-muted-foreground/70"})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[L&&t.jsx(ve,{variant:"secondary",size:"sm",className:"hidden sm:inline-flex",onClick:()=>s.mutate(i),loading:s.isPending,children:s.isPending?m("正在撤销..."):m("撤销操作")}),t.jsx("span",{title:m(I?"同步更新":"已是最新"),className:Q("inline-flex",(!$||H)&&"cursor-not-allowed"),children:t.jsxs(ve,{variant:"secondary",size:"sm",onClick:q,disabled:!$||H,loading:y.isPending,children:[!y.isPending&&t.jsx(vt,{}),y.isPending?m("正在同步..."):m("更新")]})}),t.jsx("span",{title:T?m("合并到 {target}",{target:d}):m("提交变更"),className:Q("inline-flex",(!O||H)&&"cursor-not-allowed"),children:t.jsxs(ve,{variant:"primary",size:"sm",onClick:K,disabled:!O||H,loading:b.isPending,children:[!b.isPending&&t.jsx($s,{}),b.isPending?m("正在提交..."):m("合并")]})})]})]}),h&&t.jsx(Ve,{tone:"danger",size:"sm",children:h})]}),t.jsx(dn,{projectId:e,workspaceId:i,canMerge:T,isOpen:c,onClose:z,onBaseBranchSaved:u,branchName:n,targetBranch:d,commitMessage:v,isPending:b.isPending,activeServices:k,isCheckingServices:S.isLoading,serviceCheckFailed:S.isError,error:h,onConfirm:U})]})}const $r=["creating-workspace","creating-session","starting-session"];function $f({state:e,setupProgress:i,sessionStarted:n=!1,onRetry:d,compact:v=!1}){const{t:_}=re(),[C,r]=N.useState(!1),o=e?.status==="failed",u=i?.status==="failed",f=o||u,a=e?$r.indexOf(e.status):$r.length,p=[_("Preparing workspace"),_("Creating session"),_("Starting agent")],m=(e?.setupScript??"").split(`
|
|
69
|
+
`).map(s=>s.trim()).filter(Boolean),y=e||n?p.map((s,c)=>({label:s,status:o?"pending":c<a?"completed":c===a?"active":"pending"})):[];(i||m.length>0)&&y.push({label:i?.status==="running"?_("Running setup ({current}/{total})",{current:i.currentIndex??0,total:i.totalCommands}):i?.status==="completed"?_("Setup complete"):i?.status==="failed"?_("Setup failed"):_("Run setup script"),status:i?.status==="running"?"active":i?.status??"pending",description:i?.currentCommand||m.join(`
|
|
70
|
+
`)});const b=!!i?.output?.trim();return!e&&!i?null:t.jsxs("div",{className:`${v?"my-2 mb-4":"my-3 mb-6"} mx-auto w-full max-w-2xl rounded-xl border ${f?"border-destructive/30 bg-destructive/[0.03]":"border-border/70 bg-background"} px-4 py-3 text-left shadow-raised`,role:f?"alert":"status","aria-live":f?"assertive":"polite",children:[f&&(e?.error||i?.error||o)?t.jsx("p",{className:"mb-2 break-words text-xs text-destructive-ink",children:e?.error||i?.error||_("Agent start failed")}):null,t.jsx("div",{className:"space-y-2",children:y.map(({label:s,status:c,description:l})=>{const h=c==="completed",g=c==="active";return t.jsxs("div",{className:`flex items-start gap-2 text-sm ${c==="failed"?"text-destructive-ink":h||g?"text-info-ink":"text-muted-foreground"}`,children:[h?t.jsx(zn,{className:"h-4 w-4 shrink-0"}):g?t.jsx(Os,{className:"h-4 w-4 shrink-0 animate-spin motion-reduce:animate-none"}):c==="failed"?t.jsx(Gr,{className:"h-4 w-4 shrink-0"}):t.jsx(Jo,{className:"h-4 w-4 shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{children:s}),l&&t.jsx("code",{className:"mt-1 block whitespace-pre-wrap break-all rounded-md bg-muted/35 px-2.5 py-2 text-xs leading-relaxed text-muted-foreground",children:l})]})]},s)})}),(b||o)&&t.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 border-t border-border/50 pt-2",children:[b?t.jsxs("button",{type:"button",onClick:()=>r(s=>!s),className:"inline-flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground","aria-expanded":C,"aria-controls":"task-start-progress-details",children:[C?t.jsx(ze,{className:"h-3.5 w-3.5"}):t.jsx(Ye,{className:"h-3.5 w-3.5"}),_(C?"Hide setup output":"View setup output")]}):t.jsx("span",{}),o&&d?t.jsx(me,{size:"sm",variant:"outline",onClick:d,children:_("Retry start")}):null]}),C&&t.jsx("div",{id:"task-start-progress-details",className:"mt-2 rounded-md bg-muted/35 px-2.5 py-2 text-xs leading-relaxed text-muted-foreground",children:t.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono",children:i?.output??""})})]})}function zu({agentType:e,workingDir:i}){return Te({queryKey:oe.system.skillCatalog(e,i),queryFn:async()=>(await ae.get("/system/skill-catalog",{params:{agentType:String(e),...i?{workingDir:i}:{}}})).commands,enabled:e===si.CODEX,staleTime:3e4})}function Wu(e){const i=e.key==="Enter"&&!e.shiftKey&&!e.repeat&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229,n=e.key==="Tab"&&!e.shiftKey;return i||n}function Uf({agentType:e,workingDir:i,input:n,setInput:d,textareaRef:v,minHeight:_,maxHeight:C}){const[r,o]=N.useState(0),{data:u=[]}=zu({agentType:e,workingDir:i}),a=N.useMemo(()=>e===si.CODEX?ir(n):null,[e,n])?.query??null,p=N.useMemo(()=>a===null?[]:Ro(u,a),[a,u]),m=N.useCallback(()=>{const s=v.current;s&&(s.style.height="auto",s.style.height=`${Math.max(_,Math.min(s.scrollHeight,C))}px`)},[C,_,v]);N.useEffect(()=>{o(0)},[e,a]),N.useEffect(()=>{r<p.length||o(0)},[p.length,r]);const y=N.useCallback(s=>{const c=ir(n);if(!c)return;const l=`${n.slice(0,c.replaceStart)}${s.command} `;d(l),requestAnimationFrame(()=>{const h=v.current;h&&(m(),h.focus(),h.setSelectionRange(l.length,l.length))})},[n,m,d,v]),b=N.useCallback(s=>a===null||p.length===0?!1:s.key==="ArrowDown"?(s.preventDefault(),o(c=>(c+1)%p.length),!0):s.key==="ArrowUp"?(s.preventDefault(),o(c=>(c-1+p.length)%p.length),!0):Wu(s)?(s.preventDefault(),y(p[r]??p[0]),!0):!1,[y,p,a,r]);return{allSkills:u,query:a,filteredSkills:p,selectedIndex:r,setSelectedIndex:o,applySkill:y,handleKeyDown:b}}const ws=200,$u=180;function qf({taskId:e,title:i,readOnly:n=!1,onTitleChange:d,className:v,titleClassName:_,compact:C=!1}){const{t:r}=re(),[o,u]=N.useState(!1),[f,a]=N.useState(i),[p,m]=N.useState(!1),y=N.useRef(null),b=N.useRef(null),s=Wn();N.useEffect(()=>{o||a(i)},[i,o]),N.useEffect(()=>{o&&y.current&&(y.current.focus(),y.current.select())},[o]),N.useEffect(()=>{if(!o)return;const w=A=>{b.current&&!b.current.contains(A.target)&&h()};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o,f]);const c=N.useCallback(()=>{n||(u(!0),a(i))},[n,i]),l=N.useCallback(()=>{u(!1),a(i)},[i]),h=N.useCallback(async()=>{const w=f.trim();if(!w){a(i),u(!1);return}if(w===i){u(!1);return}try{await s.mutateAsync({id:e,title:w}),d?.(w),u(!1)}catch(A){console.error("Failed to update task title:",A),a(i)}},[f,i,e,s,d]),g=N.useCallback(w=>{w.key==="Enter"&&!w.shiftKey?(w.preventDefault(),h()):w.key==="Escape"&&(w.preventDefault(),l())},[h,l]),S=N.useCallback(w=>{const A=w.target.value;A.length<=ws&&a(A)},[]),k=f.length,E=k>=$u,x=k>=ws;return o?t.jsxs("div",{ref:b,className:Q("flex flex-col gap-2",v),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{ref:y,type:"text",value:f,onChange:S,onKeyDown:g,disabled:s.isPending,className:Q("flex-1 min-w-0 px-2 py-1 text-[15px] font-semibold bg-background border border-input rounded-md","focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent","disabled:opacity-50 disabled:cursor-not-allowed",C&&"text-base py-0.5",_),placeholder:r("输入任务标题")}),t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t.jsx(me,{size:C?"sm":"default",variant:"ghost",onClick:h,disabled:s.isPending||!f.trim(),className:"h-8 w-8 p-0",children:s.isPending?t.jsx(Os,{size:16,className:"animate-spin motion-reduce:[animation-duration:2.4s]"}):t.jsx(kt,{size:16})}),t.jsx(me,{size:C?"sm":"default",variant:"ghost",onClick:l,disabled:s.isPending,className:"h-8 w-8 p-0",children:t.jsx(Qe,{size:16})})]})]}),E&&t.jsxs("div",{className:Q("text-xs",x?"text-destructive-ink":"text-muted-foreground"),children:[k," / ",ws," ",r("字符")]})]}):t.jsxs("div",{ref:b,className:Q("group flex items-center gap-2 min-w-0",v),onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[t.jsx("h2",{onClick:c,className:Q("flex-1 min-w-0 text-[15px] font-semibold text-foreground break-words line-clamp-2",!n&&"cursor-text hover:text-foreground/80 transition-colors",C&&"text-base",_),children:i}),!n&&p&&t.jsx(me,{size:"sm",variant:"ghost",onClick:c,className:"h-7 w-7 p-0 shrink-0 opacity-60 hover:opacity-100",title:r("编辑标题"),children:t.jsx(Ko,{size:14})})]})}export{Hf as C,un as D,qf as E,Us as G,Tf as R,If as S,jf as T,Wf as W,Uf as a,Xh as b,Rf as c,Et as d,Lf as e,zf as f,Af as g,Of as h,Ef as i,$f as j,Df as k,Mf as l,Bf as m,Ff as n,Yh as o,on as p,an as q,Nf as r,Tu as s,eu as t,Pf as u,Fi as v};
|