factory-factory 0.3.2 → 0.3.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/client/assets/{_basePickBy-DXuH24ai.js → _basePickBy-0_GqMukI.js} +1 -1
- package/dist/client/assets/{_baseUniq-CslDyWeR.js → _baseUniq-BkDCIs_N.js} +1 -1
- package/dist/client/assets/{arc-2gvAyDbt.js → arc-BYBi6T58.js} +1 -1
- package/dist/client/assets/{architectureDiagram-VXUJARFQ-DgcFaiEM.js → architectureDiagram-VXUJARFQ-utRnH0EI.js} +1 -1
- package/dist/client/assets/{blockDiagram-VD42YOAC-x5GBnWvh.js → blockDiagram-VD42YOAC-ke2uPDpN.js} +1 -1
- package/dist/client/assets/{c4Diagram-YG6GDRKO-BH1ALhYh.js → c4Diagram-YG6GDRKO-DAt0t6eK.js} +1 -1
- package/dist/client/assets/channel-BA4I5_zc.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-BrzGnqT-.js → chunk-4BX2VUAB-D1vNGBo6.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-l8A9_mQA.js → chunk-55IACEB6-BDwpH7UI.js} +1 -1
- package/dist/client/assets/{chunk-B4BG7PRW-BsAqXKe3.js → chunk-B4BG7PRW-DAM5zmSO.js} +1 -1
- package/dist/client/assets/{chunk-DI55MBZ5-IIbvvT0k.js → chunk-DI55MBZ5-CgmMeVp9.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-DLu7thHk.js → chunk-FMBD7UC4-nijXNm9V.js} +1 -1
- package/dist/client/assets/{chunk-QN33PNHL-WRLtM-7j.js → chunk-QN33PNHL-GM5iQLPS.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-Dsklvm2v.js → chunk-QZHKN3VN-CbOwrlLz.js} +1 -1
- package/dist/client/assets/{chunk-TZMSLE5B-D06U47VI.js → chunk-TZMSLE5B-D0eFaU6T.js} +1 -1
- package/dist/client/assets/classDiagram-2ON5EDUG-DHiY0J8v.js +1 -0
- package/dist/client/assets/classDiagram-v2-WZHVMYZB-DHiY0J8v.js +1 -0
- package/dist/client/assets/clone-C7QOkM1k.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-BYd0MvfE.js → cose-bilkent-S5V4N54A-BAHIgVQk.js} +1 -1
- package/dist/client/assets/{dagre-6UL2VRFP-D-kPXmRT.js → dagre-6UL2VRFP-CNvHuwOI.js} +1 -1
- package/dist/client/assets/{diagram-PSM6KHXK-QIglBDlg.js → diagram-PSM6KHXK-726LBpxe.js} +1 -1
- package/dist/client/assets/{diagram-QEK2KX5R-CMd7cwDZ.js → diagram-QEK2KX5R-DQsnVN2A.js} +1 -1
- package/dist/client/assets/{diagram-S2PKOQOG-TfTgUpyH.js → diagram-S2PKOQOG-D_T0ifdw.js} +1 -1
- package/dist/client/assets/{erDiagram-Q2GNP2WA-DtuLC2xg.js → erDiagram-Q2GNP2WA-BmVDGu8M.js} +1 -1
- package/dist/client/assets/{flowDiagram-NV44I4VS-DfgrrhwS.js → flowDiagram-NV44I4VS-Z65JFfSc.js} +1 -1
- package/dist/client/assets/{ganttDiagram-JELNMOA3-D_dPspnH.js → ganttDiagram-JELNMOA3-BZ3yfDKP.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-NY62KEGX-DJsigQIR.js → gitGraphDiagram-NY62KEGX-faBi9oTt.js} +1 -1
- package/dist/client/assets/{graph-B9NXnAuJ.js → graph-DMDSMqaB.js} +1 -1
- package/dist/client/assets/{index-DY2IN4MN.js → index-D9ddlgEa.js} +6 -6
- package/dist/client/assets/{infoDiagram-WHAUD3N6-D5yAAuIK.js → infoDiagram-WHAUD3N6-CJU-Jxtx.js} +1 -1
- package/dist/client/assets/{journeyDiagram-XKPGCS4Q-DMeR4Vy_.js → journeyDiagram-XKPGCS4Q-CIFki-iq.js} +1 -1
- package/dist/client/assets/{kanban-definition-3W4ZIXB7-xNNLjBQO.js → kanban-definition-3W4ZIXB7-DDuM9VeF.js} +1 -1
- package/dist/client/assets/{layout-Bv4qdz5g.js → layout-CnYzyA25.js} +1 -1
- package/dist/client/assets/{linear-DOse4wNy.js → linear-BoRrKhGP.js} +1 -1
- package/dist/client/assets/{mindmap-definition-VGOIOE7T-BjuQGPGv.js → mindmap-definition-VGOIOE7T-QhVqNLyz.js} +1 -1
- package/dist/client/assets/{pieDiagram-ADFJNKIX-VvsVA8GJ.js → pieDiagram-ADFJNKIX-BkK0cKA8.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-AYHSOK5B-oRc7Vk8X.js → quadrantDiagram-AYHSOK5B-CeFigc3p.js} +1 -1
- package/dist/client/assets/{requirementDiagram-UZGBJVZJ-Dq3exCr2.js → requirementDiagram-UZGBJVZJ-KowHp3BW.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-TZEHDZUN-Dzab26G_.js → sankeyDiagram-TZEHDZUN-D7CevVS2.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-WL72ISMW-C0gbEvnf.js → sequenceDiagram-WL72ISMW-3mHDMyaP.js} +1 -1
- package/dist/client/assets/{stateDiagram-FKZM4ZOC-lFd4FBIQ.js → stateDiagram-FKZM4ZOC-h-G1xS2P.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-4FDKWEC3-BGGNxhyR.js +1 -0
- package/dist/client/assets/{terminal-instance-BI_R5Gu9.js → terminal-instance-BbEVZkgm.js} +1 -1
- package/dist/client/assets/{timeline-definition-IT6M3QCI-DEWrwvzp.js → timeline-definition-IT6M3QCI-Cc2H2fvU.js} +1 -1
- package/dist/client/assets/{treemap-KMMF4GRG-5d3j9VOH.js → treemap-KMMF4GRG-BAjv-2_R.js} +1 -1
- package/dist/client/assets/{xychartDiagram-PRI3JC2R-uBZMdNdc.js → xychartDiagram-PRI3JC2R-CqgFJhi0.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/src/backend/app-context.d.ts +3 -2
- package/dist/src/backend/app-context.d.ts.map +1 -1
- package/dist/src/backend/app-context.js +2 -1
- package/dist/src/backend/app-context.js.map +1 -1
- package/dist/src/backend/domains/github/github-cli/mappers.d.ts +1 -1
- package/dist/src/backend/domains/github/github-cli/mappers.d.ts.map +1 -1
- package/dist/src/backend/domains/github/github-cli/mappers.js +1 -1
- package/dist/src/backend/domains/github/github-cli/mappers.js.map +1 -1
- package/dist/src/backend/domains/github/github-cli/schemas.d.ts +6 -6
- package/dist/src/backend/domains/github/github-cli.service.d.ts +1 -1
- package/dist/src/backend/domains/github/github-cli.service.d.ts.map +1 -1
- package/dist/src/backend/domains/github/github-cli.service.js.map +1 -1
- package/dist/src/backend/domains/ratchet/bridges.d.ts +1 -1
- package/dist/src/backend/domains/ratchet/bridges.d.ts.map +1 -1
- package/dist/src/backend/domains/ratchet/ci-fixer.service.d.ts +1 -1
- package/dist/src/backend/domains/ratchet/ci-fixer.service.d.ts.map +1 -1
- package/dist/src/backend/domains/ratchet/ci-fixer.service.js.map +1 -1
- package/dist/src/backend/domains/ratchet/ci-fixer.service.test.js +1 -1
- package/dist/src/backend/domains/ratchet/ci-fixer.service.test.js.map +1 -1
- package/dist/src/backend/domains/ratchet/ci-monitor.service.js +1 -1
- package/dist/src/backend/domains/ratchet/ci-monitor.service.js.map +1 -1
- package/dist/src/backend/domains/ratchet/fixer-session.service.d.ts +1 -1
- package/dist/src/backend/domains/ratchet/fixer-session.service.d.ts.map +1 -1
- package/dist/src/backend/domains/ratchet/fixer-session.service.js +1 -1
- package/dist/src/backend/domains/ratchet/fixer-session.service.js.map +1 -1
- package/dist/src/backend/domains/ratchet/fixer-session.service.test.js +1 -1
- package/dist/src/backend/domains/ratchet/fixer-session.service.test.js.map +1 -1
- package/dist/src/backend/domains/ratchet/ratchet.service.d.ts +1 -1
- package/dist/src/backend/domains/ratchet/ratchet.service.d.ts.map +1 -1
- package/dist/src/backend/domains/ratchet/ratchet.service.js +1 -1
- package/dist/src/backend/domains/ratchet/ratchet.service.js.map +1 -1
- package/dist/src/backend/domains/ratchet/ratchet.service.test.js +1 -1
- package/dist/src/backend/domains/ratchet/ratchet.service.test.js.map +1 -1
- package/dist/src/backend/domains/ratchet/reconciliation.service.js +1 -1
- package/dist/src/backend/domains/ratchet/reconciliation.service.js.map +1 -1
- package/dist/src/backend/domains/run-script/run-script-state-machine.service.d.ts +1 -1
- package/dist/src/backend/domains/run-script/run-script-state-machine.service.d.ts.map +1 -1
- package/dist/src/backend/domains/run-script/run-script-state-machine.service.js.map +1 -1
- package/dist/src/backend/domains/run-script/run-script.service.d.ts +1 -1
- package/dist/src/backend/domains/session/data/session-data.service.d.ts +1 -1
- package/dist/src/backend/domains/session/data/session-data.service.d.ts.map +1 -1
- package/dist/src/backend/domains/session/data/session-data.service.js.map +1 -1
- package/dist/src/backend/domains/session/index.d.ts +1 -0
- package/dist/src/backend/domains/session/index.d.ts.map +1 -1
- package/dist/src/backend/domains/session/index.js +1 -0
- package/dist/src/backend/domains/session/index.js.map +1 -1
- package/dist/src/backend/domains/session/lifecycle/session.service.d.ts +9 -0
- package/dist/src/backend/domains/session/lifecycle/session.service.d.ts.map +1 -1
- package/dist/src/backend/domains/session/lifecycle/session.service.js +170 -2
- package/dist/src/backend/domains/session/lifecycle/session.service.js.map +1 -1
- package/dist/src/backend/domains/session/lifecycle/session.service.test.js +47 -1
- package/dist/src/backend/domains/session/lifecycle/session.service.test.js.map +1 -1
- package/dist/src/backend/domains/session/logging/acp-trace-logger.service.d.ts +15 -0
- package/dist/src/backend/domains/session/logging/acp-trace-logger.service.d.ts.map +1 -0
- package/dist/src/backend/domains/session/logging/acp-trace-logger.service.js +135 -0
- package/dist/src/backend/domains/session/logging/acp-trace-logger.service.js.map +1 -0
- package/dist/src/backend/domains/session/logging/acp-trace-logger.service.test.d.ts +2 -0
- package/dist/src/backend/domains/session/logging/acp-trace-logger.service.test.d.ts.map +1 -0
- package/dist/src/backend/domains/session/logging/acp-trace-logger.service.test.js +93 -0
- package/dist/src/backend/domains/session/logging/acp-trace-logger.service.test.js.map +1 -0
- package/dist/src/backend/domains/workspace/lifecycle/data.service.d.ts +1 -1
- package/dist/src/backend/domains/workspace/lifecycle/data.service.d.ts.map +1 -1
- package/dist/src/backend/domains/workspace/lifecycle/data.service.js.map +1 -1
- package/dist/src/backend/domains/workspace/lifecycle/state-machine.service.d.ts +1 -1
- package/dist/src/backend/domains/workspace/lifecycle/state-machine.service.d.ts.map +1 -1
- package/dist/src/backend/domains/workspace/lifecycle/state-machine.service.js.map +1 -1
- package/dist/src/backend/domains/workspace/query/workspace-query.service.d.ts +2 -2
- package/dist/src/backend/domains/workspace/query/workspace-query.service.d.ts.map +1 -1
- package/dist/src/backend/domains/workspace/query/workspace-query.service.js +1 -1
- package/dist/src/backend/domains/workspace/query/workspace-query.service.js.map +1 -1
- package/dist/src/backend/domains/workspace/state/flow-state.d.ts +1 -1
- package/dist/src/backend/domains/workspace/state/flow-state.d.ts.map +1 -1
- package/dist/src/backend/domains/workspace/state/flow-state.js +1 -1
- package/dist/src/backend/domains/workspace/state/flow-state.js.map +1 -1
- package/dist/src/backend/domains/workspace/state/flow-state.test.js +1 -1
- package/dist/src/backend/domains/workspace/state/flow-state.test.js.map +1 -1
- package/dist/src/backend/domains/workspace/state/init-policy.d.ts +1 -1
- package/dist/src/backend/domains/workspace/state/init-policy.d.ts.map +1 -1
- package/dist/src/backend/domains/workspace/state/kanban-state.d.ts +1 -1
- package/dist/src/backend/domains/workspace/state/kanban-state.d.ts.map +1 -1
- package/dist/src/backend/domains/workspace/state/kanban-state.js +1 -1
- package/dist/src/backend/domains/workspace/state/kanban-state.js.map +1 -1
- package/dist/src/backend/domains/workspace/worktree/worktree-init.test.js +1 -1
- package/dist/src/backend/domains/workspace/worktree/worktree-init.test.js.map +1 -1
- package/dist/src/backend/lib/session-summaries.d.ts +1 -1
- package/dist/src/backend/lib/session-summaries.d.ts.map +1 -1
- package/dist/src/backend/orchestration/data-backup.service.test.js +1 -1
- package/dist/src/backend/orchestration/data-backup.service.test.js.map +1 -1
- package/dist/src/backend/orchestration/event-collector.orchestrator.d.ts.map +1 -1
- package/dist/src/backend/orchestration/event-collector.orchestrator.js.map +1 -1
- package/dist/src/backend/orchestration/workspace-init.orchestrator.js +1 -1
- package/dist/src/backend/orchestration/workspace-init.orchestrator.js.map +1 -1
- package/dist/src/backend/orchestration/workspace-init.orchestrator.test.js +1 -1
- package/dist/src/backend/orchestration/workspace-init.orchestrator.test.js.map +1 -1
- package/dist/src/backend/resource_accessors/agent-session.accessor.d.ts +1 -1
- package/dist/src/backend/resource_accessors/agent-session.accessor.d.ts.map +1 -1
- package/dist/src/backend/resource_accessors/agent-session.accessor.js +1 -1
- package/dist/src/backend/resource_accessors/agent-session.accessor.js.map +1 -1
- package/dist/src/backend/resource_accessors/terminal-session.accessor.d.ts +1 -1
- package/dist/src/backend/resource_accessors/terminal-session.accessor.d.ts.map +1 -1
- package/dist/src/backend/resource_accessors/terminal-session.accessor.js.map +1 -1
- package/dist/src/backend/resource_accessors/workspace.accessor.d.ts +1 -1
- package/dist/src/backend/resource_accessors/workspace.accessor.d.ts.map +1 -1
- package/dist/src/backend/resource_accessors/workspace.accessor.js.map +1 -1
- package/dist/src/backend/server.d.ts.map +1 -1
- package/dist/src/backend/server.js +3 -1
- package/dist/src/backend/server.js.map +1 -1
- package/dist/src/backend/server.upgrade.test.js +4 -0
- package/dist/src/backend/server.upgrade.test.js.map +1 -1
- package/dist/src/backend/services/workspace-snapshot-store.service.d.ts +1 -1
- package/dist/src/backend/services/workspace-snapshot-store.service.d.ts.map +1 -1
- package/dist/src/backend/services/workspace-snapshot-store.service.test.js +1 -1
- package/dist/src/backend/services/workspace-snapshot-store.service.test.js.map +1 -1
- package/dist/src/backend/trpc/admin.trpc.d.ts +16 -16
- package/dist/src/backend/trpc/admin.trpc.js +1 -1
- package/dist/src/backend/trpc/admin.trpc.js.map +1 -1
- package/dist/src/backend/trpc/index.d.ts +24 -24
- package/dist/src/backend/trpc/session.trpc.d.ts +2 -2
- package/dist/src/backend/trpc/session.trpc.d.ts.map +1 -1
- package/dist/src/backend/trpc/session.trpc.js +1 -1
- package/dist/src/backend/trpc/session.trpc.js.map +1 -1
- package/dist/src/backend/trpc/workspace/run-script.trpc.d.ts +1 -1
- package/dist/src/backend/trpc/workspace.trpc.d.ts +6 -6
- package/dist/src/backend/trpc/workspace.trpc.d.ts.map +1 -1
- package/dist/src/backend/trpc/workspace.trpc.js +1 -1
- package/dist/src/backend/trpc/workspace.trpc.js.map +1 -1
- package/{packages/core/dist/shared → dist/src/shared/core}/ci-status.d.ts +1 -1
- package/dist/src/shared/core/ci-status.d.ts.map +1 -0
- package/dist/src/shared/core/ci-status.js.map +1 -0
- package/dist/src/shared/core/enums.d.ts.map +1 -0
- package/dist/src/shared/core/enums.js.map +1 -0
- package/{packages/core/dist → dist/src/shared/core}/index.d.ts +3 -3
- package/dist/src/shared/core/index.d.ts.map +1 -0
- package/{packages/core/dist → dist/src/shared/core}/index.js +3 -7
- package/dist/src/shared/core/index.js.map +1 -0
- package/{packages/core/dist/shared → dist/src/shared/core}/workspace-sidebar-status.d.ts +1 -1
- package/dist/src/shared/core/workspace-sidebar-status.d.ts.map +1 -0
- package/dist/src/shared/core/workspace-sidebar-status.js.map +1 -0
- package/dist/src/shared/schemas/export-data.schema.d.ts +38 -38
- package/dist/src/shared/schemas/export-data.schema.d.ts.map +1 -1
- package/dist/src/shared/schemas/export-data.schema.js +1 -1
- package/dist/src/shared/schemas/export-data.schema.js.map +1 -1
- package/dist/src/shared/session-runtime.d.ts +1 -1
- package/dist/src/shared/session-runtime.d.ts.map +1 -1
- package/dist/src/shared/workspace-sidebar-status.d.ts +1 -1
- package/dist/src/shared/workspace-sidebar-status.d.ts.map +1 -1
- package/dist/src/shared/workspace-sidebar-status.js +1 -1
- package/dist/src/shared/workspace-sidebar-status.js.map +1 -1
- package/dist/tsconfig.backend.tsbuildinfo +1 -1
- package/package.json +1 -4
- package/dist/client/assets/channel-C_n33uex.js +0 -1
- package/dist/client/assets/classDiagram-2ON5EDUG-ByvTr4wu.js +0 -1
- package/dist/client/assets/classDiagram-v2-WZHVMYZB-ByvTr4wu.js +0 -1
- package/dist/client/assets/clone-CVeCVXXl.js +0 -1
- package/dist/client/assets/stateDiagram-v2-4FDKWEC3-C7liWkST.js +0 -1
- package/packages/core/dist/index.d.ts.map +0 -1
- package/packages/core/dist/index.js.map +0 -1
- package/packages/core/dist/shared/ci-status.d.ts.map +0 -1
- package/packages/core/dist/shared/ci-status.js.map +0 -1
- package/packages/core/dist/shared/workspace-sidebar-status.d.ts.map +0 -1
- package/packages/core/dist/shared/workspace-sidebar-status.js.map +0 -1
- package/packages/core/dist/types/enums.d.ts.map +0 -1
- package/packages/core/dist/types/enums.js.map +0 -1
- package/packages/core/dist/types/index.d.ts +0 -2
- package/packages/core/dist/types/index.d.ts.map +0 -1
- package/packages/core/dist/types/index.js +0 -2
- package/packages/core/dist/types/index.js.map +0 -1
- package/packages/core/package.json +0 -25
- /package/{packages/core/dist/shared → dist/src/shared/core}/ci-status.js +0 -0
- /package/{packages/core/dist/types → dist/src/shared/core}/enums.d.ts +0 -0
- /package/{packages/core/dist/types → dist/src/shared/core}/enums.js +0 -0
- /package/{packages/core/dist/shared → dist/src/shared/core}/workspace-sidebar-status.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-6UL2VRFP-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-6UL2VRFP-CNvHuwOI.js","assets/graph-DMDSMqaB.js","assets/_baseUniq-BkDCIs_N.js","assets/layout-CnYzyA25.js","assets/_basePickBy-0_GqMukI.js","assets/clone-C7QOkM1k.js","assets/cose-bilkent-S5V4N54A-BAHIgVQk.js","assets/cytoscape.esm-5J0xJHOV.js","assets/c4Diagram-YG6GDRKO-DAt0t6eK.js","assets/chunk-TZMSLE5B-D0eFaU6T.js","assets/flowDiagram-NV44I4VS-Z65JFfSc.js","assets/chunk-FMBD7UC4-nijXNm9V.js","assets/chunk-55IACEB6-BDwpH7UI.js","assets/chunk-QN33PNHL-GM5iQLPS.js","assets/channel-BA4I5_zc.js","assets/erDiagram-Q2GNP2WA-BmVDGu8M.js","assets/gitGraphDiagram-NY62KEGX-faBi9oTt.js","assets/chunk-4BX2VUAB-D1vNGBo6.js","assets/chunk-QZHKN3VN-CbOwrlLz.js","assets/treemap-KMMF4GRG-BAjv-2_R.js","assets/ganttDiagram-JELNMOA3-BZ3yfDKP.js","assets/linear-BoRrKhGP.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-WHAUD3N6-CJU-Jxtx.js","assets/pieDiagram-ADFJNKIX-BkK0cKA8.js","assets/arc-BYBi6T58.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-AYHSOK5B-CeFigc3p.js","assets/xychartDiagram-PRI3JC2R-CqgFJhi0.js","assets/requirementDiagram-UZGBJVZJ-KowHp3BW.js","assets/sequenceDiagram-WL72ISMW-3mHDMyaP.js","assets/classDiagram-2ON5EDUG-DHiY0J8v.js","assets/chunk-B4BG7PRW-DAM5zmSO.js","assets/classDiagram-v2-WZHVMYZB-DHiY0J8v.js","assets/stateDiagram-FKZM4ZOC-h-G1xS2P.js","assets/chunk-DI55MBZ5-CgmMeVp9.js","assets/stateDiagram-v2-4FDKWEC3-BGGNxhyR.js","assets/journeyDiagram-XKPGCS4Q-CIFki-iq.js","assets/timeline-definition-IT6M3QCI-Cc2H2fvU.js","assets/mindmap-definition-VGOIOE7T-QhVqNLyz.js","assets/kanban-definition-3W4ZIXB7-DDuM9VeF.js","assets/sankeyDiagram-TZEHDZUN-D7CevVS2.js","assets/diagram-S2PKOQOG-D_T0ifdw.js","assets/diagram-QEK2KX5R-DQsnVN2A.js","assets/blockDiagram-VD42YOAC-ke2uPDpN.js","assets/architectureDiagram-VXUJARFQ-utRnH0EI.js","assets/diagram-PSM6KHXK-726LBpxe.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function Mpe(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const a=Object.getOwnPropertyDescriptor(r,i);a&&Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function Zy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ck={exports:{}},kg={};var r$;function Lpe(){if(r$)return kg;r$=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,a){var s=null;if(a!==void 0&&(s=""+a),i.key!==void 0&&(s=""+i.key),"key"in i){a={};for(var o in i)o!=="key"&&(a[o]=i[o])}else a=i;return i=a.ref,{$$typeof:e,type:r,key:s,ref:i!==void 0?i:null,props:a}}return kg.Fragment=t,kg.jsx=n,kg.jsxs=n,kg}var i$;function Ppe(){return i$||(i$=1,Ck.exports=Lpe()),Ck.exports}var h=Ppe(),Tk={exports:{}},Gt={};var a$;function Bpe(){if(a$)return Gt;a$=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),s=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),m=Symbol.iterator;function g(Y){return Y===null||typeof Y!="object"?null:(Y=m&&Y[m]||Y["@@iterator"],typeof Y=="function"?Y:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,S={};function w(Y,K,j){this.props=Y,this.context=K,this.refs=S,this.updater=j||y}w.prototype.isReactComponent={},w.prototype.setState=function(Y,K){if(typeof Y!="object"&&typeof Y!="function"&&Y!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,Y,K,"setState")},w.prototype.forceUpdate=function(Y){this.updater.enqueueForceUpdate(this,Y,"forceUpdate")};function E(){}E.prototype=w.prototype;function T(Y,K,j){this.props=Y,this.context=K,this.refs=S,this.updater=j||y}var A=T.prototype=new E;A.constructor=T,_(A,w.prototype),A.isPureReactComponent=!0;var O=Array.isArray;function I(){}var N={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function F(Y,K,j){var ee=j.ref;return{$$typeof:e,type:Y,key:K,ref:ee!==void 0?ee:null,props:j}}function P(Y,K){return F(Y.type,K,Y.props)}function $(Y){return typeof Y=="object"&&Y!==null&&Y.$$typeof===e}function W(Y){var K={"=":"=0",":":"=2"};return"$"+Y.replace(/[=:]/g,function(j){return K[j]})}var V=/\/+/g;function H(Y,K){return typeof Y=="object"&&Y!==null&&Y.key!=null?W(""+Y.key):K.toString(36)}function z(Y){switch(Y.status){case"fulfilled":return Y.value;case"rejected":throw Y.reason;default:switch(typeof Y.status=="string"?Y.then(I,I):(Y.status="pending",Y.then(function(K){Y.status==="pending"&&(Y.status="fulfilled",Y.value=K)},function(K){Y.status==="pending"&&(Y.status="rejected",Y.reason=K)})),Y.status){case"fulfilled":return Y.value;case"rejected":throw Y.reason}}throw Y}function M(Y,K,j,ee,re){var de=typeof Y;(de==="undefined"||de==="boolean")&&(Y=null);var le=!1;if(Y===null)le=!0;else switch(de){case"bigint":case"string":case"number":le=!0;break;case"object":switch(Y.$$typeof){case e:case t:le=!0;break;case d:return le=Y._init,M(le(Y._payload),K,j,ee,re)}}if(le)return re=re(Y),le=ee===""?"."+H(Y,0):ee,O(re)?(j="",le!=null&&(j=le.replace(V,"$&/")+"/"),M(re,K,j,"",function(we){return we})):re!=null&&($(re)&&(re=P(re,j+(re.key==null||Y&&Y.key===re.key?"":(""+re.key).replace(V,"$&/")+"/")+le)),K.push(re)),1;le=0;var _e=ee===""?".":ee+":";if(O(Y))for(var Ae=0;Ae<Y.length;Ae++)ee=Y[Ae],de=_e+H(ee,Ae),le+=M(ee,K,j,de,re);else if(Ae=g(Y),typeof Ae=="function")for(Y=Ae.call(Y),Ae=0;!(ee=Y.next()).done;)ee=ee.value,de=_e+H(ee,Ae++),le+=M(ee,K,j,de,re);else if(de==="object"){if(typeof Y.then=="function")return M(z(Y),K,j,ee,re);throw K=String(Y),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(Y).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return le}function G(Y,K,j){if(Y==null)return Y;var ee=[],re=0;return M(Y,ee,"","",function(de){return K.call(j,de,re++)}),ee}function B(Y){if(Y._status===-1){var K=Y._result;K=K(),K.then(function(j){(Y._status===0||Y._status===-1)&&(Y._status=1,Y._result=j)},function(j){(Y._status===0||Y._status===-1)&&(Y._status=2,Y._result=j)}),Y._status===-1&&(Y._status=0,Y._result=K)}if(Y._status===1)return Y._result.default;throw Y._result}var Q=typeof reportError=="function"?reportError:function(Y){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof Y=="object"&&Y!==null&&typeof Y.message=="string"?String(Y.message):String(Y),error:Y});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",Y);return}console.error(Y)},q={map:G,forEach:function(Y,K,j){G(Y,function(){K.apply(this,arguments)},j)},count:function(Y){var K=0;return G(Y,function(){K++}),K},toArray:function(Y){return G(Y,function(K){return K})||[]},only:function(Y){if(!$(Y))throw Error("React.Children.only expected to receive a single React element child.");return Y}};return Gt.Activity=f,Gt.Children=q,Gt.Component=w,Gt.Fragment=n,Gt.Profiler=i,Gt.PureComponent=T,Gt.StrictMode=r,Gt.Suspense=l,Gt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,Gt.__COMPILER_RUNTIME={__proto__:null,c:function(Y){return N.H.useMemoCache(Y)}},Gt.cache=function(Y){return function(){return Y.apply(null,arguments)}},Gt.cacheSignal=function(){return null},Gt.cloneElement=function(Y,K,j){if(Y==null)throw Error("The argument must be a React element, but you passed "+Y+".");var ee=_({},Y.props),re=Y.key;if(K!=null)for(de in K.key!==void 0&&(re=""+K.key),K)!D.call(K,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&K.ref===void 0||(ee[de]=K[de]);var de=arguments.length-2;if(de===1)ee.children=j;else if(1<de){for(var le=Array(de),_e=0;_e<de;_e++)le[_e]=arguments[_e+2];ee.children=le}return F(Y.type,re,ee)},Gt.createContext=function(Y){return Y={$$typeof:s,_currentValue:Y,_currentValue2:Y,_threadCount:0,Provider:null,Consumer:null},Y.Provider=Y,Y.Consumer={$$typeof:a,_context:Y},Y},Gt.createElement=function(Y,K,j){var ee,re={},de=null;if(K!=null)for(ee in K.key!==void 0&&(de=""+K.key),K)D.call(K,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(re[ee]=K[ee]);var le=arguments.length-2;if(le===1)re.children=j;else if(1<le){for(var _e=Array(le),Ae=0;Ae<le;Ae++)_e[Ae]=arguments[Ae+2];re.children=_e}if(Y&&Y.defaultProps)for(ee in le=Y.defaultProps,le)re[ee]===void 0&&(re[ee]=le[ee]);return F(Y,de,re)},Gt.createRef=function(){return{current:null}},Gt.forwardRef=function(Y){return{$$typeof:o,render:Y}},Gt.isValidElement=$,Gt.lazy=function(Y){return{$$typeof:d,_payload:{_status:-1,_result:Y},_init:B}},Gt.memo=function(Y,K){return{$$typeof:c,type:Y,compare:K===void 0?null:K}},Gt.startTransition=function(Y){var K=N.T,j={};N.T=j;try{var ee=Y(),re=N.S;re!==null&&re(j,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(I,Q)}catch(de){Q(de)}finally{K!==null&&j.types!==null&&(K.types=j.types),N.T=K}},Gt.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},Gt.use=function(Y){return N.H.use(Y)},Gt.useActionState=function(Y,K,j){return N.H.useActionState(Y,K,j)},Gt.useCallback=function(Y,K){return N.H.useCallback(Y,K)},Gt.useContext=function(Y){return N.H.useContext(Y)},Gt.useDebugValue=function(){},Gt.useDeferredValue=function(Y,K){return N.H.useDeferredValue(Y,K)},Gt.useEffect=function(Y,K){return N.H.useEffect(Y,K)},Gt.useEffectEvent=function(Y){return N.H.useEffectEvent(Y)},Gt.useId=function(){return N.H.useId()},Gt.useImperativeHandle=function(Y,K,j){return N.H.useImperativeHandle(Y,K,j)},Gt.useInsertionEffect=function(Y,K){return N.H.useInsertionEffect(Y,K)},Gt.useLayoutEffect=function(Y,K){return N.H.useLayoutEffect(Y,K)},Gt.useMemo=function(Y,K){return N.H.useMemo(Y,K)},Gt.useOptimistic=function(Y,K){return N.H.useOptimistic(Y,K)},Gt.useReducer=function(Y,K,j){return N.H.useReducer(Y,K,j)},Gt.useRef=function(Y){return N.H.useRef(Y)},Gt.useState=function(Y){return N.H.useState(Y)},Gt.useSyncExternalStore=function(Y,K,j){return N.H.useSyncExternalStore(Y,K,j)},Gt.useTransition=function(){return N.H.useTransition()},Gt.version="19.2.4",Gt}var s$;function jI(){return s$||(s$=1,Tk.exports=Bpe()),Tk.exports}var v=jI();const he=Zy(v),Qy=Mpe({__proto__:null,default:he},[v]);var kk={exports:{}},Ng={},Nk={exports:{}},Ak={};var o$;function jpe(){return o$||(o$=1,(function(e){function t(M,G){var B=M.length;M.push(G);e:for(;0<B;){var Q=B-1>>>1,q=M[Q];if(0<i(q,G))M[Q]=G,M[B]=q,B=Q;else break e}}function n(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var G=M[0],B=M.pop();if(B!==G){M[0]=B;e:for(var Q=0,q=M.length,Y=q>>>1;Q<Y;){var K=2*(Q+1)-1,j=M[K],ee=K+1,re=M[ee];if(0>i(j,B))ee<q&&0>i(re,j)?(M[Q]=re,M[ee]=B,Q=ee):(M[Q]=j,M[K]=B,Q=K);else if(ee<q&&0>i(re,B))M[Q]=re,M[ee]=B,Q=ee;else break e}}return G}function i(M,G){var B=M.sortIndex-G.sortIndex;return B!==0?B:M.id-G.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var s=Date,o=s.now();e.unstable_now=function(){return s.now()-o}}var l=[],c=[],d=1,f=null,m=3,g=!1,y=!1,_=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function A(M){for(var G=n(c);G!==null;){if(G.callback===null)r(c);else if(G.startTime<=M)r(c),G.sortIndex=G.expirationTime,t(l,G);else break;G=n(c)}}function O(M){if(_=!1,A(M),!y)if(n(l)!==null)y=!0,I||(I=!0,W());else{var G=n(c);G!==null&&z(O,G.startTime-M)}}var I=!1,N=-1,D=5,F=-1;function P(){return S?!0:!(e.unstable_now()-F<D)}function $(){if(S=!1,I){var M=e.unstable_now();F=M;var G=!0;try{e:{y=!1,_&&(_=!1,E(N),N=-1),g=!0;var B=m;try{t:{for(A(M),f=n(l);f!==null&&!(f.expirationTime>M&&P());){var Q=f.callback;if(typeof Q=="function"){f.callback=null,m=f.priorityLevel;var q=Q(f.expirationTime<=M);if(M=e.unstable_now(),typeof q=="function"){f.callback=q,A(M),G=!0;break t}f===n(l)&&r(l),A(M)}else r(l);f=n(l)}if(f!==null)G=!0;else{var Y=n(c);Y!==null&&z(O,Y.startTime-M),G=!1}}break e}finally{f=null,m=B,g=!1}G=void 0}}finally{G?W():I=!1}}}var W;if(typeof T=="function")W=function(){T($)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,H=V.port2;V.port1.onmessage=$,W=function(){H.postMessage(null)}}else W=function(){w($,0)};function z(M,G){N=w(function(){M(e.unstable_now())},G)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(M){switch(m){case 1:case 2:case 3:var G=3;break;default:G=m}var B=m;m=G;try{return M()}finally{m=B}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(M,G){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var B=m;m=M;try{return G()}finally{m=B}},e.unstable_scheduleCallback=function(M,G,B){var Q=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?Q+B:Q):B=Q,M){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=B+q,M={id:d++,callback:G,priorityLevel:M,startTime:B,expirationTime:q,sortIndex:-1},B>Q?(M.sortIndex=B,t(c,M),n(l)===null&&M===n(c)&&(_?(E(N),N=-1):_=!0,z(O,B-Q))):(M.sortIndex=q,t(l,M),y||g||(y=!0,I||(I=!0,W()))),M},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(M){var G=m;return function(){var B=m;m=G;try{return M.apply(this,arguments)}finally{m=B}}}})(Ak)),Ak}var l$;function Fpe(){return l$||(l$=1,Nk.exports=jpe()),Nk.exports}var Rk={exports:{}},ra={};var c$;function $pe(){if(c$)return ra;c$=1;var e=jI();function t(l){var c="https://react.dev/errors/"+l;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)c+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+l+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function a(l,c,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:f==null?null:""+f,children:l,containerInfo:c,implementation:d}}var s=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function o(l,c){if(l==="font")return"";if(typeof c=="string")return c==="use-credentials"?c:""}return ra.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,ra.createPortal=function(l,c){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)throw Error(t(299));return a(l,c,null,d)},ra.flushSync=function(l){var c=s.T,d=r.p;try{if(s.T=null,r.p=2,l)return l()}finally{s.T=c,r.p=d,r.d.f()}},ra.preconnect=function(l,c){typeof l=="string"&&(c?(c=c.crossOrigin,c=typeof c=="string"?c==="use-credentials"?c:"":void 0):c=null,r.d.C(l,c))},ra.prefetchDNS=function(l){typeof l=="string"&&r.d.D(l)},ra.preinit=function(l,c){if(typeof l=="string"&&c&&typeof c.as=="string"){var d=c.as,f=o(d,c.crossOrigin),m=typeof c.integrity=="string"?c.integrity:void 0,g=typeof c.fetchPriority=="string"?c.fetchPriority:void 0;d==="style"?r.d.S(l,typeof c.precedence=="string"?c.precedence:void 0,{crossOrigin:f,integrity:m,fetchPriority:g}):d==="script"&&r.d.X(l,{crossOrigin:f,integrity:m,fetchPriority:g,nonce:typeof c.nonce=="string"?c.nonce:void 0})}},ra.preinitModule=function(l,c){if(typeof l=="string")if(typeof c=="object"&&c!==null){if(c.as==null||c.as==="script"){var d=o(c.as,c.crossOrigin);r.d.M(l,{crossOrigin:d,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0})}}else c==null&&r.d.M(l)},ra.preload=function(l,c){if(typeof l=="string"&&typeof c=="object"&&c!==null&&typeof c.as=="string"){var d=c.as,f=o(d,c.crossOrigin);r.d.L(l,d,{crossOrigin:f,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0,type:typeof c.type=="string"?c.type:void 0,fetchPriority:typeof c.fetchPriority=="string"?c.fetchPriority:void 0,referrerPolicy:typeof c.referrerPolicy=="string"?c.referrerPolicy:void 0,imageSrcSet:typeof c.imageSrcSet=="string"?c.imageSrcSet:void 0,imageSizes:typeof c.imageSizes=="string"?c.imageSizes:void 0,media:typeof c.media=="string"?c.media:void 0})}},ra.preloadModule=function(l,c){if(typeof l=="string")if(c){var d=o(c.as,c.crossOrigin);r.d.m(l,{as:typeof c.as=="string"&&c.as!=="script"?c.as:void 0,crossOrigin:d,integrity:typeof c.integrity=="string"?c.integrity:void 0})}else r.d.m(l)},ra.requestFormReset=function(l){r.d.r(l)},ra.unstable_batchedUpdates=function(l,c){return l(c)},ra.useFormState=function(l,c,d){return s.H.useFormState(l,c,d)},ra.useFormStatus=function(){return s.H.useHostTransitionStatus()},ra.version="19.2.4",ra}var u$;function QW(){if(u$)return Rk.exports;u$=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Rk.exports=$pe(),Rk.exports}var d$;function Upe(){if(d$)return Ng;d$=1;var e=Fpe(),t=jI(),n=QW();function r(u){var p="https://react.dev/errors/"+u;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)p+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+u+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}function a(u){var p=u,b=u;if(u.alternate)for(;p.return;)p=p.return;else{u=p;do p=u,(p.flags&4098)!==0&&(b=p.return),u=p.return;while(u)}return p.tag===3?b:null}function s(u){if(u.tag===13){var p=u.memoizedState;if(p===null&&(u=u.alternate,u!==null&&(p=u.memoizedState)),p!==null)return p.dehydrated}return null}function o(u){if(u.tag===31){var p=u.memoizedState;if(p===null&&(u=u.alternate,u!==null&&(p=u.memoizedState)),p!==null)return p.dehydrated}return null}function l(u){if(a(u)!==u)throw Error(r(188))}function c(u){var p=u.alternate;if(!p){if(p=a(u),p===null)throw Error(r(188));return p!==u?null:u}for(var b=u,x=p;;){var C=b.return;if(C===null)break;var k=C.alternate;if(k===null){if(x=C.return,x!==null){b=x;continue}break}if(C.child===k.child){for(k=C.child;k;){if(k===b)return l(C),u;if(k===x)return l(C),p;k=k.sibling}throw Error(r(188))}if(b.return!==x.return)b=C,x=k;else{for(var U=!1,Z=C.child;Z;){if(Z===b){U=!0,b=C,x=k;break}if(Z===x){U=!0,x=C,b=k;break}Z=Z.sibling}if(!U){for(Z=k.child;Z;){if(Z===b){U=!0,b=k,x=C;break}if(Z===x){U=!0,x=k,b=C;break}Z=Z.sibling}if(!U)throw Error(r(189))}}if(b.alternate!==x)throw Error(r(190))}if(b.tag!==3)throw Error(r(188));return b.stateNode.current===b?u:p}function d(u){var p=u.tag;if(p===5||p===26||p===27||p===6)return u;for(u=u.child;u!==null;){if(p=d(u),p!==null)return p;u=u.sibling}return null}var f=Object.assign,m=Symbol.for("react.element"),g=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),T=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function W(u){return u===null||typeof u!="object"?null:(u=$&&u[$]||u["@@iterator"],typeof u=="function"?u:null)}var V=Symbol.for("react.client.reference");function H(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===V?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case _:return"Fragment";case w:return"Profiler";case S:return"StrictMode";case O:return"Suspense";case I:return"SuspenseList";case F:return"Activity"}if(typeof u=="object")switch(u.$$typeof){case y:return"Portal";case T:return u.displayName||"Context";case E:return(u._context.displayName||"Context")+".Consumer";case A:var p=u.render;return u=u.displayName,u||(u=p.displayName||p.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case N:return p=u.displayName||null,p!==null?p:H(u.type)||"Memo";case D:p=u._payload,u=u._init;try{return H(u(p))}catch{}}return null}var z=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B={pending:!1,data:null,method:null,action:null},Q=[],q=-1;function Y(u){return{current:u}}function K(u){0>q||(u.current=Q[q],Q[q]=null,q--)}function j(u,p){q++,Q[q]=u.current,u.current=p}var ee=Y(null),re=Y(null),de=Y(null),le=Y(null);function _e(u,p){switch(j(de,p),j(re,u),j(ee,null),p.nodeType){case 9:case 11:u=(u=p.documentElement)&&(u=u.namespaceURI)?T6(u):0;break;default:if(u=p.tagName,p=p.namespaceURI)p=T6(p),u=k6(p,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}K(ee),j(ee,u)}function Ae(){K(ee),K(re),K(de)}function we(u){u.memoizedState!==null&&j(le,u);var p=ee.current,b=k6(p,u.type);p!==b&&(j(re,u),j(ee,b))}function Oe(u){re.current===u&&(K(ee),K(re)),le.current===u&&(K(le),wg._currentValue=B)}var Be,qe;function At(u){if(Be===void 0)try{throw Error()}catch(b){var p=b.stack.trim().match(/\n( *(at )?)/);Be=p&&p[1]||"",qe=-1<b.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<b.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+Be+u+qe}var Yt=!1;function qt(u,p){if(!u||Yt)return"";Yt=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var x={DetermineComponentFrameRoot:function(){try{if(p){var De=function(){throw Error()};if(Object.defineProperty(De.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(De,[])}catch(Se){var ve=Se}Reflect.construct(u,[],De)}else{try{De.call()}catch(Se){ve=Se}u.call(De.prototype)}}else{try{throw Error()}catch(Se){ve=Se}(De=u())&&typeof De.catch=="function"&&De.catch(function(){})}}catch(Se){if(Se&&ve&&typeof Se.stack=="string")return[Se.stack,ve.stack]}return[null,null]}};x.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var C=Object.getOwnPropertyDescriptor(x.DetermineComponentFrameRoot,"name");C&&C.configurable&&Object.defineProperty(x.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=x.DetermineComponentFrameRoot(),U=k[0],Z=k[1];if(U&&Z){var se=U.split(`
|
|
@@ -342,8 +342,8 @@ Please report this to https://github.com/markedjs/marked.`,t){let i="<p>An error
|
|
|
342
342
|
node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const r=e.x,i=e.y,a=Math.abs(r-n.x),s=e.width/2;let o=n.x<t.x?s-a:s+a;const l=e.height/2,c=Math.abs(t.y-n.y),d=Math.abs(t.x-n.x);if(Math.abs(i-t.y)*s>Math.abs(r-t.x)*l){let f=n.y<t.y?t.y-l-i:i-l-t.y;o=d*f/c;const m={x:n.x<t.x?n.x+o:n.x-d+o,y:n.y<t.y?n.y+c-f:n.y-c+f};return o===0&&(m.x=t.x,m.y=t.y),d===0&&(m.x=t.x),c===0&&(m.y=t.y),Pe.debug(`abc89 top/bottom calc, Q ${c}, q ${f}, R ${d}, r ${o}`,m),m}else{n.x<t.x?o=t.x-s-r:o=r-s-t.x;let f=c*o/d,m=n.x<t.x?n.x+d-o:n.x-d+o,g=n.y<t.y?n.y+f:n.y-f;return Pe.debug(`sides calc abc89, Q ${c}, q ${f}, R ${d}, r ${o}`,{_x:m,_y:g}),o===0&&(m=t.x,g=t.y),d===0&&(m=t.x),c===0&&(g=t.y),{x:m,y:g}}},"intersection"),pH=L((e,t)=>{Pe.warn("abc88 cutPathAtIntersect",e,t);let n=[],r=e[0],i=!1;return e.forEach(a=>{if(Pe.info("abc88 checking point",a,t),!Y6e(t,a)&&!i){const s=K6e(t,r,a);Pe.debug("abc88 inside",a,r,s),Pe.debug("abc88 intersection",s,t);let o=!1;n.forEach(l=>{o=o||l.x===s.x&&l.y===s.y}),n.some(l=>l.x===s.x&&l.y===s.y)?Pe.warn("abc88 no intersect",s,n):n.push(s),i=!0}else Pe.warn("abc88 outside",a,r),r=a,i||n.push(a)}),Pe.debug("returning points",n),n},"cutPathAtIntersect");function zne(e){const t=[],n=[];for(let r=1;r<e.length-1;r++){const i=e[r-1],a=e[r],s=e[r+1];(i.x===a.x&&a.y===s.y&&Math.abs(a.x-s.x)>5&&Math.abs(a.y-i.y)>5||i.y===a.y&&a.x===s.x&&Math.abs(a.x-i.x)>5&&Math.abs(a.y-s.y)>5)&&(t.push(a),n.push(r))}return{cornerPoints:t,cornerPointPositions:n}}L(zne,"extractCornerPoints");var mH=L(function(e,t,n){const r=t.x-e.x,i=t.y-e.y,a=Math.sqrt(r*r+i*i),s=n/a;return{x:t.x-s*r,y:t.y-s*i}},"findAdjacentPoint"),X6e=L(function(e){const{cornerPointPositions:t}=zne(e),n=[];for(let r=0;r<e.length;r++)if(t.includes(r)){const i=e[r-1],a=e[r+1],s=e[r],o=mH(i,s,5),l=mH(a,s,5),c=l.x-o.x,d=l.y-o.y;n.push(o);const f=Math.sqrt(2)*2;let m={x:s.x,y:s.y};if(Math.abs(a.x-i.x)>10&&Math.abs(a.y-i.y)>=10){Pe.debug("Corner point fixing",Math.abs(a.x-i.x),Math.abs(a.y-i.y));const g=5;s.x===o.x?m={x:c<0?o.x-g+f:o.x+g-f,y:d<0?o.y-f:o.y+f}:m={x:c<0?o.x-f:o.x+f,y:d<0?o.y-g+f:o.y+g-f}}else Pe.debug("Corner point skipping fixing",Math.abs(a.x-i.x),Math.abs(a.y-i.y));n.push(m,l)}else n.push(e[r]);return n},"fixCorners"),Z6e=L((e,t,n)=>{const r=e-t-n,i=2,a=2,s=i+a,o=Math.floor(r/s),l=Array(o).fill(`${i} ${a}`).join(" ");return`0 ${t} ${l} ${n}`},"generateDashArray"),Q6e=L(function(e,t,n,r,i,a,s,o=!1){const{handDrawnSeed:l}=qn();let c=t.points,d=!1;const f=i;var m=a;const g=[];for(const H in t.cssCompiledStyles)vee(H)||g.push(t.cssCompiledStyles[H]);Pe.debug("UIO intersect check",t.points,m.x,f.x),m.intersect&&f.intersect&&!o&&(c=c.slice(1,t.points.length-1),c.unshift(f.intersect(c[0])),Pe.debug("Last point UIO",t.start,"-->",t.end,c[c.length-1],m,m.intersect(c[c.length-1])),c.push(m.intersect(c[c.length-1])));const y=btoa(JSON.stringify(c));t.toCluster&&(Pe.info("to cluster abc88",n.get(t.toCluster)),c=pH(t.points,n.get(t.toCluster).node),d=!0),t.fromCluster&&(Pe.debug("from cluster abc88",n.get(t.fromCluster),JSON.stringify(c,null,2)),c=pH(c.reverse(),n.get(t.fromCluster).node).reverse(),d=!0);let _=c.filter(H=>!Number.isNaN(H.y));_=X6e(_);let S=qx;switch(S=VS,t.curve){case"linear":S=VS;break;case"basis":S=qx;break;case"cardinal":S=wQ;break;case"bumpX":S=yQ;break;case"bumpY":S=vQ;break;case"catmullRom":S=CQ;break;case"monotoneX":S=IQ;break;case"monotoneY":S=OQ;break;case"natural":S=MQ;break;case"step":S=LQ;break;case"stepAfter":S=BQ;break;case"stepBefore":S=PQ;break;default:S=qx}const{x:w,y:E}=XBe(t),T=D3e().x(w).y(E).curve(S);let A;switch(t.thickness){case"normal":A="edge-thickness-normal";break;case"thick":A="edge-thickness-thick";break;case"invisible":A="edge-thickness-invisible";break;default:A="edge-thickness-normal"}switch(t.pattern){case"solid":A+=" edge-pattern-solid";break;case"dotted":A+=" edge-pattern-dotted";break;case"dashed":A+=" edge-pattern-dashed";break;default:A+=" edge-pattern-solid"}let O,I=t.curve==="rounded"?Hne(Wne(_,t),5):T(_);const N=Array.isArray(t.style)?t.style:[t.style];let D=N.find(H=>H?.startsWith("stroke:")),F=!1;if(t.look==="handDrawn"){const H=pt.svg(e);Object.assign([],_);const z=H.path(I,{roughness:.3,seed:l});A+=" transition",O=On(z).select("path").attr("id",t.id).attr("class"," "+A+(t.classes?" "+t.classes:"")).attr("style",N?N.reduce((G,B)=>G+";"+B,""):"");let M=O.attr("d");O.attr("d",M),e.node().appendChild(O.node())}else{const H=g.join(";"),z=N?N.reduce((K,j)=>K+j+";",""):"";let M="";t.animate&&(M=" edge-animation-fast"),t.animation&&(M=" edge-animation-"+t.animation);const G=(H?H+";"+z+";":z)+";"+(N?N.reduce((K,j)=>K+";"+j,""):"");O=e.append("path").attr("d",I).attr("id",t.id).attr("class"," "+A+(t.classes?" "+t.classes:"")+(M??"")).attr("style",G),D=G.match(/stroke:([^;]+)/)?.[1],F=t.animate===!0||!!t.animation||H.includes("animation");const B=O.node(),Q=typeof B.getTotalLength=="function"?B.getTotalLength():0,q=I8[t.arrowTypeStart]||0,Y=I8[t.arrowTypeEnd]||0;if(t.look==="neo"&&!F){const j=`stroke-dasharray: ${t.pattern==="dotted"||t.pattern==="dashed"?Z6e(Q,q,Y):`0 ${q} ${Q-q-Y} ${Y}`}; stroke-dashoffset: 0;`;O.attr("style",j+O.attr("style"))}}O.attr("data-edge",!0),O.attr("data-et","edge"),O.attr("data-id",t.id),O.attr("data-points",y),t.showPoints&&_.forEach(H=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",H.x).attr("cy",H.y)});let P="";(qn().flowchart.arrowMarkerAbsolute||qn().state.arrowMarkerAbsolute)&&(P=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,P=P.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),Pe.info("arrowTypeStart",t.arrowTypeStart),Pe.info("arrowTypeEnd",t.arrowTypeEnd),W6e(O,t,P,s,r,D);const $=Math.floor(c.length/2),W=c[$];go.isLabelCoordinateInPath(W,O.attr("d"))||(d=!0);let V={};return d&&(V.updatedPath=c),V.originalPath=t.points,V},"insertEdge");function Hne(e,t){if(e.length<2)return"";let n="";const r=e.length,i=1e-5;for(let a=0;a<r;a++){const s=e[a],o=e[a-1],l=e[a+1];if(a===0)n+=`M${s.x},${s.y}`;else if(a===r-1)n+=`L${s.x},${s.y}`;else{const c=s.x-o.x,d=s.y-o.y,f=l.x-s.x,m=l.y-s.y,g=Math.hypot(c,d),y=Math.hypot(f,m);if(g<i||y<i){n+=`L${s.x},${s.y}`;continue}const _=c/g,S=d/g,w=f/y,E=m/y,T=_*w+S*E,A=Math.max(-1,Math.min(1,T)),O=Math.acos(A);if(O<i||Math.abs(Math.PI-O)<i){n+=`L${s.x},${s.y}`;continue}const I=Math.min(t/Math.sin(O/2),g/2,y/2),N=s.x-_*I,D=s.y-S*I,F=s.x+w*I,P=s.y+E*I;n+=`L${N},${D}`,n+=`Q${s.x},${s.y} ${F},${P}`}}return n}L(Hne,"generateRoundedPath");function cR(e,t){if(!e||!t)return{angle:0,deltaX:0,deltaY:0};const n=t.x-e.x,r=t.y-e.y;return{angle:Math.atan2(r,n),deltaX:n,deltaY:r}}L(cR,"calculateDeltaAndAngle");function Wne(e,t){const n=e.map(i=>({...i}));if(e.length>=2&&sa[t.arrowTypeStart]){const i=sa[t.arrowTypeStart],a=e[0],s=e[1],{angle:o}=cR(a,s),l=i*Math.cos(o),c=i*Math.sin(o);n[0].x=a.x+l,n[0].y=a.y+c}const r=e.length;if(r>=2&&sa[t.arrowTypeEnd]){const i=sa[t.arrowTypeEnd],a=e[r-1],s=e[r-2],{angle:o}=cR(s,a),l=i*Math.cos(o),c=i*Math.sin(o);n[r-1].x=a.x-l,n[r-1].y=a.y-c}return n}L(Wne,"applyMarkerOffsetsToPoints");var J6e=L((e,t,n,r)=>{t.forEach(i=>{m$e[i](e,n,r)})},"insertMarkers"),e$e=L((e,t,n)=>{Pe.trace("Making markers for ",n),e.append("defs").append("marker").attr("id",n+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",n+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),t$e=L((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),n$e=L((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),r$e=L((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),i$e=L((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",n+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),a$e=L((e,t,n)=>{e.append("marker").attr("id",n+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),s$e=L((e,t,n)=>{e.append("marker").attr("id",n+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),o$e=L((e,t,n)=>{e.append("marker").attr("id",n+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),l$e=L((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),c$e=L((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",n+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),u$e=L((e,t,n)=>{const r=e.append("defs").append("marker").attr("id",n+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");r.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),r.append("path").attr("d","M9,0 L9,18");const i=e.append("defs").append("marker").attr("id",n+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),i.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),d$e=L((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",n+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),h$e=L((e,t,n)=>{const r=e.append("defs").append("marker").attr("id",n+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");r.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),r.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const i=e.append("defs").append("marker").attr("id",n+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),i.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),f$e=L((e,t,n)=>{e.append("defs").append("marker").attr("id",n+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
|
|
343
343
|
L20,10
|
|
344
344
|
M20,10
|
|
345
|
-
L0,20`)},"requirement_arrow"),p$e=L((e,t,n)=>{const r=e.append("defs").append("marker").attr("id",n+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");r.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),r.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),r.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),m$e={extension:e$e,composition:t$e,aggregation:n$e,dependency:r$e,lollipop:i$e,point:a$e,circle:s$e,cross:o$e,barb:l$e,only_one:c$e,zero_or_one:u$e,one_or_more:d$e,zero_or_more:h$e,requirement_arrow:f$e,requirement_contains:p$e},g$e=J6e,b$e={common:vm,getConfig:da,insertCluster:C6e,insertEdge:Q6e,insertEdgeLabel:q6e,insertMarkers:g$e,insertNode:Une,interpolateToCurve:FD,labelHelper:Mt,log:Pe,positionEdgeLabel:V6e},Iy={},Gne=L(e=>{for(const t of e)Iy[t.name]=t},"registerLayoutLoaders"),y$e=L(()=>{Gne([{name:"dagre",loader:L(async()=>await Gn(()=>import("./dagre-6UL2VRFP-D-kPXmRT.js"),__vite__mapDeps([0,1,2,3,4,5])),"loader")},{name:"cose-bilkent",loader:L(async()=>await Gn(()=>import("./cose-bilkent-S5V4N54A-BYd0MvfE.js"),__vite__mapDeps([6,7])),"loader")}])},"registerDefaultLayoutLoaders");y$e();var tbt=L(async(e,t)=>{if(!(e.layoutAlgorithm in Iy))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=Iy[e.layoutAlgorithm];return(await n.loader()).render(e,t,b$e,{algorithm:n.algorithm})},"render"),nbt=L((e="",{fallback:t="dagre"}={})=>{if(e in Iy)return e;if(t in Iy)return Pe.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),qne="comm",Vne="rule",Yne="decl",v$e="@import",_$e="@namespace",x$e="@keyframes",S$e="@layer",Kne=Math.abs,aM=String.fromCharCode;function Xne(e){return e.trim()}function Zx(e,t,n){return e.replace(t,n)}function w$e(e,t,n){return e.indexOf(t,n)}function cp(e,t){return e.charCodeAt(t)|0}function Fp(e,t,n){return e.slice(t,n)}function nl(e){return e.length}function E$e(e){return e.length}function hx(e,t){return t.push(e),e}var n1=1,$p=1,Zne=0,Js=0,ui=0,Em="";function sM(e,t,n,r,i,a,s,o){return{value:e,root:t,parent:n,type:r,props:i,children:a,line:n1,column:$p,length:s,return:"",siblings:o}}function C$e(){return ui}function T$e(){return ui=Js>0?cp(Em,--Js):0,$p--,ui===10&&($p=1,n1--),ui}function xo(){return ui=Js<Zne?cp(Em,Js++):0,$p++,ui===10&&($p=1,n1++),ui}function fu(){return cp(Em,Js)}function Qx(){return Js}function r1(e,t){return Fp(Em,e,t)}function Oy(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function k$e(e){return n1=$p=1,Zne=nl(Em=e),Js=0,[]}function N$e(e){return Em="",e}function NN(e){return Xne(r1(Js-1,uR(e===91?e+2:e===40?e+1:e)))}function A$e(e){for(;(ui=fu())&&ui<33;)xo();return Oy(e)>2||Oy(ui)>3?"":" "}function R$e(e,t){for(;--t&&xo()&&!(ui<48||ui>102||ui>57&&ui<65||ui>70&&ui<97););return r1(e,Qx()+(t<6&&fu()==32&&xo()==32))}function uR(e){for(;xo();)switch(ui){case e:return Js;case 34:case 39:e!==34&&e!==39&&uR(ui);break;case 40:e===41&&uR(e);break;case 92:xo();break}return Js}function I$e(e,t){for(;xo()&&e+ui!==57;)if(e+ui===84&&fu()===47)break;return"/*"+r1(t,Js-1)+"*"+aM(e===47?e:xo())}function O$e(e){for(;!Oy(fu());)xo();return r1(e,Js)}function D$e(e){return N$e(Jx("",null,null,null,[""],e=k$e(e),0,[0],e))}function Jx(e,t,n,r,i,a,s,o,l){for(var c=0,d=0,f=s,m=0,g=0,y=0,_=1,S=1,w=1,E=0,T="",A=i,O=a,I=r,N=T;S;)switch(y=E,E=xo()){case 40:if(y!=108&&cp(N,f-1)==58){w$e(N+=Zx(NN(E),"&","&\f"),"&\f",Kne(c?o[c-1]:0))!=-1&&(w=-1);break}case 34:case 39:case 91:N+=NN(E);break;case 9:case 10:case 13:case 32:N+=A$e(y);break;case 92:N+=R$e(Qx()-1,7);continue;case 47:switch(fu()){case 42:case 47:hx(M$e(I$e(xo(),Qx()),t,n,l),l),(Oy(y||1)==5||Oy(fu()||1)==5)&&nl(N)&&Fp(N,-1,void 0)!==" "&&(N+=" ");break;default:N+="/"}break;case 123*_:o[c++]=nl(N)*w;case 125*_:case 59:case 0:switch(E){case 0:case 125:S=0;case 59+d:w==-1&&(N=Zx(N,/\f/g,"")),g>0&&(nl(N)-f||_===0&&y===47)&&hx(g>32?bH(N+";",r,n,f-1,l):bH(Zx(N," ","")+";",r,n,f-2,l),l);break;case 59:N+=";";default:if(hx(I=gH(N,t,n,c,d,i,o,T,A=[],O=[],f,a),a),E===123)if(d===0)Jx(N,t,I,I,A,a,f,o,O);else{switch(m){case 99:if(cp(N,3)===110)break;case 108:if(cp(N,2)===97)break;default:d=0;case 100:case 109:case 115:}d?Jx(e,I,I,r&&hx(gH(e,I,I,0,0,i,o,T,i,A=[],f,O),O),i,O,f,o,r?A:O):Jx(N,I,I,I,[""],O,0,o,O)}}c=d=g=0,_=w=1,T=N="",f=s;break;case 58:f=1+nl(N),g=y;default:if(_<1){if(E==123)--_;else if(E==125&&_++==0&&T$e()==125)continue}switch(N+=aM(E),E*_){case 38:w=d>0?1:(N+="\f",-1);break;case 44:o[c++]=(nl(N)-1)*w,w=1;break;case 64:fu()===45&&(N+=NN(xo())),m=fu(),d=f=nl(T=N+=O$e(Qx())),E++;break;case 45:y===45&&nl(N)==2&&(_=0)}}return a}function gH(e,t,n,r,i,a,s,o,l,c,d,f){for(var m=i-1,g=i===0?a:[""],y=E$e(g),_=0,S=0,w=0;_<r;++_)for(var E=0,T=Fp(e,m+1,m=Kne(S=s[_])),A=e;E<y;++E)(A=Xne(S>0?g[E]+" "+T:Zx(T,/&\f/g,g[E])))&&(l[w++]=A);return sM(e,t,n,i===0?Vne:o,l,c,d,f)}function M$e(e,t,n,r){return sM(e,t,n,qne,aM(C$e()),Fp(e,2,-2),0,r)}function bH(e,t,n,r,i){return sM(e,t,n,Yne,Fp(e,0,r),Fp(e,r+1,-1),r,i)}function dR(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function L$e(e,t,n,r){switch(e.type){case S$e:if(e.children.length)break;case v$e:case _$e:case Yne:return e.return=e.return||e.value;case qne:return"";case x$e:return e.return=e.value+"{"+dR(e.children,r)+"}";case Vne:if(!nl(e.value=e.props.join(",")))return""}return nl(n=dR(e.children,r))?e.return=e.value+"{"+n+"}":""}var P$e=wee(Object.keys,Object),B$e=Object.prototype,j$e=B$e.hasOwnProperty;function F$e(e){if(!qE(e))return P$e(e);var t=[];for(var n in Object(e))j$e.call(e,n)&&n!="constructor"&&t.push(n);return t}var hR=Th(kl,"DataView"),fR=Th(kl,"Promise"),pR=Th(kl,"Set"),mR=Th(kl,"WeakMap"),yH="[object Map]",$$e="[object Object]",vH="[object Promise]",_H="[object Set]",xH="[object WeakMap]",SH="[object DataView]",U$e=Ch(hR),z$e=Ch(Ay),H$e=Ch(fR),W$e=Ch(pR),G$e=Ch(mR),kd=xm;(hR&&kd(new hR(new ArrayBuffer(1)))!=SH||Ay&&kd(new Ay)!=yH||fR&&kd(fR.resolve())!=vH||pR&&kd(new pR)!=_H||mR&&kd(new mR)!=xH)&&(kd=function(e){var t=xm(e),n=t==$$e?e.constructor:void 0,r=n?Ch(n):"";if(r)switch(r){case U$e:return SH;case z$e:return yH;case H$e:return vH;case W$e:return _H;case G$e:return xH}return t});var q$e="[object Map]",V$e="[object Set]",Y$e=Object.prototype,K$e=Y$e.hasOwnProperty;function wH(e){if(e==null)return!0;if(VE(e)&&(sw(e)||typeof e=="string"||typeof e.splice=="function"||BD(e)||jD(e)||aw(e)))return!e.length;var t=kd(e);if(t==q$e||t==V$e)return!e.size;if(qE(e))return!F$e(e).length;for(var n in e)if(K$e.call(e,n))return!1;return!0}var Qne="c4",X$e=L(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Z$e=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./c4Diagram-YG6GDRKO-BH1ALhYh.js");return{diagram:t}},__vite__mapDeps([8,9]));return{id:Qne,diagram:e}},"loader"),Q$e={id:Qne,detector:X$e,loader:Z$e},J$e=Q$e,Jne="flowchart",eUe=L((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),tUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-DfgrrhwS.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:Jne,diagram:e}},"loader"),nUe={id:Jne,detector:eUe,loader:tUe},rUe=nUe,ere="flowchart-v2",iUe=L((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),aUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-DfgrrhwS.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:ere,diagram:e}},"loader"),sUe={id:ere,detector:iUe,loader:aUe},oUe=sUe,tre="er",lUe=L(e=>/^\s*erDiagram/.test(e),"detector"),cUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./erDiagram-Q2GNP2WA-DtuLC2xg.js");return{diagram:t}},__vite__mapDeps([15,12,13,14]));return{id:tre,diagram:e}},"loader"),uUe={id:tre,detector:lUe,loader:cUe},dUe=uUe,nre="gitGraph",hUe=L(e=>/^\s*gitGraph/.test(e),"detector"),fUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./gitGraphDiagram-NY62KEGX-DJsigQIR.js");return{diagram:t}},__vite__mapDeps([16,17,18,19,2,4,5]));return{id:nre,diagram:e}},"loader"),pUe={id:nre,detector:hUe,loader:fUe},mUe=pUe,rre="gantt",gUe=L(e=>/^\s*gantt/.test(e),"detector"),bUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./ganttDiagram-JELNMOA3-D_dPspnH.js");return{diagram:t}},__vite__mapDeps([20,21,22,23]));return{id:rre,diagram:e}},"loader"),yUe={id:rre,detector:gUe,loader:bUe},vUe=yUe,ire="info",_Ue=L(e=>/^\s*info/.test(e),"detector"),xUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./infoDiagram-WHAUD3N6-D5yAAuIK.js");return{diagram:t}},__vite__mapDeps([24,19,2,4,5]));return{id:ire,diagram:e}},"loader"),SUe={id:ire,detector:_Ue,loader:xUe},are="pie",wUe=L(e=>/^\s*pie/.test(e),"detector"),EUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./pieDiagram-ADFJNKIX-VvsVA8GJ.js");return{diagram:t}},__vite__mapDeps([25,17,19,2,4,5,26,27,22]));return{id:are,diagram:e}},"loader"),CUe={id:are,detector:wUe,loader:EUe},sre="quadrantChart",TUe=L(e=>/^\s*quadrantChart/.test(e),"detector"),kUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./quadrantDiagram-AYHSOK5B-oRc7Vk8X.js");return{diagram:t}},__vite__mapDeps([28,21,22,23]));return{id:sre,diagram:e}},"loader"),NUe={id:sre,detector:TUe,loader:kUe},AUe=NUe,ore="xychart",RUe=L(e=>/^\s*xychart(-beta)?/.test(e),"detector"),IUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./xychartDiagram-PRI3JC2R-uBZMdNdc.js");return{diagram:t}},__vite__mapDeps([29,22,27,21,23]));return{id:ore,diagram:e}},"loader"),OUe={id:ore,detector:RUe,loader:IUe},DUe=OUe,lre="requirement",MUe=L(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),LUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./requirementDiagram-UZGBJVZJ-Dq3exCr2.js");return{diagram:t}},__vite__mapDeps([30,12,13]));return{id:lre,diagram:e}},"loader"),PUe={id:lre,detector:MUe,loader:LUe},BUe=PUe,cre="sequence",jUe=L(e=>/^\s*sequenceDiagram/.test(e),"detector"),FUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./sequenceDiagram-WL72ISMW-C0gbEvnf.js");return{diagram:t}},__vite__mapDeps([31,9,18]));return{id:cre,diagram:e}},"loader"),$Ue={id:cre,detector:jUe,loader:FUe},UUe=$Ue,ure="class",zUe=L((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),HUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./classDiagram-2ON5EDUG-ByvTr4wu.js");return{diagram:t}},__vite__mapDeps([32,33,11,12,13]));return{id:ure,diagram:e}},"loader"),WUe={id:ure,detector:zUe,loader:HUe},GUe=WUe,dre="classDiagram",qUe=L((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),VUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./classDiagram-v2-WZHVMYZB-ByvTr4wu.js");return{diagram:t}},__vite__mapDeps([34,33,11,12,13]));return{id:dre,diagram:e}},"loader"),YUe={id:dre,detector:qUe,loader:VUe},KUe=YUe,hre="state",XUe=L((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),ZUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./stateDiagram-FKZM4ZOC-lFd4FBIQ.js");return{diagram:t}},__vite__mapDeps([35,36,12,13,1,2,3,4]));return{id:hre,diagram:e}},"loader"),QUe={id:hre,detector:XUe,loader:ZUe},JUe=QUe,fre="stateDiagram",eze=L((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),tze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./stateDiagram-v2-4FDKWEC3-C7liWkST.js");return{diagram:t}},__vite__mapDeps([37,36,12,13]));return{id:fre,diagram:e}},"loader"),nze={id:fre,detector:eze,loader:tze},rze=nze,pre="journey",ize=L(e=>/^\s*journey/.test(e),"detector"),aze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./journeyDiagram-XKPGCS4Q-DMeR4Vy_.js");return{diagram:t}},__vite__mapDeps([38,9,11,26]));return{id:pre,diagram:e}},"loader"),sze={id:pre,detector:ize,loader:aze},oze=sze,lze=L((e,t,n)=>{Pe.debug(`rendering svg for syntax error
|
|
346
|
-
`);const r=z3e(t),i=r.append("g");r.attr("viewBox","0 0 2412 512"),UZ(r,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${n}`)},"draw"),mre={draw:lze},cze=mre,uze={db:{},renderer:mre,parser:{parse:L(()=>{},"parse")}},dze=uze,gre="flowchart-elk",hze=L((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),fze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-
|
|
345
|
+
L0,20`)},"requirement_arrow"),p$e=L((e,t,n)=>{const r=e.append("defs").append("marker").attr("id",n+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");r.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),r.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),r.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),m$e={extension:e$e,composition:t$e,aggregation:n$e,dependency:r$e,lollipop:i$e,point:a$e,circle:s$e,cross:o$e,barb:l$e,only_one:c$e,zero_or_one:u$e,one_or_more:d$e,zero_or_more:h$e,requirement_arrow:f$e,requirement_contains:p$e},g$e=J6e,b$e={common:vm,getConfig:da,insertCluster:C6e,insertEdge:Q6e,insertEdgeLabel:q6e,insertMarkers:g$e,insertNode:Une,interpolateToCurve:FD,labelHelper:Mt,log:Pe,positionEdgeLabel:V6e},Iy={},Gne=L(e=>{for(const t of e)Iy[t.name]=t},"registerLayoutLoaders"),y$e=L(()=>{Gne([{name:"dagre",loader:L(async()=>await Gn(()=>import("./dagre-6UL2VRFP-CNvHuwOI.js"),__vite__mapDeps([0,1,2,3,4,5])),"loader")},{name:"cose-bilkent",loader:L(async()=>await Gn(()=>import("./cose-bilkent-S5V4N54A-BAHIgVQk.js"),__vite__mapDeps([6,7])),"loader")}])},"registerDefaultLayoutLoaders");y$e();var tbt=L(async(e,t)=>{if(!(e.layoutAlgorithm in Iy))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=Iy[e.layoutAlgorithm];return(await n.loader()).render(e,t,b$e,{algorithm:n.algorithm})},"render"),nbt=L((e="",{fallback:t="dagre"}={})=>{if(e in Iy)return e;if(t in Iy)return Pe.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),qne="comm",Vne="rule",Yne="decl",v$e="@import",_$e="@namespace",x$e="@keyframes",S$e="@layer",Kne=Math.abs,aM=String.fromCharCode;function Xne(e){return e.trim()}function Zx(e,t,n){return e.replace(t,n)}function w$e(e,t,n){return e.indexOf(t,n)}function cp(e,t){return e.charCodeAt(t)|0}function Fp(e,t,n){return e.slice(t,n)}function nl(e){return e.length}function E$e(e){return e.length}function hx(e,t){return t.push(e),e}var n1=1,$p=1,Zne=0,Js=0,ui=0,Em="";function sM(e,t,n,r,i,a,s,o){return{value:e,root:t,parent:n,type:r,props:i,children:a,line:n1,column:$p,length:s,return:"",siblings:o}}function C$e(){return ui}function T$e(){return ui=Js>0?cp(Em,--Js):0,$p--,ui===10&&($p=1,n1--),ui}function xo(){return ui=Js<Zne?cp(Em,Js++):0,$p++,ui===10&&($p=1,n1++),ui}function fu(){return cp(Em,Js)}function Qx(){return Js}function r1(e,t){return Fp(Em,e,t)}function Oy(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function k$e(e){return n1=$p=1,Zne=nl(Em=e),Js=0,[]}function N$e(e){return Em="",e}function NN(e){return Xne(r1(Js-1,uR(e===91?e+2:e===40?e+1:e)))}function A$e(e){for(;(ui=fu())&&ui<33;)xo();return Oy(e)>2||Oy(ui)>3?"":" "}function R$e(e,t){for(;--t&&xo()&&!(ui<48||ui>102||ui>57&&ui<65||ui>70&&ui<97););return r1(e,Qx()+(t<6&&fu()==32&&xo()==32))}function uR(e){for(;xo();)switch(ui){case e:return Js;case 34:case 39:e!==34&&e!==39&&uR(ui);break;case 40:e===41&&uR(e);break;case 92:xo();break}return Js}function I$e(e,t){for(;xo()&&e+ui!==57;)if(e+ui===84&&fu()===47)break;return"/*"+r1(t,Js-1)+"*"+aM(e===47?e:xo())}function O$e(e){for(;!Oy(fu());)xo();return r1(e,Js)}function D$e(e){return N$e(Jx("",null,null,null,[""],e=k$e(e),0,[0],e))}function Jx(e,t,n,r,i,a,s,o,l){for(var c=0,d=0,f=s,m=0,g=0,y=0,_=1,S=1,w=1,E=0,T="",A=i,O=a,I=r,N=T;S;)switch(y=E,E=xo()){case 40:if(y!=108&&cp(N,f-1)==58){w$e(N+=Zx(NN(E),"&","&\f"),"&\f",Kne(c?o[c-1]:0))!=-1&&(w=-1);break}case 34:case 39:case 91:N+=NN(E);break;case 9:case 10:case 13:case 32:N+=A$e(y);break;case 92:N+=R$e(Qx()-1,7);continue;case 47:switch(fu()){case 42:case 47:hx(M$e(I$e(xo(),Qx()),t,n,l),l),(Oy(y||1)==5||Oy(fu()||1)==5)&&nl(N)&&Fp(N,-1,void 0)!==" "&&(N+=" ");break;default:N+="/"}break;case 123*_:o[c++]=nl(N)*w;case 125*_:case 59:case 0:switch(E){case 0:case 125:S=0;case 59+d:w==-1&&(N=Zx(N,/\f/g,"")),g>0&&(nl(N)-f||_===0&&y===47)&&hx(g>32?bH(N+";",r,n,f-1,l):bH(Zx(N," ","")+";",r,n,f-2,l),l);break;case 59:N+=";";default:if(hx(I=gH(N,t,n,c,d,i,o,T,A=[],O=[],f,a),a),E===123)if(d===0)Jx(N,t,I,I,A,a,f,o,O);else{switch(m){case 99:if(cp(N,3)===110)break;case 108:if(cp(N,2)===97)break;default:d=0;case 100:case 109:case 115:}d?Jx(e,I,I,r&&hx(gH(e,I,I,0,0,i,o,T,i,A=[],f,O),O),i,O,f,o,r?A:O):Jx(N,I,I,I,[""],O,0,o,O)}}c=d=g=0,_=w=1,T=N="",f=s;break;case 58:f=1+nl(N),g=y;default:if(_<1){if(E==123)--_;else if(E==125&&_++==0&&T$e()==125)continue}switch(N+=aM(E),E*_){case 38:w=d>0?1:(N+="\f",-1);break;case 44:o[c++]=(nl(N)-1)*w,w=1;break;case 64:fu()===45&&(N+=NN(xo())),m=fu(),d=f=nl(T=N+=O$e(Qx())),E++;break;case 45:y===45&&nl(N)==2&&(_=0)}}return a}function gH(e,t,n,r,i,a,s,o,l,c,d,f){for(var m=i-1,g=i===0?a:[""],y=E$e(g),_=0,S=0,w=0;_<r;++_)for(var E=0,T=Fp(e,m+1,m=Kne(S=s[_])),A=e;E<y;++E)(A=Xne(S>0?g[E]+" "+T:Zx(T,/&\f/g,g[E])))&&(l[w++]=A);return sM(e,t,n,i===0?Vne:o,l,c,d,f)}function M$e(e,t,n,r){return sM(e,t,n,qne,aM(C$e()),Fp(e,2,-2),0,r)}function bH(e,t,n,r,i){return sM(e,t,n,Yne,Fp(e,0,r),Fp(e,r+1,-1),r,i)}function dR(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function L$e(e,t,n,r){switch(e.type){case S$e:if(e.children.length)break;case v$e:case _$e:case Yne:return e.return=e.return||e.value;case qne:return"";case x$e:return e.return=e.value+"{"+dR(e.children,r)+"}";case Vne:if(!nl(e.value=e.props.join(",")))return""}return nl(n=dR(e.children,r))?e.return=e.value+"{"+n+"}":""}var P$e=wee(Object.keys,Object),B$e=Object.prototype,j$e=B$e.hasOwnProperty;function F$e(e){if(!qE(e))return P$e(e);var t=[];for(var n in Object(e))j$e.call(e,n)&&n!="constructor"&&t.push(n);return t}var hR=Th(kl,"DataView"),fR=Th(kl,"Promise"),pR=Th(kl,"Set"),mR=Th(kl,"WeakMap"),yH="[object Map]",$$e="[object Object]",vH="[object Promise]",_H="[object Set]",xH="[object WeakMap]",SH="[object DataView]",U$e=Ch(hR),z$e=Ch(Ay),H$e=Ch(fR),W$e=Ch(pR),G$e=Ch(mR),kd=xm;(hR&&kd(new hR(new ArrayBuffer(1)))!=SH||Ay&&kd(new Ay)!=yH||fR&&kd(fR.resolve())!=vH||pR&&kd(new pR)!=_H||mR&&kd(new mR)!=xH)&&(kd=function(e){var t=xm(e),n=t==$$e?e.constructor:void 0,r=n?Ch(n):"";if(r)switch(r){case U$e:return SH;case z$e:return yH;case H$e:return vH;case W$e:return _H;case G$e:return xH}return t});var q$e="[object Map]",V$e="[object Set]",Y$e=Object.prototype,K$e=Y$e.hasOwnProperty;function wH(e){if(e==null)return!0;if(VE(e)&&(sw(e)||typeof e=="string"||typeof e.splice=="function"||BD(e)||jD(e)||aw(e)))return!e.length;var t=kd(e);if(t==q$e||t==V$e)return!e.size;if(qE(e))return!F$e(e).length;for(var n in e)if(K$e.call(e,n))return!1;return!0}var Qne="c4",X$e=L(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),Z$e=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./c4Diagram-YG6GDRKO-DAt0t6eK.js");return{diagram:t}},__vite__mapDeps([8,9]));return{id:Qne,diagram:e}},"loader"),Q$e={id:Qne,detector:X$e,loader:Z$e},J$e=Q$e,Jne="flowchart",eUe=L((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),tUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-Z65JFfSc.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:Jne,diagram:e}},"loader"),nUe={id:Jne,detector:eUe,loader:tUe},rUe=nUe,ere="flowchart-v2",iUe=L((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),aUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-Z65JFfSc.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:ere,diagram:e}},"loader"),sUe={id:ere,detector:iUe,loader:aUe},oUe=sUe,tre="er",lUe=L(e=>/^\s*erDiagram/.test(e),"detector"),cUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./erDiagram-Q2GNP2WA-BmVDGu8M.js");return{diagram:t}},__vite__mapDeps([15,12,13,14]));return{id:tre,diagram:e}},"loader"),uUe={id:tre,detector:lUe,loader:cUe},dUe=uUe,nre="gitGraph",hUe=L(e=>/^\s*gitGraph/.test(e),"detector"),fUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./gitGraphDiagram-NY62KEGX-faBi9oTt.js");return{diagram:t}},__vite__mapDeps([16,17,18,19,2,4,5]));return{id:nre,diagram:e}},"loader"),pUe={id:nre,detector:hUe,loader:fUe},mUe=pUe,rre="gantt",gUe=L(e=>/^\s*gantt/.test(e),"detector"),bUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./ganttDiagram-JELNMOA3-BZ3yfDKP.js");return{diagram:t}},__vite__mapDeps([20,21,22,23]));return{id:rre,diagram:e}},"loader"),yUe={id:rre,detector:gUe,loader:bUe},vUe=yUe,ire="info",_Ue=L(e=>/^\s*info/.test(e),"detector"),xUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./infoDiagram-WHAUD3N6-CJU-Jxtx.js");return{diagram:t}},__vite__mapDeps([24,19,2,4,5]));return{id:ire,diagram:e}},"loader"),SUe={id:ire,detector:_Ue,loader:xUe},are="pie",wUe=L(e=>/^\s*pie/.test(e),"detector"),EUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./pieDiagram-ADFJNKIX-BkK0cKA8.js");return{diagram:t}},__vite__mapDeps([25,17,19,2,4,5,26,27,22]));return{id:are,diagram:e}},"loader"),CUe={id:are,detector:wUe,loader:EUe},sre="quadrantChart",TUe=L(e=>/^\s*quadrantChart/.test(e),"detector"),kUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./quadrantDiagram-AYHSOK5B-CeFigc3p.js");return{diagram:t}},__vite__mapDeps([28,21,22,23]));return{id:sre,diagram:e}},"loader"),NUe={id:sre,detector:TUe,loader:kUe},AUe=NUe,ore="xychart",RUe=L(e=>/^\s*xychart(-beta)?/.test(e),"detector"),IUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./xychartDiagram-PRI3JC2R-CqgFJhi0.js");return{diagram:t}},__vite__mapDeps([29,22,27,21,23]));return{id:ore,diagram:e}},"loader"),OUe={id:ore,detector:RUe,loader:IUe},DUe=OUe,lre="requirement",MUe=L(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),LUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./requirementDiagram-UZGBJVZJ-KowHp3BW.js");return{diagram:t}},__vite__mapDeps([30,12,13]));return{id:lre,diagram:e}},"loader"),PUe={id:lre,detector:MUe,loader:LUe},BUe=PUe,cre="sequence",jUe=L(e=>/^\s*sequenceDiagram/.test(e),"detector"),FUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./sequenceDiagram-WL72ISMW-3mHDMyaP.js");return{diagram:t}},__vite__mapDeps([31,9,18]));return{id:cre,diagram:e}},"loader"),$Ue={id:cre,detector:jUe,loader:FUe},UUe=$Ue,ure="class",zUe=L((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),HUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./classDiagram-2ON5EDUG-DHiY0J8v.js");return{diagram:t}},__vite__mapDeps([32,33,11,12,13]));return{id:ure,diagram:e}},"loader"),WUe={id:ure,detector:zUe,loader:HUe},GUe=WUe,dre="classDiagram",qUe=L((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),VUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./classDiagram-v2-WZHVMYZB-DHiY0J8v.js");return{diagram:t}},__vite__mapDeps([34,33,11,12,13]));return{id:dre,diagram:e}},"loader"),YUe={id:dre,detector:qUe,loader:VUe},KUe=YUe,hre="state",XUe=L((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),ZUe=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./stateDiagram-FKZM4ZOC-h-G1xS2P.js");return{diagram:t}},__vite__mapDeps([35,36,12,13,1,2,3,4]));return{id:hre,diagram:e}},"loader"),QUe={id:hre,detector:XUe,loader:ZUe},JUe=QUe,fre="stateDiagram",eze=L((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),tze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./stateDiagram-v2-4FDKWEC3-BGGNxhyR.js");return{diagram:t}},__vite__mapDeps([37,36,12,13]));return{id:fre,diagram:e}},"loader"),nze={id:fre,detector:eze,loader:tze},rze=nze,pre="journey",ize=L(e=>/^\s*journey/.test(e),"detector"),aze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./journeyDiagram-XKPGCS4Q-CIFki-iq.js");return{diagram:t}},__vite__mapDeps([38,9,11,26]));return{id:pre,diagram:e}},"loader"),sze={id:pre,detector:ize,loader:aze},oze=sze,lze=L((e,t,n)=>{Pe.debug(`rendering svg for syntax error
|
|
346
|
+
`);const r=z3e(t),i=r.append("g");r.attr("viewBox","0 0 2412 512"),UZ(r,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${n}`)},"draw"),mre={draw:lze},cze=mre,uze={db:{},renderer:mre,parser:{parse:L(()=>{},"parse")}},dze=uze,gre="flowchart-elk",hze=L((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),fze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./flowDiagram-NV44I4VS-Z65JFfSc.js");return{diagram:t}},__vite__mapDeps([10,11,12,13,14]));return{id:gre,diagram:e}},"loader"),pze={id:gre,detector:hze,loader:fze},mze=pze,bre="timeline",gze=L(e=>/^\s*timeline/.test(e),"detector"),bze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./timeline-definition-IT6M3QCI-Cc2H2fvU.js");return{diagram:t}},__vite__mapDeps([39,26]));return{id:bre,diagram:e}},"loader"),yze={id:bre,detector:gze,loader:bze},vze=yze,yre="mindmap",_ze=L(e=>/^\s*mindmap/.test(e),"detector"),xze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./mindmap-definition-VGOIOE7T-QhVqNLyz.js");return{diagram:t}},__vite__mapDeps([40,12,13]));return{id:yre,diagram:e}},"loader"),Sze={id:yre,detector:_ze,loader:xze},wze=Sze,vre="kanban",Eze=L(e=>/^\s*kanban/.test(e),"detector"),Cze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./kanban-definition-3W4ZIXB7-DDuM9VeF.js");return{diagram:t}},__vite__mapDeps([41,11]));return{id:vre,diagram:e}},"loader"),Tze={id:vre,detector:Eze,loader:Cze},kze=Tze,_re="sankey",Nze=L(e=>/^\s*sankey(-beta)?/.test(e),"detector"),Aze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./sankeyDiagram-TZEHDZUN-D7CevVS2.js");return{diagram:t}},__vite__mapDeps([42,27,22]));return{id:_re,diagram:e}},"loader"),Rze={id:_re,detector:Nze,loader:Aze},Ize=Rze,xre="packet",Oze=L(e=>/^\s*packet(-beta)?/.test(e),"detector"),Dze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./diagram-S2PKOQOG-D_T0ifdw.js");return{diagram:t}},__vite__mapDeps([43,17,19,2,4,5]));return{id:xre,diagram:e}},"loader"),Mze={id:xre,detector:Oze,loader:Dze},Sre="radar",Lze=L(e=>/^\s*radar-beta/.test(e),"detector"),Pze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./diagram-QEK2KX5R-DQsnVN2A.js");return{diagram:t}},__vite__mapDeps([44,17,19,2,4,5]));return{id:Sre,diagram:e}},"loader"),Bze={id:Sre,detector:Lze,loader:Pze},wre="block",jze=L(e=>/^\s*block(-beta)?/.test(e),"detector"),Fze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./blockDiagram-VD42YOAC-ke2uPDpN.js");return{diagram:t}},__vite__mapDeps([45,11,5,2,1,14]));return{id:wre,diagram:e}},"loader"),$ze={id:wre,detector:jze,loader:Fze},Uze=$ze,Ere="architecture",zze=L(e=>/^\s*architecture/.test(e),"detector"),Hze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./architectureDiagram-VXUJARFQ-utRnH0EI.js");return{diagram:t}},__vite__mapDeps([46,17,19,2,4,5,7]));return{id:Ere,diagram:e}},"loader"),Wze={id:Ere,detector:zze,loader:Hze},Gze=Wze,Cre="treemap",qze=L(e=>/^\s*treemap/.test(e),"detector"),Vze=L(async()=>{const{diagram:e}=await Gn(async()=>{const{diagram:t}=await import("./diagram-PSM6KHXK-726LBpxe.js");return{diagram:t}},__vite__mapDeps([47,13,17,19,2,4,5,23,27,22]));return{id:Cre,diagram:e}},"loader"),Yze={id:Cre,detector:qze,loader:Vze},EH=!1,i1=L(()=>{EH||(EH=!0,$S("error",dze,e=>e.toLowerCase().trim()==="error"),$S("---",{db:{clear:L(()=>{},"clear")},styles:{},renderer:{draw:L(()=>{},"draw")},parser:{parse:L(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:L(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),S2(mze,wze,Gze),S2(J$e,kze,KUe,GUe,dUe,vUe,SUe,CUe,BUe,UUe,oUe,rUe,vze,mUe,rze,JUe,oze,AUe,Ize,Mze,DUe,Uze,Bze,Yze))},"addDiagrams"),Kze=L(async()=>{Pe.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(ih).map(async([n,{detector:r,loader:i}])=>{if(i)try{T2(n)}catch{try{const{diagram:a,id:s}=await i();$S(s,a,r)}catch(a){throw Pe.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete ih[n],a}}}))).filter(n=>n.status==="rejected");if(t.length>0){Pe.error(`Failed to load ${t.length} external diagrams`);for(const n of t)Pe.error(n);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),Xze="graphics-document document";function Tre(e,t){e.attr("role",Xze),t!==""&&e.attr("aria-roledescription",t)}L(Tre,"setA11yDiagramInfo");function kre(e,t,n,r){if(e.insert!==void 0){if(n){const i=`chart-desc-${r}`;e.attr("aria-describedby",i),e.insert("desc",":first-child").attr("id",i).text(n)}if(t){const i=`chart-title-${r}`;e.attr("aria-labelledby",i),e.insert("title",":first-child").attr("id",i).text(t)}}}L(kre,"addSVGa11yTitleDescription");var Gd,gR=(Gd=class{constructor(t,n,r,i,a){this.type=t,this.text=n,this.db=r,this.parser=i,this.renderer=a}static async fromText(t,n={}){const r=da(),i=lD(t,r);t=Y4e(t)+`
|
|
347
347
|
`;try{T2(i)}catch{const c=yDe(i);if(!c)throw new AZ(`Diagram ${i} not found.`);const{id:d,diagram:f}=await c();$S(d,f)}const{db:a,parser:s,renderer:o,init:l}=T2(i);return s.parser&&(s.parser.yy=a),a.clear?.(),l?.(r),n.title&&a.setDiagramTitle?.(n.title),await s.parse(t),new Gd(i,t,a,s,o)}async render(t,n){await this.renderer.draw(this.text,t,n,this)}getParser(){return this.parser}getType(){return this.type}},L(Gd,"Diagram"),Gd),CH=[],Zze=L(()=>{CH.forEach(e=>{e()}),CH=[]},"attachFunctions"),Qze=L(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Nre(e){const t=e.match(NZ);if(!t)return{text:e,metadata:{}};let n=KBe(t[1],{schema:YBe})??{};n=typeof n=="object"&&!Array.isArray(n)?n:{};const r={};return n.displayMode&&(r.displayMode=n.displayMode.toString()),n.title&&(r.title=n.title.toString()),n.config&&(r.config=n.config),{text:e.slice(t[0].length),metadata:r}}L(Nre,"extractFrontMatter");var Jze=L(e=>e.replace(/\r\n?/g,`
|
|
348
348
|
`).replace(/<(\w+)([^>]*)>/g,(t,n,r)=>"<"+n+r.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),e8e=L(e=>{const{text:t,metadata:n}=Nre(e),{displayMode:r,title:i,config:a={}}=n;return r&&(a.gantt||(a.gantt={}),a.gantt.displayMode=r),{title:i,config:a,text:t}},"processFrontmatter"),t8e=L(e=>{const t=go.detectInit(e)??{},n=go.detectDirective(e,"wrap");return Array.isArray(n)?t.wrap=n.some(({type:r})=>r==="wrap"):n?.type==="wrap"&&(t.wrap=!0),{text:L4e(e),directive:t}},"processDirectives");function oM(e){const t=Jze(e),n=e8e(t),r=t8e(n.text),i=WD(n.config,r.directive);return e=Qze(r.text),{code:e,title:n.title,config:i}}L(oM,"preprocessDiagram");function Are(e){const t=new TextEncoder().encode(e),n=Array.from(t,r=>String.fromCodePoint(r)).join("");return btoa(n)}L(Are,"toBase64");var n8e=5e4,r8e="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",i8e="sandbox",a8e="loose",s8e="http://www.w3.org/2000/svg",o8e="http://www.w3.org/1999/xlink",l8e="http://www.w3.org/1999/xhtml",c8e="100%",u8e="100%",d8e="border:0;margin:0;",h8e="margin:0",f8e="allow-top-navigation-by-user-activation allow-popups",p8e='The "iframe" tag is not supported by your browser.',m8e=["foreignobject"],g8e=["dominant-baseline"];function lM(e){const t=oM(e);return jS(),MDe(t.config??{}),t}L(lM,"processAndSetConfigs");async function Rre(e,t){i1();try{const{code:n,config:r}=lM(e);return{diagramType:(await Ore(n)).type,config:r}}catch(n){if(t?.suppressErrors)return!1;throw n}}L(Rre,"parse");var TH=L((e,t,n=[])=>`
|
|
349
349
|
.${e} ${t} { ${n.join(" !important; ")} !important; }`,"cssImportantStyles"),b8e=L((e,t=new Map)=>{let n="";if(e.themeCSS!==void 0&&(n+=`
|
|
@@ -394,7 +394,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
394
394
|
]))(?:`+(/[^\s\\]/.source+'|[ ]+(?:(?![ "])|'+r+")|"+/\\[\r\n]+(?:[#;].*[\r\n]+)*(?![#;])/.source)+")*"),lookbehind:!0,greedy:!0,alias:"attr-value",inside:{comment:n,quoted:{pattern:RegExp(/(^|\s)/.source+r),lookbehind:!0,greedy:!0},punctuation:/\\$/m,boolean:{pattern:/^(?:false|no|off|on|true|yes)$/,greedy:!0}}},punctuation:/=/}})(e)}G0.displayName="t4-templating";G0.aliases=[];function G0(e){(function(t){function n(i,a,s){return{pattern:RegExp("<#"+i+"[\\s\\S]*?#>"),alias:"block",inside:{delimiter:{pattern:RegExp("^<#"+i+"|#>$"),alias:"important"},content:{pattern:/[\s\S]+/,inside:a,alias:s}}}}function r(i){var a=t.languages[i],s="language-"+i;return{block:{pattern:/<#[\s\S]+?#>/,inside:{directive:n("@",{"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/,inside:{punctuation:/^=|^["']|["']$/}},keyword:/\b\w+(?=\s)/,"attr-name":/\b\w+/}),expression:n("=",a,s),"class-feature":n("\\+",a,s),standard:n("",a,s)}}}}t.languages["t4-templating"]=Object.defineProperty({},"createT4",{value:r})})(e)}LB.displayName="t4-cs";LB.aliases=["t4"];function LB(e){e.register(Oh),e.register(G0),e.languages.t4=e.languages["t4-cs"]=e.languages["t4-templating"].createT4("csharp")}PB.displayName="t4-vb";PB.aliases=[];function PB(e){e.register(G0),e.register(z0),e.languages["t4-vb"]=e.languages["t4-templating"].createT4("vbnet")}BB.displayName="tap";BB.aliases=[];function BB(e){e.register(F0),e.languages.tap={fail:/not ok[^#{\n\r]*/,pass:/ok[^#{\n\r]*/,pragma:/pragma [+-][a-z]+/,bailout:/bail out!.*/i,version:/TAP version \d+/i,plan:/\b\d+\.\.\d+(?: +#.*)?/,subtest:{pattern:/# Subtest(?:: .*)?/,greedy:!0},punctuation:/[{}]/,directive:/#.*/,yamlish:{pattern:/(^[ \t]*)---[\s\S]*?[\r\n][ \t]*\.\.\.$/m,lookbehind:!0,inside:e.languages.yaml,alias:"language-yaml"}}}jB.displayName="tcl";jB.aliases=[];function jB(e){e.languages.tcl={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},string:{pattern:/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"/,greedy:!0},variable:[{pattern:/(\$)(?:::)?(?:[a-zA-Z0-9]+::)*\w+/,lookbehind:!0},{pattern:/(\$)\{[^}]+\}/,lookbehind:!0},{pattern:/(^[\t ]*set[ \t]+)(?:::)?(?:[a-zA-Z0-9]+::)*\w+/m,lookbehind:!0}],function:{pattern:/(^[\t ]*proc[ \t]+)\S+/m,lookbehind:!0},builtin:[{pattern:/(^[\t ]*)(?:break|class|continue|error|eval|exit|for|foreach|if|proc|return|switch|while)\b/m,lookbehind:!0},/\b(?:else|elseif)\b/],scope:{pattern:/(^[\t ]*)(?:global|upvar|variable)\b/m,lookbehind:!0,alias:"constant"},keyword:{pattern:/(^[\t ]*|\[)(?:Safe_Base|Tcl|after|append|apply|array|auto_(?:execok|import|load|mkindex|qualify|reset)|automkindex_old|bgerror|binary|catch|cd|chan|clock|close|concat|dde|dict|encoding|eof|exec|expr|fblocked|fconfigure|fcopy|file(?:event|name)?|flush|gets|glob|history|http|incr|info|interp|join|lappend|lassign|lindex|linsert|list|llength|load|lrange|lrepeat|lreplace|lreverse|lsearch|lset|lsort|math(?:func|op)|memory|msgcat|namespace|open|package|parray|pid|pkg_mkIndex|platform|puts|pwd|re_syntax|read|refchan|regexp|registry|regsub|rename|scan|seek|set|socket|source|split|string|subst|tcl(?:_endOfWord|_findLibrary|startOf(?:Next|Previous)Word|test|vars|wordBreak(?:After|Before))|tell|time|tm|trace|unknown|unload|unset|update|uplevel|vwait)\b/m,lookbehind:!0},operator:/!=?|\*\*?|==|&&?|\|\|?|<[=<]?|>[=>]?|[-+~\/%?^]|\b(?:eq|in|ne|ni)\b/,punctuation:/[{}()\[\]]/}}FB.displayName="tt2";FB.aliases=[];function FB(e){e.register(Sn),e.register(ta),(function(t){t.languages.tt2=t.languages.extend("clike",{comment:/#.*|\[%#[\s\S]*?%\]/,keyword:/\b(?:BLOCK|CALL|CASE|CATCH|CLEAR|DEBUG|DEFAULT|ELSE|ELSIF|END|FILTER|FINAL|FOREACH|GET|IF|IN|INCLUDE|INSERT|LAST|MACRO|META|NEXT|PERL|PROCESS|RAWPERL|RETURN|SET|STOP|SWITCH|TAGS|THROW|TRY|UNLESS|USE|WHILE|WRAPPER)\b/,punctuation:/[[\]{},()]/}),t.languages.insertBefore("tt2","number",{operator:/=[>=]?|!=?|<=?|>=?|&&|\|\|?|\b(?:and|not|or)\b/,variable:{pattern:/\b[a-z]\w*(?:\s*\.\s*(?:\d+|\$?[a-z]\w*))*\b/i}}),t.languages.insertBefore("tt2","keyword",{delimiter:{pattern:/^(?:\[%|%%)-?|-?%\]$/,alias:"punctuation"}}),t.languages.insertBefore("tt2","string",{"single-quoted-string":{pattern:/'[^\\']*(?:\\[\s\S][^\\']*)*'/,greedy:!0,alias:"string"},"double-quoted-string":{pattern:/"[^\\"]*(?:\\[\s\S][^\\"]*)*"/,greedy:!0,alias:"string",inside:{variable:{pattern:/\$(?:[a-z]\w*(?:\.(?:\d+|\$?[a-z]\w*))*)/i}}}}),delete t.languages.tt2.string,t.hooks.add("before-tokenize",function(n){var r=/\[%[\s\S]+?%\]/g;t.languages["markup-templating"].buildPlaceholders(n,"tt2",r)}),t.hooks.add("after-tokenize",function(n){t.languages["markup-templating"].tokenizePlaceholders(n,"tt2")})})(e)}$B.displayName="toml";$B.aliases=[];function $B(e){(function(t){var n=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function r(i){return i.replace(/__/g,function(){return n})}t.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(r(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(r(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(e)}UB.displayName="tremor";UB.aliases=["trickle","troy"];function UB(e){(function(t){t.languages.tremor={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},"interpolated-string":null,extractor:{pattern:/\b[a-z_]\w*\|(?:[^\r\n\\|]|\\(?:\r\n|[\s\S]))*\|/i,greedy:!0,inside:{regex:{pattern:/(^re)\|[\s\S]+/,lookbehind:!0},function:/^\w+/,value:/\|[\s\S]+/}},identifier:{pattern:/`[^`]*`/,greedy:!0},function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/,keyword:/\b(?:args|as|by|case|config|connect|connector|const|copy|create|default|define|deploy|drop|each|emit|end|erase|event|flow|fn|for|from|group|having|insert|into|intrinsic|let|links|match|merge|mod|move|of|operator|patch|pipeline|recur|script|select|set|sliding|state|stream|to|tumbling|update|use|when|where|window|with)\b/,boolean:/\b(?:false|null|true)\b/i,number:/\b(?:0b[01_]*|0x[0-9a-fA-F_]*|\d[\d_]*(?:\.\d[\d_]*)?(?:[Ee][+-]?[\d_]+)?)\b/,"pattern-punctuation":{pattern:/%(?=[({[])/,alias:"punctuation"},operator:/[-+*\/%~!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?>?=?|(?:absent|and|not|or|present|xor)\b/,punctuation:/::|[;\[\]()\{\},.:]/};var n=/#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*")*\}/.source;t.languages.tremor["interpolated-string"]={pattern:RegExp(/(^|[^\\])/.source+'(?:"""(?:'+/[^"\\#]|\\[\s\S]|"(?!"")|#(?!\{)/.source+"|"+n+')*"""|"(?:'+/[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)/.source+"|"+n+')*")'),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:RegExp(n),inside:{punctuation:/^#\{|\}$/,expression:{pattern:/[\s\S]+/,inside:t.languages.tremor}}},string:/[\s\S]+/}},t.languages.troy=t.languages.tremor,t.languages.trickle=t.languages.tremor})(e)}zB.displayName="typoscript";zB.aliases=["tsconfig"];function zB(e){(function(t){var n=/\b(?:ACT|ACTIFSUB|CARRAY|CASE|CLEARGIF|COA|COA_INT|CONSTANTS|CONTENT|CUR|EDITPANEL|EFFECT|EXT|FILE|FLUIDTEMPLATE|FORM|FRAME|FRAMESET|GIFBUILDER|GMENU|GMENU_FOLDOUT|GMENU_LAYERS|GP|HMENU|HRULER|HTML|IENV|IFSUB|IMAGE|IMGMENU|IMGMENUITEM|IMGTEXT|IMG_RESOURCE|INCLUDE_TYPOSCRIPT|JSMENU|JSMENUITEM|LLL|LOAD_REGISTER|NO|PAGE|RECORDS|RESTORE_REGISTER|TEMPLATE|TEXT|TMENU|TMENUITEM|TMENU_LAYERS|USER|USER_INT|_GIFBUILDER|global|globalString|globalVar)\b/;t.languages.typoscript={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:= \t]|(?:^|[^= \t])[ \t]+)\/\/.*/,lookbehind:!0,greedy:!0},{pattern:/(^|[^"'])#.*/,lookbehind:!0,greedy:!0}],function:[{pattern:/<INCLUDE_TYPOSCRIPT:\s*source\s*=\s*(?:"[^"\r\n]*"|'[^'\r\n]*')\s*>/,inside:{string:{pattern:/"[^"\r\n]*"|'[^'\r\n]*'/,inside:{keyword:n}},keyword:{pattern:/INCLUDE_TYPOSCRIPT/}}},{pattern:/@import\s*(?:"[^"\r\n]*"|'[^'\r\n]*')/,inside:{string:/"[^"\r\n]*"|'[^'\r\n]*'/}}],string:{pattern:/^([^=]*=[< ]?)(?:(?!\]\n).)*/,lookbehind:!0,inside:{function:/\{\$.*\}/,keyword:n,number:/^\d+$/,punctuation:/[,|:]/}},keyword:n,number:{pattern:/\b\d+\s*[.{=]/,inside:{operator:/[.{=]/}},tag:{pattern:/\.?[-\w\\]+\.?/,inside:{punctuation:/\./}},punctuation:/[{}[\];(),.:|]/,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/},t.languages.tsconfig=t.languages.typoscript})(e)}HB.displayName="unrealscript";HB.aliases=["uc","uscript"];function HB(e){e.languages.unrealscript={comment:/\/\/.*|\/\*[\s\S]*?\*\//,string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},category:{pattern:/(\b(?:(?:autoexpand|hide|show)categories|var)\s*\()[^()]+(?=\))/,lookbehind:!0,greedy:!0,alias:"property"},metadata:{pattern:/(\w\s*)<\s*\w+\s*=[^<>|=\r\n]+(?:\|\s*\w+\s*=[^<>|=\r\n]+)*>/,lookbehind:!0,greedy:!0,inside:{property:/\b\w+(?=\s*=)/,operator:/=/,punctuation:/[<>|]/}},macro:{pattern:/`\w+/,alias:"property"},"class-name":{pattern:/(\b(?:class|enum|extends|interface|state(?:\(\))?|struct|within)\s+)\w+/,lookbehind:!0},keyword:/\b(?:abstract|actor|array|auto|autoexpandcategories|bool|break|byte|case|class|classgroup|client|coerce|collapsecategories|config|const|continue|default|defaultproperties|delegate|dependson|deprecated|do|dontcollapsecategories|editconst|editinlinenew|else|enum|event|exec|export|extends|final|float|for|forcescriptorder|foreach|function|goto|guid|hidecategories|hidedropdown|if|ignores|implements|inherits|input|int|interface|iterator|latent|local|material|name|native|nativereplication|noexport|nontransient|noteditinlinenew|notplaceable|operator|optional|out|pawn|perobjectconfig|perobjectlocalized|placeable|postoperator|preoperator|private|protected|reliable|replication|return|server|showcategories|simulated|singular|state|static|string|struct|structdefault|structdefaultproperties|switch|texture|transient|travel|unreliable|until|var|vector|while|within)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,boolean:/\b(?:false|true)\b/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/>>|<<|--|\+\+|\*\*|[-+*/~!=<>$@]=?|&&?|\|\|?|\^\^?|[?:%]|\b(?:ClockwiseFrom|Cross|Dot)\b/,punctuation:/[()[\]{};,.]/},e.languages.uc=e.languages.uscript=e.languages.unrealscript}WB.displayName="uorazor";WB.aliases=[];function WB(e){e.languages.uorazor={"comment-hash":{pattern:/#.*/,alias:"comment",greedy:!0},"comment-slash":{pattern:/\/\/.*/,alias:"comment",greedy:!0},string:{pattern:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,inside:{punctuation:/^['"]|['"]$/},greedy:!0},"source-layers":{pattern:/\b(?:arms|backpack|blue|bracelet|cancel|clear|cloak|criminal|earrings|enemy|facialhair|friend|friendly|gloves|gray|grey|ground|hair|head|innerlegs|innertorso|innocent|lefthand|middletorso|murderer|neck|nonfriendly|onehandedsecondary|outerlegs|outertorso|pants|red|righthand|ring|self|shirt|shoes|talisman|waist)\b/i,alias:"function"},"source-commands":{pattern:/\b(?:alliance|attack|cast|clearall|clearignore|clearjournal|clearlist|clearsysmsg|createlist|createtimer|dclick|dclicktype|dclickvar|dress|dressconfig|drop|droprelloc|emote|getlabel|guild|gumpclose|gumpresponse|hotkey|ignore|lasttarget|lift|lifttype|menu|menuresponse|msg|org|organize|organizer|overhead|pause|poplist|potion|promptresponse|pushlist|removelist|removetimer|rename|restock|say|scav|scavenger|script|setability|setlasttarget|setskill|settimer|setvar|sysmsg|target|targetloc|targetrelloc|targettype|undress|unignore|unsetvar|useobject|useonce|useskill|usetype|virtue|wait|waitforgump|waitformenu|waitforprompt|waitforstat|waitforsysmsg|waitfortarget|walk|wfsysmsg|wft|whisper|yell)\b/,alias:"function"},"tag-name":{pattern:/(^\{%-?\s*)\w+/,lookbehind:!0,alias:"keyword"},delimiter:{pattern:/^\{[{%]-?|-?[%}]\}$/,alias:"punctuation"},function:/\b(?:atlist|close|closest|count|counter|counttype|dead|dex|diffhits|diffmana|diffstam|diffweight|find|findbuff|finddebuff|findlayer|findtype|findtypelist|followers|gumpexists|hidden|hits|hp|hue|human|humanoid|ingump|inlist|insysmessage|insysmsg|int|invul|lhandempty|list|listexists|mana|maxhits|maxhp|maxmana|maxstam|maxweight|monster|mounted|name|next|noto|paralyzed|poisoned|position|prev|previous|queued|rand|random|rhandempty|skill|stam|str|targetexists|timer|timerexists|varexist|warmode|weight)\b/,keyword:/\b(?:and|as|break|continue|else|elseif|endfor|endif|endwhile|for|if|loop|not|or|replay|stop|while)\b/,boolean:/\b(?:false|null|true)\b/,number:/\b0x[\dA-Fa-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][-+]?\d+)?/,operator:[{pattern:/(\s)(?:and|b-and|b-or|b-xor|ends with|in|is|matches|not|or|same as|starts with)(?=\s)/,lookbehind:!0},/[=<>]=?|!=|\*\*?|\/\/?|\?:?|[-+~%|]/],punctuation:/[()\[\]{}:.,]/}}GB.displayName="v";GB.aliases=[];function GB(e){e.register(Sn),(function(t){var n={pattern:/[\s\S]+/,inside:null};t.languages.v=t.languages.extend("clike",{string:{pattern:/r?(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,alias:"quoted-string",greedy:!0,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:\{[^{}]*\}|\w+(?:\.\w+(?:\([^\(\)]*\))?|\[[^\[\]]+\])*)/,lookbehind:!0,inside:{"interpolation-variable":{pattern:/^\$\w[\s\S]*$/,alias:"variable"},"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},"interpolation-expression":n}}}},"class-name":{pattern:/(\b(?:enum|interface|struct|type)\s+)(?:C\.)?\w+/,lookbehind:!0},keyword:/(?:\b(?:__global|as|asm|assert|atomic|break|chan|const|continue|defer|else|embed|enum|fn|for|go(?:to)?|if|import|in|interface|is|lock|match|module|mut|none|or|pub|return|rlock|select|shared|sizeof|static|struct|type(?:of)?|union|unsafe)|\$(?:else|for|if)|#(?:flag|include))\b/,number:/\b(?:0x[a-f\d]+(?:_[a-f\d]+)*|0b[01]+(?:_[01]+)*|0o[0-7]+(?:_[0-7]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?)\b/i,operator:/~|\?|[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\.?/,builtin:/\b(?:any(?:_float|_int)?|bool|byte(?:ptr)?|charptr|f(?:32|64)|i(?:8|16|64|128|nt)|rune|size_t|string|u(?:16|32|64|128)|voidptr)\b/}),n.inside=t.languages.v,t.languages.insertBefore("v","string",{char:{pattern:/`(?:\\`|\\?[^`]{1,2})`/,alias:"rune"}}),t.languages.insertBefore("v","operator",{attribute:{pattern:/(^[\t ]*)\[(?:deprecated|direct_array_access|flag|inline|live|ref_only|typedef|unsafe_fn|windows_stdcall)\]/m,lookbehind:!0,alias:"annotation",inside:{punctuation:/[\[\]]/,keyword:/\w+/}},generic:{pattern:/<\w+>(?=\s*[\)\{])/,inside:{punctuation:/[<>]/,"class-name":/\w+/}}}),t.languages.insertBefore("v","function",{"generic-function":{pattern:/\b\w+\s*<\w+>(?=\()/,inside:{function:/^\w+/,generic:{pattern:/<\w+>/,inside:t.languages.v.generic.inside}}}})})(e)}qB.displayName="vala";qB.aliases=[];function qB(e){e.register(Sn),e.languages.vala=e.languages.extend("clike",{"class-name":[{pattern:/\b[A-Z]\w*(?:\.\w+)*\b(?=(?:\?\s+|\*?\s+\*?)\w)/,inside:{punctuation:/\./}},{pattern:/(\[)[A-Z]\w*(?:\.\w+)*\b/,lookbehind:!0,inside:{punctuation:/\./}},{pattern:/(\b(?:class|interface)\s+[A-Z]\w*(?:\.\w+)*\s*:\s*)[A-Z]\w*(?:\.\w+)*\b/,lookbehind:!0,inside:{punctuation:/\./}},{pattern:/((?:\b(?:class|enum|interface|new|struct)\s+)|(?:catch\s+\())[A-Z]\w*(?:\.\w+)*\b/,lookbehind:!0,inside:{punctuation:/\./}}],keyword:/\b(?:abstract|as|assert|async|base|bool|break|case|catch|char|class|const|construct|continue|default|delegate|delete|do|double|dynamic|else|ensures|enum|errordomain|extern|finally|float|for|foreach|get|if|in|inline|int|int16|int32|int64|int8|interface|internal|is|lock|long|namespace|new|null|out|override|owned|params|private|protected|public|ref|requires|return|set|short|signal|sizeof|size_t|ssize_t|static|string|struct|switch|this|throw|throws|try|typeof|uchar|uint|uint16|uint32|uint64|uint8|ulong|unichar|unowned|ushort|using|value|var|virtual|void|volatile|weak|while|yield)\b/i,function:/\b\w+(?=\s*\()/,number:/(?:\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)(?:f|u?l?)?/i,operator:/\+\+|--|&&|\|\||<<=?|>>=?|=>|->|~|[+\-*\/%&^|=!<>]=?|\?\??|\.\.\./,punctuation:/[{}[\];(),.:]/,constant:/\b[A-Z0-9_]+\b/}),e.languages.insertBefore("vala","string",{"raw-string":{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string"},"template-string":{pattern:/@"[\s\S]*?"/,greedy:!0,inside:{interpolation:{pattern:/\$(?:\([^)]*\)|[a-zA-Z]\w*)/,inside:{delimiter:{pattern:/^\$\(?|\)$/,alias:"punctuation"},rest:e.languages.vala}},string:/[\s\S]+/}}}),e.languages.insertBefore("vala","keyword",{regex:{pattern:/\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[imsx]{0,4}(?=\s*(?:$|[\r\n,.;})\]]))/,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\//,"regex-flags":/^[a-z]+$/}}})}VB.displayName="velocity";VB.aliases=[];function VB(e){e.register(Hi),(function(t){t.languages.velocity=t.languages.extend("markup",{});var n={variable:{pattern:/(^|[^\\](?:\\\\)*)\$!?(?:[a-z][\w-]*(?:\([^)]*\))?(?:\.[a-z][\w-]*(?:\([^)]*\))?|\[[^\]]+\])*|\{[^}]+\})/i,lookbehind:!0,inside:{}},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},number:/\b\d+\b/,boolean:/\b(?:false|true)\b/,operator:/[=!<>]=?|[+*/%-]|&&|\|\||\.\.|\b(?:eq|g[et]|l[et]|n(?:e|ot))\b/,punctuation:/[(){}[\]:,.]/};n.variable.inside={string:n.string,function:{pattern:/([^\w-])[a-z][\w-]*(?=\()/,lookbehind:!0},number:n.number,boolean:n.boolean,punctuation:n.punctuation},t.languages.insertBefore("velocity","comment",{unparsed:{pattern:/(^|[^\\])#\[\[[\s\S]*?\]\]#/,lookbehind:!0,greedy:!0,inside:{punctuation:/^#\[\[|\]\]#$/}},"velocity-comment":[{pattern:/(^|[^\\])#\*[\s\S]*?\*#/,lookbehind:!0,greedy:!0,alias:"comment"},{pattern:/(^|[^\\])##.*/,lookbehind:!0,greedy:!0,alias:"comment"}],directive:{pattern:/(^|[^\\](?:\\\\)*)#@?(?:[a-z][\w-]*|\{[a-z][\w-]*\})(?:\s*\((?:[^()]|\([^()]*\))*\))?/i,lookbehind:!0,inside:{keyword:{pattern:/^#@?(?:[a-z][\w-]*|\{[a-z][\w-]*\})|\bin\b/,inside:{punctuation:/[{}]/}},rest:n}},variable:n.variable}),t.languages.velocity.tag.inside["attr-value"].inside.rest=t.languages.velocity})(e)}YB.displayName="verilog";YB.aliases=[];function YB(e){e.languages.verilog={comment:{pattern:/\/\/.*|\/\*[\s\S]*?\*\//,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"kernel-function":{pattern:/\B\$\w+\b/,alias:"property"},constant:/\B`\w+\b/,function:/\b\w+(?=\()/,keyword:/\b(?:alias|and|assert|assign|assume|automatic|before|begin|bind|bins|binsof|bit|break|buf|bufif0|bufif1|byte|case|casex|casez|cell|chandle|class|clocking|cmos|config|const|constraint|context|continue|cover|covergroup|coverpoint|cross|deassign|default|defparam|design|disable|dist|do|edge|else|end|endcase|endclass|endclocking|endconfig|endfunction|endgenerate|endgroup|endinterface|endmodule|endpackage|endprimitive|endprogram|endproperty|endsequence|endspecify|endtable|endtask|enum|event|expect|export|extends|extern|final|first_match|for|force|foreach|forever|fork|forkjoin|function|generate|genvar|highz0|highz1|if|iff|ifnone|ignore_bins|illegal_bins|import|incdir|include|initial|inout|input|inside|instance|int|integer|interface|intersect|join|join_any|join_none|large|liblist|library|local|localparam|logic|longint|macromodule|matches|medium|modport|module|nand|negedge|new|nmos|nor|noshowcancelled|not|notif0|notif1|null|or|output|package|packed|parameter|pmos|posedge|primitive|priority|program|property|protected|pull0|pull1|pulldown|pullup|pulsestyle_ondetect|pulsestyle_onevent|pure|rand|randc|randcase|randsequence|rcmos|real|realtime|ref|reg|release|repeat|return|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|sequence|shortint|shortreal|showcancelled|signed|small|solve|specify|specparam|static|string|strong0|strong1|struct|super|supply0|supply1|table|tagged|task|this|throughout|time|timeprecision|timeunit|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|type|typedef|union|unique|unsigned|use|uwire|var|vectored|virtual|void|wait|wait_order|wand|weak0|weak1|while|wildcard|wire|with|within|wor|xnor|xor)\b/,important:/\b(?:always|always_comb|always_ff|always_latch)\b(?: *@)?/,number:/\B##?\d+|(?:\b\d+)?'[odbh] ?[\da-fzx_?]+|\b(?:\d*[._])?\d+(?:e[-+]?\d+)?/i,operator:/[-+{}^~%*\/?=!<>&|]+/,punctuation:/[[\];(),.:]/}}KB.displayName="vhdl";KB.aliases=[];function KB(e){e.languages.vhdl={comment:/--.+/,"vhdl-vectors":{pattern:/\b[oxb]"[\da-f_]+"|"[01uxzwlh-]+"/i,alias:"number"},"quoted-function":{pattern:/"\S+?"(?=\()/,alias:"function"},string:/"(?:[^\\"\r\n]|\\(?:\r\n|[\s\S]))*"/,attribute:{pattern:/\b'\w+/,alias:"attr-name"},keyword:/\b(?:access|after|alias|all|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|new|next|null|of|on|open|others|out|package|port|postponed|private|procedure|process|pure|range|record|register|reject|report|return|select|severity|shared|signal|subtype|then|to|transport|type|unaffected|units|until|use|variable|view|wait|when|while|with)\b/i,boolean:/\b(?:false|true)\b/i,function:/\w+(?=\()/,number:/'[01uxzwlh-]'|\b(?:\d+#[\da-f_.]+#|\d[\d_.]*)(?:e[-+]?\d+)?/i,operator:/[<>]=?|:=|[-+*/&=]|\b(?:abs|and|mod|nand|nor|not|or|rem|rol|ror|sla|sll|sra|srl|xnor|xor)\b/i,punctuation:/[{}[\];(),.:]/}}XB.displayName="vim";XB.aliases=[];function XB(e){e.languages.vim={string:/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\r\n]|'')*'/,comment:/".*/,function:/\b\w+(?=\()/,keyword:/\b(?:N|Next|P|Print|X|XMLent|XMLns|ab|abbreviate|abc|abclear|abo|aboveleft|al|all|ar|arga|argadd|argd|argdelete|argdo|arge|argedit|argg|argglobal|argl|arglocal|args|argu|argument|as|ascii|b|bN|bNext|ba|bad|badd|ball|bd|bdelete|be|bel|belowright|bf|bfirst|bl|blast|bm|bmodified|bn|bnext|bo|botright|bp|bprevious|br|brea|break|breaka|breakadd|breakd|breakdel|breakl|breaklist|brewind|bro|browse|bufdo|buffer|buffers|bun|bunload|bw|bwipeout|c|cN|cNext|cNfcNfile|ca|cabbrev|cabc|cabclear|cad|caddb|caddbuffer|caddexpr|caddf|caddfile|cal|call|cat|catch|cb|cbuffer|cc|ccl|cclose|cd|ce|center|cex|cexpr|cf|cfile|cfir|cfirst|cg|cgetb|cgetbuffer|cgete|cgetexpr|cgetfile|change|changes|chd|chdir|che|checkpath|checkt|checktime|cl|cla|clast|clist|clo|close|cmapc|cmapclear|cn|cnew|cnewer|cnext|cnf|cnfile|cnorea|cnoreabbrev|co|col|colder|colo|colorscheme|comc|comclear|comp|compiler|con|conf|confirm|continue|cope|copen|copy|cp|cpf|cpfile|cprevious|cq|cquit|cr|crewind|cu|cuna|cunabbrev|cunmap|cw|cwindow|d|debugg|debuggreedy|delc|delcommand|delete|delf|delfunction|delm|delmarks|di|diffg|diffget|diffoff|diffpatch|diffpu|diffput|diffsplit|diffthis|diffu|diffupdate|dig|digraphs|display|dj|djump|dl|dlist|dr|drop|ds|dsearch|dsp|dsplit|e|earlier|echoe|echoerr|echom|echomsg|echon|edit|el|else|elsei|elseif|em|emenu|en|endf|endfo|endfor|endfun|endfunction|endif|endt|endtry|endw|endwhile|ene|enew|ex|exi|exit|exu|exusage|f|file|files|filetype|fin|fina|finally|find|fini|finish|fir|first|fix|fixdel|fo|fold|foldc|foldclose|foldd|folddoc|folddoclosed|folddoopen|foldo|foldopen|for|fu|fun|function|go|goto|gr|grep|grepa|grepadd|h|ha|hardcopy|help|helpf|helpfind|helpg|helpgrep|helpt|helptags|hid|hide|his|history|ia|iabbrev|iabc|iabclear|if|ij|ijump|il|ilist|imapc|imapclear|in|inorea|inoreabbrev|isearch|isp|isplit|iu|iuna|iunabbrev|iunmap|j|join|ju|jumps|k|kee|keepalt|keepj|keepjumps|keepmarks|l|lN|lNext|lNf|lNfile|la|lad|laddb|laddbuffer|laddexpr|laddf|laddfile|lan|language|last|later|lb|lbuffer|lc|lcd|lch|lchdir|lcl|lclose|left|lefta|leftabove|let|lex|lexpr|lf|lfile|lfir|lfirst|lg|lgetb|lgetbuffer|lgete|lgetexpr|lgetfile|lgr|lgrep|lgrepa|lgrepadd|lh|lhelpgrep|list|ll|lla|llast|lli|llist|lm|lmak|lmake|lmap|lmapc|lmapclear|ln|lne|lnew|lnewer|lnext|lnf|lnfile|lnoremap|lo|loadview|loc|lockmarks|lockv|lockvar|lol|lolder|lop|lopen|lp|lpf|lpfile|lprevious|lr|lrewind|ls|lt|ltag|lu|lunmap|lv|lvimgrep|lvimgrepa|lvimgrepadd|lw|lwindow|m|ma|mak|make|mark|marks|mat|match|menut|menutranslate|mk|mkexrc|mks|mksession|mksp|mkspell|mkv|mkvie|mkview|mkvimrc|mod|mode|move|mz|mzf|mzfile|mzscheme|n|nbkey|new|next|nmapc|nmapclear|noh|nohlsearch|norea|noreabbrev|nu|number|nun|nunmap|o|omapc|omapclear|on|only|open|opt|options|ou|ounmap|p|pc|pclose|pe|ped|pedit|perl|perld|perldo|po|pop|popu|popup|pp|ppop|pre|preserve|prev|previous|print|prof|profd|profdel|profile|promptf|promptfind|promptr|promptrepl|ps|psearch|ptN|ptNext|pta|ptag|ptf|ptfirst|ptj|ptjump|ptl|ptlast|ptn|ptnext|ptp|ptprevious|ptr|ptrewind|pts|ptselect|pu|put|pw|pwd|py|pyf|pyfile|python|q|qa|qall|quit|quita|quitall|r|read|rec|recover|red|redi|redir|redo|redr|redraw|redraws|redrawstatus|reg|registers|res|resize|ret|retab|retu|return|rew|rewind|ri|right|rightb|rightbelow|ru|rub|ruby|rubyd|rubydo|rubyf|rubyfile|runtime|rv|rviminfo|sN|sNext|sa|sal|sall|san|sandbox|sargument|sav|saveas|sb|sbN|sbNext|sba|sball|sbf|sbfirst|sbl|sblast|sbm|sbmodified|sbn|sbnext|sbp|sbprevious|sbr|sbrewind|sbuffer|scrip|scripte|scriptencoding|scriptnames|se|set|setf|setfiletype|setg|setglobal|setl|setlocal|sf|sfind|sfir|sfirst|sh|shell|sign|sil|silent|sim|simalt|sl|sla|slast|sleep|sm|smagic|smap|smapc|smapclear|sme|smenu|sn|snext|sni|sniff|sno|snomagic|snor|snoremap|snoreme|snoremenu|so|sor|sort|source|sp|spe|spelld|spelldump|spellgood|spelli|spellinfo|spellr|spellrepall|spellu|spellundo|spellw|spellwrong|split|spr|sprevious|sre|srewind|st|sta|stag|star|startg|startgreplace|startinsert|startr|startreplace|stj|stjump|stop|stopi|stopinsert|sts|stselect|sun|sunhide|sunm|sunmap|sus|suspend|sv|sview|syncbind|t|tN|tNext|ta|tab|tabN|tabNext|tabc|tabclose|tabd|tabdo|tabe|tabedit|tabf|tabfind|tabfir|tabfirst|tabl|tablast|tabm|tabmove|tabn|tabnew|tabnext|tabo|tabonly|tabp|tabprevious|tabr|tabrewind|tabs|tag|tags|tc|tcl|tcld|tcldo|tclf|tclfile|te|tearoff|tf|tfirst|th|throw|tj|tjump|tl|tlast|tm|tmenu|tn|tnext|to|topleft|tp|tprevious|tr|trewind|try|ts|tselect|tu|tunmenu|u|una|unabbreviate|undo|undoj|undojoin|undol|undolist|unh|unhide|unlet|unlo|unlockvar|unm|unmap|up|update|ve|verb|verbose|version|vert|vertical|vi|vie|view|vim|vimgrep|vimgrepa|vimgrepadd|visual|viu|viusage|vmapc|vmapclear|vne|vnew|vs|vsplit|vu|vunmap|w|wN|wNext|wa|wall|wh|while|win|winc|wincmd|windo|winp|winpos|winsize|wn|wnext|wp|wprevious|wq|wqa|wqall|write|ws|wsverb|wv|wviminfo|x|xa|xall|xit|xm|xmap|xmapc|xmapclear|xme|xmenu|xn|xnoremap|xnoreme|xnoremenu|xu|xunmap|y|yank)\b/,builtin:/\b(?:acd|ai|akm|aleph|allowrevins|altkeymap|ambiwidth|ambw|anti|antialias|arab|arabic|arabicshape|ari|arshape|autochdir|autocmd|autoindent|autoread|autowrite|autowriteall|aw|awa|background|backspace|backup|backupcopy|backupdir|backupext|backupskip|balloondelay|ballooneval|balloonexpr|bdir|bdlay|beval|bex|bexpr|bg|bh|bin|binary|biosk|bioskey|bk|bkc|bomb|breakat|brk|browsedir|bs|bsdir|bsk|bt|bufhidden|buflisted|buftype|casemap|ccv|cdpath|cedit|cfu|ch|charconvert|ci|cin|cindent|cink|cinkeys|cino|cinoptions|cinw|cinwords|clipboard|cmdheight|cmdwinheight|cmp|cms|columns|com|comments|commentstring|compatible|complete|completefunc|completeopt|consk|conskey|copyindent|cot|cpo|cpoptions|cpt|cscopepathcomp|cscopeprg|cscopequickfix|cscopetag|cscopetagorder|cscopeverbose|cspc|csprg|csqf|cst|csto|csverb|cuc|cul|cursorcolumn|cursorline|cwh|debug|deco|def|define|delcombine|dex|dg|dict|dictionary|diff|diffexpr|diffopt|digraph|dip|dir|directory|dy|ea|ead|eadirection|eb|ed|edcompatible|ef|efm|ei|ek|enc|encoding|endofline|eol|ep|equalalways|equalprg|errorbells|errorfile|errorformat|esckeys|et|eventignore|expandtab|exrc|fcl|fcs|fdc|fde|fdi|fdl|fdls|fdm|fdn|fdo|fdt|fen|fenc|fencs|fex|ff|ffs|fileencoding|fileencodings|fileformat|fileformats|fillchars|fk|fkmap|flp|fml|fmr|foldcolumn|foldenable|foldexpr|foldignore|foldlevel|foldlevelstart|foldmarker|foldmethod|foldminlines|foldnestmax|foldtext|formatexpr|formatlistpat|formatoptions|formatprg|fp|fs|fsync|ft|gcr|gd|gdefault|gfm|gfn|gfs|gfw|ghr|gp|grepformat|grepprg|gtl|gtt|guicursor|guifont|guifontset|guifontwide|guiheadroom|guioptions|guipty|guitablabel|guitabtooltip|helpfile|helpheight|helplang|hf|hh|hi|hidden|highlight|hk|hkmap|hkmapp|hkp|hl|hlg|hls|hlsearch|ic|icon|iconstring|ignorecase|im|imactivatekey|imak|imc|imcmdline|imd|imdisable|imi|iminsert|ims|imsearch|inc|include|includeexpr|incsearch|inde|indentexpr|indentkeys|indk|inex|inf|infercase|insertmode|invacd|invai|invakm|invallowrevins|invaltkeymap|invanti|invantialias|invar|invarab|invarabic|invarabicshape|invari|invarshape|invautochdir|invautoindent|invautoread|invautowrite|invautowriteall|invaw|invawa|invbackup|invballooneval|invbeval|invbin|invbinary|invbiosk|invbioskey|invbk|invbl|invbomb|invbuflisted|invcf|invci|invcin|invcindent|invcompatible|invconfirm|invconsk|invconskey|invcopyindent|invcp|invcscopetag|invcscopeverbose|invcst|invcsverb|invcuc|invcul|invcursorcolumn|invcursorline|invdeco|invdelcombine|invdg|invdiff|invdigraph|invdisable|invea|inveb|inved|invedcompatible|invek|invendofline|inveol|invequalalways|inverrorbells|invesckeys|invet|invex|invexpandtab|invexrc|invfen|invfk|invfkmap|invfoldenable|invgd|invgdefault|invguipty|invhid|invhidden|invhk|invhkmap|invhkmapp|invhkp|invhls|invhlsearch|invic|invicon|invignorecase|invim|invimc|invimcmdline|invimd|invincsearch|invinf|invinfercase|invinsertmode|invis|invjoinspaces|invjs|invlazyredraw|invlbr|invlinebreak|invlisp|invlist|invloadplugins|invlpl|invlz|invma|invmacatsui|invmagic|invmh|invml|invmod|invmodeline|invmodifiable|invmodified|invmore|invmousef|invmousefocus|invmousehide|invnu|invnumber|invodev|invopendevice|invpaste|invpi|invpreserveindent|invpreviewwindow|invprompt|invpvw|invreadonly|invremap|invrestorescreen|invrevins|invri|invrightleft|invrightleftcmd|invrl|invrlc|invro|invrs|invru|invruler|invsb|invsc|invscb|invscrollbind|invscs|invsecure|invsft|invshellslash|invshelltemp|invshiftround|invshortname|invshowcmd|invshowfulltag|invshowmatch|invshowmode|invsi|invsm|invsmartcase|invsmartindent|invsmarttab|invsmd|invsn|invsol|invspell|invsplitbelow|invsplitright|invspr|invsr|invssl|invsta|invstartofline|invstmp|invswapfile|invswf|invta|invtagbsearch|invtagrelative|invtagstack|invtbi|invtbidi|invtbs|invtermbidi|invterse|invtextauto|invtextmode|invtf|invtgst|invtildeop|invtimeout|invtitle|invto|invtop|invtr|invttimeout|invttybuiltin|invttyfast|invtx|invvb|invvisualbell|invwa|invwarn|invwb|invweirdinvert|invwfh|invwfw|invwildmenu|invwinfixheight|invwinfixwidth|invwiv|invwmnu|invwrap|invwrapscan|invwrite|invwriteany|invwritebackup|invws|isf|isfname|isi|isident|isk|iskeyword|isprint|joinspaces|js|key|keymap|keymodel|keywordprg|km|kmp|kp|langmap|langmenu|laststatus|lazyredraw|lbr|lcs|linebreak|lines|linespace|lisp|lispwords|listchars|loadplugins|lpl|lsp|lz|macatsui|magic|makeef|makeprg|matchpairs|matchtime|maxcombine|maxfuncdepth|maxmapdepth|maxmem|maxmempattern|maxmemtot|mco|mef|menuitems|mfd|mh|mis|mkspellmem|ml|mls|mm|mmd|mmp|mmt|modeline|modelines|modifiable|modified|more|mouse|mousef|mousefocus|mousehide|mousem|mousemodel|mouses|mouseshape|mouset|mousetime|mp|mps|msm|mzq|mzquantum|nf|noacd|noai|noakm|noallowrevins|noaltkeymap|noanti|noantialias|noar|noarab|noarabic|noarabicshape|noari|noarshape|noautochdir|noautoindent|noautoread|noautowrite|noautowriteall|noaw|noawa|nobackup|noballooneval|nobeval|nobin|nobinary|nobiosk|nobioskey|nobk|nobl|nobomb|nobuflisted|nocf|noci|nocin|nocindent|nocompatible|noconfirm|noconsk|noconskey|nocopyindent|nocp|nocscopetag|nocscopeverbose|nocst|nocsverb|nocuc|nocul|nocursorcolumn|nocursorline|nodeco|nodelcombine|nodg|nodiff|nodigraph|nodisable|noea|noeb|noed|noedcompatible|noek|noendofline|noeol|noequalalways|noerrorbells|noesckeys|noet|noex|noexpandtab|noexrc|nofen|nofk|nofkmap|nofoldenable|nogd|nogdefault|noguipty|nohid|nohidden|nohk|nohkmap|nohkmapp|nohkp|nohls|noic|noicon|noignorecase|noim|noimc|noimcmdline|noimd|noincsearch|noinf|noinfercase|noinsertmode|nois|nojoinspaces|nojs|nolazyredraw|nolbr|nolinebreak|nolisp|nolist|noloadplugins|nolpl|nolz|noma|nomacatsui|nomagic|nomh|noml|nomod|nomodeline|nomodifiable|nomodified|nomore|nomousef|nomousefocus|nomousehide|nonu|nonumber|noodev|noopendevice|nopaste|nopi|nopreserveindent|nopreviewwindow|noprompt|nopvw|noreadonly|noremap|norestorescreen|norevins|nori|norightleft|norightleftcmd|norl|norlc|noro|nors|noru|noruler|nosb|nosc|noscb|noscrollbind|noscs|nosecure|nosft|noshellslash|noshelltemp|noshiftround|noshortname|noshowcmd|noshowfulltag|noshowmatch|noshowmode|nosi|nosm|nosmartcase|nosmartindent|nosmarttab|nosmd|nosn|nosol|nospell|nosplitbelow|nosplitright|nospr|nosr|nossl|nosta|nostartofline|nostmp|noswapfile|noswf|nota|notagbsearch|notagrelative|notagstack|notbi|notbidi|notbs|notermbidi|noterse|notextauto|notextmode|notf|notgst|notildeop|notimeout|notitle|noto|notop|notr|nottimeout|nottybuiltin|nottyfast|notx|novb|novisualbell|nowa|nowarn|nowb|noweirdinvert|nowfh|nowfw|nowildmenu|nowinfixheight|nowinfixwidth|nowiv|nowmnu|nowrap|nowrapscan|nowrite|nowriteany|nowritebackup|nows|nrformats|numberwidth|nuw|odev|oft|ofu|omnifunc|opendevice|operatorfunc|opfunc|osfiletype|pa|para|paragraphs|paste|pastetoggle|patchexpr|patchmode|path|pdev|penc|pex|pexpr|pfn|ph|pheader|pi|pm|pmbcs|pmbfn|popt|preserveindent|previewheight|previewwindow|printdevice|printencoding|printexpr|printfont|printheader|printmbcharset|printmbfont|printoptions|prompt|pt|pumheight|pvh|pvw|qe|quoteescape|readonly|remap|report|restorescreen|revins|rightleft|rightleftcmd|rl|rlc|ro|rs|rtp|ruf|ruler|rulerformat|runtimepath|sbo|sc|scb|scr|scroll|scrollbind|scrolljump|scrolloff|scrollopt|scs|sect|sections|secure|sel|selection|selectmode|sessionoptions|sft|shcf|shellcmdflag|shellpipe|shellquote|shellredir|shellslash|shelltemp|shelltype|shellxquote|shiftround|shiftwidth|shm|shortmess|shortname|showbreak|showcmd|showfulltag|showmatch|showmode|showtabline|shq|si|sidescroll|sidescrolloff|siso|sj|slm|smartcase|smartindent|smarttab|smc|smd|softtabstop|sol|spc|spell|spellcapcheck|spellfile|spelllang|spellsuggest|spf|spl|splitbelow|splitright|sps|sr|srr|ss|ssl|ssop|stal|startofline|statusline|stl|stmp|su|sua|suffixes|suffixesadd|sw|swapfile|swapsync|swb|swf|switchbuf|sws|sxq|syn|synmaxcol|syntax|t_AB|t_AF|t_AL|t_CS|t_CV|t_Ce|t_Co|t_Cs|t_DL|t_EI|t_F1|t_F2|t_F3|t_F4|t_F5|t_F6|t_F7|t_F8|t_F9|t_IE|t_IS|t_K1|t_K3|t_K4|t_K5|t_K6|t_K7|t_K8|t_K9|t_KA|t_KB|t_KC|t_KD|t_KE|t_KF|t_KG|t_KH|t_KI|t_KJ|t_KK|t_KL|t_RI|t_RV|t_SI|t_Sb|t_Sf|t_WP|t_WS|t_ZH|t_ZR|t_al|t_bc|t_cd|t_ce|t_cl|t_cm|t_cs|t_da|t_db|t_dl|t_fs|t_k1|t_k2|t_k3|t_k4|t_k5|t_k6|t_k7|t_k8|t_k9|t_kB|t_kD|t_kI|t_kN|t_kP|t_kb|t_kd|t_ke|t_kh|t_kl|t_kr|t_ks|t_ku|t_le|t_mb|t_md|t_me|t_mr|t_ms|t_nd|t_op|t_se|t_so|t_sr|t_te|t_ti|t_ts|t_ue|t_us|t_ut|t_vb|t_ve|t_vi|t_vs|t_xs|tabline|tabpagemax|tabstop|tagbsearch|taglength|tagrelative|tagstack|tal|tb|tbi|tbidi|tbis|tbs|tenc|term|termbidi|termencoding|terse|textauto|textmode|textwidth|tgst|thesaurus|tildeop|timeout|timeoutlen|title|titlelen|titleold|titlestring|toolbar|toolbariconsize|top|tpm|tsl|tsr|ttimeout|ttimeoutlen|ttm|tty|ttybuiltin|ttyfast|ttym|ttymouse|ttyscroll|ttytype|tw|tx|uc|ul|undolevels|updatecount|updatetime|ut|vb|vbs|vdir|verbosefile|vfile|viewdir|viewoptions|viminfo|virtualedit|visualbell|vop|wak|warn|wb|wc|wcm|wd|weirdinvert|wfh|wfw|whichwrap|wi|wig|wildchar|wildcharm|wildignore|wildmenu|wildmode|wildoptions|wim|winaltkeys|window|winfixheight|winfixwidth|winheight|winminheight|winminwidth|winwidth|wiv|wiw|wm|wmh|wmnu|wmw|wop|wrap|wrapmargin|wrapscan|writeany|writebackup|writedelay|ww)\b/,number:/\b(?:0x[\da-f]+|\d+(?:\.\d+)?)\b/i,operator:/\|\||&&|[-+.]=?|[=!](?:[=~][#?]?)?|[<>]=?[#?]?|[*\/%?]|\b(?:is(?:not)?)\b/,punctuation:/[{}[\](),;:]/}}ZB.displayName="visual-basic";ZB.aliases=["vb","vba"];function ZB(e){e.languages["visual-basic"]={comment:{pattern:/(?:['‘’]|REM\b)(?:[^\r\n_]|_(?:\r\n?|\n)?)*/i,inside:{keyword:/^REM/i}},directive:{pattern:/#(?:Const|Else|ElseIf|End|ExternalChecksum|ExternalSource|If|Region)(?:\b_[ \t]*(?:\r\n?|\n)|.)+/i,alias:"property",greedy:!0},string:{pattern:/\$?["“”](?:["“”]{2}|[^"“”])*["“”]C?/i,greedy:!0},date:{pattern:/#[ \t]*(?:\d+([/-])\d+\1\d+(?:[ \t]+(?:\d+[ \t]*(?:AM|PM)|\d+:\d+(?::\d+)?(?:[ \t]*(?:AM|PM))?))?|\d+[ \t]*(?:AM|PM)|\d+:\d+(?::\d+)?(?:[ \t]*(?:AM|PM))?)[ \t]*#/i,alias:"number"},number:/(?:(?:\b\d+(?:\.\d+)?|\.\d+)(?:E[+-]?\d+)?|&[HO][\dA-F]+)(?:[FRD]|U?[ILS])?/i,boolean:/\b(?:False|Nothing|True)\b/i,keyword:/\b(?:AddHandler|AddressOf|Alias|And(?:Also)?|As|Boolean|ByRef|Byte|ByVal|Call|Case|Catch|C(?:Bool|Byte|Char|Date|Dbl|Dec|Int|Lng|Obj|SByte|Short|Sng|Str|Type|UInt|ULng|UShort)|Char|Class|Const|Continue|Currency|Date|Decimal|Declare|Default|Delegate|Dim|DirectCast|Do|Double|Each|Else(?:If)?|End(?:If)?|Enum|Erase|Error|Event|Exit|Finally|For|Friend|Function|Get(?:Type|XMLNamespace)?|Global|GoSub|GoTo|Handles|If|Implements|Imports|In|Inherits|Integer|Interface|Is|IsNot|Let|Lib|Like|Long|Loop|Me|Mod|Module|Must(?:Inherit|Override)|My(?:Base|Class)|Namespace|Narrowing|New|Next|Not(?:Inheritable|Overridable)?|Object|Of|On|Operator|Option(?:al)?|Or(?:Else)?|Out|Overloads|Overridable|Overrides|ParamArray|Partial|Private|Property|Protected|Public|RaiseEvent|ReadOnly|ReDim|RemoveHandler|Resume|Return|SByte|Select|Set|Shadows|Shared|short|Single|Static|Step|Stop|String|Structure|Sub|SyncLock|Then|Throw|To|Try|TryCast|Type|TypeOf|U(?:Integer|Long|Short)|Until|Using|Variant|Wend|When|While|Widening|With(?:Events)?|WriteOnly|Xor)\b/i,operator:/[+\-*/\\^<=>&#@$%!]|\b_(?=[ \t]*[\r\n])/,punctuation:/[{}().,:?]/},e.languages.vb=e.languages["visual-basic"],e.languages.vba=e.languages["visual-basic"]}QB.displayName="warpscript";QB.aliases=[];function QB(e){e.languages.warpscript={comment:/#.*|\/\/.*|\/\*[\s\S]*?\*\//,string:{pattern:/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'|<'(?:[^\\']|'(?!>)|\\.)*'>/,greedy:!0},variable:/\$\S+/,macro:{pattern:/@\S+/,alias:"property"},keyword:/\b(?:BREAK|CHECKMACRO|CONTINUE|CUDF|DEFINED|DEFINEDMACRO|EVAL|FAIL|FOR|FOREACH|FORSTEP|IFT|IFTE|MSGFAIL|NRETURN|RETHROW|RETURN|SWITCH|TRY|UDF|UNTIL|WHILE)\b/,number:/[+-]?\b(?:NaN|Infinity|\d+(?:\.\d*)?(?:[Ee][+-]?\d+)?|0x[\da-fA-F]+|0b[01]+)\b/,boolean:/\b(?:F|T|false|true)\b/,punctuation:/<%|%>|[{}[\]()]/,operator:/==|&&?|\|\|?|\*\*?|>>>?|<<|[<>!~]=?|[-/%^]|\+!?|\b(?:AND|NOT|OR)\b/}}JB.displayName="wasm";JB.aliases=[];function JB(e){e.languages.wasm={comment:[/\(;[\s\S]*?;\)/,{pattern:/;;.*/,greedy:!0}],string:{pattern:/"(?:\\[\s\S]|[^"\\])*"/,greedy:!0},keyword:[{pattern:/\b(?:align|offset)=/,inside:{operator:/=/}},{pattern:/\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,inside:{punctuation:/\./}},/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],variable:/\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,number:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,punctuation:/[()]/}}ej.displayName="web-idl";ej.aliases=["webidl"];function ej(e){(function(t){var n=/(?:\B-|\b_|\b)[A-Za-z][\w-]*(?![\w-])/.source,r="(?:"+/\b(?:unsigned\s+)?long\s+long(?![\w-])/.source+"|"+/\b(?:unrestricted|unsigned)\s+[a-z]+(?![\w-])/.source+"|"+/(?!(?:unrestricted|unsigned)\b)/.source+n+/(?:\s*<(?:[^<>]|<[^<>]*>)*>)?/.source+")"+/(?:\s*\?)?/.source,i={};t.languages["web-idl"]={comment:{pattern:/\/\/.*|\/\*[\s\S]*?\*\//,greedy:!0},string:{pattern:/"[^"]*"/,greedy:!0},namespace:{pattern:RegExp(/(\bnamespace\s+)/.source+n),lookbehind:!0},"class-name":[{pattern:/(^|[^\w-])(?:iterable|maplike|setlike)\s*<(?:[^<>]|<[^<>]*>)*>/,lookbehind:!0,inside:i},{pattern:RegExp(/(\b(?:attribute|const|deleter|getter|optional|setter)\s+)/.source+r),lookbehind:!0,inside:i},{pattern:RegExp("("+/\bcallback\s+/.source+n+/\s*=\s*/.source+")"+r),lookbehind:!0,inside:i},{pattern:RegExp(/(\btypedef\b\s*)/.source+r),lookbehind:!0,inside:i},{pattern:RegExp(/(\b(?:callback|dictionary|enum|interface(?:\s+mixin)?)\s+)(?!(?:interface|mixin)\b)/.source+n),lookbehind:!0},{pattern:RegExp(/(:\s*)/.source+n),lookbehind:!0},RegExp(n+/(?=\s+(?:implements|includes)\b)/.source),{pattern:RegExp(/(\b(?:implements|includes)\s+)/.source+n),lookbehind:!0},{pattern:RegExp(r+"(?="+/\s*(?:\.{3}\s*)?/.source+n+/\s*[(),;=]/.source+")"),inside:i}],builtin:/\b(?:ArrayBuffer|BigInt64Array|BigUint64Array|ByteString|DOMString|DataView|Float32Array|Float64Array|FrozenArray|Int16Array|Int32Array|Int8Array|ObservableArray|Promise|USVString|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray)\b/,keyword:[/\b(?:async|attribute|callback|const|constructor|deleter|dictionary|enum|getter|implements|includes|inherit|interface|mixin|namespace|null|optional|or|partial|readonly|required|setter|static|stringifier|typedef|unrestricted)\b/,/\b(?:any|bigint|boolean|byte|double|float|iterable|long|maplike|object|octet|record|sequence|setlike|short|symbol|undefined|unsigned|void)\b/],boolean:/\b(?:false|true)\b/,number:{pattern:/(^|[^\w-])-?(?:0x[0-9a-f]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|NaN|Infinity)(?![\w-])/i,lookbehind:!0},operator:/\.{3}|[=:?<>-]/,punctuation:/[(){}[\].,;]/};for(var a in t.languages["web-idl"])a!=="class-name"&&(i[a]=t.languages["web-idl"][a]);t.languages.webidl=t.languages["web-idl"]})(e)}tj.displayName="wgsl";tj.aliases=[];function tj(e){e.languages.wgsl={comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},"builtin-attribute":{pattern:/(@)builtin\(.*?\)/,lookbehind:!0,inside:{attribute:{pattern:/^builtin/,alias:"attr-name"},punctuation:/[(),]/,"built-in-values":{pattern:/\b(?:frag_depth|front_facing|global_invocation_id|instance_index|local_invocation_id|local_invocation_index|num_workgroups|position|sample_index|sample_mask|vertex_index|workgroup_id)\b/,alias:"attr-value"}}},attributes:{pattern:/(@)(?:align|binding|compute|const|fragment|group|id|interpolate|invariant|location|size|vertex|workgroup_size)/i,lookbehind:!0,alias:"attr-name"},functions:{pattern:/\b(fn\s+)[_a-zA-Z]\w*(?=[(<])/,lookbehind:!0,alias:"function"},keyword:/\b(?:bitcast|break|case|const|continue|continuing|default|discard|else|enable|fallthrough|fn|for|function|if|let|loop|private|return|storage|struct|switch|type|uniform|var|while|workgroup)\b/,builtin:/\b(?:abs|acos|acosh|all|any|array|asin|asinh|atan|atan2|atanh|atomic|atomicAdd|atomicAnd|atomicCompareExchangeWeak|atomicExchange|atomicLoad|atomicMax|atomicMin|atomicOr|atomicStore|atomicSub|atomicXor|bool|ceil|clamp|cos|cosh|countLeadingZeros|countOneBits|countTrailingZeros|cross|degrees|determinant|distance|dot|dpdx|dpdxCoarse|dpdxFine|dpdy|dpdyCoarse|dpdyFine|exp|exp2|extractBits|f32|f64|faceForward|firstLeadingBit|floor|fma|fract|frexp|fwidth|fwidthCoarse|fwidthFine|i32|i64|insertBits|inverseSqrt|ldexp|length|log|log2|mat[2-4]x[2-4]|max|min|mix|modf|normalize|override|pack2x16float|pack2x16snorm|pack2x16unorm|pack4x8snorm|pack4x8unorm|pow|ptr|quantizeToF16|radians|reflect|refract|reverseBits|round|sampler|sampler_comparison|select|shiftLeft|shiftRight|sign|sin|sinh|smoothstep|sqrt|staticAssert|step|storageBarrier|tan|tanh|textureDimensions|textureGather|textureGatherCompare|textureLoad|textureNumLayers|textureNumLevels|textureNumSamples|textureSample|textureSampleBias|textureSampleCompare|textureSampleCompareLevel|textureSampleGrad|textureSampleLevel|textureStore|texture_1d|texture_2d|texture_2d_array|texture_3d|texture_cube|texture_cube_array|texture_depth_2d|texture_depth_2d_array|texture_depth_cube|texture_depth_cube_array|texture_depth_multisampled_2d|texture_multisampled_2d|texture_storage_1d|texture_storage_2d|texture_storage_2d_array|texture_storage_3d|transpose|trunc|u32|u64|unpack2x16float|unpack2x16snorm|unpack2x16unorm|unpack4x8snorm|unpack4x8unorm|vec[2-4]|workgroupBarrier)\b/,"function-calls":{pattern:/\b[_a-z]\w*(?=\()/i,alias:"function"},"class-name":/\b(?:[A-Z][A-Za-z0-9]*)\b/,"bool-literal":{pattern:/\b(?:false|true)\b/,alias:"boolean"},"hex-int-literal":{pattern:/\b0[xX][0-9a-fA-F]+[iu]?\b(?![.pP])/,alias:"number"},"hex-float-literal":{pattern:/\b0[xX][0-9a-fA-F]*(?:\.[0-9a-fA-F]*)?(?:[pP][+-]?\d+[fh]?)?/,alias:"number"},"decimal-float-literal":[{pattern:/\d*\.\d+(?:[eE](?:\+|-)?\d+)?[fh]?/,alias:"number"},{pattern:/\d+\.\d*(?:[eE](?:\+|-)?\d+)?[fh]?/,alias:"number"},{pattern:/\d+[eE](?:\+|-)?\d+[fh]?/,alias:"number"},{pattern:/\b\d+[fh]\b/,alias:"number"}],"int-literal":{pattern:/\b\d+[iu]?\b/,alias:"number"},operator:[{pattern:/(?:\^|~|\|(?!\|)|\|\||&&|<<|>>|!)(?!=)/},{pattern:/&(?![&=])/},{pattern:/(?:\+=|-=|\*=|\/=|%=|\^=|&=|\|=|<<=|>>=)/},{pattern:/(^|[^<>=!])=(?![=>])/,lookbehind:!0},{pattern:/(?:==|!=|<=|\+\+|--|(^|[^=])>=)/,lookbehind:!0},{pattern:/(?:(?:[+%]|(?:\*(?!\w)))(?!=))|(?:-(?!>))|(?:\/(?!\/))/},{pattern:/->/}],punctuation:/[@(){}[\],;<>:.]/}}nj.displayName="wiki";nj.aliases=[];function nj(e){e.register(Hi),e.languages.wiki=e.languages.extend("markup",{"block-comment":{pattern:/(^|[^\\])\/\*[\s\S]*?\*\//,lookbehind:!0,alias:"comment"},heading:{pattern:/^(=+)[^=\r\n].*?\1/m,inside:{punctuation:/^=+|=+$/,important:/.+/}},emphasis:{pattern:/('{2,5}).+?\1/,inside:{"bold-italic":{pattern:/(''''').+?(?=\1)/,lookbehind:!0,alias:["bold","italic"]},bold:{pattern:/(''')[^'](?:.*?[^'])?(?=\1)/,lookbehind:!0},italic:{pattern:/('')[^'](?:.*?[^'])?(?=\1)/,lookbehind:!0},punctuation:/^''+|''+$/}},hr:{pattern:/^-{4,}/m,alias:"punctuation"},url:[/ISBN +(?:97[89][ -]?)?(?:\d[ -]?){9}[\dx]\b|(?:PMID|RFC) +\d+/i,/\[\[.+?\]\]|\[.+?\]/],variable:[/__[A-Z]+__/,/\{{3}.+?\}{3}/,/\{\{.+?\}\}/],symbol:[/^#redirect/im,/~{3,5}/],"table-tag":{pattern:/((?:^|[|!])[|!])[^|\r\n]+\|(?!\|)/m,lookbehind:!0,inside:{"table-bar":{pattern:/\|$/,alias:"punctuation"},rest:e.languages.markup.tag.inside}},punctuation:/^(?:\{\||\|\}|\|-|[*#:;!|])|\|\||!!/m}),e.languages.insertBefore("wiki","tag",{nowiki:{pattern:/<(nowiki|pre|source)\b[^>]*>[\s\S]*?<\/\1>/i,inside:{tag:{pattern:/<(?:nowiki|pre|source)\b[^>]*>|<\/(?:nowiki|pre|source)>/i,inside:e.languages.markup.tag.inside}}}})}rj.displayName="wolfram";rj.aliases=["mathematica","nb","wl"];function rj(e){e.languages.wolfram={comment:/\(\*(?:\(\*(?:[^*]|\*(?!\)))*\*\)|(?!\(\*)[\s\S])*?\*\)/,string:{pattern:/"(?:\\.|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:Abs|AbsArg|Accuracy|Block|Do|For|Function|If|Manipulate|Module|Nest|NestList|None|Return|Switch|Table|Which|While)\b/,context:{pattern:/\b\w+`+\w*/,alias:"class-name"},blank:{pattern:/\b\w+_\b/,alias:"regex"},"global-variable":{pattern:/\$\w+/,alias:"variable"},boolean:/\b(?:False|True)\b/,number:/(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?j?\b/i,operator:/\/\.|;|=\.|\^=|\^:=|:=|<<|>>|<\||\|>|:>|\|->|->|<-|@@@|@@|@|\/@|=!=|===|==|=|\+|-|\[\/-+%=\]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.mathematica=e.languages.wolfram,e.languages.wl=e.languages.wolfram,e.languages.nb=e.languages.wolfram}ij.displayName="wren";ij.aliases=[];function ij(e){e.languages.wren={comment:[{pattern:/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*))*\*\/)*\*\/)*\*\//,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],"triple-quoted-string":{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string"},"string-literal":null,hashbang:{pattern:/^#!\/.+/,greedy:!0,alias:"comment"},attribute:{pattern:/#!?[ \t\u3000]*\w+/,alias:"keyword"},"class-name":[{pattern:/(\bclass\s+)\w+/,lookbehind:!0},/\b[A-Z][a-z\d_]*\b/],constant:/\b[A-Z][A-Z\d_]*\b/,null:{pattern:/\bnull\b/,alias:"keyword"},keyword:/\b(?:as|break|class|construct|continue|else|for|foreign|if|import|in|is|return|static|super|this|var|while)\b/,boolean:/\b(?:false|true)\b/,number:/\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i,function:/\b[a-z_]\w*(?=\s*[({])/i,operator:/<<|>>|[=!<>]=?|&&|\|\||[-+*/%~^&|?:]|\.{2,3}/,punctuation:/[\[\](){}.,;]/},e.languages.wren["string-literal"]={pattern:/(^|[^\\"])"(?:[^\\"%]|\\[\s\S]|%(?!\()|%\((?:[^()]|\((?:[^()]|\([^)]*\))*\))*\))*"/,lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)%\((?:[^()]|\((?:[^()]|\([^)]*\))*\))*\)/,lookbehind:!0,inside:{expression:{pattern:/^(%\()[\s\S]+(?=\)$)/,lookbehind:!0,inside:e.languages.wren},"interpolation-punctuation":{pattern:/^%\(|\)$/,alias:"punctuation"}}},string:/[\s\S]+/}}}aj.displayName="xeora";aj.aliases=["xeoracube"];function aj(e){e.register(Hi),(function(t){t.languages.xeora=t.languages.extend("markup",{constant:{pattern:/\$(?:DomainContents|PageRenderDuration)\$/,inside:{punctuation:{pattern:/\$/}}},variable:{pattern:/\$@?(?:#+|[-+*~=^])?[\w.]+\$/,inside:{punctuation:{pattern:/[$.]/},operator:{pattern:/#+|[-+*~=^@]/}}},"function-inline":{pattern:/\$F:[-\w.]+\?[-\w.]+(?:,(?:(?:@[-#]*\w+\.[\w+.]\.*)*\|)*(?:(?:[\w+]|[-#*.~^]+[\w+]|=\S)(?:[^$=]|=+[^=])*=*|(?:@[-#]*\w+\.[\w+.]\.*)+(?:(?:[\w+]|[-#*~^][-#*.~^]*[\w+]|=\S)(?:[^$=]|=+[^=])*=*)?)?)?\$/,inside:{variable:{pattern:/(?:[,|])@?(?:#+|[-+*~=^])?[\w.]+/,inside:{punctuation:{pattern:/[,.|]/},operator:{pattern:/#+|[-+*~=^@]/}}},punctuation:{pattern:/\$\w:|[$:?.,|]/}},alias:"function"},"function-block":{pattern:/\$XF:\{[-\w.]+\?[-\w.]+(?:,(?:(?:@[-#]*\w+\.[\w+.]\.*)*\|)*(?:(?:[\w+]|[-#*.~^]+[\w+]|=\S)(?:[^$=]|=+[^=])*=*|(?:@[-#]*\w+\.[\w+.]\.*)+(?:(?:[\w+]|[-#*~^][-#*.~^]*[\w+]|=\S)(?:[^$=]|=+[^=])*=*)?)?)?\}:XF\$/,inside:{punctuation:{pattern:/[$:{}?.,|]/}},alias:"function"},"directive-inline":{pattern:/\$\w(?:#\d+\+?)?(?:\[[-\w.]+\])?:[-\/\w.]+\$/,inside:{punctuation:{pattern:/\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/,inside:{tag:{pattern:/#\d/}}}},alias:"function"},"directive-block-open":{pattern:/\$\w+:\{|\$\w(?:#\d+\+?)?(?:\[[-\w.]+\])?:[-\w.]+:\{(?:![A-Z]+)?/,inside:{punctuation:{pattern:/\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/,inside:{tag:{pattern:/#\d/}}},attribute:{pattern:/![A-Z]+$/,inside:{punctuation:{pattern:/!/}},alias:"keyword"}},alias:"function"},"directive-block-separator":{pattern:/\}:[-\w.]+:\{/,inside:{punctuation:{pattern:/[:{}]/}},alias:"function"},"directive-block-close":{pattern:/\}:[-\w.]+\$/,inside:{punctuation:{pattern:/[:{}$]/}},alias:"function"}}),t.languages.insertBefore("inside","punctuation",{variable:t.languages.xeora["function-inline"].inside.variable},t.languages.xeora["function-block"]),t.languages.xeoracube=t.languages.xeora})(e)}sj.displayName="xml-doc";sj.aliases=[];function sj(e){e.register(Hi),(function(t){function n(s,o){t.languages[s]&&t.languages.insertBefore(s,"comment",{"doc-comment":o})}var r=t.languages.markup.tag,i={pattern:/\/\/\/.*/,greedy:!0,alias:"comment",inside:{tag:r}},a={pattern:/'''.*/,greedy:!0,alias:"comment",inside:{tag:r}};n("csharp",i),n("fsharp",i),n("vbnet",a)})(e)}oj.displayName="xojo";oj.aliases=[];function oj(e){e.languages.xojo={comment:{pattern:/(?:'|\/\/|Rem\b).+/i,greedy:!0},string:{pattern:/"(?:""|[^"])*"/,greedy:!0},number:[/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,/&[bchou][a-z\d]+/i],directive:{pattern:/#(?:Else|ElseIf|Endif|If|Pragma)\b/i,alias:"property"},keyword:/\b(?:AddHandler|App|Array|As(?:signs)?|Auto|Boolean|Break|By(?:Ref|Val)|Byte|Call|Case|Catch|CFStringRef|CGFloat|Class|Color|Const|Continue|CString|Currency|CurrentMethodName|Declare|Delegate|Dim|Do(?:uble|wnTo)?|Each|Else(?:If)?|End|Enumeration|Event|Exception|Exit|Extends|False|Finally|For|Function|Get|GetTypeInfo|Global|GOTO|If|Implements|In|Inherits|Int(?:8|16|32|64|eger|erface)?|Lib|Loop|Me|Module|Next|Nil|Object|Optional|OSType|ParamArray|Private|Property|Protected|PString|Ptr|Raise(?:Event)?|ReDim|RemoveHandler|Return|Select(?:or)?|Self|Set|Shared|Short|Single|Soft|Static|Step|String|Sub|Super|Text|Then|To|True|Try|Ubound|UInt(?:8|16|32|64|eger)?|Until|Using|Var(?:iant)?|Wend|While|WindowPtr|WString)\b/i,operator:/<[=>]?|>=?|[+\-*\/\\^=]|\b(?:AddressOf|And|Ctype|IsA?|Mod|New|Not|Or|WeakAddressOf|Xor)\b/i,punctuation:/[.,;:()]/}}lj.displayName="xquery";lj.aliases=[];function lj(e){e.register(Hi),(function(t){t.languages.xquery=t.languages.extend("markup",{"xquery-comment":{pattern:/\(:[\s\S]*?:\)/,greedy:!0,alias:"comment"},string:{pattern:/(["'])(?:\1\1|(?!\1)[\s\S])*\1/,greedy:!0},extension:{pattern:/\(#.+?#\)/,alias:"symbol"},variable:/\$[-\w:]+/,axis:{pattern:/(^|[^-])(?:ancestor(?:-or-self)?|attribute|child|descendant(?:-or-self)?|following(?:-sibling)?|parent|preceding(?:-sibling)?|self)(?=::)/,lookbehind:!0,alias:"operator"},"keyword-operator":{pattern:/(^|[^:-])\b(?:and|castable as|div|eq|except|ge|gt|idiv|instance of|intersect|is|le|lt|mod|ne|or|union)\b(?=$|[^:-])/,lookbehind:!0,alias:"operator"},keyword:{pattern:/(^|[^:-])\b(?:as|ascending|at|base-uri|boundary-space|case|cast as|collation|construction|copy-namespaces|declare|default|descending|else|empty (?:greatest|least)|encoding|every|external|for|function|if|import|in|inherit|lax|let|map|module|namespace|no-inherit|no-preserve|option|order(?: by|ed|ing)?|preserve|return|satisfies|schema|some|stable|strict|strip|then|to|treat as|typeswitch|unordered|validate|variable|version|where|xquery)\b(?=$|[^:-])/,lookbehind:!0},function:/[\w-]+(?::[\w-]+)*(?=\s*\()/,"xquery-element":{pattern:/(element\s+)[\w-]+(?::[\w-]+)*/,lookbehind:!0,alias:"tag"},"xquery-attribute":{pattern:/(attribute\s+)[\w-]+(?::[\w-]+)*/,lookbehind:!0,alias:"attr-name"},builtin:{pattern:/(^|[^:-])\b(?:attribute|comment|document|element|processing-instruction|text|xs:(?:ENTITIES|ENTITY|ID|IDREFS?|NCName|NMTOKENS?|NOTATION|Name|QName|anyAtomicType|anyType|anyURI|base64Binary|boolean|byte|date|dateTime|dayTimeDuration|decimal|double|duration|float|gDay|gMonth|gMonthDay|gYear|gYearMonth|hexBinary|int|integer|language|long|negativeInteger|nonNegativeInteger|nonPositiveInteger|normalizedString|positiveInteger|short|string|time|token|unsigned(?:Byte|Int|Long|Short)|untyped(?:Atomic)?|yearMonthDuration))\b(?=$|[^:-])/,lookbehind:!0},number:/\b\d+(?:\.\d+)?(?:E[+-]?\d+)?/,operator:[/[+*=?|@]|\.\.?|:=|!=|<[=<]?|>[=>]?/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}],punctuation:/[[\](){},;:/]/}),t.languages.xquery.tag.pattern=/<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/,t.languages.xquery.tag.inside["attr-value"].pattern=/=(?:("|')(?:\\[\s\S]|\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}|(?!\1)[^\\])*\1|[^\s'">=]+)/,t.languages.xquery.tag.inside["attr-value"].inside.punctuation=/^="|"$/,t.languages.xquery.tag.inside["attr-value"].inside.expression={pattern:/\{(?!\{)(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}/,inside:t.languages.xquery,alias:"language-xquery"};var n=function(i){return typeof i=="string"?i:typeof i.content=="string"?i.content:i.content.map(n).join("")},r=function(i){for(var a=[],s=0;s<i.length;s++){var o=i[s],l=!1;if(typeof o!="string"&&(o.type==="tag"&&o.content[0]&&o.content[0].type==="tag"?o.content[0].content[0].content==="</"?a.length>0&&a[a.length-1].tagName===n(o.content[0].content[1])&&a.pop():o.content[o.content.length-1].content==="/>"||a.push({tagName:n(o.content[0].content[1]),openedBraces:0}):a.length>0&&o.type==="punctuation"&&o.content==="{"&&(!i[s+1]||i[s+1].type!=="punctuation"||i[s+1].content!=="{")&&(!i[s-1]||i[s-1].type!=="plain-text"||i[s-1].content!=="{")?a[a.length-1].openedBraces++:a.length>0&&a[a.length-1].openedBraces>0&&o.type==="punctuation"&&o.content==="}"?a[a.length-1].openedBraces--:o.type!=="comment"&&(l=!0)),(l||typeof o=="string")&&a.length>0&&a[a.length-1].openedBraces===0){var c=n(o);s<i.length-1&&(typeof i[s+1]=="string"||i[s+1].type==="plain-text")&&(c+=n(i[s+1]),i.splice(s+1,1)),s>0&&(typeof i[s-1]=="string"||i[s-1].type==="plain-text")&&(c=n(i[s-1])+c,i.splice(s-1,1),s--),/^\s+$/.test(c)?i[s]=c:i[s]=new t.Token("plain-text",c,null,c)}o.content&&typeof o.content!="string"&&r(o.content)}};t.hooks.add("after-tokenize",function(i){i.language==="xquery"&&r(i.tokens)})})(e)}cj.displayName="yang";cj.aliases=[];function cj(e){e.languages.yang={comment:/\/\*[\s\S]*?\*\/|\/\/.*/,string:{pattern:/"(?:[^\\"]|\\.)*"|'[^']*'/,greedy:!0},keyword:{pattern:/(^|[{};\r\n][ \t]*)[a-z_][\w.-]*/i,lookbehind:!0},namespace:{pattern:/(\s)[a-z_][\w.-]*(?=:)/i,lookbehind:!0},boolean:/\b(?:false|true)\b/,operator:/\+/,punctuation:/[{};:]/}}uj.displayName="zig";uj.aliases=[];function uj(e){(function(t){function n(c){return function(){return c}}var r=/\b(?:align|allowzero|and|anyframe|anytype|asm|async|await|break|cancel|catch|comptime|const|continue|defer|else|enum|errdefer|error|export|extern|fn|for|if|inline|linksection|nakedcc|noalias|nosuspend|null|or|orelse|packed|promise|pub|resume|return|stdcallcc|struct|suspend|switch|test|threadlocal|try|undefined|union|unreachable|usingnamespace|var|volatile|while)\b/,i="\\b(?!"+r.source+")(?!\\d)\\w+\\b",a=/align\s*\((?:[^()]|\([^()]*\))*\)/.source,s=/(?:\?|\bpromise->|(?:\[[^[\]]*\]|\*(?!\*)|\*\*)(?:\s*<ALIGN>|\s*const\b|\s*volatile\b|\s*allowzero\b)*)/.source.replace(/<ALIGN>/g,n(a)),o=/(?:\bpromise\b|(?:\berror\.)?<ID>(?:\.<ID>)*(?!\s+<ID>))/.source.replace(/<ID>/g,n(i)),l="(?!\\s)(?:!?\\s*(?:"+s+"\\s*)*"+o+")+";t.languages.zig={comment:[{pattern:/\/\/[/!].*/,alias:"doc-comment"},/\/{2}.*/],string:[{pattern:/(^|[^\\@])c?"(?:[^"\\\r\n]|\\.)*"/,lookbehind:!0,greedy:!0},{pattern:/([\r\n])([ \t]+c?\\{2}).*(?:(?:\r\n?|\n)\2.*)*/,lookbehind:!0,greedy:!0}],char:{pattern:/(^|[^\\])'(?:[^'\\\r\n]|[\uD800-\uDFFF]{2}|\\(?:.|x[a-fA-F\d]{2}|u\{[a-fA-F\d]{1,6}\}))'/,lookbehind:!0,greedy:!0},builtin:/\B@(?!\d)\w+(?=\s*\()/,label:{pattern:/(\b(?:break|continue)\s*:\s*)\w+\b|\b(?!\d)\w+\b(?=\s*:\s*(?:\{|while\b))/,lookbehind:!0},"class-name":[/\b(?!\d)\w+(?=\s*=\s*(?:(?:extern|packed)\s+)?(?:enum|struct|union)\s*[({])/,{pattern:RegExp(/(:\s*)<TYPE>(?=\s*(?:<ALIGN>\s*)?[=;,)])|<TYPE>(?=\s*(?:<ALIGN>\s*)?\{)/.source.replace(/<TYPE>/g,n(l)).replace(/<ALIGN>/g,n(a))),lookbehind:!0,inside:null},{pattern:RegExp(/(\)\s*)<TYPE>(?=\s*(?:<ALIGN>\s*)?;)/.source.replace(/<TYPE>/g,n(l)).replace(/<ALIGN>/g,n(a))),lookbehind:!0,inside:null}],"builtin-type":{pattern:/\b(?:anyerror|bool|c_u?(?:int|long|longlong|short)|c_longdouble|c_void|comptime_(?:float|int)|f(?:16|32|64|128)|[iu](?:8|16|32|64|128|size)|noreturn|type|void)\b/,alias:"keyword"},keyword:r,function:/\b(?!\d)\w+(?=\s*\()/,number:/\b(?:0b[01]+|0o[0-7]+|0x[a-fA-F\d]+(?:\.[a-fA-F\d]*)?(?:[pP][+-]?[a-fA-F\d]+)?|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)\b/,boolean:/\b(?:false|true)\b/,operator:/\.[*?]|\.{2,3}|[-=]>|\*\*|\+\+|\|\||(?:<<|>>|[-+*]%|[-+*/%^&|<>!=])=?|[?~]/,punctuation:/[.:,;(){}[\]]/},t.languages.zig["class-name"].forEach(function(c){c.inside===null&&(c.inside=t.languages.zig)})})(e)}X.register(Hi);X.register(Xu);X.register(Sn);X.register(v1);X.register(ea);X.register(kM);X.register(NM);X.register(AM);X.register(RM);X.register(IM);X.register(OM);X.register(DM);X.register(MM);X.register(Nm);X.register(LM);X.register(PM);X.register(BM);X.register(jM);X.register(Oo);X.register(Ih);X.register(m1);X.register(FM);X.register($M);X.register(B0);X.register(F0);X.register(w1);X.register(UM);X.register(zM);X.register(Oh);X.register(HM);X.register(WM);X.register(GM);X.register(qM);X.register(VM);X.register(YM);X.register(KM);X.register(XM);X.register(U0);X.register(ZM);X.register(QM);X.register(JM);X.register(eL);X.register(tL);X.register(nL);X.register(rL);X.register(iL);X.register(aL);X.register(sL);X.register(oL);X.register(lL);X.register(cL);X.register(uL);X.register(dL);X.register(hL);X.register(fL);X.register(pL);X.register(mL);X.register(gL);X.register(bL);X.register(yL);X.register(vL);X.register(_L);X.register(xL);X.register(Lh);X.register(SL);X.register(wL);X.register(EL);X.register(CL);X.register(TL);X.register(kL);X.register(NL);X.register(AL);X.register(RL);X.register(IL);X.register(g1);X.register(ta);X.register(OL);X.register(DL);X.register(ML);X.register(LL);X.register(PL);X.register(BL);X.register(jL);X.register(FL);X.register($L);X.register(UL);X.register(j0);X.register(zL);X.register(HL);X.register(WL);X.register(GL);X.register(qL);X.register(VL);X.register(YL);X.register(KL);X.register(XL);X.register(ZL);X.register(QL);X.register(JL);X.register(eP);X.register(tP);X.register(nP);X.register(rP);X.register(iP);X.register(aP);X.register(sP);X.register(oP);X.register(lP);X.register(cP);X.register(b1);X.register(uP);X.register(dP);X.register(hP);X.register(fP);X.register(x1);X.register(A1);X.register(pP);X.register(mP);X.register(gP);X.register(H0);X.register(bP);X.register(yP);X.register(vP);X.register(_P);X.register(xP);X.register(SP);X.register(km);X.register(wP);X.register(EP);X.register(CP);X.register(TP);X.register(kP);X.register(NP);X.register(AP);X.register(RP);X.register(y1);X.register(IP);X.register(OP);X.register(Dh);X.register(Mh);X.register(Rm);X.register(DP);X.register(MP);X.register(LP);X.register(PP);X.register(BP);X.register(jP);X.register(FP);X.register(Am);X.register($P);X.register(UP);X.register(zP);X.register(HP);X.register(WP);X.register(GP);X.register(qP);X.register(VP);X.register(YP);X.register(_1);X.register(KP);X.register(XP);X.register(ZP);X.register(QP);X.register(W0);X.register(JP);X.register(e3);X.register(t3);X.register(n3);X.register(r3);X.register(i3);X.register(a3);X.register(s3);X.register(S1);X.register(I1);X.register(o3);X.register(l3);X.register(c3);X.register(u3);X.register(d3);X.register(h3);X.register(f3);X.register(p3);X.register(m3);X.register(g3);X.register(b3);X.register(y3);X.register(v3);X.register(_3);X.register(x3);X.register(S3);X.register(w3);X.register(E3);X.register(C3);X.register(E1);X.register(T3);X.register(k3);X.register(N3);X.register(A3);X.register(R3);X.register(I3);X.register(O3);X.register(D3);X.register(M3);X.register(L3);X.register(P3);X.register(B3);X.register(C1);X.register(j3);X.register(F3);X.register($3);X.register(U3);X.register(z3);X.register(H3);X.register(W3);X.register(G3);X.register(q3);X.register(V3);X.register(Y3);X.register(K3);X.register(X3);X.register(Z3);X.register(Q3);X.register(J3);X.register(eB);X.register(tB);X.register($0);X.register(nB);X.register(rB);X.register(iB);X.register(aB);X.register(T1);X.register(sB);X.register(oB);X.register(O1);X.register(lB);X.register(cB);X.register(uB);X.register(dB);X.register(hB);X.register(fB);X.register(pB);X.register(mB);X.register(gB);X.register(k1);X.register(bB);X.register(N1);X.register(yB);X.register(vB);X.register(_B);X.register(xB);X.register(SB);X.register(wB);X.register(EB);X.register(CB);X.register(D1);X.register(TB);X.register(kB);X.register(NB);X.register(AB);X.register(RB);X.register(IB);X.register(OB);X.register(DB);X.register(R1);X.register(MB);X.register(G0);X.register(LB);X.register(z0);X.register(PB);X.register(BB);X.register(jB);X.register(FB);X.register($B);X.register(UB);X.register(zB);X.register(HB);X.register(WB);X.register(GB);X.register(qB);X.register(VB);X.register(YB);X.register(KB);X.register(XB);X.register(ZB);X.register(QB);X.register(JB);X.register(ej);X.register(tj);X.register(nj);X.register(rj);X.register(ij);X.register(aj);X.register(sj);X.register(oj);X.register(lj);X.register(cj);X.register(uj);var Mae=zYe(X,LOe);Mae.supportedLanguages=HYe;function WYe(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function GYe({workspaceId:e,filePath:t,tabId:n}){const{resolvedTheme:r}=SE(),{data:i,isLoading:a,error:s}=Ce.workspace.readFile.useQuery({workspaceId:e,path:t});if(a)return h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx(un,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(s)return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:[h.jsx(Xs,{className:"h-12 w-12 text-destructive mb-4"}),h.jsx("p",{className:"text-lg font-medium text-destructive",children:"Failed to load file"}),h.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:s.message})]});if(!i)return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:[h.jsx(qs,{className:"h-12 w-12 text-muted-foreground mb-4"}),h.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"No content"})]});const o=r==="dark"?vZ:_Z;return h.jsx(KYe,{filePath:t,tabId:n,data:i,syntaxTheme:o})}function qYe({filePath:e,isMarkdown:t,showPreview:n,onTogglePreview:r,fileSizeLabel:i,language:a}){return h.jsxs("div",{className:"flex items-center justify-between gap-2 px-4 py-2 border-b bg-muted/30",children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx(qs,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),h.jsx("span",{className:"text-sm font-mono text-foreground truncate",children:e})]}),h.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground flex-shrink-0",children:[t&&h.jsxs(We,{variant:"ghost",size:"sm",onClick:r,className:"h-7 gap-1.5",children:[n?h.jsx(qs,{className:"h-3.5 w-3.5"}):h.jsx(oO,{className:"h-3.5 w-3.5"}),n?"Code":"Preview"]}),h.jsx("span",{children:i}),h.jsx("span",{className:"uppercase",children:a})]})]})}function VYe({truncated:e,fileSizeLabel:t,isBinary:n}){return h.jsxs(h.Fragment,{children:[e&&h.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-warning/10 border-b border-warning/20",children:[h.jsx(hc,{className:"h-4 w-4 text-warning"}),h.jsxs("span",{className:"text-sm text-warning",children:["File truncated to 1MB. Actual size: ",t]})]}),n&&h.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-muted/50 border-b",children:[h.jsx(hc,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{className:"text-sm text-muted-foreground",children:"Binary file cannot be displayed"})]})]})}function YYe({data:e,isMarkdown:t,showPreview:n,syntaxTheme:r,onScroll:i,viewportRef:a}){return e.isBinary?h.jsx(wo,{className:"flex-1",onScroll:i,viewportRef:a,children:h.jsx("div",{className:"flex items-center justify-center h-full p-8",children:h.jsx("p",{className:"text-muted-foreground",children:e.content})})}):t&&n?h.jsx(wo,{className:"flex-1",onScroll:i,viewportRef:a,children:h.jsx("div",{className:"p-4",children:h.jsx(Rh,{content:e.content})})}):h.jsx(wo,{className:"flex-1",onScroll:i,viewportRef:a,children:h.jsx(Mae,{language:e.language,style:r,showLineNumbers:!0,wrapLines:!0,customStyle:{margin:0,padding:"1rem",background:"transparent",fontSize:"0.75rem",lineHeight:"1.5"},codeTagProps:{style:{background:"transparent"}},lineNumberStyle:{minWidth:"3em",paddingRight:"1em",color:"var(--muted-foreground)",background:"transparent"},lineProps:{style:{background:"transparent"}},children:e.content})})}function KYe({filePath:e,tabId:t,data:n,syntaxTheme:r}){const[i,a]=v.useState(!1),s=v.useRef(null),o=v.useRef(null),l=e.endsWith(".md")||e.endsWith(".markdown")||n.language==="markdown",{handleScroll:c}=By({tabId:t,mode:"code",viewportRef:s,enabled:!i,restoreDeps:[i,e,n.content.length,n.size,n.isBinary]}),{handleScroll:d}=By({tabId:t,mode:"markdown",viewportRef:o,enabled:i&&l,restoreDeps:[i,e,n.content.length,n.size,n.isBinary]}),f=WYe(n.size),m=()=>a(g=>!g);return h.jsxs("div",{className:"h-full flex flex-col",children:[h.jsx(qYe,{filePath:e,isMarkdown:l&&!n.isBinary,showPreview:i,onTogglePreview:m,fileSizeLabel:f,language:n.language}),h.jsx(VYe,{truncated:n.truncated,isBinary:n.isBinary,fileSizeLabel:f}),h.jsx(YYe,{data:n,isMarkdown:l,showPreview:i,syntaxTheme:r,onScroll:i?d:c,viewportRef:i?o:s})]})}function D9(e){switch(e){case"M":return"modified";case"A":return"added";case"D":return"deleted";case"?":return"untracked"}}function rS(e){switch(e){case"added":return"added";case"modified":return"modified";case"deleted":return"deleted"}}function XYe(e){switch(e){case"modified":return h.jsx(qs,{className:"h-4 w-4"});case"added":return h.jsx(t_e,{className:"h-4 w-4"});case"deleted":return h.jsx(Jve,{className:"h-4 w-4"});case"untracked":return h.jsx(Fq,{className:"h-4 w-4"})}}function ZYe(e){switch(e){case"modified":return"text-yellow-500";case"added":return"text-green-500";case"deleted":return"text-red-500";case"untracked":return"text-muted-foreground"}}function QYe(e){switch(e){case"modified":return"Modified";case"added":return"Added";case"deleted":return"Deleted";case"untracked":return"Untracked"}}const dp=v.memo(function({path:t,kind:n,onClick:r,statusCode:i}){const a=ZYe(n),s=t.split("/").pop()??t,o=t.includes("/")?t.slice(0,t.lastIndexOf("/")):"";return h.jsxs("button",{type:"button",onClick:r,className:ne("w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left","hover:bg-muted/50 rounded-md transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),title:`${QYe(n)}: ${t}`,children:[h.jsx("span",{className:a,children:XYe(n)}),h.jsxs("span",{className:"flex-1 truncate",children:[h.jsx("span",{className:"font-medium",children:s}),o&&h.jsx("span",{className:"text-muted-foreground ml-1 text-xs",children:o})]}),i&&h.jsx("span",{className:ne("text-xs font-mono uppercase",a),children:i})]})});function JYe({workspaceId:e,screenshotPath:t}){const{data:n,isLoading:r}=Ce.workspace.readScreenshot.useQuery({workspaceId:e,path:t},{staleTime:6e4});return r?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx(un,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):n?h.jsx("div",{className:"flex items-center justify-center h-full p-4 overflow-auto",children:h.jsx("img",{src:`data:${n.mimeType};base64,${n.data}`,alt:n.name,className:"max-w-full max-h-full object-contain rounded-md"})}):h.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Failed to load screenshot"})}function eKe({workspaceId:e,children:t,className:n}){const{tabs:r,activeTabId:i}=Do(),a=r.find(f=>f.id===i),s=!a||a.type==="chat",o=a?.type==="file"?a.path:void 0,l=a?.type==="diff"?a.path:void 0,c=a?.type==="screenshot"?a.path:void 0,d=a?.id;return h.jsxs("div",{className:ne("h-full",n),children:[h.jsx("div",{className:ne("h-full",!s&&"hidden"),children:t}),o&&d&&h.jsx(GYe,{workspaceId:e,filePath:o,tabId:d}),l&&d&&h.jsx(dYe,{workspaceId:e,filePath:l,tabId:d}),c&&d&&h.jsx(JYe,{workspaceId:e,screenshotPath:c,tabId:d})]})}function Qo({icon:e,label:t,isActive:n,onSelect:r,onClose:i,truncate:a=!1,maxLabelWidth:s=120,className:o,iconSide:l="left"}){const c=v.useCallback(m=>{m.stopPropagation(),i?.()},[i]),d=v.useCallback(m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),r())},[r]),f=l==="right";return i||a?h.jsxs("div",{role:"tab",tabIndex:0,onClick:r,onKeyDown:d,"aria-selected":n,className:ne("group relative flex items-center gap-1.5 px-2 py-1 text-sm font-medium cursor-pointer","rounded-md transition-all whitespace-nowrap","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","border",n?"bg-background text-foreground shadow-sm border-border":"text-muted-foreground hover:bg-muted/50 hover:text-foreground border-transparent",o),children:[!f&&e,h.jsx("span",{className:ne(a&&"truncate"),style:a?{maxWidth:s}:void 0,children:t}),f&&e,i&&h.jsx("button",{type:"button",onClick:c,className:ne("ml-1 rounded p-0.5 opacity-0 transition-opacity","hover:bg-muted-foreground/20 focus-visible:opacity-100","group-hover:opacity-100"),"aria-label":`Close ${t}`,children:h.jsx(Ao,{className:"h-3 w-3"})})]}):h.jsxs("button",{type:"button",onClick:r,className:ne("flex items-center gap-1 px-2 py-1 text-sm font-medium rounded-md transition-colors border",n?"bg-background text-foreground shadow-sm border-border":"text-muted-foreground hover:bg-muted/50 hover:text-foreground border-transparent",o),children:[!f&&e,t,f&&e]})}const MR=[{value:"CLAUDE",label:"Claude"},{value:"CODEX",label:"Codex"}];function Xc(e){return e==="CLAUDE"||e==="CODEX"||e==="WORKSPACE_DEFAULT"?e:"WORKSPACE_DEFAULT"}function Lae(e,t){return e==="CLAUDE"||e==="CODEX"?e:t==="CODEX"?"CODEX":"CLAUDE"}function Pae(e){return e==="CODEX"?"Codex":"Claude"}function M9(e,t){const n=Lae(e,t);return`${Pae(n)} (Workspace Default)`}const L9={IDLE:"Watching",CI_RUNNING:"CI in progress",CI_FAILED:"Fixing CI",REVIEW_PENDING:"Addressing reviews",READY:"Ready to merge",MERGED:"Merged"};function tKe(e){return e?e in L9?L9[e]:e:"Watching"}function nKe(e,t){return e?t?"processing":"idle":"off"}function ww({enabled:e,animated:t=!1,className:n,iconClassName:r}){const i=nKe(e,t);return h.jsx("span",{"aria-hidden":"true","data-ratchet-state":i,className:ne("ratchet-toggle inline-flex items-center justify-center rounded-md",n),children:h.jsx(cxe,{className:ne("h-3.5 w-3.5",e?"text-foreground":"text-muted-foreground",r)})})}const Bae={color:"text-emerald-500",pulse:!1,spin:!1,label:"Idle",description:"Ready for input",icon:oc,isRunning:!1};function rKe(e){return e==="RUNNING"?{color:"text-brand",pulse:!0,spin:!1,label:"Running",description:"Processing your request",icon:iO,isRunning:!0}:e==="PAUSED"?{color:"text-muted-foreground",pulse:!1,spin:!1,label:"Paused",description:"Session paused",icon:Pq,isRunning:!1}:e==="COMPLETED"?{color:"text-blue-500",pulse:!1,spin:!1,label:"Completed",description:"Session finished",icon:fl,isRunning:!1}:e==="FAILED"?{color:"text-destructive",pulse:!1,spin:!1,label:"Failed",description:"Session failed",icon:uy,isRunning:!1}:Bae}function iKe(e,t){return e?e.runtimePhase==="loading"?{color:"text-muted-foreground",pulse:!1,spin:!0,label:"Loading",description:"Loading session...",icon:un,isRunning:!1}:e.runtimePhase==="starting"?{color:"text-muted-foreground",pulse:!1,spin:!0,label:"Starting",description:"Launching Claude...",icon:un,isRunning:!1}:e.runtimePhase==="stopping"?{color:"text-brand",pulse:!1,spin:!0,label:"Stopping",description:"Finishing current request...",icon:un,isRunning:!1}:e.runtimePhase==="error"?{color:"text-destructive",pulse:!1,spin:!1,label:"Error",description:"Session entered an error state",icon:uy,isRunning:!1}:e.processState==="stopped"?e.lastExit?.unexpected?{color:"text-destructive",pulse:!1,spin:!1,label:"Error",description:`Exited unexpectedly${e.lastExit.code!==null?` (code ${e.lastExit.code})`:""}`,icon:uy,isRunning:!1}:{color:"text-muted-foreground",pulse:!1,spin:!1,label:"Stopped",description:"Send a message to start",icon:Pq,isRunning:!1}:e.activity==="WORKING"||e.runtimePhase==="running"?{color:"text-brand",pulse:!0,spin:!1,label:"Running",description:"Processing your request",icon:iO,isRunning:!0}:Bae:rKe(t)}function aKe(e){switch(e){case"chat":case"file":return qs;case"diff":return Zve;case"screenshot":return cy}}function sKe({sessionSummary:e,isCIFix:t,persistedStatus:n}){const r=iKe(e,n),i=r.icon;return t?h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx("span",{className:"flex items-center justify-center",children:h.jsx(ww,{enabled:!0,animated:r.isRunning,className:"h-3.5 w-3.5 rounded-[4px] shrink-0",iconClassName:ne(r.isRunning&&"animate-pulse text-brand",!r.isRunning&&"text-warning")})})}),h.jsxs(er,{side:"bottom",className:"text-xs",children:[h.jsxs("div",{className:"font-medium",children:["CI Fix: ",r.label]}),h.jsx("div",{className:"text-muted-foreground",children:r.description})]})]}):h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx("span",{className:"flex items-center justify-center w-3.5 h-3.5",children:h.jsx(i,{className:ne("h-3.5 w-3.5 shrink-0",r.color,r.pulse&&"animate-pulse",r.spin&&"animate-spin")})})}),h.jsxs(er,{side:"bottom",className:"text-xs",children:[h.jsx("div",{className:"font-medium",children:r.label}),h.jsx("div",{className:"text-muted-foreground",children:r.description})]})]})}function oKe({tab:e,isActive:t,onSelect:n,onClose:r}){const i=aKe(e.type);return h.jsx(Qo,{icon:h.jsx(i,{className:"h-3.5 w-3.5 shrink-0"}),label:e.label,isActive:t,onSelect:n,onClose:r,truncate:!0})}function lKe({label:e,isActive:t,sessionSummary:n,isCIFix:r,persistedStatus:i,onSelect:a,onClose:s}){return h.jsx(Qo,{icon:h.jsx(sKe,{sessionSummary:n,isCIFix:r,persistedStatus:i}),label:e,isActive:t,onSelect:a,onClose:s,truncate:!0})}function cKe({className:e,sessions:t,currentSessionId:n,sessionSummariesById:r,onSelectSession:i,onCreateSession:a,onCloseSession:s,disabled:o,maxSessions:l,selectedProvider:c,setSelectedProvider:d}){const{tabs:f,activeTabId:m,selectTab:g,closeTab:y}=Do(),_=f.filter(A=>A.type!=="chat"),S=t?.length??0,w=l!==void 0&&S>=l,E=o||w,T=Pae(c);return h.jsxs("div",{role:"tablist",className:ne("flex items-center gap-0.5 bg-muted/50 p-1 overflow-x-auto",e),style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:[t?.map((A,O)=>{const I=A.id===n,N=A.name??`Chat ${O+1}`;return h.jsx(lKe,{label:N,isActive:I&&m==="chat",sessionSummary:r?.get(A.id),isCIFix:A.workflow==="ci-fix",persistedStatus:A.status,onSelect:()=>{i?.(A.id),g("chat")},onClose:t.length>1?()=>s?.(A.id):void 0},A.id)}),a&&h.jsxs(mc,{value:c,onValueChange:A=>{d(A==="CODEX"?"CODEX":"CLAUDE")},disabled:E,children:[h.jsx(yl,{"aria-label":"New session provider",className:"h-6 w-[96px] text-xs shrink-0",children:h.jsx("span",{className:"truncate",children:T})}),h.jsx(vl,{children:MR.map(A=>h.jsx(sr,{value:A.value,children:A.label},A.value))})]}),a&&h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx("button",{type:"button",onClick:a,disabled:E,className:ne("flex items-center justify-center h-6 w-6 rounded-md","text-muted-foreground hover:bg-sidebar-accent hover:text-foreground","transition-colors disabled:opacity-50 disabled:pointer-events-none"),"aria-label":"New chat session",children:h.jsx(Yd,{className:"h-3.5 w-3.5"})})}),h.jsx(er,{children:w?`Maximum ${l} sessions per workspace`:"New chat session"})]}),_.length>0&&h.jsx("div",{className:"h-4 w-px bg-border mx-1"}),_.map(A=>h.jsx(oKe,{tab:A,isActive:A.id===m,onSelect:()=>g(A.id),onClose:()=>y(A.id)},A.id))]})}var YN="rovingFocusGroup.onEntryFocus",uKe={bubbles:!1,cancelable:!0},q0="RovingFocusGroup",[LR,jae,dKe]=XO(q0),[hKe,Zu]=Ai(q0,[dKe]),[fKe,pKe]=hKe(q0),Fae=v.forwardRef((e,t)=>h.jsx(LR.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(LR.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(mKe,{...e,ref:t})})}));Fae.displayName=q0;var mKe=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:s,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...f}=e,m=v.useRef(null),g=Ut(t,m),y=wh(a),[_,S]=Na({prop:s,defaultProp:o??null,onChange:l,caller:q0}),[w,E]=v.useState(!1),T=Fi(c),A=jae(n),O=v.useRef(!1),[I,N]=v.useState(0);return v.useEffect(()=>{const D=m.current;if(D)return D.addEventListener(YN,T),()=>D.removeEventListener(YN,T)},[T]),h.jsx(fKe,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:_,onItemFocus:v.useCallback(D=>S(D),[S]),onItemShiftTab:v.useCallback(()=>E(!0),[]),onFocusableItemAdd:v.useCallback(()=>N(D=>D+1),[]),onFocusableItemRemove:v.useCallback(()=>N(D=>D-1),[]),children:h.jsx(yt.div,{tabIndex:w||I===0?-1:0,"data-orientation":r,...f,ref:g,style:{outline:"none",...e.style},onMouseDown:Ye(e.onMouseDown,()=>{O.current=!0}),onFocus:Ye(e.onFocus,D=>{const F=!O.current;if(D.target===D.currentTarget&&F&&!w){const P=new CustomEvent(YN,uKe);if(D.currentTarget.dispatchEvent(P),!P.defaultPrevented){const $=A().filter(M=>M.focusable),W=$.find(M=>M.active),V=$.find(M=>M.id===_),z=[W,V,...$].filter(Boolean).map(M=>M.ref.current);zae(z,d)}}O.current=!1}),onBlur:Ye(e.onBlur,()=>E(!1))})})}),$ae="RovingFocusGroupItem",Uae=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:s,...o}=e,l=Ti(),c=a||l,d=pKe($ae,n),f=d.currentTabStopId===c,m=jae(n),{onFocusableItemAdd:g,onFocusableItemRemove:y,currentTabStopId:_}=d;return v.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),h.jsx(LR.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:h.jsx(yt.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...o,ref:t,onMouseDown:Ye(e.onMouseDown,S=>{r?d.onItemFocus(c):S.preventDefault()}),onFocus:Ye(e.onFocus,()=>d.onItemFocus(c)),onKeyDown:Ye(e.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){d.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const w=yKe(S,d.orientation,d.dir);if(w!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let T=m().filter(A=>A.focusable).map(A=>A.ref.current);if(w==="last")T.reverse();else if(w==="prev"||w==="next"){w==="prev"&&T.reverse();const A=T.indexOf(S.currentTarget);T=d.loop?vKe(T,A+1):T.slice(A+1)}setTimeout(()=>zae(T))}}),children:typeof s=="function"?s({isCurrentTabStop:f,hasTabStop:_!=null}):s})})});Uae.displayName=$ae;var gKe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function bKe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function yKe(e,t,n){const r=bKe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return gKe[r]}function zae(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function vKe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var M1=Fae,L1=Uae,PR=["Enter"," "],_Ke=["ArrowDown","PageUp","Home"],Hae=["ArrowUp","PageDown","End"],xKe=[..._Ke,...Hae],SKe={ltr:[...PR,"ArrowRight"],rtl:[...PR,"ArrowLeft"]},wKe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},V0="Menu",[Fy,EKe,CKe]=XO(V0),[Ph,P1]=Ai(V0,[CKe,$u,Zu]),B1=$u(),Wae=Zu(),[TKe,Bh]=Ph(V0),[kKe,Y0]=Ph(V0),Gae=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:s=!0}=e,o=B1(t),[l,c]=v.useState(null),d=v.useRef(!1),f=Fi(a),m=wh(i);return v.useEffect(()=>{const g=()=>{d.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>d.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),h.jsx(bE,{...o,children:h.jsx(TKe,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:c,children:h.jsx(kKe,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:s,children:r})})})};Gae.displayName=V0;var NKe="MenuAnchor",dj=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=B1(n);return h.jsx(p0,{...i,...r,ref:t})});dj.displayName=NKe;var hj="MenuPortal",[AKe,qae]=Ph(hj,{forceMount:void 0}),Vae=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Bh(hj,t);return h.jsx(AKe,{scope:t,forceMount:n,children:h.jsx(bi,{present:n||a.open,children:h.jsx(cm,{asChild:!0,container:i,children:r})})})};Vae.displayName=hj;var Vs="MenuContent",[RKe,fj]=Ph(Vs),Yae=v.forwardRef((e,t)=>{const n=qae(Vs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Bh(Vs,e.__scopeMenu),s=Y0(Vs,e.__scopeMenu);return h.jsx(Fy.Provider,{scope:e.__scopeMenu,children:h.jsx(bi,{present:r||a.open,children:h.jsx(Fy.Slot,{scope:e.__scopeMenu,children:s.modal?h.jsx(IKe,{...i,ref:t}):h.jsx(OKe,{...i,ref:t})})})})}),IKe=v.forwardRef((e,t)=>{const n=Bh(Vs,e.__scopeMenu),r=v.useRef(null),i=Ut(t,r);return v.useEffect(()=>{const a=r.current;if(a)return rE(a)},[]),h.jsx(pj,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ye(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),OKe=v.forwardRef((e,t)=>{const n=Bh(Vs,e.__scopeMenu);return h.jsx(pj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),DKe=Jd("MenuContent.ScrollLock"),pj=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:g,disableOutsideScroll:y,..._}=e,S=Bh(Vs,n),w=Y0(Vs,n),E=B1(n),T=Wae(n),A=EKe(n),[O,I]=v.useState(null),N=v.useRef(null),D=Ut(t,N,S.onContentChange),F=v.useRef(0),P=v.useRef(""),$=v.useRef(0),W=v.useRef(null),V=v.useRef("right"),H=v.useRef(0),z=y?u0:v.Fragment,M=y?{as:DKe,allowPinchZoom:!0}:void 0,G=Q=>{const q=P.current+Q,Y=A().filter(le=>!le.disabled),K=document.activeElement,j=Y.find(le=>le.ref.current===K)?.textValue,ee=Y.map(le=>le.textValue),re=GKe(ee,q,j),de=Y.find(le=>le.textValue===re)?.ref.current;(function le(_e){P.current=_e,window.clearTimeout(F.current),_e!==""&&(F.current=window.setTimeout(()=>le(""),1e3))})(q),de&&setTimeout(()=>de.focus())};v.useEffect(()=>()=>window.clearTimeout(F.current),[]),tE();const B=v.useCallback(Q=>V.current===W.current?.side&&VKe(Q,W.current?.area),[]);return h.jsx(RKe,{scope:n,searchRef:P,onItemEnter:v.useCallback(Q=>{B(Q)&&Q.preventDefault()},[B]),onItemLeave:v.useCallback(Q=>{B(Q)||(N.current?.focus(),I(null))},[B]),onTriggerLeave:v.useCallback(Q=>{B(Q)&&Q.preventDefault()},[B]),pointerGraceTimerRef:$,onPointerGraceIntentChange:v.useCallback(Q=>{W.current=Q},[]),children:h.jsx(z,{...M,children:h.jsx(c0,{asChild:!0,trapped:i,onMountAutoFocus:Ye(a,Q=>{Q.preventDefault(),N.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:h.jsx(lm,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:g,children:h.jsx(M1,{asChild:!0,...T,dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:O,onCurrentTabStopIdChange:I,onEntryFocus:Ye(l,Q=>{w.isUsingKeyboardRef.current||Q.preventDefault()}),preventScrollOnEntryFocus:!0,children:h.jsx(yE,{role:"menu","aria-orientation":"vertical","data-state":use(S.open),"data-radix-menu-content":"",dir:w.dir,...E,..._,ref:D,style:{outline:"none",..._.style},onKeyDown:Ye(_.onKeyDown,Q=>{const Y=Q.target.closest("[data-radix-menu-content]")===Q.currentTarget,K=Q.ctrlKey||Q.altKey||Q.metaKey,j=Q.key.length===1;Y&&(Q.key==="Tab"&&Q.preventDefault(),!K&&j&&G(Q.key));const ee=N.current;if(Q.target!==ee||!xKe.includes(Q.key))return;Q.preventDefault();const de=A().filter(le=>!le.disabled).map(le=>le.ref.current);Hae.includes(Q.key)&&de.reverse(),HKe(de)}),onBlur:Ye(e.onBlur,Q=>{Q.currentTarget.contains(Q.target)||(window.clearTimeout(F.current),P.current="")}),onPointerMove:Ye(e.onPointerMove,$y(Q=>{const q=Q.target,Y=H.current!==Q.clientX;if(Q.currentTarget.contains(q)&&Y){const K=Q.clientX>H.current?"right":"left";V.current=K,H.current=Q.clientX}}))})})})})})})});Yae.displayName=Vs;var MKe="MenuGroup",mj=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(yt.div,{role:"group",...r,ref:t})});mj.displayName=MKe;var LKe="MenuLabel",Kae=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(yt.div,{...r,ref:t})});Kae.displayName=LKe;var Ew="MenuItem",P9="menu.itemSelect",j1=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,a=v.useRef(null),s=Y0(Ew,e.__scopeMenu),o=fj(Ew,e.__scopeMenu),l=Ut(t,a),c=v.useRef(!1),d=()=>{const f=a.current;if(!n&&f){const m=new CustomEvent(P9,{bubbles:!0,cancelable:!0});f.addEventListener(P9,g=>r?.(g),{once:!0}),mY(f,m),m.defaultPrevented?c.current=!1:s.onClose()}};return h.jsx(Xae,{...i,ref:l,disabled:n,onClick:Ye(e.onClick,d),onPointerDown:f=>{e.onPointerDown?.(f),c.current=!0},onPointerUp:Ye(e.onPointerUp,f=>{c.current||f.currentTarget?.click()}),onKeyDown:Ye(e.onKeyDown,f=>{const m=o.searchRef.current!=="";n||m&&f.key===" "||PR.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});j1.displayName=Ew;var Xae=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,s=fj(Ew,n),o=Wae(n),l=v.useRef(null),c=Ut(t,l),[d,f]=v.useState(!1),[m,g]=v.useState("");return v.useEffect(()=>{const y=l.current;y&&g((y.textContent??"").trim())},[a.children]),h.jsx(Fy.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:h.jsx(L1,{asChild:!0,...o,focusable:!r,children:h.jsx(yt.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:c,onPointerMove:Ye(e.onPointerMove,$y(y=>{r?s.onItemLeave(y):(s.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ye(e.onPointerLeave,$y(y=>s.onItemLeave(y))),onFocus:Ye(e.onFocus,()=>f(!0)),onBlur:Ye(e.onBlur,()=>f(!1))})})})}),PKe="MenuCheckboxItem",Zae=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return h.jsx(nse,{scope:e.__scopeMenu,checked:n,children:h.jsx(j1,{role:"menuitemcheckbox","aria-checked":Cw(n)?"mixed":n,...i,ref:t,"data-state":bj(n),onSelect:Ye(i.onSelect,()=>r?.(Cw(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Zae.displayName=PKe;var Qae="MenuRadioGroup",[BKe,jKe]=Ph(Qae,{value:void 0,onValueChange:()=>{}}),Jae=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,a=Fi(r);return h.jsx(BKe,{scope:e.__scopeMenu,value:n,onValueChange:a,children:h.jsx(mj,{...i,ref:t})})});Jae.displayName=Qae;var ese="MenuRadioItem",tse=v.forwardRef((e,t)=>{const{value:n,...r}=e,i=jKe(ese,e.__scopeMenu),a=n===i.value;return h.jsx(nse,{scope:e.__scopeMenu,checked:a,children:h.jsx(j1,{role:"menuitemradio","aria-checked":a,...r,ref:t,"data-state":bj(a),onSelect:Ye(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});tse.displayName=ese;var gj="MenuItemIndicator",[nse,FKe]=Ph(gj,{checked:!1}),rse=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,a=FKe(gj,n);return h.jsx(bi,{present:r||Cw(a.checked)||a.checked===!0,children:h.jsx(yt.span,{...i,ref:t,"data-state":bj(a.checked)})})});rse.displayName=gj;var $Ke="MenuSeparator",ise=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(yt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});ise.displayName=$Ke;var UKe="MenuArrow",ase=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=B1(n);return h.jsx(vE,{...i,...r,ref:t})});ase.displayName=UKe;var zKe="MenuSub",[rbt,sse]=Ph(zKe),_b="MenuSubTrigger",ose=v.forwardRef((e,t)=>{const n=Bh(_b,e.__scopeMenu),r=Y0(_b,e.__scopeMenu),i=sse(_b,e.__scopeMenu),a=fj(_b,e.__scopeMenu),s=v.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:l}=a,c={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=o.current;return()=>{window.clearTimeout(f),l(null)}},[o,l]),h.jsx(dj,{asChild:!0,...c,children:h.jsx(Xae,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":use(n.open),...e,ref:ml(t,i.onTriggerChange),onClick:f=>{e.onClick?.(f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ye(e.onPointerMove,$y(f=>{a.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(a.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Ye(e.onPointerLeave,$y(f=>{d();const m=n.content?.getBoundingClientRect();if(m){const g=n.content?.dataset.side,y=g==="right",_=y?-5:5,S=m[y?"left":"right"],w=m[y?"right":"left"];a.onPointerGraceIntentChange({area:[{x:f.clientX+_,y:f.clientY},{x:S,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:S,y:m.bottom}],side:g}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(f),f.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:Ye(e.onKeyDown,f=>{const m=a.searchRef.current!=="";e.disabled||m&&f.key===" "||SKe[r.dir].includes(f.key)&&(n.onOpenChange(!0),n.content?.focus(),f.preventDefault())})})})});ose.displayName=_b;var lse="MenuSubContent",cse=v.forwardRef((e,t)=>{const n=qae(Vs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Bh(Vs,e.__scopeMenu),s=Y0(Vs,e.__scopeMenu),o=sse(lse,e.__scopeMenu),l=v.useRef(null),c=Ut(t,l);return h.jsx(Fy.Provider,{scope:e.__scopeMenu,children:h.jsx(bi,{present:r||a.open,children:h.jsx(Fy.Slot,{scope:e.__scopeMenu,children:h.jsx(pj,{id:o.contentId,"aria-labelledby":o.triggerId,...i,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{s.isUsingKeyboardRef.current&&l.current?.focus(),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Ye(e.onFocusOutside,d=>{d.target!==o.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Ye(e.onEscapeKeyDown,d=>{s.onClose(),d.preventDefault()}),onKeyDown:Ye(e.onKeyDown,d=>{const f=d.currentTarget.contains(d.target),m=wKe[s.dir].includes(d.key);f&&m&&(a.onOpenChange(!1),o.trigger?.focus(),d.preventDefault())})})})})})});cse.displayName=lse;function use(e){return e?"open":"closed"}function Cw(e){return e==="indeterminate"}function bj(e){return Cw(e)?"indeterminate":e?"checked":"unchecked"}function HKe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function WKe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function GKe(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let s=WKe(e,Math.max(a,0));i.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function qKe(e,t){const{x:n,y:r}=e;let i=!1;for(let a=0,s=t.length-1;a<t.length;s=a++){const o=t[a],l=t[s],c=o.x,d=o.y,f=l.x,m=l.y;d>r!=m>r&&n<(f-c)*(r-d)/(m-d)+c&&(i=!i)}return i}function VKe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return qKe(n,t)}function $y(e){return t=>t.pointerType==="mouse"?e(t):void 0}var dse=Gae,hse=dj,fse=Vae,pse=Yae,mse=mj,gse=Kae,bse=j1,yse=Zae,vse=Jae,_se=tse,xse=rse,Sse=ise,wse=ase,Ese=ose,Cse=cse,F1="DropdownMenu",[YKe]=Ai(F1,[P1]),Ia=P1(),[KKe,Tse]=YKe(F1),kse=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:s,modal:o=!0}=e,l=Ia(t),c=v.useRef(null),[d,f]=Na({prop:i,defaultProp:a??!1,onChange:s,caller:F1});return h.jsx(KKe,{scope:t,triggerId:Ti(),triggerRef:c,contentId:Ti(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(m=>!m),[f]),modal:o,children:h.jsx(dse,{...l,open:d,onOpenChange:f,dir:r,modal:o,children:n})})};kse.displayName=F1;var Nse="DropdownMenuTrigger",Ase=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Tse(Nse,n),s=Ia(n);return h.jsx(hse,{asChild:!0,...s,children:h.jsx(yt.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:ml(t,a.triggerRef),onPointerDown:Ye(e.onPointerDown,o=>{!r&&o.button===0&&o.ctrlKey===!1&&(a.onOpenToggle(),a.open||o.preventDefault())}),onKeyDown:Ye(e.onKeyDown,o=>{r||(["Enter"," "].includes(o.key)&&a.onOpenToggle(),o.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});Ase.displayName=Nse;var XKe="DropdownMenuPortal",Rse=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ia(t);return h.jsx(fse,{...r,...n})};Rse.displayName=XKe;var Ise="DropdownMenuContent",Ose=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Tse(Ise,n),a=Ia(n),s=v.useRef(!1);return h.jsx(pse,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:Ye(e.onCloseAutoFocus,o=>{s.current||i.triggerRef.current?.focus(),s.current=!1,o.preventDefault()}),onInteractOutside:Ye(e.onInteractOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;(!i.modal||d)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ose.displayName=Ise;var ZKe="DropdownMenuGroup",QKe=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ia(n);return h.jsx(mse,{...i,...r,ref:t})});QKe.displayName=ZKe;var JKe="DropdownMenuLabel",Dse=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ia(n);return h.jsx(gse,{...i,...r,ref:t})});Dse.displayName=JKe;var eXe="DropdownMenuItem",Mse=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ia(n);return h.jsx(bse,{...i,...r,ref:t})});Mse.displayName=eXe;var tXe="DropdownMenuCheckboxItem",Lse=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ia(n);return h.jsx(yse,{...i,...r,ref:t})});Lse.displayName=tXe;var nXe="DropdownMenuRadioGroup",Pse=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ia(n);return h.jsx(vse,{...i,...r,ref:t})});Pse.displayName=nXe;var rXe="DropdownMenuRadioItem",Bse=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ia(n);return h.jsx(_se,{...i,...r,ref:t})});Bse.displayName=rXe;var iXe="DropdownMenuItemIndicator",jse=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ia(n);return h.jsx(xse,{...i,...r,ref:t})});jse.displayName=iXe;var aXe="DropdownMenuSeparator",Fse=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ia(n);return h.jsx(Sse,{...i,...r,ref:t})});Fse.displayName=aXe;var sXe="DropdownMenuArrow",oXe=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ia(n);return h.jsx(wse,{...i,...r,ref:t})});oXe.displayName=sXe;var lXe="DropdownMenuSubTrigger",$se=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ia(n);return h.jsx(Ese,{...i,...r,ref:t})});$se.displayName=lXe;var cXe="DropdownMenuSubContent",Use=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Ia(n);return h.jsx(Cse,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Use.displayName=cXe;var uXe=kse,dXe=Ase,hXe=Rse,zse=Ose,Hse=Dse,Wse=Mse,Gse=Lse,fXe=Pse,qse=Bse,Vse=jse,Yse=Fse,Kse=$se,Xse=Use;const K0=uXe,X0=dXe,Zse=fXe,pXe=v.forwardRef(({className:e,inset:t,children:n,...r},i)=>h.jsxs(Kse,{ref:i,className:ne("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[n,h.jsx(xs,{className:"ml-auto"})]}));pXe.displayName=Kse.displayName;const mXe=v.forwardRef(({className:e,...t},n)=>h.jsx(Xse,{ref:n,className:ne("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t}));mXe.displayName=Xse.displayName;const Im=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(hXe,{children:h.jsx(zse,{ref:r,sideOffset:t,className:ne("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-sm","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));Im.displayName=zse.displayName;const hp=v.forwardRef(({className:e,inset:t,...n},r)=>h.jsx(Wse,{ref:r,className:ne("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));hp.displayName=Wse.displayName;const gXe=v.forwardRef(({className:e,children:t,checked:n,...r},i)=>h.jsxs(Gse,{ref:i,className:ne("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(Vse,{children:h.jsx(nm,{className:"h-4 w-4"})})}),t]}));gXe.displayName=Gse.displayName;const qb=v.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(qse,{ref:r,className:ne("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(Vse,{children:h.jsx(oc,{className:"h-2 w-2 fill-current"})})}),t]}));qb.displayName=qse.displayName;const yj=v.forwardRef(({className:e,inset:t,...n},r)=>h.jsx(Hse,{ref:r,className:ne("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));yj.displayName=Hse.displayName;const Qse=v.forwardRef(({className:e,...t},n)=>h.jsx(Yse,{ref:n,className:ne("-mx-1 my-1 h-px bg-muted",e),...t}));Qse.displayName=Yse.displayName;const bXe={zap:Kd,sparkles:Kq,eye:oO,play:pl,terminal:El,check:nm,camera:cy,"git-branch":l0};function yXe(e){return e&&bXe[e]||Kd}function vXe({onExecuteAgent:e,disabled:t=!1}){const{data:n,isLoading:r}=Ce.session.listQuickActions.useQuery(),i=n?.filter(s=>s.type==="agent")??[],a=i.length>0;return h.jsxs(K0,{children:[h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx(X0,{asChild:!0,children:h.jsxs(We,{variant:"ghost",size:"icon",className:"h-8 w-8",disabled:t||r||!a,children:[h.jsx(Kd,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Quick Actions"})]})})}),h.jsx(er,{children:"Quick Actions"})]}),h.jsxs(Im,{align:"end",className:"w-56",children:[h.jsx(yj,{children:"Quick Actions"}),i.map(s=>{const o=yXe(s.icon);return h.jsxs(hp,{onClick:()=>e(s),className:"cursor-pointer",children:[h.jsx(o,{className:"mr-2 h-4 w-4"}),h.jsxs("div",{className:"flex flex-col",children:[h.jsx("span",{children:s.name}),h.jsx("span",{className:"text-xs text-muted-foreground",children:s.description})]})]},s.id)})]})]})}function _Xe(e,t){return e?`Auto-fix is on (${tKe(t)}). Click to disable.`:"Auto-fix is off. Click to enable automatic fixes for CI failures and review comments."}function Z0({enabled:e,state:t,animated:n=!1,onToggle:r,disabled:i=!1,stopPropagation:a=!1,className:s}){return h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx(We,{type:"button",variant:"ghost",size:"icon",onPointerDown:o=>{a&&o.stopPropagation()},onClick:o=>{a&&(o.preventDefault(),o.stopPropagation()),r(!e)},disabled:i,"aria-label":e?"Disable auto-fix":"Enable auto-fix","aria-pressed":e,className:ne("h-7 w-7 p-0",s),children:h.jsx(ww,{enabled:e,animated:n,className:"h-full w-full"})})}),h.jsx(er,{side:"top",children:_Xe(e,t)})]})}function xXe({output:e,outputEndRef:t,className:n}){const r=v.useRef(null);return h.jsx("div",{className:ne("h-full bg-background",n),children:h.jsxs("div",{ref:r,className:"h-full overflow-y-auto overflow-x-auto font-mono text-xs p-4 bg-black text-white",children:[h.jsx("pre",{className:"whitespace-pre-wrap break-words",children:e||"Waiting for dev server output..."}),h.jsx("div",{ref:t})]})})}function If(e,t,n){let r=n.initialDeps??[],i,a=!0;function s(){var o,l,c;let d;n.key&&((o=n.debug)!=null&&o.call(n))&&(d=Date.now());const f=e();if(!(f.length!==r.length||f.some((y,_)=>r[_]!==y)))return i;r=f;let g;if(n.key&&((l=n.debug)!=null&&l.call(n))&&(g=Date.now()),i=t(...f),n.key&&((c=n.debug)!=null&&c.call(n))){const y=Math.round((Date.now()-d)*100)/100,_=Math.round((Date.now()-g)*100)/100,S=_/16,w=(E,T)=>{for(E=String(E);E.length<T;)E=" "+E;return E};console.info(`%c⏱ ${w(_,5)} /${w(y,5)} ms`,`
|
|
395
395
|
font-size: .6rem;
|
|
396
396
|
font-weight: bold;
|
|
397
|
-
color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i}return s.updateDeps=o=>{r=o},s}function B9(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const SXe=(e,t)=>Math.abs(e-t)<1.01,wXe=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},j9=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},EXe=e=>e,CXe=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let i=t;i<=n;i++)r.push(i);return r},TXe=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=s=>{const{width:o,height:l}=s;t({width:Math.round(o),height:Math.round(l)})};if(i(j9(n)),!r.ResizeObserver)return()=>{};const a=new r.ResizeObserver(s=>{const o=()=>{const l=s[0];if(l?.borderBoxSize){const c=l.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(j9(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},F9={passive:!0},$9=typeof window>"u"?!0:"onscrollend"in window,kXe=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const a=e.options.useScrollendEvent&&$9?()=>{}:wXe(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),s=d=>()=>{const{horizontal:f,isRtl:m}=e.options;i=f?n.scrollLeft*(m&&-1||1):n.scrollTop,a(),t(i,d)},o=s(!0),l=s(!1);n.addEventListener("scroll",o,F9);const c=e.options.useScrollendEvent&&$9;return c&&n.addEventListener("scrollend",l,F9),()=>{n.removeEventListener("scroll",o),c&&n.removeEventListener("scrollend",l)}},NXe=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},AXe=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;const s=e+t;(a=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||a.call(i,{[r.options.horizontal?"left":"top"]:s,behavior:n})};class RXe{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(a=>{const s=()=>{this._measureElement(a.target,a)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var a;return(a=r())==null?void 0:a.observe(i,{box:"border-box"})},unobserve:i=>{var a;return(a=r())==null?void 0:a.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:EXe,rangeExtractor:CXe,onChange:()=>{},measureElement:NXe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=If(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,a)=>{this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=a,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const i=new Map,a=new Map;for(let s=r-1;s>=0;s--){const o=n[s];if(i.has(o.lane))continue;const l=a.get(o.lane);if(l==null||o.end>l.end?a.set(o.lane,o):o.end<l.end&&i.set(o.lane,!0),i.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((s,o)=>s.end===o.end?s.index-o.index:s.end-o.end)[0]:void 0},this.getMeasurementOptions=If(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,i,a,s,o)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:i,getItemKey:a,enabled:s,lanes:o}),{key:!1}),this.getMeasurements=If(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:i,getItemKey:a,enabled:s,lanes:o},l)=>{if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const m of this.laneAssignments.keys())m>=n&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,c),f=new Array(o).fill(void 0);for(let m=0;m<c;m++){const g=d[m];g&&(f[g.lane]=m)}for(let m=c;m<n;m++){const g=a(m),y=this.laneAssignments.get(m);let _,S;if(y!==void 0&&this.options.lanes>1){_=y;const A=f[_],O=A!==void 0?d[A]:void 0;S=O?O.end+this.options.gap:r+i}else{const A=this.options.lanes===1?d[m-1]:this.getFurthestMeasurement(d,m);S=A?A.end+this.options.gap:r+i,_=A?A.lane:m%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(m,_)}const w=l.get(g),E=typeof w=="number"?w:this.options.estimateSize(m),T=S+E;d[m]={index:m,start:S,size:E,end:T,key:g,lane:_},f[_]=m}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=If(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,i,a)=>this.range=n.length>0&&r>0?IXe({measurements:n,outerSize:r,scrollOffset:i,lanes:a}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=If(()=>{let n=null,r=null;const i=this.calculateRange();return i&&(n=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,i,a,s)=>a===null||s===null?[]:n({startIndex:a,endIndex:s,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const i=this.indexFromElement(n),a=this.measurementsCache[i];if(!a)return;const s=a.key,o=this.elementsCache.get(s);o!==n&&(o&&this.observer.unobserve(o),this.observer.observe(n),this.elementsCache.set(s,n)),n.isConnected&&this.resizeItem(i,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const i=this.measurementsCache[n];if(!i)return;const a=this.itemSizeCache.get(i.key)??i.size,s=r-a;s!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,s,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=s,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,i)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(i))});return}this._measureElement(n,void 0)},this.getVirtualItems=If(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let a=0,s=n.length;a<s;a++){const o=n[a],l=r[o];i.push(l)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return B9(r[Jse(0,r.length-1,i=>B9(r[i]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,r,i=0)=>{if(!this.scrollElement)return 0;const a=this.getSize(),s=this.getScrollOffset();r==="auto"&&(r=n>=s+a?"end":"start"),r==="center"?n+=(i-a)/2:r==="end"&&(n-=a);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.measurementsCache[n];if(!i)return;const a=this.getSize(),s=this.getScrollOffset();if(r==="auto")if(i.end>=s+a-this.options.scrollPaddingEnd)r="end";else if(i.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const o=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,i.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:i})},this.scrollToIndex=(n,{align:r="auto",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1)),this.currentScrollToIndex=n;let a=0;const s=10,o=c=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(n,c);if(!d){console.warn("Failed to get offset for index:",n);return}const[f,m]=d;this._scrollToOffset(f,{adjustments:void 0,behavior:i}),this.targetWindow.requestAnimationFrame(()=>{const g=()=>{if(this.currentScrollToIndex!==n)return;const y=this.getScrollOffset(),_=this.getOffsetForIndex(n,m);if(!_){console.warn("Failed to get offset for index:",n);return}SXe(_[0],y)||l(m)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(g):g()})},l=c=>{this.targetWindow&&this.currentScrollToIndex===n&&(a++,a<s?this.targetWindow.requestAnimationFrame(()=>o(c)):console.warn(`Failed to scroll to index ${n} after ${s} attempts.`))};o(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((n=r[r.length-1])==null?void 0:n.end)??0;else{const a=Array(this.options.lanes).fill(null);let s=r.length-1;for(;s>=0&&a.some(o=>o===null);){const o=r[s];a[o.lane]===null&&(a[o.lane]=o.end),s--}i=Math.max(...a.filter(o=>o!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}}const Jse=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function IXe({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const i=e.length-1,a=l=>e[l].start;if(e.length<=r)return{startIndex:0,endIndex:i};let s=Jse(0,i,a,n),o=s;if(r===1)for(;o<i&&e[o].end<n+t;)o++;else if(r>1){const l=Array(r).fill(0);for(;o<i&&l.some(d=>d<n+t);){const d=e[o];l[d.lane]=d.end,o++}const c=Array(r).fill(n+t);for(;s>=0&&c.some(d=>d>=n);){const d=e[s];c[d.lane]=d.start,s--}s=Math.max(0,s-s%r),o=Math.min(i,o+(r-1-o%r))}return{startIndex:s,endIndex:o}}const U9=typeof document<"u"?v.useLayoutEffect:v.useEffect;function OXe({useFlushSync:e=!0,...t}){const n=v.useReducer(()=>({}),{})[1],r={...t,onChange:(a,s)=>{var o;e&&s?Gs.flushSync(n):n(),(o=t.onChange)==null||o.call(t,a,s)}},[i]=v.useState(()=>new RXe(r));return i.setOptions(r),U9(()=>i._didMount(),[]),U9(()=>i._willUpdate()),i}function vj(e){return OXe({observeElementRect:TXe,observeElementOffset:kXe,scrollToFn:AXe,...e})}const DXe=v.memo(function({files:t,onFileClick:n}){const r=v.useRef(null),i=vj({count:t.length,getScrollElement:()=>r.current,estimateSize:()=>32,overscan:10});return h.jsx("div",{ref:r,className:"flex-1 overflow-auto",children:h.jsx("div",{style:{height:`${i.getTotalSize()}px`,position:"relative"},children:i.getVirtualItems().map(a=>{const s=t[a.index];return s?h.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${a.start}px)`},children:h.jsx(dp,{path:s.path,kind:rS(s.status),statusCode:s.status[0],onClick:()=>n(s)})},a.key):null})})})}),MXe=v.memo(function({added:t,modified:n,deleted:r,onFileClick:i}){return h.jsx(wo,{className:"h-full",children:h.jsxs("div",{className:"p-2 space-y-3",children:[t.length>0&&h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider px-3 mb-1",children:["Added (",t.length,")"]}),h.jsx("div",{className:"space-y-0.5",children:t.map(a=>h.jsx(dp,{path:a.path,kind:rS(a.status),statusCode:a.status[0],onClick:()=>i(a)},a.path))})]}),n.length>0&&h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider px-3 mb-1",children:["Modified (",n.length,")"]}),h.jsx("div",{className:"space-y-0.5",children:n.map(a=>h.jsx(dp,{path:a.path,kind:rS(a.status),statusCode:a.status[0],onClick:()=>i(a)},a.path))})]}),r.length>0&&h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider px-3 mb-1",children:["Deleted (",r.length,")"]}),h.jsx("div",{className:"space-y-0.5",children:r.map(a=>h.jsx(dp,{path:a.path,kind:rS(a.status),statusCode:a.status[0],onClick:()=>i(a)},a.path))})]})]})})});function LXe({workspaceId:e}){const{openTab:t}=Do(),{data:n,isLoading:r,error:i}=Ce.workspace.getDiffVsMain.useQuery({workspaceId:e},{refetchInterval:15e3,staleTime:1e4}),a=v.useCallback(m=>{t("diff",m.path,`Diff: ${m.path.split("/").pop()}`)},[t]);if(r)return h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx(un,{className:"h-6 w-6 animate-spin text-muted-foreground"})});if(i)return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-4",children:[h.jsx(Xs,{className:"h-8 w-8 text-destructive mb-2"}),h.jsx("p",{className:"text-sm text-destructive",children:"Failed to load diff vs main"}),h.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:i.message})]});const{added:s,modified:o,deleted:l,noMergeBase:c}=n??{added:[],modified:[],deleted:[],noMergeBase:!1},d=s.length>0||o.length>0||l.length>0,f=s.length+o.length+l.length;if(c)return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-4",children:[h.jsx(Xs,{className:"h-8 w-8 text-warning mb-2"}),h.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"No common history with main"}),h.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"This branch doesn't share history with the main branch"})]});if(!d)return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-4",children:[h.jsx(qs,{className:"h-8 w-8 text-muted-foreground mb-2"}),h.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Up to date with main"}),h.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"No changes compared to main branch"})]});if(f>200){const m=[...s,...o,...l];return h.jsxs("div",{className:"h-full flex flex-col",children:[h.jsxs("div",{className:"p-2 pb-1 border-b text-xs text-muted-foreground",children:[s.length>0&&h.jsxs("span",{className:"text-green-500",children:["+",s.length]}),s.length>0&&o.length>0&&h.jsx("span",{className:"mx-1",children:"·"}),o.length>0&&h.jsxs("span",{className:"text-yellow-500",children:["~",o.length]}),(s.length>0||o.length>0)&&l.length>0&&h.jsx("span",{className:"mx-1",children:"·"}),l.length>0&&h.jsxs("span",{className:"text-red-500",children:["-",l.length]})]}),h.jsx(DXe,{files:m,onFileClick:a})]})}return h.jsx(MXe,{added:s,modified:o,deleted:l,onFileClick:a})}function PXe({workspaceId:e,onTakeScreenshots:t}){const{openTab:n}=Do(),r=Ce.useUtils(),[i,a]=v.useState(!1),s=v.useRef(0),o=Ce.workspace.deleteScreenshot.useMutation({onSuccess:()=>{r.workspace.listScreenshots.invalidate({workspaceId:e})}}),{data:l,isLoading:c}=Ce.workspace.listScreenshots.useQuery({workspaceId:e},{refetchInterval:i?3e3:1e4,staleTime:i?1e3:5e3}),d=l?.screenshots??[];v.useEffect(()=>{i&&d.length>s.current&&a(!1),s.current=d.length},[d.length,i]);const f=v.useCallback(()=>{a(!0),t?.()},[t]);return c?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx(un,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):d.length===0?h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-4 gap-3",children:[h.jsx(cy,{className:"h-8 w-8 text-muted-foreground"}),h.jsx("div",{children:i?h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Taking Screenshots..."}),h.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"The agent is capturing the dev app"})]}):h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"No screenshots yet"}),h.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"Capture screenshots of the running dev app"})]})}),i?h.jsx(un,{className:"h-5 w-5 animate-spin text-muted-foreground"}):t&&h.jsxs(We,{variant:"outline",size:"sm",onClick:f,className:"gap-1.5",children:[h.jsx(cy,{className:"h-3.5 w-3.5"}),"Take Screenshots"]})]}):h.jsx(wo,{className:"h-full",children:h.jsx("div",{className:"p-2 grid grid-cols-2 gap-2",children:d.map(m=>h.jsx(BXe,{workspaceId:e,screenshot:m,onClick:()=>n("screenshot",m.path,m.name),onDelete:()=>o.mutate({workspaceId:e,path:m.path})},m.path))})})}function BXe({workspaceId:e,screenshot:t,onClick:n,onDelete:r}){const{data:i,isLoading:a}=Ce.workspace.readScreenshot.useQuery({workspaceId:e,path:t.path},{staleTime:6e4}),s=v.useCallback(o=>{o.stopPropagation(),r()},[r]);return h.jsxs("button",{type:"button",onClick:n,className:"group relative aspect-video rounded-md border bg-muted/30 overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:[a?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx(un,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):i?h.jsx("img",{src:`data:${i.mimeType};base64,${i.data}`,alt:t.name,className:"absolute inset-0 w-full h-full object-cover"}):null,h.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity",children:h.jsx("button",{type:"button",onClick:s,className:"h-5 w-5 flex items-center justify-center rounded-full bg-black/60 text-white hover:bg-red-600 transition-colors",children:h.jsx(Ao,{className:"h-3 w-3"})})}),h.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 px-1.5 py-0.5 text-[10px] text-white truncate",children:t.name})]})}function jXe({workspaceId:e,className:t}){const n=v.useRef(null),r=v.useRef(0),{data:i}=Ce.workspace.getInitStatus.useQuery({id:e},{refetchInterval:l=>{const c=l.state.data?.status;return c==="READY"||c==="FAILED"||c==="ARCHIVED"?!1:1e3}}),a=i?.initOutput??"",s=i?.status;a.length>r.current&&(r.current=a.length,requestAnimationFrame(()=>{n.current?.scrollTo({top:n.current.scrollHeight,behavior:"smooth"})}));const o=s==="PROVISIONING"?"Running...":s==="READY"?"Completed":s==="FAILED"?"Failed":"";return h.jsxs("div",{className:ne("h-full bg-background flex flex-col",t),children:[o&&h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 border-b text-xs text-muted-foreground",children:[s==="PROVISIONING"&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-yellow-500 animate-pulse"}),s==="READY"&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500"}),s==="FAILED"&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),h.jsxs("span",{children:["Startup script: ",o]})]}),h.jsx("div",{ref:n,className:"flex-1 overflow-y-auto overflow-x-auto font-mono text-xs p-4 bg-black text-white",children:h.jsx("pre",{className:"whitespace-pre-wrap break-words",children:a||"No setup logs yet."})})]})}function eoe({tabs:e,activeTabId:t,onSelectTab:n,onCloseTab:r,onNewTab:i,showNewButton:a=!0,renderNewButton:s,className:o}){return h.jsxs("div",{className:ne("flex items-center gap-1 min-w-0 overflow-hidden",o),children:[h.jsx("div",{className:"flex-1 flex items-center gap-1 overflow-x-auto scrollbar-hide flex-nowrap min-w-0",children:e.map(l=>h.jsxs("div",{className:ne("flex items-center rounded-md transition-colors group flex-shrink-0",t===l.id?"bg-zinc-800 text-zinc-100":"text-zinc-400 hover:bg-zinc-800/50 hover:text-zinc-200"),children:[h.jsxs("button",{type:"button",className:"flex items-center gap-1 px-2 py-1 text-xs cursor-pointer whitespace-nowrap",onClick:()=>n(l.id),children:[h.jsx(El,{className:"h-3 w-3 flex-shrink-0"}),h.jsx("span",{children:l.label})]}),h.jsx("button",{type:"button",onClick:()=>r(l.id),className:ne("mr-1 p-0.5 rounded hover:bg-zinc-600/50 transition-colors","opacity-0 group-hover:opacity-100",t===l.id&&"opacity-100"),children:h.jsx(Ao,{className:"h-3 w-3"})})]},l.id))}),a&&i&&(s?s(i):h.jsx("button",{type:"button",onClick:i,className:"h-6 w-6 flex-shrink-0 flex items-center justify-center rounded-md transition-colors text-muted-foreground hover:bg-sidebar-accent hover:text-foreground",title:"New terminal",children:h.jsx(Yd,{className:"h-3 w-3"})}))]})}const FXe=10,$Xe=1e3,UXe=3e4;function zXe(e){const t=Math.min($Xe*2**e,UXe),n=Math.random()*t*.25;return t+n}function $1(e,t){const n=typeof window<"u"?window.location.host:"localhost:3000",r=typeof window<"u"&&window.location.protocol==="https:"?"wss:":"ws:",i=new URLSearchParams;for(const[s,o]of Object.entries(t))o!==void 0&&i.set(s,o);const a=i.toString();return`${r}//${n}${e}?${a}`}const HXe=100,z9=10,WXe=new Set(["stop","interrupt"]);function U1(e){const{url:t,onMessage:n,onConnected:r,onDisconnected:i,queuePolicy:a="replay"}=e,[s,o]=v.useState(!1),l=v.useRef(null),c=v.useRef(0),d=v.useRef(null),f=v.useRef(!1),m=v.useRef([]),g=v.useRef(n),y=v.useRef(r),_=v.useRef(i);v.useEffect(()=>{g.current=n,y.current=r,_.current=i},[n,r,i]);const S=v.useCallback(()=>{if(!t||l.current?.readyState===WebSocket.OPEN)return;l.current&&(l.current.close(),l.current=null),d.current&&(clearTimeout(d.current),d.current=null),f.current=!1;const T=new WebSocket(t);l.current=T,T.onopen=()=>{if(o(!0),c.current=0,a!=="replay"){m.current=[],y.current?.();return}const A=m.current;m.current=[];const O=A.filter(D=>{const F=D.type;return!(F&&WXe.has(F))}),I=O.slice(0,z9),N=O.slice(z9);for(const D of I)T.send(JSON.stringify(D));N.length>0&&(m.current=N),y.current?.()},T.onmessage=A=>{try{if(typeof A.data!="string")return;const O=JSON.parse(A.data);g.current?.(O)}catch{}},T.onclose=()=>{if(l.current===T&&(o(!1),l.current=null,_.current?.(),!f.current&&c.current<FXe)){const A=zXe(c.current);c.current+=1,d.current=setTimeout(()=>{S()},A)}},T.onerror=()=>{}},[a,t]);v.useEffect(()=>(t?S():(f.current=!0,m.current=[],l.current&&(l.current.close(),l.current=null),o(!1)),()=>{f.current=!0,d.current&&(clearTimeout(d.current),d.current=null),l.current&&(l.current.close(),l.current=null)}),[t,S]);const w=v.useCallback(T=>l.current?.readyState===WebSocket.OPEN?(l.current.send(JSON.stringify(T)),!0):(a!=="replay"||m.current.length<HXe&&m.current.push(T),!1),[a]),E=v.useCallback(()=>{c.current=0,f.current=!1,m.current=[],l.current&&(l.current.close(),l.current=null),S()},[S]);return{connected:s,send:w,reconnect:E}}const GXe=nn({id:ke(),createdAt:ke(),outputBuffer:ke().optional()}),qXe=_O("type",[nn({type:Pr("output"),data:ke().optional(),terminalId:ke().optional()}),nn({type:Pr("created"),terminalId:ke().optional()}),nn({type:Pr("exit"),terminalId:ke().optional(),exitCode:hi().optional()}),nn({type:Pr("error"),message:ke().optional()}),nn({type:Pr("terminal_list"),terminals:Ya(GXe).optional()})]);function VXe(e,t){const{onOutput:n,onCreated:r,onExit:i,onError:a,onTerminalList:s}=t;switch(e.type){case"output":e.terminalId&&e.data&&n?.(e.terminalId,e.data);break;case"created":e.terminalId&&r?.(e.terminalId);break;case"exit":e.terminalId&&e.exitCode!==void 0&&i?.(e.terminalId,e.exitCode);break;case"error":e.message&&a?.(e.message);break;case"terminal_list":e.terminals&&s?.(e.terminals);break}}function YXe({workspaceId:e,onOutput:t,onCreated:n,onExit:r,onError:i,onTerminalList:a}){const s=$1("/terminal",{workspaceId:e}),o=v.useCallback(_=>{const S=qXe.safeParse(_);if(!S.success)return;const w=S.data;VXe(w,{onOutput:t,onCreated:n,onExit:r,onError:i,onTerminalList:a})},[t,n,r,i,a]),{connected:l,send:c}=U1({url:s,onMessage:o,queuePolicy:"drop"}),d=v.useCallback((_=80,S=24)=>{c({type:"create",cols:_,rows:S})},[c]),f=v.useCallback((_,S)=>{c({type:"input",terminalId:_,data:S})},[c]),m=v.useCallback((_,S,w)=>{c({type:"resize",terminalId:_,cols:S,rows:w})},[c]),g=v.useCallback(_=>{c({type:"destroy",terminalId:_})},[c]),y=v.useCallback(_=>{c({type:"set_active",terminalId:_})},[c]);return{connected:l,create:d,sendInput:f,resize:m,destroy:g,setActive:y}}const KXe=v.lazy(()=>Gn(()=>import("./terminal-instance-BI_R5Gu9.js"),[]).then(e=>({default:e.TerminalInstance}))),XXe=v.forwardRef(function({workspaceId:t,className:n,hideHeader:r=!1,onStateChange:i},a){const[s,o]=v.useState([]),[l,c]=v.useState(null),d=v.useRef(null),f=v.useRef(new Map),m=v.useRef(()=>{}),g=v.useCallback((z,M)=>{o(G=>{if(G.find(q=>q.terminalId===z))return G.map(q=>q.terminalId===z?{...q,output:q.output+M}:q);const Q=f.current.get(z)??"";return f.current.set(z,Q+M),G})},[]),y=v.useCallback(z=>{const M=d.current;if(M){const G=f.current.get(z)??"";f.current.delete(z),o(B=>B.map(Q=>Q.id===M?{...Q,terminalId:z,output:G}:Q)),d.current=null,m.current(z)}},[]),_=v.useCallback((z,M)=>{o(G=>G.map(B=>B.terminalId===z?{...B,output:`${B.output}\r
|
|
397
|
+
color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i}return s.updateDeps=o=>{r=o},s}function B9(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const SXe=(e,t)=>Math.abs(e-t)<1.01,wXe=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},j9=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},EXe=e=>e,CXe=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let i=t;i<=n;i++)r.push(i);return r},TXe=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=s=>{const{width:o,height:l}=s;t({width:Math.round(o),height:Math.round(l)})};if(i(j9(n)),!r.ResizeObserver)return()=>{};const a=new r.ResizeObserver(s=>{const o=()=>{const l=s[0];if(l?.borderBoxSize){const c=l.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(j9(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},F9={passive:!0},$9=typeof window>"u"?!0:"onscrollend"in window,kXe=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const a=e.options.useScrollendEvent&&$9?()=>{}:wXe(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),s=d=>()=>{const{horizontal:f,isRtl:m}=e.options;i=f?n.scrollLeft*(m&&-1||1):n.scrollTop,a(),t(i,d)},o=s(!0),l=s(!1);n.addEventListener("scroll",o,F9);const c=e.options.useScrollendEvent&&$9;return c&&n.addEventListener("scrollend",l,F9),()=>{n.removeEventListener("scroll",o),c&&n.removeEventListener("scrollend",l)}},NXe=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},AXe=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;const s=e+t;(a=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||a.call(i,{[r.options.horizontal?"left":"top"]:s,behavior:n})};class RXe{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(a=>{const s=()=>{this._measureElement(a.target,a)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var a;return(a=r())==null?void 0:a.observe(i,{box:"border-box"})},unobserve:i=>{var a;return(a=r())==null?void 0:a.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:EXe,rangeExtractor:CXe,onChange:()=>{},measureElement:NXe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=If(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,a)=>{this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=a,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const i=new Map,a=new Map;for(let s=r-1;s>=0;s--){const o=n[s];if(i.has(o.lane))continue;const l=a.get(o.lane);if(l==null||o.end>l.end?a.set(o.lane,o):o.end<l.end&&i.set(o.lane,!0),i.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((s,o)=>s.end===o.end?s.index-o.index:s.end-o.end)[0]:void 0},this.getMeasurementOptions=If(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,i,a,s,o)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:i,getItemKey:a,enabled:s,lanes:o}),{key:!1}),this.getMeasurements=If(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:i,getItemKey:a,enabled:s,lanes:o},l)=>{if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const m of this.laneAssignments.keys())m>=n&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,c),f=new Array(o).fill(void 0);for(let m=0;m<c;m++){const g=d[m];g&&(f[g.lane]=m)}for(let m=c;m<n;m++){const g=a(m),y=this.laneAssignments.get(m);let _,S;if(y!==void 0&&this.options.lanes>1){_=y;const A=f[_],O=A!==void 0?d[A]:void 0;S=O?O.end+this.options.gap:r+i}else{const A=this.options.lanes===1?d[m-1]:this.getFurthestMeasurement(d,m);S=A?A.end+this.options.gap:r+i,_=A?A.lane:m%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(m,_)}const w=l.get(g),E=typeof w=="number"?w:this.options.estimateSize(m),T=S+E;d[m]={index:m,start:S,size:E,end:T,key:g,lane:_},f[_]=m}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=If(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,i,a)=>this.range=n.length>0&&r>0?IXe({measurements:n,outerSize:r,scrollOffset:i,lanes:a}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=If(()=>{let n=null,r=null;const i=this.calculateRange();return i&&(n=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,i,a,s)=>a===null||s===null?[]:n({startIndex:a,endIndex:s,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const i=this.indexFromElement(n),a=this.measurementsCache[i];if(!a)return;const s=a.key,o=this.elementsCache.get(s);o!==n&&(o&&this.observer.unobserve(o),this.observer.observe(n),this.elementsCache.set(s,n)),n.isConnected&&this.resizeItem(i,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const i=this.measurementsCache[n];if(!i)return;const a=this.itemSizeCache.get(i.key)??i.size,s=r-a;s!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,s,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=s,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,i)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(i))});return}this._measureElement(n,void 0)},this.getVirtualItems=If(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let a=0,s=n.length;a<s;a++){const o=n[a],l=r[o];i.push(l)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return B9(r[Jse(0,r.length-1,i=>B9(r[i]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,r,i=0)=>{if(!this.scrollElement)return 0;const a=this.getSize(),s=this.getScrollOffset();r==="auto"&&(r=n>=s+a?"end":"start"),r==="center"?n+=(i-a)/2:r==="end"&&(n-=a);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.measurementsCache[n];if(!i)return;const a=this.getSize(),s=this.getScrollOffset();if(r==="auto")if(i.end>=s+a-this.options.scrollPaddingEnd)r="end";else if(i.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const o=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,i.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:i})},this.scrollToIndex=(n,{align:r="auto",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1)),this.currentScrollToIndex=n;let a=0;const s=10,o=c=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(n,c);if(!d){console.warn("Failed to get offset for index:",n);return}const[f,m]=d;this._scrollToOffset(f,{adjustments:void 0,behavior:i}),this.targetWindow.requestAnimationFrame(()=>{const g=()=>{if(this.currentScrollToIndex!==n)return;const y=this.getScrollOffset(),_=this.getOffsetForIndex(n,m);if(!_){console.warn("Failed to get offset for index:",n);return}SXe(_[0],y)||l(m)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(g):g()})},l=c=>{this.targetWindow&&this.currentScrollToIndex===n&&(a++,a<s?this.targetWindow.requestAnimationFrame(()=>o(c)):console.warn(`Failed to scroll to index ${n} after ${s} attempts.`))};o(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((n=r[r.length-1])==null?void 0:n.end)??0;else{const a=Array(this.options.lanes).fill(null);let s=r.length-1;for(;s>=0&&a.some(o=>o===null);){const o=r[s];a[o.lane]===null&&(a[o.lane]=o.end),s--}i=Math.max(...a.filter(o=>o!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}}const Jse=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function IXe({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const i=e.length-1,a=l=>e[l].start;if(e.length<=r)return{startIndex:0,endIndex:i};let s=Jse(0,i,a,n),o=s;if(r===1)for(;o<i&&e[o].end<n+t;)o++;else if(r>1){const l=Array(r).fill(0);for(;o<i&&l.some(d=>d<n+t);){const d=e[o];l[d.lane]=d.end,o++}const c=Array(r).fill(n+t);for(;s>=0&&c.some(d=>d>=n);){const d=e[s];c[d.lane]=d.start,s--}s=Math.max(0,s-s%r),o=Math.min(i,o+(r-1-o%r))}return{startIndex:s,endIndex:o}}const U9=typeof document<"u"?v.useLayoutEffect:v.useEffect;function OXe({useFlushSync:e=!0,...t}){const n=v.useReducer(()=>({}),{})[1],r={...t,onChange:(a,s)=>{var o;e&&s?Gs.flushSync(n):n(),(o=t.onChange)==null||o.call(t,a,s)}},[i]=v.useState(()=>new RXe(r));return i.setOptions(r),U9(()=>i._didMount(),[]),U9(()=>i._willUpdate()),i}function vj(e){return OXe({observeElementRect:TXe,observeElementOffset:kXe,scrollToFn:AXe,...e})}const DXe=v.memo(function({files:t,onFileClick:n}){const r=v.useRef(null),i=vj({count:t.length,getScrollElement:()=>r.current,estimateSize:()=>32,overscan:10});return h.jsx("div",{ref:r,className:"flex-1 overflow-auto",children:h.jsx("div",{style:{height:`${i.getTotalSize()}px`,position:"relative"},children:i.getVirtualItems().map(a=>{const s=t[a.index];return s?h.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${a.start}px)`},children:h.jsx(dp,{path:s.path,kind:rS(s.status),statusCode:s.status[0],onClick:()=>n(s)})},a.key):null})})})}),MXe=v.memo(function({added:t,modified:n,deleted:r,onFileClick:i}){return h.jsx(wo,{className:"h-full",children:h.jsxs("div",{className:"p-2 space-y-3",children:[t.length>0&&h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider px-3 mb-1",children:["Added (",t.length,")"]}),h.jsx("div",{className:"space-y-0.5",children:t.map(a=>h.jsx(dp,{path:a.path,kind:rS(a.status),statusCode:a.status[0],onClick:()=>i(a)},a.path))})]}),n.length>0&&h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider px-3 mb-1",children:["Modified (",n.length,")"]}),h.jsx("div",{className:"space-y-0.5",children:n.map(a=>h.jsx(dp,{path:a.path,kind:rS(a.status),statusCode:a.status[0],onClick:()=>i(a)},a.path))})]}),r.length>0&&h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider px-3 mb-1",children:["Deleted (",r.length,")"]}),h.jsx("div",{className:"space-y-0.5",children:r.map(a=>h.jsx(dp,{path:a.path,kind:rS(a.status),statusCode:a.status[0],onClick:()=>i(a)},a.path))})]})]})})});function LXe({workspaceId:e}){const{openTab:t}=Do(),{data:n,isLoading:r,error:i}=Ce.workspace.getDiffVsMain.useQuery({workspaceId:e},{refetchInterval:15e3,staleTime:1e4}),a=v.useCallback(m=>{t("diff",m.path,`Diff: ${m.path.split("/").pop()}`)},[t]);if(r)return h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx(un,{className:"h-6 w-6 animate-spin text-muted-foreground"})});if(i)return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-4",children:[h.jsx(Xs,{className:"h-8 w-8 text-destructive mb-2"}),h.jsx("p",{className:"text-sm text-destructive",children:"Failed to load diff vs main"}),h.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:i.message})]});const{added:s,modified:o,deleted:l,noMergeBase:c}=n??{added:[],modified:[],deleted:[],noMergeBase:!1},d=s.length>0||o.length>0||l.length>0,f=s.length+o.length+l.length;if(c)return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-4",children:[h.jsx(Xs,{className:"h-8 w-8 text-warning mb-2"}),h.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"No common history with main"}),h.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"This branch doesn't share history with the main branch"})]});if(!d)return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-4",children:[h.jsx(qs,{className:"h-8 w-8 text-muted-foreground mb-2"}),h.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Up to date with main"}),h.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"No changes compared to main branch"})]});if(f>200){const m=[...s,...o,...l];return h.jsxs("div",{className:"h-full flex flex-col",children:[h.jsxs("div",{className:"p-2 pb-1 border-b text-xs text-muted-foreground",children:[s.length>0&&h.jsxs("span",{className:"text-green-500",children:["+",s.length]}),s.length>0&&o.length>0&&h.jsx("span",{className:"mx-1",children:"·"}),o.length>0&&h.jsxs("span",{className:"text-yellow-500",children:["~",o.length]}),(s.length>0||o.length>0)&&l.length>0&&h.jsx("span",{className:"mx-1",children:"·"}),l.length>0&&h.jsxs("span",{className:"text-red-500",children:["-",l.length]})]}),h.jsx(DXe,{files:m,onFileClick:a})]})}return h.jsx(MXe,{added:s,modified:o,deleted:l,onFileClick:a})}function PXe({workspaceId:e,onTakeScreenshots:t}){const{openTab:n}=Do(),r=Ce.useUtils(),[i,a]=v.useState(!1),s=v.useRef(0),o=Ce.workspace.deleteScreenshot.useMutation({onSuccess:()=>{r.workspace.listScreenshots.invalidate({workspaceId:e})}}),{data:l,isLoading:c}=Ce.workspace.listScreenshots.useQuery({workspaceId:e},{refetchInterval:i?3e3:1e4,staleTime:i?1e3:5e3}),d=l?.screenshots??[];v.useEffect(()=>{i&&d.length>s.current&&a(!1),s.current=d.length},[d.length,i]);const f=v.useCallback(()=>{a(!0),t?.()},[t]);return c?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx(un,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):d.length===0?h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-4 gap-3",children:[h.jsx(cy,{className:"h-8 w-8 text-muted-foreground"}),h.jsx("div",{children:i?h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Taking Screenshots..."}),h.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"The agent is capturing the dev app"})]}):h.jsxs(h.Fragment,{children:[h.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"No screenshots yet"}),h.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"Capture screenshots of the running dev app"})]})}),i?h.jsx(un,{className:"h-5 w-5 animate-spin text-muted-foreground"}):t&&h.jsxs(We,{variant:"outline",size:"sm",onClick:f,className:"gap-1.5",children:[h.jsx(cy,{className:"h-3.5 w-3.5"}),"Take Screenshots"]})]}):h.jsx(wo,{className:"h-full",children:h.jsx("div",{className:"p-2 grid grid-cols-2 gap-2",children:d.map(m=>h.jsx(BXe,{workspaceId:e,screenshot:m,onClick:()=>n("screenshot",m.path,m.name),onDelete:()=>o.mutate({workspaceId:e,path:m.path})},m.path))})})}function BXe({workspaceId:e,screenshot:t,onClick:n,onDelete:r}){const{data:i,isLoading:a}=Ce.workspace.readScreenshot.useQuery({workspaceId:e,path:t.path},{staleTime:6e4}),s=v.useCallback(o=>{o.stopPropagation(),r()},[r]);return h.jsxs("button",{type:"button",onClick:n,className:"group relative aspect-video rounded-md border bg-muted/30 overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:[a?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx(un,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):i?h.jsx("img",{src:`data:${i.mimeType};base64,${i.data}`,alt:t.name,className:"absolute inset-0 w-full h-full object-cover"}):null,h.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity",children:h.jsx("button",{type:"button",onClick:s,className:"h-5 w-5 flex items-center justify-center rounded-full bg-black/60 text-white hover:bg-red-600 transition-colors",children:h.jsx(Ao,{className:"h-3 w-3"})})}),h.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 px-1.5 py-0.5 text-[10px] text-white truncate",children:t.name})]})}function jXe({workspaceId:e,className:t}){const n=v.useRef(null),r=v.useRef(0),{data:i}=Ce.workspace.getInitStatus.useQuery({id:e},{refetchInterval:l=>{const c=l.state.data?.status;return c==="READY"||c==="FAILED"||c==="ARCHIVED"?!1:1e3}}),a=i?.initOutput??"",s=i?.status;a.length>r.current&&(r.current=a.length,requestAnimationFrame(()=>{n.current?.scrollTo({top:n.current.scrollHeight,behavior:"smooth"})}));const o=s==="PROVISIONING"?"Running...":s==="READY"?"Completed":s==="FAILED"?"Failed":"";return h.jsxs("div",{className:ne("h-full bg-background flex flex-col",t),children:[o&&h.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 border-b text-xs text-muted-foreground",children:[s==="PROVISIONING"&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-yellow-500 animate-pulse"}),s==="READY"&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500"}),s==="FAILED"&&h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),h.jsxs("span",{children:["Startup script: ",o]})]}),h.jsx("div",{ref:n,className:"flex-1 overflow-y-auto overflow-x-auto font-mono text-xs p-4 bg-black text-white",children:h.jsx("pre",{className:"whitespace-pre-wrap break-words",children:a||"No setup logs yet."})})]})}function eoe({tabs:e,activeTabId:t,onSelectTab:n,onCloseTab:r,onNewTab:i,showNewButton:a=!0,renderNewButton:s,className:o}){return h.jsxs("div",{className:ne("flex items-center gap-1 min-w-0 overflow-hidden",o),children:[h.jsx("div",{className:"flex-1 flex items-center gap-1 overflow-x-auto scrollbar-hide flex-nowrap min-w-0",children:e.map(l=>h.jsxs("div",{className:ne("flex items-center rounded-md transition-colors group flex-shrink-0",t===l.id?"bg-zinc-800 text-zinc-100":"text-zinc-400 hover:bg-zinc-800/50 hover:text-zinc-200"),children:[h.jsxs("button",{type:"button",className:"flex items-center gap-1 px-2 py-1 text-xs cursor-pointer whitespace-nowrap",onClick:()=>n(l.id),children:[h.jsx(El,{className:"h-3 w-3 flex-shrink-0"}),h.jsx("span",{children:l.label})]}),h.jsx("button",{type:"button",onClick:()=>r(l.id),className:ne("mr-1 p-0.5 rounded hover:bg-zinc-600/50 transition-colors","opacity-0 group-hover:opacity-100",t===l.id&&"opacity-100"),children:h.jsx(Ao,{className:"h-3 w-3"})})]},l.id))}),a&&i&&(s?s(i):h.jsx("button",{type:"button",onClick:i,className:"h-6 w-6 flex-shrink-0 flex items-center justify-center rounded-md transition-colors text-muted-foreground hover:bg-sidebar-accent hover:text-foreground",title:"New terminal",children:h.jsx(Yd,{className:"h-3 w-3"})}))]})}const FXe=10,$Xe=1e3,UXe=3e4;function zXe(e){const t=Math.min($Xe*2**e,UXe),n=Math.random()*t*.25;return t+n}function $1(e,t){const n=typeof window<"u"?window.location.host:"localhost:3000",r=typeof window<"u"&&window.location.protocol==="https:"?"wss:":"ws:",i=new URLSearchParams;for(const[s,o]of Object.entries(t))o!==void 0&&i.set(s,o);const a=i.toString();return`${r}//${n}${e}?${a}`}const HXe=100,z9=10,WXe=new Set(["stop","interrupt"]);function U1(e){const{url:t,onMessage:n,onConnected:r,onDisconnected:i,queuePolicy:a="replay"}=e,[s,o]=v.useState(!1),l=v.useRef(null),c=v.useRef(0),d=v.useRef(null),f=v.useRef(!1),m=v.useRef([]),g=v.useRef(n),y=v.useRef(r),_=v.useRef(i);v.useEffect(()=>{g.current=n,y.current=r,_.current=i},[n,r,i]);const S=v.useCallback(()=>{if(!t||l.current?.readyState===WebSocket.OPEN)return;l.current&&(l.current.close(),l.current=null),d.current&&(clearTimeout(d.current),d.current=null),f.current=!1;const T=new WebSocket(t);l.current=T,T.onopen=()=>{if(o(!0),c.current=0,a!=="replay"){m.current=[],y.current?.();return}const A=m.current;m.current=[];const O=A.filter(D=>{const F=D.type;return!(F&&WXe.has(F))}),I=O.slice(0,z9),N=O.slice(z9);for(const D of I)T.send(JSON.stringify(D));N.length>0&&(m.current=N),y.current?.()},T.onmessage=A=>{try{if(typeof A.data!="string")return;const O=JSON.parse(A.data);g.current?.(O)}catch{}},T.onclose=()=>{if(l.current===T&&(o(!1),l.current=null,_.current?.(),!f.current&&c.current<FXe)){const A=zXe(c.current);c.current+=1,d.current=setTimeout(()=>{S()},A)}},T.onerror=()=>{}},[a,t]);v.useEffect(()=>(t?S():(f.current=!0,m.current=[],l.current&&(l.current.close(),l.current=null),o(!1)),()=>{f.current=!0,d.current&&(clearTimeout(d.current),d.current=null),l.current&&(l.current.close(),l.current=null)}),[t,S]);const w=v.useCallback(T=>l.current?.readyState===WebSocket.OPEN?(l.current.send(JSON.stringify(T)),!0):(a!=="replay"||m.current.length<HXe&&m.current.push(T),!1),[a]),E=v.useCallback(()=>{c.current=0,f.current=!1,m.current=[],l.current&&(l.current.close(),l.current=null),S()},[S]);return{connected:s,send:w,reconnect:E}}const GXe=nn({id:ke(),createdAt:ke(),outputBuffer:ke().optional()}),qXe=_O("type",[nn({type:Pr("output"),data:ke().optional(),terminalId:ke().optional()}),nn({type:Pr("created"),terminalId:ke().optional()}),nn({type:Pr("exit"),terminalId:ke().optional(),exitCode:hi().optional()}),nn({type:Pr("error"),message:ke().optional()}),nn({type:Pr("terminal_list"),terminals:Ya(GXe).optional()})]);function VXe(e,t){const{onOutput:n,onCreated:r,onExit:i,onError:a,onTerminalList:s}=t;switch(e.type){case"output":e.terminalId&&e.data&&n?.(e.terminalId,e.data);break;case"created":e.terminalId&&r?.(e.terminalId);break;case"exit":e.terminalId&&e.exitCode!==void 0&&i?.(e.terminalId,e.exitCode);break;case"error":e.message&&a?.(e.message);break;case"terminal_list":e.terminals&&s?.(e.terminals);break}}function YXe({workspaceId:e,onOutput:t,onCreated:n,onExit:r,onError:i,onTerminalList:a}){const s=$1("/terminal",{workspaceId:e}),o=v.useCallback(_=>{const S=qXe.safeParse(_);if(!S.success)return;const w=S.data;VXe(w,{onOutput:t,onCreated:n,onExit:r,onError:i,onTerminalList:a})},[t,n,r,i,a]),{connected:l,send:c}=U1({url:s,onMessage:o,queuePolicy:"drop"}),d=v.useCallback((_=80,S=24)=>{c({type:"create",cols:_,rows:S})},[c]),f=v.useCallback((_,S)=>{c({type:"input",terminalId:_,data:S})},[c]),m=v.useCallback((_,S,w)=>{c({type:"resize",terminalId:_,cols:S,rows:w})},[c]),g=v.useCallback(_=>{c({type:"destroy",terminalId:_})},[c]),y=v.useCallback(_=>{c({type:"set_active",terminalId:_})},[c]);return{connected:l,create:d,sendInput:f,resize:m,destroy:g,setActive:y}}const KXe=v.lazy(()=>Gn(()=>import("./terminal-instance-BbEVZkgm.js"),[]).then(e=>({default:e.TerminalInstance}))),XXe=v.forwardRef(function({workspaceId:t,className:n,hideHeader:r=!1,onStateChange:i},a){const[s,o]=v.useState([]),[l,c]=v.useState(null),d=v.useRef(null),f=v.useRef(new Map),m=v.useRef(()=>{}),g=v.useCallback((z,M)=>{o(G=>{if(G.find(q=>q.terminalId===z))return G.map(q=>q.terminalId===z?{...q,output:q.output+M}:q);const Q=f.current.get(z)??"";return f.current.set(z,Q+M),G})},[]),y=v.useCallback(z=>{const M=d.current;if(M){const G=f.current.get(z)??"";f.current.delete(z),o(B=>B.map(Q=>Q.id===M?{...Q,terminalId:z,output:G}:Q)),d.current=null,m.current(z)}},[]),_=v.useCallback((z,M)=>{o(G=>G.map(B=>B.terminalId===z?{...B,output:`${B.output}\r
|
|
398
398
|
[Process exited with code ${M}]\r
|
|
399
399
|
`}:B))},[]),S=v.useCallback(z=>{const M=d.current;M&&(d.current=null,o(G=>G.map(B=>B.id===M?{...B,output:`${B.output}\r
|
|
400
400
|
[Error: ${z}]\r
|
|
@@ -419,7 +419,7 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
|
|
|
419
419
|
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Dj&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=m7(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Oj(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-tA),tA),t/=tA,t/Math.abs(t)+Math.round(t*(Eet-1)))}shouldForceSelection(e){return Aw?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),Cet)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Aw&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<Tet&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=met(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let s=i.translateBufferLineToString(e[1],!1),o=this._convertViewportColToCharacterIndex(a,e[0]),l=o,c=e[0]-o,d=0,f=0,m=0,g=0;if(s.charAt(o)===" "){for(;o>0&&s.charAt(o-1)===" ";)o--;for(;l<s.length&&s.charAt(l+1)===" ";)l++}else{let S=e[0],w=e[0];a.getWidth(S)===0&&(d++,S--),a.getWidth(w)===2&&(f++,w++);let E=a.getString(w).length;for(E>1&&(g+=E-1,l+=E-1);S>0&&o>0&&!this._isCharWordSeparator(a.loadCell(S-1,this._workCell));){a.loadCell(S-1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,S--):T>1&&(m+=T-1,o-=T-1),o--,S--}for(;w<a.length&&l+1<s.length&&!this._isCharWordSeparator(a.loadCell(w+1,this._workCell));){a.loadCell(w+1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===2?(f++,w++):T>1&&(g+=T-1,l+=T-1),l++,w++}}l++;let y=o+c-d+m,_=Math.min(this._bufferService.cols,l-o+d+f-m-g);if(!(!t&&s.slice(o,l).trim()==="")){if(n&&y===0&&a.getCodePoint(0)!==32){let S=i.lines.get(e[1]-1);if(S&&a.isWrapped&&S.getCodePoint(this._bufferService.cols-1)!==32){let w=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(w){let E=this._bufferService.cols-w.start;y-=E,_+=E}}}if(r&&y+_===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let S=i.lines.get(e[1]+1);if(S?.isWrapped&&S.getCodePoint(0)!==32){let w=this._getWordAt([0,e[1]+1],!1,!1,!0);w&&(_+=w.length)}}return{start:y,length:_}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=m7(n,this._bufferService.cols)}};hI=Kr([rt(3,Da),rt(4,jh),rt(5,Cj),rt(6,Ma),rt(7,Ec),rt(8,wc)],hI);var g7=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},b7=class{constructor(){this._color=new g7,this._css=new g7}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},xi=Object.freeze((()=>{let e=[Lr.toColor("#2e3436"),Lr.toColor("#cc0000"),Lr.toColor("#4e9a06"),Lr.toColor("#c4a000"),Lr.toColor("#3465a4"),Lr.toColor("#75507b"),Lr.toColor("#06989a"),Lr.toColor("#d3d7cf"),Lr.toColor("#555753"),Lr.toColor("#ef2929"),Lr.toColor("#8ae234"),Lr.toColor("#fce94f"),Lr.toColor("#729fcf"),Lr.toColor("#ad7fa8"),Lr.toColor("#34e2e2"),Lr.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:di.toCss(r,i,a),rgba:di.toRgba(r,i,a)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:di.toCss(r,r,r),rgba:di.toRgba(r,r,r)})}return e})()),Nd=Lr.toColor("#ffffff"),Sb=Lr.toColor("#000000"),y7=Lr.toColor("#ffffff"),v7=Sb,Zg={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Aet=Nd,fI=class extends dn{constructor(e){super(),this._optionsService=e,this._contrastCache=new b7,this._halfContrastCache=new b7,this._onChangeColors=this._register(new Xe),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Nd,background:Sb,cursor:y7,cursorAccent:v7,selectionForeground:void 0,selectionBackgroundTransparent:Zg,selectionBackgroundOpaque:Er.blend(Sb,Zg),selectionInactiveBackgroundTransparent:Zg,selectionInactiveBackgroundOpaque:Er.blend(Sb,Zg),scrollbarSliderBackground:Er.opacity(Nd,.2),scrollbarSliderHoverBackground:Er.opacity(Nd,.4),scrollbarSliderActiveBackground:Er.opacity(Nd,.5),overviewRulerBorder:Nd,ansi:xi.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=ar(e.foreground,Nd),t.background=ar(e.background,Sb),t.cursor=Er.blend(t.background,ar(e.cursor,y7)),t.cursorAccent=Er.blend(t.background,ar(e.cursorAccent,v7)),t.selectionBackgroundTransparent=ar(e.selectionBackground,Zg),t.selectionBackgroundOpaque=Er.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ar(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Er.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ar(e.selectionForeground,h7):void 0,t.selectionForeground===h7&&(t.selectionForeground=void 0),Er.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Er.opacity(t.selectionBackgroundTransparent,.3)),Er.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Er.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ar(e.scrollbarSliderBackground,Er.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ar(e.scrollbarSliderHoverBackground,Er.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ar(e.scrollbarSliderActiveBackground,Er.opacity(t.foreground,.5)),t.overviewRulerBorder=ar(e.overviewRulerBorder,Aet),t.ansi=xi.slice(),t.ansi[0]=ar(e.black,xi[0]),t.ansi[1]=ar(e.red,xi[1]),t.ansi[2]=ar(e.green,xi[2]),t.ansi[3]=ar(e.yellow,xi[3]),t.ansi[4]=ar(e.blue,xi[4]),t.ansi[5]=ar(e.magenta,xi[5]),t.ansi[6]=ar(e.cyan,xi[6]),t.ansi[7]=ar(e.white,xi[7]),t.ansi[8]=ar(e.brightBlack,xi[8]),t.ansi[9]=ar(e.brightRed,xi[9]),t.ansi[10]=ar(e.brightGreen,xi[10]),t.ansi[11]=ar(e.brightYellow,xi[11]),t.ansi[12]=ar(e.brightBlue,xi[12]),t.ansi[13]=ar(e.brightMagenta,xi[13]),t.ansi[14]=ar(e.brightCyan,xi[14]),t.ansi[15]=ar(e.brightWhite,xi[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=ar(e.extendedAnsi[r],xi[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};fI=Kr([rt(0,Ma)],fI);function ar(e,t){if(e!==void 0)try{return Lr.toColor(e)}catch{}return t}var Ret=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Iet=class{constructor(){this._services=new Ret,this._services.set(Ej,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=SQe(e).sort((a,s)=>a.index-s.index),r=[];for(let a of n){let s=this._services.get(a.id);if(!s)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id._id}.`);r.push(s)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},Oet={trace:0,debug:1,info:2,warn:3,error:4,off:5},Det="xterm.js: ",pI=class extends dn{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Oet[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":Det)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};pI=Kr([rt(0,Ma)],pI);var _7=class extends dn{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Xe),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Xe),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Xe),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let i=t-1;i>=0;i--)this.set(e+i+n,this.get(e+i));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},on=3,ci=Object.freeze(new tv),Ex=0,nA=2,wb=class Ele{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*on);let i=n||Ys.fromCharData([0,Hoe,1,0]);for(let a=0;a<t;++a)this.setCell(a,i);this.length=t}get(t){let n=this._data[t*on+0],r=n&2097151;return[this._data[t*on+1],n&2097152?this._combined[t]:r?lu(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*on+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*on+0]=t|2097152|n[2]<<22):this._data[t*on+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*on+0]>>22}hasWidth(t){return this._data[t*on+0]&12582912}getFg(t){return this._data[t*on+1]}getBg(t){return this._data[t*on+2]}hasContent(t){return this._data[t*on+0]&4194303}getCodePoint(t){let n=this._data[t*on+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*on+0]&2097152}getString(t){let n=this._data[t*on+0];return n&2097152?this._combined[t]:n&2097151?lu(n&2097151):""}isProtected(t){return this._data[t*on+2]&536870912}loadCell(t,n){return Ex=t*on,n.content=this._data[Ex+0],n.fg=this._data[Ex+1],n.bg=this._data[Ex+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*on+0]=n.content,this._data[t*on+1]=n.fg,this._data[t*on+2]=n.bg}setCellFromCodepoint(t,n,r,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*on+0]=n|r<<22,this._data[t*on+1]=i.fg,this._data[t*on+2]=i.bg}addCodepointToCell(t,n,r){let i=this._data[t*on+0];i&2097152?this._combined[t]+=lu(n):i&2097151?(this._combined[t]=lu(i&2097151)+lu(n),i&=-2097152,i|=2097152):i=n|1<<22,r&&(i&=-12582913,i|=r<<22),this._data[t*on+0]=i}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let i=new Ys;for(let a=this.length-t-n-1;a>=0;--a)this.setCell(t+n+a,this.loadCell(t+a,i));for(let a=0;a<n;++a)this.setCell(t+a,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let i=new Ys;for(let a=0;a<this.length-t-n;++a)this.setCell(t+a,this.loadCell(t+n+a,i));for(let a=this.length-n;a<this.length;++a)this.setCell(a,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*nA<this._data.buffer.byteLength;let r=t*on;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let i=new Uint32Array(r);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,n)}else{this._data=this._data.subarray(0,r);let i=Object.keys(this._combined);for(let s=0;s<i.length;s++){let o=parseInt(i[s],10);o>=t&&delete this._combined[o]}let a=Object.keys(this._extendedAttrs);for(let s=0;s<a.length;s++){let o=parseInt(a[s],10);o>=t&&delete this._extendedAttrs[o]}}return this.length=t,r*4*nA<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*nA<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new Ele(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*on+0]&4194303)return t+(this._data[t*on+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*on+0]&4194303||this._data[t*on+2]&50331648)return t+(this._data[t*on+0]>>22);return 0}copyCellsFrom(t,n,r,i,a){let s=t._data;if(a)for(let l=i-1;l>=0;l--){for(let c=0;c<on;c++)this._data[(r+l)*on+c]=s[(n+l)*on+c];s[(n+l)*on+2]&268435456&&(this._extendedAttrs[r+l]=t._extendedAttrs[n+l])}else for(let l=0;l<i;l++){for(let c=0;c<on;c++)this._data[(r+l)*on+c]=s[(n+l)*on+c];s[(n+l)*on+2]&268435456&&(this._extendedAttrs[r+l]=t._extendedAttrs[n+l])}let o=Object.keys(t._combined);for(let l=0;l<o.length;l++){let c=parseInt(o[l],10);c>=n&&(this._combined[c-n+r]=t._combined[c])}}translateToString(t,n,r,i){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),i&&(i.length=0);let a="";for(;n<r;){let s=this._data[n*on+0],o=s&2097151,l=s&2097152?this._combined[n]:o?lu(o):mu;if(a+=l,i)for(let c=0;c<l.length;++c)i.push(n);n+=s>>22||1}return i&&i.push(n),a}};function Met(e,t,n,r,i,a){let s=[];for(let o=0;o<e.length-1;o++){let l=o,c=e.get(++l);if(!c.isWrapped)continue;let d=[e.get(o)];for(;l<e.length&&c.isWrapped;)d.push(c),c=e.get(++l);if(!a&&r>=o&&r<l){o+=d.length-1;continue}let f=0,m=Wy(d,f,t),g=1,y=0;for(;g<d.length;){let S=Wy(d,g,t),w=S-y,E=n-m,T=Math.min(w,E);d[f].copyCellsFrom(d[g],y,m,T,!1),m+=T,m===n&&(f++,m=0),y+=T,y===S&&(g++,y=0),m===0&&f!==0&&d[f-1].getWidth(n-1)===2&&(d[f].copyCellsFrom(d[f-1],n-1,m++,1,!1),d[f-1].setCell(n-1,i))}d[f].replaceCells(m,n,i);let _=0;for(let S=d.length-1;S>0&&(S>f||d[S].getTrimmedLength()===0);S--)_++;_>0&&(s.push(o+d.length-_),s.push(_)),o+=d.length-1}return s}function Let(e,t){let n=[],r=0,i=t[r],a=0;for(let s=0;s<e.length;s++)if(i===s){let o=t[++r];e.onDeleteEmitter.fire({index:s-a,amount:o}),s+=o-1,a+=o,i=t[++r]}else n.push(s);return{layout:n,countRemoved:a}}function Pet(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function Bet(e,t,n){let r=[],i=e.map((l,c)=>Wy(e,c,t)).reduce((l,c)=>l+c),a=0,s=0,o=0;for(;o<i;){if(i-o<n){r.push(i-o);break}a+=n;let l=Wy(e,s,t);a>l&&(a-=l,s++);let c=e[s].getWidth(a-1)===2;c&&a--;let d=c?n-1:n;r.push(d),o+=d}return r}function Wy(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var Cle=class Tle{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Tle._nextId++,this._onDispose=this.register(new Xe),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ph(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Cle._nextId=1;var jet=Cle,Ni={},Ad=Ni.B;Ni[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ni.A={"#":"£"};Ni.B=void 0;Ni[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ni.C=Ni[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ni.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ni.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ni.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ni.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ni.E=Ni[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ni.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ni.H=Ni[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ni["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var x7=4294967295,S7=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=ci.clone(),this.savedCharset=Ad,this.markers=[],this._nullCell=Ys.fromCharData([0,Hoe,1,0]),this._whitespaceCell=Ys.fromCharData([0,mu,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Rw,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new _7(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Tw),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Tw),this._whitespaceCell}getBlankLine(e,t){return new wb(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>x7?x7:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ci);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new _7(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(ci),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let s=0;s<this.lines.length;s++)r+=+this.lines.get(s).resize(e,n);let a=0;if(this._rows<t)for(let s=this._rows;s<t;s++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new wb(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new wb(e,n)));else for(let s=this._rows;s>t;s--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let s=this.lines.length-i;s>0&&(this.lines.trimStart(s),this.ybase=Math.max(this.ybase-s,0),this.ydisp=Math.max(this.ydisp-s,0),this.savedY=Math.max(this.savedY-s,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let a=0;a<this.lines.length;a++)r+=+this.lines.get(a).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=Met(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ci),n);if(r.length>0){let i=Let(this.lines,r);Pet(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(ci),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new wb(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(ci),i=[],a=0;for(let s=this.lines.length-1;s>=0;s--){let o=this.lines.get(s);if(!o||!o.isWrapped&&o.getTrimmedLength()<=e)continue;let l=[o];for(;o.isWrapped&&s>0;)o=this.lines.get(--s),l.unshift(o);if(!n){let T=this.ybase+this.y;if(T>=s&&T<s+l.length)continue}let c=l[l.length-1].getTrimmedLength(),d=Bet(l,this._cols,e),f=d.length-l.length,m;this.ybase===0&&this.y!==this.lines.length-1?m=Math.max(0,this.y-this.lines.maxLength+f):m=Math.max(0,this.lines.length-this.lines.maxLength+f);let g=[];for(let T=0;T<f;T++){let A=this.getBlankLine(ci,!0);g.push(A)}g.length>0&&(i.push({start:s+l.length+a,newLines:g}),a+=g.length),l.push(...g);let y=d.length-1,_=d[y];_===0&&(y--,_=d[y]);let S=l.length-f-1,w=c;for(;S>=0;){let T=Math.min(w,_);if(l[y]===void 0)break;if(l[y].copyCellsFrom(l[S],w-T,_-T,T,!0),_-=T,_===0&&(y--,_=d[y]),w-=T,w===0){S--;let A=Math.max(S,0);w=Wy(l,A,this._cols)}}for(let T=0;T<l.length;T++)d[T]<e&&l[T].setCell(d[T],r);let E=f-m;for(;E-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+f,this.ybase+t-1)}if(i.length>0){let s=[],o=[];for(let _=0;_<this.lines.length;_++)o.push(this.lines.get(_));let l=this.lines.length,c=l-1,d=0,f=i[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let m=0;for(let _=Math.min(this.lines.maxLength-1,l+a-1);_>=0;_--)if(f&&f.start>c+m){for(let S=f.newLines.length-1;S>=0;S--)this.lines.set(_--,f.newLines[S]);_++,s.push({index:c+1,amount:f.newLines.length}),m+=f.newLines.length,f=i[++d]}else this.lines.set(_,o[c--]);let g=0;for(let _=s.length-1;_>=0;_--)s[_].index+=g,this.lines.onInsertEmitter.fire(s[_]),g+=s[_].amount;let y=Math.max(0,l+a-this.lines.maxLength);y>0&&this.lines.onTrimEmitter.fire(y)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new jet(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Fet=class extends dn{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Xe),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 S7(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new S7(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},kle=2,Nle=1,mI=class extends dn{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Xe),this.onResize=this._onResize.event,this._onScroll=this._register(new Xe),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,kle),this.rows=Math.max(e.rawOptions.rows||0,Nle),this.buffers=this._register(new Fet(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let s=n.lines.isFull;a===n.lines.length-1?s?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),s?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let s=a-i+1;n.lines.shiftElements(i+1,s-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};mI=Kr([rt(0,Ma)],mI);var Df={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Aw,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},$et=["normal","bold","100","200","300","400","500","600","700","800","900"],Uet=class extends dn{constructor(e){super(),this._onOptionChange=this._register(new Xe),this.onOptionChange=this._onOptionChange.event;let t={...Df};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Rr(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in Df))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in Df))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Df[e]),!zet(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Df[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=$et.includes(t)?t:Df[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function zet(e){return e==="block"||e==="underline"||e==="bar"}function Eb(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&Eb(e[r],t-1);return n}var w7=Object.freeze({insertMode:!1}),E7=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),gI=class extends dn{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Xe),this.onData=this._onData.event,this._onUserInput=this._register(new Xe),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Xe),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Xe),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Eb(w7),this.decPrivateModes=Eb(E7)}reset(){this.modes=Eb(w7),this.decPrivateModes=Eb(E7)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};gI=Kr([rt(0,Da),rt(1,Yoe),rt(2,Ma)],gI);var C7={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function rA(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var iA=String.fromCharCode,T7={DEFAULT:e=>{let t=[rA(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${iA(t[0])}${iA(t[1])}${iA(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${rA(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${rA(e,!0)};${e.x};${e.y}${t}`}},bI=class extends dn{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Xe),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(C7))this.addProtocol(r,C7[r]);for(let r of Object.keys(T7))this.addEncoding(r,T7[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};bI=Kr([rt(0,Da),rt(1,jh),rt(2,Ma)],bI);var aA=[[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]],Het=[[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]],Si;function Wet(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var Get=class{constructor(){if(this.version="6",!Si){Si=new Uint8Array(65536),Si.fill(1),Si[0]=0,Si.fill(0,1,32),Si.fill(0,127,160),Si.fill(2,4352,4448),Si[9001]=2,Si[9002]=2,Si.fill(2,11904,42192),Si[12351]=1,Si.fill(2,44032,55204),Si.fill(2,63744,64256),Si.fill(2,65040,65050),Si.fill(2,65072,65136),Si.fill(2,65280,65377),Si.fill(2,65504,65511);for(let e=0;e<aA.length;++e)Si.fill(0,aA[e][0],aA[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Si[e]:Wet(e,Het)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let i=Fd.extractWidth(t);i===0?r=!1:i>n&&(n=i)}return Fd.createPropertyValue(0,n,r)}},Fd=class cS{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Xe,this.onChange=this._onChange.event;let t=new Get;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let s=t.charCodeAt(a);if(55296<=s&&s<=56319){if(++a>=i)return n+this.wcwidth(s);let c=t.charCodeAt(a);56320<=c&&c<=57343?s=(s-55296)*1024+c-56320+65536:n+=this.wcwidth(c)}let o=this.charProperties(s,r),l=cS.extractWidth(o);cS.extractShouldJoin(o)&&(l-=cS.extractWidth(r)),n+=l,r=o}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},qet=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function k7(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Qg=2147483647,Vet=256,Ale=class yI{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>Vet)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new yI;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let i=t[r];if(Array.isArray(i))for(let a=0;a<i.length;++a)n.addSubParam(i[a]);else n.addParam(i)}return n}clone(){let t=new yI(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,i))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Qg?Qg:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Qg?Qg:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&(t[n]=this._subParams.slice(r,i))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[n-1];r[n-1]=~i?Math.min(i*10+t,Qg):t}},Jg=[],Yet=class{constructor(){this._state=0,this._active=Jg,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Jg}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Jg,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Jg,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",G1(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Jg,this._id=-1,this._state=0}}},ds=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,n,r){this._hitLimit||(this._data+=G1(t,n,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let n=!1;if(this._hitLimit)n=!1;else if(t&&(n=this._handler(this._data),n instanceof Promise))return n.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,n}},eb=[],Ket=class{constructor(){this._handlers=Object.create(null),this._active=eb,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=eb}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=eb,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||eb,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",G1(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=eb,this._ident=0}},Cb=new Ale;Cb.addParam(0);var N7=class{constructor(e){this._handler=e,this._data="",this._params=Cb,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Cb,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=G1(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=Cb,this._data="",this._hitLimit=!1,n));return this._params=Cb,this._data="",this._hitLimit=!1,t}},Xet=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},zs=160,Zet=(function(){let e=new Xet(4095),t=Array.apply(null,Array(256)).map((o,l)=>l),n=(o,l)=>t.slice(o,l),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),s;e.setDefault(1,0),e.addMany(r,0,2,0);for(s in a)e.addMany([24,26,153,154],s,3,0),e.addMany(n(128,144),s,3,0),e.addMany(n(144,152),s,3,0),e.add(156,s,0,0),e.add(27,s,11,1),e.add(157,s,4,8),e.addMany([152,158,159],s,0,7),e.add(155,s,11,3),e.add(144,s,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(zs,0,2,0),e.add(zs,8,5,8),e.add(zs,6,0,6),e.add(zs,11,0,11),e.add(zs,13,13,13),e})(),Qet=class extends dn{constructor(e=Zet){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Ale,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Rr(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Yet),this._dcsParser=this._register(new Ket),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let a=e.intermediates.charCodeAt(i);if(32>a||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,s;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let o=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&l>-1){for(;l>=0&&(s=o[l](this._params),s!==!0);l--)if(s instanceof Promise)return this._parseStack.handlerPos=l,s}this._parseStack.handlers=[];break;case 4:if(n===!1&&l>-1){for(;l>=0&&(s=o[l](),s!==!0);l--)if(s instanceof Promise)return this._parseStack.handlerPos=l,s}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],s=this._dcsParser.unhook(r!==24&&r!==26,n),s)return s;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],s=this._oscParser.end(r!==24&&r!==26,n),s)return s;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let o=a;o<t;++o){switch(r=e[o],i=this._transitions.table[this.currentState<<8|(r<160?r:zs)],i>>4){case 2:for(let m=o+1;;++m){if(m>=t||(r=e[m])<32||r>126&&r<zs){this._printHandler(e,o,m),o=m-1;break}if(++m>=t||(r=e[m])<32||r>126&&r<zs){this._printHandler(e,o,m),o=m-1;break}if(++m>=t||(r=e[m])<32||r>126&&r<zs){this._printHandler(e,o,m),o=m-1;break}if(++m>=t||(r=e[m])<32||r>126&&r<zs){this._printHandler(e,o,m),o=m-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:o,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|r],c=l?l.length-1:-1;for(;c>=0&&(s=l[c](this._params),s!==!0);c--)if(s instanceof Promise)return this._preserveStack(3,l,c,i,o),s;c<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++o<t&&(r=e[o])>47&&r<60);o--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let d=this._escHandlers[this._collect<<8|r],f=d?d.length-1:-1;for(;f>=0&&(s=d[f](),s!==!0);f--)if(s instanceof Promise)return this._preserveStack(4,d,f,i,o),s;f<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let m=o+1;;++m)if(m>=t||(r=e[m])===24||r===26||r===27||r>127&&r<zs){this._dcsParser.put(e,o,m),o=m-1;break}break;case 14:if(s=this._dcsParser.unhook(r!==24&&r!==26),s)return this._preserveStack(6,[],0,i,o),s;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let m=o+1;;m++)if(m>=t||(r=e[m])<32||r>127&&r<zs){this._oscParser.put(e,o,m),o=m-1;break}break;case 6:if(s=this._oscParser.end(r!==24&&r!==26),s)return this._preserveStack(5,[],0,i,o),s;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},Jet=/^([\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})$/,ett=/^[\da-f]+$/;function A7(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=Jet.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),ett.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let i=0;i<3;++i){let a=parseInt(t.slice(n*i,n*i+n),16);r[i]=n===1?a<<4:n===2?a:n===3?a>>4:a>>8}return r}}function sA(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function ttt(e,t=16){let[n,r,i]=e;return`rgb:${sA(n,t)}/${sA(r,t)}/${sA(i,t)}`}var ntt={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Jc=131072,R7=10;function I7(e,t){if(e>24)return t.setWinLines||!1;switch(e){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 O7=5e3,D7=0,rtt=class extends dn{constructor(e,t,n,r,i,a,s,o,l=new Qet){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=s,this._unicodeService=o,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new _Qe,this._utf8Decoder=new xQe,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ci.clone(),this._eraseAttrDataInternal=ci.clone(),this._onRequestBell=this._register(new Xe),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Xe),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Xe),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Xe),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Xe),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Xe),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Xe),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Xe),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Xe),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Xe),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Xe),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Xe),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Xe),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 vI(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:d.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,d,f)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:d,data:f})}),this._parser.setDcsHandlerFallback((c,d,f)=>{d==="HOOK"&&(f=f.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:d,payload:f})}),this._parser.setPrintHandler((c,d,f)=>this.print(c,d,f)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(Me.BEL,()=>this.bell()),this._parser.setExecuteHandler(Me.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Me.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Me.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Me.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Me.BS,()=>this.backspace()),this._parser.setExecuteHandler(Me.HT,()=>this.tab()),this._parser.setExecuteHandler(Me.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Me.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(oS.IND,()=>this.index()),this._parser.setExecuteHandler(oS.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(oS.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ds(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new ds(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new ds(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new ds(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new ds(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new ds(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new ds(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new ds(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new ds(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new ds(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new ds(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new ds(c=>this.restoreCursorColor(c))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let c in Ni)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new N7((c,d)=>this.requestStatusString(c,d)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),O7))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${O7} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,s=this._parseStack.paused;if(s){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Jc&&(a=this._parseStack.position+Jc)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Jc&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Jc))),s||this._dirtyRowTracker.clearRange(),e.length>Jc)for(let c=a;c<e.length;c+=Jc){let d=c+Jc<e.length?c+Jc:e.length,f=typeof e=="string"?this._stringDecoder.decode(e.substring(c,d),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,d),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,f))return this._preserveStack(r,i,f,c),this._logSlowResolvingAsync(n),n}else if(!s){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,c))return this._preserveStack(r,i,c,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let o=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(o,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,s=this._optionsService.rawOptions.screenReaderMode,o=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,d=this._curAttrData,f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&f.getWidth(this._activeBuffer.x-1)===2&&f.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let m=this._parser.precedingJoinState;for(let g=t;g<n;++g){if(r=e[g],r<127&&a){let w=a[String.fromCharCode(r)];w&&(r=w.charCodeAt(0))}let y=this._unicodeService.charProperties(r,m);i=Fd.extractWidth(y);let _=Fd.extractShouldJoin(y),S=_?Fd.extractWidth(m):0;if(m=y,s&&this._onA11yChar.fire(lu(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-S>o){if(l){let w=f,E=this._activeBuffer.x-S;for(this._activeBuffer.x=S,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),f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),S>0&&f instanceof wb&&f.copyCellsFrom(w,E,0,S,!1);E<o;)w.setCellFromCodepoint(E++,0,1,d)}else if(this._activeBuffer.x=o-1,i===2)continue}if(_&&this._activeBuffer.x){let w=f.getWidth(this._activeBuffer.x-1)?1:2;f.addCodepointToCell(this._activeBuffer.x-w,r,i);for(let E=i-S;--E>=0;)f.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(c&&(f.insertCells(this._activeBuffer.x,i-S,this._activeBuffer.getNullCell(d)),f.getWidth(o-1)===2&&f.setCellFromCodepoint(o-1,0,1,d)),f.setCellFromCodepoint(this._activeBuffer.x++,r,i,d),i>0)for(;--i;)f.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=m,this._activeBuffer.x<o&&n-t>0&&f.getWidth(this._activeBuffer.x)===0&&!f.hasContent(this._activeBuffer.x)&&f.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>I7(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new N7(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ds(t))}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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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(e){let t=e.params[0]||1;for(;t--;)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(ci));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=Fd.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),s=new Uint32Array(a.length*n),o=0;for(let c=0;c<a.length;){let d=a.codePointAt(c)||0;s[o++]=d,c+=d>65535?2:1}let l=o;for(let c=1;c<n;++c)s.copyWithin(l,0,o),l+=o;return this.print(s,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Me.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Me.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Me.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Me.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Me.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Ad),this._charsetService.setgCharset(1,Ad),this._charsetService.setgCharset(2,Ad),this._charsetService.setgCharset(3,Ad);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(_=>(_[_.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",_[_.SET=1]="SET",_[_.RESET=2]="RESET",_[_.PERMANENTLY_SET=3]="PERMANENTLY_SET",_[_.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,s=this._coreService,{buffers:o,cols:l}=this._bufferService,{active:c,alt:d}=o,f=this._optionsService.rawOptions,m=(_,S)=>(s.triggerDataEvent(`${Me.ESC}[${t?"":"?"}${_};${S}$y`),!0),g=_=>_?1:2,y=e.params[0];return t?y===2?m(y,4):y===4?m(y,g(s.modes.insertMode)):y===12?m(y,3):y===20?m(y,g(f.convertEol)):m(y,0):y===1?m(y,g(r.applicationCursorKeys)):y===3?m(y,f.windowOptions.setWinLines?l===80?2:l===132?1:0:0):y===6?m(y,g(r.origin)):y===7?m(y,g(r.wraparound)):y===8?m(y,3):y===9?m(y,g(i==="X10")):y===12?m(y,g(f.cursorBlink)):y===25?m(y,g(!s.isCursorHidden)):y===45?m(y,g(r.reverseWraparound)):y===66?m(y,g(r.applicationKeypad)):y===67?m(y,4):y===1e3?m(y,g(i==="VT200")):y===1002?m(y,g(i==="DRAG")):y===1003?m(y,g(i==="ANY")):y===1004?m(y,g(r.sendFocus)):y===1005?m(y,4):y===1006?m(y,g(a==="SGR")):y===1015?m(y,4):y===1016?m(y,g(a==="SGR_PIXELS")):y===1048?m(y,1):y===47||y===1047||y===1049?m(y,g(c===d)):y===2004?m(y,g(r.bracketedPasteMode)):y===2026?m(y,g(r.synchronizedOutput)):m(y,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=tv.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let s=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=s[o];while(++o<s.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let s=2;s<r.length;++s)r[s]===-1&&(r[s]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=ci.fg,e.bg=ci.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=ci.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=ci.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=ci.fg&16777215,r.bg&=-67108864,r.bg|=ci.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Me.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Me.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Me.ESC}[?${t};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ci.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(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!I7(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Me.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>R7&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>R7&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){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(e){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(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),i=n.shift();if(/^\d+$/.exec(r)){let a=parseInt(r);if(M7(a))if(i==="?")t.push({type:0,index:a});else{let s=A7(i);s&&t.push({type:1,index:a,color:s})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,i=n.findIndex(a=>a.startsWith("id="));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=A7(n[r]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let i=parseInt(n[r]);M7(i)&&t.push({type:2,index:i})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){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,Ad),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(ntt[e[0]],Ni[e[1]]||Ad),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=ci.clone(),this._eraseAttrDataInternal=ci.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Ys;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=s=>(this._coreService.triggerDataEvent(`${Me.ESC}${s}${Me.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},vI=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(D7=e,e=t,t=D7),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};vI=Kr([rt(0,Da)],vI);function M7(e){return 0<=e&&e<256}var itt=5e7,L7=12,att=50,stt=class extends dn{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Xe),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>itt)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],i=this._action(r,t);if(i){let s=o=>performance.now()-n>=L7?setTimeout(()=>this._innerWrite(0,o)):this._innerWrite(n,o);i.catch(o=>(queueMicrotask(()=>{throw o}),Promise.resolve(!1))).then(s);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=L7)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>att&&(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()}},_I=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let o=t.addMarker(t.ybase+t.y),l={data:e,id:this._nextId++,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._dataByLinkId.set(l.id,l),l.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),s={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(s,a)),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};_I=Kr([rt(0,Da)],_I);var P7=!1,ott=class extends dn{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Hp),this._onBinary=this._register(new Xe),this.onBinary=this._onBinary.event,this._onData=this._register(new Xe),this.onData=this._onData.event,this._onLineFeed=this._register(new Xe),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Xe),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Xe),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Xe),this._instantiationService=new Iet,this.optionsService=this._register(new Uet(e)),this._instantiationService.setService(Ma,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(mI)),this._instantiationService.setService(Da,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(pI)),this._instantiationService.setService(Yoe,this._logService),this.coreService=this._register(this._instantiationService.createInstance(gI)),this._instantiationService.setService(jh,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(bI)),this._instantiationService.setService(Voe,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Fd)),this._instantiationService.setService(CQe,this.unicodeService),this._charsetService=this._instantiationService.createInstance(qet),this._instantiationService.setService(EQe,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(_I),this._instantiationService.setService(Koe,this._oscLinkService),this._inputHandler=this._register(new rtt(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Qi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Qi.forward(this._bufferService.onResize,this._onResize)),this._register(Qi.forward(this.coreService.onData,this._onData)),this._register(Qi.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new stt((t,n)=>this._inputHandler.parse(t,n))),this._register(Qi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Xe),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!P7&&(this._logService.warn("writeSync is unreliable and will be removed soon."),P7=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,kle),t=Math.max(t,Nle),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(k7.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(k7(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Rr(()=>{for(let t of e)t.dispose()})}}},ltt={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function ctt(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?i.key=Me.ESC+"OA":i.key=Me.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=Me.ESC+"OD":i.key=Me.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=Me.ESC+"OC":i.key=Me.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=Me.ESC+"OB":i.key=Me.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":Me.DEL,e.altKey&&(i.key=Me.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Me.ESC+"[Z";break}i.key=Me.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Me.ESC+Me.CR:Me.CR,i.cancel=!0;break;case 27:i.key=Me.ESC,e.altKey&&(i.key=Me.ESC+Me.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=Me.ESC+"[1;"+(a+1)+"D":t?i.key=Me.ESC+"OD":i.key=Me.ESC+"[D";break;case 39:if(e.metaKey)break;a?i.key=Me.ESC+"[1;"+(a+1)+"C":t?i.key=Me.ESC+"OC":i.key=Me.ESC+"[C";break;case 38:if(e.metaKey)break;a?i.key=Me.ESC+"[1;"+(a+1)+"A":t?i.key=Me.ESC+"OA":i.key=Me.ESC+"[A";break;case 40:if(e.metaKey)break;a?i.key=Me.ESC+"[1;"+(a+1)+"B":t?i.key=Me.ESC+"OB":i.key=Me.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Me.ESC+"[2~");break;case 46:a?i.key=Me.ESC+"[3;"+(a+1)+"~":i.key=Me.ESC+"[3~";break;case 36:a?i.key=Me.ESC+"[1;"+(a+1)+"H":t?i.key=Me.ESC+"OH":i.key=Me.ESC+"[H";break;case 35:a?i.key=Me.ESC+"[1;"+(a+1)+"F":t?i.key=Me.ESC+"OF":i.key=Me.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=Me.ESC+"[5;"+(a+1)+"~":i.key=Me.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=Me.ESC+"[6;"+(a+1)+"~":i.key=Me.ESC+"[6~";break;case 112:a?i.key=Me.ESC+"[1;"+(a+1)+"P":i.key=Me.ESC+"OP";break;case 113:a?i.key=Me.ESC+"[1;"+(a+1)+"Q":i.key=Me.ESC+"OQ";break;case 114:a?i.key=Me.ESC+"[1;"+(a+1)+"R":i.key=Me.ESC+"OR";break;case 115:a?i.key=Me.ESC+"[1;"+(a+1)+"S":i.key=Me.ESC+"OS";break;case 116:a?i.key=Me.ESC+"[15;"+(a+1)+"~":i.key=Me.ESC+"[15~";break;case 117:a?i.key=Me.ESC+"[17;"+(a+1)+"~":i.key=Me.ESC+"[17~";break;case 118:a?i.key=Me.ESC+"[18;"+(a+1)+"~":i.key=Me.ESC+"[18~";break;case 119:a?i.key=Me.ESC+"[19;"+(a+1)+"~":i.key=Me.ESC+"[19~";break;case 120:a?i.key=Me.ESC+"[20;"+(a+1)+"~":i.key=Me.ESC+"[20~";break;case 121:a?i.key=Me.ESC+"[21;"+(a+1)+"~":i.key=Me.ESC+"[21~";break;case 122:a?i.key=Me.ESC+"[23;"+(a+1)+"~":i.key=Me.ESC+"[23~";break;case 123:a?i.key=Me.ESC+"[24;"+(a+1)+"~":i.key=Me.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Me.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Me.DEL:e.keyCode===219?i.key=Me.ESC:e.keyCode===220?i.key=Me.FS:e.keyCode===221&&(i.key=Me.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let s=ltt[e.keyCode]?.[e.shiftKey?1:0];if(s)i.key=Me.ESC+s;else if(e.keyCode>=65&&e.keyCode<=90){let o=e.ctrlKey?e.keyCode-64:e.keyCode+32,l=String.fromCharCode(o);e.shiftKey&&(l=l.toUpperCase()),i.key=Me.ESC+l}else if(e.keyCode===32)i.key=Me.ESC+(e.ctrlKey?Me.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let o=e.code.slice(3,4);e.shiftKey||(o=o.toLowerCase()),i.key=Me.ESC+o,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=Me.US),e.key==="@"&&(i.key=Me.NUL));break}return i}var Jr=0,utt=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Rw,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Rw,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((i,a)=>this._getKey(i)-this._getKey(a)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Jr=this._search(t),Jr===-1)||this._getKey(this._array[Jr])!==t)return!1;do if(this._array[Jr]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Jr),!0;while(++Jr<this._array.length&&this._getKey(this._array[Jr])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,a)=>i-a),t=0,n=new Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Jr=this._search(e),!(Jr<0||Jr>=this._array.length)&&this._getKey(this._array[Jr])===e))do yield this._array[Jr];while(++Jr<this._array.length&&this._getKey(this._array[Jr])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Jr=this._search(e),!(Jr<0||Jr>=this._array.length)&&this._getKey(this._array[Jr])===e))do t(this._array[Jr]);while(++Jr<this._array.length&&this._getKey(this._array[Jr])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},oA=0,B7=0,dtt=class extends dn{constructor(){super(),this._decorations=new utt(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Xe),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Xe),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Rr(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new htt(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??"bottom")===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,i=>{oA=i.options.x??0,B7=oA+(i.options.width??1),e>=oA&&e<B7&&(!n||(i.options.layer??"bottom")===n)&&r(i)})}},htt=class extends _u{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Xe),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Xe),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Lr.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Lr.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},ftt=1e3,ptt=class{constructor(e,t=ftt){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=r-this._lastRefreshMs,a=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},a)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},j7=20,Iw=class extends dn{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let a=0;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);if(this._topBoundaryFocusListener=a=>this._handleBoundaryFocus(a,0),this._bottomBoundaryFocusListener=a=>this._handleBoundaryFocus(a,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new ptt(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(a=>this._handleResize(a.rows))),this._register(this._terminal.onRender(a=>this._refreshRows(a.start,a.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(a=>this._handleChar(a))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
420
420
|
`))),this._register(this._terminal.onA11yTab(a=>this._handleTab(a))),this._register(this._terminal.onKey(a=>this._handleKey(a.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ft(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Rr(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<j7+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
421
421
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===j7+1&&(this._liveRegion.textContent+=$R.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let a=n.lines.get(n.ydisp+i),s=[],o=a?.translateToString(!0,void 0,void 0,s)||"",l=(n.ydisp+i+1).toString(),c=this._rowElements[i];c&&(o.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=o,this._rowColumns.set(c,s)),c.setAttribute("aria-posinset",l),c.setAttribute("aria-setsize",r),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],i=n.getAttribute("aria-posinset"),a=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===a||e.relatedTarget!==r)return;let s,o;if(t===0?(s=n,o=this._rowElements.pop(),this._rowContainer.removeChild(o)):(s=this._rowElements.shift(),o=n,this._rowContainer.removeChild(s)),s.removeEventListener("focus",this._topBoundaryFocusListener),o.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:o,offset:l})=>{let c=o instanceof Text?o.parentNode:o,d=parseInt(c?.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(c);if(!f)return console.warn("columns is null. Race condition?"),null;let m=l<f.length?f[l]:f.slice(-1)[0]+1;return m>=this._terminal.cols&&(++d,m=0),{row:d,column:m}},a=i(t),s=i(n);if(!(!a||!s)){if(a.row>s.row||a.row===s.row&&a.column>=s.column)throw new Error("invalid range");this._terminal.select(a.column,a.row,(s.row-a.row)*this._terminal.cols-a.column+s.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Iw=Kr([rt(1,Ej),rt(2,wc),rt(3,Ec)],Iw);var xI=class extends dn{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Xe),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Xe),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Rr(()=>{ph(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ft(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ft(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ft(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ft(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let i=n[r];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(r=>{r?.forEach(i=>{i.link.dispose&&i.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,a=>{if(this._isMouseOut)return;let s=a?.map(o=>({link:o}));this._activeProviderReplies?.set(r,s),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let a=0;a<i.length;a++){let s=i[a],o=s.link.range.start.y<e?0:s.link.range.start.x,l=s.link.range.end.y>e?this._bufferService.cols:s.link.range.end.x;for(let c=o;c<=l;c++){if(n.has(c)){i.splice(a--,1);break}n.add(c)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let a=0;a<e;a++)(!this._activeProviderReplies.has(a)||this._activeProviderReplies.get(a))&&(i=!0);if(!i&&r){let a=r.find(s=>this._linkAtPosition(s.link,t));a&&(n=!0,this._handleNewLink(a))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let a=0;a<this._activeProviderReplies.size;a++){let s=this._activeProviderReplies.get(a)?.find(o=>this._linkAtPosition(o.link,t));if(s){n=!0,this._handleNewLink(s);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&mtt(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ph(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(r,i),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};xI=Kr([rt(1,Cj),rt(2,Ec),rt(3,Da),rt(4,Zoe)],xI);function mtt(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var gtt=class extends ott{constructor(e={}){super(e),this._linkifier=this._register(new Hp),this.browser=gle,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Hp),this._onCursorMove=this._register(new Xe),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Xe),this.onKey=this._onKey.event,this._onRender=this._register(new Xe),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Xe),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Xe),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Xe),this.onBell=this._onBell.event,this._onFocus=this._register(new Xe),this._onBlur=this._register(new Xe),this._onA11yCharEmitter=this._register(new Xe),this._onA11yTabEmitter=this._register(new Xe),this._onWillOpen=this._register(new Xe),this._setup(),this._decorationService=this._instantiationService.createInstance(dtt),this._instantiationService.setService(nv,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ret),this._instantiationService.setService(Zoe,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(zR)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Qi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Qi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Qi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Qi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Rr(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let i=Er.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${Me.ESC}]${r};${ttt(i)}${ple.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(a=>a.ansi[t.index]=di.toColor(...t.color));else{let a=n;this._themeService.modifyColors(s=>s[a]=di.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Iw,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Me.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Me.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,s=this.buffer.y*this._renderService.dimensions.css.cell.height,o=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=o+"px",this.textarea.style.top=s+"px",this.textarea.style.width=a+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ft(this.element,"copy",t=>{this.hasSelection()&&yQe(t,this._selectionService)}));let e=t=>vQe(t,this.textarea,this.coreService,this.optionsService);this._register(Ft(this.textarea,"paste",e)),this._register(Ft(this.element,"paste",e)),ble?this._register(Ft(this.element,"mousedown",t=>{t.button===2&&Y9(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ft(this.element,"contextmenu",t=>{Y9(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Dj&&this._register(Ft(this.element,"auxclick",t=>{t.button===1&&zoe(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ft(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ft(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ft(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ft(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ft(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ft(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ft(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Ft(this.screenElement,"mousemove",i=>this.updateCursorStyle(i))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",FR.get()),_le||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(tet,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(wc,this._coreBrowserService),this._register(Ft(this.textarea,"focus",i=>this._handleTextAreaFocus(i))),this._register(Ft(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(cI,this._document,this._helperContainer),this._instantiationService.setService(q1,this._charSizeService),this._themeService=this._instantiationService.createInstance(fI),this._instantiationService.setService(Om,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Nw),this._instantiationService.setService(Xoe,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(dI,this.rows,this.screenElement)),this._instantiationService.setService(Ec,this._renderService),this._register(this._renderService.onRenderedViewportChange(i=>this._onRender.fire(i))),this.onResize(i=>this._renderService.resize(i.cols,i.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(sI,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(uI),this._instantiationService.setService(Cj,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(xI,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(iI,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(i=>{super.scrollLines(i,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(hI,this.element,this.screenElement,r)),this._instantiationService.setService(kQe,this._selectionService),this._register(this._selectionService.onRequestScrollLines(i=>this.scrollLines(i.amount,i.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(i=>this._renderService.handleSelectionChanged(i.start,i.end,i.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(i=>{this.textarea.value=i,this.textarea.focus(),this.textarea.select()})),this._register(Qi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(aI,this.screenElement)),this._register(Ft(this.element,"mousedown",i=>this._selectionService.handleMouseDown(i))),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(Iw,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",i=>this._handleScreenReaderModeOptionChange(i))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(kw,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",i=>{!this._overviewRulerRenderer&&i&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(kw,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(lI,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(a){let s=e._mouseService.getMouseReportCoords(a,e.screenElement);if(!s)return!1;let o,l;switch(a.overrideType||a.type){case"mousemove":l=32,a.buttons===void 0?(o=3,a.button!==void 0&&(o=a.button<3?a.button:3)):o=a.buttons&1?0:a.buttons&4?1:a.buttons&2?2:3;break;case"mouseup":l=0,o=a.button<3?a.button:3;break;case"mousedown":l=1,o=a.button<3?a.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(a)===!1)return!1;let c=a.deltaY;if(c===0||e.coreMouseService.consumeWheelEvent(a,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;l=c<0?0:1,o=4;break;default:return!1}return l===void 0||o===void 0||o>4?!1:e.coreMouseService.triggerMouseEvent({col:s.col,row:s.row,x:s.x,y:s.y,button:o,action:l,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:a=>(n(a),a.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(a)),wheel:a=>(n(a),this.cancel(a,!0)),mousedrag:a=>{a.buttons&&n(a)},mousemove:a=>{a.buttons||n(a)}};this._register(this.coreMouseService.onProtocolChange(a=>{a?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(a)),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()),a&8?r.mousemove||(t.addEventListener("mousemove",i.mousemove),r.mousemove=i.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),a&16?r.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),r.wheel=i.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),a&2?r.mouseup||(r.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),a&4?r.mousedrag||(r.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ft(t,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return n(a),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(a)})),this._register(Ft(t,"wheel",a=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(a)===!1)return!1;if(!this.buffer.hasScrollback){if(a.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(a,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(a,!0);let s=Me.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(a.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(s,!0),this.cancel(a,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Uoe(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=ctt(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Me.ETX||n.key===Me.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(btt(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(ci));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(Me.ESC+"[I"):this.coreService.triggerDataEvent(Me.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Me.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Me.ESC}[6;${i};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function btt(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var ytt=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},vtt=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Ys)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},F7=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new vtt(t)}getNullCell(){return new Ys}},_tt=class extends dn{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Xe),this.onBufferChange=this._onBufferChange.event,this._normal=new F7(this._core.buffers.normal,"normal"),this._alternate=new F7(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)}},xtt=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},Stt=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},wtt=["cols","rows"],Go=0,cbt=class extends dn{constructor(e){super(),this._core=this._register(new gtt(e)),this._addonManager=this._register(new ytt),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,i)=>{this._checkReadonlyOptions(r),this._core.options[r]=i};for(let r in this._core.options){let i={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,i)}}_checkReadonlyOptions(e){if(wtt.includes(e))throw new Error(`Option "${e}" 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 xtt(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Stt(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 _tt(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
422
|
-
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return FR.get()},set promptLabel(e){FR.set(e)},get tooMuchOutput(){return $R.get()},set tooMuchOutput(e){$R.set(e)}}}_verifyIntegers(...e){for(Go of e)if(Go===1/0||isNaN(Go)||Go%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Go of e)if(Go&&(Go===1/0||isNaN(Go)||Go%1!==0||Go<0))throw new Error("This API only accepts positive integers")}};function Ett({workspaceId:e,sessions:t,selectedSessionId:n,sessionSummariesById:r,isCreatingSession:i,isDeletingSession:a,onSelectSession:s,onCreateSession:o,onCloseSession:l,children:c,maxSessions:d,hasWorktreePath:f,selectedProvider:m,setSelectedProvider:g}){const y=t&&t.length===0;return h.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[h.jsx("div",{className:"border-b flex-shrink-0",children:h.jsx(cKe,{sessions:t,currentSessionId:n,sessionSummariesById:r,onSelectSession:s,onCreateSession:o,onCloseSession:l,disabled:i||a||!f,maxSessions:d,selectedProvider:m,setSelectedProvider:g})}),h.jsx(eKe,{workspaceId:e,className:"flex-1 min-h-0",children:y?h.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:h.jsxs("div",{className:"max-w-md w-full space-y-6 text-center",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx("h2",{className:"text-2xl font-semibold",children:"Start a Session"}),h.jsx("p",{className:"text-muted-foreground",children:"Click the + button above to start a new chat session in this workspace."})]}),!f&&h.jsx("div",{className:"bg-yellow-50 border border-yellow-200 text-yellow-800 px-4 py-3 rounded-md text-sm",children:"Workspace is initializing... Please wait for the worktree to be created."})]})}):c})]})}const Ctt={NEW:{icon:HA,label:"Pending",variant:"outline"},PROVISIONING:{icon:un,label:"Setting up",variant:"secondary",iconClassName:"animate-spin"},FAILED:{icon:Xs,label:"Setup failed",variant:"destructive"}};function Mj({status:e,errorMessage:t,className:n}){if(e==="READY"||e==="ARCHIVED")return null;const r=Ctt[e],i=r.icon,a=h.jsxs(gn,{variant:r.variant,className:ne("gap-1 text-xs whitespace-nowrap shrink-0",n),children:[h.jsx(i,{className:ne("h-3 w-3",r.iconClassName)}),r.label]});return e==="FAILED"&&t?h.jsx(Uu,{children:h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:a}),h.jsx(er,{side:"top",className:"max-w-[300px]",children:h.jsx("p",{className:"text-xs",children:t})})]})}):a}function Lj(e){return{...e,sessionSummaries:[],agentSessions:[],terminalSessions:[],sidebarStatus:{activityState:"IDLE",ciState:"NONE"},ratchetButtonAnimated:!1,flowPhase:"NO_PR",ciObservation:"NOT_FETCHED"}}const $7=["tiger","falcon","otter","panda","wolf","fox","bear","hawk","owl","raven","dolphin","eagle","lynx","cobra","jaguar","panther","phoenix","dragon","griffin","sphinx","nova","comet","nebula","quasar","pulsar","orbit","cosmos","stellar","lunar","solar","thunder","blaze","frost","storm","ember","crystal","aurora","summit","canyon","ridge","pixel","vector","cipher","spark","pulse","flux","apex","vertex","nexus","prism"];function Ttt(){return $7[Math.floor(Math.random()*$7.length)]??"workspace"}function Pj(e){const t=Ttt();if(!e.includes(t))return t;let n=2;const r=1e3;for(;n<r&&e.includes(`${t}-${n}`);)n++;return`${t}-${n}`}function Rle(e,t,n){const r=to(),i=Ce.useUtils(),[a,s]=v.useState(!1),o=Ce.workspace.create.useMutation(),{data:l}=Ce.workspace.list.useQuery({projectId:e??""},{enabled:!!e&&n===void 0}),c=n??l?.map(f=>f.name)??[];return{handleCreate:async f=>{if(!e||a)return;const m=f??Pj(c);s(!0);try{const g=await o.mutateAsync({type:"MANUAL",projectId:e,name:m});i.workspace.get.setData({id:g.id},y=>y||Lj(g)),i.workspace.list.invalidate({projectId:e}),i.workspace.getProjectSummaryState.invalidate({projectId:e}),s(!1),r(`/projects/${t}/workspaces/${g.id}`)}catch(g){s(!1);const y=g instanceof Error?g.message:"Unknown error";throw Qt.error(`Failed to create workspace: ${y}`),g}},isCreating:a,existingNames:c}}function Ile(e,t){return{id:e.workspaceId,name:e.name,status:e.status,createdAt:new Date(e.createdAt),branchName:e.branchName,prUrl:e.prUrl,prNumber:e.prNumber,prState:e.prState,prCiStatus:e.prCiStatus,ratchetEnabled:e.ratchetEnabled,ratchetState:e.ratchetState,runScriptStatus:e.runScriptStatus,kanbanColumn:e.kanbanColumn,isWorking:e.isWorking,ratchetButtonAnimated:e.ratchetButtonAnimated,flowPhase:e.flowPhase,pendingRequestType:e.pendingRequestType,isArchived:!1,description:t?.description??null,initErrorMessage:t?.initErrorMessage??null,githubIssueNumber:t?.githubIssueNumber??null}}function ktt(e){return e==="SUCCESS"?"PASSING":e==="FAILURE"?"FAILING":e==="PENDING"?"RUNNING":"UNKNOWN"}function Ntt(e){return!e||e.length===0?"NONE":e.some(r=>r.conclusion==="FAILURE")?"FAILING":e.some(r=>r.status!=="COMPLETED"||r.conclusion===null)?"RUNNING":"PASSING"}function Att(e){switch(e){case"PASSING":return"CI Passing";case"FAILING":return"CI Failing";case"RUNNING":return"CI Running";case"UNKNOWN":return"CI Unknown";case"NONE":return"No checks"}}function Ole(e){const t=e.isWorking?"WORKING":"IDLE";if(!e.prUrl)return{activityState:t,ciState:"NONE"};if(e.prState==="MERGED"||e.ratchetState==="MERGED")return{activityState:t,ciState:"MERGED"};const n=ktt(e.prCiStatus);if(n==="UNKNOWN"){if(e.ratchetState==="CI_FAILED")return{activityState:t,ciState:"FAILING"};if(e.ratchetState==="CI_RUNNING")return{activityState:t,ciState:"RUNNING"}}return{activityState:t,ciState:n}}function Rtt(e){return e==="WORKING"?"Claude is working":"Claude is idle"}function Itt(e){switch(e){case"NONE":return"No PR";case"RUNNING":return"CI Running";case"FAILING":return"CI Failing";case"PASSING":return"CI Passing";case"UNKNOWN":return"CI Unknown";case"MERGED":return"Merged"}}function U7(e,t){return e==="RUNNING"?"CI checks are running":e==="FAILING"?"CI checks are failing":e==="PASSING"?"CI checks are passing":e==="MERGED"?"PR is merged":e==="UNKNOWN"?t==="CLOSED"?"PR is closed":"CI status is unknown":"No PR attached"}function Ott(e,t){return t==="CLOSED"?" · Closed":e==="MERGED"?" · Merged":e==="FAILING"?" · CI failing":e==="RUNNING"?" · CI running":e==="PASSING"?" · CI passing":""}const Dtt={NEW:"NEW",PROVISIONING:"PROVISIONING",READY:"READY",FAILED:"FAILED",ARCHIVED:"ARCHIVED"},Dle={IDLE:"IDLE",RUNNING:"RUNNING",PAUSED:"PAUSED",COMPLETED:"COMPLETED",FAILED:"FAILED"},Mle={NONE:"NONE",DRAFT:"DRAFT",OPEN:"OPEN",CHANGES_REQUESTED:"CHANGES_REQUESTED",APPROVED:"APPROVED",MERGED:"MERGED",CLOSED:"CLOSED"},Lle={UNKNOWN:"UNKNOWN",PENDING:"PENDING",SUCCESS:"SUCCESS",FAILURE:"FAILURE"},Ple={WORKING:"WORKING",WAITING:"WAITING",DONE:"DONE"},Ble={IDLE:"IDLE",CI_RUNNING:"CI_RUNNING",CI_FAILED:"CI_FAILED",REVIEW_PENDING:"REVIEW_PENDING",READY:"READY",MERGED:"MERGED"},Mtt={MANUAL:"MANUAL",RESUME_BRANCH:"RESUME_BRANCH",GITHUB_ISSUE:"GITHUB_ISSUE"},jle={IDLE:"IDLE",STARTING:"STARTING",RUNNING:"RUNNING",STOPPING:"STOPPING",COMPLETED:"COMPLETED",FAILED:"FAILED"},Ltt=nn({code:hi().nullable(),timestamp:ke(),unexpected:Ui()}),Ptt=nn({sessionId:ke(),name:ke().nullable(),workflow:ke().nullable(),model:ke().nullable(),provider:qr(["CLAUDE","CODEX"]).optional(),persistedStatus:jf(Dle),runtimePhase:qr(["loading","starting","running","idle","stopping","error"]),processState:qr(["unknown","alive","stopped"]),activity:qr(["WORKING","IDLE"]),updatedAt:ke(),lastExit:Ltt.nullable()}),Btt=nn({total:hi(),additions:hi(),deletions:hi(),hasUncommitted:Ui()}),jtt=nn({activityState:qr(["WORKING","IDLE"]),ciState:qr(["NONE","RUNNING","FAILING","PASSING","UNKNOWN","MERGED"])}),Fle=nn({workspaceId:ke(),projectId:ke(),version:hi(),computedAt:ke(),source:ke(),name:ke(),status:ke(),createdAt:ke(),branchName:ke().nullable(),prUrl:ke().nullable(),prNumber:hi().nullable(),prState:jf(Mle),prCiStatus:jf(Lle),prUpdatedAt:ke().nullable(),ratchetEnabled:Ui(),ratchetState:jf(Ble),runScriptStatus:jf(jle),hasHadSessions:Ui(),isWorking:Ui(),pendingRequestType:qr(["plan_approval","user_question"]).nullable(),sessionSummaries:Ya(Ptt),gitStats:Btt.nullable(),lastActivityAt:ke().nullable(),sidebarStatus:jtt,kanbanColumn:jf(Ple).nullable(),flowPhase:qr(["NO_PR","CI_WAIT","RATCHET_VERIFY","RATCHET_FIXING","READY","MERGED"]).nullable(),ciObservation:qr(["NOT_FETCHED","NO_CHECKS","CHECKS_PENDING","CHECKS_FAILED","CHECKS_PASSED","CHECKS_UNKNOWN"]).nullable(),ratchetButtonAnimated:Ui(),fieldTimestamps:im(ke(),hi())}),Ftt=nn({type:Pr("snapshot_full"),projectId:ke(),entries:Ya(Fle)}),$tt=nn({type:Pr("snapshot_changed"),workspaceId:ke(),entry:Fle}),Utt=nn({type:Pr("snapshot_removed"),workspaceId:ke()}),ztt=_O("type",[Ftt,$tt,Utt]);function lA(e){return{id:e.workspaceId,name:e.name,createdAt:new Date(e.createdAt),branchName:e.branchName,prUrl:e.prUrl,prNumber:e.prNumber,prState:e.prState,prCiStatus:e.prCiStatus,isWorking:e.isWorking,sessionSummaries:e.sessionSummaries,gitStats:e.gitStats,lastActivityAt:e.lastActivityAt,ratchetEnabled:e.ratchetEnabled,ratchetState:e.ratchetState,sidebarStatus:e.sidebarStatus,ratchetButtonAnimated:e.ratchetButtonAnimated,flowPhase:e.flowPhase,ciObservation:e.ciObservation,runScriptStatus:e.runScriptStatus,pendingRequestType:e.pendingRequestType,cachedKanbanColumn:e.kanbanColumn,stateComputedAt:e.computedAt}}function Htt(e,t){const n=new Map;if(t)for(const r of t){const i=r.id;n.set(i,r)}return e.filter(r=>r.kanbanColumn!==null).map(r=>Ile(r,n.get(r.workspaceId)))}function Wtt(e,t){if(e.kanbanColumn===null)return t&&t.filter(s=>s.id!==e.workspaceId);const n=t?.find(s=>s.id===e.workspaceId),r=Ile(e,n);if(!t)return[r];const i=t.findIndex(s=>s.id===e.workspaceId),a=[...t];return i>=0?a[i]=r:a.push(r),a}function Gtt(e,t){return t&&t.filter(n=>n.id!==e)}function z7(e,t){return e&&{...e,prUrl:t.prUrl,prNumber:t.prNumber,prState:t.prState,prCiStatus:t.prCiStatus,ratchetEnabled:t.ratchetEnabled,ratchetState:t.ratchetState,runScriptStatus:t.runScriptStatus,isWorking:t.isWorking,pendingRequestType:t.pendingRequestType,sessionSummaries:t.sessionSummaries,sidebarStatus:t.sidebarStatus,ratchetButtonAnimated:t.ratchetButtonAnimated,flowPhase:t.flowPhase,ciObservation:t.ciObservation}}function qtt(e){const t=Ce.useUtils(),n=e?$1("/snapshots",{projectId:e}):null,r=v.useCallback(i=>{const a=ztt.safeParse(i);if(!a.success)return;const s=a.data,{setData:o}=t.workspace.getProjectSummaryState,{setData:l}=t.workspace.listWithKanbanState,{setData:c}=t.workspace.get;switch(s.type){case"snapshot_full":{o({projectId:s.projectId},(d=>({workspaces:s.entries.map(lA),reviewCount:d?.reviewCount??0}))),l({projectId:s.projectId},(d=>Htt(s.entries,d)));for(const d of s.entries)c({id:d.workspaceId},(f=>z7(f,d)));t.workspace.list.invalidate({projectId:s.projectId});break}case"snapshot_changed":{if(!e)break;o({projectId:e},(d=>{if(!d)return{workspaces:[lA(s.entry)],reviewCount:0};const f=lA(s.entry),m=d.workspaces.findIndex(y=>y.id===f.id),g=[...d.workspaces];return m>=0?g[m]=f:g.push(f),{workspaces:g,reviewCount:d.reviewCount}})),l({projectId:e},(d=>Wtt(s.entry,d))),c({id:s.entry.workspaceId},(d=>z7(d,s.entry))),t.workspace.list.invalidate({projectId:e});break}case"snapshot_removed":{if(!e)break;o({projectId:e},(d=>d&&{workspaces:d.workspaces.filter(f=>f.id!==s.workspaceId),reviewCount:d.reviewCount})),l({projectId:e},(d=>Gtt(s.workspaceId,d))),c({id:s.workspaceId},void 0),t.workspace.list.invalidate({projectId:e});break}}},[e,t]);U1({url:n,onMessage:r,queuePolicy:"drop"})}const H7=3e4;function Vtt(){const[e,t]=v.useState(new Map);v.useEffect(()=>{const i=a=>{const{workspaceId:s}=a.detail,o=Date.now();t(l=>{const c=new Map(l);return c.set(s,o),c})};return window.addEventListener("workspace-attention-required",i),()=>{window.removeEventListener("workspace-attention-required",i)}},[]),v.useEffect(()=>{const i=setInterval(()=>{const a=Date.now();t(s=>{const o=new Map(s);let l=!1;for(const[c,d]of o.entries())a-d>H7&&(o.delete(c),l=!0);return l?o:s})},1e3);return()=>clearInterval(i)},[]);const n=v.useCallback(i=>{const a=e.get(i);return a?Date.now()-a<H7:!1},[e]),r=v.useCallback(i=>{t(a=>{if(!a.has(i))return a;const s=new Map(a);return s.delete(i),s})},[]);return{needsAttention:n,clearAttention:r}}function Ytt(){const{setTheme:e}=SE(),[t,n]=v.useState(!1);return v.useEffect(()=>{n(!0)},[]),t?h.jsxs(K0,{children:[h.jsx(X0,{asChild:!0,children:h.jsxs(We,{variant:"ghost",size:"icon",children:[h.jsx(zk,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),h.jsx(dU,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),h.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),h.jsxs(Im,{align:"end",children:[h.jsxs(hp,{onClick:()=>e("light"),children:[h.jsx(zk,{className:"mr-2 h-4 w-4"}),"Light"]}),h.jsxs(hp,{onClick:()=>e("dark"),children:[h.jsx(dU,{className:"mr-2 h-4 w-4"}),"Dark"]}),h.jsxs(hp,{onClick:()=>e("system"),children:[h.jsx(A_e,{className:"mr-2 h-4 w-4"}),"System"]})]})]}):h.jsxs(We,{variant:"ghost",size:"icon",disabled:!0,children:[h.jsx(zk,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}function W7(e){if(e instanceof Date)return e.getTime();const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function G7(e,t){const n=W7(t.createdAt)-W7(e.createdAt);if(n!==0)return n;const r=e.name.localeCompare(t.name);return r!==0?r:e.id.localeCompare(t.id)}function Ktt(e,t){if(!t||t.length===0)return[...e].sort(G7);const n=new Map(t.map((a,s)=>[a,s])),r=[],i=[];for(const a of e)n.has(a.id)?r.push(a):i.push(a);return r.sort((a,s)=>(n.get(a.id)??0)-(n.get(s.id)??0)),i.sort(G7),[...i,...r]}function Xtt(e,t={}){const{customOrder:n}=t,[r,i]=v.useState(null),[a,s]=v.useState(new Map),o=r?e?.some(y=>y.name===r.name):!1,l=v.useMemo(()=>{const y=[];if(r&&!o&&y.push({id:`creating-${r.name}`,name:r.name,createdAt:new Date().toISOString(),branchName:null,prUrl:null,prNumber:null,prState:null,prCiStatus:null,ratchetEnabled:!1,isWorking:!1,gitStats:null,uiState:"creating"}),e){const _=Ktt(e,n);for(const S of _){const w=a.has(S.id);y.push({...S,uiState:w?"archiving":"normal"})}}return y},[e,r,o,a,n]);v.useEffect(()=>{r&&o&&i(null)},[r,o]),v.useEffect(()=>{if(a.size===0)return;const y=[];for(const[S]of a)e?.some(E=>E.id===S)||y.push(S);if(y.length===0)return;const _=setTimeout(()=>{s(S=>{const w=new Map(S);for(const E of y)w.delete(E);return w})},300);return()=>clearTimeout(_)},[a,e]);const c=v.useMemo(()=>{const y=e?.map(_=>_.name)??[];return r?.name&&y.push(r.name),y},[e,r?.name]),d=v.useCallback(y=>{i({name:y})},[]),f=v.useCallback(()=>{i(null)},[]),m=v.useCallback(y=>{const _=e?.find(S=>S.id===y);_&&s(S=>{const w=new Map(S);return w.set(y,{id:_.id,name:_.name,branchName:_.branchName}),w})},[e]),g=v.useCallback(y=>{if(!y){s(new Map);return}s(_=>{if(!_.has(y))return _;const S=new Map(_);return S.delete(y),S})},[]);return{workspaceList:l,existingNames:c,isCreating:!!r,startCreating:d,cancelCreating:f,startArchiving:m,cancelArchiving:g}}function Ztt(e){switch(e){case"PASSING":return{className:"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300",Icon:fl};case"FAILING":return{className:"bg-red-500/15 text-red-700 dark:text-red-300",Icon:uy};case"RUNNING":return{className:"bg-yellow-500/15 text-yellow-700 dark:text-yellow-300",Icon:oc};case"UNKNOWN":return{className:"bg-muted text-muted-foreground",Icon:oc};case"MERGED":return{className:"bg-purple-500/15 text-purple-700 dark:text-purple-300",Icon:fl};case"NONE":return{className:"bg-transparent text-muted-foreground",Icon:oc}}}function Bj({ciState:e,prState:t,size:n="sm",className:r}){if(e==="NONE")return null;const i=Ztt(e),{Icon:a}=i,s=n==="sm"?"text-[10px] px-1.5 py-0.5":"text-xs px-2 py-0.5",o=n==="sm"?"h-2.5 w-2.5":"h-3 w-3";return h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsxs("button",{type:"button","aria-label":U7(e,t??null),className:ne("inline-flex w-fit items-center gap-1 rounded-sm font-medium uppercase tracking-wide cursor-default",s,i.className,r),children:[h.jsx(a,{className:ne(o,e==="RUNNING"&&"animate-pulse")}),h.jsx("span",{children:Itt(e)})]})}),h.jsx(er,{side:"right",children:U7(e,t??null)})]})}function Qtt(){return h.jsx(y0,{children:h.jsx(v0,{size:"lg",className:"h-auto px-2 py-2 cursor-default",children:h.jsxs("div",{className:"flex items-center gap-1.5 w-full min-w-0",children:[h.jsx("div",{className:"w-4 shrink-0","aria-hidden":"true"}),h.jsx("div",{className:"h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-foreground/40 border-t-foreground"}),h.jsx("span",{className:"truncate text-sm",children:"Creating..."})]})})})}function $le({workspace:e,selectedProjectSlug:t,sortableRef:n,sortableStyle:r}){return h.jsx(y0,{ref:n,style:r,children:h.jsx(v0,{asChild:!0,className:"h-auto px-2 py-2 opacity-50 pointer-events-none",children:h.jsx(Ar,{to:`/projects/${t}/workspaces/${e.id}`,children:h.jsxs("div",{className:"flex items-center gap-1.5 w-full min-w-0",children:[h.jsx("div",{className:"w-4 shrink-0","aria-hidden":"true"}),h.jsx("div",{className:"h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-muted-foreground/40 border-t-muted-foreground"}),h.jsx("span",{className:"truncate text-sm text-muted-foreground",children:"Archiving..."})]})})})})}function Ule({workspace:e,isActive:t,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:i,disableRatchetAnimation:a,needsAttention:s,clearAttention:o,sortableRef:l,sortableStyle:c,sortableAttributes:d,sortableListeners:f,isDragging:m,hideDragHandle:g}){const y=Ce.useUtils(),_=Ce.workspace.toggleRatcheting.useMutation({onSuccess:()=>{n&&(y.workspace.getProjectSummaryState.invalidate({projectId:n}),y.workspace.listWithKanbanState.invalidate({projectId:n})),y.workspace.get.invalidate({id:e.id})}}),{gitStats:S}=e,w=e.ratchetEnabled??!0,E=jj(e),{showAttentionGlow:T}=rnt(e,!!a,s);return h.jsx(y0,{ref:l,style:c,children:h.jsx(v0,{asChild:!0,isActive:t,className:ne("h-auto px-2 py-2",m&&"opacity-50 bg-sidebar-accent",T&&"waiting-pulse"),children:h.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1.5",children:[!g&&d&&f&&h.jsx("button",{type:"button",className:"w-4 shrink-0 flex justify-center cursor-grab active:cursor-grabbing text-muted-foreground/50 hover:text-muted-foreground bg-transparent border-none p-0","aria-label":"Drag to reorder",...d,...f,onClick:A=>{A.preventDefault(),A.stopPropagation()},children:h.jsx(zq,{className:"h-3 w-3"})}),h.jsxs(Ar,{to:`/projects/${r}/workspaces/${e.id}`,onClick:()=>o(e.id),className:"flex flex-1 min-w-0 items-center gap-1.5",children:[h.jsxs("div",{className:"w-5 shrink-0 flex flex-col items-center gap-1.5 self-start mt-1.5",children:[h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx("span",{className:ne("h-2 w-2 rounded-full",int(E))})}),h.jsx(er,{side:"right",children:Rtt(E.activityState)})]}),h.jsx(Z0,{enabled:w,state:e.ratchetState,animated:e.ratchetButtonAnimated??!1,className:"h-5 w-5 shrink-0",disabled:_.isPending,stopPropagation:!0,onToggle:A=>{_.mutate({workspaceId:e.id,enabled:A})}}),e.runScriptStatus==="RUNNING"&&h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx("span",{children:h.jsx(pl,{className:"h-3 w-3 text-green-500 fill-green-500 animate-pulse"})})}),h.jsx(er,{side:"right",children:"Dev server running"})]})]}),h.jsxs("div",{className:"min-w-0 flex-1 space-y-0 self-start",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"truncate font-medium text-sm leading-tight flex-1 min-w-0",children:e.name}),e.lastActivityAt&&h.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:SO(e.lastActivityAt)}),h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx("button",{type:"button",onClick:A=>{A.preventDefault(),A.stopPropagation(),i(e)},className:ne("shrink-0 h-6 w-6 flex items-center justify-center rounded transition-opacity",e.prState==="MERGED"?"opacity-100 text-emerald-700 dark:text-emerald-300 bg-emerald-500/15 hover:bg-emerald-500/25":e.prState==="CLOSED"?"opacity-100 text-yellow-500 hover:text-yellow-400 hover:bg-yellow-500/10":"opacity-0 group-hover/menu-item:opacity-100 text-muted-foreground hover:text-foreground hover:bg-sidebar-accent"),children:h.jsx(Kw,{className:"h-3 w-3"})})}),h.jsx(er,{side:"right",children:"Archive"})]})]}),e.pendingRequestType&&h.jsxs("div",{className:"flex items-center gap-1 text-[10px] leading-tight mt-0.5",children:[e.pendingRequestType==="plan_approval"&&h.jsxs(h.Fragment,{children:[h.jsx(jq,{className:"h-2.5 w-2.5 text-amber-600 dark:text-amber-400"}),h.jsx("span",{className:"text-amber-700 dark:text-amber-400 font-medium",children:"Plan Approval Needed"})]}),e.pendingRequestType==="user_question"&&h.jsxs(h.Fragment,{children:[h.jsx(Gq,{className:"h-2.5 w-2.5 text-blue-600 dark:text-blue-400"}),h.jsx("span",{className:"text-blue-700 dark:text-blue-400 font-medium",children:"Question Waiting"})]})]}),e.branchName&&h.jsx("div",{className:"truncate text-[11px] leading-tight text-muted-foreground font-mono",children:e.branchName}),h.jsx(Jtt,{workspace:e,stats:S})]})]})]})})})}function Jtt({workspace:e,stats:t}){const n=!!(t&&(t.additions>0||t.deletions>0)),r=jj(e),i=!!(e.prNumber&&e.prState!=="NONE"&&e.prUrl),a=r.ciState!=="NONE";if(!(n||i||a))return null;const s=n&&t?.additions?`+${t.additions}`:"",o=n&&t?.deletions?`-${t.deletions}`:"";return h.jsxs("div",{className:"flex items-center gap-x-1.5 text-xs text-muted-foreground",children:[h.jsx("div",{className:"min-w-0 flex-1",children:h.jsx(ent,{workspace:e,sidebarStatus:r})}),h.jsx("span",{className:"shrink-0 text-right tabular-nums text-green-600 dark:text-green-400",children:s}),h.jsx("span",{className:"shrink-0 text-left tabular-nums text-red-600 dark:text-red-400",children:o}),i&&h.jsx(tnt,{workspace:e})]})}function ent({workspace:e,sidebarStatus:t}){return t.ciState==="NONE"?h.jsx("span",{className:"truncate","aria-hidden":"true"}):h.jsx(Bj,{ciState:t.ciState,prState:e.prState??null,size:"sm",className:"max-w-full truncate"})}function tnt({workspace:e}){const t=nnt(e);return h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsxs("button",{type:"button",onClick:n=>{n.preventDefault(),n.stopPropagation(),e.prUrl&&window.open(e.prUrl,"_blank","noopener,noreferrer")},className:ne("flex shrink-0 items-center gap-1 text-xs hover:opacity-80 transition-opacity p-0",e.prState==="MERGED"?"text-green-500":"text-muted-foreground hover:text-foreground"),children:[h.jsx(Cp,{className:"h-3 w-3"}),h.jsxs("span",{children:["#",e.prNumber]}),e.prState==="MERGED"&&h.jsx(fl,{className:"h-3 w-3 text-green-500"})]})}),h.jsxs(er,{side:"right",children:[h.jsxs("p",{children:["PR #",e.prNumber,t]}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Click to open on GitHub"})]})]})}function nnt(e){const t=jj(e).ciState;return Ott(t,e.prState??null)}function jj(e){return e.sidebarStatus??Ole({isWorking:e.isWorking,prUrl:e.prUrl??null,prState:e.prState??null,prCiStatus:e.prCiStatus??null,ratchetState:e.ratchetState??null})}function rnt(e,t,n){const r=e.cachedKanbanColumn==="DONE",i=!(t||r)&&!!e.ratchetButtonAnimated;return{showAttentionGlow:n(e.id)&&!i}}function int(e){return e.activityState==="WORKING"?"bg-green-500 animate-pulse":"bg-gray-400"}const Yb="factoryfactory_selected_project_slug";function zle(e){const t=e.match(/^\/projects\/([^/]+)/);return t?t[1]:null}function ant(e){if(e?.selectedProjectSlug)return e.selectedProjectSlug;const t=zle(window.location.pathname);return t&&t!=="new"?t:localStorage.getItem(Yb)||""}function snt(e,t,n){const r=Ce.workspace.syncAllPRStatuses.useMutation({onSuccess:()=>{n.workspace.getProjectSummaryState.invalidate({projectId:e})}}),i=v.useRef(null);v.useEffect(()=>{t||e&&e!==i.current&&(i.current=e,r.mutate({projectId:e}))},[t,e,r])}function ont(e,t,n,r,i){v.useEffect(()=>{if(t)return;const a=zle(e);if(a&&a!=="new")i(a),localStorage.setItem(Yb,a);else{const o=localStorage.getItem(Yb);o&&i(o)}},[t,e,i]),v.useEffect(()=>{if(t||!n||n.length===0||r)return;const a=n[0]?.slug;a&&(i(a),localStorage.setItem(Yb,a))},[t,n,r,i])}function lnt({isMobile:e,onClose:t,projectSelector:n}){return e?h.jsx(r2,{className:"border-b border-sidebar-border px-2 py-2.5",children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Ar,{to:"/projects",className:"shrink-0",children:h.jsx($O,{className:"size-8"})}),h.jsx("div",{className:"flex-1 min-w-0",children:n}),h.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-md hover:bg-sidebar-accent transition-colors text-sidebar-foreground/70 hover:text-sidebar-foreground",children:h.jsx(Ao,{className:"h-5 w-5"})})]})}):h.jsxs(r2,{className:"border-b border-sidebar-border p-4",children:[h.jsx(Ar,{to:"/projects",children:h.jsx(DK,{showIcon:!1,textClassName:"text-lg",className:"hover:opacity-80 transition-opacity"})}),h.jsx("div",{className:"mt-3",children:n})]})}function Hle({selectedProjectSlug:e,onProjectChange:t,projects:n}){return h.jsxs(mc,{value:e,onValueChange:t,children:[h.jsx(yl,{id:"project-select",className:"w-full",children:h.jsx(Nu,{placeholder:"Select a project"})}),h.jsxs(vl,{children:[n?.map(r=>h.jsx(sr,{value:r.slug,children:r.name},r.id)),h.jsx(sr,{value:"__create__",className:"text-muted-foreground",children:"+ Create project"}),h.jsx(sr,{value:"__manage__",className:"text-muted-foreground",children:"Manage projects..."})]})]})}function cnt({isMobile:e,selectedProjectSlug:t,onProjectChange:n,projects:r}){const i=s2e();return e&&i?Gs.createPortal(h.jsx(Hle,{selectedProjectSlug:t,onProjectChange:n,projects:r}),i):null}function unt({mockData:e}){const n=ko().pathname,r=to(),i=!!e,{isMobile:a,setOpenMobile:s}=b0(),[o,l]=v.useState(()=>ant(e)),[c,d]=v.useState(!1),[f,m]=v.useState(null),{setProjectContext:g}=Iq(),{data:y}=Ce.project.list.useQuery({isArchived:!1},{enabled:!i}),_=e?.projects??y,S=_?.find(Oe=>Oe.slug===o)?.id,{data:w}=Ce.workspace.getProjectSummaryState.useQuery({projectId:S??""},{enabled:!!S&&!i,refetchInterval:i?!1:3e4}),E=e?.projectState??w;qtt(i?void 0:S);const T=E?.workspaces,A=E?.reviewCount??0,{data:O}=Ce.userSettings.getWorkspaceOrder.useQuery({projectId:S??""},{enabled:!!S&&!i}),I=Ce.useUtils();snt(S,i,I);const{needsAttention:N,clearAttention:D}=Vtt(),{workspaceList:F,existingNames:P,isCreating:$,startCreating:W,cancelCreating:V,startArchiving:H,cancelArchiving:z}=Xtt(T,{customOrder:i?void 0:O}),M=Ce.userSettings.updateWorkspaceOrder.useMutation({onMutate:async({projectId:Oe,workspaceIds:Be})=>{await I.userSettings.getWorkspaceOrder.cancel({projectId:Oe});const qe=I.userSettings.getWorkspaceOrder.getData({projectId:Oe});return I.userSettings.getWorkspaceOrder.setData({projectId:Oe},Be),{previousOrder:qe}},onError:(Oe,{projectId:Be},qe)=>{qe?.previousOrder!==void 0&&I.userSettings.getWorkspaceOrder.setData({projectId:Be},qe.previousOrder),I.userSettings.getWorkspaceOrder.invalidate({projectId:Be})}}),G=lRe(Oz(KO,{activationConstraint:{distance:8}}),Oz(VO,{coordinateGetter:DIe})),B=v.useCallback(Oe=>{const{active:Be,over:qe}=Oe;if(!(qe&&Be.id!==qe.id&&S))return;const Yt=F.filter(an=>an.uiState!=="creating").map(an=>an.id),qt=Yt.indexOf(Be.id),In=Yt.indexOf(qe.id);if(qt===-1||In===-1)return;const Kn=[...Yt];Kn.splice(qt,1),Kn.splice(In,0,Be.id),M.mutate({projectId:S,workspaceIds:Kn})},[F,S,M]),{handleCreate:Q}=Rle(S,o,P),q=v.useCallback(()=>{if(!(S&&!$))return;const Be=Pj(P);W(Be),Q(Be).catch(()=>{V()})},[S,$,P,W,Q,V]),Y=Ce.workspace.archive.useMutation({onSuccess:(Oe,Be)=>{I.workspace.getProjectSummaryState.invalidate({projectId:S});const qe=n.match(/\/workspaces\/([^/]+)/)?.[1];Be.id===qe&&r(`/projects/${o}/workspaces`)},onError:(Oe,Be)=>{z(Be.id),Qt.error(Oe.message)}}),K=v.useCallback((Oe,Be)=>{H(Oe),Y.mutate({id:Oe,commitUncommitted:Be})},[H,Y]),j=v.useCallback(Oe=>{Oe.prState==="MERGED"?K(Oe.id,!0):(m(Oe.id),d(!0))},[K]),re=T?.find(Oe=>Oe.id===f)?.gitStats?.hasUncommitted===!0,de=n.match(/\/workspaces\/([^/]+)/)?.[1],le=n.endsWith("/workspaces")||n.endsWith("/workspaces/");v.useEffect(()=>{de&&N(de)&&D(de)},[de,N,D]),v.useEffect(()=>{S&&g(S)},[S,g]),ont(n,i,_,o,l);const _e=v.useRef(n);v.useEffect(()=>{a&&n!==_e.current&&s(!1),_e.current=n},[n,a,s]);const Ae=v.useCallback(Oe=>{if(Oe==="__manage__"){r("/projects");return}if(Oe==="__create__"){r("/projects/new");return}l(Oe),localStorage.setItem(Yb,Oe),r(`/projects/${Oe}/workspaces`)},[r]),we=[{href:"/reviews",label:"Reviews",icon:Cp},{href:"/admin",label:"Admin",icon:Yq}];return h.jsxs(h.Fragment,{children:[h.jsx(cnt,{isMobile:a,selectedProjectSlug:o,onProjectChange:Ae,projects:_}),h.jsxs(kK,{collapsible:a?"offcanvas":"none",children:[h.jsx(lnt,{isMobile:a,onClose:()=>s(!1),projectSelector:h.jsx(Hle,{selectedProjectSlug:o,onProjectChange:Ae,projects:_})}),h.jsxs(IK,{className:"flex flex-col",children:[o&&h.jsxs(i2,{className:"flex-1 min-h-0 flex flex-col overflow-hidden px-0",children:[h.jsx(OK,{children:h.jsx(Ar,{to:`/projects/${o}/workspaces`,className:"hover:text-foreground transition-colors",children:"Workspaces"})}),h.jsxs("div",{className:"absolute right-2 top-2 flex items-center gap-0.5",children:[h.jsx(Ar,{to:`/projects/${o}/workspaces`,className:"p-1 rounded hover:bg-sidebar-accent transition-colors text-sidebar-foreground/70 hover:text-sidebar-foreground",title:"View Kanban board",children:h.jsx(Hq,{className:"h-3.5 w-3.5"})}),h.jsx("button",{type:"button",onClick:q,disabled:$,className:"p-1 rounded hover:bg-sidebar-accent transition-colors text-sidebar-foreground/70 hover:text-sidebar-foreground disabled:opacity-50",title:"New Workspace",children:$?h.jsx(un,{className:"h-3.5 w-3.5 animate-spin"}):h.jsx(Yd,{className:"h-3.5 w-3.5"})})]}),h.jsx(a2,{className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden scrollbar-hide",children:h.jsx(dnt,{workspaceList:F,currentWorkspaceId:de,selectedProjectId:S,selectedProjectSlug:o,isKanbanView:le,needsAttention:N,clearAttention:D,onArchiveRequest:j,sensors:G,onDragEnd:B,isMobile:a})})]}),h.jsx(RK,{}),h.jsx(i2,{className:"px-0",children:h.jsx(a2,{children:h.jsx(FO,{children:we.map(Oe=>{const Be=n===Oe.href||n?.startsWith(`${Oe.href}/`),qe=Oe.href==="/reviews"&&A>0;return h.jsx(y0,{children:h.jsx(v0,{asChild:!0,isActive:Be,children:h.jsxs(Ar,{to:Oe.href,children:[h.jsx(Oe.icon,{className:"h-4 w-4"}),h.jsx("span",{children:Oe.label}),qe&&h.jsx(gn,{variant:"secondary",className:"ml-auto h-5 min-w-5 px-1.5 text-xs bg-orange-500/20 text-orange-600 border-orange-500/30",children:A})]})})},Oe.href)})})})})]}),h.jsxs(AK,{className:"border-t border-sidebar-border px-2 py-2",children:[!i&&h.jsx(pnt,{}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("a",{href:"https://github.com/purplefish-ai/factory-factory",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1",children:["GitHub",h.jsx(Xw,{className:"h-3 w-3"})]}),h.jsx(Ytt,{})]})]}),h.jsx(gZ,{open:c,onOpenChange:d,hasUncommitted:re,onConfirm:Oe=>{f&&K(f,Oe)}})]})]})}function dnt({workspaceList:e,currentWorkspaceId:t,selectedProjectId:n,selectedProjectSlug:r,isKanbanView:i,needsAttention:a,clearAttention:s,onArchiveRequest:o,sensors:l,onDragEnd:c,isMobile:d}){const f=e.map(g=>g.uiState==="creating"?h.jsx(Qtt,{},g.id):d?h.jsx(hnt,{workspace:g,isActive:t===g.id,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:o,disableRatchetAnimation:i,needsAttention:a,clearAttention:s},g.id):h.jsx(fnt,{workspace:g,isActive:t===g.id,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:o,disableRatchetAnimation:i,needsAttention:a,clearAttention:s},g.id)),m=h.jsxs(FO,{className:"gap-1.5 p-0",children:[f,e.length===0&&h.jsx("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:"No active workspaces"})]});return d?m:h.jsx(uIe,{sensors:l,collisionDetection:uRe,onDragEnd:c,children:h.jsx(wIe,{items:e.filter(g=>g.uiState!=="creating").map(g=>g.id),strategy:xIe,children:m})})}function hnt({workspace:e,isActive:t,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:i,disableRatchetAnimation:a,needsAttention:s,clearAttention:o}){return e.uiState==="archiving"?h.jsx($le,{workspace:e,selectedProjectSlug:r}):h.jsx(Ule,{workspace:e,isActive:t,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:i,disableRatchetAnimation:a,needsAttention:s,clearAttention:o,hideDragHandle:!0})}function fnt({workspace:e,isActive:t,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:i,disableRatchetAnimation:a,needsAttention:s,clearAttention:o}){const{attributes:l,listeners:c,setNodeRef:d,transform:f,transition:m,isDragging:g}=RIe({id:e.id}),y={transform:yy.Transform.toString(f),transition:m};return e.uiState==="archiving"?h.jsx($le,{workspace:e,selectedProjectSlug:r,sortableRef:d,sortableStyle:y}):h.jsx(Ule,{workspace:e,isActive:t,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:i,disableRatchetAnimation:a,needsAttention:s,clearAttention:o,sortableRef:d,sortableStyle:y,sortableAttributes:l,sortableListeners:c,isDragging:g})}function pnt(){const{data:e,isLoading:t}=Ce.admin.getServerInfo.useQuery(void 0,{retry:1,retryDelay:1e3,meta:{suppressErrors:!0}}),n=window.location.port?Number.parseInt(window.location.port,10):null,r=e?.backendPort??null;if(t||!n||!(n!==3e3||r!==null&&r!==3001))return null;const l=r!==null&&n!==r;return h.jsx("div",{className:"mb-2 space-y-0.5 text-[10px] text-muted-foreground/80",children:l?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{children:"Frontend:"}),h.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:n})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{children:"Backend:"}),r?h.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:r}):h.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-muted-foreground/50",children:"(restart to detect)"})]})]}):h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{children:"Server:"}),r?h.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:r}):h.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-muted-foreground/50",children:"(restart to detect)"})]})})}function mnt(){const[e,t]=v.useState(!1),{data:n,isLoading:r,refetch:i,isRefetching:a}=Ce.admin.checkCLIHealth.useQuery({forceRefresh:!1},{refetchOnWindowFocus:!1,refetchOnReconnect:!1,staleTime:6e4}),s=n?.allHealthy;if(v.useEffect(()=>{s===!1&&t(!1)},[s]),r||e||!n||n.allHealthy)return null;const o=[];return n.claude.isInstalled||o.push({title:"Claude CLI not installed",description:"Install the Claude CLI to enable AI-powered coding sessions.",link:"https://claude.ai/download"}),n.github.isInstalled?n.github.isAuthenticated||o.push({title:"GitHub CLI not authenticated",description:'Run "gh auth login" in your terminal to authenticate with GitHub.'}):o.push({title:"GitHub CLI not installed",description:"Install the GitHub CLI (gh) to enable PR management features.",link:"https://cli.github.com/"}),o.length===0?null:h.jsx("div",{className:"border-b border-warning/20 bg-warning/10 px-4 py-3",children:h.jsx("div",{className:"mx-auto max-w-7xl",children:h.jsxs("div",{className:"flex items-start justify-between gap-4",children:[h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx(hc,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-warning"}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-sm font-medium text-warning-foreground dark:text-warning",children:"Some features require additional setup"}),h.jsx("ul",{className:"space-y-1.5",children:o.map(l=>h.jsxs("li",{className:"text-sm text-foreground/80",children:[h.jsxs("span",{className:"font-medium",children:[l.title,":"]})," ",l.description,l.link&&h.jsxs("a",{href:l.link,target:"_blank",rel:"noopener noreferrer",className:"ml-1.5 inline-flex items-center gap-1 text-warning underline hover:text-warning/80",children:["Install",h.jsx(Xw,{className:"h-3 w-3"})]})]},l.title))})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs(We,{variant:"ghost",size:"sm",onClick:()=>i(),disabled:a,className:"h-8 text-warning hover:bg-warning/20",children:[h.jsx(dc,{className:`mr-1.5 h-3.5 w-3.5 ${a?"animate-spin":""}`}),"Recheck"]}),h.jsxs(We,{variant:"ghost",size:"icon",onClick:()=>t(!0),className:"h-8 w-8 text-warning hover:bg-warning/20",children:[h.jsx(Ao,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Dismiss"})]})]})]})})})}function gnt({children:e}){return h.jsx(d2e,{attribute:"class",defaultTheme:"dark",enableSystem:!0,disableTransitionOnChange:!0,children:e})}function bnt(){const{projects:e,isLoading:t}=tve(),n=to(),{pathname:r}=ko(),i=!t&&e&&e.length>0;return v.useEffect(()=>{const a=/^\/projects\/[^/]+/.test(r);!t&&e?.length===0&&!r.startsWith("/projects/new")&&!a&&n("/projects/new")},[t,e,r,n]),h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsx(mnt,{}),h.jsx(o2e,{sidebar:i?h.jsx(unt,{}):null,className:"flex-1 overflow-hidden",children:h.jsx(CG,{})})]})}function ynt(){return h.jsx(gnt,{children:h.jsxs(nve,{children:[h.jsx(G2e,{}),h.jsx(bnt,{}),h.jsx(W2e,{})]})})}function Du({className:e,...t}){return h.jsx(un,{role:"status","aria-label":"Loading",className:ne("size-4 animate-spin text-brand",e),...t})}function Wle({open:e,onOpenChange:t,title:n,description:r,confirmText:i="Continue",cancelText:a="Cancel",variant:s="default",onConfirm:o,isPending:l=!1}){return h.jsx(oZ,{open:e,onOpenChange:t,children:h.jsxs(QO,{children:[h.jsxs(JO,{children:[h.jsx(tD,{children:n}),h.jsx(nD,{children:r})]}),h.jsxs(eD,{children:[h.jsx(iD,{disabled:l,children:a}),h.jsx(rD,{onClick:c=>{c.preventDefault(),o()},disabled:l,className:ne(s==="destructive"&&Qd({variant:"destructive"})),children:l?h.jsx(Du,{className:"size-4"}):i})]})]})})}function Qu(e){return Object.values(e)}const vnt=qr(Qu(Dtt)),_nt=qr(Qu(Mtt)),xnt=qr(Qu(jle)),Snt=qr(Qu(Mle)),wnt=qr(Qu(Lle)),Ent=qr(Qu(Ple)),q7=qr(Qu(Ble)),Gle=qr(Qu(Dle)),qle=qr(["CLAUDE","CODEX"]),V7=qr(["WORKSPACE_DEFAULT","CLAUDE","CODEX"]),Cnt=nn({id:ke(),name:ke(),slug:ke(),repoPath:ke(),worktreeBasePath:ke(),defaultBranch:ke(),githubOwner:ke().nullable(),githubRepo:ke().nullable(),isArchived:Ui(),startupScriptCommand:ke().nullable(),startupScriptPath:ke().nullable(),startupScriptTimeout:hi(),createdAt:ke(),updatedAt:ke()}),Tnt=nn({id:ke(),projectId:ke(),name:ke(),description:ke().nullable(),status:vnt,worktreePath:ke().nullable(),branchName:ke().nullable(),isAutoGeneratedBranch:Ui(),creationSource:_nt,creationMetadata:Cu().nullable(),initErrorMessage:ke().nullable(),initOutput:ke().nullable(),initStartedAt:ke().nullable(),initCompletedAt:ke().nullable(),initRetryCount:hi(),runScriptCommand:ke().nullable(),runScriptCleanupCommand:ke().nullable(),runScriptPid:hi().nullable(),runScriptPort:hi().nullable(),runScriptStartedAt:ke().nullable(),runScriptStatus:xnt,prUrl:ke().nullable(),githubIssueNumber:hi().nullable(),githubIssueUrl:ke().nullable(),defaultSessionProvider:V7,ratchetSessionProvider:V7,prNumber:hi().nullable(),prState:Snt,prReviewState:ke().nullable(),prCiStatus:wnt,prUpdatedAt:ke().nullable(),prCiFailedAt:ke().nullable(),prCiLastNotifiedAt:ke().nullable(),prReviewLastCheckedAt:ke().nullable(),prReviewLastCommentId:ke().nullable(),ratchetEnabled:Ui(),ratchetState:q7,ratchetLastCheckedAt:ke().nullable(),ratchetLastPushAt:ke().nullable(),ratchetActiveSessionId:ke().nullable(),ratchetLastCiRunId:ke().nullable(),ratchetLastNotifiedState:q7.nullable(),hasHadSessions:Ui(),cachedKanbanColumn:Ent,stateComputedAt:ke().nullable(),createdAt:ke(),updatedAt:ke()}),knt=nn({id:ke(),workspaceId:ke(),name:ke().nullable(),workflow:ke(),model:ke(),status:Gle,provider:qle,providerSessionId:ke().nullable(),providerProjectPath:ke().nullable(),providerProcessPid:hi().nullable(),providerMetadata:Cu().nullable(),createdAt:ke(),updatedAt:ke()}),Nnt=nn({id:ke(),workspaceId:ke(),name:ke().nullable(),status:Gle,pid:hi().nullable(),createdAt:ke(),updatedAt:ke()}),Ant=nn({preferredIde:ke(),customIdeCommand:ke().nullable(),playSoundOnComplete:Ui(),notificationSoundPath:ke().nullable(),ratchetEnabled:Ui(),defaultSessionProvider:qle}),Rnt=nn({meta:nn({exportedAt:ke(),version:ke(),schemaVersion:Pr(3)}),data:nn({projects:Ya(Cnt),workspaces:Ya(Tnt),agentSessions:Ya(knt),terminalSessions:Ya(Nnt),userSettings:Ant.nullable()})});function Vle({onImportSuccess:e,variant:t="outline",className:n,children:r}){const i=v.useRef(null),[a,s]=v.useState({open:!1,data:null,summary:""}),o=Ce.useUtils(),l=Ce.admin.importData.useMutation({onSuccess:async y=>{const{results:_}=y,S=[`Projects: ${_.projects.imported} imported, ${_.projects.skipped} skipped`,`Workspaces: ${_.workspaces.imported} imported, ${_.workspaces.skipped} skipped`,`Agent Sessions: ${_.agentSessions.imported} imported, ${_.agentSessions.skipped} skipped`,`Terminal Sessions: ${_.terminalSessions.imported} imported, ${_.terminalSessions.skipped} skipped`,`User Settings: ${_.userSettings.imported?"imported":_.userSettings.skipped?"skipped (exists)":"none"}`].join(`
|
|
422
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return FR.get()},set promptLabel(e){FR.set(e)},get tooMuchOutput(){return $R.get()},set tooMuchOutput(e){$R.set(e)}}}_verifyIntegers(...e){for(Go of e)if(Go===1/0||isNaN(Go)||Go%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Go of e)if(Go&&(Go===1/0||isNaN(Go)||Go%1!==0||Go<0))throw new Error("This API only accepts positive integers")}};function Ett({workspaceId:e,sessions:t,selectedSessionId:n,sessionSummariesById:r,isCreatingSession:i,isDeletingSession:a,onSelectSession:s,onCreateSession:o,onCloseSession:l,children:c,maxSessions:d,hasWorktreePath:f,selectedProvider:m,setSelectedProvider:g}){const y=t&&t.length===0;return h.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[h.jsx("div",{className:"border-b flex-shrink-0",children:h.jsx(cKe,{sessions:t,currentSessionId:n,sessionSummariesById:r,onSelectSession:s,onCreateSession:o,onCloseSession:l,disabled:i||a||!f,maxSessions:d,selectedProvider:m,setSelectedProvider:g})}),h.jsx(eKe,{workspaceId:e,className:"flex-1 min-h-0",children:y?h.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:h.jsxs("div",{className:"max-w-md w-full space-y-6 text-center",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx("h2",{className:"text-2xl font-semibold",children:"Start a Session"}),h.jsx("p",{className:"text-muted-foreground",children:"Click the + button above to start a new chat session in this workspace."})]}),!f&&h.jsx("div",{className:"bg-yellow-50 border border-yellow-200 text-yellow-800 px-4 py-3 rounded-md text-sm",children:"Workspace is initializing... Please wait for the worktree to be created."})]})}):c})]})}const Ctt={NEW:{icon:HA,label:"Pending",variant:"outline"},PROVISIONING:{icon:un,label:"Setting up",variant:"secondary",iconClassName:"animate-spin"},FAILED:{icon:Xs,label:"Setup failed",variant:"destructive"}};function Mj({status:e,errorMessage:t,className:n}){if(e==="READY"||e==="ARCHIVED")return null;const r=Ctt[e],i=r.icon,a=h.jsxs(gn,{variant:r.variant,className:ne("gap-1 text-xs whitespace-nowrap shrink-0",n),children:[h.jsx(i,{className:ne("h-3 w-3",r.iconClassName)}),r.label]});return e==="FAILED"&&t?h.jsx(Uu,{children:h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:a}),h.jsx(er,{side:"top",className:"max-w-[300px]",children:h.jsx("p",{className:"text-xs",children:t})})]})}):a}function Lj(e){return{...e,sessionSummaries:[],agentSessions:[],terminalSessions:[],sidebarStatus:{activityState:"IDLE",ciState:"NONE"},ratchetButtonAnimated:!1,flowPhase:"NO_PR",ciObservation:"NOT_FETCHED"}}const $7=["tiger","falcon","otter","panda","wolf","fox","bear","hawk","owl","raven","dolphin","eagle","lynx","cobra","jaguar","panther","phoenix","dragon","griffin","sphinx","nova","comet","nebula","quasar","pulsar","orbit","cosmos","stellar","lunar","solar","thunder","blaze","frost","storm","ember","crystal","aurora","summit","canyon","ridge","pixel","vector","cipher","spark","pulse","flux","apex","vertex","nexus","prism"];function Ttt(){return $7[Math.floor(Math.random()*$7.length)]??"workspace"}function Pj(e){const t=Ttt();if(!e.includes(t))return t;let n=2;const r=1e3;for(;n<r&&e.includes(`${t}-${n}`);)n++;return`${t}-${n}`}function Rle(e,t,n){const r=to(),i=Ce.useUtils(),[a,s]=v.useState(!1),o=Ce.workspace.create.useMutation(),{data:l}=Ce.workspace.list.useQuery({projectId:e??""},{enabled:!!e&&n===void 0}),c=n??l?.map(f=>f.name)??[];return{handleCreate:async f=>{if(!e||a)return;const m=f??Pj(c);s(!0);try{const g=await o.mutateAsync({type:"MANUAL",projectId:e,name:m});i.workspace.get.setData({id:g.id},y=>y||Lj(g)),i.workspace.list.invalidate({projectId:e}),i.workspace.getProjectSummaryState.invalidate({projectId:e}),s(!1),r(`/projects/${t}/workspaces/${g.id}`)}catch(g){s(!1);const y=g instanceof Error?g.message:"Unknown error";throw Qt.error(`Failed to create workspace: ${y}`),g}},isCreating:a,existingNames:c}}function Ile(e,t){return{id:e.workspaceId,name:e.name,status:e.status,createdAt:new Date(e.createdAt),branchName:e.branchName,prUrl:e.prUrl,prNumber:e.prNumber,prState:e.prState,prCiStatus:e.prCiStatus,ratchetEnabled:e.ratchetEnabled,ratchetState:e.ratchetState,runScriptStatus:e.runScriptStatus,kanbanColumn:e.kanbanColumn,isWorking:e.isWorking,ratchetButtonAnimated:e.ratchetButtonAnimated,flowPhase:e.flowPhase,pendingRequestType:e.pendingRequestType,isArchived:!1,description:t?.description??null,initErrorMessage:t?.initErrorMessage??null,githubIssueNumber:t?.githubIssueNumber??null}}function ktt(e){return e==="SUCCESS"?"PASSING":e==="FAILURE"?"FAILING":e==="PENDING"?"RUNNING":"UNKNOWN"}function Ntt(e){return!e||e.length===0?"NONE":e.some(r=>r.conclusion==="FAILURE")?"FAILING":e.some(r=>r.status!=="COMPLETED"||r.conclusion===null)?"RUNNING":"PASSING"}function Att(e){switch(e){case"PASSING":return"CI Passing";case"FAILING":return"CI Failing";case"RUNNING":return"CI Running";case"UNKNOWN":return"CI Unknown";case"NONE":return"No checks"}}const Rtt={NEW:"NEW",PROVISIONING:"PROVISIONING",READY:"READY",FAILED:"FAILED",ARCHIVED:"ARCHIVED"},Ole={IDLE:"IDLE",RUNNING:"RUNNING",PAUSED:"PAUSED",COMPLETED:"COMPLETED",FAILED:"FAILED"},Dle={NONE:"NONE",DRAFT:"DRAFT",OPEN:"OPEN",CHANGES_REQUESTED:"CHANGES_REQUESTED",APPROVED:"APPROVED",MERGED:"MERGED",CLOSED:"CLOSED"},Mle={UNKNOWN:"UNKNOWN",PENDING:"PENDING",SUCCESS:"SUCCESS",FAILURE:"FAILURE"},Lle={WORKING:"WORKING",WAITING:"WAITING",DONE:"DONE"},Ple={IDLE:"IDLE",CI_RUNNING:"CI_RUNNING",CI_FAILED:"CI_FAILED",REVIEW_PENDING:"REVIEW_PENDING",READY:"READY",MERGED:"MERGED"},Itt={MANUAL:"MANUAL",RESUME_BRANCH:"RESUME_BRANCH",GITHUB_ISSUE:"GITHUB_ISSUE"},Ble={IDLE:"IDLE",STARTING:"STARTING",RUNNING:"RUNNING",STOPPING:"STOPPING",COMPLETED:"COMPLETED",FAILED:"FAILED"};function jle(e){const t=e.isWorking?"WORKING":"IDLE";if(!e.prUrl)return{activityState:t,ciState:"NONE"};if(e.prState==="MERGED"||e.ratchetState==="MERGED")return{activityState:t,ciState:"MERGED"};const n=ktt(e.prCiStatus);if(n==="UNKNOWN"){if(e.ratchetState==="CI_FAILED")return{activityState:t,ciState:"FAILING"};if(e.ratchetState==="CI_RUNNING")return{activityState:t,ciState:"RUNNING"}}return{activityState:t,ciState:n}}function Ott(e){return e==="WORKING"?"Claude is working":"Claude is idle"}function Dtt(e){switch(e){case"NONE":return"No PR";case"RUNNING":return"CI Running";case"FAILING":return"CI Failing";case"PASSING":return"CI Passing";case"UNKNOWN":return"CI Unknown";case"MERGED":return"Merged"}}function U7(e,t){return e==="RUNNING"?"CI checks are running":e==="FAILING"?"CI checks are failing":e==="PASSING"?"CI checks are passing":e==="MERGED"?"PR is merged":e==="UNKNOWN"?t==="CLOSED"?"PR is closed":"CI status is unknown":"No PR attached"}function Mtt(e,t){return t==="CLOSED"?" · Closed":e==="MERGED"?" · Merged":e==="FAILING"?" · CI failing":e==="RUNNING"?" · CI running":e==="PASSING"?" · CI passing":""}const Ltt=nn({code:hi().nullable(),timestamp:ke(),unexpected:Ui()}),Ptt=nn({sessionId:ke(),name:ke().nullable(),workflow:ke().nullable(),model:ke().nullable(),provider:qr(["CLAUDE","CODEX"]).optional(),persistedStatus:jf(Ole),runtimePhase:qr(["loading","starting","running","idle","stopping","error"]),processState:qr(["unknown","alive","stopped"]),activity:qr(["WORKING","IDLE"]),updatedAt:ke(),lastExit:Ltt.nullable()}),Btt=nn({total:hi(),additions:hi(),deletions:hi(),hasUncommitted:Ui()}),jtt=nn({activityState:qr(["WORKING","IDLE"]),ciState:qr(["NONE","RUNNING","FAILING","PASSING","UNKNOWN","MERGED"])}),Fle=nn({workspaceId:ke(),projectId:ke(),version:hi(),computedAt:ke(),source:ke(),name:ke(),status:ke(),createdAt:ke(),branchName:ke().nullable(),prUrl:ke().nullable(),prNumber:hi().nullable(),prState:jf(Dle),prCiStatus:jf(Mle),prUpdatedAt:ke().nullable(),ratchetEnabled:Ui(),ratchetState:jf(Ple),runScriptStatus:jf(Ble),hasHadSessions:Ui(),isWorking:Ui(),pendingRequestType:qr(["plan_approval","user_question"]).nullable(),sessionSummaries:Ya(Ptt),gitStats:Btt.nullable(),lastActivityAt:ke().nullable(),sidebarStatus:jtt,kanbanColumn:jf(Lle).nullable(),flowPhase:qr(["NO_PR","CI_WAIT","RATCHET_VERIFY","RATCHET_FIXING","READY","MERGED"]).nullable(),ciObservation:qr(["NOT_FETCHED","NO_CHECKS","CHECKS_PENDING","CHECKS_FAILED","CHECKS_PASSED","CHECKS_UNKNOWN"]).nullable(),ratchetButtonAnimated:Ui(),fieldTimestamps:im(ke(),hi())}),Ftt=nn({type:Pr("snapshot_full"),projectId:ke(),entries:Ya(Fle)}),$tt=nn({type:Pr("snapshot_changed"),workspaceId:ke(),entry:Fle}),Utt=nn({type:Pr("snapshot_removed"),workspaceId:ke()}),ztt=_O("type",[Ftt,$tt,Utt]);function lA(e){return{id:e.workspaceId,name:e.name,createdAt:new Date(e.createdAt),branchName:e.branchName,prUrl:e.prUrl,prNumber:e.prNumber,prState:e.prState,prCiStatus:e.prCiStatus,isWorking:e.isWorking,sessionSummaries:e.sessionSummaries,gitStats:e.gitStats,lastActivityAt:e.lastActivityAt,ratchetEnabled:e.ratchetEnabled,ratchetState:e.ratchetState,sidebarStatus:e.sidebarStatus,ratchetButtonAnimated:e.ratchetButtonAnimated,flowPhase:e.flowPhase,ciObservation:e.ciObservation,runScriptStatus:e.runScriptStatus,pendingRequestType:e.pendingRequestType,cachedKanbanColumn:e.kanbanColumn,stateComputedAt:e.computedAt}}function Htt(e,t){const n=new Map;if(t)for(const r of t){const i=r.id;n.set(i,r)}return e.filter(r=>r.kanbanColumn!==null).map(r=>Ile(r,n.get(r.workspaceId)))}function Wtt(e,t){if(e.kanbanColumn===null)return t&&t.filter(s=>s.id!==e.workspaceId);const n=t?.find(s=>s.id===e.workspaceId),r=Ile(e,n);if(!t)return[r];const i=t.findIndex(s=>s.id===e.workspaceId),a=[...t];return i>=0?a[i]=r:a.push(r),a}function Gtt(e,t){return t&&t.filter(n=>n.id!==e)}function z7(e,t){return e&&{...e,prUrl:t.prUrl,prNumber:t.prNumber,prState:t.prState,prCiStatus:t.prCiStatus,ratchetEnabled:t.ratchetEnabled,ratchetState:t.ratchetState,runScriptStatus:t.runScriptStatus,isWorking:t.isWorking,pendingRequestType:t.pendingRequestType,sessionSummaries:t.sessionSummaries,sidebarStatus:t.sidebarStatus,ratchetButtonAnimated:t.ratchetButtonAnimated,flowPhase:t.flowPhase,ciObservation:t.ciObservation}}function qtt(e){const t=Ce.useUtils(),n=e?$1("/snapshots",{projectId:e}):null,r=v.useCallback(i=>{const a=ztt.safeParse(i);if(!a.success)return;const s=a.data,{setData:o}=t.workspace.getProjectSummaryState,{setData:l}=t.workspace.listWithKanbanState,{setData:c}=t.workspace.get;switch(s.type){case"snapshot_full":{o({projectId:s.projectId},(d=>({workspaces:s.entries.map(lA),reviewCount:d?.reviewCount??0}))),l({projectId:s.projectId},(d=>Htt(s.entries,d)));for(const d of s.entries)c({id:d.workspaceId},(f=>z7(f,d)));t.workspace.list.invalidate({projectId:s.projectId});break}case"snapshot_changed":{if(!e)break;o({projectId:e},(d=>{if(!d)return{workspaces:[lA(s.entry)],reviewCount:0};const f=lA(s.entry),m=d.workspaces.findIndex(y=>y.id===f.id),g=[...d.workspaces];return m>=0?g[m]=f:g.push(f),{workspaces:g,reviewCount:d.reviewCount}})),l({projectId:e},(d=>Wtt(s.entry,d))),c({id:s.entry.workspaceId},(d=>z7(d,s.entry))),t.workspace.list.invalidate({projectId:e});break}case"snapshot_removed":{if(!e)break;o({projectId:e},(d=>d&&{workspaces:d.workspaces.filter(f=>f.id!==s.workspaceId),reviewCount:d.reviewCount})),l({projectId:e},(d=>Gtt(s.workspaceId,d))),c({id:s.workspaceId},void 0),t.workspace.list.invalidate({projectId:e});break}}},[e,t]);U1({url:n,onMessage:r,queuePolicy:"drop"})}const H7=3e4;function Vtt(){const[e,t]=v.useState(new Map);v.useEffect(()=>{const i=a=>{const{workspaceId:s}=a.detail,o=Date.now();t(l=>{const c=new Map(l);return c.set(s,o),c})};return window.addEventListener("workspace-attention-required",i),()=>{window.removeEventListener("workspace-attention-required",i)}},[]),v.useEffect(()=>{const i=setInterval(()=>{const a=Date.now();t(s=>{const o=new Map(s);let l=!1;for(const[c,d]of o.entries())a-d>H7&&(o.delete(c),l=!0);return l?o:s})},1e3);return()=>clearInterval(i)},[]);const n=v.useCallback(i=>{const a=e.get(i);return a?Date.now()-a<H7:!1},[e]),r=v.useCallback(i=>{t(a=>{if(!a.has(i))return a;const s=new Map(a);return s.delete(i),s})},[]);return{needsAttention:n,clearAttention:r}}function Ytt(){const{setTheme:e}=SE(),[t,n]=v.useState(!1);return v.useEffect(()=>{n(!0)},[]),t?h.jsxs(K0,{children:[h.jsx(X0,{asChild:!0,children:h.jsxs(We,{variant:"ghost",size:"icon",children:[h.jsx(zk,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),h.jsx(dU,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),h.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),h.jsxs(Im,{align:"end",children:[h.jsxs(hp,{onClick:()=>e("light"),children:[h.jsx(zk,{className:"mr-2 h-4 w-4"}),"Light"]}),h.jsxs(hp,{onClick:()=>e("dark"),children:[h.jsx(dU,{className:"mr-2 h-4 w-4"}),"Dark"]}),h.jsxs(hp,{onClick:()=>e("system"),children:[h.jsx(A_e,{className:"mr-2 h-4 w-4"}),"System"]})]})]}):h.jsxs(We,{variant:"ghost",size:"icon",disabled:!0,children:[h.jsx(zk,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}function W7(e){if(e instanceof Date)return e.getTime();const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function G7(e,t){const n=W7(t.createdAt)-W7(e.createdAt);if(n!==0)return n;const r=e.name.localeCompare(t.name);return r!==0?r:e.id.localeCompare(t.id)}function Ktt(e,t){if(!t||t.length===0)return[...e].sort(G7);const n=new Map(t.map((a,s)=>[a,s])),r=[],i=[];for(const a of e)n.has(a.id)?r.push(a):i.push(a);return r.sort((a,s)=>(n.get(a.id)??0)-(n.get(s.id)??0)),i.sort(G7),[...i,...r]}function Xtt(e,t={}){const{customOrder:n}=t,[r,i]=v.useState(null),[a,s]=v.useState(new Map),o=r?e?.some(y=>y.name===r.name):!1,l=v.useMemo(()=>{const y=[];if(r&&!o&&y.push({id:`creating-${r.name}`,name:r.name,createdAt:new Date().toISOString(),branchName:null,prUrl:null,prNumber:null,prState:null,prCiStatus:null,ratchetEnabled:!1,isWorking:!1,gitStats:null,uiState:"creating"}),e){const _=Ktt(e,n);for(const S of _){const w=a.has(S.id);y.push({...S,uiState:w?"archiving":"normal"})}}return y},[e,r,o,a,n]);v.useEffect(()=>{r&&o&&i(null)},[r,o]),v.useEffect(()=>{if(a.size===0)return;const y=[];for(const[S]of a)e?.some(E=>E.id===S)||y.push(S);if(y.length===0)return;const _=setTimeout(()=>{s(S=>{const w=new Map(S);for(const E of y)w.delete(E);return w})},300);return()=>clearTimeout(_)},[a,e]);const c=v.useMemo(()=>{const y=e?.map(_=>_.name)??[];return r?.name&&y.push(r.name),y},[e,r?.name]),d=v.useCallback(y=>{i({name:y})},[]),f=v.useCallback(()=>{i(null)},[]),m=v.useCallback(y=>{const _=e?.find(S=>S.id===y);_&&s(S=>{const w=new Map(S);return w.set(y,{id:_.id,name:_.name,branchName:_.branchName}),w})},[e]),g=v.useCallback(y=>{if(!y){s(new Map);return}s(_=>{if(!_.has(y))return _;const S=new Map(_);return S.delete(y),S})},[]);return{workspaceList:l,existingNames:c,isCreating:!!r,startCreating:d,cancelCreating:f,startArchiving:m,cancelArchiving:g}}function Ztt(e){switch(e){case"PASSING":return{className:"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300",Icon:fl};case"FAILING":return{className:"bg-red-500/15 text-red-700 dark:text-red-300",Icon:uy};case"RUNNING":return{className:"bg-yellow-500/15 text-yellow-700 dark:text-yellow-300",Icon:oc};case"UNKNOWN":return{className:"bg-muted text-muted-foreground",Icon:oc};case"MERGED":return{className:"bg-purple-500/15 text-purple-700 dark:text-purple-300",Icon:fl};case"NONE":return{className:"bg-transparent text-muted-foreground",Icon:oc}}}function Bj({ciState:e,prState:t,size:n="sm",className:r}){if(e==="NONE")return null;const i=Ztt(e),{Icon:a}=i,s=n==="sm"?"text-[10px] px-1.5 py-0.5":"text-xs px-2 py-0.5",o=n==="sm"?"h-2.5 w-2.5":"h-3 w-3";return h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsxs("button",{type:"button","aria-label":U7(e,t??null),className:ne("inline-flex w-fit items-center gap-1 rounded-sm font-medium uppercase tracking-wide cursor-default",s,i.className,r),children:[h.jsx(a,{className:ne(o,e==="RUNNING"&&"animate-pulse")}),h.jsx("span",{children:Dtt(e)})]})}),h.jsx(er,{side:"right",children:U7(e,t??null)})]})}function Qtt(){return h.jsx(y0,{children:h.jsx(v0,{size:"lg",className:"h-auto px-2 py-2 cursor-default",children:h.jsxs("div",{className:"flex items-center gap-1.5 w-full min-w-0",children:[h.jsx("div",{className:"w-4 shrink-0","aria-hidden":"true"}),h.jsx("div",{className:"h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-foreground/40 border-t-foreground"}),h.jsx("span",{className:"truncate text-sm",children:"Creating..."})]})})})}function $le({workspace:e,selectedProjectSlug:t,sortableRef:n,sortableStyle:r}){return h.jsx(y0,{ref:n,style:r,children:h.jsx(v0,{asChild:!0,className:"h-auto px-2 py-2 opacity-50 pointer-events-none",children:h.jsx(Ar,{to:`/projects/${t}/workspaces/${e.id}`,children:h.jsxs("div",{className:"flex items-center gap-1.5 w-full min-w-0",children:[h.jsx("div",{className:"w-4 shrink-0","aria-hidden":"true"}),h.jsx("div",{className:"h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-muted-foreground/40 border-t-muted-foreground"}),h.jsx("span",{className:"truncate text-sm text-muted-foreground",children:"Archiving..."})]})})})})}function Ule({workspace:e,isActive:t,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:i,disableRatchetAnimation:a,needsAttention:s,clearAttention:o,sortableRef:l,sortableStyle:c,sortableAttributes:d,sortableListeners:f,isDragging:m,hideDragHandle:g}){const y=Ce.useUtils(),_=Ce.workspace.toggleRatcheting.useMutation({onSuccess:()=>{n&&(y.workspace.getProjectSummaryState.invalidate({projectId:n}),y.workspace.listWithKanbanState.invalidate({projectId:n})),y.workspace.get.invalidate({id:e.id})}}),{gitStats:S}=e,w=e.ratchetEnabled??!0,E=jj(e),{showAttentionGlow:T}=rnt(e,!!a,s);return h.jsx(y0,{ref:l,style:c,children:h.jsx(v0,{asChild:!0,isActive:t,className:ne("h-auto px-2 py-2",m&&"opacity-50 bg-sidebar-accent",T&&"waiting-pulse"),children:h.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1.5",children:[!g&&d&&f&&h.jsx("button",{type:"button",className:"w-4 shrink-0 flex justify-center cursor-grab active:cursor-grabbing text-muted-foreground/50 hover:text-muted-foreground bg-transparent border-none p-0","aria-label":"Drag to reorder",...d,...f,onClick:A=>{A.preventDefault(),A.stopPropagation()},children:h.jsx(zq,{className:"h-3 w-3"})}),h.jsxs(Ar,{to:`/projects/${r}/workspaces/${e.id}`,onClick:()=>o(e.id),className:"flex flex-1 min-w-0 items-center gap-1.5",children:[h.jsxs("div",{className:"w-5 shrink-0 flex flex-col items-center gap-1.5 self-start mt-1.5",children:[h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx("span",{className:ne("h-2 w-2 rounded-full",int(E))})}),h.jsx(er,{side:"right",children:Ott(E.activityState)})]}),h.jsx(Z0,{enabled:w,state:e.ratchetState,animated:e.ratchetButtonAnimated??!1,className:"h-5 w-5 shrink-0",disabled:_.isPending,stopPropagation:!0,onToggle:A=>{_.mutate({workspaceId:e.id,enabled:A})}}),e.runScriptStatus==="RUNNING"&&h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx("span",{children:h.jsx(pl,{className:"h-3 w-3 text-green-500 fill-green-500 animate-pulse"})})}),h.jsx(er,{side:"right",children:"Dev server running"})]})]}),h.jsxs("div",{className:"min-w-0 flex-1 space-y-0 self-start",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"truncate font-medium text-sm leading-tight flex-1 min-w-0",children:e.name}),e.lastActivityAt&&h.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:SO(e.lastActivityAt)}),h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx("button",{type:"button",onClick:A=>{A.preventDefault(),A.stopPropagation(),i(e)},className:ne("shrink-0 h-6 w-6 flex items-center justify-center rounded transition-opacity",e.prState==="MERGED"?"opacity-100 text-emerald-700 dark:text-emerald-300 bg-emerald-500/15 hover:bg-emerald-500/25":e.prState==="CLOSED"?"opacity-100 text-yellow-500 hover:text-yellow-400 hover:bg-yellow-500/10":"opacity-0 group-hover/menu-item:opacity-100 text-muted-foreground hover:text-foreground hover:bg-sidebar-accent"),children:h.jsx(Kw,{className:"h-3 w-3"})})}),h.jsx(er,{side:"right",children:"Archive"})]})]}),e.pendingRequestType&&h.jsxs("div",{className:"flex items-center gap-1 text-[10px] leading-tight mt-0.5",children:[e.pendingRequestType==="plan_approval"&&h.jsxs(h.Fragment,{children:[h.jsx(jq,{className:"h-2.5 w-2.5 text-amber-600 dark:text-amber-400"}),h.jsx("span",{className:"text-amber-700 dark:text-amber-400 font-medium",children:"Plan Approval Needed"})]}),e.pendingRequestType==="user_question"&&h.jsxs(h.Fragment,{children:[h.jsx(Gq,{className:"h-2.5 w-2.5 text-blue-600 dark:text-blue-400"}),h.jsx("span",{className:"text-blue-700 dark:text-blue-400 font-medium",children:"Question Waiting"})]})]}),e.branchName&&h.jsx("div",{className:"truncate text-[11px] leading-tight text-muted-foreground font-mono",children:e.branchName}),h.jsx(Jtt,{workspace:e,stats:S})]})]})]})})})}function Jtt({workspace:e,stats:t}){const n=!!(t&&(t.additions>0||t.deletions>0)),r=jj(e),i=!!(e.prNumber&&e.prState!=="NONE"&&e.prUrl),a=r.ciState!=="NONE";if(!(n||i||a))return null;const s=n&&t?.additions?`+${t.additions}`:"",o=n&&t?.deletions?`-${t.deletions}`:"";return h.jsxs("div",{className:"flex items-center gap-x-1.5 text-xs text-muted-foreground",children:[h.jsx("div",{className:"min-w-0 flex-1",children:h.jsx(ent,{workspace:e,sidebarStatus:r})}),h.jsx("span",{className:"shrink-0 text-right tabular-nums text-green-600 dark:text-green-400",children:s}),h.jsx("span",{className:"shrink-0 text-left tabular-nums text-red-600 dark:text-red-400",children:o}),i&&h.jsx(tnt,{workspace:e})]})}function ent({workspace:e,sidebarStatus:t}){return t.ciState==="NONE"?h.jsx("span",{className:"truncate","aria-hidden":"true"}):h.jsx(Bj,{ciState:t.ciState,prState:e.prState??null,size:"sm",className:"max-w-full truncate"})}function tnt({workspace:e}){const t=nnt(e);return h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsxs("button",{type:"button",onClick:n=>{n.preventDefault(),n.stopPropagation(),e.prUrl&&window.open(e.prUrl,"_blank","noopener,noreferrer")},className:ne("flex shrink-0 items-center gap-1 text-xs hover:opacity-80 transition-opacity p-0",e.prState==="MERGED"?"text-green-500":"text-muted-foreground hover:text-foreground"),children:[h.jsx(Cp,{className:"h-3 w-3"}),h.jsxs("span",{children:["#",e.prNumber]}),e.prState==="MERGED"&&h.jsx(fl,{className:"h-3 w-3 text-green-500"})]})}),h.jsxs(er,{side:"right",children:[h.jsxs("p",{children:["PR #",e.prNumber,t]}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Click to open on GitHub"})]})]})}function nnt(e){const t=jj(e).ciState;return Mtt(t,e.prState??null)}function jj(e){return e.sidebarStatus??jle({isWorking:e.isWorking,prUrl:e.prUrl??null,prState:e.prState??null,prCiStatus:e.prCiStatus??null,ratchetState:e.ratchetState??null})}function rnt(e,t,n){const r=e.cachedKanbanColumn==="DONE",i=!(t||r)&&!!e.ratchetButtonAnimated;return{showAttentionGlow:n(e.id)&&!i}}function int(e){return e.activityState==="WORKING"?"bg-green-500 animate-pulse":"bg-gray-400"}const Yb="factoryfactory_selected_project_slug";function zle(e){const t=e.match(/^\/projects\/([^/]+)/);return t?t[1]:null}function ant(e){if(e?.selectedProjectSlug)return e.selectedProjectSlug;const t=zle(window.location.pathname);return t&&t!=="new"?t:localStorage.getItem(Yb)||""}function snt(e,t,n){const r=Ce.workspace.syncAllPRStatuses.useMutation({onSuccess:()=>{n.workspace.getProjectSummaryState.invalidate({projectId:e})}}),i=v.useRef(null);v.useEffect(()=>{t||e&&e!==i.current&&(i.current=e,r.mutate({projectId:e}))},[t,e,r])}function ont(e,t,n,r,i){v.useEffect(()=>{if(t)return;const a=zle(e);if(a&&a!=="new")i(a),localStorage.setItem(Yb,a);else{const o=localStorage.getItem(Yb);o&&i(o)}},[t,e,i]),v.useEffect(()=>{if(t||!n||n.length===0||r)return;const a=n[0]?.slug;a&&(i(a),localStorage.setItem(Yb,a))},[t,n,r,i])}function lnt({isMobile:e,onClose:t,projectSelector:n}){return e?h.jsx(r2,{className:"border-b border-sidebar-border px-2 py-2.5",children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Ar,{to:"/projects",className:"shrink-0",children:h.jsx($O,{className:"size-8"})}),h.jsx("div",{className:"flex-1 min-w-0",children:n}),h.jsx("button",{type:"button",onClick:t,className:"shrink-0 rounded-md hover:bg-sidebar-accent transition-colors text-sidebar-foreground/70 hover:text-sidebar-foreground",children:h.jsx(Ao,{className:"h-5 w-5"})})]})}):h.jsxs(r2,{className:"border-b border-sidebar-border p-4",children:[h.jsx(Ar,{to:"/projects",children:h.jsx(DK,{showIcon:!1,textClassName:"text-lg",className:"hover:opacity-80 transition-opacity"})}),h.jsx("div",{className:"mt-3",children:n})]})}function Hle({selectedProjectSlug:e,onProjectChange:t,projects:n}){return h.jsxs(mc,{value:e,onValueChange:t,children:[h.jsx(yl,{id:"project-select",className:"w-full",children:h.jsx(Nu,{placeholder:"Select a project"})}),h.jsxs(vl,{children:[n?.map(r=>h.jsx(sr,{value:r.slug,children:r.name},r.id)),h.jsx(sr,{value:"__create__",className:"text-muted-foreground",children:"+ Create project"}),h.jsx(sr,{value:"__manage__",className:"text-muted-foreground",children:"Manage projects..."})]})]})}function cnt({isMobile:e,selectedProjectSlug:t,onProjectChange:n,projects:r}){const i=s2e();return e&&i?Gs.createPortal(h.jsx(Hle,{selectedProjectSlug:t,onProjectChange:n,projects:r}),i):null}function unt({mockData:e}){const n=ko().pathname,r=to(),i=!!e,{isMobile:a,setOpenMobile:s}=b0(),[o,l]=v.useState(()=>ant(e)),[c,d]=v.useState(!1),[f,m]=v.useState(null),{setProjectContext:g}=Iq(),{data:y}=Ce.project.list.useQuery({isArchived:!1},{enabled:!i}),_=e?.projects??y,S=_?.find(Oe=>Oe.slug===o)?.id,{data:w}=Ce.workspace.getProjectSummaryState.useQuery({projectId:S??""},{enabled:!!S&&!i,refetchInterval:i?!1:3e4}),E=e?.projectState??w;qtt(i?void 0:S);const T=E?.workspaces,A=E?.reviewCount??0,{data:O}=Ce.userSettings.getWorkspaceOrder.useQuery({projectId:S??""},{enabled:!!S&&!i}),I=Ce.useUtils();snt(S,i,I);const{needsAttention:N,clearAttention:D}=Vtt(),{workspaceList:F,existingNames:P,isCreating:$,startCreating:W,cancelCreating:V,startArchiving:H,cancelArchiving:z}=Xtt(T,{customOrder:i?void 0:O}),M=Ce.userSettings.updateWorkspaceOrder.useMutation({onMutate:async({projectId:Oe,workspaceIds:Be})=>{await I.userSettings.getWorkspaceOrder.cancel({projectId:Oe});const qe=I.userSettings.getWorkspaceOrder.getData({projectId:Oe});return I.userSettings.getWorkspaceOrder.setData({projectId:Oe},Be),{previousOrder:qe}},onError:(Oe,{projectId:Be},qe)=>{qe?.previousOrder!==void 0&&I.userSettings.getWorkspaceOrder.setData({projectId:Be},qe.previousOrder),I.userSettings.getWorkspaceOrder.invalidate({projectId:Be})}}),G=lRe(Oz(KO,{activationConstraint:{distance:8}}),Oz(VO,{coordinateGetter:DIe})),B=v.useCallback(Oe=>{const{active:Be,over:qe}=Oe;if(!(qe&&Be.id!==qe.id&&S))return;const Yt=F.filter(an=>an.uiState!=="creating").map(an=>an.id),qt=Yt.indexOf(Be.id),In=Yt.indexOf(qe.id);if(qt===-1||In===-1)return;const Kn=[...Yt];Kn.splice(qt,1),Kn.splice(In,0,Be.id),M.mutate({projectId:S,workspaceIds:Kn})},[F,S,M]),{handleCreate:Q}=Rle(S,o,P),q=v.useCallback(()=>{if(!(S&&!$))return;const Be=Pj(P);W(Be),Q(Be).catch(()=>{V()})},[S,$,P,W,Q,V]),Y=Ce.workspace.archive.useMutation({onSuccess:(Oe,Be)=>{I.workspace.getProjectSummaryState.invalidate({projectId:S});const qe=n.match(/\/workspaces\/([^/]+)/)?.[1];Be.id===qe&&r(`/projects/${o}/workspaces`)},onError:(Oe,Be)=>{z(Be.id),Qt.error(Oe.message)}}),K=v.useCallback((Oe,Be)=>{H(Oe),Y.mutate({id:Oe,commitUncommitted:Be})},[H,Y]),j=v.useCallback(Oe=>{Oe.prState==="MERGED"?K(Oe.id,!0):(m(Oe.id),d(!0))},[K]),re=T?.find(Oe=>Oe.id===f)?.gitStats?.hasUncommitted===!0,de=n.match(/\/workspaces\/([^/]+)/)?.[1],le=n.endsWith("/workspaces")||n.endsWith("/workspaces/");v.useEffect(()=>{de&&N(de)&&D(de)},[de,N,D]),v.useEffect(()=>{S&&g(S)},[S,g]),ont(n,i,_,o,l);const _e=v.useRef(n);v.useEffect(()=>{a&&n!==_e.current&&s(!1),_e.current=n},[n,a,s]);const Ae=v.useCallback(Oe=>{if(Oe==="__manage__"){r("/projects");return}if(Oe==="__create__"){r("/projects/new");return}l(Oe),localStorage.setItem(Yb,Oe),r(`/projects/${Oe}/workspaces`)},[r]),we=[{href:"/reviews",label:"Reviews",icon:Cp},{href:"/admin",label:"Admin",icon:Yq}];return h.jsxs(h.Fragment,{children:[h.jsx(cnt,{isMobile:a,selectedProjectSlug:o,onProjectChange:Ae,projects:_}),h.jsxs(kK,{collapsible:a?"offcanvas":"none",children:[h.jsx(lnt,{isMobile:a,onClose:()=>s(!1),projectSelector:h.jsx(Hle,{selectedProjectSlug:o,onProjectChange:Ae,projects:_})}),h.jsxs(IK,{className:"flex flex-col",children:[o&&h.jsxs(i2,{className:"flex-1 min-h-0 flex flex-col overflow-hidden px-0",children:[h.jsx(OK,{children:h.jsx(Ar,{to:`/projects/${o}/workspaces`,className:"hover:text-foreground transition-colors",children:"Workspaces"})}),h.jsxs("div",{className:"absolute right-2 top-2 flex items-center gap-0.5",children:[h.jsx(Ar,{to:`/projects/${o}/workspaces`,className:"p-1 rounded hover:bg-sidebar-accent transition-colors text-sidebar-foreground/70 hover:text-sidebar-foreground",title:"View Kanban board",children:h.jsx(Hq,{className:"h-3.5 w-3.5"})}),h.jsx("button",{type:"button",onClick:q,disabled:$,className:"p-1 rounded hover:bg-sidebar-accent transition-colors text-sidebar-foreground/70 hover:text-sidebar-foreground disabled:opacity-50",title:"New Workspace",children:$?h.jsx(un,{className:"h-3.5 w-3.5 animate-spin"}):h.jsx(Yd,{className:"h-3.5 w-3.5"})})]}),h.jsx(a2,{className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden scrollbar-hide",children:h.jsx(dnt,{workspaceList:F,currentWorkspaceId:de,selectedProjectId:S,selectedProjectSlug:o,isKanbanView:le,needsAttention:N,clearAttention:D,onArchiveRequest:j,sensors:G,onDragEnd:B,isMobile:a})})]}),h.jsx(RK,{}),h.jsx(i2,{className:"px-0",children:h.jsx(a2,{children:h.jsx(FO,{children:we.map(Oe=>{const Be=n===Oe.href||n?.startsWith(`${Oe.href}/`),qe=Oe.href==="/reviews"&&A>0;return h.jsx(y0,{children:h.jsx(v0,{asChild:!0,isActive:Be,children:h.jsxs(Ar,{to:Oe.href,children:[h.jsx(Oe.icon,{className:"h-4 w-4"}),h.jsx("span",{children:Oe.label}),qe&&h.jsx(gn,{variant:"secondary",className:"ml-auto h-5 min-w-5 px-1.5 text-xs bg-orange-500/20 text-orange-600 border-orange-500/30",children:A})]})})},Oe.href)})})})})]}),h.jsxs(AK,{className:"border-t border-sidebar-border px-2 py-2",children:[!i&&h.jsx(pnt,{}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("a",{href:"https://github.com/purplefish-ai/factory-factory",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1",children:["GitHub",h.jsx(Xw,{className:"h-3 w-3"})]}),h.jsx(Ytt,{})]})]}),h.jsx(gZ,{open:c,onOpenChange:d,hasUncommitted:re,onConfirm:Oe=>{f&&K(f,Oe)}})]})]})}function dnt({workspaceList:e,currentWorkspaceId:t,selectedProjectId:n,selectedProjectSlug:r,isKanbanView:i,needsAttention:a,clearAttention:s,onArchiveRequest:o,sensors:l,onDragEnd:c,isMobile:d}){const f=e.map(g=>g.uiState==="creating"?h.jsx(Qtt,{},g.id):d?h.jsx(hnt,{workspace:g,isActive:t===g.id,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:o,disableRatchetAnimation:i,needsAttention:a,clearAttention:s},g.id):h.jsx(fnt,{workspace:g,isActive:t===g.id,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:o,disableRatchetAnimation:i,needsAttention:a,clearAttention:s},g.id)),m=h.jsxs(FO,{className:"gap-1.5 p-0",children:[f,e.length===0&&h.jsx("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:"No active workspaces"})]});return d?m:h.jsx(uIe,{sensors:l,collisionDetection:uRe,onDragEnd:c,children:h.jsx(wIe,{items:e.filter(g=>g.uiState!=="creating").map(g=>g.id),strategy:xIe,children:m})})}function hnt({workspace:e,isActive:t,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:i,disableRatchetAnimation:a,needsAttention:s,clearAttention:o}){return e.uiState==="archiving"?h.jsx($le,{workspace:e,selectedProjectSlug:r}):h.jsx(Ule,{workspace:e,isActive:t,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:i,disableRatchetAnimation:a,needsAttention:s,clearAttention:o,hideDragHandle:!0})}function fnt({workspace:e,isActive:t,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:i,disableRatchetAnimation:a,needsAttention:s,clearAttention:o}){const{attributes:l,listeners:c,setNodeRef:d,transform:f,transition:m,isDragging:g}=RIe({id:e.id}),y={transform:yy.Transform.toString(f),transition:m};return e.uiState==="archiving"?h.jsx($le,{workspace:e,selectedProjectSlug:r,sortableRef:d,sortableStyle:y}):h.jsx(Ule,{workspace:e,isActive:t,selectedProjectId:n,selectedProjectSlug:r,onArchiveRequest:i,disableRatchetAnimation:a,needsAttention:s,clearAttention:o,sortableRef:d,sortableStyle:y,sortableAttributes:l,sortableListeners:c,isDragging:g})}function pnt(){const{data:e,isLoading:t}=Ce.admin.getServerInfo.useQuery(void 0,{retry:1,retryDelay:1e3,meta:{suppressErrors:!0}}),n=window.location.port?Number.parseInt(window.location.port,10):null,r=e?.backendPort??null;if(t||!n||!(n!==3e3||r!==null&&r!==3001))return null;const l=r!==null&&n!==r;return h.jsx("div",{className:"mb-2 space-y-0.5 text-[10px] text-muted-foreground/80",children:l?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{children:"Frontend:"}),h.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:n})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{children:"Backend:"}),r?h.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:r}):h.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-muted-foreground/50",children:"(restart to detect)"})]})]}):h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{children:"Server:"}),r?h.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:r}):h.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-muted-foreground/50",children:"(restart to detect)"})]})})}function mnt(){const[e,t]=v.useState(!1),{data:n,isLoading:r,refetch:i,isRefetching:a}=Ce.admin.checkCLIHealth.useQuery({forceRefresh:!1},{refetchOnWindowFocus:!1,refetchOnReconnect:!1,staleTime:6e4}),s=n?.allHealthy;if(v.useEffect(()=>{s===!1&&t(!1)},[s]),r||e||!n||n.allHealthy)return null;const o=[];return n.claude.isInstalled||o.push({title:"Claude CLI not installed",description:"Install the Claude CLI to enable AI-powered coding sessions.",link:"https://claude.ai/download"}),n.github.isInstalled?n.github.isAuthenticated||o.push({title:"GitHub CLI not authenticated",description:'Run "gh auth login" in your terminal to authenticate with GitHub.'}):o.push({title:"GitHub CLI not installed",description:"Install the GitHub CLI (gh) to enable PR management features.",link:"https://cli.github.com/"}),o.length===0?null:h.jsx("div",{className:"border-b border-warning/20 bg-warning/10 px-4 py-3",children:h.jsx("div",{className:"mx-auto max-w-7xl",children:h.jsxs("div",{className:"flex items-start justify-between gap-4",children:[h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx(hc,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-warning"}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-sm font-medium text-warning-foreground dark:text-warning",children:"Some features require additional setup"}),h.jsx("ul",{className:"space-y-1.5",children:o.map(l=>h.jsxs("li",{className:"text-sm text-foreground/80",children:[h.jsxs("span",{className:"font-medium",children:[l.title,":"]})," ",l.description,l.link&&h.jsxs("a",{href:l.link,target:"_blank",rel:"noopener noreferrer",className:"ml-1.5 inline-flex items-center gap-1 text-warning underline hover:text-warning/80",children:["Install",h.jsx(Xw,{className:"h-3 w-3"})]})]},l.title))})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs(We,{variant:"ghost",size:"sm",onClick:()=>i(),disabled:a,className:"h-8 text-warning hover:bg-warning/20",children:[h.jsx(dc,{className:`mr-1.5 h-3.5 w-3.5 ${a?"animate-spin":""}`}),"Recheck"]}),h.jsxs(We,{variant:"ghost",size:"icon",onClick:()=>t(!0),className:"h-8 w-8 text-warning hover:bg-warning/20",children:[h.jsx(Ao,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Dismiss"})]})]})]})})})}function gnt({children:e}){return h.jsx(d2e,{attribute:"class",defaultTheme:"dark",enableSystem:!0,disableTransitionOnChange:!0,children:e})}function bnt(){const{projects:e,isLoading:t}=tve(),n=to(),{pathname:r}=ko(),i=!t&&e&&e.length>0;return v.useEffect(()=>{const a=/^\/projects\/[^/]+/.test(r);!t&&e?.length===0&&!r.startsWith("/projects/new")&&!a&&n("/projects/new")},[t,e,r,n]),h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsx(mnt,{}),h.jsx(o2e,{sidebar:i?h.jsx(unt,{}):null,className:"flex-1 overflow-hidden",children:h.jsx(CG,{})})]})}function ynt(){return h.jsx(gnt,{children:h.jsxs(nve,{children:[h.jsx(G2e,{}),h.jsx(bnt,{}),h.jsx(W2e,{})]})})}function Du({className:e,...t}){return h.jsx(un,{role:"status","aria-label":"Loading",className:ne("size-4 animate-spin text-brand",e),...t})}function Wle({open:e,onOpenChange:t,title:n,description:r,confirmText:i="Continue",cancelText:a="Cancel",variant:s="default",onConfirm:o,isPending:l=!1}){return h.jsx(oZ,{open:e,onOpenChange:t,children:h.jsxs(QO,{children:[h.jsxs(JO,{children:[h.jsx(tD,{children:n}),h.jsx(nD,{children:r})]}),h.jsxs(eD,{children:[h.jsx(iD,{disabled:l,children:a}),h.jsx(rD,{onClick:c=>{c.preventDefault(),o()},disabled:l,className:ne(s==="destructive"&&Qd({variant:"destructive"})),children:l?h.jsx(Du,{className:"size-4"}):i})]})]})})}function Qu(e){return Object.values(e)}const vnt=qr(Qu(Rtt)),_nt=qr(Qu(Itt)),xnt=qr(Qu(Ble)),Snt=qr(Qu(Dle)),wnt=qr(Qu(Mle)),Ent=qr(Qu(Lle)),q7=qr(Qu(Ple)),Gle=qr(Qu(Ole)),qle=qr(["CLAUDE","CODEX"]),V7=qr(["WORKSPACE_DEFAULT","CLAUDE","CODEX"]),Cnt=nn({id:ke(),name:ke(),slug:ke(),repoPath:ke(),worktreeBasePath:ke(),defaultBranch:ke(),githubOwner:ke().nullable(),githubRepo:ke().nullable(),isArchived:Ui(),startupScriptCommand:ke().nullable(),startupScriptPath:ke().nullable(),startupScriptTimeout:hi(),createdAt:ke(),updatedAt:ke()}),Tnt=nn({id:ke(),projectId:ke(),name:ke(),description:ke().nullable(),status:vnt,worktreePath:ke().nullable(),branchName:ke().nullable(),isAutoGeneratedBranch:Ui(),creationSource:_nt,creationMetadata:Cu().nullable(),initErrorMessage:ke().nullable(),initOutput:ke().nullable(),initStartedAt:ke().nullable(),initCompletedAt:ke().nullable(),initRetryCount:hi(),runScriptCommand:ke().nullable(),runScriptCleanupCommand:ke().nullable(),runScriptPid:hi().nullable(),runScriptPort:hi().nullable(),runScriptStartedAt:ke().nullable(),runScriptStatus:xnt,prUrl:ke().nullable(),githubIssueNumber:hi().nullable(),githubIssueUrl:ke().nullable(),defaultSessionProvider:V7,ratchetSessionProvider:V7,prNumber:hi().nullable(),prState:Snt,prReviewState:ke().nullable(),prCiStatus:wnt,prUpdatedAt:ke().nullable(),prCiFailedAt:ke().nullable(),prCiLastNotifiedAt:ke().nullable(),prReviewLastCheckedAt:ke().nullable(),prReviewLastCommentId:ke().nullable(),ratchetEnabled:Ui(),ratchetState:q7,ratchetLastCheckedAt:ke().nullable(),ratchetLastPushAt:ke().nullable(),ratchetActiveSessionId:ke().nullable(),ratchetLastCiRunId:ke().nullable(),ratchetLastNotifiedState:q7.nullable(),hasHadSessions:Ui(),cachedKanbanColumn:Ent,stateComputedAt:ke().nullable(),createdAt:ke(),updatedAt:ke()}),knt=nn({id:ke(),workspaceId:ke(),name:ke().nullable(),workflow:ke(),model:ke(),status:Gle,provider:qle,providerSessionId:ke().nullable(),providerProjectPath:ke().nullable(),providerProcessPid:hi().nullable(),providerMetadata:Cu().nullable(),createdAt:ke(),updatedAt:ke()}),Nnt=nn({id:ke(),workspaceId:ke(),name:ke().nullable(),status:Gle,pid:hi().nullable(),createdAt:ke(),updatedAt:ke()}),Ant=nn({preferredIde:ke(),customIdeCommand:ke().nullable(),playSoundOnComplete:Ui(),notificationSoundPath:ke().nullable(),ratchetEnabled:Ui(),defaultSessionProvider:qle}),Rnt=nn({meta:nn({exportedAt:ke(),version:ke(),schemaVersion:Pr(3)}),data:nn({projects:Ya(Cnt),workspaces:Ya(Tnt),agentSessions:Ya(knt),terminalSessions:Ya(Nnt),userSettings:Ant.nullable()})});function Vle({onImportSuccess:e,variant:t="outline",className:n,children:r}){const i=v.useRef(null),[a,s]=v.useState({open:!1,data:null,summary:""}),o=Ce.useUtils(),l=Ce.admin.importData.useMutation({onSuccess:async y=>{const{results:_}=y,S=[`Projects: ${_.projects.imported} imported, ${_.projects.skipped} skipped`,`Workspaces: ${_.workspaces.imported} imported, ${_.workspaces.skipped} skipped`,`Agent Sessions: ${_.agentSessions.imported} imported, ${_.agentSessions.skipped} skipped`,`Terminal Sessions: ${_.terminalSessions.imported} imported, ${_.terminalSessions.skipped} skipped`,`User Settings: ${_.userSettings.imported?"imported":_.userSettings.skipped?"skipped (exists)":"none"}`].join(`
|
|
423
423
|
`);Qt.success("Import completed",{description:S,duration:1e4}),s({open:!1,data:null,summary:""}),await o.invalidate(),e?.()},onError:y=>{Qt.error(`Import failed: ${y.message}`),s({open:!1,data:null,summary:""})}}),c=y=>[`Exported: ${new Date(y.meta.exportedAt).toLocaleString()}`,`Version: ${y.meta.version}`,"",`Projects: ${y.data.projects.length}`,`Workspaces: ${y.data.workspaces.length}`,`Agent Sessions: ${y.data.agentSessions.length}`,`Terminal Sessions: ${y.data.terminalSessions.length}`,`User Settings: ${y.data.userSettings?"Yes":"No"}`].join(`
|
|
424
424
|
`),d=y=>y instanceof Error?y.message:"Unknown error",f=async y=>{const _=await y.text(),S=JSON.parse(_),w=Rnt.safeParse(S);if(!w.success)throw new Error(`Invalid backup file format: ${w.error.message}`);return w.data},m=async y=>{const _=y.target.files?.[0];if(_){try{const S=await f(_);s({open:!0,data:S,summary:c(S)})}catch(S){Qt.error(`Failed to read file: ${d(S)}`)}i.current&&(i.current.value="")}},g=()=>{a.data&&l.mutate(a.data)};return h.jsxs(h.Fragment,{children:[h.jsxs(We,{onClick:()=>i.current?.click(),disabled:l.isPending,variant:t,className:n,children:[h.jsx(sxe,{className:"w-4 h-4 mr-2"}),l.isPending?"Importing...":r||"Import Data"]}),h.jsx("input",{ref:i,type:"file",accept:".json",onChange:m,className:"hidden"}),h.jsx(Wle,{open:a.open,onOpenChange:y=>{y||s({open:!1,data:null,summary:""})},title:"Confirm Import",description:`Review the data to be imported. Existing records will be skipped.
|
|
425
425
|
|
|
@@ -443,5 +443,5 @@ Supported text files: ${i}`)}}function Dlt({setAttachments:e,disabled:t=!1}){con
|
|
|
443
443
|
- `)||t.includes(`
|
|
444
444
|
1. `)}function Zlt(e){if(e.length===0)return null;const t=e.filter(n=>Xlt(n)).sort((n,r)=>r.length-n.length)[0];return t||(e.sort((n,r)=>r.length-n.length)[0]??null)}function Gue(e,t){return e.map(n=>Ky(n,t+1)).filter(n=>typeof n=="string"&&n.trim().length>0)}function Qlt(e,t){const n=e.trim();if(n.length===0)return null;const r=Klt(n);if(r!==n){const i=Ky(r,t+1);if(i)return i}if(n.startsWith("{")||n.startsWith("["))try{const i=JSON.parse(n);return Ky(i,t+1)}catch{return e}return e}function Jlt(e,t){const n=Gue(e,t);return n.length===0?null:n.join(`
|
|
445
445
|
|
|
446
|
-
`)}function ect(e,t){const n=["plan","markdown","text","content","value","message"];for(const r of n){if(!(r in e))continue;const i=Ky(e[r],t+1);if(i)return i}return null}function tct(e){const t=Reflect.get(e,"type");if(t!=="text"&&t!=="markdown")return null;const n=Reflect.get(e,"text");return typeof n=="string"&&n.trim().length>0?n:null}function nct(e,t){const n=ect(e,t);if(n)return n;const r=tct(e);if(r)return r;const i=Gue(Object.values(e),t);return Zlt(i)}function Ky(e,t){return t>Ylt?null:typeof e=="string"?Qlt(e,t):Array.isArray(e)?Jlt(e,t):typeof e=="object"&&e!==null?nct(e,t):null}function kW(e){return Ky(e,0)}const que="ff:plan-view-mode",bA="rendered";function rct(e){return e==="rendered"||e==="raw"}function ict(){if(typeof window>"u")return bA;try{const e=window.localStorage.getItem(que);if(e&&rct(e))return e}catch{return bA}return bA}function act(e){if(!(typeof window>"u"))try{window.localStorage.setItem(que,e)}catch{}}function sct(){const[e,t]=v.useState(()=>ict());return v.useEffect(()=>{act(e)},[e]),[e,t]}function Vue(e){if("command"in e&&typeof e.command=="string")return e.command;if("file_path"in e&&typeof e.file_path=="string")return e.file_path;if("pattern"in e&&typeof e.pattern=="string")return e.pattern;const t=Object.keys(e);if(t.length===0)return"No parameters";const n=t[0];if(!n)return"No parameters";const r=e[n];return typeof r=="string"&&r.length<100?r:`${t.length} parameter${t.length===1?"":"s"}`}function oct(e){const t=kW(e.planContent);if(t)return t;const n=kW(e.toolInput.plan);if(n)return n;if(typeof e.planContent=="string"&&e.planContent.length>0)return e.planContent;if(typeof e.toolInput.plan=="string"&&e.toolInput.plan.length>0)return e.toolInput.plan;if(typeof e.toolInput.plan=="object"&&e.toolInput.plan!==null)try{return JSON.stringify(e.toolInput.plan,null,2)}catch{return String(e.toolInput.plan)}return null}function lct({value:e,onChange:t}){return h.jsx("div",{className:"flex items-center rounded-md border bg-background p-0.5",children:["rendered","raw"].map(n=>h.jsx("button",{type:"button","aria-pressed":e===n,onClick:()=>t(n),className:ne("text-[11px] px-2 py-1 rounded-sm transition-colors",e===n?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:n==="rendered"?"Rendered":"Raw"},n))})}function cct({permission:e,onApprove:t}){const n=v.useRef(null),[r,i]=v.useState(!0),[a,s]=sct(),o=e?.requestId;if(v.useEffect(()=>{if(!o)return;const m=setTimeout(()=>{n.current?.focus()},100);return()=>clearTimeout(m)},[o]),!e)return null;const{requestId:l}=e,c=oct(e),d=()=>{t(l,!0)},f=()=>{t(l,!1)};return h.jsx("div",{className:"border-b bg-muted/50 p-3",role:"alertdialog","aria-label":"Plan approval request",children:h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(o0,{className:"h-5 w-5 shrink-0 text-blue-500","aria-hidden":"true"}),h.jsx("span",{className:"text-sm font-medium",children:"Review Plan"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[c&&h.jsx(lct,{value:a,onChange:s}),h.jsx("button",{type:"button",onClick:()=>i(!r),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:r?"Collapse":"Expand"})]})]}),r&&c&&h.jsx("div",{className:"bg-background rounded-md border overflow-hidden",children:h.jsx("div",{className:"max-h-[70vh] overflow-auto",children:a==="rendered"?h.jsx("div",{className:"p-3",children:h.jsx(Rh,{content:c})}):h.jsx("pre",{className:"text-xs p-3 whitespace-pre-wrap font-mono",children:c})})}),!c&&h.jsx("div",{className:"text-xs text-muted-foreground italic",children:"No plan content available"}),h.jsx("p",{className:"text-[11px] text-muted-foreground",children:"You can also type feedback in the chat input below to request changes."}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsxs(We,{variant:"outline",size:"sm",onClick:f,className:"gap-1.5",children:[h.jsx(yS,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Reject Plan"]}),h.jsxs(We,{ref:n,size:"sm",onClick:d,className:"gap-1.5",children:[h.jsx(Ib,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Approve Plan"]})]})]})})}function uct({permission:e,onApprove:t}){const n=v.useRef(null),r=e?.requestId;if(v.useEffect(()=>{if(!r)return;const g=setTimeout(()=>n.current?.focus(),100);return()=>clearTimeout(g)},[r]),!e?.acpOptions)return null;const{requestId:i,toolName:a,toolInput:s,acpOptions:o}=e,l=Vue(s),c=o.filter(g=>g.kind.startsWith("allow")),d=o.filter(g=>g.kind.startsWith("reject")),f=(g,y)=>{const _=y.startsWith("allow");t(i,_,g)},m=g=>{switch(g){case"allow_once":return{variant:"outline",icon:Ib};case"allow_always":return{variant:"default",icon:Ib};case"reject_once":return{variant:"outline",icon:yS};case"reject_always":return{variant:"destructive",icon:yS};default:return{variant:"outline",icon:Ib}}};return h.jsxs(dC,{icon:h.jsx(El,{className:"h-5 w-5 text-muted-foreground","aria-hidden":"true"}),label:`Permission request for ${a}`,actions:h.jsx("div",{className:"flex flex-wrap gap-2",children:[...c,...d].map((g,y)=>{const _=m(g.kind),S=_.icon;return h.jsxs(We,{ref:y===0?n:void 0,variant:_.variant,size:"sm",onClick:()=>f(g.optionId,g.kind),className:"gap-1.5",children:[h.jsx(S,{className:"h-3.5 w-3.5","aria-hidden":"true"}),g.name]},g.optionId)})}),children:[h.jsxs("div",{className:"text-sm font-medium",children:["Permission: ",a]}),h.jsx("div",{className:"text-xs text-muted-foreground mt-1 font-mono truncate",title:l,children:l})]})}function dct({permission:e,onApprove:t}){const n=v.useRef(null),r=e?.requestId;if(v.useEffect(()=>{if(!r)return;const d=setTimeout(()=>{n.current?.focus()},100);return()=>clearTimeout(d)},[r]),!e)return null;if(e.acpOptions&&e.acpOptions.length>0)return h.jsx(uct,{permission:e,onApprove:t});if(e.toolName==="ExitPlanMode")return h.jsx(cct,{permission:e,onApprove:t});const{requestId:i,toolName:a,toolInput:s}=e,o=Vue(s),l=()=>{t(i,!0)},c=()=>{t(i,!1)};return h.jsxs(dC,{icon:h.jsx(El,{className:"h-5 w-5 text-muted-foreground","aria-hidden":"true"}),label:`Permission request for ${a}`,actions:h.jsxs(h.Fragment,{children:[h.jsxs(We,{variant:"outline",size:"sm",onClick:c,className:"gap-1.5",children:[h.jsx(yS,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Deny"]}),h.jsxs(We,{ref:n,size:"sm",onClick:l,className:"gap-1.5",children:[h.jsx(Ib,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Allow"]})]}),children:[h.jsxs("div",{className:"text-sm font-medium",children:["Permission: ",a]}),h.jsx("div",{className:"text-xs text-muted-foreground mt-1 font-mono truncate",title:o,children:o})]})}const or="__other__";function Yue(e){return e?.trim()??""}function NI(e,t,n){const r=Yue(n);return e.multiSelect?!Array.isArray(t)||t.length===0?!1:t.includes(or)?r.length>0:!0:typeof t!="string"||t.length===0?!1:t===or?r.length>0:!0}function hct(e,t,n){const r=Yue(n);return t===void 0?e.multiSelect?[]:"":e.multiSelect&&Array.isArray(t)?t.includes(or)?r?t.map(i=>i===or?r:i):t.filter(i=>i!==or):t:!e.multiSelect&&t===or&&r?r:!e.multiSelect&&t===or?"":t}function fct({question:e,requestId:t,answers:n,otherTexts:r,onAnswerChange:i,onOtherTextChange:a,onSubmit:s,isComplete:o}){return h.jsx(dC,{icon:h.jsx(Lq,{className:"h-5 w-5 text-blue-500","aria-hidden":"true"}),role:"form",label:"Question from Claude",actions:h.jsx("div",{className:"self-end",children:h.jsx(We,{size:"sm",onClick:s,disabled:!o,children:"Submit"})}),children:h.jsx("div",{className:"space-y-3",children:e.multiSelect?h.jsx(Xue,{question:e,index:0,value:n[0]??[],onChange:l=>i(0,l),otherText:r[0]??"",onOtherTextChange:l=>a(0,l),requestId:t}):h.jsx(Kue,{question:e,index:0,value:n[0]??"",onChange:l=>i(0,l),otherText:r[0]??"",onOtherTextChange:l=>a(0,l),requestId:t})})})}function pct({question:e,requestId:t,currentIndex:n,answers:r,otherTexts:i,onAnswerChange:a,onOtherTextChange:s,onSubmit:o,onIndexChange:l,isComplete:c,isCurrentAnswered:d}){const f=e.questions.length,m=e.questions[n],g=n===f-1,y=n===0;return h.jsxs(dC,{icon:h.jsx(Lq,{className:"h-5 w-5 text-blue-500","aria-hidden":"true"}),role:"form",label:"Questions from Claude",actions:h.jsxs("div",{className:"self-end flex items-center gap-1",children:[h.jsx(We,{variant:"ghost",size:"sm",onClick:()=>l(n-1),disabled:y,className:"h-8 w-8 p-0","aria-label":"Previous question",children:h.jsx(Dq,{className:"h-4 w-4"})}),g?h.jsx(We,{size:"sm",onClick:o,disabled:!c,children:"Submit"}):h.jsx(We,{size:"sm",onClick:()=>l(n+1),disabled:!d,children:"Next"}),!g&&h.jsx(We,{variant:"ghost",size:"sm",onClick:()=>l(n+1),className:"h-8 w-8 p-0","aria-label":"Next question",children:h.jsx(xs,{className:"h-4 w-4"})})]}),children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsxs("span",{className:"text-xs text-muted-foreground",children:["Question ",n+1," of ",f]}),h.jsx("div",{className:"flex gap-1",children:e.questions.map((_,S)=>{const w=NI(_,r[S],i[S]??"");return h.jsx("button",{type:"button",onClick:()=>l(S),className:ne("w-2 h-2 rounded-full transition-colors",S===n?"bg-primary":w?"bg-primary/50":"bg-muted-foreground/30"),"aria-label":`Go to question ${S+1}`},`dot-${t}-${S}-${_.question}`)})})]}),m?m.multiSelect?h.jsx(Xue,{question:m,index:n,value:r[n]??[],onChange:_=>a(n,_),otherText:i[n]??"",onOtherTextChange:_=>s(n,_),requestId:t}):h.jsx(Kue,{question:m,index:n,value:r[n]??"",onChange:_=>a(n,_),otherText:i[n]??"",onOtherTextChange:_=>s(n,_),requestId:t}):null]})}function Kue({question:e,index:t,value:n,onChange:r,otherText:i,onOtherTextChange:a,requestId:s}){const o=typeof n=="string"?n:"",l=`${s}-${t}`;return h.jsxs("div",{className:"space-y-1.5",children:[e.header&&h.jsx("h4",{className:"text-xs font-medium text-muted-foreground",children:e.header}),h.jsx("p",{className:"text-sm font-medium",children:e.question}),h.jsxs(Qj,{value:o,onValueChange:r,className:"space-y-1.5",children:[e.options.map(c=>h.jsxs("label",{htmlFor:`question-${l}-option-${c.label}`,className:ne("flex items-center gap-2 p-1.5 rounded-md border transition-colors cursor-pointer hover:bg-background",o===c.label&&"border-primary bg-primary/5"),children:[h.jsx(Vy,{value:c.label,id:`question-${l}-option-${c.label}`,className:"shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:"text-sm",children:c.label}),c.description&&h.jsx("p",{className:"text-xs text-muted-foreground truncate",children:c.description})]})]},`${t}-${c.label}`)),h.jsxs("label",{htmlFor:`question-${l}-option-other`,className:ne("flex items-start gap-2 p-1.5 rounded-md border transition-colors cursor-pointer hover:bg-background",o===or&&"border-primary bg-primary/5"),children:[h.jsx(Vy,{value:or,id:`question-${l}-option-other`,className:"shrink-0 mt-1"}),h.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[h.jsx("span",{className:"text-sm font-medium",children:"Other"}),h.jsx(ym,{value:i,"aria-label":"Other response",onFocus:()=>{o!==or&&r(or)},onClick:()=>{o!==or&&r(or)},onBlur:()=>{o===or&&i.trim().length===0&&r("")},onChange:c=>{const d=c.target.value;a(d),d.trim().length>0&&o!==or&&r(or)},placeholder:"Type your response...",className:"min-h-[42px] text-sm py-1.5"})]})]})]})]})}function Xue({question:e,index:t,value:n,onChange:r,otherText:i,onOtherTextChange:a,requestId:s}){const o=Array.isArray(n)?n:[],l=`${s}-${t}`,c=v.useCallback((d,f)=>{r(f?[...o,d]:o.filter(m=>m!==d))},[o,r]);return h.jsxs("div",{className:"space-y-1.5",children:[e.header&&h.jsx("h4",{className:"text-xs font-medium text-muted-foreground",children:e.header}),h.jsx("p",{className:"text-sm font-medium",children:e.question}),h.jsxs("div",{className:"space-y-1.5",children:[e.options.map(d=>{const f=o.includes(d.label);return h.jsxs("label",{htmlFor:`question-${l}-option-${d.label}`,className:ne("flex items-center gap-2 p-1.5 rounded-md border transition-colors cursor-pointer hover:bg-background",f&&"border-primary bg-primary/5"),children:[h.jsx(LS,{id:`question-${l}-option-${d.label}`,checked:f,onCheckedChange:m=>c(d.label,m===!0),className:"shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:"text-sm",children:d.label}),d.description&&h.jsx("p",{className:"text-xs text-muted-foreground truncate",children:d.description})]})]},`${t}-${d.label}`)}),h.jsxs("label",{htmlFor:`question-${l}-option-other`,className:ne("flex items-start gap-2 p-1.5 rounded-md border transition-colors cursor-pointer hover:bg-background",o.includes(or)&&"border-primary bg-primary/5"),children:[h.jsx(LS,{id:`question-${l}-option-other`,checked:o.includes(or),onCheckedChange:d=>{d===!0?r([...o,or]):(a(""),r(o.filter(m=>m!==or)))},className:"shrink-0 mt-1"}),h.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[h.jsx("span",{className:"text-sm font-medium",children:"Other"}),h.jsx(ym,{value:i,"aria-label":"Other response",onFocus:()=>{o.includes(or)||r([...o,or])},onClick:()=>{o.includes(or)||r([...o,or])},onBlur:()=>{i.trim().length===0&&o.includes(or)&&r(o.filter(d=>d!==or))},onChange:d=>{const f=d.target.value;a(f),f.trim().length>0&&!o.includes(or)&&r([...o,or])},placeholder:"Type your response...",className:"min-h-[42px] text-sm py-1.5"})]})]})]})]})}function mct({question:e,onAnswer:t}){const[n,r]=v.useState({}),[i,a]=v.useState(0),[s,o]=v.useState({}),l=v.useRef(null),c=e?.requestId;v.useEffect(()=>{c&&(r({}),a(0),o({}))},[c]),v.useEffect(()=>{if(!c)return;const w=setTimeout(()=>{l.current?.querySelector('input, button, textarea, [tabindex]:not([tabindex="-1"])')?.focus()},100);return()=>clearTimeout(w)},[c]);const d=v.useCallback((w,E)=>{r(T=>({...T,[w]:E}))},[]),f=v.useCallback((w,E)=>{o(T=>({...T,[w]:E}))},[]),m=v.useCallback(()=>{if(!e)return;const w={};e.questions.forEach((E,T)=>{w[E.question]=hct(E,n[T],s[T]??"")}),t(e.requestId,w),r({}),a(0),o({})},[e,n,s,t]),g=e?.questions.every((w,E)=>NI(w,n[E],s[E]??"")),y=(()=>{if(!e)return!1;const w=e.questions[i];return w?NI(w,n[i],s[i]??""):!1})();if(!e)return null;const _=e.questions.length,S=c??"unknown";if(_===1){const w=e.questions[0];return w?h.jsx("div",{ref:l,children:h.jsx(fct,{question:w,requestId:S,answers:n,otherTexts:s,onAnswerChange:d,onOtherTextChange:f,onSubmit:m,isComplete:!!g})}):null}return h.jsx("div",{ref:l,children:h.jsx(pct,{question:e,requestId:S,currentIndex:i,answers:n,otherTexts:s,onAnswerChange:d,onOtherTextChange:f,onSubmit:m,onIndexChange:a,isComplete:!!g,isCurrentAnswered:y})})}function gct({rewindPreview:e,onConfirm:t,onCancel:n}){const r=e!==null,i=e?.isLoading??!1,a=e?.isExecuting??!1,s=!!e?.error,o=e?.affectedFiles??[],l=o.length>0;return h.jsx(dv,{open:r,onOpenChange:c=>!c&&n(),children:h.jsxs(Lm,{className:"sm:max-w-md",children:[h.jsxs(hv,{children:[h.jsxs(fv,{className:"flex items-center gap-2",children:[h.jsx(WA,{className:"h-5 w-5 text-amber-500"}),"Rewind Files"]}),h.jsx(pv,{children:"This will revert file changes to the state before the selected message was processed."})]}),h.jsx("div",{className:"py-4",children:i?h.jsxs("div",{className:"flex items-center justify-center py-6",children:[h.jsx(un,{className:"h-6 w-6 animate-spin text-muted-foreground"}),h.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:a?"Reverting files...":"Loading preview..."})]}):s?h.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-destructive/50 bg-destructive/10 p-3",children:[h.jsx(hc,{className:"h-5 w-5 text-destructive flex-shrink-0 mt-0.5"}),h.jsx("div",{className:"text-sm text-destructive",children:e?.error})]}):l?h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[h.jsx(o0,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{children:"Files that will be reverted:"})]}),h.jsx("div",{className:"max-h-48 overflow-y-auto rounded-lg border bg-muted/30",children:h.jsx("ul",{className:"divide-y divide-border",children:o.map(c=>h.jsx("li",{className:"px-3 py-2 text-sm font-mono truncate",title:c,children:c},c))})}),h.jsxs("div",{className:ne("flex items-start gap-2 rounded-lg border p-3 text-sm","border-amber-500/50 bg-amber-50 dark:bg-amber-900/20"),children:[h.jsx(hc,{className:"h-4 w-4 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5"}),h.jsx("span",{className:"text-amber-800 dark:text-amber-200",children:"This action cannot be undone. Make sure you want to revert these changes."})]})]}):h.jsx("div",{className:"text-center py-6 text-sm text-muted-foreground",children:"No files were modified since this message. There's nothing to rewind."})}),h.jsxs(tC,{children:[h.jsx(We,{variant:"outline",onClick:n,disabled:i,children:"Cancel"}),h.jsxs(We,{variant:"destructive",onClick:t,disabled:i||s||!l,className:"bg-amber-600 hover:bg-amber-700",children:[h.jsx(WA,{className:"mr-2 h-4 w-4"}),"Rewind Files"]})]})]})})}const bct=v.memo(function({notification:t,onDismiss:n}){return h.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-2 rounded-md hover:bg-muted/50 group",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:"text-xs text-foreground truncate",children:t.message}),h.jsx("p",{className:"text-[10px] text-muted-foreground",children:SO(t.timestamp)})]}),n&&h.jsx(We,{variant:"ghost",size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",onClick:n,"aria-label":"Dismiss notification",children:h.jsx(Ao,{className:"h-3 w-3"})})]})});v.memo(function({notifications:t,onDismiss:n,onClearAll:r,className:i}){const a=v.useCallback(o=>()=>{n?.(o)},[n]),s=v.useMemo(()=>[...t].reverse(),[t]);return t.length===0?null:h.jsx("div",{className:i,children:h.jsx("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:h.jsxs("div",{className:"p-2 space-y-1",children:[h.jsxs("div",{className:"flex items-center justify-between px-2 py-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(bve,{className:"h-3.5 w-3.5 text-muted-foreground"}),h.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:["Notifications (",t.length,")"]})]}),r&&t.length>1&&h.jsx(We,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[10px] text-muted-foreground hover:text-foreground",onClick:r,children:"Clear all"})]}),h.jsx("div",{className:"space-y-0.5 max-h-32 overflow-y-auto",children:s.map(o=>h.jsx(bct,{notification:o,onDismiss:n?a(o.id):void 0},o.id))})]})})})});function hC(e){{const t=()=>{};return{log:t,group:t,groupEnd:t}}}const yct=hC(),Zue=(...e)=>{yct.log(...e)};function Que(){return`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function vct(e,t,n){if(!n)return e;for(let r=e.messages.length-1;r>=0;r-=1){const i=e.messages[r];if(!i||i.source!=="agent"||!i.message||!fh(i.message))continue;const a=i.message.event;if(a?.type!=="content_block_start"||a.content_block.type!=="thinking"||a.index!==t)continue;const s=[...e.messages];return s[r]={...i,message:{...i.message,event:{...a,content_block:{...a.content_block,thinking:(a.content_block.thinking??"")+n}}}},{...e,messages:s}}return e}function _ct(e,t){return{id:Que(),source:"agent",message:e,timestamp:new Date().toISOString(),order:t}}function fC(e,t){const n=t.order;let r=0,i=e.length;for(;r<i;){const s=Math.floor((r+i)/2),o=e[s];if(!o)throw new Error(`Missing message at index ${s}`);o.order<=n?r=s+1:i=s}const a=[...e];return a.splice(r,0,t),a}function NW(e,t){if(e.source!=="agent"||!e.message)return!1;const n=e.message;if(!fh(n))return!1;const r=n.event;return r.type!=="content_block_start"||r.content_block.type!=="tool_use"?!1:r.content_block.id===t}function AI(e){return fh(e)?pZe(e.event):null}function xct(e,t,n){const r=e.messages.findIndex(l=>l.source==="agent"&&l.order===n);if(r<0)return null;const i=e.messages[r];if(!i)return null;const a=i.message?AI(i.message):null,s=AI(t),o=[...e.messages];if(o[r]={...i,message:t,timestamp:t.timestamp??i.timestamp},a!==s){const l=new Map(e.toolUseIdToIndex);return a&&l.delete(a),s&&l.set(s,r),{...e,messages:o,toolUseIdToIndex:l}}return{...e,messages:o}}function Sct(e,t,n){let r=e;if(t.type==="result"&&(r={...r,tokenStats:kZe(r.tokenStats,t)},oZe(r.messages,t))||(fh(t)&&t.event.type==="message_start"&&(r={...r,latestThinking:null}),fh(t)&&t.event.type==="content_block_delta"&&t.event.delta.type==="thinking_delta"&&(r=vct(r,t.event.index,t.event.delta.thinking),r={...r,latestThinking:(r.latestThinking??"")+t.event.delta.thinking}),!eZe(t)))return r;const i=xct(r,t,n);if(i)return i;const a=_ct(t,n),s=fC(r.messages,a),o=s.indexOf(a),l=AI(t);if(l){const c=new Map(r.toolUseIdToIndex);return c.set(l,o),{...r,messages:s,toolUseIdToIndex:c}}return{...r,messages:s}}function wct(e,t,n){let r=e.toolUseIdToIndex.get(t),i=e,a=!1;if(r!==void 0){const m=e.messages[r];m&&NW(m,t)||(r=void 0,a=!0)}if(r===void 0){if(r=e.messages.findIndex(m=>NW(m,t)),r===-1)return e;a=!0}if(a){const m=new Map(e.toolUseIdToIndex);m.set(t,r),i={...e,toolUseIdToIndex:m}}const s=i.messages[r];if(!s)return i;const o=s.message,l=o?.event;if(!l?.content_block)return i;const c={...l,content_block:{...l.content_block,input:n}},d={...s,message:{...o,event:c}},f=[...i.messages];return f[r]=d,{...i,messages:f}}function Ect(e){if(!e)return{type:"none"};if(e.toolName==="AskUserQuestion"){const t=e.input;return{type:"question",request:{requestId:e.requestId,questions:t.questions??[],timestamp:e.timestamp}}}return{type:"permission",request:{requestId:e.requestId,toolName:e.toolName,toolInput:e.input,timestamp:e.timestamp,planContent:e.planContent}}}function Cct(e,t){if(t.type==="COMPACT_BOUNDARY"){const n=e.messages.reduce((i,a)=>Math.max(i,a.order),-1),r={id:`compact-boundary-${Date.now()}`,source:"agent",message:{type:"system",subtype:"compact_boundary"},timestamp:new Date().toISOString(),order:n+1};return{...e,hasCompactBoundary:!0,messages:[...e.messages,r]}}else return e}function Tct(e,t){switch(t.type){case"USER_MESSAGE_SENT":return{...e,messages:[...e.messages,t.payload]};case"ADD_TO_QUEUE":{const n=new Map(e.queuedMessages);return n.set(t.payload.id,t.payload),{...e,queuedMessages:n}}case"MESSAGE_SENDING":{const{id:n,text:r,attachments:i}=t.payload,a=new Map(e.pendingMessages);return a.set(n,{text:r,attachments:i}),{...e,pendingMessages:a}}case"CLEAR_REJECTED_MESSAGE":return{...e,lastRejectedMessage:null};case"MESSAGE_USED_AS_RESPONSE":{const n=e.pendingMessages.get(t.payload.id),r=new Map(e.pendingMessages);if(r.delete(t.payload.id),e.messages.some(a=>a.id===t.payload.id))return{...e,pendingMessages:r,pendingRequest:{type:"none"}};const i={id:t.payload.id,source:"user",text:t.payload.text,timestamp:new Date().toISOString(),attachments:n?.attachments,order:t.payload.order};return{...e,messages:fC(e.messages,i),pendingMessages:r,pendingRequest:{type:"none"}}}default:return e}}function fp(e,t){const n=new Set(t.model.options.map(s=>s.value)),r=new Set(t.reasoning.options.map(s=>s.value)),i=!t.model.enabled||e.selectedModel&&n.has(e.selectedModel)?e.selectedModel:t.model.selected&&n.has(t.model.selected)?t.model.selected:t.model.options[0]?.value??e.selectedModel,a=t.reasoning.enabled?e.reasoningEffort&&r.has(e.reasoningEffort)?e.reasoningEffort:t.reasoning.selected&&r.has(t.reasoning.selected)?t.reasoning.selected:t.reasoning.options[0]?.value??null:null;return{selectedModel:i,reasoningEffort:a,thinkingEnabled:t.thinking.enabled?e.thinkingEnabled:!1,planModeEnabled:t.planMode.enabled?e.planModeEnabled:!1}}const Jue={provider:"CLAUDE",model:{enabled:!1,options:[]},reasoning:{enabled:!1,options:[]},thinking:{enabled:!1},planMode:{enabled:!1},attachments:{enabled:!1,kinds:[]},slashCommands:{enabled:!1},usageStats:{enabled:!1,contextWindow:!1},rewind:{enabled:!1}};function cF(){return{messages:[],gitBranch:null,pendingRequest:{type:"none"},toolUseIdToIndex:new Map,latestThinking:null,pendingMessages:new Map,lastRejectedMessage:null,isCompacting:!1,toolProgress:new Map,sessionInitData:null,permissionMode:null,hasCompactBoundary:!1,activeHooks:new Map,taskNotifications:[],tokenStats:coe(),pendingUserMessageUuids:[],messageIdToUuid:new Map,localUserMessageIds:new Set,rewindPreview:null,acpPlan:null,acpConfigOptions:null}}function ede(){return{...cF(),queuedMessages:new Map,sessionStatus:{phase:"loading"},processStatus:{state:"unknown"},sessionRuntime:{...noe(),phase:"loading"},slashCommands:[],slashCommandsLoaded:!1,chatCapabilities:Jue}}function kct(e){return{messages:[],sessionStatus:{phase:"loading"},processStatus:{state:"unknown"},sessionRuntime:noe(),gitBranch:null,availableSessions:[],pendingRequest:{type:"none"},chatSettings:J0,chatCapabilities:Jue,queuedMessages:new Map,toolUseIdToIndex:new Map,latestThinking:null,pendingMessages:new Map,lastRejectedMessage:null,isCompacting:!1,toolProgress:new Map,sessionInitData:null,permissionMode:null,hasCompactBoundary:!1,activeHooks:new Map,taskNotifications:[],slashCommands:[],slashCommandsLoaded:!1,tokenStats:coe(),pendingUserMessageUuids:[],messageIdToUuid:new Map,localUserMessageIds:new Set,rewindPreview:null,acpPlan:null,acpConfigOptions:null,...e}}function Nct(e,t){switch(t.type){case"CLEAR_CHAT":{const n=e.sessionStatus.phase==="running"?e.sessionStatus:{phase:"ready"};return{...e,...cF(),sessionStatus:n,chatSettings:fp(J0,e.chatCapabilities)}}case"RESET_FOR_SESSION_SWITCH":return{...e,...ede()};default:return e}}function Act(e,t){switch(t.type){case"SESSION_SNAPSHOT":{const n=t.payload.messages,r=new Set(n.map(o=>o.id)),i=new Map;for(const[o,l]of e.pendingMessages)r.has(o)||i.set(o,l);const a=Ect(t.payload.pendingInteractiveRequest),s=new Map(t.payload.queuedMessages.map(o=>[o.id,o]));return{...e,messages:n,queuedMessages:s,pendingRequest:a,sessionRuntime:t.payload.sessionRuntime,toolUseIdToIndex:new Map,pendingMessages:i,lastRejectedMessage:null,messageIdToUuid:new Map,pendingUserMessageUuids:[],localUserMessageIds:new Set,rewindPreview:null}}default:return e}}function Rct(e,t){return t.type==="MESSAGE_STATE_CHANGED"?Ict(e,t.payload):e}function Ict(e,t){const{id:n,newState:r,userMessage:i,errorMessage:a,queuePosition:s}=t;switch(r){case ru.ACCEPTED:return i?Oct(e,n,i,s):e;case ru.DISPATCHED:return i?Dct(e,n,i):AW(e,n);case ru.COMMITTED:case ru.COMPLETE:return AW(e,n);case ru.CANCELLED:return Mct(e,n);case ru.REJECTED:case ru.FAILED:return Lct(e,n,a);default:return Zue(`[chat-reducer] Ignoring state transition to ${r} for message ${n}`),e}}function Oct(e,t,n,r){const i=new Map(e.pendingMessages);if(i.delete(t),e.messages.some(d=>d.id===t)){const d=new Map(e.queuedMessages);return d.set(t,{id:t,text:n.text,timestamp:n.timestamp,attachments:n.attachments,settings:n.settings??{selectedModel:null,reasoningEffort:null,thinkingEnabled:!1,planModeEnabled:!1}}),{...e,queuedMessages:d,pendingMessages:i}}const a={id:t,source:"user",text:n.text,timestamp:n.timestamp,attachments:n.attachments,order:n.order??roe+(r??0)},s=new Map(e.queuedMessages);s.set(t,{id:t,text:n.text,timestamp:n.timestamp,attachments:n.attachments,settings:n.settings??{selectedModel:null,reasoningEffort:null,thinkingEnabled:!1,planModeEnabled:!1}});const o=new Set(e.localUserMessageIds);e.sessionStatus.phase!=="loading"&&o.add(t);let l=e.messageIdToUuid,c=e.pendingUserMessageUuids;if(e.pendingUserMessageUuids.length>0){const[d,...f]=e.pendingUserMessageUuids;c=f,d&&(l=new Map(e.messageIdToUuid),l.set(t,d))}return{...e,messages:fC(e.messages,a),queuedMessages:s,pendingMessages:i,messageIdToUuid:l,pendingUserMessageUuids:c,localUserMessageIds:o}}function Dct(e,t,n){const r=new Map(e.queuedMessages);if(r.delete(t),n.order===void 0)return{...e,queuedMessages:r};const i=e.messages.findIndex(c=>c.id===t);if(i===-1)return{...e,queuedMessages:r};const a=e.messages[i];if(!a)return{...e,queuedMessages:r};const s={...a,order:n.order},o=[...e.messages.slice(0,i),...e.messages.slice(i+1)],l=fC(o,s);return{...e,messages:l,queuedMessages:r}}function AW(e,t){const n=new Map(e.queuedMessages);return n.delete(t),{...e,queuedMessages:n}}function Mct(e,t){const n=new Map(e.queuedMessages);return n.delete(t),{...e,messages:e.messages.filter(r=>r.id!==t),queuedMessages:n}}function Lct(e,t,n){const r=e.queuedMessages.get(t),i=e.pendingMessages.get(t),a=r??i,s=new Map(e.queuedMessages);s.delete(t);const o=new Map(e.pendingMessages);return o.delete(t),{...e,messages:e.messages.filter(l=>l.id!==t),queuedMessages:s,pendingMessages:o,lastRejectedMessage:a?{text:r?.text??i?.text??"",attachments:a.attachments,error:n??"Message failed"}:null}}function Pct(e,t){switch(t.type){case"WS_AGENT_MESSAGE":return Sct(e,t.payload.message,t.payload.order);case"WS_ERROR":{const n=e.messages.reduce((s,o)=>Math.max(s,o.order),-1),r={type:"error",error:t.payload.message,timestamp:new Date().toISOString()},i={id:Que(),source:"agent",message:r,timestamp:new Date().toISOString(),order:n+1},a=e.sessionStatus.phase==="loading"?{phase:"ready"}:e.sessionStatus;return{...e,messages:[...e.messages,i],sessionStatus:a}}default:return e}}function Bct(e,t){switch(t.type){case"USER_MESSAGE_UUID_RECEIVED":{const n=e.messages.filter(r=>r.source==="user"&&e.localUserMessageIds.has(r.id)&&!e.messageIdToUuid.has(r.id));if(n.length>0){const r=n[0];if(!r)return e;const i=new Map(e.messageIdToUuid);return i.set(r.id,t.payload.uuid),{...e,messageIdToUuid:i}}return Zue(`[chat-reducer] UUID received but no unmapped user message found, queueing: ${t.payload.uuid}`),{...e,pendingUserMessageUuids:[...e.pendingUserMessageUuids,t.payload.uuid]}}default:return e}}function jct(e,t){switch(t.type){case"WS_PERMISSION_REQUEST":return{...e,pendingRequest:{type:"permission",request:t.payload}};case"WS_USER_QUESTION":return{...e,pendingRequest:{type:"question",request:t.payload}};case"PERMISSION_RESPONSE":{const n=t.payload.allow&&e.pendingRequest.type==="permission"&&e.pendingRequest.request.toolName==="ExitPlanMode";return{...e,pendingRequest:{type:"none"},...n&&{chatSettings:{...e.chatSettings,planModeEnabled:!1}}}}case"QUESTION_RESPONSE":return{...e,pendingRequest:{type:"none"}};case"WS_PERMISSION_CANCELLED":return(e.pendingRequest.type==="permission"||e.pendingRequest.type==="question"?e.pendingRequest.request.requestId:null)===t.payload.requestId?{...e,pendingRequest:{type:"none"}}:e;default:return e}}function Fct(e,t){switch(t.type){case"REWIND_PREVIEW_START":return{...e,rewindPreview:{userMessageId:t.payload.userMessageId,requestNonce:t.payload.requestNonce,isLoading:!0}};case"REWIND_PREVIEW_SUCCESS":return!e.rewindPreview||t.payload.userMessageId&&t.payload.userMessageId!==e.rewindPreview.userMessageId?e:{...e,rewindPreview:{...e.rewindPreview,isLoading:!1,affectedFiles:t.payload.affectedFiles}};case"REWIND_PREVIEW_ERROR":return!e.rewindPreview||t.payload.requestNonce&&t.payload.requestNonce!==e.rewindPreview.requestNonce||t.payload.userMessageId&&t.payload.userMessageId!==e.rewindPreview.userMessageId?e:{...e,rewindPreview:{...e.rewindPreview,isLoading:!1,error:t.payload.error}};case"REWIND_CANCEL":return{...e,rewindPreview:null};default:return e}}function $ct(e,t){switch(t.type){case"REWIND_EXECUTING":return e.rewindPreview?{...e,rewindPreview:{...e.rewindPreview,isLoading:!0,isExecuting:!0}}:e;case"REWIND_SUCCESS":return!e.rewindPreview||t.payload.userMessageId&&t.payload.userMessageId!==e.rewindPreview.userMessageId?e:{...e,rewindPreview:null};default:return e}}function tde(e){switch(e.phase){case"loading":return{phase:"loading"};case"starting":return{phase:"starting"};case"stopping":return{phase:"stopping"};case"running":return e.processState==="stopped"?{phase:"ready"}:{phase:"running"};case"idle":case"error":return{phase:"ready"};default:return{phase:"ready"}}}function Uct(e){return e.processState==="alive"?{state:"alive"}:e.processState==="stopped"?e.lastExit?{state:"stopped",lastExit:{code:e.lastExit.code,exitedAt:e.lastExit.timestamp,unexpected:e.lastExit.unexpected}}:{state:"stopped"}:{state:"unknown"}}function RI(e,t){return{...e,sessionRuntime:t,sessionStatus:tde(t),processStatus:Uct(t)}}function zct(e){return e.processState==="stopped"||e.phase==="error"}function yA(e,t){const n=RI(e,t);return zct(t)?{...n,toolProgress:new Map,isCompacting:!1,activeHooks:new Map}:n}function Hct(e,t){switch(t.type){case"SESSION_SNAPSHOT":return yA(e,t.payload.sessionRuntime);case"SESSION_RUNTIME_SNAPSHOT":return yA(e,t.payload.sessionRuntime);case"SESSION_RUNTIME_UPDATED":return yA(e,t.payload.sessionRuntime);case"WS_SESSIONS":return{...e,availableSessions:t.payload.sessions};case"SESSION_SWITCH_START":return{...e,...ede(),queuedMessages:e.queuedMessages};case"SESSION_LOADING_START":{const n={...e.sessionRuntime,phase:"loading",updatedAt:new Date().toISOString()};return{...e,sessionRuntime:n,sessionStatus:tde(n)}}case"SESSION_LOADING_END":return e.sessionRuntime.phase==="loading"?RI(e,{...e.sessionRuntime,phase:"idle",updatedAt:new Date().toISOString()}):e;case"STOP_REQUESTED":return RI(e,{...e.sessionRuntime,phase:"stopping",activity:"IDLE",updatedAt:new Date().toISOString()});default:return e}}function Wct(e,t){return{...e,acpConfigOptions:t.configOptions}}function Gct(e,t){switch(t.type){case"UPDATE_SETTINGS":return{...e,chatSettings:fp({...e.chatSettings,...t.payload},e.chatCapabilities)};case"SET_SETTINGS":return{...e,chatSettings:fp(t.payload,e.chatCapabilities)};case"CONFIG_OPTIONS_UPDATE":return Wct(e,t.payload);case"WS_CHAT_CAPABILITIES":{const n=t.payload.capabilities.slashCommands.enabled;return{...e,chatCapabilities:t.payload.capabilities,chatSettings:fp(e.chatSettings,t.payload.capabilities),slashCommands:n?e.slashCommands:[],slashCommandsLoaded:n?e.slashCommandsLoaded:!0}}default:return e}}function qct(e,t){switch(t.type){case"SDK_STATUS_UPDATE":{const{permissionMode:n}=t.payload;return n!==void 0?{...e,permissionMode:n}:e}case"SDK_TASK_NOTIFICATION":{const n={id:crypto.randomUUID(),message:t.payload.message,timestamp:new Date().toISOString()};return{...e,taskNotifications:[...e.taskNotifications,n]}}case"SYSTEM_INIT":return{...e,sessionInitData:t.payload,slashCommandsLoaded:!0};case"HOOK_STARTED":{const{hookId:n,hookName:r,hookEvent:i}=t.payload,a=new Map(e.activeHooks);return a.set(n,{hookId:n,hookName:r,hookEvent:i,startedAt:new Date().toISOString()}),{...e,activeHooks:a}}case"HOOK_RESPONSE":{const n=new Map(e.activeHooks);return n.delete(t.payload.hookId),{...e,activeHooks:n}}case"WS_SLASH_COMMANDS":return{...e,slashCommands:t.payload.commands,slashCommandsLoaded:!0};case"DISMISS_TASK_NOTIFICATION":return{...e,taskNotifications:e.taskNotifications.filter(n=>n.id!==t.payload.id)};case"CLEAR_TASK_NOTIFICATIONS":return{...e,taskNotifications:[]};default:return e}}function Vct(e,t){switch(t.type){case"TOOL_INPUT_UPDATE":return wct(e,t.payload.toolUseId,t.payload.input);case"TOOL_USE_INDEXED":{const n=new Map(e.toolUseIdToIndex);return n.set(t.payload.toolUseId,t.payload.index),{...e,toolUseIdToIndex:n}}case"SDK_TOOL_PROGRESS":{const{toolUseId:n,toolName:r,elapsedSeconds:i,acpLocations:a,acpKind:s}=t.payload,o=new Map(e.toolProgress);return o.set(n,{toolName:r,elapsedSeconds:i,...a&&{acpLocations:a},...s&&{acpKind:s}}),{...e,toolProgress:o}}case"SDK_TOOL_USE_SUMMARY":{const{precedingToolUseIds:n}=t.payload,r=new Map(e.toolProgress);for(const i of n)r.delete(i);return{...e,toolProgress:r}}case"SDK_COMPACTING_START":return{...e,isCompacting:!0};case"SDK_COMPACTING_END":return{...e,isCompacting:!1};case"ACP_PLAN_UPDATE":return{...e,acpPlan:{entries:t.payload.entries,updatedAt:new Date().toISOString()}};default:return e}}const Yct=[Hct,jct,Gct,Pct,Tct,Nct,Act,Rct,Bct,Cct,Vct,qct,Fct,$ct];function vA(e,t){let n=e;for(const r of Yct){const i=r(n,t);i!==n&&(n=i)}return n}function Kct(e){return{...e,...cF(),pendingMessages:e.pendingMessages,queuedMessages:e.queuedMessages,sessionStatus:{phase:"loading"},processStatus:{state:"unknown"},sessionRuntime:{...e.sessionRuntime,phase:"loading",processState:"unknown",activity:"IDLE",updatedAt:new Date().toISOString()}}}function Xct(e,t){if(t.type==="SESSION_REPLAY_BATCH"){let n=Kct(e);for(const r of t.payload.replayEvents){if(r.type==="session_replay_batch")continue;const i=nde(r);!i||i.type==="SESSION_REPLAY_BATCH"||(n=vA(n,i))}return n.sessionStatus.phase==="loading"&&(n=vA(n,{type:"SESSION_LOADING_END"})),n}return vA(e,t)}function Zct(e){return e.sessionRuntime?{type:"SESSION_RUNTIME_SNAPSHOT",payload:{sessionRuntime:e.sessionRuntime}}:null}function Qct(e){return e.sessionRuntime?{type:"SESSION_RUNTIME_UPDATED",payload:{sessionRuntime:e.sessionRuntime}}:null}function Jct(e){return aoe(e)&&e.order!==void 0?{type:"WS_AGENT_MESSAGE",payload:{message:e.data,order:e.order}}:null}function eut(e){return e.message?{type:"WS_ERROR",payload:{message:e.message}}:null}function tut(e){return e.sessions?{type:"WS_SESSIONS",payload:{sessions:e.sessions}}:null}function nut(e){return e.capabilities?{type:"WS_CHAT_CAPABILITIES",payload:{capabilities:e.capabilities}}:null}function rut(e){return e.requestId&&e.toolName?{type:"WS_PERMISSION_REQUEST",payload:{requestId:e.requestId,toolName:e.toolName,toolInput:e.toolInput??{},timestamp:new Date().toISOString(),planContent:e.planContent??null,acpOptions:e.acpOptions}}:null}function iut(e){return e.requestId&&e.questions?{type:"WS_USER_QUESTION",payload:{requestId:e.requestId,questions:e.questions,...Array.isArray(e.acpOptions)?{acpOptions:e.acpOptions}:{},timestamp:new Date().toISOString()}}:null}function aut(e){return e.messages&&e.queuedMessages&&e.sessionRuntime?{type:"SESSION_SNAPSHOT",payload:{messages:e.messages,queuedMessages:e.queuedMessages,sessionRuntime:e.sessionRuntime,pendingInteractiveRequest:e.pendingInteractiveRequest??null}}:null}function sut(e){return Array.isArray(e.replayEvents)?{type:"SESSION_REPLAY_BATCH",payload:{replayEvents:e.replayEvents.filter(jR)}}:null}function out(e){if(!(e.id&&e.newState))return null;const t=e.userMessage?{...e.userMessage}:void 0;return{type:"MESSAGE_STATE_CHANGED",payload:{id:e.id,newState:e.newState,queuePosition:e.queuePosition,errorMessage:e.errorMessage,userMessage:t}}}function lut(e){return e.tool_use_id&&e.tool_name&&e.elapsed_time_seconds!==void 0?{type:"SDK_TOOL_PROGRESS",payload:{toolUseId:e.tool_use_id,toolName:e.tool_name,elapsedSeconds:e.elapsed_time_seconds,acpLocations:e.acpLocations,acpKind:e.acpKind}}:null}function cut(e){return Array.isArray(e.preceding_tool_use_ids)?{type:"SDK_TOOL_USE_SUMMARY",payload:{summary:e.summary,precedingToolUseIds:e.preceding_tool_use_ids}}:null}function uut(e){const t=e.data;return t?{type:"SYSTEM_INIT",payload:{tools:t.tools??[],model:t.model??null,cwd:t.cwd??null,apiKeySource:t.apiKeySource??null,slashCommands:t.slashCommands??[],plugins:t.plugins??[]}}:null}function dut(e){const t=e.data;return t?.hookId&&t?.hookName&&t?.hookEvent?{type:"HOOK_STARTED",payload:{hookId:t.hookId,hookName:t.hookName,hookEvent:t.hookEvent}}:null}function hut(e){const t=e.data;return t?.hookId?{type:"HOOK_RESPONSE",payload:{hookId:t.hookId}}:null}function fut(e){return e.requestId?{type:"WS_PERMISSION_CANCELLED",payload:{requestId:e.requestId}}:null}function put(e){return e.id&&e.text&&e.order!==void 0?{type:"MESSAGE_USED_AS_RESPONSE",payload:{id:e.id,text:e.text,order:e.order}}:null}function mut(e){return{type:"SDK_STATUS_UPDATE",payload:{permissionMode:e.permissionMode}}}function gut(e){if(!e.message)return null;try{const t=JSON.parse(e.message);if(t&&t.type==="acp_plan"&&Array.isArray(t.entries))return{type:"ACP_PLAN_UPDATE",payload:{entries:t.entries}}}catch{}return{type:"SDK_TASK_NOTIFICATION",payload:{message:e.message}}}function but(e){return e.slashCommands?{type:"WS_SLASH_COMMANDS",payload:{commands:e.slashCommands}}:null}function yut(e){return e.uuid?{type:"USER_MESSAGE_UUID_RECEIVED",payload:{uuid:e.uuid}}:null}function vut(e){const t=e.configOptions;return Array.isArray(t)?{type:"CONFIG_OPTIONS_UPDATE",payload:{configOptions:t}}:null}const _ut={session_runtime_snapshot:Zct,session_runtime_updated:Qct,agent_message:Jct,error:eut,sessions:tut,chat_capabilities:nut,agent_metadata:null,permission_request:rut,user_question:iut,permission_cancelled:fut,message_used_as_response:put,session_snapshot:aut,session_delta:null,session_replay_batch:sut,message_state_changed:out,tool_progress:lut,tool_use_summary:cut,status_update:mut,task_notification:gut,system_init:uut,compact_boundary:()=>({type:"COMPACT_BOUNDARY"}),hook_started:dut,hook_response:hut,compacting_start:()=>({type:"SDK_COMPACTING_START"}),compacting_end:()=>({type:"SDK_COMPACTING_END"}),workspace_notification_request:null,slash_commands:but,user_message_uuid:yut,config_options_update:vut};function nde(e){const t=_ut[e.type];return t?t(e):null}const rde=hC();function xut(e){return fh(e)?e.event:null}function Sut(){return{toolUseIdByIndex:new Map,inputJsonByToolUseId:new Map}}function ide(e){e.toolUseIdByIndex.clear(),e.inputJsonByToolUseId.clear()}function wut(e,t){if(e.type!=="content_block_start")return;const n=e.content_block;if(n.type==="tool_use"&&n.id){const r=n.id;t.current.toolUseIdByIndex.set(e.index,r),t.current.inputJsonByToolUseId.set(r,""),rde.log("Tool use started:",r,n.name)}}function Eut(e,t){if(e.type!=="content_block_delta")return null;const n=e.delta;if(n.type!=="input_json_delta"||!("partial_json"in n))return null;const r=t.current.toolUseIdByIndex.get(e.index);if(!r)return null;const a=(t.current.inputJsonByToolUseId.get(r)??"")+n.partial_json;t.current.inputJsonByToolUseId.set(r,a);try{const s=JSON.parse(a),l=im(ke(),Cu()).parse(s);return rde.log("Tool input updated:",r,Object.keys(l)),{type:"TOOL_INPUT_UPDATE",payload:{toolUseId:r,input:l}}}catch{return null}}function Cut(e,t){if(e.type!=="content_block_stop")return;const n=t.current.toolUseIdByIndex.get(e.index);n&&(t.current.toolUseIdByIndex.delete(e.index),t.current.inputJsonByToolUseId.delete(n))}function Tut(e,t){const n=xut(e);return n?(wut(n,t),Cut(n,t),Eut(n,t)):null}const kut=nn({id:ke(),name:ke(),type:ke(),size:hi(),data:ke(),contentType:qr(["image","text"]).optional()}),ade=nn({selectedModel:ke().nullable(),reasoningEffort:ke().nullable(),thinkingEnabled:Ui(),planModeEnabled:Ui()});_O("type",[nn({type:Pr("start"),thinkingEnabled:Ui().optional(),planModeEnabled:Ui().optional(),selectedModel:ke().nullable().optional(),reasoningEffort:ke().nullable().optional(),model:ke().optional()}),nn({type:Pr("user_input"),text:ke().optional(),content:HV([ke(),Ya(Cu())]).optional()}),nn({type:Pr("queue_message"),id:ke().min(1),text:ke().optional(),attachments:Ya(kut).optional(),settings:ade.optional()}),nn({type:Pr("remove_queued_message"),messageId:ke().min(1)}),nn({type:Pr("stop")}),nn({type:Pr("load_session"),loadRequestId:ke().min(1).optional()}),nn({type:Pr("permission_response"),requestId:ke().min(1),optionId:ke().min(1)}),nn({type:Pr("set_model"),model:ke().optional(),reasoningEffort:ke().nullable().optional()}),nn({type:Pr("set_thinking_budget"),max_tokens:hi().nullable()}),nn({type:Pr("resume_queued_messages")}),nn({type:Pr("set_config_option"),configId:ke().min(1),value:ke().min(1)})]);const Nut="chat-draft-",sde="chat-settings-";function Mw(e){return`${Nut}${e}`}function Aut(e){if(!e||typeof window>"u")return"";try{return sessionStorage.getItem(Mw(e))??""}catch{return""}}function Rut(e,t){if(!(!e||typeof window>"u"))try{t.trim()?sessionStorage.setItem(Mw(e),t):sessionStorage.removeItem(Mw(e))}catch{}}function Iut(e){if(!(!e||typeof window>"u"))try{sessionStorage.removeItem(Mw(e))}catch{}}const Out=ade.partial({reasoningEffort:!0}).transform(e=>({...e,selectedModel:iZe(e.selectedModel),reasoningEffort:e.reasoningEffort??null}));function Dut(e){if(!e||typeof window>"u")return null;try{const t=sessionStorage.getItem(`${sde}${e}`);if(!t)return null;const n=JSON.parse(t),r=Out.safeParse(n);return r.success?r.data:null}catch{return null}}function Mut(e,t){if(!(!e||typeof window>"u"))try{sessionStorage.setItem(`${sde}${e}`,JSON.stringify(t))}catch{}}function Lut(e){return Dut(e)??J0}function Put(e){return{draft:Aut(e),settings:Lut(e)}}function But(){return`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function jut(e,t,n){if(!("thinkingEnabled"in t&&n))return;const r=t.thinkingEnabled?aZe:null;e({type:"set_thinking_budget",max_tokens:r})}function Fut(e,t,n,r){const i="selectedModel"in t,a="reasoningEffort"in t;if(!((i||a)&&r.model.enabled))return;const s={type:"set_model",model:n.selectedModel};r.reasoning.enabled&&(a?s.reasoningEffort=n.reasoningEffort:i&&(s.reasoningEffort=null)),e(s)}function ode(e,t){return!e||e.length===0?void 0:e.find(r=>t?r.kind.startsWith("allow"):r.kind.startsWith("reject"))?.optionId??e[0]?.optionId}function $ut(e,t){return e==="ExitPlanMode"?t?"default":"plan":t?"allow":"reject"}function Uut(e){const t=[];for(const n of Object.values(e)){if(Array.isArray(n)){t.push(...n);continue}n&&t.push(n)}return t}function zut(e,t){if(!e||e.length===0)return;const n=new Set(Uut(t).map(r=>r.trim().toLowerCase()));if(n.size>0){const r=e.find(i=>n.has(i.name.trim().toLowerCase()));if(r)return r.optionId}return ode(e,!0)}function Hut(e){const{send:t,dispatch:n,stateRef:r,dbSessionIdRef:i,inputAttachmentsRef:a,rewindTimeoutRef:s,onClearInput:o}=e,l=v.useCallback(D=>{const F=D.trim(),P=a.current;if(!F&&P.length===0)return;const $=But();n({type:"MESSAGE_SENDING",payload:{id:$,text:F,attachments:P.length>0?P:void 0}}),o();const W={type:"queue_message",id:$,text:F,attachments:P.length>0?P:void 0,settings:fp(r.current.chatSettings,r.current.chatCapabilities)};t(W)},[t,n,a,r,o]),c=v.useCallback(()=>{const{sessionStatus:D}=r.current;D.phase==="running"&&(n({type:"STOP_REQUESTED"}),t({type:"stop"}))},[t,n,r]),d=v.useCallback(()=>{r.current.sessionStatus.phase==="running"&&(n({type:"STOP_REQUESTED"}),t({type:"stop"})),n({type:"CLEAR_CHAT"})},[t,n,r]),f=v.useCallback((D,F,P)=>{const{pendingRequest:$}=r.current;if($.type!=="permission"||$.request.requestId!==D)return;const W=P??ode($.request.acpOptions,F)??$ut($.request.toolName,F);t({type:"permission_response",requestId:D,optionId:W}),n({type:"PERMISSION_RESPONSE",payload:{allow:F}})},[t,n,r]),m=v.useCallback((D,F)=>{const{pendingRequest:P}=r.current;if(P.type!=="question"||P.request.requestId!==D)return;const $=zut(P.request.acpOptions,F)??"allow";t({type:"permission_response",requestId:D,optionId:$}),n({type:"QUESTION_RESPONSE"})},[t,n,r]),g=v.useCallback(D=>{n({type:"UPDATE_SETTINGS",payload:D});const F=r.current.chatCapabilities,P=fp({...r.current.chatSettings,...D},F);Mut(i.current,P),jut(t,D,F.thinking.enabled),Fut(t,D,P,F)},[t,n,r,i]),y=v.useCallback(D=>{t({type:"remove_queued_message",messageId:D})},[t]),_=v.useCallback(()=>{t({type:"resume_queued_messages"})},[t]),S=v.useCallback(D=>{n({type:"DISMISS_TASK_NOTIFICATION",payload:{id:D}})},[n]),w=v.useCallback(()=>{n({type:"CLEAR_TASK_NOTIFICATIONS"})},[n]),E=v.useCallback((D,F)=>{t({type:"set_config_option",configId:D,value:F})},[t]),T=r.current.chatCapabilities.rewind.enabled,A=v.useCallback(D=>{if(!T)return;s.current&&(clearTimeout(s.current),s.current=null);const F=`${Date.now()}-${Math.random().toString(36).slice(2,9)}`;n({type:"REWIND_PREVIEW_START",payload:{userMessageId:D,requestNonce:F}}),n({type:"REWIND_PREVIEW_ERROR",payload:{error:"Rewind is not supported in ACP runtime.",requestNonce:F}})},[n,T,s]),O=v.useCallback(()=>{if(!T)return;s.current&&(clearTimeout(s.current),s.current=null);const D=r.current.rewindPreview;D&&(n({type:"REWIND_EXECUTING"}),n({type:"REWIND_PREVIEW_ERROR",payload:{error:"Rewind is not supported in ACP runtime.",requestNonce:D.requestNonce}}))},[n,T,r,s]),I=v.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),n({type:"REWIND_CANCEL"})},[n,s]),N=v.useCallback(D=>r.current.messageIdToUuid.get(D),[r]);return{sendMessage:l,stopChat:c,clearChat:d,approvePermission:f,answerQuestion:m,updateSettings:g,removeQueuedMessage:y,resumeQueuedMessages:_,dismissTaskNotification:S,clearTaskNotifications:w,setConfigOption:E,startRewindPreview:A,confirmRewind:O,cancelRewind:I,getUuidForMessageId:N}}function Wut(e){const{dbSessionId:t,initialDraft:n}=e,[r,i]=v.useState(n),a=v.useRef(t??null),s=v.useRef(void 0);v.useEffect(()=>{a.current=t},[t]),v.useEffect(()=>{i(n)},[n]);const o=v.useCallback(c=>{i(c),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{Rut(a.current,c)},300)},[]),l=v.useCallback(()=>{i(""),Iut(a.current)},[]);return v.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]),{inputDraft:r,setInputDraft:o,clearInputDraft:l}}const _A=hC();function Gut(e){const{dbSessionId:t,dispatch:n,toolInputAccumulatorRef:r,sessionRuntimePhase:i}=e,a=v.useRef(null),s=v.useRef(""),o=v.useRef(null);v.useEffect(()=>{const c=a.current,d=t??null;if(a.current=d,c!==null&&c!==d&&(_A.log("Session switch detected",{from:c,to:d}),o.current&&(clearTimeout(o.current),o.current=null),n({type:"SESSION_SWITCH_START"}),ide(r.current)),d){const f=Put(d);s.current=f.draft,n({type:"SET_SETTINGS",payload:f.settings}),c===null&&(n({type:"SESSION_LOADING_START"}),o.current=setTimeout(()=>{_A.log("Loading timeout reached, clearing loading state"),n({type:"SESSION_LOADING_END"}),o.current=null},1e4))}else s.current="",n({type:"SET_SETTINGS",payload:J0});return()=>{o.current&&clearTimeout(o.current)}},[t,n,r]);const l=v.useRef(i);return v.useEffect(()=>{const c=l.current;l.current=i,c==="loading"&&i!=="loading"&&o.current&&(_A.log("Session runtime phase changed from loading, clearing loading timeout"),clearTimeout(o.current),o.current=null)},[i]),{loadedDraft:s.current}}const qut=hC();function Vut(e,t,n){const r=e.data,i=Tut(r,t);i&&n(i)}function Yut(e){const{dispatch:t,toolInputAccumulatorRef:n}=e,r=v.useCallback(i=>{if(!jR(i)){qut.log("Received invalid WebSocket message:",i);return}const a=i;if(a.type==="session_delta"&&jR(a.data)){r(a.data);return}if((a.type==="session_snapshot"||a.type==="session_replay_batch")&&ide(n.current),a.type==="workspace_notification_request"){window.dispatchEvent(new CustomEvent("workspace-notification-request",{detail:{workspaceId:a.workspaceId,workspaceName:a.workspaceName,sessionCount:a.sessionCount,finishedAt:a.finishedAt}}));return}aoe(a)&&Vut(a,n,t);const s=nde(a);s&&t(s)},[t,n]);return{handleMessage:r}}function Kut(e){const{dbSessionId:t,send:n,connected:r}=e,[i,a]=v.useReducer(Xct,void 0,kct),[s,o]=v.useState([]),l=v.useRef(null),c=v.useRef(null),d=v.useRef(t??null),f=v.useRef(Sut()),m=v.useRef(i);m.current=i;const g=v.useRef(s);g.current=s;const y=v.useRef(null);v.useEffect(()=>{d.current=t},[t]);const{loadedDraft:_}=Gut({dbSessionId:t,dispatch:a,toolInputAccumulatorRef:f,sessionRuntimePhase:i.sessionRuntime.phase}),{inputDraft:S,setInputDraft:w,clearInputDraft:E}=Wut({dbSessionId:t,initialDraft:_}),{handleMessage:T}=Yut({dispatch:a,toolInputAccumulatorRef:f});v.useEffect(()=>{if(i.lastRejectedMessage){const{text:O,attachments:I}=i.lastRejectedMessage;w(O),I&&I.length>0&&o(I),a({type:"CLEAR_REJECTED_MESSAGE"})}},[i.lastRejectedMessage,w]);const A=Hut({send:n,dispatch:a,stateRef:m,dbSessionIdRef:d,inputAttachmentsRef:g,rewindTimeoutRef:y,onClearInput:()=>{E(),o([])}});return v.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]),v.useMemo(()=>({...i,queuedMessages:Array.from(i.queuedMessages.values()),connected:r,...A,inputDraft:S,setInputDraft:w,inputAttachments:s,setInputAttachments:o,handleMessage:T,dispatch:a,inputRef:l,messagesEndRef:c}),[i,r,A,S,w,s,T])}const Xut=1e4;function Zut(e){const{dbSessionId:t}=e,n=v.useRef(`conn-${Date.now()}-${Math.random().toString(36).slice(2,9)}`),r=t?$1("/chat",{sessionId:t,connectionId:n.current}):null,i=v.useRef(()=>!1),a=v.useRef(null),s=v.useRef(0),o=v.useRef(null),l=v.useCallback(()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]),c=v.useCallback((_,S)=>{l(),o.current=setTimeout(()=>{if(s.current!==_||a.current!==S){o.current=null;return}const w=`load-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;a.current=w,i.current({type:"load_session",loadRequestId:w}),c(_,w)},Xut)},[l]),d=Kut({dbSessionId:t,send:v.useCallback(_=>i.current(_),[]),connected:!1}),f=v.useCallback(_=>{if(typeof _=="object"&&_!==null&&"type"in _&&(_.type==="session_replay_batch"||_.type==="session_snapshot")){const S=_;if(a.current&&S.loadRequestId){if(S.loadRequestId!==a.current)return;a.current=null,l()}}d.handleMessage(_)},[d.handleMessage,l]),m=v.useCallback(()=>{d.dispatch({type:"SESSION_LOADING_START"});const _=s.current+1;s.current=_;const S=`load-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;a.current=S,c(_,S),i.current({type:"load_session",loadRequestId:S})},[d.dispatch,c]),g=v.useCallback(()=>{a.current=null,s.current+=1,l(),d.dispatch({type:"SESSION_LOADING_END"})},[d.dispatch,l]);v.useEffect(()=>()=>{a.current=null,s.current+=1,l()},[l]);const y=U1({url:r,onMessage:f,onConnected:m,onDisconnected:g});return i.current=y.send,{messages:d.messages,connected:y.connected,sessionStatus:d.sessionStatus,processStatus:d.processStatus,sessionRuntime:d.sessionRuntime,gitBranch:d.gitBranch,availableSessions:d.availableSessions,pendingRequest:d.pendingRequest,chatSettings:d.chatSettings,chatCapabilities:d.chatCapabilities,inputDraft:d.inputDraft,inputAttachments:d.inputAttachments,queuedMessages:d.queuedMessages,latestThinking:d.latestThinking,pendingMessages:d.pendingMessages,isCompacting:d.isCompacting,taskNotifications:d.taskNotifications,permissionMode:d.permissionMode,slashCommands:d.slashCommands,slashCommandsLoaded:d.slashCommandsLoaded,tokenStats:d.tokenStats,rewindPreview:d.rewindPreview,acpPlan:d.acpPlan,acpConfigOptions:d.acpConfigOptions,toolProgress:d.toolProgress,sendMessage:d.sendMessage,stopChat:d.stopChat,clearChat:d.clearChat,approvePermission:d.approvePermission,answerQuestion:d.answerQuestion,updateSettings:d.updateSettings,setInputDraft:d.setInputDraft,setInputAttachments:d.setInputAttachments,removeQueuedMessage:d.removeQueuedMessage,resumeQueuedMessages:d.resumeQueuedMessages,dismissTaskNotification:d.dismissTaskNotification,clearTaskNotifications:d.clearTaskNotifications,setConfigOption:d.setConfigOption,startRewindPreview:d.startRewindPreview,confirmRewind:d.confirmRewind,cancelRewind:d.cancelRewind,getUuidForMessageId:d.getUuidForMessageId,inputRef:d.inputRef,messagesEndRef:d.messagesEndRef}}const Qut=2e3;function Jut({textContent:e,className:t}){const[n,r]=v.useState(!1),i=v.useRef(void 0);v.useEffect(()=>()=>{i.current!==void 0&&clearTimeout(i.current)},[]);const a=async()=>{try{await navigator.clipboard.writeText(e),r(!0),i.current!==void 0&&clearTimeout(i.current),i.current=window.setTimeout(()=>{r(!1)},Qut)}catch{}};return h.jsx("button",{onClick:a,onMouseDown:s=>s.preventDefault(),className:ne("absolute top-1 right-1 p-1.5 rounded-md","bg-background/90 hover:bg-background","border border-border","shadow-sm","opacity-0 group-hover:opacity-100","transition-all","z-10","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",t),title:"Copy to clipboard",type:"button","aria-label":"Copy message to clipboard",children:n?h.jsx(nm,{className:"h-3.5 w-3.5 text-green-600 dark:text-green-400"}):h.jsx(Bq,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-foreground"})})}const edt=v.memo(function({className:t}){return h.jsxs("div",{className:ne("flex items-center gap-2 py-3 my-2 border-t border-b border-dashed border-muted-foreground/30",t),children:[h.jsx(U_e,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"Context compacted - earlier messages may be summarized"})]})}),lde=v.createContext({lastThinkingMessageId:null,running:!1});function tdt({lastThinkingMessageId:e,running:t,children:n}){const r=v.useMemo(()=>({lastThinkingMessageId:e,running:t}),[e,t]);return h.jsx(lde.Provider,{value:r,children:n})}function ndt(e){const{lastThinkingMessageId:t,running:n}=v.useContext(lde);return n&&e!=null&&e===t}const rdt=v.memo(function({event:t,messageId:n,className:r}){switch(t.type){case"content_block_start":{const i=t.content_block;return _j(i)?h.jsx("div",{className:ne("prose prose-sm dark:prose-invert max-w-none text-sm",r),children:h.jsx(adt,{text:i.text})}):Q0(i)?h.jsx(cde,{text:i.thinking,messageId:n,className:r}):null}case"content_block_delta":return h.jsx(idt,{delta:t.delta,className:r});case"message_start":case"message_delta":case"message_stop":case"content_block_stop":return null;default:return null}}),idt=v.memo(function({delta:t,className:n}){return t.type==="text_delta"?h.jsx("span",{className:ne("",n),children:t.text}):t.type==="thinking_delta"?h.jsx("span",{className:ne("text-muted-foreground italic",n),children:t.thinking}):null}),adt=v.memo(function({text:t}){return h.jsx(Rh,{content:t})}),sdt=200,cde=v.memo(function({text:t,messageId:n,truncateLength:r=sdt,className:i}){const[a,s]=v.useState(!1),o=ndt(n),l=t.length>r,c=l&&!a?`${t.slice(0,r)}...`:t;return h.jsxs("div",{className:ne("rounded-md border border-dashed border-muted-foreground/30 bg-muted/30 p-2",i),children:[h.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[h.jsx(un,{className:ne("h-3 w-3",o&&"animate-spin")}),h.jsx("span",{children:"Thinking"})]}),h.jsx("div",{className:"text-sm text-muted-foreground italic whitespace-pre-wrap",children:c}),l&&h.jsx("button",{onClick:()=>s(!a),className:"text-xs text-primary hover:underline mt-1",children:a?"Show less":"Show more"})]})}),odt=v.memo(function({message:t,className:n}){const r=t.error||"An unknown error occurred";return h.jsxs("div",{className:ne("flex items-start gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3",n),children:[h.jsx(hc,{className:"h-4 w-4 text-destructive shrink-0 mt-0.5"}),h.jsx("div",{className:"text-sm text-destructive",children:r})]})}),ldt=v.memo(function({message:t,className:n}){switch(t.subtype){case"init":return t.tools?h.jsxs("div",{className:ne("text-xs text-muted-foreground",n),children:[h.jsxs("span",{children:["Session initialized with ",t.tools.length," tools"]}),t.model&&h.jsxs("span",{className:"ml-2",children:["Model: ",t.model]})]}):null;case"status":return null;case"compact_boundary":return h.jsx(edt,{className:n});case"hook_started":case"hook_response":return null;default:return null}}),cdt=v.memo(function({message:t,className:n}){return t.result&&typeof t.result=="string"?h.jsx("div",{className:ne("prose prose-sm dark:prose-invert max-w-none text-sm",n),children:h.jsx(Rh,{content:t.result})}):null}),RW=v.memo(function({message:t,messageId:n,className:r}){if(ev(t)||z1(t))return h.jsx(udt,{message:t,className:r});if(t.type==="result")return h.jsx(cdt,{message:t,className:r});if(t.type==="error")return h.jsx(odt,{message:t,className:r});if(t.type==="stream_event"&&t.event)return h.jsx(rdt,{event:t.event,messageId:n,className:r});if(t.message&&Array.isArray(t.message.content)){const a=t.message.content,s=a[0];if(a.length===1&&s&&Q0(s))return h.jsx(cde,{text:s.thinking,messageId:n,className:r})}const i=soe(t);return i?h.jsx("div",{className:ne("prose prose-sm dark:prose-invert max-w-none text-sm break-words",r),children:h.jsx(ddt,{text:i})}):t.type==="system"?h.jsx(ldt,{message:t,className:r}):null}),udt=v.memo(function({message:t,className:n}){return h.jsx("div",{className:ne("my-1",n),children:h.jsx(Kst,{message:t})})}),ddt=v.memo(function({text:t}){return h.jsx(Rh,{content:t})}),IW=v.memo(function({children:t,className:n}){return h.jsx("div",{className:ne("py-2",n),children:h.jsx("div",{className:"max-w-full",children:t})})}),hdt=v.memo(function({className:t}){return h.jsxs("div",{className:ne("flex items-center gap-2 text-muted-foreground",t),children:[h.jsx(un,{className:"h-4 w-4 animate-spin"}),h.jsx("span",{className:"text-sm",children:"Agent is working..."})]})});function fdt(e){return e??""}function pdt(e){if(!e)return null;const t=soe(e);if(t)return t;if(e.message&&Array.isArray(e.message.content)&&e.message.content.length===1){const n=e.message.content[0];if(n&&Q0(n))return n.thinking}return null}const mdt=v.memo(function({message:t,isQueued:n,onRemove:r,userMessageUuid:i,onRewindToMessage:a}){if(t.source==="user"){const s=fdt(t.text);return h.jsx(IW,{children:h.jsxs("div",{className:"group relative w-full max-w-full",children:[h.jsxs("div",{className:ne("absolute -top-1 -right-1 flex items-center gap-1","opacity-0 group-hover:opacity-100","transition-all","z-10"),children:[s&&h.jsx("button",{onClick:async()=>{try{await navigator.clipboard.writeText(s)}catch{}},onMouseDown:o=>o.preventDefault(),className:ne("p-1.5 rounded-md","bg-background/90 hover:bg-background","border border-border","shadow-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),title:"Copy to clipboard",type:"button","aria-label":"Copy message to clipboard",children:h.jsx(Bq,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-foreground"})}),i&&a&&h.jsx("button",{onClick:()=>a(i),onMouseDown:o=>o.preventDefault(),className:ne("p-1.5 rounded-md","bg-background/90 hover:bg-amber-50 dark:hover:bg-amber-900/20","border border-border hover:border-amber-500/50","shadow-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),title:"Rewind files to before this message",type:"button","aria-label":"Rewind files to before this message",children:h.jsx(WA,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-amber-600 dark:hover:text-amber-400"})}),n&&r&&h.jsx("button",{onClick:r,className:ne("p-1.5 rounded-md","bg-background/90 hover:bg-destructive/10","border border-border hover:border-destructive/50","shadow-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),title:"Cancel queued message",type:"button","aria-label":"Cancel queued message",children:h.jsx(Ao,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-destructive"})})]}),h.jsxs("div",{className:ne("space-y-2",n&&"opacity-50"),children:[t.attachments&&t.attachments.length>0&&h.jsx(Tue,{attachments:t.attachments,readOnly:!0}),t.text&&h.jsx("div",{className:"relative w-full max-w-full",children:h.jsx("div",{className:"w-full rounded border border-border/70 bg-muted/35 px-3 py-2 break-words text-sm text-left whitespace-pre-wrap",children:s})})]})]})})}if(t.message){const s=pdt(t.message);return h.jsx(IW,{children:s!==null?h.jsxs("div",{className:"group relative",children:[h.jsx(RW,{message:t.message,messageId:t.id}),h.jsx(Jut,{textContent:s})]}):h.jsx(RW,{message:t.message,messageId:t.id})})}return null}),gdt=v.memo(function({item:t,isQueued:n,onRemove:r,userMessageUuid:i,onRewindToMessage:a}){return Sj(t)?h.jsx(gue,{sequence:t,summaryOrder:"latest-first"}):h.jsx(mdt,{message:t,isQueued:n,onRemove:r,userMessageUuid:i,onRewindToMessage:a})});function bdt(){return h.jsx("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:h.jsxs("div",{className:"text-muted-foreground space-y-2",children:[h.jsx("p",{className:"text-lg font-medium",children:"Ready to start"}),h.jsx("p",{className:"text-sm",children:"Send a message to start the agent and begin your conversation."})]})})}const ydt=v.memo(function({item:t,index:n,measureElement:r,isQueued:i,onRemove:a,userMessageUuid:s,onRewindToMessage:o}){return h.jsx("div",{ref:r,"data-index":n,className:"pb-2",children:h.jsx(gdt,{item:t,isQueued:i,onRemove:a,userMessageUuid:s,onRewindToMessage:o})})}),vdt=v.memo(function({messages:t,running:n,startingSession:r,loadingSession:i,startingLabel:a="Starting agent...",scrollContainerRef:s,onScroll:o,messagesEndRef:l,isNearBottom:c=!0,queuedMessageIds:d,onRemoveQueuedMessage:f,isCompacting:m=!1,getUuidForMessageId:g,onRewindToMessage:y,initBanner:_}){const S=v.useRef(t.length),w=v.useRef(!1),E=v.useRef(c);E.current=c;const T=v.useMemo(()=>{for(let F=t.length-1;F>=0;F-=1){const P=t[F];if(!P||Sj(P)||!(P.message&&fh(P.message)))continue;const $=P.message.event;if($?.type==="content_block_start"&&$.content_block.type==="thinking")return P.id}return null},[t]),A=vj({count:t.length,getScrollElement:()=>s.current,estimateSize:()=>80,overscan:n?3:5,getItemKey:F=>{const P=t[F];return P?P.id:`missing-message-${F}`}}),O=A.getVirtualItems(),I=A.getTotalSize();v.useEffect(()=>{const F=t.length,P=S.current;if(S.current=F,F>P&&E.current&&s.current){w.current=!0;try{A.scrollToIndex(F-1,{align:"end",behavior:"auto"})}catch{}requestAnimationFrame(()=>{w.current=!1})}},[t.length,A,s]);const N=v.useCallback(()=>{w.current||o?.()},[o]);v.useEffect(()=>{const F=s.current;if(F)return F.addEventListener("scroll",N,{passive:!0}),()=>F.removeEventListener("scroll",N)},[s,N]);const D=_&&_.kind==="info";return i?h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8 gap-4",children:[D&&h.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[h.jsx(un,{className:"h-4 w-4 animate-spin"}),h.jsx("span",{className:"text-sm",children:_.message})]}),h.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[h.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary border-t-transparent"}),h.jsx("span",{className:"text-sm",children:"Loading session..."})]})]}):t.length===0&&!(n||r||D)?h.jsx(bdt,{}):h.jsx(tdt,{lastThinkingMessageId:T,running:n,children:h.jsxs("div",{className:"p-4 min-w-0",children:[h.jsx("div",{style:{height:`${I}px`,width:"100%",position:"relative"},children:O.map(F=>{const P=t[F.index];if(!P)return null;const $=d?.has(P.id)??!1,W="source"in P&&P.source==="user"?g?.(P.id):void 0;return h.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${F.start}px)`},children:h.jsx(ydt,{item:P,index:F.index,measureElement:A.measureElement,isQueued:$,onRemove:$&&f?()=>f(P.id):void 0,userMessageUuid:W,onRewindToMessage:y})},F.key)})}),h.jsx(Vlt,{isCompacting:m,className:"mb-4"}),_&&_.kind==="info"&&h.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground py-4",children:[h.jsx(un,{className:"h-4 w-4 animate-spin"}),h.jsx("span",{className:"text-sm",children:_.message})]}),r&&!n&&h.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground py-4",children:[h.jsx(un,{className:"h-4 w-4 animate-spin"}),h.jsx("span",{className:"text-sm",children:a})]}),n&&h.jsx(hdt,{className:"py-4"}),h.jsx("div",{ref:l,className:"h-px"})]})})});function _dt(e){const[t,n]=v.useState(!0),r=v.useRef(!0),i=v.useRef(!1),a=v.useRef(!1),s=v.useCallback(()=>{i.current||a.current||(a.current=!0,requestAnimationFrame(()=>{a.current=!1;const l=e.current;if(!l)return;const f=l.scrollHeight-l.scrollTop-l.clientHeight<150;f!==r.current&&(r.current=f,n(f))}))},[e]),o=v.useCallback(()=>{const l=e.current;l&&(i.current=!0,n(!0),r.current=!0,l.scrollTo({top:l.scrollHeight,behavior:"smooth"}),setTimeout(()=>{i.current=!1},500))},[e]);return{onScroll:s,isNearBottom:t,scrollToBottom:o}}im(ke(),Ui());const xdt=nn({filePath:ke(),ownerId:ke(),ownerLabel:ke().optional(),acquiredAt:ke(),expiresAt:ke(),metadata:im(ke(),Cu()).optional()});nn({version:Pr(1),workspaceId:ke(),locks:Ya(xdt)});const Sdt=Ya(ke());im(ke(),Ya(ke()));const ude="ff_resume_workspace_ids";function uF(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(ude);if(!e)return[];const t=JSON.parse(e);return Sdt.parse(t)}catch{return[]}}function dde(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ude,JSON.stringify(e))}catch{}}function wdt(e){const t=uF();t.includes(e)||t.push(e);const n=t.slice(-200);dde(n)}function Edt(e){const t=uF().filter(n=>n!==e);dde(t)}function Cdt(e){return uF().includes(e)}function Tdt({workspaceId:e}){const t=Ce.useUtils(),{data:n,isLoading:r}=Ce.workspace.get.useQuery({id:e},{refetchInterval:3e4,staleTime:1e4,refetchOnWindowFocus:!1}),i=v.useCallback(()=>{t.workspace.get.invalidate({id:e})},[t,e]),a=Ce.workspace.syncPRStatus.useMutation({onSuccess:()=>{t.workspace.get.invalidate({id:e})}}),s=v.useRef(!1);v.useEffect(()=>{n?.prUrl&&!s.current&&!a.isPending&&(s.current=!0,a.mutate({workspaceId:e}))},[n?.prUrl,e,a]);const{data:o,isLoading:l}=Ce.session.listSessions.useQuery({workspaceId:e},{refetchInterval:1e4,staleTime:0,refetchOnWindowFocus:!1}),{data:c}=Ce.session.getMaxSessionsPerWorkspace.useQuery(),f=o?.[0]?.id;return{workspace:n,workspaceLoading:r,sessions:o,sessionsLoading:l,initialDbSessionId:f,maxSessions:c,invalidateWorkspace:i}}function kdt({workspaceId:e,slug:t,sessions:n,sendMessage:r,inputRef:i,selectedDbSessionId:a,setSelectedDbSessionId:s,selectedModel:o,selectedProvider:l,isSessionReady:c}){const d=to(),f=Ce.useUtils(),m=v.useRef(null),g=v.useRef(c);v.useEffect(()=>{const $=m.current,W=!g.current&&c;$&&$.dbSessionId===a&&W&&(m.current=null,r($.prompt)),g.current=c},[a,r,c]);const y=Ce.session.createSession.useMutation({onSuccess:$=>{f.session.listSessions.invalidate({workspaceId:e})}}),_=Ce.session.startSession.useMutation(),S=Ce.session.deleteSession.useMutation({onMutate:async({id:$})=>{await f.session.listSessions.cancel({workspaceId:e});const W=f.session.listSessions.getData({workspaceId:e});return f.session.listSessions.setData({workspaceId:e},V=>V?.filter(H=>H.id!==$)),{previousSessions:W}},onError:($,W,V)=>{V?.previousSessions&&f.session.listSessions.setData({workspaceId:e},V.previousSessions)},onSettled:()=>{f.session.listSessions.invalidate({workspaceId:e})}}),w=Ce.workspace.archive.useMutation({onSuccess:()=>{d(`/projects/${t}/workspaces`)}}),E=Ce.workspace.openInIde.useMutation({onError:$=>{Qt.error($.message)}}),{data:T}=Ce.workspace.getAvailableIdes.useQuery(),A=T?.ides??[],O=T?.preferredIde??"cursor",I=v.useCallback($=>{s($),setTimeout(()=>i.current?.focus(),0)},[i,s]),N=v.useCallback($=>{if(!n||n.length===0)return;const W=n.findIndex(H=>H.id===$);if(W===-1)return;const V=$===a;if(S.mutate({id:$}),V&&n.length>1){const H=n[W+1]??n[W-1];s(H?.id??null)}else n.length===1&&s(null)},[n,a,S,s]),D=v.useCallback(()=>{const $=(n??[]).map(V=>{const H=V.name?.match(/^Chat (\d+)$/);return H?Number.parseInt(H[1],10):0}).filter(V=>V>0);return`Chat ${$.length>0?Math.max(...$)+1:1}`},[n]),F=v.useCallback(()=>{const $=D(),W=l,V=W==="CODEX"?void 0:o||void 0;y.mutate({workspaceId:e,workflow:"followup",model:V,name:$,provider:W},{onSuccess:H=>{const z=a;_.mutate({id:H.id,initialPrompt:""},{onSuccess:()=>{s(H.id),setTimeout(()=>i.current?.focus(),0)},onError:M=>{Qt.error(M.message||"Failed to start session"),s(z)}})}})},[y,e,D,_,a,s,i,o,l]),P=v.useCallback(($,W)=>{const V=l,H=V==="CODEX"?void 0:o||void 0,z=a;y.mutate({workspaceId:e,workflow:"followup",name:$,model:H,provider:V},{onSuccess:M=>{_.mutate({id:M.id,initialPrompt:""},{onSuccess:()=>{m.current={dbSessionId:M.id,prompt:W},s(M.id)},onError:G=>{Qt.error(G.message||"Failed to start session"),m.current=null,s(z)}})}})},[y,e,_,a,s,o,l]);return{createSession:y,deleteSession:S,archiveWorkspace:w,openInIde:E,availableIdes:A,preferredIde:O,handleSelectSession:I,handleCloseSession:N,handleNewChat:F,handleQuickAction:P}}function Ndt(e,t,n){const{data:r,isPending:i}=Ce.workspace.getInitStatus.useQuery({id:e},{refetchInterval:d=>{const f=d.state.data?.status;return f==="READY"||f==="FAILED"||f==="ARCHIVED"?!1:1e3}}),a=v.useRef(void 0),s=v.useRef(!1),o=r?.hasWorktreePath??!1;v.useEffect(()=>{const d=r?.status,f=a.current;if(o&&!s.current&&n.workspace.get.invalidate({id:e}),s.current=o,d==="READY"){const m=f!==void 0&&f!=="READY",g=f===void 0&&!t?.worktreePath;(m||g)&&n.workspace.get.invalidate({id:e})}a.current=d},[r?.status,o,e,n,t?.worktreePath]);const c=r?.status==="FAILED"&&o;return{workspaceInitStatus:r,isInitStatusPending:i,isScriptFailed:c}}const Adt="workspace-selected-session-",Rdt=5e3;function Idt({currentSelectedDbSessionId:e,persistedSessionId:t,initialDbSessionId:n,sessionIds:r,pendingSelectionId:i,pendingSelectionSetAtMs:a,nowMs:s=Date.now()}){return r.length===0||i!=null&&e===i&&!r.includes(i)&&a!=null&&s-a<Rdt||e&&r.includes(e)?e:t&&r.includes(t)?t:n&&r.includes(n)?n:r[0]??null}function Odt(e,t,n){const r=`${Adt}${e}`,i=v.useRef({id:null,setAtMs:null}),[a,s]=v.useState(()=>localStorage.getItem(r)??t);v.useEffect(()=>{const l=i.current;l.id&&n.includes(l.id)&&(i.current={id:null,setAtMs:null});const c=localStorage.getItem(r),d=Idt({currentSelectedDbSessionId:a,persistedSessionId:c,initialDbSessionId:t,sessionIds:n,pendingSelectionId:i.current.id,pendingSelectionSetAtMs:i.current.setAtMs});d!==a&&s(d)},[t,a,n,r]);const o=v.useCallback(l=>{i.current={id:l,setAtMs:l?Date.now():null},s(l),l?localStorage.setItem(r,l):localStorage.removeItem(r)},[r]);return{selectedDbSessionId:a,setSelectedDbSessionId:o}}function Ddt({workspaceLoading:e,workspace:t,selectedDbSessionId:n,activeTabId:r,loadingSession:i,inputRef:a}){const s=v.useRef(!1);v.useEffect(()=>{!(s.current||e)&&t&&n&&r==="chat"&&!i&&(s.current=!0,setTimeout(()=>a.current?.focus(),0))},[n,r,i,e,t,a])}function hde(e){const t=Ce.useUtils(),n=Ce.workspace.retryInit.useMutation({onSuccess:()=>{t.workspace.getInitStatus.invalidate({id:e})},onError:i=>{Qt.error(i.message)}});return{retry:v.useCallback(()=>{n.mutate({id:e,useExistingBranch:Cdt(e)||void 0})},[n,e]),retryInit:n}}function Mdt(e,t){return e==="starting"||t}function Ldt({loadingSession:e,stopping:t,displayStartingState:n,running:r,pendingRequest:i,sessionPhase:a,messageCount:s}){return e?"Loading session...":t?"Stopping...":n&&!r?"Agent is starting...":i.type==="permission"&&i.request.toolName==="ExitPlanMode"?"Type feedback to revise the plan...":r?"Message will be queued...":a==="ready"&&s===0?"Type a message to start the agent...":"Type a message..."}function Pdt(e){return e==="error"?"border-red-200 bg-red-50 text-red-900":e==="warning"?"border-yellow-200 bg-yellow-50 text-yellow-900":"border-blue-200 bg-blue-50 text-blue-900"}const Bdt=v.memo(function({banner:t,retryPending:n,onRetry:r,onPlay:i}){const a=t.showRetry||t.showPlay;return h.jsx("div",{className:"px-4 pt-4",children:h.jsxs("div",{className:["rounded-md border p-3 text-sm flex items-start gap-3",Pdt(t.kind)].join(" "),children:[t.kind==="info"?h.jsx(un,{className:"h-4 w-4 mt-0.5 shrink-0 animate-spin"}):h.jsx(hc,{className:"h-4 w-4 mt-0.5 shrink-0"}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{children:t.message}),a&&h.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.showRetry&&h.jsxs(We,{size:"sm",variant:"outline",disabled:n,onClick:r,children:[h.jsx(dc,{className:"h-3.5 w-3.5 mr-1.5"}),"Retry setup"]}),t.showPlay&&h.jsxs(We,{size:"sm",onClick:i,children:[h.jsx(pl,{className:"h-3.5 w-3.5 mr-1.5"}),"Dispatch queued messages"]})]})]})]})})}),jdt=v.memo(function({workspaceId:t,messages:n,sessionStatus:r,messagesEndRef:i,viewportRef:a,isNearBottom:s,scrollToBottom:o,onScroll:l,pendingRequest:c,approvePermission:d,answerQuestion:f,connected:m,sendMessage:g,stopChat:y,inputRef:_,chatSettings:S,chatCapabilities:w,updateSettings:E,inputDraft:T,setInputDraft:A,inputAttachments:O,setInputAttachments:I,queuedMessages:N,removeQueuedMessage:D,resumeQueuedMessages:F,latestThinking:P,pendingMessages:$,isCompacting:W,permissionMode:V,slashCommands:H,slashCommandsLoaded:z,tokenStats:M,rewindPreview:G,startRewindPreview:B,confirmRewind:Q,cancelRewind:q,getUuidForMessageId:Y,acpPlan:K,acpConfigOptions:j,setConfigOption:ee,toolProgress:re,autoStartPending:de=!1,initBanner:le}){const{retry:_e,retryInit:Ae}=hde(t),we=v.useMemo(()=>CZe(n),[n]),Oe=v.useMemo(()=>{for(let rn=we.length-1;rn>=0;rn-=1){const mr=we[rn];if(mr&&Sj(mr))return mr}return null},[we]),Be=v.useMemo(()=>new Set(N.map(rn=>rn.id)),[N]),qe=v.useCallback(()=>{s&&a.current&&a.current.scrollTo({top:a.current.scrollHeight,behavior:"instant"})},[s,a]),At=r.phase==="running",Yt=r.phase==="stopping",qt=Mdt(r.phase,de),In=r.phase==="loading",Kn=w.rewind.enabled,an=c.type==="permission"?c.request.requestId:null,$n=c.type==="permission"&&c.request.toolName==="ExitPlanMode";v.useEffect(()=>{if(!($n&&an))return;const rn=document.activeElement;rn&&rn!==document.body||_?.current?.focus()},[$n,an,_]);const Or=Ldt({loadingSession:In,stopping:Yt,displayStartingState:qt,running:At,pendingRequest:c,sessionPhase:r.phase,messageCount:n.length});return h.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden",children:[h.jsxs("div",{ref:a,className:"flex-1 min-h-0 overflow-y-auto",children:[le&&le.kind!=="info"&&h.jsx(Bdt,{banner:le,retryPending:Ae.isPending,onRetry:_e,onPlay:F}),h.jsx(vdt,{messages:we,running:At,startingSession:qt,loadingSession:In,scrollContainerRef:a,onScroll:l,messagesEndRef:i,isNearBottom:s,queuedMessageIds:Be,onRemoveQueuedMessage:D,isCompacting:W,getUuidForMessageId:Y,onRewindToMessage:Kn?B:void 0,initBanner:le})]}),!s&&h.jsx("div",{className:"absolute bottom-28 left-1/2 -translate-x-1/2 z-10",children:h.jsxs(We,{variant:"secondary",size:"sm",onClick:o,className:"rounded-full shadow-lg",children:[h.jsx(pve,{className:"h-4 w-4 mr-1"}),"Scroll to bottom"]})}),h.jsxs("div",{className:"border-t",children:[h.jsx(sot,{workspaceId:t,running:At,starting:qt,stopping:Yt,permissionMode:V,latestThinking:P??null,latestToolSequence:Oe,acpPlan:K,toolProgress:re}),h.jsx(dct,{permission:c.type==="permission"?c.request:null,onApprove:d}),h.jsx(mct,{question:c.type==="question"?c.request:null,onAnswer:f}),h.jsx(qlt,{onSend:g,onStop:y,disabled:!m||In,running:At,stopping:Yt,inputRef:_,placeholder:Or,settings:S,capabilities:w,onSettingsChange:E,value:T,onChange:A,attachments:O,onAttachmentsChange:I,onHeightChange:qe,pendingMessageCount:$.size,slashCommands:H,slashCommandsLoaded:z,tokenStats:M,workspaceId:t,acpConfigOptions:j,onSetConfigOption:ee})]}),h.jsx(gct,{rewindPreview:G,onConfirm:Q,onCancel:q})]})});function Fdt(){const{rightPanelVisible:e,toggleRightPanel:t}=Do();return h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx(We,{variant:"ghost",size:"icon",onClick:t,className:"h-8 w-8",children:h.jsx(M_e,{className:ne("h-4 w-4",e&&"text-primary")})})}),h.jsx(er,{children:e?"Hide right panel":"Show right panel"})]})}function $dt({workspace:e}){return e.branchName?h.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[h.jsx(l0,{className:"h-3.5 w-3.5 md:h-4 md:w-4 text-muted-foreground shrink-0"}),h.jsx("h1",{className:"text-sm md:text-lg font-semibold font-mono truncate",children:e.branchName})]}):h.jsx("h1",{className:"text-sm md:text-lg font-semibold truncate",children:e.name})}function Udt({workspace:e,hasChanges:t,running:n,isCreatingSession:r,handleQuickAction:i}){return t&&!n&&(e.prState==="NONE"||e.prState==="CLOSED")?h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsxs(We,{variant:"ghost",size:"sm",className:"h-6 gap-1 text-xs px-2",disabled:r,onClick:()=>i("Create Pull Request","Create a pull request for the current branch using the GitHub CLI (gh). Include a clear title and description summarizing the changes."),children:[h.jsx(Cp,{className:"h-3 w-3"}),"Create PR"]})}),h.jsx(er,{children:"Create a pull request for this branch"})]}):e.prUrl&&e.prNumber&&e.prState!=="NONE"&&e.prState!=="CLOSED"?h.jsxs("a",{href:e.prUrl,target:"_blank",rel:"noopener noreferrer",className:`flex items-center gap-1 text-xs hover:opacity-80 transition-opacity ${e.prState==="MERGED"?"text-green-500":"text-muted-foreground hover:text-foreground"}`,children:[h.jsx(Cp,{className:"h-3 w-3"}),"#",e.prNumber,e.prState==="MERGED"&&h.jsx(fl,{className:"h-3 w-3 text-green-500"})]}):null}function zdt({workspace:e}){return!e.prUrl||!e.sidebarStatus?null:h.jsx(Bj,{ciState:e.sidebarStatus.ciState,prState:e.prState,size:"md"})}function Hdt({workspace:e,workspaceId:t}){const n=Ce.useUtils(),r=Ce.workspace.toggleRatcheting.useMutation({onSuccess:()=>{n.workspace.get.invalidate({id:t}),n.workspace.listWithKanbanState.invalidate({projectId:e.projectId}),n.workspace.getProjectSummaryState.invalidate({projectId:e.projectId})}}),i=e.ratchetEnabled??!0;return h.jsx(Z0,{enabled:i,state:e.ratchetState,animated:e.ratchetButtonAnimated??!1,disabled:r.isPending,onToggle:a=>{r.mutate({workspaceId:t,enabled:a})}})}function Wdt({workspace:e,workspaceId:t}){const[n,r]=v.useState(!1),[i,a]=v.useState(Xc(e.defaultSessionProvider)),[s,o]=v.useState(Xc(e.ratchetSessionProvider)),{data:l}=Ce.userSettings.get.useQuery(),c=Ce.useUtils(),d=Ce.workspace.updateProviderDefaults.useMutation({onSuccess:()=>{c.workspace.get.invalidate({id:t}),c.workspace.listWithKanbanState.invalidate({projectId:e.projectId}),c.workspace.getProjectSummaryState.invalidate({projectId:e.projectId}),r(!1)}});v.useEffect(()=>{n&&(a(Xc(e.defaultSessionProvider)),o(Xc(e.ratchetSessionProvider)))},[n,e.defaultSessionProvider,e.ratchetSessionProvider]);const f=Xc(e.defaultSessionProvider),m=Xc(e.ratchetSessionProvider),g=i!==f||s!==m,y=l?.defaultSessionProvider,_=M9("WORKSPACE_DEFAULT",y),S=M9(i,y);return h.jsxs(dv,{open:n,onOpenChange:r,children:[h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx(oue,{asChild:!0,children:h.jsx(We,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Provider settings",children:h.jsx(Y_e,{className:"h-4 w-4"})})})}),h.jsx(er,{children:"Provider settings"})]}),h.jsxs(Lm,{className:"sm:max-w-[440px]",children:[h.jsxs(hv,{children:[h.jsx(fv,{children:"Session Provider Defaults"}),h.jsx(pv,{children:"Configure workspace defaults and ratchet provider behavior."})]}),h.jsxs("div",{className:"space-y-4 py-2",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(Gr,{htmlFor:"workspace-default-provider",children:"Default Session Provider"}),h.jsxs(mc,{value:i,onValueChange:w=>{a(Xc(w))},children:[h.jsx(yl,{id:"workspace-default-provider",children:h.jsx(Nu,{})}),h.jsxs(vl,{children:[h.jsx(sr,{value:"WORKSPACE_DEFAULT",children:_}),MR.map(w=>h.jsx(sr,{value:w.value,children:w.label},`default-${w.value}`))]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Gr,{htmlFor:"workspace-ratchet-provider",children:"Ratchet Session Provider"}),h.jsxs(mc,{value:s,onValueChange:w=>{o(Xc(w))},children:[h.jsx(yl,{id:"workspace-ratchet-provider",children:h.jsx(Nu,{})}),h.jsxs(vl,{children:[h.jsx(sr,{value:"WORKSPACE_DEFAULT",children:S}),MR.map(w=>h.jsx(sr,{value:w.value,children:w.label},`ratchet-${w.value}`))]})]})]})]}),h.jsxs(tC,{children:[h.jsx(We,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),h.jsx(We,{onClick:()=>{d.mutate({workspaceId:t,defaultSessionProvider:i,ratchetSessionProvider:s})},disabled:!g||d.isPending,children:d.isPending?"Saving...":"Save"})]})]})]})}function Gdt({workspace:e,workspaceId:t,availableIdes:n,preferredIde:r,openInIde:i,archivePending:a,onArchiveRequest:s,handleQuickAction:o,running:l,isCreatingSession:c,hasChanges:d}){return h.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-1 md:gap-2 px-2 py-1.5 md:px-4 md:py-2 border-b",children:[h.jsxs("div",{className:"flex items-center gap-2 md:gap-3 min-w-0",children:[h.jsx($dt,{workspace:e}),h.jsx(fQe,{workspaceId:t}),h.jsx(Udt,{workspace:e,hasChanges:d,running:l,isCreatingSession:c,handleQuickAction:o}),h.jsx(zdt,{workspace:e})]}),h.jsxs("div",{className:"flex items-center justify-end gap-0.5 md:gap-1 shrink-0",children:[h.jsx(Wdt,{workspace:e,workspaceId:t}),h.jsx(Hdt,{workspace:e,workspaceId:t}),h.jsx(vXe,{onExecuteAgent:f=>{f.content&&o(f.name,f.content)},disabled:l||c}),h.jsx(hQe,{workspaceId:t}),n.length>0&&h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx(We,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>i.mutate({id:t}),disabled:i.isPending||!e.worktreePath,children:i.isPending?h.jsx(un,{className:"h-4 w-4 animate-spin"}):h.jsx(dve,{className:"h-4 w-4"})})}),h.jsxs(er,{children:["Open in ",n.find(f=>f.id===r)?.name??"IDE"]})]}),h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx(We,{variant:e.prState==="MERGED"?"default":"ghost",size:"icon",className:ne("h-8 w-8",e.prState==="MERGED"?"":"hover:bg-destructive/10 hover:text-destructive"),onClick:s,disabled:a,children:a?h.jsx(un,{className:"h-4 w-4 animate-spin"}):h.jsx(Kw,{className:"h-4 w-4"})})}),h.jsx(er,{children:a?"Archiving...":"Archive"})]}),h.jsx(Fdt,{})]})]})}function qdt({output:e,className:t,emptyMessage:n="Waiting for output..."}){const r=v.useRef(null);return v.useEffect(()=>{r.current&&e!==null&&(r.current.scrollTop=r.current.scrollHeight)},[e]),h.jsx(wo,{viewportRef:r,className:t,children:h.jsx("pre",{className:"p-2 text-xs font-mono text-zinc-300 whitespace-pre-wrap break-words",children:e||h.jsx("span",{className:"text-zinc-500 italic",children:n})})})}function Vdt({workspaceId:e,initErrorMessage:t,initOutput:n,hasStartupScript:r}){const[i,a]=v.useState(!1),{retry:s,retryInit:o}=hde(e);return h.jsxs("div",{className:"border-b bg-destructive/10 px-4 py-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[h.jsx(hc,{className:"h-3 w-3"}),h.jsxs("span",{children:["Init script failed",t?`: ${t}`:""]})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[r&&n&&h.jsxs(We,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>a(!i),children:[i?h.jsx(Za,{className:"h-3 w-3 mr-1"}):h.jsx(xs,{className:"h-3 w-3 mr-1"}),i?"Hide output":"Show output"]}),h.jsx(We,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:s,disabled:o.isPending,children:o.isPending?h.jsxs(h.Fragment,{children:[h.jsx(un,{className:"h-3 w-3 mr-1 animate-spin"}),"Retrying..."]}):h.jsxs(h.Fragment,{children:[h.jsx(dc,{className:"h-3 w-3 mr-1"}),"Retry"]})})]})]}),i&&r&&h.jsx(qdt,{output:n,className:"mt-2 h-32 w-full rounded-md border bg-zinc-950"})]})}function Ydt(){return h.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-md",children:h.jsxs("div",{className:"flex items-center gap-3 p-8",children:[h.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-muted-foreground/40 border-t-muted-foreground"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Archiving..."})]})})}function Kdt({workspaceId:e,isScriptFailed:t,workspaceInitStatus:n}){return t?h.jsx(Vdt,{workspaceId:e,initErrorMessage:n?.initErrorMessage??null,initOutput:n?.initOutput??null,hasStartupScript:n?.hasStartupScript??!1}):null}function Xdt({workspaceState:e,header:t,sessionTabs:n,chat:r,rightPanelVisible:i,archiveDialog:a}){return e.workspaceLoading?h.jsx(Fh,{message:"Loading workspace..."}):e.workspace?h.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden",children:[t.archivePending&&h.jsx(Ydt,{}),h.jsx(Gdt,{workspace:e.workspace,workspaceId:e.workspaceId,availableIdes:t.availableIdes,preferredIde:t.preferredIde,openInIde:t.openInIde,archivePending:t.archivePending,onArchiveRequest:t.handleArchiveRequest,handleQuickAction:t.handleQuickAction,running:t.running,isCreatingSession:t.isCreatingSession,hasChanges:t.hasChanges}),h.jsx(Kdt,{workspaceId:e.workspaceId,isScriptFailed:e.isScriptFailed,workspaceInitStatus:e.workspaceInitStatus}),h.jsxs(wO,{direction:"horizontal",className:"flex-1 overflow-hidden",autoSaveId:"workspace-main-panel",children:[h.jsx(Ap,{defaultSize:"70%",minSize:"30%",children:h.jsx("div",{className:"h-full flex flex-col min-w-0",children:h.jsx(Ett,{workspaceId:e.workspaceId,sessions:n.sessions,selectedSessionId:n.selectedDbSessionId,sessionSummariesById:n.sessionSummariesById,isCreatingSession:t.isCreatingSession,isDeletingSession:n.isDeletingSession,onSelectSession:n.handleSelectSession,onCreateSession:n.handleNewChat,onCloseSession:n.handleCloseChatSession,maxSessions:n.maxSessions,hasWorktreePath:n.hasWorktreePath,selectedProvider:n.selectedProvider,setSelectedProvider:n.setSelectedProvider,children:h.jsx(jdt,{...r})})})}),i&&h.jsxs(h.Fragment,{children:[h.jsx(EO,{}),h.jsx(Ap,{defaultSize:"30%",minSize:"15%",maxSize:"50%",children:h.jsx("div",{className:"h-full border-l",children:h.jsx(PZe,{workspaceId:e.workspaceId,messages:r.messages,onTakeScreenshots:()=>t.handleQuickAction("Take Screenshots","Take a screenshot of the workspace dev app using Playwright MCP tools. Read factory-factory.json for the scripts.run command, pick a free port, replace {port}, and start the dev server in the background. Once ready, determine the most relevant screen and save a screenshot to .factory-factory/screenshots/ with a descriptive filename.")})})})]})]}),h.jsx(gZ,{open:a.open,onOpenChange:a.setOpen,hasUncommitted:a.hasUncommitted,onConfirm:a.onConfirm})]}):h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[h.jsx("p",{className:"text-destructive",children:"Workspace not found"}),h.jsx(We,{variant:"outline",onClick:e.handleBackToWorkspaces,children:"Back to workspaces"})]})}function Zdt(e,t){if(!e)return!1;const n=e.lastExit,r=t.lastExit,i=n===r||n?.code===r?.code&&n?.timestamp===r?.timestamp&&n?.unexpected===r?.unexpected;return e.phase===t.phase&&e.processState===t.processState&&e.activity===t.activity&&e.updatedAt===t.updatedAt&&i}function Qdt(e,t){if(!t)return!0;const n=Date.parse(e.updatedAt),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?!0:n>=r}function Jdt(e,t,n){const r=new Map((e??[]).map(i=>[i.sessionId,i]));for(const i of t??[]){const a=n.get(i.id);if(!a)continue;const s=r.get(i.id);Qdt(a,s?.updatedAt)&&r.set(i.id,{sessionId:i.id,name:s?.name??i.name??null,workflow:s?.workflow??i.workflow??null,model:s?.model??i.model??null,provider:s?.provider??i.provider,persistedStatus:s?.persistedStatus??i.status,runtimePhase:a.phase,processState:a.processState,activity:a.activity,updatedAt:a.updatedAt,lastExit:a.lastExit??s?.lastExit??null})}return r}function eht(){const{slug:e="",id:t=""}=tm(),n=to(),r=Ce.useUtils(),{workspace:i,workspaceLoading:a,sessions:s,initialDbSessionId:o,maxSessions:l}=Tdt({workspaceId:t}),{rightPanelVisible:c,activeTabId:d,clearScrollState:f}=Do(),{data:m}=Ce.userSettings.get.useQuery(),{data:g}=Ce.workspace.hasChanges.useQuery({workspaceId:t},{enabled:i?.hasHadSessions===!0&&i?.prState==="NONE"}),{workspaceInitStatus:y,isScriptFailed:_}=Ndt(t,i,r);v.useEffect(()=>{const Fe=y?.phase;(Fe==="READY"||Fe==="ARCHIVED")&&Edt(t)},[t,y?.phase]);const S=v.useMemo(()=>s?.map(Fe=>Fe.id)??[],[s]),{selectedDbSessionId:w,setSelectedDbSessionId:E}=Odt(t,o??null,S),[T,A]=v.useState(!1),O=Lae(i?.defaultSessionProvider,m?.defaultSessionProvider),[I,N]=v.useState(O);v.useEffect(()=>{N(O)},[O]);const{data:D}=Ce.workspace.getGitStatus.useQuery({workspaceId:t},{enabled:!!i?.worktreePath,refetchInterval:15e3,staleTime:1e4}),F=D?.hasUncommitted===!0,{messages:P,connected:$,sessionStatus:W,processStatus:V,sessionRuntime:H,pendingRequest:z,chatSettings:M,chatCapabilities:G,inputDraft:B,inputAttachments:Q,queuedMessages:q,removeQueuedMessage:Y,resumeQueuedMessages:K,latestThinking:j,pendingMessages:ee,isCompacting:re,permissionMode:de,slashCommands:le,slashCommandsLoaded:_e,tokenStats:Ae,rewindPreview:we,sendMessage:Oe,stopChat:Be,approvePermission:qe,answerQuestion:At,updateSettings:Yt,setInputDraft:qt,setInputAttachments:In,startRewindPreview:Kn,confirmRewind:an,cancelRewind:$n,getUuidForMessageId:Or,acpPlan:rn,acpConfigOptions:mr,setConfigOption:hn,toolProgress:_r,inputRef:xe,messagesEndRef:je}=Zut({dbSessionId:w}),tt=W.phase==="loading",ut=W.phase==="ready"||W.phase==="running",Lt=i?.creationSource==="GITHUB_ISSUE"&&w!==null&&(W.phase==="loading"||W.phase==="ready")&&V.state==="unknown"&&P.some(Fe=>Fe.source==="user")&&!P.some(Fe=>Fe.source==="agent"),[wn,Un]=v.useState(new Map);v.useEffect(()=>{w&&Un(Fe=>{const Ke=Fe.get(w);if(Zdt(Ke,H))return Fe;const st=new Map(Fe);return st.set(w,H),st})},[w,H]),v.useEffect(()=>{const Fe=new Set(S);Un(Ke=>{let st=!1;const Et=new Map;for(const[mt,sn]of Ke)Fe.has(mt)?Et.set(mt,sn):st=!0;return st?Et:Ke})},[S]);const Mn=v.useMemo(()=>Jdt(i?.sessionSummaries,s,wn),[i?.sessionSummaries,s,wn]),Kt=v.useMemo(()=>Array.from(Mn.values()).some(Fe=>Fe.activity==="WORKING"||Fe.runtimePhase==="running"),[Mn]),{createSession:fn,deleteSession:jt,archiveWorkspace:gr,openInIde:tr,availableIdes:_t,preferredIde:Ot,handleSelectSession:ot,handleCloseSession:lt,handleNewChat:Bt,handleQuickAction:Ue}=kdt({workspaceId:t,slug:e,sessions:s,sendMessage:Oe,inputRef:xe,selectedDbSessionId:w,setSelectedDbSessionId:E,selectedModel:M.selectedModel,selectedProvider:I,isSessionReady:ut}),Xt=v.useCallback(Fe=>{const Ke=Fe;if(Ke.data?.code==="PRECONDITION_FAILED"){Qt.error("Archiving blocked: enable commit before archiving to proceed.");return}Qt.error(Ke.message??"Failed to archive workspace")},[]),St=v.useCallback(Fe=>{gr.mutate({id:t,commitUncommitted:Fe},{onError:Xt})},[gr,Xt,t]),zt=v.useCallback(()=>{if(i?.prState==="MERGED"){St(!0);return}A(!0)},[i?.prState,St]),Ln=v.useCallback(()=>n(`/projects/${e}/workspaces`),[n,e]),Wt=v.useRef(null),Jt=v.useRef(null),{onScroll:xr,isNearBottom:ie,scrollToBottom:ce}=_dt(Wt),pe=v.useCallback(Fe=>{f(`chat-${Fe}`),lt(Fe)},[f,lt]),Ne=w?`chat-${w}`:null,{persistCurrent:$e}=By({tabId:Ne,mode:"chat",viewportRef:Wt,enabled:d==="chat"&&!!Ne,restoreDeps:[P.length,d,Ne],autoStickToBottom:!0,stickToBottomThreshold:150,onRestore:xr});v.useEffect(()=>{const Fe=Jt.current;Fe&&Fe!==w&&$e(`chat-${Fe}`),Jt.current=w},[w,$e]);const at=v.useCallback(()=>{xr(),$e()},[xr,$e]);Ddt({workspaceLoading:a,workspace:i,selectedDbSessionId:w,activeTabId:d,loadingSession:tt,inputRef:xe});const Ze={workspaceId:t,messages:P,sessionStatus:W,messagesEndRef:je,viewportRef:Wt,isNearBottom:ie,scrollToBottom:ce,onScroll:at,pendingRequest:z,approvePermission:qe,answerQuestion:At,connected:$,sendMessage:Oe,stopChat:Be,inputRef:xe,chatSettings:M,chatCapabilities:G,updateSettings:Yt,inputDraft:B,setInputDraft:qt,inputAttachments:Q,setInputAttachments:In,queuedMessages:q,removeQueuedMessage:Y,resumeQueuedMessages:K,latestThinking:j,pendingMessages:ee,isCompacting:re,permissionMode:de,slashCommands:le,slashCommandsLoaded:_e,tokenStats:Ae,rewindPreview:we,startRewindPreview:Kn,confirmRewind:an,cancelRewind:$n,getUuidForMessageId:Or,acpPlan:rn,acpConfigOptions:mr,setConfigOption:hn,toolProgress:_r,autoStartPending:Lt,initBanner:y?.chatBanner??null};return h.jsx(Xdt,{workspaceState:{workspaceLoading:a,workspace:i,workspaceId:t,handleBackToWorkspaces:Ln,isScriptFailed:_,workspaceInitStatus:y},header:{archivePending:gr.isPending,availableIdes:_t,preferredIde:Ot,openInIde:tr,handleArchiveRequest:zt,handleQuickAction:Ue,running:Kt,isCreatingSession:fn.isPending,hasChanges:g},sessionTabs:{sessions:s,selectedDbSessionId:w,sessionSummariesById:Mn,isDeletingSession:jt.isPending,handleSelectSession:ot,handleNewChat:Bt,handleCloseChatSession:pe,maxSessions:l,hasWorktreePath:!!i?.worktreePath,selectedProvider:I,setSelectedProvider:N},chat:Ze,rightPanelVisible:c,archiveDialog:{open:T,setOpen:A,hasUncommitted:F,onConfirm:St}})}function tht(){const{id:e=""}=tm();return h.jsx(oYe,{workspaceId:e,children:h.jsx(v.Suspense,{fallback:h.jsx(Fh,{message:"Loading chat..."}),children:h.jsx(eht,{},e)})})}function II({onClick:e,isCreating:t,children:n="New Workspace"}){return g0()?h.jsx(We,{size:"icon",variant:"outline",className:"h-8 w-8",onClick:e,disabled:t,children:t?h.jsx(un,{className:"h-4 w-4 animate-spin"}):h.jsx(Yd,{className:"h-4 w-4"})}):h.jsxs(We,{size:"sm",onClick:e,disabled:t,children:[t?h.jsx(un,{className:"h-4 w-4 mr-2 animate-spin"}):h.jsx(Yd,{className:"h-4 w-4 mr-2"}),n]})}function nht({open:e,onOpenChange:t,branches:n,isLoading:r,isSubmitting:i,onSelectBranch:a}){return h.jsxs(Mot,{open:e,onOpenChange:t,children:[h.jsx(Lue,{placeholder:"Search branches..."}),h.jsxs(lC,{children:[r&&h.jsx(Yy,{children:"Loading branches..."}),!r&&n.length===0&&h.jsx(Yy,{children:"No branches found."}),!r&&n.length>0&&h.jsx(cC,{heading:"Branches",children:n.map(s=>h.jsxs(uC,{value:s.displayName,onSelect:()=>a(s),disabled:i,children:[h.jsx("span",{className:"font-mono text-sm",children:s.displayName}),s.refType==="remote"&&h.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"remote"})]},s.name))})]})]})}function rht({issue:e,projectId:t,onClick:n}){const r=Ce.useUtils(),{data:i,isLoading:a}=Ce.userSettings.get.useQuery(),[s,o]=v.useState(!1),l=`kanban:issue-ratchet:${t}:${e.number}`;v.useEffect(()=>{if(i?.ratchetEnabled!==void 0){try{const g=window.localStorage.getItem(l);if(g==="true"||g==="false"){o(g==="true");return}}catch{}o(i.ratchetEnabled)}},[l,i?.ratchetEnabled]);const c=Ce.workspace.create.useMutation({onSuccess:g=>{r.workspace.get.setData({id:g.id},y=>y||Lj(g)),r.workspace.listWithKanbanState.invalidate({projectId:t})}}),d=g=>{g.preventDefault(),g.stopPropagation(),c.mutate({type:"GITHUB_ISSUE",projectId:t,issueNumber:e.number,issueUrl:e.url,name:e.title,ratchetEnabled:s})},f=g=>{g.preventDefault(),g.stopPropagation(),window.open(e.url,"_blank","noopener,noreferrer")},m=()=>{n?.()};return h.jsxs(vr,{className:"cursor-pointer hover:border-primary/50 transition-colors overflow-hidden border-dashed",onClick:m,children:[h.jsx(pi,{className:"pb-3",children:h.jsx(mi,{className:"text-sm font-medium leading-tight line-clamp-2",children:e.title})}),h.jsx(Yr,{className:"pt-0",children:h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground min-w-0",children:[h.jsx(Z0,{enabled:s,state:"IDLE",className:"h-5 w-5 shrink-0",stopPropagation:!0,disabled:a||c.isPending,onToggle:g=>{o(g);try{window.localStorage.setItem(l,String(g))}catch{}}}),h.jsxs("button",{type:"button",onClick:f,className:"inline-flex items-center gap-1 hover:text-foreground shrink-0",children:[h.jsx(Mq,{className:"h-3 w-3 text-green-500"}),h.jsxs("span",{children:["#",e.number]})]}),h.jsxs("span",{className:"inline-flex items-center gap-1 truncate",children:[h.jsx(Xq,{className:"h-3 w-3 shrink-0"}),e.author.login]})]}),h.jsxs(We,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs shrink-0",onClick:d,disabled:c.isPending||a,children:[h.jsx(pl,{className:"h-3 w-3 mr-1"}),c.isPending?"...":"Start"]})]})})]})}function iht({issue:e,projectId:t,open:n,onOpenChange:r}){const i=Ce.useUtils(),{data:a,isLoading:s}=Ce.userSettings.get.useQuery(),[o,l]=v.useState(!1),{data:c,isLoading:d,refetch:f}=Ce.github.getIssue.useQuery({projectId:t,issueNumber:e?.number??0},{enabled:n&&!!e}),m=c?.issue,g=e?`kanban:issue-ratchet:${t}:${e.number}`:"";v.useEffect(()=>{if(!(!e||a?.ratchetEnabled===void 0)){try{const w=window.localStorage.getItem(g);if(w==="true"||w==="false"){l(w==="true");return}}catch{}l(a.ratchetEnabled)}},[g,a?.ratchetEnabled,e]);const y=Ce.workspace.create.useMutation({onSuccess:()=>{r(!1),i.workspace.listWithKanbanState.invalidate({projectId:t})}}),_=()=>{e&&y.mutate({type:"GITHUB_ISSUE",projectId:t,issueNumber:e.number,issueUrl:e.url,name:e.title,ratchetEnabled:o})},S=()=>{e&&window.open(e.url,"_blank","noopener,noreferrer")};return v.useEffect(()=>{n&&e&&f()},[e,n,f]),h.jsx(NO,{open:n,onOpenChange:r,children:h.jsx(lE,{side:"right",className:"w-full sm:max-w-2xl flex flex-col p-0",children:e?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[h.jsx(cE,{className:"pb-4",children:h.jsx("div",{className:"flex items-start justify-between gap-4",children:h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx(uE,{className:"text-xl leading-tight pr-8",children:e.title}),h.jsxs(dE,{className:"flex items-center gap-2 text-xs mt-2",children:[h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx(Mq,{className:"h-3 w-3 text-green-500"}),h.jsxs("span",{children:["#",e.number]})]}),h.jsx("span",{children:"•"}),h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx(Xq,{className:"h-3 w-3"}),e.author.login]}),h.jsx("span",{children:"•"}),h.jsx("span",{children:new Date(e.createdAt).toLocaleDateString()})]})]})})}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Description"}),d?h.jsxs("div",{className:"space-y-2",children:[h.jsx(ei,{className:"h-4 w-full"}),h.jsx(ei,{className:"h-4 w-3/4"}),h.jsx(ei,{className:"h-4 w-5/6"})]}):m?.body?h.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:h.jsx(Rh,{content:m.body})}):h.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No description provided."})]})]}),h.jsxs("div",{className:"border-t p-4 space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Z0,{enabled:o,state:"IDLE",className:"h-6 w-6 shrink-0",stopPropagation:!1,disabled:s||y.isPending,onToggle:w=>{l(w);try{window.localStorage.setItem(g,String(w))}catch{}}}),h.jsx("span",{className:"text-xs text-muted-foreground",children:o?"Ratcheting enabled":"Ratcheting disabled"})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(We,{onClick:S,variant:"outline",children:[h.jsx(Xw,{className:"h-4 w-4 mr-2"}),"Open in GitHub"]}),h.jsxs(We,{onClick:_,disabled:y.isPending||s,className:"flex-1",children:[h.jsx(pl,{className:"h-4 w-4 mr-2"}),y.isPending?"Starting...":"Start Issue"]})]})]})]}):h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("p",{className:"text-muted-foreground",children:"No issue selected"})})})})}function aht({isArchived:e,isWorking:t,status:n,errorMessage:r}){return e?h.jsxs(gn,{variant:"outline",className:"shrink-0 text-[10px] gap-1",children:[h.jsx(Kw,{className:"h-2.5 w-2.5"}),"Archived"]}):t?h.jsxs("span",{className:"flex items-center gap-1 text-xs text-brand shrink-0",children:[h.jsx("span",{className:"h-2 w-2 rounded-full bg-brand animate-pulse"}),"Working"]}):h.jsx(Mj,{status:n,errorMessage:r})}function sht({type:e}){return e==="plan_approval"?h.jsxs(gn,{variant:"outline",className:"text-[10px] gap-1 bg-amber-500/10 text-amber-700 dark:text-amber-400 border-amber-500/30",children:[h.jsx(jq,{className:"h-2.5 w-2.5"}),"Plan Approval Needed"]}):h.jsxs(gn,{variant:"outline",className:"text-[10px] gap-1 bg-blue-500/10 text-blue-700 dark:text-blue-400 border-blue-500/30",children:[h.jsx(Gq,{className:"h-2.5 w-2.5"}),"Question Waiting"]})}function oht({workspace:e,ratchetEnabled:t,isTogglePending:n,isArchived:r,onToggleRatcheting:i,showPR:a}){return h.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground min-w-0",children:[h.jsx(Z0,{enabled:t,state:e.ratchetState,animated:e.ratchetButtonAnimated??!1,className:"h-5 w-5 shrink-0",disabled:n||r||!i,stopPropagation:!0,onToggle:s=>{i?.(e.id,s)}}),e.branchName&&h.jsxs(h.Fragment,{children:[h.jsx(l0,{className:"h-3 w-3 shrink-0"}),h.jsx("span",{className:"font-mono truncate",children:e.branchName})]}),a&&h.jsxs("button",{type:"button",onClick:s=>{s.preventDefault(),s.stopPropagation(),window.open(e.prUrl,"_blank","noopener,noreferrer")},className:"ml-auto inline-flex items-center gap-1 text-muted-foreground hover:text-foreground",children:[h.jsx(Cp,{className:"h-3 w-3"}),h.jsxs("span",{children:["#",e.prNumber]})]})]})}function lht({workspace:e,projectSlug:t,onToggleRatcheting:n,isTogglePending:r=!1}){const i=!!(e.prState!=="NONE"&&e.prNumber&&e.prUrl),a=e.isArchived||e.status==="ARCHIVED",s=e.ratchetEnabled??!0,o=Ole({isWorking:e.isWorking,prUrl:e.prUrl??null,prState:e.prState??null,prCiStatus:e.prCiStatus??null,ratchetState:e.ratchetState??null});return h.jsx(Ar,{to:`/projects/${t}/workspaces/${e.id}`,children:h.jsxs(vr,{className:ne("cursor-pointer hover:border-primary/50 transition-colors overflow-hidden",e.isWorking&&"border-brand/50 bg-brand/5",a&&"opacity-60 border-dashed"),children:[h.jsx(pi,{className:"pb-3",children:h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsx(mi,{className:"text-sm font-medium leading-tight line-clamp-2",children:e.name}),h.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.runScriptStatus==="RUNNING"&&h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx("span",{children:h.jsx(pl,{className:"h-3 w-3 text-green-500 fill-green-500 animate-pulse"})})}),h.jsx(er,{children:"Dev server running"})]}),h.jsx(aht,{isArchived:a,isWorking:e.isWorking,status:e.status,errorMessage:e.initErrorMessage})]})]})}),h.jsxs(Yr,{className:"space-y-2",children:[h.jsx(oht,{workspace:e,ratchetEnabled:s,isTogglePending:r,isArchived:a,onToggleRatcheting:n,showPR:i}),o.ciState!=="NONE"&&h.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:h.jsx(Bj,{ciState:o.ciState,prState:e.prState,size:"sm"})}),e.pendingRequestType&&h.jsx("div",{className:"flex items-center gap-2",children:h.jsx(sht,{type:e.pendingRequestType})}),e.description&&h.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.description})]})]})})}const OW=[{id:"ISSUES",label:"GitHub Issues",description:"Issues assigned to you"},{id:"WORKING",label:"Working",description:"Agent is working"},{id:"WAITING",label:"Waiting",description:"Waiting for input"},{id:"DONE",label:"Done",description:"PR merged"}];function cht({column:e,workspaces:t,projectSlug:n,onToggleRatcheting:r,togglingWorkspaceId:i}){const a=t.length===0;return h.jsxs("div",{className:"flex flex-col w-full md:w-[380px] md:shrink-0 md:h-full",children:[h.jsx("div",{className:"flex items-center justify-between px-2 py-3 bg-muted/30 rounded-t-lg",children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h3",{className:"font-semibold text-sm",children:e.label}),h.jsx(gn,{variant:"secondary",className:"h-5 min-w-5 justify-center text-xs",children:t.length})]})}),h.jsx("div",{className:"flex flex-col gap-3 flex-1 overflow-y-auto p-3 min-h-0 rounded-b-lg bg-muted/30",children:a?h.jsx("div",{className:"flex items-center justify-center h-[60px] md:h-[150px] text-muted-foreground text-sm",children:e.description}):t.map(s=>h.jsx("div",{className:"shrink-0",children:h.jsx(lht,{workspace:s,projectSlug:n,onToggleRatcheting:r,isTogglePending:i===s.id})},s.id))})]})}const fde=v.createContext(null);function pde(){const e=v.useContext(fde);if(!e)throw new Error("useKanban must be used within a KanbanProvider");return e}function uht({projectId:e,projectSlug:t,children:n}){const r=Ce.useUtils(),{data:i,isLoading:a,isError:s,error:o,refetch:l}=Ce.workspace.listWithKanbanState.useQuery({projectId:e},{refetchInterval:3e4,staleTime:25e3}),{data:c,isLoading:d,refetch:f}=Ce.github.listIssuesForProject.useQuery({projectId:e},{refetchInterval:6e4,staleTime:3e4}),m=Ce.workspace.syncAllPRStatuses.useMutation(),g=Ce.workspace.toggleRatcheting.useMutation(),[y,_]=v.useState(null),S=async()=>{await m.mutateAsync({projectId:e}),l(),f()},w=async(A,O)=>{_(A);try{await g.mutateAsync({workspaceId:A,enabled:O}),await Promise.all([l(),r.workspace.getProjectSummaryState.invalidate({projectId:e}),r.workspace.get.invalidate({id:A})])}finally{_(null)}},E=()=>{l(),f()},T=v.useMemo(()=>{if(!c?.issues)return;if(!i)return c.issues;const A=new Set(i.map(O=>O.githubIssueNumber).filter(O=>O!==null));return c.issues.filter(O=>!A.has(O.number))},[c?.issues,i]);return h.jsx(fde.Provider,{value:{projectId:e,projectSlug:t,workspaces:i,issues:T,isLoading:a||d,isError:s,error:o?{message:o.message}:null,refetch:E,syncAndRefetch:S,isSyncing:m.isPending,toggleWorkspaceRatcheting:w,togglingWorkspaceId:y},children:n})}function dht(){const{syncAndRefetch:e,isSyncing:t}=pde();return h.jsx(We,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>e(),disabled:t,children:h.jsx(dc,{className:ne("h-4 w-4",t&&"animate-spin")})})}function hht(){const{projectId:e,projectSlug:t,workspaces:n,issues:r,isLoading:i,isError:a,error:s,refetch:o,toggleWorkspaceRatcheting:l,togglingWorkspaceId:c}=pde(),d=v.useMemo(()=>{const f={WORKING:[],WAITING:[],DONE:[]};if(n)for(const m of n){const g=m.kanbanColumn;g in f&&f[g].push(m)}return f},[n]);return i?h.jsx("div",{className:"flex flex-col md:flex-row gap-3 md:gap-4 pb-4 h-full overflow-y-auto md:overflow-y-hidden md:overflow-x-auto",children:OW.map(f=>h.jsxs("div",{className:"flex flex-col w-full md:w-[380px] md:shrink-0 md:h-full",children:[h.jsx(ei,{className:"h-10 w-full rounded-t-lg rounded-b-none"}),h.jsx(ei,{className:"flex-1 w-full rounded-b-lg rounded-t-none"})]},f.id))}):a?h.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[h.jsxs("p",{className:"text-destructive mb-4",children:["Failed to load workspaces: ",s?.message??"Unknown error"]}),h.jsxs(We,{variant:"outline",onClick:()=>o(),children:[h.jsx(dc,{className:"h-4 w-4 mr-2"}),"Retry"]})]}):h.jsx("div",{className:"flex flex-col md:flex-row gap-3 md:gap-4 pb-4 h-full overflow-y-auto md:overflow-y-hidden md:overflow-x-auto",children:OW.map(f=>{if(f.id==="ISSUES")return h.jsx(fht,{column:f,issues:r??[],projectId:e},f.id);const m=d[f.id]??[];return h.jsx(cht,{column:f,workspaces:m,projectSlug:t,onToggleRatcheting:l,togglingWorkspaceId:c},f.id)})})}function fht({column:e,issues:t,projectId:n}){const r=t.length===0,[i,a]=v.useState(null),[s,o]=v.useState(!1),l=d=>{a(d),o(!0)},c=d=>{o(d),d||a(null)};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex flex-col w-full md:w-[380px] md:shrink-0 md:h-full",children:[h.jsx("div",{className:"flex items-center justify-between px-2 py-3 bg-muted/30 rounded-t-lg",children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h3",{className:"font-semibold text-sm",children:e.label}),h.jsx(gn,{variant:"secondary",className:"h-5 min-w-5 justify-center text-xs",children:t.length})]})}),h.jsx("div",{className:"flex flex-col gap-3 flex-1 overflow-y-auto p-3 min-h-0 rounded-b-lg bg-muted/30",children:r?h.jsx("div",{className:"flex items-center justify-center h-[60px] md:h-[150px] text-muted-foreground text-sm",children:e.description}):t.map(d=>h.jsx("div",{className:"shrink-0",children:h.jsx(rht,{issue:d,projectId:n,onClick:()=>l(d)})},d.number))})]}),h.jsx(iht,{issue:i,projectId:n,open:s,onOpenChange:c})]})}function mde({onClick:e}){return g0()?null:h.jsxs(We,{variant:"outline",size:"sm",onClick:e,children:[h.jsx(l0,{className:"h-4 w-4 mr-2"}),"Resume branch"]})}var ed="ToggleGroup",[gde]=Ai(ed,[Zu]),bde=Zu(),dF=he.forwardRef((e,t)=>{const{type:n,...r}=e;if(n==="single"){const i=r;return h.jsx(pht,{...i,ref:t})}if(n==="multiple"){const i=r;return h.jsx(mht,{...i,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${ed}\``)});dF.displayName=ed;var[yde,vde]=gde(ed),pht=he.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[s,o]=Na({prop:n,defaultProp:r??"",onChange:i,caller:ed});return h.jsx(yde,{scope:e.__scopeToggleGroup,type:"single",value:he.useMemo(()=>s?[s]:[],[s]),onItemActivate:o,onItemDeactivate:he.useCallback(()=>o(""),[o]),children:h.jsx(_de,{...a,ref:t})})}),mht=he.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[s,o]=Na({prop:n,defaultProp:r??[],onChange:i,caller:ed}),l=he.useCallback(d=>o((f=[])=>[...f,d]),[o]),c=he.useCallback(d=>o((f=[])=>f.filter(m=>m!==d)),[o]);return h.jsx(yde,{scope:e.__scopeToggleGroup,type:"multiple",value:s,onItemActivate:l,onItemDeactivate:c,children:h.jsx(_de,{...a,ref:t})})});dF.displayName=ed;var[ght,bht]=gde(ed),_de=he.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:s,loop:o=!0,...l}=e,c=bde(n),d=wh(s),f={role:"group",dir:d,...l};return h.jsx(ght,{scope:n,rovingFocus:i,disabled:r,children:i?h.jsx(M1,{asChild:!0,...c,orientation:a,dir:d,loop:o,children:h.jsx(yt.div,{...f,ref:t})}):h.jsx(yt.div,{...f,ref:t})})}),Lw="ToggleGroupItem",xde=he.forwardRef((e,t)=>{const n=vde(Lw,e.__scopeToggleGroup),r=bht(Lw,e.__scopeToggleGroup),i=bde(e.__scopeToggleGroup),a=n.value.includes(e.value),s=r.disabled||e.disabled,o={...e,pressed:a,disabled:s},l=he.useRef(null);return r.rovingFocus?h.jsx(L1,{asChild:!0,...i,focusable:!s,active:a,ref:l,children:h.jsx(DW,{...o,ref:t})}):h.jsx(DW,{...o,ref:t})});xde.displayName=Lw;var DW=he.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:r,...i}=e,a=vde(Lw,n),s={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},o=a.type==="single"?s:void 0;return h.jsx(lF,{...o,...i,ref:t,onPressedChange:l=>{l?a.onItemActivate(r):a.onItemDeactivate(r)}})}),Sde=dF,wde=xde;const Ede=v.createContext({size:"default",variant:"default"}),Cde=v.forwardRef(({className:e,variant:t,size:n,children:r,...i},a)=>h.jsx(Sde,{ref:a,className:ne("flex items-center justify-center gap-1",e),...i,children:h.jsx(Ede.Provider,{value:{variant:t,size:n},children:r})}));Cde.displayName=Sde.displayName;const OI=v.forwardRef(({className:e,children:t,variant:n,size:r,...i},a)=>{const s=v.useContext(Ede);return h.jsx(wde,{ref:a,className:ne(Hue({variant:s.variant||n,size:s.size||r}),e),...i,children:t})});OI.displayName=wde.displayName;function Tde({viewMode:e,onViewModeChange:t}){return h.jsxs(Cde,{type:"single",value:e,onValueChange:n=>n&&t(n),size:"sm",children:[h.jsx(OI,{value:"board","aria-label":"Board view",children:h.jsx(Hq,{className:"h-4 w-4"})}),h.jsx(OI,{value:"list","aria-label":"List view",children:h.jsx(w_e,{className:"h-4 w-4"})})]})}function yht({projectId:e,slug:t,viewMode:n,onViewModeChange:r,onResumeOpen:i,onCreateWorkspace:a,isCreatingWorkspace:s,resumeDialog:o}){return h.jsx(uht,{projectId:e,projectSlug:t,children:h.jsxs("div",{className:"flex flex-col h-full p-3 md:p-6 gap-3 md:gap-4",children:[h.jsxs(X1,{title:"Workspaces",children:[h.jsx(dht,{}),h.jsx(Tde,{viewMode:n,onViewModeChange:r}),h.jsx(mde,{onClick:i}),h.jsx(II,{onClick:a,isCreating:s})]}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(hht,{})}),o]})})}function vht({className:e,...t}){return h.jsx("div",{"data-slot":"empty",className:ne("flex min-w-0 flex-1 flex-col items-center justify-center gap-3 text-balance rounded-lg border-dashed p-3 text-center md:p-6",e),...t})}function _ht({className:e,...t}){return h.jsx("div",{"data-slot":"empty-header",className:ne("flex max-w-sm flex-col items-center gap-2 text-center",e),...t})}function xht({className:e,...t}){return h.jsx("div",{"data-slot":"empty-title",className:ne("text-lg font-medium tracking-tight",e),...t})}function Sht({className:e,...t}){return h.jsx("div",{"data-slot":"empty-description",className:ne("text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4",e),...t})}function kde({ciStatus:e,prUrl:t,size:n="sm"}){if(e!=="FAILURE")return null;const r=n==="sm"?"h-3.5 w-3.5":"h-4 w-4";return h.jsx(Uu,{children:h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx("span",{className:"inline-flex items-center",children:h.jsx(hc,{className:`${r} text-destructive`})})}),h.jsxs(er,{children:[h.jsx("p",{className:"text-sm",children:"CI checks are failing"}),t&&h.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Check the PR for details"})]})]})})}const wht=["NEW","PROVISIONING","READY","FAILED","ARCHIVED"];function Eht({workspace:e,slug:t}){return h.jsx(Ar,{to:`/projects/${t}/workspaces/${e.id}`,className:"block",children:h.jsx(vr,{className:"p-3 hover:border-primary/50 transition-colors",children:h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"font-medium text-sm truncate",children:e.name}),h.jsx(kde,{ciStatus:e.prCiStatus,prUrl:e.prUrl,size:"sm"})]}),e.branchName&&h.jsxs("div",{className:"flex items-center gap-1 mt-1 text-xs text-muted-foreground font-mono truncate",children:[h.jsx(l0,{className:"h-3 w-3 shrink-0"}),h.jsx("span",{className:"truncate",children:e.branchName})]})]}),h.jsx(Mj,{status:e.status,errorMessage:e.initErrorMessage})]})})})}function Cht({workspaces:e,isLoading:t,slug:n,statusFilter:r,onStatusFilterChange:i,viewMode:a,onViewModeChange:s,onResumeOpen:o,onCreateWorkspace:l,isCreatingWorkspace:c,resumeDialog:d}){const f=g0();return h.jsxs("div",{className:"space-y-4 p-3 md:p-6",children:[h.jsxs(X1,{title:"Workspaces",children:[h.jsxs(mc,{value:r,onValueChange:i,children:[h.jsx(yl,{className:"w-[150px]",children:h.jsx(Nu,{placeholder:"All Statuses"})}),h.jsxs(vl,{children:[h.jsx(sr,{value:"all",children:"All Statuses"}),wht.map(m=>h.jsx(sr,{value:m,children:Gnt(m)},m))]})]}),h.jsx(Tde,{viewMode:a,onViewModeChange:s}),h.jsx(mde,{onClick:o}),h.jsx(II,{onClick:l,isCreating:c})]}),t?h.jsx(vr,{children:h.jsx(Fh,{message:"Loading workspaces..."})}):!e||e.length===0?h.jsx(vr,{children:h.jsxs(vht,{className:"py-12",children:[h.jsxs(_ht,{children:[h.jsx(xht,{children:"No workspaces found"}),h.jsx(Sht,{children:"Get started by creating your first workspace."})]}),h.jsx(II,{onClick:l,isCreating:c,children:"Create your first workspace"})]})}):f?h.jsx("div",{className:"flex flex-col gap-2",children:e.map(m=>h.jsx(Eht,{workspace:m,slug:n},m.id))}):h.jsx(vr,{children:h.jsxs(Wp,{children:[h.jsx(Gp,{children:h.jsxs(ys,{children:[h.jsx(Jn,{children:"Name"}),h.jsx(Jn,{children:"Status"}),h.jsx(Jn,{children:"Sessions"}),h.jsx(Jn,{children:"Branch"}),h.jsx(Jn,{children:"Created"}),h.jsx(Jn,{className:"text-right",children:"Actions"})]})}),h.jsx(qp,{children:e.map(m=>h.jsxs(ys,{children:[h.jsxs(Wn,{children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Ar,{to:`/projects/${n}/workspaces/${m.id}`,className:"font-medium hover:underline",children:m.name}),h.jsx(kde,{ciStatus:m.prCiStatus,prUrl:m.prUrl,size:"sm"})]}),m.description&&h.jsx("p",{className:"text-sm text-muted-foreground truncate max-w-md",children:m.description.length>100?`${m.description.slice(0,100)}...`:m.description})]}),h.jsxs(Wn,{children:[h.jsx(Mj,{status:m.status,errorMessage:m.initErrorMessage}),m.status==="READY"&&h.jsx("span",{className:"text-xs text-muted-foreground",children:"Ready"}),m.status==="ARCHIVED"&&h.jsx("span",{className:"text-xs text-muted-foreground",children:"Archived"})]}),h.jsxs(Wn,{className:"text-muted-foreground",children:[m.agentSessions?.length??0," sessions"]}),h.jsx(Wn,{className:"text-muted-foreground font-mono text-sm",children:m.branchName||"-"}),h.jsx(Wn,{className:"text-muted-foreground",children:new Date(m.createdAt).toLocaleDateString()}),h.jsx(Wn,{className:"text-right",children:h.jsx(We,{variant:"ghost",size:"sm",asChild:!0,children:h.jsx(Ar,{to:`/projects/${n}/workspaces/${m.id}`,children:"View"})})})]},m.id))})]})}),d]})}function Tht(e,t){const n=e.trim();if(!n)return Pj(t);if(!t.includes(n))return n;let r=1,i=`${n}-${r}`;for(;t.includes(i);)r+=1,i=`${n}-${r}`;return i}function kht(){const{slug:e=""}=tm(),t=to(),[n,r]=v.useState("all"),[i,a]=v.useState("board"),[s,o]=v.useState(!1),{data:l}=Ce.project.getBySlug.useQuery({slug:e}),{handleCreate:c,isCreating:d,existingNames:f}=Rle(l?.id,e),m=()=>{c().catch(()=>{})},g=Ce.useUtils(),y=Ce.workspace.create.useMutation(),{data:_,isLoading:S}=Ce.project.listBranches.useQuery({projectId:l?.id??""},{enabled:s&&!!l?.id}),{data:w,isLoading:E}=Ce.workspace.list.useQuery({projectId:l?.id??"",status:n!=="all"?n:void 0},{enabled:!!l?.id&&i==="list",refetchInterval:6e4,staleTime:5e4});if(!l)return h.jsx(Fh,{message:"Loading project..."});const T=_?.branches??[],A=async I=>{if(!l?.id||y.isPending)return;const N=Tht(I.displayName,f);try{const D=await y.mutateAsync({type:"RESUME_BRANCH",projectId:l.id,branchName:I.name,name:N});wdt(D.id),g.workspace.list.invalidate({projectId:l.id}),g.workspace.getProjectSummaryState.invalidate({projectId:l.id}),o(!1),t(`/projects/${e}/workspaces/${D.id}`)}catch(D){const F=D instanceof Error?D.message:"Unknown error";Qt.error(`Failed to resume branch: ${F}`)}},O=h.jsx(nht,{open:s,onOpenChange:o,branches:T,isLoading:S,isSubmitting:y.isPending,onSelectBranch:A});return i==="board"?h.jsx(yht,{projectId:l.id,slug:e,viewMode:i,onViewModeChange:a,onResumeOpen:()=>o(!0),onCreateWorkspace:m,isCreatingWorkspace:d,resumeDialog:O}):h.jsx(Cht,{workspaces:w,isLoading:E,slug:e,statusFilter:n,onStatusFilterChange:r,viewMode:i,onViewModeChange:a,onResumeOpen:()=>o(!0),onCreateWorkspace:m,isCreatingWorkspace:d,resumeDialog:O})}function Nht(){const{slug:e=""}=tm(),t=to(),[n,r]=v.useState(""),[i,a]=v.useState(""),[s,o]=v.useState(""),[l,c]=v.useState(""),{data:d}=Ce.project.getBySlug.useQuery({slug:e}),{data:f}=Ce.workspace.getFactoryConfig.useQuery({projectId:d?.id??""},{enabled:!!d?.id}),m=Ce.useUtils(),g=Ce.workspace.create.useMutation({onSuccess:_=>{m.workspace.get.setData({id:_.id},S=>S||Lj(_)),t(`/projects/${e}/workspaces/${_.id}`)},onError:_=>{c(_.message)}}),y=_=>{if(_.preventDefault(),c(""),!d?.id){c("Project not found");return}if(!n.trim()){c("Name is required");return}g.mutate({type:"MANUAL",projectId:d.id,name:n,description:i||void 0,branchName:s||void 0})};return d?h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx(We,{variant:"ghost",size:"icon",asChild:!0,children:h.jsx(Ar,{to:`/projects/${e}/workspaces`,children:h.jsx(aO,{className:"h-5 w-5"})})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Create New Workspace"}),h.jsx("p",{className:"text-muted-foreground mt-1",children:d.name})]})]}),f&&h.jsx(Yle,{factoryConfig:f,variant:"alert"}),h.jsx(vr,{children:h.jsx(Yr,{className:"pt-6",children:h.jsxs("form",{onSubmit:y,className:"space-y-4",children:[l&&h.jsx(av,{variant:"destructive",children:h.jsx(sv,{children:l})}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs(Gr,{htmlFor:"name",children:["Name ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(vo,{id:"name",value:n,onChange:_=>r(_.target.value),placeholder:"E.g., Feature Development",autoFocus:!0})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Gr,{htmlFor:"description",children:"Description"}),h.jsx(ym,{id:"description",value:i,onChange:_=>a(_.target.value),rows:3,placeholder:"Brief description of what this workspace is for"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Gr,{htmlFor:"branchName",children:"Branch Name"}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Git branch for this workspace (optional)"}),h.jsx(vo,{id:"branchName",value:s,onChange:_=>o(_.target.value),placeholder:"E.g., feature/my-feature",className:"font-mono"})]}),h.jsxs("div",{className:"flex justify-end gap-4",children:[h.jsx(We,{variant:"outline",asChild:!0,disabled:g.isPending,children:h.jsx(Ar,{to:`/projects/${e}/workspaces`,children:"Cancel"})}),h.jsxs(We,{type:"submit",disabled:g.isPending,children:[g.isPending&&h.jsx(Du,{className:"mr-2 h-4 w-4"}),g.isPending?"Creating...":"Create Workspace"]})]})]})})})]}):h.jsx(Fh,{message:"Loading..."})}function Aht(e){const t=String(e),n=[];return{toOffset:i,toPoint:r};function r(a){if(typeof a=="number"&&a>-1&&a<=t.length){let s=0;for(;;){let o=n[s];if(o===void 0){const l=MW(t,n[s-1]);o=l===-1?t.length+1:l+1,n[s]=o}if(o>a)return{line:s+1,column:a-(s>0?n[s-1]:0)+1,offset:a};s++}}}function i(a){if(a&&typeof a.line=="number"&&typeof a.column=="number"&&!Number.isNaN(a.line)&&!Number.isNaN(a.column)){for(;n.length<a.line;){const o=n[n.length-1],l=MW(t,o),c=l===-1?t.length+1:l+1;if(o===c)break;n.push(c)}const s=(a.line>1?n[a.line-2]:0)+a.column-1;if(s<n[a.line-1])return s}}}function MW(e,t){const n=e.indexOf("\r",t),r=e.indexOf(`
|
|
446
|
+
`)}function ect(e,t){const n=["plan","markdown","text","content","value","message"];for(const r of n){if(!(r in e))continue;const i=Ky(e[r],t+1);if(i)return i}return null}function tct(e){const t=Reflect.get(e,"type");if(t!=="text"&&t!=="markdown")return null;const n=Reflect.get(e,"text");return typeof n=="string"&&n.trim().length>0?n:null}function nct(e,t){const n=ect(e,t);if(n)return n;const r=tct(e);if(r)return r;const i=Gue(Object.values(e),t);return Zlt(i)}function Ky(e,t){return t>Ylt?null:typeof e=="string"?Qlt(e,t):Array.isArray(e)?Jlt(e,t):typeof e=="object"&&e!==null?nct(e,t):null}function kW(e){return Ky(e,0)}const que="ff:plan-view-mode",bA="rendered";function rct(e){return e==="rendered"||e==="raw"}function ict(){if(typeof window>"u")return bA;try{const e=window.localStorage.getItem(que);if(e&&rct(e))return e}catch{return bA}return bA}function act(e){if(!(typeof window>"u"))try{window.localStorage.setItem(que,e)}catch{}}function sct(){const[e,t]=v.useState(()=>ict());return v.useEffect(()=>{act(e)},[e]),[e,t]}function Vue(e){if("command"in e&&typeof e.command=="string")return e.command;if("file_path"in e&&typeof e.file_path=="string")return e.file_path;if("pattern"in e&&typeof e.pattern=="string")return e.pattern;const t=Object.keys(e);if(t.length===0)return"No parameters";const n=t[0];if(!n)return"No parameters";const r=e[n];return typeof r=="string"&&r.length<100?r:`${t.length} parameter${t.length===1?"":"s"}`}function oct(e){const t=kW(e.planContent);if(t)return t;const n=kW(e.toolInput.plan);if(n)return n;if(typeof e.planContent=="string"&&e.planContent.length>0)return e.planContent;if(typeof e.toolInput.plan=="string"&&e.toolInput.plan.length>0)return e.toolInput.plan;if(typeof e.toolInput.plan=="object"&&e.toolInput.plan!==null)try{return JSON.stringify(e.toolInput.plan,null,2)}catch{return String(e.toolInput.plan)}return null}function lct({value:e,onChange:t}){return h.jsx("div",{className:"flex items-center rounded-md border bg-background p-0.5",children:["rendered","raw"].map(n=>h.jsx("button",{type:"button","aria-pressed":e===n,onClick:()=>t(n),className:ne("text-[11px] px-2 py-1 rounded-sm transition-colors",e===n?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:n==="rendered"?"Rendered":"Raw"},n))})}function cct({permission:e,onApprove:t}){const n=v.useRef(null),[r,i]=v.useState(!0),[a,s]=sct(),o=e?.requestId;if(v.useEffect(()=>{if(!o)return;const m=setTimeout(()=>{n.current?.focus()},100);return()=>clearTimeout(m)},[o]),!e)return null;const{requestId:l}=e,c=oct(e),d=()=>{t(l,!0)},f=()=>{t(l,!1)};return h.jsx("div",{className:"border-b bg-muted/50 p-3",role:"alertdialog","aria-label":"Plan approval request",children:h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(o0,{className:"h-5 w-5 shrink-0 text-blue-500","aria-hidden":"true"}),h.jsx("span",{className:"text-sm font-medium",children:"Review Plan"})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[c&&h.jsx(lct,{value:a,onChange:s}),h.jsx("button",{type:"button",onClick:()=>i(!r),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:r?"Collapse":"Expand"})]})]}),r&&c&&h.jsx("div",{className:"bg-background rounded-md border overflow-hidden",children:h.jsx("div",{className:"max-h-[70vh] overflow-auto",children:a==="rendered"?h.jsx("div",{className:"p-3",children:h.jsx(Rh,{content:c})}):h.jsx("pre",{className:"text-xs p-3 whitespace-pre-wrap font-mono",children:c})})}),!c&&h.jsx("div",{className:"text-xs text-muted-foreground italic",children:"No plan content available"}),h.jsx("p",{className:"text-[11px] text-muted-foreground",children:"You can also type feedback in the chat input below to request changes."}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsxs(We,{variant:"outline",size:"sm",onClick:f,className:"gap-1.5",children:[h.jsx(yS,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Reject Plan"]}),h.jsxs(We,{ref:n,size:"sm",onClick:d,className:"gap-1.5",children:[h.jsx(Ib,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Approve Plan"]})]})]})})}function uct({permission:e,onApprove:t}){const n=v.useRef(null),r=e?.requestId;if(v.useEffect(()=>{if(!r)return;const g=setTimeout(()=>n.current?.focus(),100);return()=>clearTimeout(g)},[r]),!e?.acpOptions)return null;const{requestId:i,toolName:a,toolInput:s,acpOptions:o}=e,l=Vue(s),c=o.filter(g=>g.kind.startsWith("allow")),d=o.filter(g=>g.kind.startsWith("reject")),f=(g,y)=>{const _=y.startsWith("allow");t(i,_,g)},m=g=>{switch(g){case"allow_once":return{variant:"outline",icon:Ib};case"allow_always":return{variant:"default",icon:Ib};case"reject_once":return{variant:"outline",icon:yS};case"reject_always":return{variant:"destructive",icon:yS};default:return{variant:"outline",icon:Ib}}};return h.jsxs(dC,{icon:h.jsx(El,{className:"h-5 w-5 text-muted-foreground","aria-hidden":"true"}),label:`Permission request for ${a}`,actions:h.jsx("div",{className:"flex flex-wrap gap-2",children:[...c,...d].map((g,y)=>{const _=m(g.kind),S=_.icon;return h.jsxs(We,{ref:y===0?n:void 0,variant:_.variant,size:"sm",onClick:()=>f(g.optionId,g.kind),className:"gap-1.5",children:[h.jsx(S,{className:"h-3.5 w-3.5","aria-hidden":"true"}),g.name]},g.optionId)})}),children:[h.jsxs("div",{className:"text-sm font-medium",children:["Permission: ",a]}),h.jsx("div",{className:"text-xs text-muted-foreground mt-1 font-mono truncate",title:l,children:l})]})}function dct({permission:e,onApprove:t}){const n=v.useRef(null),r=e?.requestId;if(v.useEffect(()=>{if(!r)return;const d=setTimeout(()=>{n.current?.focus()},100);return()=>clearTimeout(d)},[r]),!e)return null;if(e.acpOptions&&e.acpOptions.length>0)return h.jsx(uct,{permission:e,onApprove:t});if(e.toolName==="ExitPlanMode")return h.jsx(cct,{permission:e,onApprove:t});const{requestId:i,toolName:a,toolInput:s}=e,o=Vue(s),l=()=>{t(i,!0)},c=()=>{t(i,!1)};return h.jsxs(dC,{icon:h.jsx(El,{className:"h-5 w-5 text-muted-foreground","aria-hidden":"true"}),label:`Permission request for ${a}`,actions:h.jsxs(h.Fragment,{children:[h.jsxs(We,{variant:"outline",size:"sm",onClick:c,className:"gap-1.5",children:[h.jsx(yS,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Deny"]}),h.jsxs(We,{ref:n,size:"sm",onClick:l,className:"gap-1.5",children:[h.jsx(Ib,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Allow"]})]}),children:[h.jsxs("div",{className:"text-sm font-medium",children:["Permission: ",a]}),h.jsx("div",{className:"text-xs text-muted-foreground mt-1 font-mono truncate",title:o,children:o})]})}const or="__other__";function Yue(e){return e?.trim()??""}function NI(e,t,n){const r=Yue(n);return e.multiSelect?!Array.isArray(t)||t.length===0?!1:t.includes(or)?r.length>0:!0:typeof t!="string"||t.length===0?!1:t===or?r.length>0:!0}function hct(e,t,n){const r=Yue(n);return t===void 0?e.multiSelect?[]:"":e.multiSelect&&Array.isArray(t)?t.includes(or)?r?t.map(i=>i===or?r:i):t.filter(i=>i!==or):t:!e.multiSelect&&t===or&&r?r:!e.multiSelect&&t===or?"":t}function fct({question:e,requestId:t,answers:n,otherTexts:r,onAnswerChange:i,onOtherTextChange:a,onSubmit:s,isComplete:o}){return h.jsx(dC,{icon:h.jsx(Lq,{className:"h-5 w-5 text-blue-500","aria-hidden":"true"}),role:"form",label:"Question from Claude",actions:h.jsx("div",{className:"self-end",children:h.jsx(We,{size:"sm",onClick:s,disabled:!o,children:"Submit"})}),children:h.jsx("div",{className:"space-y-3",children:e.multiSelect?h.jsx(Xue,{question:e,index:0,value:n[0]??[],onChange:l=>i(0,l),otherText:r[0]??"",onOtherTextChange:l=>a(0,l),requestId:t}):h.jsx(Kue,{question:e,index:0,value:n[0]??"",onChange:l=>i(0,l),otherText:r[0]??"",onOtherTextChange:l=>a(0,l),requestId:t})})})}function pct({question:e,requestId:t,currentIndex:n,answers:r,otherTexts:i,onAnswerChange:a,onOtherTextChange:s,onSubmit:o,onIndexChange:l,isComplete:c,isCurrentAnswered:d}){const f=e.questions.length,m=e.questions[n],g=n===f-1,y=n===0;return h.jsxs(dC,{icon:h.jsx(Lq,{className:"h-5 w-5 text-blue-500","aria-hidden":"true"}),role:"form",label:"Questions from Claude",actions:h.jsxs("div",{className:"self-end flex items-center gap-1",children:[h.jsx(We,{variant:"ghost",size:"sm",onClick:()=>l(n-1),disabled:y,className:"h-8 w-8 p-0","aria-label":"Previous question",children:h.jsx(Dq,{className:"h-4 w-4"})}),g?h.jsx(We,{size:"sm",onClick:o,disabled:!c,children:"Submit"}):h.jsx(We,{size:"sm",onClick:()=>l(n+1),disabled:!d,children:"Next"}),!g&&h.jsx(We,{variant:"ghost",size:"sm",onClick:()=>l(n+1),className:"h-8 w-8 p-0","aria-label":"Next question",children:h.jsx(xs,{className:"h-4 w-4"})})]}),children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsxs("span",{className:"text-xs text-muted-foreground",children:["Question ",n+1," of ",f]}),h.jsx("div",{className:"flex gap-1",children:e.questions.map((_,S)=>{const w=NI(_,r[S],i[S]??"");return h.jsx("button",{type:"button",onClick:()=>l(S),className:ne("w-2 h-2 rounded-full transition-colors",S===n?"bg-primary":w?"bg-primary/50":"bg-muted-foreground/30"),"aria-label":`Go to question ${S+1}`},`dot-${t}-${S}-${_.question}`)})})]}),m?m.multiSelect?h.jsx(Xue,{question:m,index:n,value:r[n]??[],onChange:_=>a(n,_),otherText:i[n]??"",onOtherTextChange:_=>s(n,_),requestId:t}):h.jsx(Kue,{question:m,index:n,value:r[n]??"",onChange:_=>a(n,_),otherText:i[n]??"",onOtherTextChange:_=>s(n,_),requestId:t}):null]})}function Kue({question:e,index:t,value:n,onChange:r,otherText:i,onOtherTextChange:a,requestId:s}){const o=typeof n=="string"?n:"",l=`${s}-${t}`;return h.jsxs("div",{className:"space-y-1.5",children:[e.header&&h.jsx("h4",{className:"text-xs font-medium text-muted-foreground",children:e.header}),h.jsx("p",{className:"text-sm font-medium",children:e.question}),h.jsxs(Qj,{value:o,onValueChange:r,className:"space-y-1.5",children:[e.options.map(c=>h.jsxs("label",{htmlFor:`question-${l}-option-${c.label}`,className:ne("flex items-center gap-2 p-1.5 rounded-md border transition-colors cursor-pointer hover:bg-background",o===c.label&&"border-primary bg-primary/5"),children:[h.jsx(Vy,{value:c.label,id:`question-${l}-option-${c.label}`,className:"shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:"text-sm",children:c.label}),c.description&&h.jsx("p",{className:"text-xs text-muted-foreground truncate",children:c.description})]})]},`${t}-${c.label}`)),h.jsxs("label",{htmlFor:`question-${l}-option-other`,className:ne("flex items-start gap-2 p-1.5 rounded-md border transition-colors cursor-pointer hover:bg-background",o===or&&"border-primary bg-primary/5"),children:[h.jsx(Vy,{value:or,id:`question-${l}-option-other`,className:"shrink-0 mt-1"}),h.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[h.jsx("span",{className:"text-sm font-medium",children:"Other"}),h.jsx(ym,{value:i,"aria-label":"Other response",onFocus:()=>{o!==or&&r(or)},onClick:()=>{o!==or&&r(or)},onBlur:()=>{o===or&&i.trim().length===0&&r("")},onChange:c=>{const d=c.target.value;a(d),d.trim().length>0&&o!==or&&r(or)},placeholder:"Type your response...",className:"min-h-[42px] text-sm py-1.5"})]})]})]})]})}function Xue({question:e,index:t,value:n,onChange:r,otherText:i,onOtherTextChange:a,requestId:s}){const o=Array.isArray(n)?n:[],l=`${s}-${t}`,c=v.useCallback((d,f)=>{r(f?[...o,d]:o.filter(m=>m!==d))},[o,r]);return h.jsxs("div",{className:"space-y-1.5",children:[e.header&&h.jsx("h4",{className:"text-xs font-medium text-muted-foreground",children:e.header}),h.jsx("p",{className:"text-sm font-medium",children:e.question}),h.jsxs("div",{className:"space-y-1.5",children:[e.options.map(d=>{const f=o.includes(d.label);return h.jsxs("label",{htmlFor:`question-${l}-option-${d.label}`,className:ne("flex items-center gap-2 p-1.5 rounded-md border transition-colors cursor-pointer hover:bg-background",f&&"border-primary bg-primary/5"),children:[h.jsx(LS,{id:`question-${l}-option-${d.label}`,checked:f,onCheckedChange:m=>c(d.label,m===!0),className:"shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:"text-sm",children:d.label}),d.description&&h.jsx("p",{className:"text-xs text-muted-foreground truncate",children:d.description})]})]},`${t}-${d.label}`)}),h.jsxs("label",{htmlFor:`question-${l}-option-other`,className:ne("flex items-start gap-2 p-1.5 rounded-md border transition-colors cursor-pointer hover:bg-background",o.includes(or)&&"border-primary bg-primary/5"),children:[h.jsx(LS,{id:`question-${l}-option-other`,checked:o.includes(or),onCheckedChange:d=>{d===!0?r([...o,or]):(a(""),r(o.filter(m=>m!==or)))},className:"shrink-0 mt-1"}),h.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[h.jsx("span",{className:"text-sm font-medium",children:"Other"}),h.jsx(ym,{value:i,"aria-label":"Other response",onFocus:()=>{o.includes(or)||r([...o,or])},onClick:()=>{o.includes(or)||r([...o,or])},onBlur:()=>{i.trim().length===0&&o.includes(or)&&r(o.filter(d=>d!==or))},onChange:d=>{const f=d.target.value;a(f),f.trim().length>0&&!o.includes(or)&&r([...o,or])},placeholder:"Type your response...",className:"min-h-[42px] text-sm py-1.5"})]})]})]})]})}function mct({question:e,onAnswer:t}){const[n,r]=v.useState({}),[i,a]=v.useState(0),[s,o]=v.useState({}),l=v.useRef(null),c=e?.requestId;v.useEffect(()=>{c&&(r({}),a(0),o({}))},[c]),v.useEffect(()=>{if(!c)return;const w=setTimeout(()=>{l.current?.querySelector('input, button, textarea, [tabindex]:not([tabindex="-1"])')?.focus()},100);return()=>clearTimeout(w)},[c]);const d=v.useCallback((w,E)=>{r(T=>({...T,[w]:E}))},[]),f=v.useCallback((w,E)=>{o(T=>({...T,[w]:E}))},[]),m=v.useCallback(()=>{if(!e)return;const w={};e.questions.forEach((E,T)=>{w[E.question]=hct(E,n[T],s[T]??"")}),t(e.requestId,w),r({}),a(0),o({})},[e,n,s,t]),g=e?.questions.every((w,E)=>NI(w,n[E],s[E]??"")),y=(()=>{if(!e)return!1;const w=e.questions[i];return w?NI(w,n[i],s[i]??""):!1})();if(!e)return null;const _=e.questions.length,S=c??"unknown";if(_===1){const w=e.questions[0];return w?h.jsx("div",{ref:l,children:h.jsx(fct,{question:w,requestId:S,answers:n,otherTexts:s,onAnswerChange:d,onOtherTextChange:f,onSubmit:m,isComplete:!!g})}):null}return h.jsx("div",{ref:l,children:h.jsx(pct,{question:e,requestId:S,currentIndex:i,answers:n,otherTexts:s,onAnswerChange:d,onOtherTextChange:f,onSubmit:m,onIndexChange:a,isComplete:!!g,isCurrentAnswered:y})})}function gct({rewindPreview:e,onConfirm:t,onCancel:n}){const r=e!==null,i=e?.isLoading??!1,a=e?.isExecuting??!1,s=!!e?.error,o=e?.affectedFiles??[],l=o.length>0;return h.jsx(dv,{open:r,onOpenChange:c=>!c&&n(),children:h.jsxs(Lm,{className:"sm:max-w-md",children:[h.jsxs(hv,{children:[h.jsxs(fv,{className:"flex items-center gap-2",children:[h.jsx(WA,{className:"h-5 w-5 text-amber-500"}),"Rewind Files"]}),h.jsx(pv,{children:"This will revert file changes to the state before the selected message was processed."})]}),h.jsx("div",{className:"py-4",children:i?h.jsxs("div",{className:"flex items-center justify-center py-6",children:[h.jsx(un,{className:"h-6 w-6 animate-spin text-muted-foreground"}),h.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:a?"Reverting files...":"Loading preview..."})]}):s?h.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-destructive/50 bg-destructive/10 p-3",children:[h.jsx(hc,{className:"h-5 w-5 text-destructive flex-shrink-0 mt-0.5"}),h.jsx("div",{className:"text-sm text-destructive",children:e?.error})]}):l?h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[h.jsx(o0,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{children:"Files that will be reverted:"})]}),h.jsx("div",{className:"max-h-48 overflow-y-auto rounded-lg border bg-muted/30",children:h.jsx("ul",{className:"divide-y divide-border",children:o.map(c=>h.jsx("li",{className:"px-3 py-2 text-sm font-mono truncate",title:c,children:c},c))})}),h.jsxs("div",{className:ne("flex items-start gap-2 rounded-lg border p-3 text-sm","border-amber-500/50 bg-amber-50 dark:bg-amber-900/20"),children:[h.jsx(hc,{className:"h-4 w-4 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5"}),h.jsx("span",{className:"text-amber-800 dark:text-amber-200",children:"This action cannot be undone. Make sure you want to revert these changes."})]})]}):h.jsx("div",{className:"text-center py-6 text-sm text-muted-foreground",children:"No files were modified since this message. There's nothing to rewind."})}),h.jsxs(tC,{children:[h.jsx(We,{variant:"outline",onClick:n,disabled:i,children:"Cancel"}),h.jsxs(We,{variant:"destructive",onClick:t,disabled:i||s||!l,className:"bg-amber-600 hover:bg-amber-700",children:[h.jsx(WA,{className:"mr-2 h-4 w-4"}),"Rewind Files"]})]})]})})}const bct=v.memo(function({notification:t,onDismiss:n}){return h.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-2 rounded-md hover:bg-muted/50 group",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:"text-xs text-foreground truncate",children:t.message}),h.jsx("p",{className:"text-[10px] text-muted-foreground",children:SO(t.timestamp)})]}),n&&h.jsx(We,{variant:"ghost",size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",onClick:n,"aria-label":"Dismiss notification",children:h.jsx(Ao,{className:"h-3 w-3"})})]})});v.memo(function({notifications:t,onDismiss:n,onClearAll:r,className:i}){const a=v.useCallback(o=>()=>{n?.(o)},[n]),s=v.useMemo(()=>[...t].reverse(),[t]);return t.length===0?null:h.jsx("div",{className:i,children:h.jsx("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:h.jsxs("div",{className:"p-2 space-y-1",children:[h.jsxs("div",{className:"flex items-center justify-between px-2 py-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(bve,{className:"h-3.5 w-3.5 text-muted-foreground"}),h.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:["Notifications (",t.length,")"]})]}),r&&t.length>1&&h.jsx(We,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[10px] text-muted-foreground hover:text-foreground",onClick:r,children:"Clear all"})]}),h.jsx("div",{className:"space-y-0.5 max-h-32 overflow-y-auto",children:s.map(o=>h.jsx(bct,{notification:o,onDismiss:n?a(o.id):void 0},o.id))})]})})})});function hC(e){{const t=()=>{};return{log:t,group:t,groupEnd:t}}}const yct=hC(),Zue=(...e)=>{yct.log(...e)};function Que(){return`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function vct(e,t,n){if(!n)return e;for(let r=e.messages.length-1;r>=0;r-=1){const i=e.messages[r];if(!i||i.source!=="agent"||!i.message||!fh(i.message))continue;const a=i.message.event;if(a?.type!=="content_block_start"||a.content_block.type!=="thinking"||a.index!==t)continue;const s=[...e.messages];return s[r]={...i,message:{...i.message,event:{...a,content_block:{...a.content_block,thinking:(a.content_block.thinking??"")+n}}}},{...e,messages:s}}return e}function _ct(e,t){return{id:Que(),source:"agent",message:e,timestamp:new Date().toISOString(),order:t}}function fC(e,t){const n=t.order;let r=0,i=e.length;for(;r<i;){const s=Math.floor((r+i)/2),o=e[s];if(!o)throw new Error(`Missing message at index ${s}`);o.order<=n?r=s+1:i=s}const a=[...e];return a.splice(r,0,t),a}function NW(e,t){if(e.source!=="agent"||!e.message)return!1;const n=e.message;if(!fh(n))return!1;const r=n.event;return r.type!=="content_block_start"||r.content_block.type!=="tool_use"?!1:r.content_block.id===t}function AI(e){return fh(e)?pZe(e.event):null}function xct(e,t,n){const r=e.messages.findIndex(l=>l.source==="agent"&&l.order===n);if(r<0)return null;const i=e.messages[r];if(!i)return null;const a=i.message?AI(i.message):null,s=AI(t),o=[...e.messages];if(o[r]={...i,message:t,timestamp:t.timestamp??i.timestamp},a!==s){const l=new Map(e.toolUseIdToIndex);return a&&l.delete(a),s&&l.set(s,r),{...e,messages:o,toolUseIdToIndex:l}}return{...e,messages:o}}function Sct(e,t,n){let r=e;if(t.type==="result"&&(r={...r,tokenStats:kZe(r.tokenStats,t)},oZe(r.messages,t))||(fh(t)&&t.event.type==="message_start"&&(r={...r,latestThinking:null}),fh(t)&&t.event.type==="content_block_delta"&&t.event.delta.type==="thinking_delta"&&(r=vct(r,t.event.index,t.event.delta.thinking),r={...r,latestThinking:(r.latestThinking??"")+t.event.delta.thinking}),!eZe(t)))return r;const i=xct(r,t,n);if(i)return i;const a=_ct(t,n),s=fC(r.messages,a),o=s.indexOf(a),l=AI(t);if(l){const c=new Map(r.toolUseIdToIndex);return c.set(l,o),{...r,messages:s,toolUseIdToIndex:c}}return{...r,messages:s}}function wct(e,t,n){let r=e.toolUseIdToIndex.get(t),i=e,a=!1;if(r!==void 0){const m=e.messages[r];m&&NW(m,t)||(r=void 0,a=!0)}if(r===void 0){if(r=e.messages.findIndex(m=>NW(m,t)),r===-1)return e;a=!0}if(a){const m=new Map(e.toolUseIdToIndex);m.set(t,r),i={...e,toolUseIdToIndex:m}}const s=i.messages[r];if(!s)return i;const o=s.message,l=o?.event;if(!l?.content_block)return i;const c={...l,content_block:{...l.content_block,input:n}},d={...s,message:{...o,event:c}},f=[...i.messages];return f[r]=d,{...i,messages:f}}function Ect(e){if(!e)return{type:"none"};if(e.toolName==="AskUserQuestion"){const t=e.input;return{type:"question",request:{requestId:e.requestId,questions:t.questions??[],timestamp:e.timestamp}}}return{type:"permission",request:{requestId:e.requestId,toolName:e.toolName,toolInput:e.input,timestamp:e.timestamp,planContent:e.planContent}}}function Cct(e,t){if(t.type==="COMPACT_BOUNDARY"){const n=e.messages.reduce((i,a)=>Math.max(i,a.order),-1),r={id:`compact-boundary-${Date.now()}`,source:"agent",message:{type:"system",subtype:"compact_boundary"},timestamp:new Date().toISOString(),order:n+1};return{...e,hasCompactBoundary:!0,messages:[...e.messages,r]}}else return e}function Tct(e,t){switch(t.type){case"USER_MESSAGE_SENT":return{...e,messages:[...e.messages,t.payload]};case"ADD_TO_QUEUE":{const n=new Map(e.queuedMessages);return n.set(t.payload.id,t.payload),{...e,queuedMessages:n}}case"MESSAGE_SENDING":{const{id:n,text:r,attachments:i}=t.payload,a=new Map(e.pendingMessages);return a.set(n,{text:r,attachments:i}),{...e,pendingMessages:a}}case"CLEAR_REJECTED_MESSAGE":return{...e,lastRejectedMessage:null};case"MESSAGE_USED_AS_RESPONSE":{const n=e.pendingMessages.get(t.payload.id),r=new Map(e.pendingMessages);if(r.delete(t.payload.id),e.messages.some(a=>a.id===t.payload.id))return{...e,pendingMessages:r,pendingRequest:{type:"none"}};const i={id:t.payload.id,source:"user",text:t.payload.text,timestamp:new Date().toISOString(),attachments:n?.attachments,order:t.payload.order};return{...e,messages:fC(e.messages,i),pendingMessages:r,pendingRequest:{type:"none"}}}default:return e}}function fp(e,t){const n=new Set(t.model.options.map(s=>s.value)),r=new Set(t.reasoning.options.map(s=>s.value)),i=!t.model.enabled||e.selectedModel&&n.has(e.selectedModel)?e.selectedModel:t.model.selected&&n.has(t.model.selected)?t.model.selected:t.model.options[0]?.value??e.selectedModel,a=t.reasoning.enabled?e.reasoningEffort&&r.has(e.reasoningEffort)?e.reasoningEffort:t.reasoning.selected&&r.has(t.reasoning.selected)?t.reasoning.selected:t.reasoning.options[0]?.value??null:null;return{selectedModel:i,reasoningEffort:a,thinkingEnabled:t.thinking.enabled?e.thinkingEnabled:!1,planModeEnabled:t.planMode.enabled?e.planModeEnabled:!1}}const Jue={provider:"CLAUDE",model:{enabled:!1,options:[]},reasoning:{enabled:!1,options:[]},thinking:{enabled:!1},planMode:{enabled:!1},attachments:{enabled:!1,kinds:[]},slashCommands:{enabled:!1},usageStats:{enabled:!1,contextWindow:!1},rewind:{enabled:!1}};function cF(){return{messages:[],gitBranch:null,pendingRequest:{type:"none"},toolUseIdToIndex:new Map,latestThinking:null,pendingMessages:new Map,lastRejectedMessage:null,isCompacting:!1,toolProgress:new Map,sessionInitData:null,permissionMode:null,hasCompactBoundary:!1,activeHooks:new Map,taskNotifications:[],tokenStats:coe(),pendingUserMessageUuids:[],messageIdToUuid:new Map,localUserMessageIds:new Set,rewindPreview:null,acpPlan:null,acpConfigOptions:null}}function ede(){return{...cF(),queuedMessages:new Map,sessionStatus:{phase:"loading"},processStatus:{state:"unknown"},sessionRuntime:{...noe(),phase:"loading"},slashCommands:[],slashCommandsLoaded:!1,chatCapabilities:Jue}}function kct(e){return{messages:[],sessionStatus:{phase:"loading"},processStatus:{state:"unknown"},sessionRuntime:noe(),gitBranch:null,availableSessions:[],pendingRequest:{type:"none"},chatSettings:J0,chatCapabilities:Jue,queuedMessages:new Map,toolUseIdToIndex:new Map,latestThinking:null,pendingMessages:new Map,lastRejectedMessage:null,isCompacting:!1,toolProgress:new Map,sessionInitData:null,permissionMode:null,hasCompactBoundary:!1,activeHooks:new Map,taskNotifications:[],slashCommands:[],slashCommandsLoaded:!1,tokenStats:coe(),pendingUserMessageUuids:[],messageIdToUuid:new Map,localUserMessageIds:new Set,rewindPreview:null,acpPlan:null,acpConfigOptions:null,...e}}function Nct(e,t){switch(t.type){case"CLEAR_CHAT":{const n=e.sessionStatus.phase==="running"?e.sessionStatus:{phase:"ready"};return{...e,...cF(),sessionStatus:n,chatSettings:fp(J0,e.chatCapabilities)}}case"RESET_FOR_SESSION_SWITCH":return{...e,...ede()};default:return e}}function Act(e,t){switch(t.type){case"SESSION_SNAPSHOT":{const n=t.payload.messages,r=new Set(n.map(o=>o.id)),i=new Map;for(const[o,l]of e.pendingMessages)r.has(o)||i.set(o,l);const a=Ect(t.payload.pendingInteractiveRequest),s=new Map(t.payload.queuedMessages.map(o=>[o.id,o]));return{...e,messages:n,queuedMessages:s,pendingRequest:a,sessionRuntime:t.payload.sessionRuntime,toolUseIdToIndex:new Map,pendingMessages:i,lastRejectedMessage:null,messageIdToUuid:new Map,pendingUserMessageUuids:[],localUserMessageIds:new Set,rewindPreview:null}}default:return e}}function Rct(e,t){return t.type==="MESSAGE_STATE_CHANGED"?Ict(e,t.payload):e}function Ict(e,t){const{id:n,newState:r,userMessage:i,errorMessage:a,queuePosition:s}=t;switch(r){case ru.ACCEPTED:return i?Oct(e,n,i,s):e;case ru.DISPATCHED:return i?Dct(e,n,i):AW(e,n);case ru.COMMITTED:case ru.COMPLETE:return AW(e,n);case ru.CANCELLED:return Mct(e,n);case ru.REJECTED:case ru.FAILED:return Lct(e,n,a);default:return Zue(`[chat-reducer] Ignoring state transition to ${r} for message ${n}`),e}}function Oct(e,t,n,r){const i=new Map(e.pendingMessages);if(i.delete(t),e.messages.some(d=>d.id===t)){const d=new Map(e.queuedMessages);return d.set(t,{id:t,text:n.text,timestamp:n.timestamp,attachments:n.attachments,settings:n.settings??{selectedModel:null,reasoningEffort:null,thinkingEnabled:!1,planModeEnabled:!1}}),{...e,queuedMessages:d,pendingMessages:i}}const a={id:t,source:"user",text:n.text,timestamp:n.timestamp,attachments:n.attachments,order:n.order??roe+(r??0)},s=new Map(e.queuedMessages);s.set(t,{id:t,text:n.text,timestamp:n.timestamp,attachments:n.attachments,settings:n.settings??{selectedModel:null,reasoningEffort:null,thinkingEnabled:!1,planModeEnabled:!1}});const o=new Set(e.localUserMessageIds);e.sessionStatus.phase!=="loading"&&o.add(t);let l=e.messageIdToUuid,c=e.pendingUserMessageUuids;if(e.pendingUserMessageUuids.length>0){const[d,...f]=e.pendingUserMessageUuids;c=f,d&&(l=new Map(e.messageIdToUuid),l.set(t,d))}return{...e,messages:fC(e.messages,a),queuedMessages:s,pendingMessages:i,messageIdToUuid:l,pendingUserMessageUuids:c,localUserMessageIds:o}}function Dct(e,t,n){const r=new Map(e.queuedMessages);if(r.delete(t),n.order===void 0)return{...e,queuedMessages:r};const i=e.messages.findIndex(c=>c.id===t);if(i===-1)return{...e,queuedMessages:r};const a=e.messages[i];if(!a)return{...e,queuedMessages:r};const s={...a,order:n.order},o=[...e.messages.slice(0,i),...e.messages.slice(i+1)],l=fC(o,s);return{...e,messages:l,queuedMessages:r}}function AW(e,t){const n=new Map(e.queuedMessages);return n.delete(t),{...e,queuedMessages:n}}function Mct(e,t){const n=new Map(e.queuedMessages);return n.delete(t),{...e,messages:e.messages.filter(r=>r.id!==t),queuedMessages:n}}function Lct(e,t,n){const r=e.queuedMessages.get(t),i=e.pendingMessages.get(t),a=r??i,s=new Map(e.queuedMessages);s.delete(t);const o=new Map(e.pendingMessages);return o.delete(t),{...e,messages:e.messages.filter(l=>l.id!==t),queuedMessages:s,pendingMessages:o,lastRejectedMessage:a?{text:r?.text??i?.text??"",attachments:a.attachments,error:n??"Message failed"}:null}}function Pct(e,t){switch(t.type){case"WS_AGENT_MESSAGE":return Sct(e,t.payload.message,t.payload.order);case"WS_ERROR":{const n=e.messages.reduce((s,o)=>Math.max(s,o.order),-1),r={type:"error",error:t.payload.message,timestamp:new Date().toISOString()},i={id:Que(),source:"agent",message:r,timestamp:new Date().toISOString(),order:n+1},a=e.sessionStatus.phase==="loading"?{phase:"ready"}:e.sessionStatus;return{...e,messages:[...e.messages,i],sessionStatus:a}}default:return e}}function Bct(e,t){switch(t.type){case"USER_MESSAGE_UUID_RECEIVED":{const n=e.messages.filter(r=>r.source==="user"&&e.localUserMessageIds.has(r.id)&&!e.messageIdToUuid.has(r.id));if(n.length>0){const r=n[0];if(!r)return e;const i=new Map(e.messageIdToUuid);return i.set(r.id,t.payload.uuid),{...e,messageIdToUuid:i}}return Zue(`[chat-reducer] UUID received but no unmapped user message found, queueing: ${t.payload.uuid}`),{...e,pendingUserMessageUuids:[...e.pendingUserMessageUuids,t.payload.uuid]}}default:return e}}function jct(e,t){switch(t.type){case"WS_PERMISSION_REQUEST":return{...e,pendingRequest:{type:"permission",request:t.payload}};case"WS_USER_QUESTION":return{...e,pendingRequest:{type:"question",request:t.payload}};case"PERMISSION_RESPONSE":{const n=t.payload.allow&&e.pendingRequest.type==="permission"&&e.pendingRequest.request.toolName==="ExitPlanMode";return{...e,pendingRequest:{type:"none"},...n&&{chatSettings:{...e.chatSettings,planModeEnabled:!1}}}}case"QUESTION_RESPONSE":return{...e,pendingRequest:{type:"none"}};case"WS_PERMISSION_CANCELLED":return(e.pendingRequest.type==="permission"||e.pendingRequest.type==="question"?e.pendingRequest.request.requestId:null)===t.payload.requestId?{...e,pendingRequest:{type:"none"}}:e;default:return e}}function Fct(e,t){switch(t.type){case"REWIND_PREVIEW_START":return{...e,rewindPreview:{userMessageId:t.payload.userMessageId,requestNonce:t.payload.requestNonce,isLoading:!0}};case"REWIND_PREVIEW_SUCCESS":return!e.rewindPreview||t.payload.userMessageId&&t.payload.userMessageId!==e.rewindPreview.userMessageId?e:{...e,rewindPreview:{...e.rewindPreview,isLoading:!1,affectedFiles:t.payload.affectedFiles}};case"REWIND_PREVIEW_ERROR":return!e.rewindPreview||t.payload.requestNonce&&t.payload.requestNonce!==e.rewindPreview.requestNonce||t.payload.userMessageId&&t.payload.userMessageId!==e.rewindPreview.userMessageId?e:{...e,rewindPreview:{...e.rewindPreview,isLoading:!1,error:t.payload.error}};case"REWIND_CANCEL":return{...e,rewindPreview:null};default:return e}}function $ct(e,t){switch(t.type){case"REWIND_EXECUTING":return e.rewindPreview?{...e,rewindPreview:{...e.rewindPreview,isLoading:!0,isExecuting:!0}}:e;case"REWIND_SUCCESS":return!e.rewindPreview||t.payload.userMessageId&&t.payload.userMessageId!==e.rewindPreview.userMessageId?e:{...e,rewindPreview:null};default:return e}}function tde(e){switch(e.phase){case"loading":return{phase:"loading"};case"starting":return{phase:"starting"};case"stopping":return{phase:"stopping"};case"running":return e.processState==="stopped"?{phase:"ready"}:{phase:"running"};case"idle":case"error":return{phase:"ready"};default:return{phase:"ready"}}}function Uct(e){return e.processState==="alive"?{state:"alive"}:e.processState==="stopped"?e.lastExit?{state:"stopped",lastExit:{code:e.lastExit.code,exitedAt:e.lastExit.timestamp,unexpected:e.lastExit.unexpected}}:{state:"stopped"}:{state:"unknown"}}function RI(e,t){return{...e,sessionRuntime:t,sessionStatus:tde(t),processStatus:Uct(t)}}function zct(e){return e.processState==="stopped"||e.phase==="error"}function yA(e,t){const n=RI(e,t);return zct(t)?{...n,toolProgress:new Map,isCompacting:!1,activeHooks:new Map}:n}function Hct(e,t){switch(t.type){case"SESSION_SNAPSHOT":return yA(e,t.payload.sessionRuntime);case"SESSION_RUNTIME_SNAPSHOT":return yA(e,t.payload.sessionRuntime);case"SESSION_RUNTIME_UPDATED":return yA(e,t.payload.sessionRuntime);case"WS_SESSIONS":return{...e,availableSessions:t.payload.sessions};case"SESSION_SWITCH_START":return{...e,...ede(),queuedMessages:e.queuedMessages};case"SESSION_LOADING_START":{const n={...e.sessionRuntime,phase:"loading",updatedAt:new Date().toISOString()};return{...e,sessionRuntime:n,sessionStatus:tde(n)}}case"SESSION_LOADING_END":return e.sessionRuntime.phase==="loading"?RI(e,{...e.sessionRuntime,phase:"idle",updatedAt:new Date().toISOString()}):e;case"STOP_REQUESTED":return RI(e,{...e.sessionRuntime,phase:"stopping",activity:"IDLE",updatedAt:new Date().toISOString()});default:return e}}function Wct(e,t){return{...e,acpConfigOptions:t.configOptions}}function Gct(e,t){switch(t.type){case"UPDATE_SETTINGS":return{...e,chatSettings:fp({...e.chatSettings,...t.payload},e.chatCapabilities)};case"SET_SETTINGS":return{...e,chatSettings:fp(t.payload,e.chatCapabilities)};case"CONFIG_OPTIONS_UPDATE":return Wct(e,t.payload);case"WS_CHAT_CAPABILITIES":{const n=t.payload.capabilities.slashCommands.enabled;return{...e,chatCapabilities:t.payload.capabilities,chatSettings:fp(e.chatSettings,t.payload.capabilities),slashCommands:n?e.slashCommands:[],slashCommandsLoaded:n?e.slashCommandsLoaded:!0}}default:return e}}function qct(e,t){switch(t.type){case"SDK_STATUS_UPDATE":{const{permissionMode:n}=t.payload;return n!==void 0?{...e,permissionMode:n}:e}case"SDK_TASK_NOTIFICATION":{const n={id:crypto.randomUUID(),message:t.payload.message,timestamp:new Date().toISOString()};return{...e,taskNotifications:[...e.taskNotifications,n]}}case"SYSTEM_INIT":return{...e,sessionInitData:t.payload,slashCommandsLoaded:!0};case"HOOK_STARTED":{const{hookId:n,hookName:r,hookEvent:i}=t.payload,a=new Map(e.activeHooks);return a.set(n,{hookId:n,hookName:r,hookEvent:i,startedAt:new Date().toISOString()}),{...e,activeHooks:a}}case"HOOK_RESPONSE":{const n=new Map(e.activeHooks);return n.delete(t.payload.hookId),{...e,activeHooks:n}}case"WS_SLASH_COMMANDS":return{...e,slashCommands:t.payload.commands,slashCommandsLoaded:!0};case"DISMISS_TASK_NOTIFICATION":return{...e,taskNotifications:e.taskNotifications.filter(n=>n.id!==t.payload.id)};case"CLEAR_TASK_NOTIFICATIONS":return{...e,taskNotifications:[]};default:return e}}function Vct(e,t){switch(t.type){case"TOOL_INPUT_UPDATE":return wct(e,t.payload.toolUseId,t.payload.input);case"TOOL_USE_INDEXED":{const n=new Map(e.toolUseIdToIndex);return n.set(t.payload.toolUseId,t.payload.index),{...e,toolUseIdToIndex:n}}case"SDK_TOOL_PROGRESS":{const{toolUseId:n,toolName:r,elapsedSeconds:i,acpLocations:a,acpKind:s}=t.payload,o=new Map(e.toolProgress);return o.set(n,{toolName:r,elapsedSeconds:i,...a&&{acpLocations:a},...s&&{acpKind:s}}),{...e,toolProgress:o}}case"SDK_TOOL_USE_SUMMARY":{const{precedingToolUseIds:n}=t.payload,r=new Map(e.toolProgress);for(const i of n)r.delete(i);return{...e,toolProgress:r}}case"SDK_COMPACTING_START":return{...e,isCompacting:!0};case"SDK_COMPACTING_END":return{...e,isCompacting:!1};case"ACP_PLAN_UPDATE":return{...e,acpPlan:{entries:t.payload.entries,updatedAt:new Date().toISOString()}};default:return e}}const Yct=[Hct,jct,Gct,Pct,Tct,Nct,Act,Rct,Bct,Cct,Vct,qct,Fct,$ct];function vA(e,t){let n=e;for(const r of Yct){const i=r(n,t);i!==n&&(n=i)}return n}function Kct(e){return{...e,...cF(),pendingMessages:e.pendingMessages,queuedMessages:e.queuedMessages,sessionStatus:{phase:"loading"},processStatus:{state:"unknown"},sessionRuntime:{...e.sessionRuntime,phase:"loading",processState:"unknown",activity:"IDLE",updatedAt:new Date().toISOString()}}}function Xct(e,t){if(t.type==="SESSION_REPLAY_BATCH"){let n=Kct(e);for(const r of t.payload.replayEvents){if(r.type==="session_replay_batch")continue;const i=nde(r);!i||i.type==="SESSION_REPLAY_BATCH"||(n=vA(n,i))}return n.sessionStatus.phase==="loading"&&(n=vA(n,{type:"SESSION_LOADING_END"})),n}return vA(e,t)}function Zct(e){return e.sessionRuntime?{type:"SESSION_RUNTIME_SNAPSHOT",payload:{sessionRuntime:e.sessionRuntime}}:null}function Qct(e){return e.sessionRuntime?{type:"SESSION_RUNTIME_UPDATED",payload:{sessionRuntime:e.sessionRuntime}}:null}function Jct(e){return aoe(e)&&e.order!==void 0?{type:"WS_AGENT_MESSAGE",payload:{message:e.data,order:e.order}}:null}function eut(e){return e.message?{type:"WS_ERROR",payload:{message:e.message}}:null}function tut(e){return e.sessions?{type:"WS_SESSIONS",payload:{sessions:e.sessions}}:null}function nut(e){return e.capabilities?{type:"WS_CHAT_CAPABILITIES",payload:{capabilities:e.capabilities}}:null}function rut(e){return e.requestId&&e.toolName?{type:"WS_PERMISSION_REQUEST",payload:{requestId:e.requestId,toolName:e.toolName,toolInput:e.toolInput??{},timestamp:new Date().toISOString(),planContent:e.planContent??null,acpOptions:e.acpOptions}}:null}function iut(e){return e.requestId&&e.questions?{type:"WS_USER_QUESTION",payload:{requestId:e.requestId,questions:e.questions,...Array.isArray(e.acpOptions)?{acpOptions:e.acpOptions}:{},timestamp:new Date().toISOString()}}:null}function aut(e){return e.messages&&e.queuedMessages&&e.sessionRuntime?{type:"SESSION_SNAPSHOT",payload:{messages:e.messages,queuedMessages:e.queuedMessages,sessionRuntime:e.sessionRuntime,pendingInteractiveRequest:e.pendingInteractiveRequest??null}}:null}function sut(e){return Array.isArray(e.replayEvents)?{type:"SESSION_REPLAY_BATCH",payload:{replayEvents:e.replayEvents.filter(jR)}}:null}function out(e){if(!(e.id&&e.newState))return null;const t=e.userMessage?{...e.userMessage}:void 0;return{type:"MESSAGE_STATE_CHANGED",payload:{id:e.id,newState:e.newState,queuePosition:e.queuePosition,errorMessage:e.errorMessage,userMessage:t}}}function lut(e){return e.tool_use_id&&e.tool_name&&e.elapsed_time_seconds!==void 0?{type:"SDK_TOOL_PROGRESS",payload:{toolUseId:e.tool_use_id,toolName:e.tool_name,elapsedSeconds:e.elapsed_time_seconds,acpLocations:e.acpLocations,acpKind:e.acpKind}}:null}function cut(e){return Array.isArray(e.preceding_tool_use_ids)?{type:"SDK_TOOL_USE_SUMMARY",payload:{summary:e.summary,precedingToolUseIds:e.preceding_tool_use_ids}}:null}function uut(e){const t=e.data;return t?{type:"SYSTEM_INIT",payload:{tools:t.tools??[],model:t.model??null,cwd:t.cwd??null,apiKeySource:t.apiKeySource??null,slashCommands:t.slashCommands??[],plugins:t.plugins??[]}}:null}function dut(e){const t=e.data;return t?.hookId&&t?.hookName&&t?.hookEvent?{type:"HOOK_STARTED",payload:{hookId:t.hookId,hookName:t.hookName,hookEvent:t.hookEvent}}:null}function hut(e){const t=e.data;return t?.hookId?{type:"HOOK_RESPONSE",payload:{hookId:t.hookId}}:null}function fut(e){return e.requestId?{type:"WS_PERMISSION_CANCELLED",payload:{requestId:e.requestId}}:null}function put(e){return e.id&&e.text&&e.order!==void 0?{type:"MESSAGE_USED_AS_RESPONSE",payload:{id:e.id,text:e.text,order:e.order}}:null}function mut(e){return{type:"SDK_STATUS_UPDATE",payload:{permissionMode:e.permissionMode}}}function gut(e){if(!e.message)return null;try{const t=JSON.parse(e.message);if(t&&t.type==="acp_plan"&&Array.isArray(t.entries))return{type:"ACP_PLAN_UPDATE",payload:{entries:t.entries}}}catch{}return{type:"SDK_TASK_NOTIFICATION",payload:{message:e.message}}}function but(e){return e.slashCommands?{type:"WS_SLASH_COMMANDS",payload:{commands:e.slashCommands}}:null}function yut(e){return e.uuid?{type:"USER_MESSAGE_UUID_RECEIVED",payload:{uuid:e.uuid}}:null}function vut(e){const t=e.configOptions;return Array.isArray(t)?{type:"CONFIG_OPTIONS_UPDATE",payload:{configOptions:t}}:null}const _ut={session_runtime_snapshot:Zct,session_runtime_updated:Qct,agent_message:Jct,error:eut,sessions:tut,chat_capabilities:nut,agent_metadata:null,permission_request:rut,user_question:iut,permission_cancelled:fut,message_used_as_response:put,session_snapshot:aut,session_delta:null,session_replay_batch:sut,message_state_changed:out,tool_progress:lut,tool_use_summary:cut,status_update:mut,task_notification:gut,system_init:uut,compact_boundary:()=>({type:"COMPACT_BOUNDARY"}),hook_started:dut,hook_response:hut,compacting_start:()=>({type:"SDK_COMPACTING_START"}),compacting_end:()=>({type:"SDK_COMPACTING_END"}),workspace_notification_request:null,slash_commands:but,user_message_uuid:yut,config_options_update:vut};function nde(e){const t=_ut[e.type];return t?t(e):null}const rde=hC();function xut(e){return fh(e)?e.event:null}function Sut(){return{toolUseIdByIndex:new Map,inputJsonByToolUseId:new Map}}function ide(e){e.toolUseIdByIndex.clear(),e.inputJsonByToolUseId.clear()}function wut(e,t){if(e.type!=="content_block_start")return;const n=e.content_block;if(n.type==="tool_use"&&n.id){const r=n.id;t.current.toolUseIdByIndex.set(e.index,r),t.current.inputJsonByToolUseId.set(r,""),rde.log("Tool use started:",r,n.name)}}function Eut(e,t){if(e.type!=="content_block_delta")return null;const n=e.delta;if(n.type!=="input_json_delta"||!("partial_json"in n))return null;const r=t.current.toolUseIdByIndex.get(e.index);if(!r)return null;const a=(t.current.inputJsonByToolUseId.get(r)??"")+n.partial_json;t.current.inputJsonByToolUseId.set(r,a);try{const s=JSON.parse(a),l=im(ke(),Cu()).parse(s);return rde.log("Tool input updated:",r,Object.keys(l)),{type:"TOOL_INPUT_UPDATE",payload:{toolUseId:r,input:l}}}catch{return null}}function Cut(e,t){if(e.type!=="content_block_stop")return;const n=t.current.toolUseIdByIndex.get(e.index);n&&(t.current.toolUseIdByIndex.delete(e.index),t.current.inputJsonByToolUseId.delete(n))}function Tut(e,t){const n=xut(e);return n?(wut(n,t),Cut(n,t),Eut(n,t)):null}const kut=nn({id:ke(),name:ke(),type:ke(),size:hi(),data:ke(),contentType:qr(["image","text"]).optional()}),ade=nn({selectedModel:ke().nullable(),reasoningEffort:ke().nullable(),thinkingEnabled:Ui(),planModeEnabled:Ui()});_O("type",[nn({type:Pr("start"),thinkingEnabled:Ui().optional(),planModeEnabled:Ui().optional(),selectedModel:ke().nullable().optional(),reasoningEffort:ke().nullable().optional(),model:ke().optional()}),nn({type:Pr("user_input"),text:ke().optional(),content:HV([ke(),Ya(Cu())]).optional()}),nn({type:Pr("queue_message"),id:ke().min(1),text:ke().optional(),attachments:Ya(kut).optional(),settings:ade.optional()}),nn({type:Pr("remove_queued_message"),messageId:ke().min(1)}),nn({type:Pr("stop")}),nn({type:Pr("load_session"),loadRequestId:ke().min(1).optional()}),nn({type:Pr("permission_response"),requestId:ke().min(1),optionId:ke().min(1)}),nn({type:Pr("set_model"),model:ke().optional(),reasoningEffort:ke().nullable().optional()}),nn({type:Pr("set_thinking_budget"),max_tokens:hi().nullable()}),nn({type:Pr("resume_queued_messages")}),nn({type:Pr("set_config_option"),configId:ke().min(1),value:ke().min(1)})]);const Nut="chat-draft-",sde="chat-settings-";function Mw(e){return`${Nut}${e}`}function Aut(e){if(!e||typeof window>"u")return"";try{return sessionStorage.getItem(Mw(e))??""}catch{return""}}function Rut(e,t){if(!(!e||typeof window>"u"))try{t.trim()?sessionStorage.setItem(Mw(e),t):sessionStorage.removeItem(Mw(e))}catch{}}function Iut(e){if(!(!e||typeof window>"u"))try{sessionStorage.removeItem(Mw(e))}catch{}}const Out=ade.partial({reasoningEffort:!0}).transform(e=>({...e,selectedModel:iZe(e.selectedModel),reasoningEffort:e.reasoningEffort??null}));function Dut(e){if(!e||typeof window>"u")return null;try{const t=sessionStorage.getItem(`${sde}${e}`);if(!t)return null;const n=JSON.parse(t),r=Out.safeParse(n);return r.success?r.data:null}catch{return null}}function Mut(e,t){if(!(!e||typeof window>"u"))try{sessionStorage.setItem(`${sde}${e}`,JSON.stringify(t))}catch{}}function Lut(e){return Dut(e)??J0}function Put(e){return{draft:Aut(e),settings:Lut(e)}}function But(){return`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function jut(e,t,n){if(!("thinkingEnabled"in t&&n))return;const r=t.thinkingEnabled?aZe:null;e({type:"set_thinking_budget",max_tokens:r})}function Fut(e,t,n,r){const i="selectedModel"in t,a="reasoningEffort"in t;if(!((i||a)&&r.model.enabled))return;const s={type:"set_model",model:n.selectedModel};r.reasoning.enabled&&(a?s.reasoningEffort=n.reasoningEffort:i&&(s.reasoningEffort=null)),e(s)}function ode(e,t){return!e||e.length===0?void 0:e.find(r=>t?r.kind.startsWith("allow"):r.kind.startsWith("reject"))?.optionId??e[0]?.optionId}function $ut(e,t){return e==="ExitPlanMode"?t?"default":"plan":t?"allow":"reject"}function Uut(e){const t=[];for(const n of Object.values(e)){if(Array.isArray(n)){t.push(...n);continue}n&&t.push(n)}return t}function zut(e,t){if(!e||e.length===0)return;const n=new Set(Uut(t).map(r=>r.trim().toLowerCase()));if(n.size>0){const r=e.find(i=>n.has(i.name.trim().toLowerCase()));if(r)return r.optionId}return ode(e,!0)}function Hut(e){const{send:t,dispatch:n,stateRef:r,dbSessionIdRef:i,inputAttachmentsRef:a,rewindTimeoutRef:s,onClearInput:o}=e,l=v.useCallback(D=>{const F=D.trim(),P=a.current;if(!F&&P.length===0)return;const $=But();n({type:"MESSAGE_SENDING",payload:{id:$,text:F,attachments:P.length>0?P:void 0}}),o();const W={type:"queue_message",id:$,text:F,attachments:P.length>0?P:void 0,settings:fp(r.current.chatSettings,r.current.chatCapabilities)};t(W)},[t,n,a,r,o]),c=v.useCallback(()=>{const{sessionStatus:D}=r.current;D.phase==="running"&&(n({type:"STOP_REQUESTED"}),t({type:"stop"}))},[t,n,r]),d=v.useCallback(()=>{r.current.sessionStatus.phase==="running"&&(n({type:"STOP_REQUESTED"}),t({type:"stop"})),n({type:"CLEAR_CHAT"})},[t,n,r]),f=v.useCallback((D,F,P)=>{const{pendingRequest:$}=r.current;if($.type!=="permission"||$.request.requestId!==D)return;const W=P??ode($.request.acpOptions,F)??$ut($.request.toolName,F);t({type:"permission_response",requestId:D,optionId:W}),n({type:"PERMISSION_RESPONSE",payload:{allow:F}})},[t,n,r]),m=v.useCallback((D,F)=>{const{pendingRequest:P}=r.current;if(P.type!=="question"||P.request.requestId!==D)return;const $=zut(P.request.acpOptions,F)??"allow";t({type:"permission_response",requestId:D,optionId:$}),n({type:"QUESTION_RESPONSE"})},[t,n,r]),g=v.useCallback(D=>{n({type:"UPDATE_SETTINGS",payload:D});const F=r.current.chatCapabilities,P=fp({...r.current.chatSettings,...D},F);Mut(i.current,P),jut(t,D,F.thinking.enabled),Fut(t,D,P,F)},[t,n,r,i]),y=v.useCallback(D=>{t({type:"remove_queued_message",messageId:D})},[t]),_=v.useCallback(()=>{t({type:"resume_queued_messages"})},[t]),S=v.useCallback(D=>{n({type:"DISMISS_TASK_NOTIFICATION",payload:{id:D}})},[n]),w=v.useCallback(()=>{n({type:"CLEAR_TASK_NOTIFICATIONS"})},[n]),E=v.useCallback((D,F)=>{t({type:"set_config_option",configId:D,value:F})},[t]),T=r.current.chatCapabilities.rewind.enabled,A=v.useCallback(D=>{if(!T)return;s.current&&(clearTimeout(s.current),s.current=null);const F=`${Date.now()}-${Math.random().toString(36).slice(2,9)}`;n({type:"REWIND_PREVIEW_START",payload:{userMessageId:D,requestNonce:F}}),n({type:"REWIND_PREVIEW_ERROR",payload:{error:"Rewind is not supported in ACP runtime.",requestNonce:F}})},[n,T,s]),O=v.useCallback(()=>{if(!T)return;s.current&&(clearTimeout(s.current),s.current=null);const D=r.current.rewindPreview;D&&(n({type:"REWIND_EXECUTING"}),n({type:"REWIND_PREVIEW_ERROR",payload:{error:"Rewind is not supported in ACP runtime.",requestNonce:D.requestNonce}}))},[n,T,r,s]),I=v.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),n({type:"REWIND_CANCEL"})},[n,s]),N=v.useCallback(D=>r.current.messageIdToUuid.get(D),[r]);return{sendMessage:l,stopChat:c,clearChat:d,approvePermission:f,answerQuestion:m,updateSettings:g,removeQueuedMessage:y,resumeQueuedMessages:_,dismissTaskNotification:S,clearTaskNotifications:w,setConfigOption:E,startRewindPreview:A,confirmRewind:O,cancelRewind:I,getUuidForMessageId:N}}function Wut(e){const{dbSessionId:t,initialDraft:n}=e,[r,i]=v.useState(n),a=v.useRef(t??null),s=v.useRef(void 0);v.useEffect(()=>{a.current=t},[t]),v.useEffect(()=>{i(n)},[n]);const o=v.useCallback(c=>{i(c),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{Rut(a.current,c)},300)},[]),l=v.useCallback(()=>{i(""),Iut(a.current)},[]);return v.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]),{inputDraft:r,setInputDraft:o,clearInputDraft:l}}const _A=hC();function Gut(e){const{dbSessionId:t,dispatch:n,toolInputAccumulatorRef:r,sessionRuntimePhase:i}=e,a=v.useRef(null),s=v.useRef(""),o=v.useRef(null);v.useEffect(()=>{const c=a.current,d=t??null;if(a.current=d,c!==null&&c!==d&&(_A.log("Session switch detected",{from:c,to:d}),o.current&&(clearTimeout(o.current),o.current=null),n({type:"SESSION_SWITCH_START"}),ide(r.current)),d){const f=Put(d);s.current=f.draft,n({type:"SET_SETTINGS",payload:f.settings}),c===null&&(n({type:"SESSION_LOADING_START"}),o.current=setTimeout(()=>{_A.log("Loading timeout reached, clearing loading state"),n({type:"SESSION_LOADING_END"}),o.current=null},1e4))}else s.current="",n({type:"SET_SETTINGS",payload:J0});return()=>{o.current&&clearTimeout(o.current)}},[t,n,r]);const l=v.useRef(i);return v.useEffect(()=>{const c=l.current;l.current=i,c==="loading"&&i!=="loading"&&o.current&&(_A.log("Session runtime phase changed from loading, clearing loading timeout"),clearTimeout(o.current),o.current=null)},[i]),{loadedDraft:s.current}}const qut=hC();function Vut(e,t,n){const r=e.data,i=Tut(r,t);i&&n(i)}function Yut(e){const{dispatch:t,toolInputAccumulatorRef:n}=e,r=v.useCallback(i=>{if(!jR(i)){qut.log("Received invalid WebSocket message:",i);return}const a=i;if(a.type==="session_delta"&&jR(a.data)){r(a.data);return}if((a.type==="session_snapshot"||a.type==="session_replay_batch")&&ide(n.current),a.type==="workspace_notification_request"){window.dispatchEvent(new CustomEvent("workspace-notification-request",{detail:{workspaceId:a.workspaceId,workspaceName:a.workspaceName,sessionCount:a.sessionCount,finishedAt:a.finishedAt}}));return}aoe(a)&&Vut(a,n,t);const s=nde(a);s&&t(s)},[t,n]);return{handleMessage:r}}function Kut(e){const{dbSessionId:t,send:n,connected:r}=e,[i,a]=v.useReducer(Xct,void 0,kct),[s,o]=v.useState([]),l=v.useRef(null),c=v.useRef(null),d=v.useRef(t??null),f=v.useRef(Sut()),m=v.useRef(i);m.current=i;const g=v.useRef(s);g.current=s;const y=v.useRef(null);v.useEffect(()=>{d.current=t},[t]);const{loadedDraft:_}=Gut({dbSessionId:t,dispatch:a,toolInputAccumulatorRef:f,sessionRuntimePhase:i.sessionRuntime.phase}),{inputDraft:S,setInputDraft:w,clearInputDraft:E}=Wut({dbSessionId:t,initialDraft:_}),{handleMessage:T}=Yut({dispatch:a,toolInputAccumulatorRef:f});v.useEffect(()=>{if(i.lastRejectedMessage){const{text:O,attachments:I}=i.lastRejectedMessage;w(O),I&&I.length>0&&o(I),a({type:"CLEAR_REJECTED_MESSAGE"})}},[i.lastRejectedMessage,w]);const A=Hut({send:n,dispatch:a,stateRef:m,dbSessionIdRef:d,inputAttachmentsRef:g,rewindTimeoutRef:y,onClearInput:()=>{E(),o([])}});return v.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]),v.useMemo(()=>({...i,queuedMessages:Array.from(i.queuedMessages.values()),connected:r,...A,inputDraft:S,setInputDraft:w,inputAttachments:s,setInputAttachments:o,handleMessage:T,dispatch:a,inputRef:l,messagesEndRef:c}),[i,r,A,S,w,s,T])}const Xut=1e4;function Zut(e){const{dbSessionId:t}=e,n=v.useRef(`conn-${Date.now()}-${Math.random().toString(36).slice(2,9)}`),r=t?$1("/chat",{sessionId:t,connectionId:n.current}):null,i=v.useRef(()=>!1),a=v.useRef(null),s=v.useRef(0),o=v.useRef(null),l=v.useCallback(()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]),c=v.useCallback((_,S)=>{l(),o.current=setTimeout(()=>{if(s.current!==_||a.current!==S){o.current=null;return}const w=`load-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;a.current=w,i.current({type:"load_session",loadRequestId:w}),c(_,w)},Xut)},[l]),d=Kut({dbSessionId:t,send:v.useCallback(_=>i.current(_),[]),connected:!1}),f=v.useCallback(_=>{if(typeof _=="object"&&_!==null&&"type"in _&&(_.type==="session_replay_batch"||_.type==="session_snapshot")){const S=_;if(a.current&&S.loadRequestId){if(S.loadRequestId!==a.current)return;a.current=null,l()}}d.handleMessage(_)},[d.handleMessage,l]),m=v.useCallback(()=>{d.dispatch({type:"SESSION_LOADING_START"});const _=s.current+1;s.current=_;const S=`load-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;a.current=S,c(_,S),i.current({type:"load_session",loadRequestId:S})},[d.dispatch,c]),g=v.useCallback(()=>{a.current=null,s.current+=1,l(),d.dispatch({type:"SESSION_LOADING_END"})},[d.dispatch,l]);v.useEffect(()=>()=>{a.current=null,s.current+=1,l()},[l]);const y=U1({url:r,onMessage:f,onConnected:m,onDisconnected:g});return i.current=y.send,{messages:d.messages,connected:y.connected,sessionStatus:d.sessionStatus,processStatus:d.processStatus,sessionRuntime:d.sessionRuntime,gitBranch:d.gitBranch,availableSessions:d.availableSessions,pendingRequest:d.pendingRequest,chatSettings:d.chatSettings,chatCapabilities:d.chatCapabilities,inputDraft:d.inputDraft,inputAttachments:d.inputAttachments,queuedMessages:d.queuedMessages,latestThinking:d.latestThinking,pendingMessages:d.pendingMessages,isCompacting:d.isCompacting,taskNotifications:d.taskNotifications,permissionMode:d.permissionMode,slashCommands:d.slashCommands,slashCommandsLoaded:d.slashCommandsLoaded,tokenStats:d.tokenStats,rewindPreview:d.rewindPreview,acpPlan:d.acpPlan,acpConfigOptions:d.acpConfigOptions,toolProgress:d.toolProgress,sendMessage:d.sendMessage,stopChat:d.stopChat,clearChat:d.clearChat,approvePermission:d.approvePermission,answerQuestion:d.answerQuestion,updateSettings:d.updateSettings,setInputDraft:d.setInputDraft,setInputAttachments:d.setInputAttachments,removeQueuedMessage:d.removeQueuedMessage,resumeQueuedMessages:d.resumeQueuedMessages,dismissTaskNotification:d.dismissTaskNotification,clearTaskNotifications:d.clearTaskNotifications,setConfigOption:d.setConfigOption,startRewindPreview:d.startRewindPreview,confirmRewind:d.confirmRewind,cancelRewind:d.cancelRewind,getUuidForMessageId:d.getUuidForMessageId,inputRef:d.inputRef,messagesEndRef:d.messagesEndRef}}const Qut=2e3;function Jut({textContent:e,className:t}){const[n,r]=v.useState(!1),i=v.useRef(void 0);v.useEffect(()=>()=>{i.current!==void 0&&clearTimeout(i.current)},[]);const a=async()=>{try{await navigator.clipboard.writeText(e),r(!0),i.current!==void 0&&clearTimeout(i.current),i.current=window.setTimeout(()=>{r(!1)},Qut)}catch{}};return h.jsx("button",{onClick:a,onMouseDown:s=>s.preventDefault(),className:ne("absolute top-1 right-1 p-1.5 rounded-md","bg-background/90 hover:bg-background","border border-border","shadow-sm","opacity-0 group-hover:opacity-100","transition-all","z-10","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",t),title:"Copy to clipboard",type:"button","aria-label":"Copy message to clipboard",children:n?h.jsx(nm,{className:"h-3.5 w-3.5 text-green-600 dark:text-green-400"}):h.jsx(Bq,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-foreground"})})}const edt=v.memo(function({className:t}){return h.jsxs("div",{className:ne("flex items-center gap-2 py-3 my-2 border-t border-b border-dashed border-muted-foreground/30",t),children:[h.jsx(U_e,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"Context compacted - earlier messages may be summarized"})]})}),lde=v.createContext({lastThinkingMessageId:null,running:!1});function tdt({lastThinkingMessageId:e,running:t,children:n}){const r=v.useMemo(()=>({lastThinkingMessageId:e,running:t}),[e,t]);return h.jsx(lde.Provider,{value:r,children:n})}function ndt(e){const{lastThinkingMessageId:t,running:n}=v.useContext(lde);return n&&e!=null&&e===t}const rdt=v.memo(function({event:t,messageId:n,className:r}){switch(t.type){case"content_block_start":{const i=t.content_block;return _j(i)?h.jsx("div",{className:ne("prose prose-sm dark:prose-invert max-w-none text-sm",r),children:h.jsx(adt,{text:i.text})}):Q0(i)?h.jsx(cde,{text:i.thinking,messageId:n,className:r}):null}case"content_block_delta":return h.jsx(idt,{delta:t.delta,className:r});case"message_start":case"message_delta":case"message_stop":case"content_block_stop":return null;default:return null}}),idt=v.memo(function({delta:t,className:n}){return t.type==="text_delta"?h.jsx("span",{className:ne("",n),children:t.text}):t.type==="thinking_delta"?h.jsx("span",{className:ne("text-muted-foreground italic",n),children:t.thinking}):null}),adt=v.memo(function({text:t}){return h.jsx(Rh,{content:t})}),sdt=200,cde=v.memo(function({text:t,messageId:n,truncateLength:r=sdt,className:i}){const[a,s]=v.useState(!1),o=ndt(n),l=t.length>r,c=l&&!a?`${t.slice(0,r)}...`:t;return h.jsxs("div",{className:ne("rounded-md border border-dashed border-muted-foreground/30 bg-muted/30 p-2",i),children:[h.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[h.jsx(un,{className:ne("h-3 w-3",o&&"animate-spin")}),h.jsx("span",{children:"Thinking"})]}),h.jsx("div",{className:"text-sm text-muted-foreground italic whitespace-pre-wrap",children:c}),l&&h.jsx("button",{onClick:()=>s(!a),className:"text-xs text-primary hover:underline mt-1",children:a?"Show less":"Show more"})]})}),odt=v.memo(function({message:t,className:n}){const r=t.error||"An unknown error occurred";return h.jsxs("div",{className:ne("flex items-start gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3",n),children:[h.jsx(hc,{className:"h-4 w-4 text-destructive shrink-0 mt-0.5"}),h.jsx("div",{className:"text-sm text-destructive",children:r})]})}),ldt=v.memo(function({message:t,className:n}){switch(t.subtype){case"init":return t.tools?h.jsxs("div",{className:ne("text-xs text-muted-foreground",n),children:[h.jsxs("span",{children:["Session initialized with ",t.tools.length," tools"]}),t.model&&h.jsxs("span",{className:"ml-2",children:["Model: ",t.model]})]}):null;case"status":return null;case"compact_boundary":return h.jsx(edt,{className:n});case"hook_started":case"hook_response":return null;default:return null}}),cdt=v.memo(function({message:t,className:n}){return t.result&&typeof t.result=="string"?h.jsx("div",{className:ne("prose prose-sm dark:prose-invert max-w-none text-sm",n),children:h.jsx(Rh,{content:t.result})}):null}),RW=v.memo(function({message:t,messageId:n,className:r}){if(ev(t)||z1(t))return h.jsx(udt,{message:t,className:r});if(t.type==="result")return h.jsx(cdt,{message:t,className:r});if(t.type==="error")return h.jsx(odt,{message:t,className:r});if(t.type==="stream_event"&&t.event)return h.jsx(rdt,{event:t.event,messageId:n,className:r});if(t.message&&Array.isArray(t.message.content)){const a=t.message.content,s=a[0];if(a.length===1&&s&&Q0(s))return h.jsx(cde,{text:s.thinking,messageId:n,className:r})}const i=soe(t);return i?h.jsx("div",{className:ne("prose prose-sm dark:prose-invert max-w-none text-sm break-words",r),children:h.jsx(ddt,{text:i})}):t.type==="system"?h.jsx(ldt,{message:t,className:r}):null}),udt=v.memo(function({message:t,className:n}){return h.jsx("div",{className:ne("my-1",n),children:h.jsx(Kst,{message:t})})}),ddt=v.memo(function({text:t}){return h.jsx(Rh,{content:t})}),IW=v.memo(function({children:t,className:n}){return h.jsx("div",{className:ne("py-2",n),children:h.jsx("div",{className:"max-w-full",children:t})})}),hdt=v.memo(function({className:t}){return h.jsxs("div",{className:ne("flex items-center gap-2 text-muted-foreground",t),children:[h.jsx(un,{className:"h-4 w-4 animate-spin"}),h.jsx("span",{className:"text-sm",children:"Agent is working..."})]})});function fdt(e){return e??""}function pdt(e){if(!e)return null;const t=soe(e);if(t)return t;if(e.message&&Array.isArray(e.message.content)&&e.message.content.length===1){const n=e.message.content[0];if(n&&Q0(n))return n.thinking}return null}const mdt=v.memo(function({message:t,isQueued:n,onRemove:r,userMessageUuid:i,onRewindToMessage:a}){if(t.source==="user"){const s=fdt(t.text);return h.jsx(IW,{children:h.jsxs("div",{className:"group relative w-full max-w-full",children:[h.jsxs("div",{className:ne("absolute -top-1 -right-1 flex items-center gap-1","opacity-0 group-hover:opacity-100","transition-all","z-10"),children:[s&&h.jsx("button",{onClick:async()=>{try{await navigator.clipboard.writeText(s)}catch{}},onMouseDown:o=>o.preventDefault(),className:ne("p-1.5 rounded-md","bg-background/90 hover:bg-background","border border-border","shadow-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),title:"Copy to clipboard",type:"button","aria-label":"Copy message to clipboard",children:h.jsx(Bq,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-foreground"})}),i&&a&&h.jsx("button",{onClick:()=>a(i),onMouseDown:o=>o.preventDefault(),className:ne("p-1.5 rounded-md","bg-background/90 hover:bg-amber-50 dark:hover:bg-amber-900/20","border border-border hover:border-amber-500/50","shadow-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),title:"Rewind files to before this message",type:"button","aria-label":"Rewind files to before this message",children:h.jsx(WA,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-amber-600 dark:hover:text-amber-400"})}),n&&r&&h.jsx("button",{onClick:r,className:ne("p-1.5 rounded-md","bg-background/90 hover:bg-destructive/10","border border-border hover:border-destructive/50","shadow-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),title:"Cancel queued message",type:"button","aria-label":"Cancel queued message",children:h.jsx(Ao,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-destructive"})})]}),h.jsxs("div",{className:ne("space-y-2",n&&"opacity-50"),children:[t.attachments&&t.attachments.length>0&&h.jsx(Tue,{attachments:t.attachments,readOnly:!0}),t.text&&h.jsx("div",{className:"relative w-full max-w-full",children:h.jsx("div",{className:"w-full rounded border border-border/70 bg-muted/35 px-3 py-2 break-words text-sm text-left whitespace-pre-wrap",children:s})})]})]})})}if(t.message){const s=pdt(t.message);return h.jsx(IW,{children:s!==null?h.jsxs("div",{className:"group relative",children:[h.jsx(RW,{message:t.message,messageId:t.id}),h.jsx(Jut,{textContent:s})]}):h.jsx(RW,{message:t.message,messageId:t.id})})}return null}),gdt=v.memo(function({item:t,isQueued:n,onRemove:r,userMessageUuid:i,onRewindToMessage:a}){return Sj(t)?h.jsx(gue,{sequence:t,summaryOrder:"latest-first"}):h.jsx(mdt,{message:t,isQueued:n,onRemove:r,userMessageUuid:i,onRewindToMessage:a})});function bdt(){return h.jsx("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:h.jsxs("div",{className:"text-muted-foreground space-y-2",children:[h.jsx("p",{className:"text-lg font-medium",children:"Ready to start"}),h.jsx("p",{className:"text-sm",children:"Send a message to start the agent and begin your conversation."})]})})}const ydt=v.memo(function({item:t,index:n,measureElement:r,isQueued:i,onRemove:a,userMessageUuid:s,onRewindToMessage:o}){return h.jsx("div",{ref:r,"data-index":n,className:"pb-2",children:h.jsx(gdt,{item:t,isQueued:i,onRemove:a,userMessageUuid:s,onRewindToMessage:o})})}),vdt=v.memo(function({messages:t,running:n,startingSession:r,loadingSession:i,startingLabel:a="Starting agent...",scrollContainerRef:s,onScroll:o,messagesEndRef:l,isNearBottom:c=!0,queuedMessageIds:d,onRemoveQueuedMessage:f,isCompacting:m=!1,getUuidForMessageId:g,onRewindToMessage:y,initBanner:_}){const S=v.useRef(t.length),w=v.useRef(!1),E=v.useRef(c);E.current=c;const T=v.useMemo(()=>{for(let F=t.length-1;F>=0;F-=1){const P=t[F];if(!P||Sj(P)||!(P.message&&fh(P.message)))continue;const $=P.message.event;if($?.type==="content_block_start"&&$.content_block.type==="thinking")return P.id}return null},[t]),A=vj({count:t.length,getScrollElement:()=>s.current,estimateSize:()=>80,overscan:n?3:5,getItemKey:F=>{const P=t[F];return P?P.id:`missing-message-${F}`}}),O=A.getVirtualItems(),I=A.getTotalSize();v.useEffect(()=>{const F=t.length,P=S.current;if(S.current=F,F>P&&E.current&&s.current){w.current=!0;try{A.scrollToIndex(F-1,{align:"end",behavior:"auto"})}catch{}requestAnimationFrame(()=>{w.current=!1})}},[t.length,A,s]);const N=v.useCallback(()=>{w.current||o?.()},[o]);v.useEffect(()=>{const F=s.current;if(F)return F.addEventListener("scroll",N,{passive:!0}),()=>F.removeEventListener("scroll",N)},[s,N]);const D=_&&_.kind==="info";return i?h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8 gap-4",children:[D&&h.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[h.jsx(un,{className:"h-4 w-4 animate-spin"}),h.jsx("span",{className:"text-sm",children:_.message})]}),h.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[h.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary border-t-transparent"}),h.jsx("span",{className:"text-sm",children:"Loading session..."})]})]}):t.length===0&&!(n||r||D)?h.jsx(bdt,{}):h.jsx(tdt,{lastThinkingMessageId:T,running:n,children:h.jsxs("div",{className:"p-4 min-w-0",children:[h.jsx("div",{style:{height:`${I}px`,width:"100%",position:"relative"},children:O.map(F=>{const P=t[F.index];if(!P)return null;const $=d?.has(P.id)??!1,W="source"in P&&P.source==="user"?g?.(P.id):void 0;return h.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${F.start}px)`},children:h.jsx(ydt,{item:P,index:F.index,measureElement:A.measureElement,isQueued:$,onRemove:$&&f?()=>f(P.id):void 0,userMessageUuid:W,onRewindToMessage:y})},F.key)})}),h.jsx(Vlt,{isCompacting:m,className:"mb-4"}),_&&_.kind==="info"&&h.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground py-4",children:[h.jsx(un,{className:"h-4 w-4 animate-spin"}),h.jsx("span",{className:"text-sm",children:_.message})]}),r&&!n&&h.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground py-4",children:[h.jsx(un,{className:"h-4 w-4 animate-spin"}),h.jsx("span",{className:"text-sm",children:a})]}),n&&h.jsx(hdt,{className:"py-4"}),h.jsx("div",{ref:l,className:"h-px"})]})})});function _dt(e){const[t,n]=v.useState(!0),r=v.useRef(!0),i=v.useRef(!1),a=v.useRef(!1),s=v.useCallback(()=>{i.current||a.current||(a.current=!0,requestAnimationFrame(()=>{a.current=!1;const l=e.current;if(!l)return;const f=l.scrollHeight-l.scrollTop-l.clientHeight<150;f!==r.current&&(r.current=f,n(f))}))},[e]),o=v.useCallback(()=>{const l=e.current;l&&(i.current=!0,n(!0),r.current=!0,l.scrollTo({top:l.scrollHeight,behavior:"smooth"}),setTimeout(()=>{i.current=!1},500))},[e]);return{onScroll:s,isNearBottom:t,scrollToBottom:o}}im(ke(),Ui());const xdt=nn({filePath:ke(),ownerId:ke(),ownerLabel:ke().optional(),acquiredAt:ke(),expiresAt:ke(),metadata:im(ke(),Cu()).optional()});nn({version:Pr(1),workspaceId:ke(),locks:Ya(xdt)});const Sdt=Ya(ke());im(ke(),Ya(ke()));const ude="ff_resume_workspace_ids";function uF(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(ude);if(!e)return[];const t=JSON.parse(e);return Sdt.parse(t)}catch{return[]}}function dde(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ude,JSON.stringify(e))}catch{}}function wdt(e){const t=uF();t.includes(e)||t.push(e);const n=t.slice(-200);dde(n)}function Edt(e){const t=uF().filter(n=>n!==e);dde(t)}function Cdt(e){return uF().includes(e)}function Tdt({workspaceId:e}){const t=Ce.useUtils(),{data:n,isLoading:r}=Ce.workspace.get.useQuery({id:e},{refetchInterval:3e4,staleTime:1e4,refetchOnWindowFocus:!1}),i=v.useCallback(()=>{t.workspace.get.invalidate({id:e})},[t,e]),a=Ce.workspace.syncPRStatus.useMutation({onSuccess:()=>{t.workspace.get.invalidate({id:e})}}),s=v.useRef(!1);v.useEffect(()=>{n?.prUrl&&!s.current&&!a.isPending&&(s.current=!0,a.mutate({workspaceId:e}))},[n?.prUrl,e,a]);const{data:o,isLoading:l}=Ce.session.listSessions.useQuery({workspaceId:e},{refetchInterval:1e4,staleTime:0,refetchOnWindowFocus:!1}),{data:c}=Ce.session.getMaxSessionsPerWorkspace.useQuery(),f=o?.[0]?.id;return{workspace:n,workspaceLoading:r,sessions:o,sessionsLoading:l,initialDbSessionId:f,maxSessions:c,invalidateWorkspace:i}}function kdt({workspaceId:e,slug:t,sessions:n,sendMessage:r,inputRef:i,selectedDbSessionId:a,setSelectedDbSessionId:s,selectedModel:o,selectedProvider:l,isSessionReady:c}){const d=to(),f=Ce.useUtils(),m=v.useRef(null),g=v.useRef(c);v.useEffect(()=>{const $=m.current,W=!g.current&&c;$&&$.dbSessionId===a&&W&&(m.current=null,r($.prompt)),g.current=c},[a,r,c]);const y=Ce.session.createSession.useMutation({onSuccess:$=>{f.session.listSessions.invalidate({workspaceId:e})}}),_=Ce.session.startSession.useMutation(),S=Ce.session.deleteSession.useMutation({onMutate:async({id:$})=>{await f.session.listSessions.cancel({workspaceId:e});const W=f.session.listSessions.getData({workspaceId:e});return f.session.listSessions.setData({workspaceId:e},V=>V?.filter(H=>H.id!==$)),{previousSessions:W}},onError:($,W,V)=>{V?.previousSessions&&f.session.listSessions.setData({workspaceId:e},V.previousSessions)},onSettled:()=>{f.session.listSessions.invalidate({workspaceId:e})}}),w=Ce.workspace.archive.useMutation({onSuccess:()=>{d(`/projects/${t}/workspaces`)}}),E=Ce.workspace.openInIde.useMutation({onError:$=>{Qt.error($.message)}}),{data:T}=Ce.workspace.getAvailableIdes.useQuery(),A=T?.ides??[],O=T?.preferredIde??"cursor",I=v.useCallback($=>{s($),setTimeout(()=>i.current?.focus(),0)},[i,s]),N=v.useCallback($=>{if(!n||n.length===0)return;const W=n.findIndex(H=>H.id===$);if(W===-1)return;const V=$===a;if(S.mutate({id:$}),V&&n.length>1){const H=n[W+1]??n[W-1];s(H?.id??null)}else n.length===1&&s(null)},[n,a,S,s]),D=v.useCallback(()=>{const $=(n??[]).map(V=>{const H=V.name?.match(/^Chat (\d+)$/);return H?Number.parseInt(H[1],10):0}).filter(V=>V>0);return`Chat ${$.length>0?Math.max(...$)+1:1}`},[n]),F=v.useCallback(()=>{const $=D(),W=l,V=W==="CODEX"?void 0:o||void 0;y.mutate({workspaceId:e,workflow:"followup",model:V,name:$,provider:W},{onSuccess:H=>{const z=a;_.mutate({id:H.id,initialPrompt:""},{onSuccess:()=>{s(H.id),setTimeout(()=>i.current?.focus(),0)},onError:M=>{Qt.error(M.message||"Failed to start session"),s(z)}})}})},[y,e,D,_,a,s,i,o,l]),P=v.useCallback(($,W)=>{const V=l,H=V==="CODEX"?void 0:o||void 0,z=a;y.mutate({workspaceId:e,workflow:"followup",name:$,model:H,provider:V},{onSuccess:M=>{_.mutate({id:M.id,initialPrompt:""},{onSuccess:()=>{m.current={dbSessionId:M.id,prompt:W},s(M.id)},onError:G=>{Qt.error(G.message||"Failed to start session"),m.current=null,s(z)}})}})},[y,e,_,a,s,o,l]);return{createSession:y,deleteSession:S,archiveWorkspace:w,openInIde:E,availableIdes:A,preferredIde:O,handleSelectSession:I,handleCloseSession:N,handleNewChat:F,handleQuickAction:P}}function Ndt(e,t,n){const{data:r,isPending:i}=Ce.workspace.getInitStatus.useQuery({id:e},{refetchInterval:d=>{const f=d.state.data?.status;return f==="READY"||f==="FAILED"||f==="ARCHIVED"?!1:1e3}}),a=v.useRef(void 0),s=v.useRef(!1),o=r?.hasWorktreePath??!1;v.useEffect(()=>{const d=r?.status,f=a.current;if(o&&!s.current&&n.workspace.get.invalidate({id:e}),s.current=o,d==="READY"){const m=f!==void 0&&f!=="READY",g=f===void 0&&!t?.worktreePath;(m||g)&&n.workspace.get.invalidate({id:e})}a.current=d},[r?.status,o,e,n,t?.worktreePath]);const c=r?.status==="FAILED"&&o;return{workspaceInitStatus:r,isInitStatusPending:i,isScriptFailed:c}}const Adt="workspace-selected-session-",Rdt=5e3;function Idt({currentSelectedDbSessionId:e,persistedSessionId:t,initialDbSessionId:n,sessionIds:r,pendingSelectionId:i,pendingSelectionSetAtMs:a,nowMs:s=Date.now()}){return r.length===0||i!=null&&e===i&&!r.includes(i)&&a!=null&&s-a<Rdt||e&&r.includes(e)?e:t&&r.includes(t)?t:n&&r.includes(n)?n:r[0]??null}function Odt(e,t,n){const r=`${Adt}${e}`,i=v.useRef({id:null,setAtMs:null}),[a,s]=v.useState(()=>localStorage.getItem(r)??t);v.useEffect(()=>{const l=i.current;l.id&&n.includes(l.id)&&(i.current={id:null,setAtMs:null});const c=localStorage.getItem(r),d=Idt({currentSelectedDbSessionId:a,persistedSessionId:c,initialDbSessionId:t,sessionIds:n,pendingSelectionId:i.current.id,pendingSelectionSetAtMs:i.current.setAtMs});d!==a&&s(d)},[t,a,n,r]);const o=v.useCallback(l=>{i.current={id:l,setAtMs:l?Date.now():null},s(l),l?localStorage.setItem(r,l):localStorage.removeItem(r)},[r]);return{selectedDbSessionId:a,setSelectedDbSessionId:o}}function Ddt({workspaceLoading:e,workspace:t,selectedDbSessionId:n,activeTabId:r,loadingSession:i,inputRef:a}){const s=v.useRef(!1);v.useEffect(()=>{!(s.current||e)&&t&&n&&r==="chat"&&!i&&(s.current=!0,setTimeout(()=>a.current?.focus(),0))},[n,r,i,e,t,a])}function hde(e){const t=Ce.useUtils(),n=Ce.workspace.retryInit.useMutation({onSuccess:()=>{t.workspace.getInitStatus.invalidate({id:e})},onError:i=>{Qt.error(i.message)}});return{retry:v.useCallback(()=>{n.mutate({id:e,useExistingBranch:Cdt(e)||void 0})},[n,e]),retryInit:n}}function Mdt(e,t){return e==="starting"||t}function Ldt({loadingSession:e,stopping:t,displayStartingState:n,running:r,pendingRequest:i,sessionPhase:a,messageCount:s}){return e?"Loading session...":t?"Stopping...":n&&!r?"Agent is starting...":i.type==="permission"&&i.request.toolName==="ExitPlanMode"?"Type feedback to revise the plan...":r?"Message will be queued...":a==="ready"&&s===0?"Type a message to start the agent...":"Type a message..."}function Pdt(e){return e==="error"?"border-red-200 bg-red-50 text-red-900":e==="warning"?"border-yellow-200 bg-yellow-50 text-yellow-900":"border-blue-200 bg-blue-50 text-blue-900"}const Bdt=v.memo(function({banner:t,retryPending:n,onRetry:r,onPlay:i}){const a=t.showRetry||t.showPlay;return h.jsx("div",{className:"px-4 pt-4",children:h.jsxs("div",{className:["rounded-md border p-3 text-sm flex items-start gap-3",Pdt(t.kind)].join(" "),children:[t.kind==="info"?h.jsx(un,{className:"h-4 w-4 mt-0.5 shrink-0 animate-spin"}):h.jsx(hc,{className:"h-4 w-4 mt-0.5 shrink-0"}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{children:t.message}),a&&h.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.showRetry&&h.jsxs(We,{size:"sm",variant:"outline",disabled:n,onClick:r,children:[h.jsx(dc,{className:"h-3.5 w-3.5 mr-1.5"}),"Retry setup"]}),t.showPlay&&h.jsxs(We,{size:"sm",onClick:i,children:[h.jsx(pl,{className:"h-3.5 w-3.5 mr-1.5"}),"Dispatch queued messages"]})]})]})]})})}),jdt=v.memo(function({workspaceId:t,messages:n,sessionStatus:r,messagesEndRef:i,viewportRef:a,isNearBottom:s,scrollToBottom:o,onScroll:l,pendingRequest:c,approvePermission:d,answerQuestion:f,connected:m,sendMessage:g,stopChat:y,inputRef:_,chatSettings:S,chatCapabilities:w,updateSettings:E,inputDraft:T,setInputDraft:A,inputAttachments:O,setInputAttachments:I,queuedMessages:N,removeQueuedMessage:D,resumeQueuedMessages:F,latestThinking:P,pendingMessages:$,isCompacting:W,permissionMode:V,slashCommands:H,slashCommandsLoaded:z,tokenStats:M,rewindPreview:G,startRewindPreview:B,confirmRewind:Q,cancelRewind:q,getUuidForMessageId:Y,acpPlan:K,acpConfigOptions:j,setConfigOption:ee,toolProgress:re,autoStartPending:de=!1,initBanner:le}){const{retry:_e,retryInit:Ae}=hde(t),we=v.useMemo(()=>CZe(n),[n]),Oe=v.useMemo(()=>{for(let rn=we.length-1;rn>=0;rn-=1){const mr=we[rn];if(mr&&Sj(mr))return mr}return null},[we]),Be=v.useMemo(()=>new Set(N.map(rn=>rn.id)),[N]),qe=v.useCallback(()=>{s&&a.current&&a.current.scrollTo({top:a.current.scrollHeight,behavior:"instant"})},[s,a]),At=r.phase==="running",Yt=r.phase==="stopping",qt=Mdt(r.phase,de),In=r.phase==="loading",Kn=w.rewind.enabled,an=c.type==="permission"?c.request.requestId:null,$n=c.type==="permission"&&c.request.toolName==="ExitPlanMode";v.useEffect(()=>{if(!($n&&an))return;const rn=document.activeElement;rn&&rn!==document.body||_?.current?.focus()},[$n,an,_]);const Or=Ldt({loadingSession:In,stopping:Yt,displayStartingState:qt,running:At,pendingRequest:c,sessionPhase:r.phase,messageCount:n.length});return h.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden",children:[h.jsxs("div",{ref:a,className:"flex-1 min-h-0 overflow-y-auto",children:[le&&le.kind!=="info"&&h.jsx(Bdt,{banner:le,retryPending:Ae.isPending,onRetry:_e,onPlay:F}),h.jsx(vdt,{messages:we,running:At,startingSession:qt,loadingSession:In,scrollContainerRef:a,onScroll:l,messagesEndRef:i,isNearBottom:s,queuedMessageIds:Be,onRemoveQueuedMessage:D,isCompacting:W,getUuidForMessageId:Y,onRewindToMessage:Kn?B:void 0,initBanner:le})]}),!s&&h.jsx("div",{className:"absolute bottom-28 left-1/2 -translate-x-1/2 z-10",children:h.jsxs(We,{variant:"secondary",size:"sm",onClick:o,className:"rounded-full shadow-lg",children:[h.jsx(pve,{className:"h-4 w-4 mr-1"}),"Scroll to bottom"]})}),h.jsxs("div",{className:"border-t",children:[h.jsx(sot,{workspaceId:t,running:At,starting:qt,stopping:Yt,permissionMode:V,latestThinking:P??null,latestToolSequence:Oe,acpPlan:K,toolProgress:re}),h.jsx(dct,{permission:c.type==="permission"?c.request:null,onApprove:d}),h.jsx(mct,{question:c.type==="question"?c.request:null,onAnswer:f}),h.jsx(qlt,{onSend:g,onStop:y,disabled:!m||In,running:At,stopping:Yt,inputRef:_,placeholder:Or,settings:S,capabilities:w,onSettingsChange:E,value:T,onChange:A,attachments:O,onAttachmentsChange:I,onHeightChange:qe,pendingMessageCount:$.size,slashCommands:H,slashCommandsLoaded:z,tokenStats:M,workspaceId:t,acpConfigOptions:j,onSetConfigOption:ee})]}),h.jsx(gct,{rewindPreview:G,onConfirm:Q,onCancel:q})]})});function Fdt(){const{rightPanelVisible:e,toggleRightPanel:t}=Do();return h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx(We,{variant:"ghost",size:"icon",onClick:t,className:"h-8 w-8",children:h.jsx(M_e,{className:ne("h-4 w-4",e&&"text-primary")})})}),h.jsx(er,{children:e?"Hide right panel":"Show right panel"})]})}function $dt({workspace:e}){return e.branchName?h.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[h.jsx(l0,{className:"h-3.5 w-3.5 md:h-4 md:w-4 text-muted-foreground shrink-0"}),h.jsx("h1",{className:"text-sm md:text-lg font-semibold font-mono truncate",children:e.branchName})]}):h.jsx("h1",{className:"text-sm md:text-lg font-semibold truncate",children:e.name})}function Udt({workspace:e,hasChanges:t,running:n,isCreatingSession:r,handleQuickAction:i}){return t&&!n&&(e.prState==="NONE"||e.prState==="CLOSED")?h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsxs(We,{variant:"ghost",size:"sm",className:"h-6 gap-1 text-xs px-2",disabled:r,onClick:()=>i("Create Pull Request","Create a pull request for the current branch using the GitHub CLI (gh). Include a clear title and description summarizing the changes."),children:[h.jsx(Cp,{className:"h-3 w-3"}),"Create PR"]})}),h.jsx(er,{children:"Create a pull request for this branch"})]}):e.prUrl&&e.prNumber&&e.prState!=="NONE"&&e.prState!=="CLOSED"?h.jsxs("a",{href:e.prUrl,target:"_blank",rel:"noopener noreferrer",className:`flex items-center gap-1 text-xs hover:opacity-80 transition-opacity ${e.prState==="MERGED"?"text-green-500":"text-muted-foreground hover:text-foreground"}`,children:[h.jsx(Cp,{className:"h-3 w-3"}),"#",e.prNumber,e.prState==="MERGED"&&h.jsx(fl,{className:"h-3 w-3 text-green-500"})]}):null}function zdt({workspace:e}){return!e.prUrl||!e.sidebarStatus?null:h.jsx(Bj,{ciState:e.sidebarStatus.ciState,prState:e.prState,size:"md"})}function Hdt({workspace:e,workspaceId:t}){const n=Ce.useUtils(),r=Ce.workspace.toggleRatcheting.useMutation({onSuccess:()=>{n.workspace.get.invalidate({id:t}),n.workspace.listWithKanbanState.invalidate({projectId:e.projectId}),n.workspace.getProjectSummaryState.invalidate({projectId:e.projectId})}}),i=e.ratchetEnabled??!0;return h.jsx(Z0,{enabled:i,state:e.ratchetState,animated:e.ratchetButtonAnimated??!1,disabled:r.isPending,onToggle:a=>{r.mutate({workspaceId:t,enabled:a})}})}function Wdt({workspace:e,workspaceId:t}){const[n,r]=v.useState(!1),[i,a]=v.useState(Xc(e.defaultSessionProvider)),[s,o]=v.useState(Xc(e.ratchetSessionProvider)),{data:l}=Ce.userSettings.get.useQuery(),c=Ce.useUtils(),d=Ce.workspace.updateProviderDefaults.useMutation({onSuccess:()=>{c.workspace.get.invalidate({id:t}),c.workspace.listWithKanbanState.invalidate({projectId:e.projectId}),c.workspace.getProjectSummaryState.invalidate({projectId:e.projectId}),r(!1)}});v.useEffect(()=>{n&&(a(Xc(e.defaultSessionProvider)),o(Xc(e.ratchetSessionProvider)))},[n,e.defaultSessionProvider,e.ratchetSessionProvider]);const f=Xc(e.defaultSessionProvider),m=Xc(e.ratchetSessionProvider),g=i!==f||s!==m,y=l?.defaultSessionProvider,_=M9("WORKSPACE_DEFAULT",y),S=M9(i,y);return h.jsxs(dv,{open:n,onOpenChange:r,children:[h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx(oue,{asChild:!0,children:h.jsx(We,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"Provider settings",children:h.jsx(Y_e,{className:"h-4 w-4"})})})}),h.jsx(er,{children:"Provider settings"})]}),h.jsxs(Lm,{className:"sm:max-w-[440px]",children:[h.jsxs(hv,{children:[h.jsx(fv,{children:"Session Provider Defaults"}),h.jsx(pv,{children:"Configure workspace defaults and ratchet provider behavior."})]}),h.jsxs("div",{className:"space-y-4 py-2",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(Gr,{htmlFor:"workspace-default-provider",children:"Default Session Provider"}),h.jsxs(mc,{value:i,onValueChange:w=>{a(Xc(w))},children:[h.jsx(yl,{id:"workspace-default-provider",children:h.jsx(Nu,{})}),h.jsxs(vl,{children:[h.jsx(sr,{value:"WORKSPACE_DEFAULT",children:_}),MR.map(w=>h.jsx(sr,{value:w.value,children:w.label},`default-${w.value}`))]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Gr,{htmlFor:"workspace-ratchet-provider",children:"Ratchet Session Provider"}),h.jsxs(mc,{value:s,onValueChange:w=>{o(Xc(w))},children:[h.jsx(yl,{id:"workspace-ratchet-provider",children:h.jsx(Nu,{})}),h.jsxs(vl,{children:[h.jsx(sr,{value:"WORKSPACE_DEFAULT",children:S}),MR.map(w=>h.jsx(sr,{value:w.value,children:w.label},`ratchet-${w.value}`))]})]})]})]}),h.jsxs(tC,{children:[h.jsx(We,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),h.jsx(We,{onClick:()=>{d.mutate({workspaceId:t,defaultSessionProvider:i,ratchetSessionProvider:s})},disabled:!g||d.isPending,children:d.isPending?"Saving...":"Save"})]})]})]})}function Gdt({workspace:e,workspaceId:t,availableIdes:n,preferredIde:r,openInIde:i,archivePending:a,onArchiveRequest:s,handleQuickAction:o,running:l,isCreatingSession:c,hasChanges:d}){return h.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-1 md:gap-2 px-2 py-1.5 md:px-4 md:py-2 border-b",children:[h.jsxs("div",{className:"flex items-center gap-2 md:gap-3 min-w-0",children:[h.jsx($dt,{workspace:e}),h.jsx(fQe,{workspaceId:t}),h.jsx(Udt,{workspace:e,hasChanges:d,running:l,isCreatingSession:c,handleQuickAction:o}),h.jsx(zdt,{workspace:e})]}),h.jsxs("div",{className:"flex items-center justify-end gap-0.5 md:gap-1 shrink-0",children:[h.jsx(Wdt,{workspace:e,workspaceId:t}),h.jsx(Hdt,{workspace:e,workspaceId:t}),h.jsx(vXe,{onExecuteAgent:f=>{f.content&&o(f.name,f.content)},disabled:l||c}),h.jsx(hQe,{workspaceId:t}),n.length>0&&h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx(We,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>i.mutate({id:t}),disabled:i.isPending||!e.worktreePath,children:i.isPending?h.jsx(un,{className:"h-4 w-4 animate-spin"}):h.jsx(dve,{className:"h-4 w-4"})})}),h.jsxs(er,{children:["Open in ",n.find(f=>f.id===r)?.name??"IDE"]})]}),h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx(We,{variant:e.prState==="MERGED"?"default":"ghost",size:"icon",className:ne("h-8 w-8",e.prState==="MERGED"?"":"hover:bg-destructive/10 hover:text-destructive"),onClick:s,disabled:a,children:a?h.jsx(un,{className:"h-4 w-4 animate-spin"}):h.jsx(Kw,{className:"h-4 w-4"})})}),h.jsx(er,{children:a?"Archiving...":"Archive"})]}),h.jsx(Fdt,{})]})]})}function qdt({output:e,className:t,emptyMessage:n="Waiting for output..."}){const r=v.useRef(null);return v.useEffect(()=>{r.current&&e!==null&&(r.current.scrollTop=r.current.scrollHeight)},[e]),h.jsx(wo,{viewportRef:r,className:t,children:h.jsx("pre",{className:"p-2 text-xs font-mono text-zinc-300 whitespace-pre-wrap break-words",children:e||h.jsx("span",{className:"text-zinc-500 italic",children:n})})})}function Vdt({workspaceId:e,initErrorMessage:t,initOutput:n,hasStartupScript:r}){const[i,a]=v.useState(!1),{retry:s,retryInit:o}=hde(e);return h.jsxs("div",{className:"border-b bg-destructive/10 px-4 py-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[h.jsx(hc,{className:"h-3 w-3"}),h.jsxs("span",{children:["Init script failed",t?`: ${t}`:""]})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[r&&n&&h.jsxs(We,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>a(!i),children:[i?h.jsx(Za,{className:"h-3 w-3 mr-1"}):h.jsx(xs,{className:"h-3 w-3 mr-1"}),i?"Hide output":"Show output"]}),h.jsx(We,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:s,disabled:o.isPending,children:o.isPending?h.jsxs(h.Fragment,{children:[h.jsx(un,{className:"h-3 w-3 mr-1 animate-spin"}),"Retrying..."]}):h.jsxs(h.Fragment,{children:[h.jsx(dc,{className:"h-3 w-3 mr-1"}),"Retry"]})})]})]}),i&&r&&h.jsx(qdt,{output:n,className:"mt-2 h-32 w-full rounded-md border bg-zinc-950"})]})}function Ydt(){return h.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-md",children:h.jsxs("div",{className:"flex items-center gap-3 p-8",children:[h.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-muted-foreground/40 border-t-muted-foreground"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Archiving..."})]})})}function Kdt({workspaceId:e,isScriptFailed:t,workspaceInitStatus:n}){return t?h.jsx(Vdt,{workspaceId:e,initErrorMessage:n?.initErrorMessage??null,initOutput:n?.initOutput??null,hasStartupScript:n?.hasStartupScript??!1}):null}function Xdt({workspaceState:e,header:t,sessionTabs:n,chat:r,rightPanelVisible:i,archiveDialog:a}){return e.workspaceLoading?h.jsx(Fh,{message:"Loading workspace..."}):e.workspace?h.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden",children:[t.archivePending&&h.jsx(Ydt,{}),h.jsx(Gdt,{workspace:e.workspace,workspaceId:e.workspaceId,availableIdes:t.availableIdes,preferredIde:t.preferredIde,openInIde:t.openInIde,archivePending:t.archivePending,onArchiveRequest:t.handleArchiveRequest,handleQuickAction:t.handleQuickAction,running:t.running,isCreatingSession:t.isCreatingSession,hasChanges:t.hasChanges}),h.jsx(Kdt,{workspaceId:e.workspaceId,isScriptFailed:e.isScriptFailed,workspaceInitStatus:e.workspaceInitStatus}),h.jsxs(wO,{direction:"horizontal",className:"flex-1 overflow-hidden",autoSaveId:"workspace-main-panel",children:[h.jsx(Ap,{defaultSize:"70%",minSize:"30%",children:h.jsx("div",{className:"h-full flex flex-col min-w-0",children:h.jsx(Ett,{workspaceId:e.workspaceId,sessions:n.sessions,selectedSessionId:n.selectedDbSessionId,sessionSummariesById:n.sessionSummariesById,isCreatingSession:t.isCreatingSession,isDeletingSession:n.isDeletingSession,onSelectSession:n.handleSelectSession,onCreateSession:n.handleNewChat,onCloseSession:n.handleCloseChatSession,maxSessions:n.maxSessions,hasWorktreePath:n.hasWorktreePath,selectedProvider:n.selectedProvider,setSelectedProvider:n.setSelectedProvider,children:h.jsx(jdt,{...r})})})}),i&&h.jsxs(h.Fragment,{children:[h.jsx(EO,{}),h.jsx(Ap,{defaultSize:"30%",minSize:"15%",maxSize:"50%",children:h.jsx("div",{className:"h-full border-l",children:h.jsx(PZe,{workspaceId:e.workspaceId,messages:r.messages,onTakeScreenshots:()=>t.handleQuickAction("Take Screenshots","Take a screenshot of the workspace dev app using Playwright MCP tools. Read factory-factory.json for the scripts.run command, pick a free port, replace {port}, and start the dev server in the background. Once ready, determine the most relevant screen and save a screenshot to .factory-factory/screenshots/ with a descriptive filename.")})})})]})]}),h.jsx(gZ,{open:a.open,onOpenChange:a.setOpen,hasUncommitted:a.hasUncommitted,onConfirm:a.onConfirm})]}):h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[h.jsx("p",{className:"text-destructive",children:"Workspace not found"}),h.jsx(We,{variant:"outline",onClick:e.handleBackToWorkspaces,children:"Back to workspaces"})]})}function Zdt(e,t){if(!e)return!1;const n=e.lastExit,r=t.lastExit,i=n===r||n?.code===r?.code&&n?.timestamp===r?.timestamp&&n?.unexpected===r?.unexpected;return e.phase===t.phase&&e.processState===t.processState&&e.activity===t.activity&&e.updatedAt===t.updatedAt&&i}function Qdt(e,t){if(!t)return!0;const n=Date.parse(e.updatedAt),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?!0:n>=r}function Jdt(e,t,n){const r=new Map((e??[]).map(i=>[i.sessionId,i]));for(const i of t??[]){const a=n.get(i.id);if(!a)continue;const s=r.get(i.id);Qdt(a,s?.updatedAt)&&r.set(i.id,{sessionId:i.id,name:s?.name??i.name??null,workflow:s?.workflow??i.workflow??null,model:s?.model??i.model??null,provider:s?.provider??i.provider,persistedStatus:s?.persistedStatus??i.status,runtimePhase:a.phase,processState:a.processState,activity:a.activity,updatedAt:a.updatedAt,lastExit:a.lastExit??s?.lastExit??null})}return r}function eht(){const{slug:e="",id:t=""}=tm(),n=to(),r=Ce.useUtils(),{workspace:i,workspaceLoading:a,sessions:s,initialDbSessionId:o,maxSessions:l}=Tdt({workspaceId:t}),{rightPanelVisible:c,activeTabId:d,clearScrollState:f}=Do(),{data:m}=Ce.userSettings.get.useQuery(),{data:g}=Ce.workspace.hasChanges.useQuery({workspaceId:t},{enabled:i?.hasHadSessions===!0&&i?.prState==="NONE"}),{workspaceInitStatus:y,isScriptFailed:_}=Ndt(t,i,r);v.useEffect(()=>{const Fe=y?.phase;(Fe==="READY"||Fe==="ARCHIVED")&&Edt(t)},[t,y?.phase]);const S=v.useMemo(()=>s?.map(Fe=>Fe.id)??[],[s]),{selectedDbSessionId:w,setSelectedDbSessionId:E}=Odt(t,o??null,S),[T,A]=v.useState(!1),O=Lae(i?.defaultSessionProvider,m?.defaultSessionProvider),[I,N]=v.useState(O);v.useEffect(()=>{N(O)},[O]);const{data:D}=Ce.workspace.getGitStatus.useQuery({workspaceId:t},{enabled:!!i?.worktreePath,refetchInterval:15e3,staleTime:1e4}),F=D?.hasUncommitted===!0,{messages:P,connected:$,sessionStatus:W,processStatus:V,sessionRuntime:H,pendingRequest:z,chatSettings:M,chatCapabilities:G,inputDraft:B,inputAttachments:Q,queuedMessages:q,removeQueuedMessage:Y,resumeQueuedMessages:K,latestThinking:j,pendingMessages:ee,isCompacting:re,permissionMode:de,slashCommands:le,slashCommandsLoaded:_e,tokenStats:Ae,rewindPreview:we,sendMessage:Oe,stopChat:Be,approvePermission:qe,answerQuestion:At,updateSettings:Yt,setInputDraft:qt,setInputAttachments:In,startRewindPreview:Kn,confirmRewind:an,cancelRewind:$n,getUuidForMessageId:Or,acpPlan:rn,acpConfigOptions:mr,setConfigOption:hn,toolProgress:_r,inputRef:xe,messagesEndRef:je}=Zut({dbSessionId:w}),tt=W.phase==="loading",ut=W.phase==="ready"||W.phase==="running",Lt=i?.creationSource==="GITHUB_ISSUE"&&w!==null&&(W.phase==="loading"||W.phase==="ready")&&V.state==="unknown"&&P.some(Fe=>Fe.source==="user")&&!P.some(Fe=>Fe.source==="agent"),[wn,Un]=v.useState(new Map);v.useEffect(()=>{w&&Un(Fe=>{const Ke=Fe.get(w);if(Zdt(Ke,H))return Fe;const st=new Map(Fe);return st.set(w,H),st})},[w,H]),v.useEffect(()=>{const Fe=new Set(S);Un(Ke=>{let st=!1;const Et=new Map;for(const[mt,sn]of Ke)Fe.has(mt)?Et.set(mt,sn):st=!0;return st?Et:Ke})},[S]);const Mn=v.useMemo(()=>Jdt(i?.sessionSummaries,s,wn),[i?.sessionSummaries,s,wn]),Kt=v.useMemo(()=>Array.from(Mn.values()).some(Fe=>Fe.activity==="WORKING"||Fe.runtimePhase==="running"),[Mn]),{createSession:fn,deleteSession:jt,archiveWorkspace:gr,openInIde:tr,availableIdes:_t,preferredIde:Ot,handleSelectSession:ot,handleCloseSession:lt,handleNewChat:Bt,handleQuickAction:Ue}=kdt({workspaceId:t,slug:e,sessions:s,sendMessage:Oe,inputRef:xe,selectedDbSessionId:w,setSelectedDbSessionId:E,selectedModel:M.selectedModel,selectedProvider:I,isSessionReady:ut}),Xt=v.useCallback(Fe=>{const Ke=Fe;if(Ke.data?.code==="PRECONDITION_FAILED"){Qt.error("Archiving blocked: enable commit before archiving to proceed.");return}Qt.error(Ke.message??"Failed to archive workspace")},[]),St=v.useCallback(Fe=>{gr.mutate({id:t,commitUncommitted:Fe},{onError:Xt})},[gr,Xt,t]),zt=v.useCallback(()=>{if(i?.prState==="MERGED"){St(!0);return}A(!0)},[i?.prState,St]),Ln=v.useCallback(()=>n(`/projects/${e}/workspaces`),[n,e]),Wt=v.useRef(null),Jt=v.useRef(null),{onScroll:xr,isNearBottom:ie,scrollToBottom:ce}=_dt(Wt),pe=v.useCallback(Fe=>{f(`chat-${Fe}`),lt(Fe)},[f,lt]),Ne=w?`chat-${w}`:null,{persistCurrent:$e}=By({tabId:Ne,mode:"chat",viewportRef:Wt,enabled:d==="chat"&&!!Ne,restoreDeps:[P.length,d,Ne],autoStickToBottom:!0,stickToBottomThreshold:150,onRestore:xr});v.useEffect(()=>{const Fe=Jt.current;Fe&&Fe!==w&&$e(`chat-${Fe}`),Jt.current=w},[w,$e]);const at=v.useCallback(()=>{xr(),$e()},[xr,$e]);Ddt({workspaceLoading:a,workspace:i,selectedDbSessionId:w,activeTabId:d,loadingSession:tt,inputRef:xe});const Ze={workspaceId:t,messages:P,sessionStatus:W,messagesEndRef:je,viewportRef:Wt,isNearBottom:ie,scrollToBottom:ce,onScroll:at,pendingRequest:z,approvePermission:qe,answerQuestion:At,connected:$,sendMessage:Oe,stopChat:Be,inputRef:xe,chatSettings:M,chatCapabilities:G,updateSettings:Yt,inputDraft:B,setInputDraft:qt,inputAttachments:Q,setInputAttachments:In,queuedMessages:q,removeQueuedMessage:Y,resumeQueuedMessages:K,latestThinking:j,pendingMessages:ee,isCompacting:re,permissionMode:de,slashCommands:le,slashCommandsLoaded:_e,tokenStats:Ae,rewindPreview:we,startRewindPreview:Kn,confirmRewind:an,cancelRewind:$n,getUuidForMessageId:Or,acpPlan:rn,acpConfigOptions:mr,setConfigOption:hn,toolProgress:_r,autoStartPending:Lt,initBanner:y?.chatBanner??null};return h.jsx(Xdt,{workspaceState:{workspaceLoading:a,workspace:i,workspaceId:t,handleBackToWorkspaces:Ln,isScriptFailed:_,workspaceInitStatus:y},header:{archivePending:gr.isPending,availableIdes:_t,preferredIde:Ot,openInIde:tr,handleArchiveRequest:zt,handleQuickAction:Ue,running:Kt,isCreatingSession:fn.isPending,hasChanges:g},sessionTabs:{sessions:s,selectedDbSessionId:w,sessionSummariesById:Mn,isDeletingSession:jt.isPending,handleSelectSession:ot,handleNewChat:Bt,handleCloseChatSession:pe,maxSessions:l,hasWorktreePath:!!i?.worktreePath,selectedProvider:I,setSelectedProvider:N},chat:Ze,rightPanelVisible:c,archiveDialog:{open:T,setOpen:A,hasUncommitted:F,onConfirm:St}})}function tht(){const{id:e=""}=tm();return h.jsx(oYe,{workspaceId:e,children:h.jsx(v.Suspense,{fallback:h.jsx(Fh,{message:"Loading chat..."}),children:h.jsx(eht,{},e)})})}function II({onClick:e,isCreating:t,children:n="New Workspace"}){return g0()?h.jsx(We,{size:"icon",variant:"outline",className:"h-8 w-8",onClick:e,disabled:t,children:t?h.jsx(un,{className:"h-4 w-4 animate-spin"}):h.jsx(Yd,{className:"h-4 w-4"})}):h.jsxs(We,{size:"sm",onClick:e,disabled:t,children:[t?h.jsx(un,{className:"h-4 w-4 mr-2 animate-spin"}):h.jsx(Yd,{className:"h-4 w-4 mr-2"}),n]})}function nht({open:e,onOpenChange:t,branches:n,isLoading:r,isSubmitting:i,onSelectBranch:a}){return h.jsxs(Mot,{open:e,onOpenChange:t,children:[h.jsx(Lue,{placeholder:"Search branches..."}),h.jsxs(lC,{children:[r&&h.jsx(Yy,{children:"Loading branches..."}),!r&&n.length===0&&h.jsx(Yy,{children:"No branches found."}),!r&&n.length>0&&h.jsx(cC,{heading:"Branches",children:n.map(s=>h.jsxs(uC,{value:s.displayName,onSelect:()=>a(s),disabled:i,children:[h.jsx("span",{className:"font-mono text-sm",children:s.displayName}),s.refType==="remote"&&h.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"remote"})]},s.name))})]})]})}function rht({issue:e,projectId:t,onClick:n}){const r=Ce.useUtils(),{data:i,isLoading:a}=Ce.userSettings.get.useQuery(),[s,o]=v.useState(!1),l=`kanban:issue-ratchet:${t}:${e.number}`;v.useEffect(()=>{if(i?.ratchetEnabled!==void 0){try{const g=window.localStorage.getItem(l);if(g==="true"||g==="false"){o(g==="true");return}}catch{}o(i.ratchetEnabled)}},[l,i?.ratchetEnabled]);const c=Ce.workspace.create.useMutation({onSuccess:g=>{r.workspace.get.setData({id:g.id},y=>y||Lj(g)),r.workspace.listWithKanbanState.invalidate({projectId:t})}}),d=g=>{g.preventDefault(),g.stopPropagation(),c.mutate({type:"GITHUB_ISSUE",projectId:t,issueNumber:e.number,issueUrl:e.url,name:e.title,ratchetEnabled:s})},f=g=>{g.preventDefault(),g.stopPropagation(),window.open(e.url,"_blank","noopener,noreferrer")},m=()=>{n?.()};return h.jsxs(vr,{className:"cursor-pointer hover:border-primary/50 transition-colors overflow-hidden border-dashed",onClick:m,children:[h.jsx(pi,{className:"pb-3",children:h.jsx(mi,{className:"text-sm font-medium leading-tight line-clamp-2",children:e.title})}),h.jsx(Yr,{className:"pt-0",children:h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground min-w-0",children:[h.jsx(Z0,{enabled:s,state:"IDLE",className:"h-5 w-5 shrink-0",stopPropagation:!0,disabled:a||c.isPending,onToggle:g=>{o(g);try{window.localStorage.setItem(l,String(g))}catch{}}}),h.jsxs("button",{type:"button",onClick:f,className:"inline-flex items-center gap-1 hover:text-foreground shrink-0",children:[h.jsx(Mq,{className:"h-3 w-3 text-green-500"}),h.jsxs("span",{children:["#",e.number]})]}),h.jsxs("span",{className:"inline-flex items-center gap-1 truncate",children:[h.jsx(Xq,{className:"h-3 w-3 shrink-0"}),e.author.login]})]}),h.jsxs(We,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs shrink-0",onClick:d,disabled:c.isPending||a,children:[h.jsx(pl,{className:"h-3 w-3 mr-1"}),c.isPending?"...":"Start"]})]})})]})}function iht({issue:e,projectId:t,open:n,onOpenChange:r}){const i=Ce.useUtils(),{data:a,isLoading:s}=Ce.userSettings.get.useQuery(),[o,l]=v.useState(!1),{data:c,isLoading:d,refetch:f}=Ce.github.getIssue.useQuery({projectId:t,issueNumber:e?.number??0},{enabled:n&&!!e}),m=c?.issue,g=e?`kanban:issue-ratchet:${t}:${e.number}`:"";v.useEffect(()=>{if(!(!e||a?.ratchetEnabled===void 0)){try{const w=window.localStorage.getItem(g);if(w==="true"||w==="false"){l(w==="true");return}}catch{}l(a.ratchetEnabled)}},[g,a?.ratchetEnabled,e]);const y=Ce.workspace.create.useMutation({onSuccess:()=>{r(!1),i.workspace.listWithKanbanState.invalidate({projectId:t})}}),_=()=>{e&&y.mutate({type:"GITHUB_ISSUE",projectId:t,issueNumber:e.number,issueUrl:e.url,name:e.title,ratchetEnabled:o})},S=()=>{e&&window.open(e.url,"_blank","noopener,noreferrer")};return v.useEffect(()=>{n&&e&&f()},[e,n,f]),h.jsx(NO,{open:n,onOpenChange:r,children:h.jsx(lE,{side:"right",className:"w-full sm:max-w-2xl flex flex-col p-0",children:e?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[h.jsx(cE,{className:"pb-4",children:h.jsx("div",{className:"flex items-start justify-between gap-4",children:h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx(uE,{className:"text-xl leading-tight pr-8",children:e.title}),h.jsxs(dE,{className:"flex items-center gap-2 text-xs mt-2",children:[h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx(Mq,{className:"h-3 w-3 text-green-500"}),h.jsxs("span",{children:["#",e.number]})]}),h.jsx("span",{children:"•"}),h.jsxs("span",{className:"inline-flex items-center gap-1",children:[h.jsx(Xq,{className:"h-3 w-3"}),e.author.login]}),h.jsx("span",{children:"•"}),h.jsx("span",{children:new Date(e.createdAt).toLocaleDateString()})]})]})})}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-sm font-semibold mb-2",children:"Description"}),d?h.jsxs("div",{className:"space-y-2",children:[h.jsx(ei,{className:"h-4 w-full"}),h.jsx(ei,{className:"h-4 w-3/4"}),h.jsx(ei,{className:"h-4 w-5/6"})]}):m?.body?h.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:h.jsx(Rh,{content:m.body})}):h.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No description provided."})]})]}),h.jsxs("div",{className:"border-t p-4 space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Z0,{enabled:o,state:"IDLE",className:"h-6 w-6 shrink-0",stopPropagation:!1,disabled:s||y.isPending,onToggle:w=>{l(w);try{window.localStorage.setItem(g,String(w))}catch{}}}),h.jsx("span",{className:"text-xs text-muted-foreground",children:o?"Ratcheting enabled":"Ratcheting disabled"})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(We,{onClick:S,variant:"outline",children:[h.jsx(Xw,{className:"h-4 w-4 mr-2"}),"Open in GitHub"]}),h.jsxs(We,{onClick:_,disabled:y.isPending||s,className:"flex-1",children:[h.jsx(pl,{className:"h-4 w-4 mr-2"}),y.isPending?"Starting...":"Start Issue"]})]})]})]}):h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("p",{className:"text-muted-foreground",children:"No issue selected"})})})})}function aht({isArchived:e,isWorking:t,status:n,errorMessage:r}){return e?h.jsxs(gn,{variant:"outline",className:"shrink-0 text-[10px] gap-1",children:[h.jsx(Kw,{className:"h-2.5 w-2.5"}),"Archived"]}):t?h.jsxs("span",{className:"flex items-center gap-1 text-xs text-brand shrink-0",children:[h.jsx("span",{className:"h-2 w-2 rounded-full bg-brand animate-pulse"}),"Working"]}):h.jsx(Mj,{status:n,errorMessage:r})}function sht({type:e}){return e==="plan_approval"?h.jsxs(gn,{variant:"outline",className:"text-[10px] gap-1 bg-amber-500/10 text-amber-700 dark:text-amber-400 border-amber-500/30",children:[h.jsx(jq,{className:"h-2.5 w-2.5"}),"Plan Approval Needed"]}):h.jsxs(gn,{variant:"outline",className:"text-[10px] gap-1 bg-blue-500/10 text-blue-700 dark:text-blue-400 border-blue-500/30",children:[h.jsx(Gq,{className:"h-2.5 w-2.5"}),"Question Waiting"]})}function oht({workspace:e,ratchetEnabled:t,isTogglePending:n,isArchived:r,onToggleRatcheting:i,showPR:a}){return h.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground min-w-0",children:[h.jsx(Z0,{enabled:t,state:e.ratchetState,animated:e.ratchetButtonAnimated??!1,className:"h-5 w-5 shrink-0",disabled:n||r||!i,stopPropagation:!0,onToggle:s=>{i?.(e.id,s)}}),e.branchName&&h.jsxs(h.Fragment,{children:[h.jsx(l0,{className:"h-3 w-3 shrink-0"}),h.jsx("span",{className:"font-mono truncate",children:e.branchName})]}),a&&h.jsxs("button",{type:"button",onClick:s=>{s.preventDefault(),s.stopPropagation(),window.open(e.prUrl,"_blank","noopener,noreferrer")},className:"ml-auto inline-flex items-center gap-1 text-muted-foreground hover:text-foreground",children:[h.jsx(Cp,{className:"h-3 w-3"}),h.jsxs("span",{children:["#",e.prNumber]})]})]})}function lht({workspace:e,projectSlug:t,onToggleRatcheting:n,isTogglePending:r=!1}){const i=!!(e.prState!=="NONE"&&e.prNumber&&e.prUrl),a=e.isArchived||e.status==="ARCHIVED",s=e.ratchetEnabled??!0,o=jle({isWorking:e.isWorking,prUrl:e.prUrl??null,prState:e.prState??null,prCiStatus:e.prCiStatus??null,ratchetState:e.ratchetState??null});return h.jsx(Ar,{to:`/projects/${t}/workspaces/${e.id}`,children:h.jsxs(vr,{className:ne("cursor-pointer hover:border-primary/50 transition-colors overflow-hidden",e.isWorking&&"border-brand/50 bg-brand/5",a&&"opacity-60 border-dashed"),children:[h.jsx(pi,{className:"pb-3",children:h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsx(mi,{className:"text-sm font-medium leading-tight line-clamp-2",children:e.name}),h.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.runScriptStatus==="RUNNING"&&h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx("span",{children:h.jsx(pl,{className:"h-3 w-3 text-green-500 fill-green-500 animate-pulse"})})}),h.jsx(er,{children:"Dev server running"})]}),h.jsx(aht,{isArchived:a,isWorking:e.isWorking,status:e.status,errorMessage:e.initErrorMessage})]})]})}),h.jsxs(Yr,{className:"space-y-2",children:[h.jsx(oht,{workspace:e,ratchetEnabled:s,isTogglePending:r,isArchived:a,onToggleRatcheting:n,showPR:i}),o.ciState!=="NONE"&&h.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:h.jsx(Bj,{ciState:o.ciState,prState:e.prState,size:"sm"})}),e.pendingRequestType&&h.jsx("div",{className:"flex items-center gap-2",children:h.jsx(sht,{type:e.pendingRequestType})}),e.description&&h.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.description})]})]})})}const OW=[{id:"ISSUES",label:"GitHub Issues",description:"Issues assigned to you"},{id:"WORKING",label:"Working",description:"Agent is working"},{id:"WAITING",label:"Waiting",description:"Waiting for input"},{id:"DONE",label:"Done",description:"PR merged"}];function cht({column:e,workspaces:t,projectSlug:n,onToggleRatcheting:r,togglingWorkspaceId:i}){const a=t.length===0;return h.jsxs("div",{className:"flex flex-col w-full md:w-[380px] md:shrink-0 md:h-full",children:[h.jsx("div",{className:"flex items-center justify-between px-2 py-3 bg-muted/30 rounded-t-lg",children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h3",{className:"font-semibold text-sm",children:e.label}),h.jsx(gn,{variant:"secondary",className:"h-5 min-w-5 justify-center text-xs",children:t.length})]})}),h.jsx("div",{className:"flex flex-col gap-3 flex-1 overflow-y-auto p-3 min-h-0 rounded-b-lg bg-muted/30",children:a?h.jsx("div",{className:"flex items-center justify-center h-[60px] md:h-[150px] text-muted-foreground text-sm",children:e.description}):t.map(s=>h.jsx("div",{className:"shrink-0",children:h.jsx(lht,{workspace:s,projectSlug:n,onToggleRatcheting:r,isTogglePending:i===s.id})},s.id))})]})}const fde=v.createContext(null);function pde(){const e=v.useContext(fde);if(!e)throw new Error("useKanban must be used within a KanbanProvider");return e}function uht({projectId:e,projectSlug:t,children:n}){const r=Ce.useUtils(),{data:i,isLoading:a,isError:s,error:o,refetch:l}=Ce.workspace.listWithKanbanState.useQuery({projectId:e},{refetchInterval:3e4,staleTime:25e3}),{data:c,isLoading:d,refetch:f}=Ce.github.listIssuesForProject.useQuery({projectId:e},{refetchInterval:6e4,staleTime:3e4}),m=Ce.workspace.syncAllPRStatuses.useMutation(),g=Ce.workspace.toggleRatcheting.useMutation(),[y,_]=v.useState(null),S=async()=>{await m.mutateAsync({projectId:e}),l(),f()},w=async(A,O)=>{_(A);try{await g.mutateAsync({workspaceId:A,enabled:O}),await Promise.all([l(),r.workspace.getProjectSummaryState.invalidate({projectId:e}),r.workspace.get.invalidate({id:A})])}finally{_(null)}},E=()=>{l(),f()},T=v.useMemo(()=>{if(!c?.issues)return;if(!i)return c.issues;const A=new Set(i.map(O=>O.githubIssueNumber).filter(O=>O!==null));return c.issues.filter(O=>!A.has(O.number))},[c?.issues,i]);return h.jsx(fde.Provider,{value:{projectId:e,projectSlug:t,workspaces:i,issues:T,isLoading:a||d,isError:s,error:o?{message:o.message}:null,refetch:E,syncAndRefetch:S,isSyncing:m.isPending,toggleWorkspaceRatcheting:w,togglingWorkspaceId:y},children:n})}function dht(){const{syncAndRefetch:e,isSyncing:t}=pde();return h.jsx(We,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>e(),disabled:t,children:h.jsx(dc,{className:ne("h-4 w-4",t&&"animate-spin")})})}function hht(){const{projectId:e,projectSlug:t,workspaces:n,issues:r,isLoading:i,isError:a,error:s,refetch:o,toggleWorkspaceRatcheting:l,togglingWorkspaceId:c}=pde(),d=v.useMemo(()=>{const f={WORKING:[],WAITING:[],DONE:[]};if(n)for(const m of n){const g=m.kanbanColumn;g in f&&f[g].push(m)}return f},[n]);return i?h.jsx("div",{className:"flex flex-col md:flex-row gap-3 md:gap-4 pb-4 h-full overflow-y-auto md:overflow-y-hidden md:overflow-x-auto",children:OW.map(f=>h.jsxs("div",{className:"flex flex-col w-full md:w-[380px] md:shrink-0 md:h-full",children:[h.jsx(ei,{className:"h-10 w-full rounded-t-lg rounded-b-none"}),h.jsx(ei,{className:"flex-1 w-full rounded-b-lg rounded-t-none"})]},f.id))}):a?h.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[h.jsxs("p",{className:"text-destructive mb-4",children:["Failed to load workspaces: ",s?.message??"Unknown error"]}),h.jsxs(We,{variant:"outline",onClick:()=>o(),children:[h.jsx(dc,{className:"h-4 w-4 mr-2"}),"Retry"]})]}):h.jsx("div",{className:"flex flex-col md:flex-row gap-3 md:gap-4 pb-4 h-full overflow-y-auto md:overflow-y-hidden md:overflow-x-auto",children:OW.map(f=>{if(f.id==="ISSUES")return h.jsx(fht,{column:f,issues:r??[],projectId:e},f.id);const m=d[f.id]??[];return h.jsx(cht,{column:f,workspaces:m,projectSlug:t,onToggleRatcheting:l,togglingWorkspaceId:c},f.id)})})}function fht({column:e,issues:t,projectId:n}){const r=t.length===0,[i,a]=v.useState(null),[s,o]=v.useState(!1),l=d=>{a(d),o(!0)},c=d=>{o(d),d||a(null)};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex flex-col w-full md:w-[380px] md:shrink-0 md:h-full",children:[h.jsx("div",{className:"flex items-center justify-between px-2 py-3 bg-muted/30 rounded-t-lg",children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h3",{className:"font-semibold text-sm",children:e.label}),h.jsx(gn,{variant:"secondary",className:"h-5 min-w-5 justify-center text-xs",children:t.length})]})}),h.jsx("div",{className:"flex flex-col gap-3 flex-1 overflow-y-auto p-3 min-h-0 rounded-b-lg bg-muted/30",children:r?h.jsx("div",{className:"flex items-center justify-center h-[60px] md:h-[150px] text-muted-foreground text-sm",children:e.description}):t.map(d=>h.jsx("div",{className:"shrink-0",children:h.jsx(rht,{issue:d,projectId:n,onClick:()=>l(d)})},d.number))})]}),h.jsx(iht,{issue:i,projectId:n,open:s,onOpenChange:c})]})}function mde({onClick:e}){return g0()?null:h.jsxs(We,{variant:"outline",size:"sm",onClick:e,children:[h.jsx(l0,{className:"h-4 w-4 mr-2"}),"Resume branch"]})}var ed="ToggleGroup",[gde]=Ai(ed,[Zu]),bde=Zu(),dF=he.forwardRef((e,t)=>{const{type:n,...r}=e;if(n==="single"){const i=r;return h.jsx(pht,{...i,ref:t})}if(n==="multiple"){const i=r;return h.jsx(mht,{...i,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${ed}\``)});dF.displayName=ed;var[yde,vde]=gde(ed),pht=he.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[s,o]=Na({prop:n,defaultProp:r??"",onChange:i,caller:ed});return h.jsx(yde,{scope:e.__scopeToggleGroup,type:"single",value:he.useMemo(()=>s?[s]:[],[s]),onItemActivate:o,onItemDeactivate:he.useCallback(()=>o(""),[o]),children:h.jsx(_de,{...a,ref:t})})}),mht=he.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[s,o]=Na({prop:n,defaultProp:r??[],onChange:i,caller:ed}),l=he.useCallback(d=>o((f=[])=>[...f,d]),[o]),c=he.useCallback(d=>o((f=[])=>f.filter(m=>m!==d)),[o]);return h.jsx(yde,{scope:e.__scopeToggleGroup,type:"multiple",value:s,onItemActivate:l,onItemDeactivate:c,children:h.jsx(_de,{...a,ref:t})})});dF.displayName=ed;var[ght,bht]=gde(ed),_de=he.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:s,loop:o=!0,...l}=e,c=bde(n),d=wh(s),f={role:"group",dir:d,...l};return h.jsx(ght,{scope:n,rovingFocus:i,disabled:r,children:i?h.jsx(M1,{asChild:!0,...c,orientation:a,dir:d,loop:o,children:h.jsx(yt.div,{...f,ref:t})}):h.jsx(yt.div,{...f,ref:t})})}),Lw="ToggleGroupItem",xde=he.forwardRef((e,t)=>{const n=vde(Lw,e.__scopeToggleGroup),r=bht(Lw,e.__scopeToggleGroup),i=bde(e.__scopeToggleGroup),a=n.value.includes(e.value),s=r.disabled||e.disabled,o={...e,pressed:a,disabled:s},l=he.useRef(null);return r.rovingFocus?h.jsx(L1,{asChild:!0,...i,focusable:!s,active:a,ref:l,children:h.jsx(DW,{...o,ref:t})}):h.jsx(DW,{...o,ref:t})});xde.displayName=Lw;var DW=he.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:r,...i}=e,a=vde(Lw,n),s={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},o=a.type==="single"?s:void 0;return h.jsx(lF,{...o,...i,ref:t,onPressedChange:l=>{l?a.onItemActivate(r):a.onItemDeactivate(r)}})}),Sde=dF,wde=xde;const Ede=v.createContext({size:"default",variant:"default"}),Cde=v.forwardRef(({className:e,variant:t,size:n,children:r,...i},a)=>h.jsx(Sde,{ref:a,className:ne("flex items-center justify-center gap-1",e),...i,children:h.jsx(Ede.Provider,{value:{variant:t,size:n},children:r})}));Cde.displayName=Sde.displayName;const OI=v.forwardRef(({className:e,children:t,variant:n,size:r,...i},a)=>{const s=v.useContext(Ede);return h.jsx(wde,{ref:a,className:ne(Hue({variant:s.variant||n,size:s.size||r}),e),...i,children:t})});OI.displayName=wde.displayName;function Tde({viewMode:e,onViewModeChange:t}){return h.jsxs(Cde,{type:"single",value:e,onValueChange:n=>n&&t(n),size:"sm",children:[h.jsx(OI,{value:"board","aria-label":"Board view",children:h.jsx(Hq,{className:"h-4 w-4"})}),h.jsx(OI,{value:"list","aria-label":"List view",children:h.jsx(w_e,{className:"h-4 w-4"})})]})}function yht({projectId:e,slug:t,viewMode:n,onViewModeChange:r,onResumeOpen:i,onCreateWorkspace:a,isCreatingWorkspace:s,resumeDialog:o}){return h.jsx(uht,{projectId:e,projectSlug:t,children:h.jsxs("div",{className:"flex flex-col h-full p-3 md:p-6 gap-3 md:gap-4",children:[h.jsxs(X1,{title:"Workspaces",children:[h.jsx(dht,{}),h.jsx(Tde,{viewMode:n,onViewModeChange:r}),h.jsx(mde,{onClick:i}),h.jsx(II,{onClick:a,isCreating:s})]}),h.jsx("div",{className:"flex-1 min-h-0",children:h.jsx(hht,{})}),o]})})}function vht({className:e,...t}){return h.jsx("div",{"data-slot":"empty",className:ne("flex min-w-0 flex-1 flex-col items-center justify-center gap-3 text-balance rounded-lg border-dashed p-3 text-center md:p-6",e),...t})}function _ht({className:e,...t}){return h.jsx("div",{"data-slot":"empty-header",className:ne("flex max-w-sm flex-col items-center gap-2 text-center",e),...t})}function xht({className:e,...t}){return h.jsx("div",{"data-slot":"empty-title",className:ne("text-lg font-medium tracking-tight",e),...t})}function Sht({className:e,...t}){return h.jsx("div",{"data-slot":"empty-description",className:ne("text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4",e),...t})}function kde({ciStatus:e,prUrl:t,size:n="sm"}){if(e!=="FAILURE")return null;const r=n==="sm"?"h-3.5 w-3.5":"h-4 w-4";return h.jsx(Uu,{children:h.jsxs(cr,{children:[h.jsx(ur,{asChild:!0,children:h.jsx("span",{className:"inline-flex items-center",children:h.jsx(hc,{className:`${r} text-destructive`})})}),h.jsxs(er,{children:[h.jsx("p",{className:"text-sm",children:"CI checks are failing"}),t&&h.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Check the PR for details"})]})]})})}const wht=["NEW","PROVISIONING","READY","FAILED","ARCHIVED"];function Eht({workspace:e,slug:t}){return h.jsx(Ar,{to:`/projects/${t}/workspaces/${e.id}`,className:"block",children:h.jsx(vr,{className:"p-3 hover:border-primary/50 transition-colors",children:h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"font-medium text-sm truncate",children:e.name}),h.jsx(kde,{ciStatus:e.prCiStatus,prUrl:e.prUrl,size:"sm"})]}),e.branchName&&h.jsxs("div",{className:"flex items-center gap-1 mt-1 text-xs text-muted-foreground font-mono truncate",children:[h.jsx(l0,{className:"h-3 w-3 shrink-0"}),h.jsx("span",{className:"truncate",children:e.branchName})]})]}),h.jsx(Mj,{status:e.status,errorMessage:e.initErrorMessage})]})})})}function Cht({workspaces:e,isLoading:t,slug:n,statusFilter:r,onStatusFilterChange:i,viewMode:a,onViewModeChange:s,onResumeOpen:o,onCreateWorkspace:l,isCreatingWorkspace:c,resumeDialog:d}){const f=g0();return h.jsxs("div",{className:"space-y-4 p-3 md:p-6",children:[h.jsxs(X1,{title:"Workspaces",children:[h.jsxs(mc,{value:r,onValueChange:i,children:[h.jsx(yl,{className:"w-[150px]",children:h.jsx(Nu,{placeholder:"All Statuses"})}),h.jsxs(vl,{children:[h.jsx(sr,{value:"all",children:"All Statuses"}),wht.map(m=>h.jsx(sr,{value:m,children:Gnt(m)},m))]})]}),h.jsx(Tde,{viewMode:a,onViewModeChange:s}),h.jsx(mde,{onClick:o}),h.jsx(II,{onClick:l,isCreating:c})]}),t?h.jsx(vr,{children:h.jsx(Fh,{message:"Loading workspaces..."})}):!e||e.length===0?h.jsx(vr,{children:h.jsxs(vht,{className:"py-12",children:[h.jsxs(_ht,{children:[h.jsx(xht,{children:"No workspaces found"}),h.jsx(Sht,{children:"Get started by creating your first workspace."})]}),h.jsx(II,{onClick:l,isCreating:c,children:"Create your first workspace"})]})}):f?h.jsx("div",{className:"flex flex-col gap-2",children:e.map(m=>h.jsx(Eht,{workspace:m,slug:n},m.id))}):h.jsx(vr,{children:h.jsxs(Wp,{children:[h.jsx(Gp,{children:h.jsxs(ys,{children:[h.jsx(Jn,{children:"Name"}),h.jsx(Jn,{children:"Status"}),h.jsx(Jn,{children:"Sessions"}),h.jsx(Jn,{children:"Branch"}),h.jsx(Jn,{children:"Created"}),h.jsx(Jn,{className:"text-right",children:"Actions"})]})}),h.jsx(qp,{children:e.map(m=>h.jsxs(ys,{children:[h.jsxs(Wn,{children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Ar,{to:`/projects/${n}/workspaces/${m.id}`,className:"font-medium hover:underline",children:m.name}),h.jsx(kde,{ciStatus:m.prCiStatus,prUrl:m.prUrl,size:"sm"})]}),m.description&&h.jsx("p",{className:"text-sm text-muted-foreground truncate max-w-md",children:m.description.length>100?`${m.description.slice(0,100)}...`:m.description})]}),h.jsxs(Wn,{children:[h.jsx(Mj,{status:m.status,errorMessage:m.initErrorMessage}),m.status==="READY"&&h.jsx("span",{className:"text-xs text-muted-foreground",children:"Ready"}),m.status==="ARCHIVED"&&h.jsx("span",{className:"text-xs text-muted-foreground",children:"Archived"})]}),h.jsxs(Wn,{className:"text-muted-foreground",children:[m.agentSessions?.length??0," sessions"]}),h.jsx(Wn,{className:"text-muted-foreground font-mono text-sm",children:m.branchName||"-"}),h.jsx(Wn,{className:"text-muted-foreground",children:new Date(m.createdAt).toLocaleDateString()}),h.jsx(Wn,{className:"text-right",children:h.jsx(We,{variant:"ghost",size:"sm",asChild:!0,children:h.jsx(Ar,{to:`/projects/${n}/workspaces/${m.id}`,children:"View"})})})]},m.id))})]})}),d]})}function Tht(e,t){const n=e.trim();if(!n)return Pj(t);if(!t.includes(n))return n;let r=1,i=`${n}-${r}`;for(;t.includes(i);)r+=1,i=`${n}-${r}`;return i}function kht(){const{slug:e=""}=tm(),t=to(),[n,r]=v.useState("all"),[i,a]=v.useState("board"),[s,o]=v.useState(!1),{data:l}=Ce.project.getBySlug.useQuery({slug:e}),{handleCreate:c,isCreating:d,existingNames:f}=Rle(l?.id,e),m=()=>{c().catch(()=>{})},g=Ce.useUtils(),y=Ce.workspace.create.useMutation(),{data:_,isLoading:S}=Ce.project.listBranches.useQuery({projectId:l?.id??""},{enabled:s&&!!l?.id}),{data:w,isLoading:E}=Ce.workspace.list.useQuery({projectId:l?.id??"",status:n!=="all"?n:void 0},{enabled:!!l?.id&&i==="list",refetchInterval:6e4,staleTime:5e4});if(!l)return h.jsx(Fh,{message:"Loading project..."});const T=_?.branches??[],A=async I=>{if(!l?.id||y.isPending)return;const N=Tht(I.displayName,f);try{const D=await y.mutateAsync({type:"RESUME_BRANCH",projectId:l.id,branchName:I.name,name:N});wdt(D.id),g.workspace.list.invalidate({projectId:l.id}),g.workspace.getProjectSummaryState.invalidate({projectId:l.id}),o(!1),t(`/projects/${e}/workspaces/${D.id}`)}catch(D){const F=D instanceof Error?D.message:"Unknown error";Qt.error(`Failed to resume branch: ${F}`)}},O=h.jsx(nht,{open:s,onOpenChange:o,branches:T,isLoading:S,isSubmitting:y.isPending,onSelectBranch:A});return i==="board"?h.jsx(yht,{projectId:l.id,slug:e,viewMode:i,onViewModeChange:a,onResumeOpen:()=>o(!0),onCreateWorkspace:m,isCreatingWorkspace:d,resumeDialog:O}):h.jsx(Cht,{workspaces:w,isLoading:E,slug:e,statusFilter:n,onStatusFilterChange:r,viewMode:i,onViewModeChange:a,onResumeOpen:()=>o(!0),onCreateWorkspace:m,isCreatingWorkspace:d,resumeDialog:O})}function Nht(){const{slug:e=""}=tm(),t=to(),[n,r]=v.useState(""),[i,a]=v.useState(""),[s,o]=v.useState(""),[l,c]=v.useState(""),{data:d}=Ce.project.getBySlug.useQuery({slug:e}),{data:f}=Ce.workspace.getFactoryConfig.useQuery({projectId:d?.id??""},{enabled:!!d?.id}),m=Ce.useUtils(),g=Ce.workspace.create.useMutation({onSuccess:_=>{m.workspace.get.setData({id:_.id},S=>S||Lj(_)),t(`/projects/${e}/workspaces/${_.id}`)},onError:_=>{c(_.message)}}),y=_=>{if(_.preventDefault(),c(""),!d?.id){c("Project not found");return}if(!n.trim()){c("Name is required");return}g.mutate({type:"MANUAL",projectId:d.id,name:n,description:i||void 0,branchName:s||void 0})};return d?h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx(We,{variant:"ghost",size:"icon",asChild:!0,children:h.jsx(Ar,{to:`/projects/${e}/workspaces`,children:h.jsx(aO,{className:"h-5 w-5"})})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Create New Workspace"}),h.jsx("p",{className:"text-muted-foreground mt-1",children:d.name})]})]}),f&&h.jsx(Yle,{factoryConfig:f,variant:"alert"}),h.jsx(vr,{children:h.jsx(Yr,{className:"pt-6",children:h.jsxs("form",{onSubmit:y,className:"space-y-4",children:[l&&h.jsx(av,{variant:"destructive",children:h.jsx(sv,{children:l})}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs(Gr,{htmlFor:"name",children:["Name ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(vo,{id:"name",value:n,onChange:_=>r(_.target.value),placeholder:"E.g., Feature Development",autoFocus:!0})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Gr,{htmlFor:"description",children:"Description"}),h.jsx(ym,{id:"description",value:i,onChange:_=>a(_.target.value),rows:3,placeholder:"Brief description of what this workspace is for"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Gr,{htmlFor:"branchName",children:"Branch Name"}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Git branch for this workspace (optional)"}),h.jsx(vo,{id:"branchName",value:s,onChange:_=>o(_.target.value),placeholder:"E.g., feature/my-feature",className:"font-mono"})]}),h.jsxs("div",{className:"flex justify-end gap-4",children:[h.jsx(We,{variant:"outline",asChild:!0,disabled:g.isPending,children:h.jsx(Ar,{to:`/projects/${e}/workspaces`,children:"Cancel"})}),h.jsxs(We,{type:"submit",disabled:g.isPending,children:[g.isPending&&h.jsx(Du,{className:"mr-2 h-4 w-4"}),g.isPending?"Creating...":"Create Workspace"]})]})]})})})]}):h.jsx(Fh,{message:"Loading..."})}function Aht(e){const t=String(e),n=[];return{toOffset:i,toPoint:r};function r(a){if(typeof a=="number"&&a>-1&&a<=t.length){let s=0;for(;;){let o=n[s];if(o===void 0){const l=MW(t,n[s-1]);o=l===-1?t.length+1:l+1,n[s]=o}if(o>a)return{line:s+1,column:a-(s>0?n[s-1]:0)+1,offset:a};s++}}}function i(a){if(a&&typeof a.line=="number"&&typeof a.column=="number"&&!Number.isNaN(a.line)&&!Number.isNaN(a.column)){for(;n.length<a.line;){const o=n[n.length-1],l=MW(t,o),c=l===-1?t.length+1:l+1;if(o===c)break;n.push(c)}const s=(a.line>1?n[a.line-2]:0)+a.column-1;if(s<n[a.line-1])return s}}}function MW(e,t){const n=e.indexOf("\r",t),r=e.indexOf(`
|
|
447
447
|
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const Ud={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},Nde={}.hasOwnProperty,Rht=Object.prototype;function Iht(e,t){const n=t||{};return hF({file:n.file||void 0,location:!1,schema:n.space==="svg"?Yu:M0,verbose:n.verbose||!1},e)}function hF(e,t){let n;switch(t.nodeName){case"#comment":{const r=t;return n={type:"comment",value:r.data},dS(e,r,n),n}case"#document":case"#document-fragment":{const r=t,i="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:Ade(e,t.childNodes),data:{quirksMode:i}},e.file&&e.location){const a=String(e.file),s=Aht(a),o=s.toPoint(0),l=s.toPoint(a.length);n.position={start:o,end:l}}return n}case"#documentType":{const r=t;return n={type:"doctype"},dS(e,r,n),n}case"#text":{const r=t;return n={type:"text",value:r.value},dS(e,r,n),n}default:return n=Oht(e,t),n}}function Ade(e,t){let n=-1;const r=[];for(;++n<t.length;){const i=hF(e,t[n]);r.push(i)}return r}function Oht(e,t){const n=e.schema;e.schema=t.namespaceURI===Ud.svg?Yu:M0;let r=-1;const i={};for(;++r<t.attrs.length;){const o=t.attrs[r],l=(o.prefix?o.prefix+":":"")+o.name;Nde.call(Rht,l)||(i[l]=o.value)}const s=(e.schema.space==="svg"?_Ve:uae)(t.tagName,i,Ade(e,t.childNodes));if(dS(e,t,s),s.tagName==="template"){const o=t,l=o.sourceCodeLocation,c=l&&l.startTag&&ep(l.startTag),d=l&&l.endTag&&ep(l.endTag),f=hF(e,o.content);c&&d&&e.file&&(f.position={start:c.end,end:d.start}),s.content=f}return e.schema=n,s}function dS(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){const r=Dht(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function Dht(e,t,n){const r=ep(n);if(t.type==="element"){const i=t.children[t.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),e.verbose){const a={};let s;if(n.attrs)for(s in n.attrs)Nde.call(n.attrs,s)&&(a[a1(e.schema,s).property]=ep(n.attrs[s]));n.startTag;const o=ep(n.startTag),l=n.endTag?ep(n.endTag):void 0,c={opening:o};l&&(c.closing=l),c.properties=a,t.data={position:c}}}return r}function ep(e){const t=LW({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=LW({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function LW(e){return e.line&&e.column?e:void 0}const Mht={},Lht={}.hasOwnProperty,Rde=Nie("type",{handlers:{root:Bht,element:zht,text:$ht,comment:Uht,doctype:Fht}});function Pht(e,t){const r=(t||Mht).space;return Rde(e,r==="svg"?Yu:M0)}function Bht(e,t){const n={nodeName:"#document",mode:(e.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return n.childNodes=fF(e.children,n,t),Pm(e,n),n}function jht(e,t){const n={nodeName:"#document-fragment",childNodes:[]};return n.childNodes=fF(e.children,n,t),Pm(e,n),n}function Fht(e){const t={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return Pm(e,t),t}function $ht(e){const t={nodeName:"#text",value:e.value,parentNode:null};return Pm(e,t),t}function Uht(e){const t={nodeName:"#comment",data:e.value,parentNode:null};return Pm(e,t),t}function zht(e,t){const n=t;let r=n;e.type==="element"&&e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=Yu);const i=[];let a;if(e.properties){for(a in e.properties)if(a!=="children"&&Lht.call(e.properties,a)){const l=Hht(r,a,e.properties[a]);l&&i.push(l)}}const s=r.space,o={nodeName:e.tagName,tagName:e.tagName,attrs:i,namespaceURI:Ud[s],childNodes:[],parentNode:null};return o.childNodes=fF(e.children,o,r),Pm(e,o),e.tagName==="template"&&e.content&&(o.content=jht(e.content,r)),o}function Hht(e,t,n){const r=a1(e,t);if(n===!1||n===null||n===void 0||typeof n=="number"&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?$re(n):Yre(n));const i={name:r.attribute,value:n===!0?"":String(n)};if(r.space&&r.space!=="html"&&r.space!=="svg"){const a=i.name.indexOf(":");a<0?i.prefix="":(i.name=i.name.slice(a+1),i.prefix=r.attribute.slice(0,a)),i.namespace=Ud[r.space]}return i}function fF(e,t,n){let r=-1;const i=[];if(e)for(;++r<e.length;){const a=Rde(e[r],n);a.parentNode=t,i.push(a)}return i}function Pm(e,t){const n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}const Wht=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Ght=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),kr="�";var J;(function(e){e[e.EOF=-1]="EOF",e[e.NULL=0]="NULL",e[e.TABULATION=9]="TABULATION",e[e.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",e[e.LINE_FEED=10]="LINE_FEED",e[e.FORM_FEED=12]="FORM_FEED",e[e.SPACE=32]="SPACE",e[e.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",e[e.QUOTATION_MARK=34]="QUOTATION_MARK",e[e.AMPERSAND=38]="AMPERSAND",e[e.APOSTROPHE=39]="APOSTROPHE",e[e.HYPHEN_MINUS=45]="HYPHEN_MINUS",e[e.SOLIDUS=47]="SOLIDUS",e[e.DIGIT_0=48]="DIGIT_0",e[e.DIGIT_9=57]="DIGIT_9",e[e.SEMICOLON=59]="SEMICOLON",e[e.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",e[e.EQUALS_SIGN=61]="EQUALS_SIGN",e[e.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",e[e.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",e[e.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",e[e.GRAVE_ACCENT=96]="GRAVE_ACCENT",e[e.LATIN_SMALL_A=97]="LATIN_SMALL_A",e[e.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(J||(J={}));const Ha={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function Ide(e){return e>=55296&&e<=57343}function qht(e){return e>=56320&&e<=57343}function Vht(e,t){return(e-55296)*1024+9216+t}function Ode(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function Dde(e){return e>=64976&&e<=65007||Ght.has(e)}var Ee;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(Ee||(Ee={}));const Yht=65536;class Kht{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=Yht,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:i,offset:a}=this,s=i+n,o=a+n;return{code:t,startLine:r,endLine:r,startCol:s,endCol:s,startOffset:o,endOffset:o}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(qht(n))return this.pos++,this._addGap(),Vht(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,J.EOF;return this._err(Ee.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r<t.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==t.charCodeAt(r))return!1;return!0}peek(t){const n=this.pos+t;if(n>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,J.EOF;const r=this.html.charCodeAt(n);return r===J.CARRIAGE_RETURN?J.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,J.EOF;let t=this.html.charCodeAt(this.pos);return t===J.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,J.LINE_FEED):t===J.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Ide(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===J.LINE_FEED||t===J.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){Ode(t)?this._err(Ee.controlCharacterInInputStream):Dde(t)&&this._err(Ee.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var mn;(function(e){e[e.CHARACTER=0]="CHARACTER",e[e.NULL_CHARACTER=1]="NULL_CHARACTER",e[e.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",e[e.START_TAG=3]="START_TAG",e[e.END_TAG=4]="END_TAG",e[e.COMMENT=5]="COMMENT",e[e.DOCTYPE=6]="DOCTYPE",e[e.EOF=7]="EOF",e[e.HIBERNATION=8]="HIBERNATION"})(mn||(mn={}));function Mde(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const Xht=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),Zht=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function Qht(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=Zht.get(e))!==null&&t!==void 0?t:e}var $i;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})($i||($i={}));const Jht=32;var gu;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(gu||(gu={}));function DI(e){return e>=$i.ZERO&&e<=$i.NINE}function eft(e){return e>=$i.UPPER_A&&e<=$i.UPPER_F||e>=$i.LOWER_A&&e<=$i.LOWER_F}function tft(e){return e>=$i.UPPER_A&&e<=$i.UPPER_Z||e>=$i.LOWER_A&&e<=$i.LOWER_Z||DI(e)}function nft(e){return e===$i.EQUALS||tft(e)}var Di;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(Di||(Di={}));var rc;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(rc||(rc={}));class rft{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=Di.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=rc.Strict}startEntity(t){this.decodeMode=t,this.state=Di.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case Di.EntityStart:return t.charCodeAt(n)===$i.NUM?(this.state=Di.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=Di.NamedEntity,this.stateNamedEntity(t,n));case Di.NumericStart:return this.stateNumericStart(t,n);case Di.NumericDecimal:return this.stateNumericDecimal(t,n);case Di.NumericHex:return this.stateNumericHex(t,n);case Di.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|Jht)===$i.LOWER_X?(this.state=Di.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=Di.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,i){if(n!==r){const a=r-n;this.result=this.result*Math.pow(i,a)+Number.parseInt(t.substr(n,a),i),this.consumed+=a}}stateNumericHex(t,n){const r=n;for(;n<t.length;){const i=t.charCodeAt(n);if(DI(i)||eft(i))n+=1;else return this.addToNumericResult(t,r,n,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(t,r,n,16),-1}stateNumericDecimal(t,n){const r=n;for(;n<t.length;){const i=t.charCodeAt(n);if(DI(i))n+=1;else return this.addToNumericResult(t,r,n,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(t,r,n,10),-1}emitNumericEntity(t,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===$i.SEMI)this.consumed+=1;else if(this.decodeMode===rc.Strict)return 0;return this.emitCodePoint(Qht(this.result),this.consumed),this.errors&&(t!==$i.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,n){const{decodeTree:r}=this;let i=r[this.treeIndex],a=(i&gu.VALUE_LENGTH)>>14;for(;n<t.length;n++,this.excess++){const s=t.charCodeAt(n);if(this.treeIndex=ift(r,i,this.treeIndex+Math.max(1,a),s),this.treeIndex<0)return this.result===0||this.decodeMode===rc.Attribute&&(a===0||nft(s))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],a=(i&gu.VALUE_LENGTH)>>14,a!==0){if(s===$i.SEMI)return this.emitNamedEntityData(this.treeIndex,a,this.consumed+this.excess);this.decodeMode!==rc.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,i=(r[n]&gu.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[t]&~gu.VALUE_LENGTH:i[t+1],r),n===3&&this.emitCodePoint(i[t+2],r),r}end(){var t;switch(this.state){case Di.NamedEntity:return this.result!==0&&(this.decodeMode!==rc.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Di.NumericDecimal:return this.emitNumericEntity(0,2);case Di.NumericHex:return this.emitNumericEntity(0,3);case Di.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Di.EntityStart:return 0}}}function ift(e,t,n,r){const i=(t&gu.BRANCH_LENGTH)>>7,a=t&gu.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){const l=r-a;return l<0||l>=i?-1:e[n+l]-1}let s=n,o=s+i-1;for(;s<=o;){const l=s+o>>>1,c=e[l];if(c<r)s=l+1;else if(c>r)o=l-1;else return e[l+i]}return-1}var ze;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(ze||(ze={}));var Wd;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(Wd||(Wd={}));var Ws;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Ws||(Ws={}));var ge;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(ge||(ge={}));var R;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(R||(R={}));const aft=new Map([[ge.A,R.A],[ge.ADDRESS,R.ADDRESS],[ge.ANNOTATION_XML,R.ANNOTATION_XML],[ge.APPLET,R.APPLET],[ge.AREA,R.AREA],[ge.ARTICLE,R.ARTICLE],[ge.ASIDE,R.ASIDE],[ge.B,R.B],[ge.BASE,R.BASE],[ge.BASEFONT,R.BASEFONT],[ge.BGSOUND,R.BGSOUND],[ge.BIG,R.BIG],[ge.BLOCKQUOTE,R.BLOCKQUOTE],[ge.BODY,R.BODY],[ge.BR,R.BR],[ge.BUTTON,R.BUTTON],[ge.CAPTION,R.CAPTION],[ge.CENTER,R.CENTER],[ge.CODE,R.CODE],[ge.COL,R.COL],[ge.COLGROUP,R.COLGROUP],[ge.DD,R.DD],[ge.DESC,R.DESC],[ge.DETAILS,R.DETAILS],[ge.DIALOG,R.DIALOG],[ge.DIR,R.DIR],[ge.DIV,R.DIV],[ge.DL,R.DL],[ge.DT,R.DT],[ge.EM,R.EM],[ge.EMBED,R.EMBED],[ge.FIELDSET,R.FIELDSET],[ge.FIGCAPTION,R.FIGCAPTION],[ge.FIGURE,R.FIGURE],[ge.FONT,R.FONT],[ge.FOOTER,R.FOOTER],[ge.FOREIGN_OBJECT,R.FOREIGN_OBJECT],[ge.FORM,R.FORM],[ge.FRAME,R.FRAME],[ge.FRAMESET,R.FRAMESET],[ge.H1,R.H1],[ge.H2,R.H2],[ge.H3,R.H3],[ge.H4,R.H4],[ge.H5,R.H5],[ge.H6,R.H6],[ge.HEAD,R.HEAD],[ge.HEADER,R.HEADER],[ge.HGROUP,R.HGROUP],[ge.HR,R.HR],[ge.HTML,R.HTML],[ge.I,R.I],[ge.IMG,R.IMG],[ge.IMAGE,R.IMAGE],[ge.INPUT,R.INPUT],[ge.IFRAME,R.IFRAME],[ge.KEYGEN,R.KEYGEN],[ge.LABEL,R.LABEL],[ge.LI,R.LI],[ge.LINK,R.LINK],[ge.LISTING,R.LISTING],[ge.MAIN,R.MAIN],[ge.MALIGNMARK,R.MALIGNMARK],[ge.MARQUEE,R.MARQUEE],[ge.MATH,R.MATH],[ge.MENU,R.MENU],[ge.META,R.META],[ge.MGLYPH,R.MGLYPH],[ge.MI,R.MI],[ge.MO,R.MO],[ge.MN,R.MN],[ge.MS,R.MS],[ge.MTEXT,R.MTEXT],[ge.NAV,R.NAV],[ge.NOBR,R.NOBR],[ge.NOFRAMES,R.NOFRAMES],[ge.NOEMBED,R.NOEMBED],[ge.NOSCRIPT,R.NOSCRIPT],[ge.OBJECT,R.OBJECT],[ge.OL,R.OL],[ge.OPTGROUP,R.OPTGROUP],[ge.OPTION,R.OPTION],[ge.P,R.P],[ge.PARAM,R.PARAM],[ge.PLAINTEXT,R.PLAINTEXT],[ge.PRE,R.PRE],[ge.RB,R.RB],[ge.RP,R.RP],[ge.RT,R.RT],[ge.RTC,R.RTC],[ge.RUBY,R.RUBY],[ge.S,R.S],[ge.SCRIPT,R.SCRIPT],[ge.SEARCH,R.SEARCH],[ge.SECTION,R.SECTION],[ge.SELECT,R.SELECT],[ge.SOURCE,R.SOURCE],[ge.SMALL,R.SMALL],[ge.SPAN,R.SPAN],[ge.STRIKE,R.STRIKE],[ge.STRONG,R.STRONG],[ge.STYLE,R.STYLE],[ge.SUB,R.SUB],[ge.SUMMARY,R.SUMMARY],[ge.SUP,R.SUP],[ge.TABLE,R.TABLE],[ge.TBODY,R.TBODY],[ge.TEMPLATE,R.TEMPLATE],[ge.TEXTAREA,R.TEXTAREA],[ge.TFOOT,R.TFOOT],[ge.TD,R.TD],[ge.TH,R.TH],[ge.THEAD,R.THEAD],[ge.TITLE,R.TITLE],[ge.TR,R.TR],[ge.TRACK,R.TRACK],[ge.TT,R.TT],[ge.U,R.U],[ge.UL,R.UL],[ge.SVG,R.SVG],[ge.VAR,R.VAR],[ge.WBR,R.WBR],[ge.XMP,R.XMP]]);function Bm(e){var t;return(t=aft.get(e))!==null&&t!==void 0?t:R.UNKNOWN}const Ge=R,sft={[ze.HTML]:new Set([Ge.ADDRESS,Ge.APPLET,Ge.AREA,Ge.ARTICLE,Ge.ASIDE,Ge.BASE,Ge.BASEFONT,Ge.BGSOUND,Ge.BLOCKQUOTE,Ge.BODY,Ge.BR,Ge.BUTTON,Ge.CAPTION,Ge.CENTER,Ge.COL,Ge.COLGROUP,Ge.DD,Ge.DETAILS,Ge.DIR,Ge.DIV,Ge.DL,Ge.DT,Ge.EMBED,Ge.FIELDSET,Ge.FIGCAPTION,Ge.FIGURE,Ge.FOOTER,Ge.FORM,Ge.FRAME,Ge.FRAMESET,Ge.H1,Ge.H2,Ge.H3,Ge.H4,Ge.H5,Ge.H6,Ge.HEAD,Ge.HEADER,Ge.HGROUP,Ge.HR,Ge.HTML,Ge.IFRAME,Ge.IMG,Ge.INPUT,Ge.LI,Ge.LINK,Ge.LISTING,Ge.MAIN,Ge.MARQUEE,Ge.MENU,Ge.META,Ge.NAV,Ge.NOEMBED,Ge.NOFRAMES,Ge.NOSCRIPT,Ge.OBJECT,Ge.OL,Ge.P,Ge.PARAM,Ge.PLAINTEXT,Ge.PRE,Ge.SCRIPT,Ge.SECTION,Ge.SELECT,Ge.SOURCE,Ge.STYLE,Ge.SUMMARY,Ge.TABLE,Ge.TBODY,Ge.TD,Ge.TEMPLATE,Ge.TEXTAREA,Ge.TFOOT,Ge.TH,Ge.THEAD,Ge.TITLE,Ge.TR,Ge.TRACK,Ge.UL,Ge.WBR,Ge.XMP]),[ze.MATHML]:new Set([Ge.MI,Ge.MO,Ge.MN,Ge.MS,Ge.MTEXT,Ge.ANNOTATION_XML]),[ze.SVG]:new Set([Ge.TITLE,Ge.FOREIGN_OBJECT,Ge.DESC]),[ze.XLINK]:new Set,[ze.XML]:new Set,[ze.XMLNS]:new Set},MI=new Set([Ge.H1,Ge.H2,Ge.H3,Ge.H4,Ge.H5,Ge.H6]);ge.STYLE,ge.SCRIPT,ge.XMP,ge.IFRAME,ge.NOEMBED,ge.NOFRAMES,ge.PLAINTEXT;var te;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(te||(te={}));const ni={DATA:te.DATA,RCDATA:te.RCDATA,RAWTEXT:te.RAWTEXT,SCRIPT_DATA:te.SCRIPT_DATA,PLAINTEXT:te.PLAINTEXT,CDATA_SECTION:te.CDATA_SECTION};function oft(e){return e>=J.DIGIT_0&&e<=J.DIGIT_9}function kb(e){return e>=J.LATIN_CAPITAL_A&&e<=J.LATIN_CAPITAL_Z}function lft(e){return e>=J.LATIN_SMALL_A&&e<=J.LATIN_SMALL_Z}function iu(e){return lft(e)||kb(e)}function PW(e){return iu(e)||oft(e)}function kx(e){return e+32}function Lde(e){return e===J.SPACE||e===J.LINE_FEED||e===J.TABULATION||e===J.FORM_FEED}function BW(e){return Lde(e)||e===J.SOLIDUS||e===J.GREATER_THAN_SIGN}function cft(e){return e===J.NULL?Ee.nullCharacterReference:e>1114111?Ee.characterReferenceOutsideUnicodeRange:Ide(e)?Ee.surrogateCharacterReference:Dde(e)?Ee.noncharacterCharacterReference:Ode(e)||e===J.CARRIAGE_RETURN?Ee.controlCharacterReference:null}class uft{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=te.DATA,this.returnState=te.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Kht(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new rft(Xht,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(Ee.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(Ee.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const i=cft(r);i&&this._err(i,1)}}:void 0)}_err(t,n=0){var r,i;(i=(r=this.handler).onParseError)===null||i===void 0||i.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t?.())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r?.()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n<t;n++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,n){return this.preprocessor.startsWith(t,n)?(this._advanceBy(t.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:mn.START_TAG,tagName:"",tagID:R.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:mn.END_TAG,tagName:"",tagID:R.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:mn.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:mn.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,n){this.currentCharacterToken={type:t,chars:n,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,n;const r=this.currentToken;if(Mde(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const i=(t=(n=r.location).attrs)!==null&&t!==void 0?t:n.attrs=Object.create(null);i[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(Ee.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const t=this.currentToken;this.prepareToken(t),t.tagID=Bm(t.tagName),t.type===mn.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(Ee.endTagWithAttributes),t.selfClosing&&this._err(Ee.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case mn.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case mn.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case mn.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:mn.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=Lde(t)?mn.WHITESPACE_CHARACTER:t===J.NULL?mn.NULL_CHARACTER:mn.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(mn.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=te.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?rc.Attribute:rc.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===te.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===te.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===te.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case te.DATA:{this._stateData(t);break}case te.RCDATA:{this._stateRcdata(t);break}case te.RAWTEXT:{this._stateRawtext(t);break}case te.SCRIPT_DATA:{this._stateScriptData(t);break}case te.PLAINTEXT:{this._statePlaintext(t);break}case te.TAG_OPEN:{this._stateTagOpen(t);break}case te.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case te.TAG_NAME:{this._stateTagName(t);break}case te.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case te.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case te.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case te.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case te.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case te.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case te.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case te.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case te.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case te.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case te.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case te.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case te.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case te.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case te.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case te.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case te.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case te.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case te.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case te.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case te.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case te.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case te.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case te.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case te.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case te.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case te.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case te.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case te.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case te.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case te.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case te.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case te.BOGUS_COMMENT:{this._stateBogusComment(t);break}case te.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case te.COMMENT_START:{this._stateCommentStart(t);break}case te.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case te.COMMENT:{this._stateComment(t);break}case te.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case te.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case te.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case te.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case te.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case te.COMMENT_END:{this._stateCommentEnd(t);break}case te.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case te.DOCTYPE:{this._stateDoctype(t);break}case te.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case te.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case te.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case te.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case te.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case te.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case te.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case te.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case te.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case te.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case te.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case te.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case te.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case te.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case te.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case te.CDATA_SECTION:{this._stateCdataSection(t);break}case te.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case te.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case te.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case te.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case J.LESS_THAN_SIGN:{this.state=te.TAG_OPEN;break}case J.AMPERSAND:{this._startCharacterReference();break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitCodePoint(t);break}case J.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case J.AMPERSAND:{this._startCharacterReference();break}case J.LESS_THAN_SIGN:{this.state=te.RCDATA_LESS_THAN_SIGN;break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(kr);break}case J.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case J.LESS_THAN_SIGN:{this.state=te.RAWTEXT_LESS_THAN_SIGN;break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(kr);break}case J.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case J.LESS_THAN_SIGN:{this.state=te.SCRIPT_DATA_LESS_THAN_SIGN;break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(kr);break}case J.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case J.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(kr);break}case J.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(iu(t))this._createStartTagToken(),this.state=te.TAG_NAME,this._stateTagName(t);else switch(t){case J.EXCLAMATION_MARK:{this.state=te.MARKUP_DECLARATION_OPEN;break}case J.SOLIDUS:{this.state=te.END_TAG_OPEN;break}case J.QUESTION_MARK:{this._err(Ee.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=te.BOGUS_COMMENT,this._stateBogusComment(t);break}case J.EOF:{this._err(Ee.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(Ee.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=te.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(iu(t))this._createEndTagToken(),this.state=te.TAG_NAME,this._stateTagName(t);else switch(t){case J.GREATER_THAN_SIGN:{this._err(Ee.missingEndTagName),this.state=te.DATA;break}case J.EOF:{this._err(Ee.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(Ee.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=te.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const n=this.currentToken;switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:{this.state=te.BEFORE_ATTRIBUTE_NAME;break}case J.SOLIDUS:{this.state=te.SELF_CLOSING_START_TAG;break}case J.GREATER_THAN_SIGN:{this.state=te.DATA,this.emitCurrentTagToken();break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),n.tagName+=kr;break}case J.EOF:{this._err(Ee.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(kb(t)?kx(t):t)}}_stateRcdataLessThanSign(t){t===J.SOLIDUS?this.state=te.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=te.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){iu(t)?(this.state=te.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=te.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const n=this.currentToken;switch(n.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=te.BEFORE_ATTRIBUTE_NAME,!1;case J.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=te.SELF_CLOSING_START_TAG,!1;case J.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=te.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=te.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===J.SOLIDUS?this.state=te.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=te.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){iu(t)?(this.state=te.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=te.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=te.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case J.SOLIDUS:{this.state=te.SCRIPT_DATA_END_TAG_OPEN;break}case J.EXCLAMATION_MARK:{this.state=te.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=te.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){iu(t)?(this.state=te.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=te.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=te.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===J.HYPHEN_MINUS?(this.state=te.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=te.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===J.HYPHEN_MINUS?(this.state=te.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=te.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case J.HYPHEN_MINUS:{this.state=te.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case J.LESS_THAN_SIGN:{this.state=te.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(kr);break}case J.EOF:{this._err(Ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case J.HYPHEN_MINUS:{this.state=te.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case J.LESS_THAN_SIGN:{this.state=te.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this.state=te.SCRIPT_DATA_ESCAPED,this._emitChars(kr);break}case J.EOF:{this._err(Ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=te.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case J.HYPHEN_MINUS:{this._emitChars("-");break}case J.LESS_THAN_SIGN:{this.state=te.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case J.GREATER_THAN_SIGN:{this.state=te.SCRIPT_DATA,this._emitChars(">");break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this.state=te.SCRIPT_DATA_ESCAPED,this._emitChars(kr);break}case J.EOF:{this._err(Ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=te.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===J.SOLIDUS?this.state=te.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:iu(t)?(this._emitChars("<"),this.state=te.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=te.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){iu(t)?(this.state=te.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=te.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=te.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(Ha.SCRIPT,!1)&&BW(this.preprocessor.peek(Ha.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Ha.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=te.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=te.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case J.HYPHEN_MINUS:{this.state=te.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case J.LESS_THAN_SIGN:{this.state=te.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this._emitChars(kr);break}case J.EOF:{this._err(Ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case J.HYPHEN_MINUS:{this.state=te.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case J.LESS_THAN_SIGN:{this.state=te.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this.state=te.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(kr);break}case J.EOF:{this._err(Ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=te.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case J.HYPHEN_MINUS:{this._emitChars("-");break}case J.LESS_THAN_SIGN:{this.state=te.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case J.GREATER_THAN_SIGN:{this.state=te.SCRIPT_DATA,this._emitChars(">");break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this.state=te.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(kr);break}case J.EOF:{this._err(Ee.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=te.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===J.SOLIDUS?(this.state=te.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=te.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Ha.SCRIPT,!1)&&BW(this.preprocessor.peek(Ha.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Ha.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=te.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=te.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:break;case J.SOLIDUS:case J.GREATER_THAN_SIGN:case J.EOF:{this.state=te.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case J.EQUALS_SIGN:{this._err(Ee.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=te.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=te.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:case J.SOLIDUS:case J.GREATER_THAN_SIGN:case J.EOF:{this._leaveAttrName(),this.state=te.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case J.EQUALS_SIGN:{this._leaveAttrName(),this.state=te.BEFORE_ATTRIBUTE_VALUE;break}case J.QUOTATION_MARK:case J.APOSTROPHE:case J.LESS_THAN_SIGN:{this._err(Ee.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this.currentAttr.name+=kr;break}default:this.currentAttr.name+=String.fromCodePoint(kb(t)?kx(t):t)}}_stateAfterAttributeName(t){switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:break;case J.SOLIDUS:{this.state=te.SELF_CLOSING_START_TAG;break}case J.EQUALS_SIGN:{this.state=te.BEFORE_ATTRIBUTE_VALUE;break}case J.GREATER_THAN_SIGN:{this.state=te.DATA,this.emitCurrentTagToken();break}case J.EOF:{this._err(Ee.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=te.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:break;case J.QUOTATION_MARK:{this.state=te.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case J.APOSTROPHE:{this.state=te.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case J.GREATER_THAN_SIGN:{this._err(Ee.missingAttributeValue),this.state=te.DATA,this.emitCurrentTagToken();break}default:this.state=te.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case J.QUOTATION_MARK:{this.state=te.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case J.AMPERSAND:{this._startCharacterReference();break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this.currentAttr.value+=kr;break}case J.EOF:{this._err(Ee.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case J.APOSTROPHE:{this.state=te.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case J.AMPERSAND:{this._startCharacterReference();break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this.currentAttr.value+=kr;break}case J.EOF:{this._err(Ee.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:{this._leaveAttrValue(),this.state=te.BEFORE_ATTRIBUTE_NAME;break}case J.AMPERSAND:{this._startCharacterReference();break}case J.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=te.DATA,this.emitCurrentTagToken();break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),this.currentAttr.value+=kr;break}case J.QUOTATION_MARK:case J.APOSTROPHE:case J.LESS_THAN_SIGN:case J.EQUALS_SIGN:case J.GRAVE_ACCENT:{this._err(Ee.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case J.EOF:{this._err(Ee.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:{this._leaveAttrValue(),this.state=te.BEFORE_ATTRIBUTE_NAME;break}case J.SOLIDUS:{this._leaveAttrValue(),this.state=te.SELF_CLOSING_START_TAG;break}case J.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=te.DATA,this.emitCurrentTagToken();break}case J.EOF:{this._err(Ee.eofInTag),this._emitEOFToken();break}default:this._err(Ee.missingWhitespaceBetweenAttributes),this.state=te.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case J.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=te.DATA,this.emitCurrentTagToken();break}case J.EOF:{this._err(Ee.eofInTag),this._emitEOFToken();break}default:this._err(Ee.unexpectedSolidusInTag),this.state=te.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const n=this.currentToken;switch(t){case J.GREATER_THAN_SIGN:{this.state=te.DATA,this.emitCurrentComment(n);break}case J.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),n.data+=kr;break}default:n.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(Ha.DASH_DASH,!0)?(this._createCommentToken(Ha.DASH_DASH.length+1),this.state=te.COMMENT_START):this._consumeSequenceIfMatch(Ha.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(Ha.DOCTYPE.length+1),this.state=te.DOCTYPE):this._consumeSequenceIfMatch(Ha.CDATA_START,!0)?this.inForeignNode?this.state=te.CDATA_SECTION:(this._err(Ee.cdataInHtmlContent),this._createCommentToken(Ha.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=te.BOGUS_COMMENT):this._ensureHibernation()||(this._err(Ee.incorrectlyOpenedComment),this._createCommentToken(2),this.state=te.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case J.HYPHEN_MINUS:{this.state=te.COMMENT_START_DASH;break}case J.GREATER_THAN_SIGN:{this._err(Ee.abruptClosingOfEmptyComment),this.state=te.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=te.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){const n=this.currentToken;switch(t){case J.HYPHEN_MINUS:{this.state=te.COMMENT_END;break}case J.GREATER_THAN_SIGN:{this._err(Ee.abruptClosingOfEmptyComment),this.state=te.DATA,this.emitCurrentComment(n);break}case J.EOF:{this._err(Ee.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=te.COMMENT,this._stateComment(t)}}_stateComment(t){const n=this.currentToken;switch(t){case J.HYPHEN_MINUS:{this.state=te.COMMENT_END_DASH;break}case J.LESS_THAN_SIGN:{n.data+="<",this.state=te.COMMENT_LESS_THAN_SIGN;break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),n.data+=kr;break}case J.EOF:{this._err(Ee.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const n=this.currentToken;switch(t){case J.EXCLAMATION_MARK:{n.data+="!",this.state=te.COMMENT_LESS_THAN_SIGN_BANG;break}case J.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=te.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===J.HYPHEN_MINUS?this.state=te.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=te.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===J.HYPHEN_MINUS?this.state=te.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=te.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==J.GREATER_THAN_SIGN&&t!==J.EOF&&this._err(Ee.nestedComment),this.state=te.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const n=this.currentToken;switch(t){case J.HYPHEN_MINUS:{this.state=te.COMMENT_END;break}case J.EOF:{this._err(Ee.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=te.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){const n=this.currentToken;switch(t){case J.GREATER_THAN_SIGN:{this.state=te.DATA,this.emitCurrentComment(n);break}case J.EXCLAMATION_MARK:{this.state=te.COMMENT_END_BANG;break}case J.HYPHEN_MINUS:{n.data+="-";break}case J.EOF:{this._err(Ee.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=te.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){const n=this.currentToken;switch(t){case J.HYPHEN_MINUS:{n.data+="--!",this.state=te.COMMENT_END_DASH;break}case J.GREATER_THAN_SIGN:{this._err(Ee.incorrectlyClosedComment),this.state=te.DATA,this.emitCurrentComment(n);break}case J.EOF:{this._err(Ee.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=te.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:{this.state=te.BEFORE_DOCTYPE_NAME;break}case J.GREATER_THAN_SIGN:{this.state=te.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case J.EOF:{this._err(Ee.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Ee.missingWhitespaceBeforeDoctypeName),this.state=te.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(kb(t))this._createDoctypeToken(String.fromCharCode(kx(t))),this.state=te.DOCTYPE_NAME;else switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:break;case J.NULL:{this._err(Ee.unexpectedNullCharacter),this._createDoctypeToken(kr),this.state=te.DOCTYPE_NAME;break}case J.GREATER_THAN_SIGN:{this._err(Ee.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=te.DATA;break}case J.EOF:{this._err(Ee.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=te.DOCTYPE_NAME}}_stateDoctypeName(t){const n=this.currentToken;switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:{this.state=te.AFTER_DOCTYPE_NAME;break}case J.GREATER_THAN_SIGN:{this.state=te.DATA,this.emitCurrentDoctype(n);break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),n.name+=kr;break}case J.EOF:{this._err(Ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(kb(t)?kx(t):t)}}_stateAfterDoctypeName(t){const n=this.currentToken;switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:break;case J.GREATER_THAN_SIGN:{this.state=te.DATA,this.emitCurrentDoctype(n);break}case J.EOF:{this._err(Ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(Ha.PUBLIC,!1)?this.state=te.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(Ha.SYSTEM,!1)?this.state=te.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(Ee.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=te.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const n=this.currentToken;switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:{this.state=te.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case J.QUOTATION_MARK:{this._err(Ee.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=te.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case J.APOSTROPHE:{this._err(Ee.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=te.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case J.GREATER_THAN_SIGN:{this._err(Ee.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=te.DATA,this.emitCurrentDoctype(n);break}case J.EOF:{this._err(Ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Ee.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=te.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:break;case J.QUOTATION_MARK:{n.publicId="",this.state=te.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case J.APOSTROPHE:{n.publicId="",this.state=te.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case J.GREATER_THAN_SIGN:{this._err(Ee.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=te.DATA,this.emitCurrentDoctype(n);break}case J.EOF:{this._err(Ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Ee.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=te.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case J.QUOTATION_MARK:{this.state=te.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),n.publicId+=kr;break}case J.GREATER_THAN_SIGN:{this._err(Ee.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=te.DATA;break}case J.EOF:{this._err(Ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case J.APOSTROPHE:{this.state=te.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),n.publicId+=kr;break}case J.GREATER_THAN_SIGN:{this._err(Ee.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=te.DATA;break}case J.EOF:{this._err(Ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:{this.state=te.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case J.GREATER_THAN_SIGN:{this.state=te.DATA,this.emitCurrentDoctype(n);break}case J.QUOTATION_MARK:{this._err(Ee.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=te.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case J.APOSTROPHE:{this._err(Ee.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=te.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case J.EOF:{this._err(Ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Ee.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=te.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const n=this.currentToken;switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:break;case J.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=te.DATA;break}case J.QUOTATION_MARK:{n.systemId="",this.state=te.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case J.APOSTROPHE:{n.systemId="",this.state=te.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case J.EOF:{this._err(Ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Ee.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=te.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const n=this.currentToken;switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:{this.state=te.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case J.QUOTATION_MARK:{this._err(Ee.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=te.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case J.APOSTROPHE:{this._err(Ee.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=te.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case J.GREATER_THAN_SIGN:{this._err(Ee.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=te.DATA,this.emitCurrentDoctype(n);break}case J.EOF:{this._err(Ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Ee.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=te.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:break;case J.QUOTATION_MARK:{n.systemId="",this.state=te.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case J.APOSTROPHE:{n.systemId="",this.state=te.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case J.GREATER_THAN_SIGN:{this._err(Ee.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=te.DATA,this.emitCurrentDoctype(n);break}case J.EOF:{this._err(Ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Ee.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=te.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case J.QUOTATION_MARK:{this.state=te.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),n.systemId+=kr;break}case J.GREATER_THAN_SIGN:{this._err(Ee.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=te.DATA;break}case J.EOF:{this._err(Ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case J.APOSTROPHE:{this.state=te.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case J.NULL:{this._err(Ee.unexpectedNullCharacter),n.systemId+=kr;break}case J.GREATER_THAN_SIGN:{this._err(Ee.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=te.DATA;break}case J.EOF:{this._err(Ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case J.SPACE:case J.LINE_FEED:case J.TABULATION:case J.FORM_FEED:break;case J.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=te.DATA;break}case J.EOF:{this._err(Ee.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(Ee.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=te.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const n=this.currentToken;switch(t){case J.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=te.DATA;break}case J.NULL:{this._err(Ee.unexpectedNullCharacter);break}case J.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(t){switch(t){case J.RIGHT_SQUARE_BRACKET:{this.state=te.CDATA_SECTION_BRACKET;break}case J.EOF:{this._err(Ee.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===J.RIGHT_SQUARE_BRACKET?this.state=te.CDATA_SECTION_END:(this._emitChars("]"),this.state=te.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case J.GREATER_THAN_SIGN:{this.state=te.DATA;break}case J.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=te.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0)if(this.preprocessor.lastChunkWritten)t=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}t===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(J.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&PW(this.preprocessor.peek(1))?te.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){PW(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===J.SEMICOLON&&this._err(Ee.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}}const Pde=new Set([R.DD,R.DT,R.LI,R.OPTGROUP,R.OPTION,R.P,R.RB,R.RP,R.RT,R.RTC]),jW=new Set([...Pde,R.CAPTION,R.COLGROUP,R.TBODY,R.TD,R.TFOOT,R.TH,R.THEAD,R.TR]),Pw=new Set([R.APPLET,R.CAPTION,R.HTML,R.MARQUEE,R.OBJECT,R.TABLE,R.TD,R.TEMPLATE,R.TH]),dft=new Set([...Pw,R.OL,R.UL]),hft=new Set([...Pw,R.BUTTON]),FW=new Set([R.ANNOTATION_XML,R.MI,R.MN,R.MO,R.MS,R.MTEXT]),$W=new Set([R.DESC,R.FOREIGN_OBJECT,R.TITLE]),fft=new Set([R.TR,R.TEMPLATE,R.HTML]),pft=new Set([R.TBODY,R.TFOOT,R.THEAD,R.TEMPLATE,R.HTML]),mft=new Set([R.TABLE,R.TEMPLATE,R.HTML]),gft=new Set([R.TD,R.TH]);class bft{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=R.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===R.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===ze.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,n){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,n,!0)}pop(){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const i=this._indexOf(t)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,r),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==ze.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop<t)}}popUntilElementPopped(t){const n=this._indexOf(t);this.shortenToLength(Math.max(n,0))}popUntilPopped(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(Math.max(r,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(MI,ze.HTML)}popUntilTableCellPopped(){this.popUntilPopped(gft,ze.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,n){for(let r=this.stackTop;r>=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(mft,ze.HTML)}clearBackToTableBodyContext(){this.clearBackTo(pft,ze.HTML)}clearBackToTableRowContext(){this.clearBackTo(fft,ze.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===R.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===R.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const i=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case ze.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case ze.SVG:{if($W.has(i))return!1;break}case ze.MATHML:{if(FW.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Pw)}hasInListItemScope(t){return this.hasInDynamicScope(t,dft)}hasInButtonScope(t){return this.hasInDynamicScope(t,hft)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case ze.HTML:{if(MI.has(n))return!0;if(Pw.has(n))return!1;break}case ze.SVG:{if($W.has(n))return!1;break}case ze.MATHML:{if(FW.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ze.HTML)switch(this.tagIDs[n]){case t:return!0;case R.TABLE:case R.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===ze.HTML)switch(this.tagIDs[t]){case R.TBODY:case R.THEAD:case R.TFOOT:return!0;case R.TABLE:case R.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ze.HTML)switch(this.tagIDs[n]){case t:return!0;case R.OPTION:case R.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Pde.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&jW.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&jW.has(this.currentTagId);)this.pop()}}const xA=3;var rl;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(rl||(rl={}));const UW={type:rl.Marker};class yft{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],i=n.length,a=this.treeAdapter.getTagName(t),s=this.treeAdapter.getNamespaceURI(t);for(let o=0;o<this.entries.length;o++){const l=this.entries[o];if(l.type===rl.Marker)break;const{element:c}=l;if(this.treeAdapter.getTagName(c)===a&&this.treeAdapter.getNamespaceURI(c)===s){const d=this.treeAdapter.getAttrList(c);d.length===i&&r.push({idx:o,attrs:d})}}return r}_ensureNoahArkCondition(t){if(this.entries.length<xA)return;const n=this.treeAdapter.getAttrList(t),r=this._getNoahArkConditionCandidates(t,n);if(r.length<xA)return;const i=new Map(n.map(s=>[s.name,s.value]));let a=0;for(let s=0;s<r.length;s++){const o=r[s];o.attrs.every(l=>i.get(l.name)===l.value)&&(a+=1,a>=xA&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(UW)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:rl.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:rl.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(UW);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===rl.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===rl.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===rl.Element&&n.element===t)}}const au={createDocument(){return{nodeName:"#document",mode:Ws.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){const i=e.childNodes.find(a=>a.nodeName==="#documentType");if(i)i.name=t,i.publicId=n,i.systemId=r;else{const a={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};au.appendChild(e,a)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(au.isTextNode(n)){n.value+=t;return}}au.appendChild(e,au.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&au.isTextNode(r)?r.value+=t:au.insertBefore(e,au.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName==="#text"},isCommentNode(e){return e.nodeName==="#comment"},isDocumentTypeNode(e){return e.nodeName==="#documentType"},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,"tagName")},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},Bde="html",vft="about:legacy-compat",_ft="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",jde=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],xft=[...jde,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],Sft=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),Fde=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],wft=[...Fde,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function zW(e,t){return t.some(n=>e.startsWith(n))}function Eft(e){return e.name===Bde&&e.publicId===null&&(e.systemId===null||e.systemId===vft)}function Cft(e){if(e.name!==Bde)return Ws.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===_ft)return Ws.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Sft.has(n))return Ws.QUIRKS;let r=t===null?xft:jde;if(zW(n,r))return Ws.QUIRKS;if(r=t===null?Fde:wft,zW(n,r))return Ws.LIMITED_QUIRKS}return Ws.NO_QUIRKS}const HW={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},Tft="definitionurl",kft="definitionURL",Nft=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),Aft=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:ze.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:ze.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:ze.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:ze.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:ze.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:ze.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:ze.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:ze.XML}],["xml:space",{prefix:"xml",name:"space",namespace:ze.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:ze.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:ze.XMLNS}]]),Rft=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),Ift=new Set([R.B,R.BIG,R.BLOCKQUOTE,R.BODY,R.BR,R.CENTER,R.CODE,R.DD,R.DIV,R.DL,R.DT,R.EM,R.EMBED,R.H1,R.H2,R.H3,R.H4,R.H5,R.H6,R.HEAD,R.HR,R.I,R.IMG,R.LI,R.LISTING,R.MENU,R.META,R.NOBR,R.OL,R.P,R.PRE,R.RUBY,R.S,R.SMALL,R.SPAN,R.STRONG,R.STRIKE,R.SUB,R.SUP,R.TABLE,R.TT,R.U,R.UL,R.VAR]);function Oft(e){const t=e.tagID;return t===R.FONT&&e.attrs.some(({name:r})=>r===Wd.COLOR||r===Wd.SIZE||r===Wd.FACE)||Ift.has(t)}function $de(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===Tft){e.attrs[t].name=kft;break}}function Ude(e){for(let t=0;t<e.attrs.length;t++){const n=Nft.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function pF(e){for(let t=0;t<e.attrs.length;t++){const n=Aft.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function Dft(e){const t=Rft.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Bm(e.tagName))}function Mft(e,t){return t===ze.MATHML&&(e===R.MI||e===R.MO||e===R.MN||e===R.MS||e===R.MTEXT)}function Lft(e,t,n){if(t===ze.MATHML&&e===R.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===Wd.ENCODING){const i=n[r].value.toLowerCase();return i===HW.TEXT_HTML||i===HW.APPLICATION_XML}}return t===ze.SVG&&(e===R.FOREIGN_OBJECT||e===R.DESC||e===R.TITLE)}function Pft(e,t,n,r){return(!r||r===ze.HTML)&&Lft(e,t,n)||(!r||r===ze.MATHML)&&Mft(e,t)}const Bft="hidden",jft=8,Fft=3;var ae;(function(e){e[e.INITIAL=0]="INITIAL",e[e.BEFORE_HTML=1]="BEFORE_HTML",e[e.BEFORE_HEAD=2]="BEFORE_HEAD",e[e.IN_HEAD=3]="IN_HEAD",e[e.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",e[e.AFTER_HEAD=5]="AFTER_HEAD",e[e.IN_BODY=6]="IN_BODY",e[e.TEXT=7]="TEXT",e[e.IN_TABLE=8]="IN_TABLE",e[e.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",e[e.IN_CAPTION=10]="IN_CAPTION",e[e.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",e[e.IN_TABLE_BODY=12]="IN_TABLE_BODY",e[e.IN_ROW=13]="IN_ROW",e[e.IN_CELL=14]="IN_CELL",e[e.IN_SELECT=15]="IN_SELECT",e[e.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",e[e.IN_TEMPLATE=17]="IN_TEMPLATE",e[e.AFTER_BODY=18]="AFTER_BODY",e[e.IN_FRAMESET=19]="IN_FRAMESET",e[e.AFTER_FRAMESET=20]="AFTER_FRAMESET",e[e.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",e[e.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(ae||(ae={}));const $ft={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},zde=new Set([R.TABLE,R.TBODY,R.TFOOT,R.THEAD,R.TR]),WW={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:au,onParseError:null};class GW{constructor(t,n,r=null,i=null){this.fragmentContext=r,this.scriptHandler=i,this.currentToken=null,this.stopped=!1,this.insertionMode=ae.INITIAL,this.originalInsertionMode=ae.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...WW,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new uft(this.options,this),this.activeFormattingElements=new yft(this.treeAdapter),this.fragmentContextID=r?Bm(this.treeAdapter.getTagName(r)):R.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new bft(this.document,this.treeAdapter,this)}static parse(t,n){const r=new this(n);return r.tokenizer.write(t,!0),r.document}static getFragmentParser(t,n){const r={...WW,...n};t??(t=r.treeAdapter.createElement(ge.TEMPLATE,ze.HTML,[]));const i=r.treeAdapter.createElement("documentmock",ze.HTML,[]),a=new this(r,i,t);return a.fragmentContextID===R.TEMPLATE&&a.tmplInsertionModeStack.unshift(ae.IN_TEMPLATE),a._initTokenizerForFragmentParsing(),a._insertFakeRootElement(),a._resetInsertionMode(),a._findFormInFragmentContext(),a}getFragment(){const t=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,n),n}_err(t,n,r){var i;if(!this.onParseError)return;const a=(i=t.location)!==null&&i!==void 0?i:$ft,s={code:n,startLine:a.startLine,startCol:a.startCol,startOffset:a.startOffset,endLine:r?a.startLine:a.endLine,endCol:r?a.startCol:a.endCol,endOffset:r?a.startOffset:a.endOffset};this.onParseError(s)}onItemPush(t,n,r){var i,a;(a=(i=this.treeAdapter).onItemPush)===null||a===void 0||a.call(i,t),r&&this.openElements.stackTop>0&&this._setContextModes(t,n)}onItemPop(t,n){var r,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(r=this.treeAdapter).onItemPop)===null||i===void 0||i.call(r,t,this.openElements.current),n){let a,s;this.openElements.stackTop===0&&this.fragmentContext?(a=this.fragmentContext,s=this.fragmentContextID):{current:a,currentTagId:s}=this.openElements,this._setContextModes(a,s)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===ze.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,ze.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=ae.TEXT}switchToPlaintextParsing(){this.insertionMode=ae.TEXT,this.originalInsertionMode=ae.IN_BODY,this.tokenizer.state=ni.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===ge.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==ze.HTML))switch(this.fragmentContextID){case R.TITLE:case R.TEXTAREA:{this.tokenizer.state=ni.RCDATA;break}case R.STYLE:case R.XMP:case R.IFRAME:case R.NOEMBED:case R.NOFRAMES:case R.NOSCRIPT:{this.tokenizer.state=ni.RAWTEXT;break}case R.SCRIPT:{this.tokenizer.state=ni.SCRIPT_DATA;break}case R.PLAINTEXT:{this.tokenizer.state=ni.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,i),t.location){const s=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));s&&this.treeAdapter.setNodeSourceCodeLocation(s,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,ze.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,ze.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(ge.HTML,ze.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,R.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const i=this.treeAdapter.getChildNodes(n),a=r?i.lastIndexOf(r):i.length,s=i[a-1];if(this.treeAdapter.getNodeSourceCodeLocation(s)){const{endLine:l,endCol:c,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(s,{endLine:l,endCol:c,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(s,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,i=this.treeAdapter.getTagName(t),a=n.type===mn.END_TAG&&i===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,a)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===R.SVG&&this.treeAdapter.getTagName(n)===ge.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===ze.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===R.MGLYPH||t.tagID===R.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,ze.HTML)}_processToken(t){switch(t.type){case mn.CHARACTER:{this.onCharacter(t);break}case mn.NULL_CHARACTER:{this.onNullCharacter(t);break}case mn.COMMENT:{this.onComment(t);break}case mn.DOCTYPE:{this.onDoctype(t);break}case mn.START_TAG:{this._processStartTag(t);break}case mn.END_TAG:{this.onEndTag(t);break}case mn.EOF:{this.onEof(t);break}case mn.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const i=this.treeAdapter.getNamespaceURI(n),a=this.treeAdapter.getAttrList(n);return Pft(t,i,a,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===rl.Marker||this.openElements.contains(i.element)),r=n===-1?t-1:n-1;for(let i=r;i>=0;i--){const a=this.activeFormattingElements.entries[i];this._insertElement(a.token,this.treeAdapter.getNamespaceURI(a.element)),a.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=ae.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(R.P),this.openElements.popUntilTagNamePopped(R.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case R.TR:{this.insertionMode=ae.IN_ROW;return}case R.TBODY:case R.THEAD:case R.TFOOT:{this.insertionMode=ae.IN_TABLE_BODY;return}case R.CAPTION:{this.insertionMode=ae.IN_CAPTION;return}case R.COLGROUP:{this.insertionMode=ae.IN_COLUMN_GROUP;return}case R.TABLE:{this.insertionMode=ae.IN_TABLE;return}case R.BODY:{this.insertionMode=ae.IN_BODY;return}case R.FRAMESET:{this.insertionMode=ae.IN_FRAMESET;return}case R.SELECT:{this._resetInsertionModeForSelect(t);return}case R.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case R.HTML:{this.insertionMode=this.headElement?ae.AFTER_HEAD:ae.BEFORE_HEAD;return}case R.TD:case R.TH:{if(t>0){this.insertionMode=ae.IN_CELL;return}break}case R.HEAD:{if(t>0){this.insertionMode=ae.IN_HEAD;return}break}}this.insertionMode=ae.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===R.TEMPLATE)break;if(r===R.TABLE){this.insertionMode=ae.IN_SELECT_IN_TABLE;return}}this.insertionMode=ae.IN_SELECT}_isElementCausesFosterParenting(t){return zde.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case R.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===ze.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case R.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return sft[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){gmt(this,t);return}switch(this.insertionMode){case ae.INITIAL:{ab(this,t);break}case ae.BEFORE_HTML:{Xb(this,t);break}case ae.BEFORE_HEAD:{Zb(this,t);break}case ae.IN_HEAD:{Qb(this,t);break}case ae.IN_HEAD_NO_SCRIPT:{Jb(this,t);break}case ae.AFTER_HEAD:{ey(this,t);break}case ae.IN_BODY:case ae.IN_CAPTION:case ae.IN_CELL:case ae.IN_TEMPLATE:{Wde(this,t);break}case ae.TEXT:case ae.IN_SELECT:case ae.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case ae.IN_TABLE:case ae.IN_TABLE_BODY:case ae.IN_ROW:{SA(this,t);break}case ae.IN_TABLE_TEXT:{Xde(this,t);break}case ae.IN_COLUMN_GROUP:{Bw(this,t);break}case ae.AFTER_BODY:{jw(this,t);break}case ae.AFTER_AFTER_BODY:{hS(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){mmt(this,t);return}switch(this.insertionMode){case ae.INITIAL:{ab(this,t);break}case ae.BEFORE_HTML:{Xb(this,t);break}case ae.BEFORE_HEAD:{Zb(this,t);break}case ae.IN_HEAD:{Qb(this,t);break}case ae.IN_HEAD_NO_SCRIPT:{Jb(this,t);break}case ae.AFTER_HEAD:{ey(this,t);break}case ae.TEXT:{this._insertCharacters(t);break}case ae.IN_TABLE:case ae.IN_TABLE_BODY:case ae.IN_ROW:{SA(this,t);break}case ae.IN_COLUMN_GROUP:{Bw(this,t);break}case ae.AFTER_BODY:{jw(this,t);break}case ae.AFTER_AFTER_BODY:{hS(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){LI(this,t);return}switch(this.insertionMode){case ae.INITIAL:case ae.BEFORE_HTML:case ae.BEFORE_HEAD:case ae.IN_HEAD:case ae.IN_HEAD_NO_SCRIPT:case ae.AFTER_HEAD:case ae.IN_BODY:case ae.IN_TABLE:case ae.IN_CAPTION:case ae.IN_COLUMN_GROUP:case ae.IN_TABLE_BODY:case ae.IN_ROW:case ae.IN_CELL:case ae.IN_SELECT:case ae.IN_SELECT_IN_TABLE:case ae.IN_TEMPLATE:case ae.IN_FRAMESET:case ae.AFTER_FRAMESET:{LI(this,t);break}case ae.IN_TABLE_TEXT:{sb(this,t);break}case ae.AFTER_BODY:{Vft(this,t);break}case ae.AFTER_AFTER_BODY:case ae.AFTER_AFTER_FRAMESET:{Yft(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case ae.INITIAL:{Kft(this,t);break}case ae.BEFORE_HEAD:case ae.IN_HEAD:case ae.IN_HEAD_NO_SCRIPT:case ae.AFTER_HEAD:{this._err(t,Ee.misplacedDoctype);break}case ae.IN_TABLE_TEXT:{sb(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,Ee.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?bmt(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case ae.INITIAL:{ab(this,t);break}case ae.BEFORE_HTML:{Xft(this,t);break}case ae.BEFORE_HEAD:{Qft(this,t);break}case ae.IN_HEAD:{Mo(this,t);break}case ae.IN_HEAD_NO_SCRIPT:{tpt(this,t);break}case ae.AFTER_HEAD:{rpt(this,t);break}case ae.IN_BODY:{ga(this,t);break}case ae.IN_TABLE:{Qp(this,t);break}case ae.IN_TABLE_TEXT:{sb(this,t);break}case ae.IN_CAPTION:{Jpt(this,t);break}case ae.IN_COLUMN_GROUP:{bF(this,t);break}case ae.IN_TABLE_BODY:{gC(this,t);break}case ae.IN_ROW:{bC(this,t);break}case ae.IN_CELL:{nmt(this,t);break}case ae.IN_SELECT:{Jde(this,t);break}case ae.IN_SELECT_IN_TABLE:{imt(this,t);break}case ae.IN_TEMPLATE:{smt(this,t);break}case ae.AFTER_BODY:{lmt(this,t);break}case ae.IN_FRAMESET:{cmt(this,t);break}case ae.AFTER_FRAMESET:{dmt(this,t);break}case ae.AFTER_AFTER_BODY:{fmt(this,t);break}case ae.AFTER_AFTER_FRAMESET:{pmt(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?ymt(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case ae.INITIAL:{ab(this,t);break}case ae.BEFORE_HTML:{Zft(this,t);break}case ae.BEFORE_HEAD:{Jft(this,t);break}case ae.IN_HEAD:{ept(this,t);break}case ae.IN_HEAD_NO_SCRIPT:{npt(this,t);break}case ae.AFTER_HEAD:{ipt(this,t);break}case ae.IN_BODY:{mC(this,t);break}case ae.TEXT:{Hpt(this,t);break}case ae.IN_TABLE:{Xy(this,t);break}case ae.IN_TABLE_TEXT:{sb(this,t);break}case ae.IN_CAPTION:{emt(this,t);break}case ae.IN_COLUMN_GROUP:{tmt(this,t);break}case ae.IN_TABLE_BODY:{PI(this,t);break}case ae.IN_ROW:{Qde(this,t);break}case ae.IN_CELL:{rmt(this,t);break}case ae.IN_SELECT:{ehe(this,t);break}case ae.IN_SELECT_IN_TABLE:{amt(this,t);break}case ae.IN_TEMPLATE:{omt(this,t);break}case ae.AFTER_BODY:{nhe(this,t);break}case ae.IN_FRAMESET:{umt(this,t);break}case ae.AFTER_FRAMESET:{hmt(this,t);break}case ae.AFTER_AFTER_BODY:{hS(this,t);break}}}onEof(t){switch(this.insertionMode){case ae.INITIAL:{ab(this,t);break}case ae.BEFORE_HTML:{Xb(this,t);break}case ae.BEFORE_HEAD:{Zb(this,t);break}case ae.IN_HEAD:{Qb(this,t);break}case ae.IN_HEAD_NO_SCRIPT:{Jb(this,t);break}case ae.AFTER_HEAD:{ey(this,t);break}case ae.IN_BODY:case ae.IN_TABLE:case ae.IN_CAPTION:case ae.IN_COLUMN_GROUP:case ae.IN_TABLE_BODY:case ae.IN_ROW:case ae.IN_CELL:case ae.IN_SELECT:case ae.IN_SELECT_IN_TABLE:{Yde(this,t);break}case ae.TEXT:{Wpt(this,t);break}case ae.IN_TABLE_TEXT:{sb(this,t);break}case ae.IN_TEMPLATE:{the(this,t);break}case ae.AFTER_BODY:case ae.IN_FRAMESET:case ae.AFTER_FRAMESET:case ae.AFTER_AFTER_BODY:case ae.AFTER_AFTER_FRAMESET:{gF(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===J.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case ae.IN_HEAD:case ae.IN_HEAD_NO_SCRIPT:case ae.AFTER_HEAD:case ae.TEXT:case ae.IN_COLUMN_GROUP:case ae.IN_SELECT:case ae.IN_SELECT_IN_TABLE:case ae.IN_FRAMESET:case ae.AFTER_FRAMESET:{this._insertCharacters(t);break}case ae.IN_BODY:case ae.IN_CAPTION:case ae.IN_CELL:case ae.IN_TEMPLATE:case ae.AFTER_BODY:case ae.AFTER_AFTER_BODY:case ae.AFTER_AFTER_FRAMESET:{Hde(this,t);break}case ae.IN_TABLE:case ae.IN_TABLE_BODY:case ae.IN_ROW:{SA(this,t);break}case ae.IN_TABLE_TEXT:{Kde(this,t);break}}}}function Uft(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):Vde(e,t),n}function zft(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function Hft(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,s=i;s!==n;a++,s=i){i=e.openElements.getCommonAncestor(s);const o=e.activeFormattingElements.getElementEntry(s),l=o&&a>=Fft;!o||l?(l&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(s)):(s=Wft(e,o),r===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(s,r),r=s)}return r}function Wft(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function Gft(e,t,n){const r=e.treeAdapter.getTagName(t),i=Bm(r);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{const a=e.treeAdapter.getNamespaceURI(t);i===R.TEMPLATE&&a===ze.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function qft(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function mF(e,t){for(let n=0;n<jft;n++){const r=Uft(e,t);if(!r)break;const i=zft(e,r);if(!i)break;e.activeFormattingElements.bookmark=r;const a=Hft(e,i,r.element),s=e.openElements.getCommonAncestor(r.element);e.treeAdapter.detachNode(a),s&&Gft(e,s,a),qft(e,i,r)}}function LI(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function Vft(e,t){e._appendCommentNode(t,e.openElements.items[0])}function Yft(e,t){e._appendCommentNode(t,e.document)}function gF(e,t){if(e.stopped=!0,t.location){const n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const r=e.openElements.items[0],i=e.treeAdapter.getNodeSourceCodeLocation(r);if(i&&!i.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const a=e.openElements.items[1],s=e.treeAdapter.getNodeSourceCodeLocation(a);s&&!s.endTag&&e._setEndLocation(a,t)}}}}function Kft(e,t){e._setDocumentType(t);const n=t.forceQuirks?Ws.QUIRKS:Cft(t);Eft(t)||e._err(t,Ee.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=ae.BEFORE_HTML}function ab(e,t){e._err(t,Ee.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Ws.QUIRKS),e.insertionMode=ae.BEFORE_HTML,e._processToken(t)}function Xft(e,t){t.tagID===R.HTML?(e._insertElement(t,ze.HTML),e.insertionMode=ae.BEFORE_HEAD):Xb(e,t)}function Zft(e,t){const n=t.tagID;(n===R.HTML||n===R.HEAD||n===R.BODY||n===R.BR)&&Xb(e,t)}function Xb(e,t){e._insertFakeRootElement(),e.insertionMode=ae.BEFORE_HEAD,e._processToken(t)}function Qft(e,t){switch(t.tagID){case R.HTML:{ga(e,t);break}case R.HEAD:{e._insertElement(t,ze.HTML),e.headElement=e.openElements.current,e.insertionMode=ae.IN_HEAD;break}default:Zb(e,t)}}function Jft(e,t){const n=t.tagID;n===R.HEAD||n===R.BODY||n===R.HTML||n===R.BR?Zb(e,t):e._err(t,Ee.endTagWithoutMatchingOpenElement)}function Zb(e,t){e._insertFakeElement(ge.HEAD,R.HEAD),e.headElement=e.openElements.current,e.insertionMode=ae.IN_HEAD,e._processToken(t)}function Mo(e,t){switch(t.tagID){case R.HTML:{ga(e,t);break}case R.BASE:case R.BASEFONT:case R.BGSOUND:case R.LINK:case R.META:{e._appendElement(t,ze.HTML),t.ackSelfClosing=!0;break}case R.TITLE:{e._switchToTextParsing(t,ni.RCDATA);break}case R.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,ni.RAWTEXT):(e._insertElement(t,ze.HTML),e.insertionMode=ae.IN_HEAD_NO_SCRIPT);break}case R.NOFRAMES:case R.STYLE:{e._switchToTextParsing(t,ni.RAWTEXT);break}case R.SCRIPT:{e._switchToTextParsing(t,ni.SCRIPT_DATA);break}case R.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=ae.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(ae.IN_TEMPLATE);break}case R.HEAD:{e._err(t,Ee.misplacedStartTagForHeadElement);break}default:Qb(e,t)}}function ept(e,t){switch(t.tagID){case R.HEAD:{e.openElements.pop(),e.insertionMode=ae.AFTER_HEAD;break}case R.BODY:case R.BR:case R.HTML:{Qb(e,t);break}case R.TEMPLATE:{$h(e,t);break}default:e._err(t,Ee.endTagWithoutMatchingOpenElement)}}function $h(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==R.TEMPLATE&&e._err(t,Ee.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(R.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,Ee.endTagWithoutMatchingOpenElement)}function Qb(e,t){e.openElements.pop(),e.insertionMode=ae.AFTER_HEAD,e._processToken(t)}function tpt(e,t){switch(t.tagID){case R.HTML:{ga(e,t);break}case R.BASEFONT:case R.BGSOUND:case R.HEAD:case R.LINK:case R.META:case R.NOFRAMES:case R.STYLE:{Mo(e,t);break}case R.NOSCRIPT:{e._err(t,Ee.nestedNoscriptInHead);break}default:Jb(e,t)}}function npt(e,t){switch(t.tagID){case R.NOSCRIPT:{e.openElements.pop(),e.insertionMode=ae.IN_HEAD;break}case R.BR:{Jb(e,t);break}default:e._err(t,Ee.endTagWithoutMatchingOpenElement)}}function Jb(e,t){const n=t.type===mn.EOF?Ee.openElementsLeftAfterEof:Ee.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=ae.IN_HEAD,e._processToken(t)}function rpt(e,t){switch(t.tagID){case R.HTML:{ga(e,t);break}case R.BODY:{e._insertElement(t,ze.HTML),e.framesetOk=!1,e.insertionMode=ae.IN_BODY;break}case R.FRAMESET:{e._insertElement(t,ze.HTML),e.insertionMode=ae.IN_FRAMESET;break}case R.BASE:case R.BASEFONT:case R.BGSOUND:case R.LINK:case R.META:case R.NOFRAMES:case R.SCRIPT:case R.STYLE:case R.TEMPLATE:case R.TITLE:{e._err(t,Ee.abandonedHeadElementChild),e.openElements.push(e.headElement,R.HEAD),Mo(e,t),e.openElements.remove(e.headElement);break}case R.HEAD:{e._err(t,Ee.misplacedStartTagForHeadElement);break}default:ey(e,t)}}function ipt(e,t){switch(t.tagID){case R.BODY:case R.HTML:case R.BR:{ey(e,t);break}case R.TEMPLATE:{$h(e,t);break}default:e._err(t,Ee.endTagWithoutMatchingOpenElement)}}function ey(e,t){e._insertFakeElement(ge.BODY,R.BODY),e.insertionMode=ae.IN_BODY,pC(e,t)}function pC(e,t){switch(t.type){case mn.CHARACTER:{Wde(e,t);break}case mn.WHITESPACE_CHARACTER:{Hde(e,t);break}case mn.COMMENT:{LI(e,t);break}case mn.START_TAG:{ga(e,t);break}case mn.END_TAG:{mC(e,t);break}case mn.EOF:{Yde(e,t);break}}}function Hde(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function Wde(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function apt(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function spt(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function opt(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,ze.HTML),e.insertionMode=ae.IN_FRAMESET)}function lpt(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,ze.HTML)}function cpt(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&MI.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,ze.HTML)}function upt(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,ze.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function dpt(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,ze.HTML),n||(e.formElement=e.openElements.current))}function hpt(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const i=e.openElements.tagIDs[r];if(n===R.LI&&i===R.LI||(n===R.DD||n===R.DT)&&(i===R.DD||i===R.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==R.ADDRESS&&i!==R.DIV&&i!==R.P&&e._isSpecialElement(e.openElements.items[r],i))break}e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,ze.HTML)}function fpt(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,ze.HTML),e.tokenizer.state=ni.PLAINTEXT}function ppt(e,t){e.openElements.hasInScope(R.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(R.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,ze.HTML),e.framesetOk=!1}function mpt(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(ge.A);n&&(mF(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,ze.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function gpt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ze.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function bpt(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(R.NOBR)&&(mF(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,ze.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function ypt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ze.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function vpt(e,t){e.treeAdapter.getDocumentMode(e.document)!==Ws.QUIRKS&&e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,ze.HTML),e.framesetOk=!1,e.insertionMode=ae.IN_TABLE}function Gde(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ze.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function qde(e){const t=Mde(e,Wd.TYPE);return t!=null&&t.toLowerCase()===Bft}function _pt(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ze.HTML),qde(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function xpt(e,t){e._appendElement(t,ze.HTML),t.ackSelfClosing=!0}function Spt(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._appendElement(t,ze.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function wpt(e,t){t.tagName=ge.IMG,t.tagID=R.IMG,Gde(e,t)}function Ept(e,t){e._insertElement(t,ze.HTML),e.skipNextNewLine=!0,e.tokenizer.state=ni.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=ae.TEXT}function Cpt(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,ni.RAWTEXT)}function Tpt(e,t){e.framesetOk=!1,e._switchToTextParsing(t,ni.RAWTEXT)}function qW(e,t){e._switchToTextParsing(t,ni.RAWTEXT)}function kpt(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ze.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===ae.IN_TABLE||e.insertionMode===ae.IN_CAPTION||e.insertionMode===ae.IN_TABLE_BODY||e.insertionMode===ae.IN_ROW||e.insertionMode===ae.IN_CELL?ae.IN_SELECT_IN_TABLE:ae.IN_SELECT}function Npt(e,t){e.openElements.currentTagId===R.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,ze.HTML)}function Apt(e,t){e.openElements.hasInScope(R.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,ze.HTML)}function Rpt(e,t){e.openElements.hasInScope(R.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(R.RTC),e._insertElement(t,ze.HTML)}function Ipt(e,t){e._reconstructActiveFormattingElements(),$de(t),pF(t),t.selfClosing?e._appendElement(t,ze.MATHML):e._insertElement(t,ze.MATHML),t.ackSelfClosing=!0}function Opt(e,t){e._reconstructActiveFormattingElements(),Ude(t),pF(t),t.selfClosing?e._appendElement(t,ze.SVG):e._insertElement(t,ze.SVG),t.ackSelfClosing=!0}function VW(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ze.HTML)}function ga(e,t){switch(t.tagID){case R.I:case R.S:case R.B:case R.U:case R.EM:case R.TT:case R.BIG:case R.CODE:case R.FONT:case R.SMALL:case R.STRIKE:case R.STRONG:{gpt(e,t);break}case R.A:{mpt(e,t);break}case R.H1:case R.H2:case R.H3:case R.H4:case R.H5:case R.H6:{cpt(e,t);break}case R.P:case R.DL:case R.OL:case R.UL:case R.DIV:case R.DIR:case R.NAV:case R.MAIN:case R.MENU:case R.ASIDE:case R.CENTER:case R.FIGURE:case R.FOOTER:case R.HEADER:case R.HGROUP:case R.DIALOG:case R.DETAILS:case R.ADDRESS:case R.ARTICLE:case R.SEARCH:case R.SECTION:case R.SUMMARY:case R.FIELDSET:case R.BLOCKQUOTE:case R.FIGCAPTION:{lpt(e,t);break}case R.LI:case R.DD:case R.DT:{hpt(e,t);break}case R.BR:case R.IMG:case R.WBR:case R.AREA:case R.EMBED:case R.KEYGEN:{Gde(e,t);break}case R.HR:{Spt(e,t);break}case R.RB:case R.RTC:{Apt(e,t);break}case R.RT:case R.RP:{Rpt(e,t);break}case R.PRE:case R.LISTING:{upt(e,t);break}case R.XMP:{Cpt(e,t);break}case R.SVG:{Opt(e,t);break}case R.HTML:{apt(e,t);break}case R.BASE:case R.LINK:case R.META:case R.STYLE:case R.TITLE:case R.SCRIPT:case R.BGSOUND:case R.BASEFONT:case R.TEMPLATE:{Mo(e,t);break}case R.BODY:{spt(e,t);break}case R.FORM:{dpt(e,t);break}case R.NOBR:{bpt(e,t);break}case R.MATH:{Ipt(e,t);break}case R.TABLE:{vpt(e,t);break}case R.INPUT:{_pt(e,t);break}case R.PARAM:case R.TRACK:case R.SOURCE:{xpt(e,t);break}case R.IMAGE:{wpt(e,t);break}case R.BUTTON:{ppt(e,t);break}case R.APPLET:case R.OBJECT:case R.MARQUEE:{ypt(e,t);break}case R.IFRAME:{Tpt(e,t);break}case R.SELECT:{kpt(e,t);break}case R.OPTION:case R.OPTGROUP:{Npt(e,t);break}case R.NOEMBED:case R.NOFRAMES:{qW(e,t);break}case R.FRAMESET:{opt(e,t);break}case R.TEXTAREA:{Ept(e,t);break}case R.NOSCRIPT:{e.options.scriptingEnabled?qW(e,t):VW(e,t);break}case R.PLAINTEXT:{fpt(e,t);break}case R.COL:case R.TH:case R.TD:case R.TR:case R.HEAD:case R.FRAME:case R.TBODY:case R.TFOOT:case R.THEAD:case R.CAPTION:case R.COLGROUP:break;default:VW(e,t)}}function Dpt(e,t){if(e.openElements.hasInScope(R.BODY)&&(e.insertionMode=ae.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function Mpt(e,t){e.openElements.hasInScope(R.BODY)&&(e.insertionMode=ae.AFTER_BODY,nhe(e,t))}function Lpt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Ppt(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(R.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(R.FORM):n&&e.openElements.remove(n))}function Bpt(e){e.openElements.hasInButtonScope(R.P)||e._insertFakeElement(ge.P,R.P),e._closePElement()}function jpt(e){e.openElements.hasInListItemScope(R.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(R.LI),e.openElements.popUntilTagNamePopped(R.LI))}function Fpt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function $pt(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function Upt(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function zpt(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(ge.BR,R.BR),e.openElements.pop(),e.framesetOk=!1}function Vde(e,t){const n=t.tagName,r=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){const a=e.openElements.items[i],s=e.openElements.tagIDs[i];if(r===s&&(r!==R.UNKNOWN||e.treeAdapter.getTagName(a)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(a,s))break}}function mC(e,t){switch(t.tagID){case R.A:case R.B:case R.I:case R.S:case R.U:case R.EM:case R.TT:case R.BIG:case R.CODE:case R.FONT:case R.NOBR:case R.SMALL:case R.STRIKE:case R.STRONG:{mF(e,t);break}case R.P:{Bpt(e);break}case R.DL:case R.UL:case R.OL:case R.DIR:case R.DIV:case R.NAV:case R.PRE:case R.MAIN:case R.MENU:case R.ASIDE:case R.BUTTON:case R.CENTER:case R.FIGURE:case R.FOOTER:case R.HEADER:case R.HGROUP:case R.DIALOG:case R.ADDRESS:case R.ARTICLE:case R.DETAILS:case R.SEARCH:case R.SECTION:case R.SUMMARY:case R.LISTING:case R.FIELDSET:case R.BLOCKQUOTE:case R.FIGCAPTION:{Lpt(e,t);break}case R.LI:{jpt(e);break}case R.DD:case R.DT:{Fpt(e,t);break}case R.H1:case R.H2:case R.H3:case R.H4:case R.H5:case R.H6:{$pt(e);break}case R.BR:{zpt(e);break}case R.BODY:{Dpt(e,t);break}case R.HTML:{Mpt(e,t);break}case R.FORM:{Ppt(e);break}case R.APPLET:case R.OBJECT:case R.MARQUEE:{Upt(e,t);break}case R.TEMPLATE:{$h(e,t);break}default:Vde(e,t)}}function Yde(e,t){e.tmplInsertionModeStack.length>0?the(e,t):gF(e,t)}function Hpt(e,t){var n;t.tagID===R.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Wpt(e,t){e._err(t,Ee.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function SA(e,t){if(e.openElements.currentTagId!==void 0&&zde.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=ae.IN_TABLE_TEXT,t.type){case mn.CHARACTER:{Xde(e,t);break}case mn.WHITESPACE_CHARACTER:{Kde(e,t);break}}else gv(e,t)}function Gpt(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,ze.HTML),e.insertionMode=ae.IN_CAPTION}function qpt(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ze.HTML),e.insertionMode=ae.IN_COLUMN_GROUP}function Vpt(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(ge.COLGROUP,R.COLGROUP),e.insertionMode=ae.IN_COLUMN_GROUP,bF(e,t)}function Ypt(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ze.HTML),e.insertionMode=ae.IN_TABLE_BODY}function Kpt(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(ge.TBODY,R.TBODY),e.insertionMode=ae.IN_TABLE_BODY,gC(e,t)}function Xpt(e,t){e.openElements.hasInTableScope(R.TABLE)&&(e.openElements.popUntilTagNamePopped(R.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function Zpt(e,t){qde(t)?e._appendElement(t,ze.HTML):gv(e,t),t.ackSelfClosing=!0}function Qpt(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,ze.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Qp(e,t){switch(t.tagID){case R.TD:case R.TH:case R.TR:{Kpt(e,t);break}case R.STYLE:case R.SCRIPT:case R.TEMPLATE:{Mo(e,t);break}case R.COL:{Vpt(e,t);break}case R.FORM:{Qpt(e,t);break}case R.TABLE:{Xpt(e,t);break}case R.TBODY:case R.TFOOT:case R.THEAD:{Ypt(e,t);break}case R.INPUT:{Zpt(e,t);break}case R.CAPTION:{Gpt(e,t);break}case R.COLGROUP:{qpt(e,t);break}default:gv(e,t)}}function Xy(e,t){switch(t.tagID){case R.TABLE:{e.openElements.hasInTableScope(R.TABLE)&&(e.openElements.popUntilTagNamePopped(R.TABLE),e._resetInsertionMode());break}case R.TEMPLATE:{$h(e,t);break}case R.BODY:case R.CAPTION:case R.COL:case R.COLGROUP:case R.HTML:case R.TBODY:case R.TD:case R.TFOOT:case R.TH:case R.THEAD:case R.TR:break;default:gv(e,t)}}function gv(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,pC(e,t),e.fosterParentingEnabled=n}function Kde(e,t){e.pendingCharacterTokens.push(t)}function Xde(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function sb(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)gv(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}const Zde=new Set([R.CAPTION,R.COL,R.COLGROUP,R.TBODY,R.TD,R.TFOOT,R.TH,R.THEAD,R.TR]);function Jpt(e,t){const n=t.tagID;Zde.has(n)?e.openElements.hasInTableScope(R.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(R.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=ae.IN_TABLE,Qp(e,t)):ga(e,t)}function emt(e,t){const n=t.tagID;switch(n){case R.CAPTION:case R.TABLE:{e.openElements.hasInTableScope(R.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(R.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=ae.IN_TABLE,n===R.TABLE&&Xy(e,t));break}case R.BODY:case R.COL:case R.COLGROUP:case R.HTML:case R.TBODY:case R.TD:case R.TFOOT:case R.TH:case R.THEAD:case R.TR:break;default:mC(e,t)}}function bF(e,t){switch(t.tagID){case R.HTML:{ga(e,t);break}case R.COL:{e._appendElement(t,ze.HTML),t.ackSelfClosing=!0;break}case R.TEMPLATE:{Mo(e,t);break}default:Bw(e,t)}}function tmt(e,t){switch(t.tagID){case R.COLGROUP:{e.openElements.currentTagId===R.COLGROUP&&(e.openElements.pop(),e.insertionMode=ae.IN_TABLE);break}case R.TEMPLATE:{$h(e,t);break}case R.COL:break;default:Bw(e,t)}}function Bw(e,t){e.openElements.currentTagId===R.COLGROUP&&(e.openElements.pop(),e.insertionMode=ae.IN_TABLE,e._processToken(t))}function gC(e,t){switch(t.tagID){case R.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,ze.HTML),e.insertionMode=ae.IN_ROW;break}case R.TH:case R.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(ge.TR,R.TR),e.insertionMode=ae.IN_ROW,bC(e,t);break}case R.CAPTION:case R.COL:case R.COLGROUP:case R.TBODY:case R.TFOOT:case R.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=ae.IN_TABLE,Qp(e,t));break}default:Qp(e,t)}}function PI(e,t){const n=t.tagID;switch(t.tagID){case R.TBODY:case R.TFOOT:case R.THEAD:{e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=ae.IN_TABLE);break}case R.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=ae.IN_TABLE,Xy(e,t));break}case R.BODY:case R.CAPTION:case R.COL:case R.COLGROUP:case R.HTML:case R.TD:case R.TH:case R.TR:break;default:Xy(e,t)}}function bC(e,t){switch(t.tagID){case R.TH:case R.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,ze.HTML),e.insertionMode=ae.IN_CELL,e.activeFormattingElements.insertMarker();break}case R.CAPTION:case R.COL:case R.COLGROUP:case R.TBODY:case R.TFOOT:case R.THEAD:case R.TR:{e.openElements.hasInTableScope(R.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ae.IN_TABLE_BODY,gC(e,t));break}default:Qp(e,t)}}function Qde(e,t){switch(t.tagID){case R.TR:{e.openElements.hasInTableScope(R.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ae.IN_TABLE_BODY);break}case R.TABLE:{e.openElements.hasInTableScope(R.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ae.IN_TABLE_BODY,PI(e,t));break}case R.TBODY:case R.TFOOT:case R.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(R.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=ae.IN_TABLE_BODY,PI(e,t));break}case R.BODY:case R.CAPTION:case R.COL:case R.COLGROUP:case R.HTML:case R.TD:case R.TH:break;default:Xy(e,t)}}function nmt(e,t){const n=t.tagID;Zde.has(n)?(e.openElements.hasInTableScope(R.TD)||e.openElements.hasInTableScope(R.TH))&&(e._closeTableCell(),bC(e,t)):ga(e,t)}function rmt(e,t){const n=t.tagID;switch(n){case R.TD:case R.TH:{e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=ae.IN_ROW);break}case R.TABLE:case R.TBODY:case R.TFOOT:case R.THEAD:case R.TR:{e.openElements.hasInTableScope(n)&&(e._closeTableCell(),Qde(e,t));break}case R.BODY:case R.CAPTION:case R.COL:case R.COLGROUP:case R.HTML:break;default:mC(e,t)}}function Jde(e,t){switch(t.tagID){case R.HTML:{ga(e,t);break}case R.OPTION:{e.openElements.currentTagId===R.OPTION&&e.openElements.pop(),e._insertElement(t,ze.HTML);break}case R.OPTGROUP:{e.openElements.currentTagId===R.OPTION&&e.openElements.pop(),e.openElements.currentTagId===R.OPTGROUP&&e.openElements.pop(),e._insertElement(t,ze.HTML);break}case R.HR:{e.openElements.currentTagId===R.OPTION&&e.openElements.pop(),e.openElements.currentTagId===R.OPTGROUP&&e.openElements.pop(),e._appendElement(t,ze.HTML),t.ackSelfClosing=!0;break}case R.INPUT:case R.KEYGEN:case R.TEXTAREA:case R.SELECT:{e.openElements.hasInSelectScope(R.SELECT)&&(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode(),t.tagID!==R.SELECT&&e._processStartTag(t));break}case R.SCRIPT:case R.TEMPLATE:{Mo(e,t);break}}}function ehe(e,t){switch(t.tagID){case R.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===R.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===R.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===R.OPTGROUP&&e.openElements.pop();break}case R.OPTION:{e.openElements.currentTagId===R.OPTION&&e.openElements.pop();break}case R.SELECT:{e.openElements.hasInSelectScope(R.SELECT)&&(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode());break}case R.TEMPLATE:{$h(e,t);break}}}function imt(e,t){const n=t.tagID;n===R.CAPTION||n===R.TABLE||n===R.TBODY||n===R.TFOOT||n===R.THEAD||n===R.TR||n===R.TD||n===R.TH?(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode(),e._processStartTag(t)):Jde(e,t)}function amt(e,t){const n=t.tagID;n===R.CAPTION||n===R.TABLE||n===R.TBODY||n===R.TFOOT||n===R.THEAD||n===R.TR||n===R.TD||n===R.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode(),e.onEndTag(t)):ehe(e,t)}function smt(e,t){switch(t.tagID){case R.BASE:case R.BASEFONT:case R.BGSOUND:case R.LINK:case R.META:case R.NOFRAMES:case R.SCRIPT:case R.STYLE:case R.TEMPLATE:case R.TITLE:{Mo(e,t);break}case R.CAPTION:case R.COLGROUP:case R.TBODY:case R.TFOOT:case R.THEAD:{e.tmplInsertionModeStack[0]=ae.IN_TABLE,e.insertionMode=ae.IN_TABLE,Qp(e,t);break}case R.COL:{e.tmplInsertionModeStack[0]=ae.IN_COLUMN_GROUP,e.insertionMode=ae.IN_COLUMN_GROUP,bF(e,t);break}case R.TR:{e.tmplInsertionModeStack[0]=ae.IN_TABLE_BODY,e.insertionMode=ae.IN_TABLE_BODY,gC(e,t);break}case R.TD:case R.TH:{e.tmplInsertionModeStack[0]=ae.IN_ROW,e.insertionMode=ae.IN_ROW,bC(e,t);break}default:e.tmplInsertionModeStack[0]=ae.IN_BODY,e.insertionMode=ae.IN_BODY,ga(e,t)}}function omt(e,t){t.tagID===R.TEMPLATE&&$h(e,t)}function the(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(R.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):gF(e,t)}function lmt(e,t){t.tagID===R.HTML?ga(e,t):jw(e,t)}function nhe(e,t){var n;if(t.tagID===R.HTML){if(e.fragmentContext||(e.insertionMode=ae.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===R.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else jw(e,t)}function jw(e,t){e.insertionMode=ae.IN_BODY,pC(e,t)}function cmt(e,t){switch(t.tagID){case R.HTML:{ga(e,t);break}case R.FRAMESET:{e._insertElement(t,ze.HTML);break}case R.FRAME:{e._appendElement(t,ze.HTML),t.ackSelfClosing=!0;break}case R.NOFRAMES:{Mo(e,t);break}}}function umt(e,t){t.tagID===R.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==R.FRAMESET&&(e.insertionMode=ae.AFTER_FRAMESET))}function dmt(e,t){switch(t.tagID){case R.HTML:{ga(e,t);break}case R.NOFRAMES:{Mo(e,t);break}}}function hmt(e,t){t.tagID===R.HTML&&(e.insertionMode=ae.AFTER_AFTER_FRAMESET)}function fmt(e,t){t.tagID===R.HTML?ga(e,t):hS(e,t)}function hS(e,t){e.insertionMode=ae.IN_BODY,pC(e,t)}function pmt(e,t){switch(t.tagID){case R.HTML:{ga(e,t);break}case R.NOFRAMES:{Mo(e,t);break}}}function mmt(e,t){t.chars=kr,e._insertCharacters(t)}function gmt(e,t){e._insertCharacters(t),e.framesetOk=!1}function rhe(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==ze.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function bmt(e,t){if(Oft(t))rhe(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===ze.MATHML?$de(t):r===ze.SVG&&(Dft(t),Ude(t)),pF(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function ymt(e,t){if(t.tagID===R.P||t.tagID===R.BR){rhe(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===ze.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}ge.AREA,ge.BASE,ge.BASEFONT,ge.BGSOUND,ge.BR,ge.COL,ge.EMBED,ge.FRAME,ge.HR,ge.IMG,ge.INPUT,ge.KEYGEN,ge.LINK,ge.META,ge.PARAM,ge.SOURCE,ge.TRACK,ge.WBR;const vmt=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,_mt=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),YW={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function ihe(e,t){const n=Rmt(e),r=Nie("type",{handlers:{root:xmt,element:Smt,text:wmt,comment:she,doctype:Emt,raw:Tmt},unknown:kmt}),i={parser:n?new GW(YW):GW.getFragmentParser(void 0,YW),handle(o){r(o,i)},stitches:!1,options:t||{}};r(e,i),jm(i,Nl());const a=n?i.parser.document:i.parser.getFragment(),s=Iht(a,{file:i.options.file});return i.stitches&&h1(s,"comment",function(o,l,c){const d=o;if(d.value.stitch&&c&&l!==void 0){const f=c.children;return f[l]=d.value.stitch,l}}),s.type==="root"&&s.children.length===1&&s.children[0].type===e.type?s.children[0]:s}function ahe(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function xmt(e,t){ahe(e.children,t)}function Smt(e,t){Nmt(e,t),ahe(e.children,t),Amt(e,t)}function wmt(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);const n={type:mn.CHARACTER,chars:e.value,location:bv(e)};jm(t,Nl(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function Emt(e,t){const n={type:mn.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:bv(e)};jm(t,Nl(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function Cmt(e,t){t.stitches=!0;const n=Imt(e);if("children"in e&&"children"in n){const r=ihe({type:"root",children:e.children},t.options);n.children=r.children}she({type:"comment",value:{stitch:n}},t)}function she(e,t){const n=e.value,r={type:mn.COMMENT,data:n,location:bv(e)};jm(t,Nl(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function Tmt(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,ohe(t,Nl(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(vmt,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function kmt(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))Cmt(n,t);else{let r="";throw _mt.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function jm(e,t){ohe(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=ni.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function ohe(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function Nmt(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===ni.PLAINTEXT)return;jm(t,Nl(e));const r=t.parser.openElements.current;let i="namespaceURI"in r?r.namespaceURI:Ud.html;i===Ud.html&&n==="svg"&&(i=Ud.svg);const a=Pht({...e,children:[]},{space:i===Ud.svg?"svg":"html"}),s={type:mn.START_TAG,tagName:n,tagID:Bm(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in a?a.attrs:[],location:bv(e)};t.parser.currentToken=s,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function Amt(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&Wht.includes(n)||t.parser.tokenizer.state===ni.PLAINTEXT)return;jm(t,s1(e));const r={type:mn.END_TAG,tagName:n,tagID:Bm(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:bv(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===ni.RCDATA||t.parser.tokenizer.state===ni.RAWTEXT||t.parser.tokenizer.state===ni.SCRIPT_DATA)&&(t.parser.tokenizer.state=ni.DATA)}function Rmt(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function bv(e){const t=Nl(e)||{line:void 0,column:void 0,offset:void 0},n=s1(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function Imt(e){return"children"in e?hh({...e,children:[]}):hh(e)}function Omt(e){return function(t,n){return ihe(t,{...e,file:n})}}const wd=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],KW={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...wd,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...wd],h2:[["className","sr-only"]],img:[...wd,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...wd,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...wd],table:[...wd],ul:[...wd,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},cu={}.hasOwnProperty;function Dmt(e,t){let n={type:"root",children:[]};const r={schema:t?{...KW,...t}:KW,stack:[]},i=lhe(r,e);return i&&(Array.isArray(i)?i.length===1?n=i[0]:n.children=i:n=i),n}function lhe(e,t){if(t&&typeof t=="object"){const n=t;switch(typeof n.type=="string"?n.type:""){case"comment":return Mmt(e,n);case"doctype":return Lmt(e,n);case"element":return Pmt(e,n);case"root":return Bmt(e,n);case"text":return jmt(e,n)}}}function Mmt(e,t){if(e.schema.allowComments){const n=typeof t.value=="string"?t.value:"",r=n.indexOf("-->"),a={type:"comment",value:r<0?n:n.slice(0,r)};return yv(a,t),a}}function Lmt(e,t){if(e.schema.allowDoctypes){const n={type:"doctype"};return yv(n,t),n}}function Pmt(e,t){const n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);const r=che(e,t.children),i=Fmt(e,t.properties);e.stack.pop();let a=!1;if(n&&n!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&cu.call(e.schema.ancestors,n))){const o=e.schema.ancestors[n];let l=-1;for(a=!1;++l<o.length;)e.stack.includes(o[l])&&(a=!0)}if(!a)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;const s={type:"element",tagName:n,properties:i,children:r};return yv(s,t),s}function Bmt(e,t){const r={type:"root",children:che(e,t.children)};return yv(r,t),r}function jmt(e,t){const r={type:"text",value:typeof t.value=="string"?t.value:""};return yv(r,t),r}function che(e,t){const n=[];if(Array.isArray(t)){const r=t;let i=-1;for(;++i<r.length;){const a=lhe(e,r[i]);a&&(Array.isArray(a)?n.push(...a):n.push(a))}}return n}function Fmt(e,t){const n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,a=r&&cu.call(r,n)?r[n]:void 0,s=r&&cu.call(r,"*")?r["*"]:void 0,o=t&&typeof t=="object"?t:{},l={};let c;for(c in o)if(cu.call(o,c)){const d=o[c];let f=XW(e,ZW(a,c),c,d);f==null&&(f=XW(e,ZW(s,c),c,d)),f!=null&&(l[c]=f)}if(i&&cu.call(i,n)){const d=i[n];for(c in d)cu.call(d,c)&&!cu.call(l,c)&&(l[c]=d[c])}return l}function XW(e,t,n,r){return t?Array.isArray(r)?$mt(e,t,n,r):uhe(e,t,n,r):void 0}function $mt(e,t,n,r){let i=-1;const a=[];for(;++i<r.length;){const s=uhe(e,t,n,r[i]);(typeof s=="number"||typeof s=="string")&&a.push(s)}return a}function uhe(e,t,n,r){if(!(typeof r!="boolean"&&typeof r!="number"&&typeof r!="string")&&Umt(e,n,r)){if(typeof t=="object"&&t.length>1){let i=!1,a=0;for(;++a<t.length;){const s=t[a];if(s&&typeof s=="object"&&"flags"in s){if(s.test(String(r))){i=!0;break}}else if(s===r){i=!0;break}}if(!i)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function Umt(e,t,n){const r=e.schema.protocols&&cu.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;const i=String(n),a=i.indexOf(":"),s=i.indexOf("?"),o=i.indexOf("#"),l=i.indexOf("/");if(a<0||l>-1&&a>l||s>-1&&a>s||o>-1&&a>o)return!0;let c=-1;for(;++c<r.length;){const d=r[c];if(a===d.length&&i.slice(0,d.length)===d)return!0}return!1}function yv(e,t){const n=Xre(t);t.data&&(e.data=hh(t.data)),n&&(e.position=n)}function ZW(e,t){let n,r=-1;if(e)for(;++r<e.length;){const i=e[r],a=typeof i=="string"?i:i[0];if(a===t)return i;a==="data*"&&(n=i)}if(t.length>4&&t.slice(0,4).toLowerCase()==="data")return n}function zmt(e){return function(t){return Dmt(t,e)}}function Jp({className:e,...t}){return h.jsx("kbd",{"data-slot":"kbd",className:ne("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",e),...t})}var yC="Tabs",[Hmt]=Ai(yC,[Zu]),dhe=Zu(),[Wmt,yF]=Hmt(yC),hhe=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:s="horizontal",dir:o,activationMode:l="automatic",...c}=e,d=wh(o),[f,m]=Na({prop:r,onChange:i,defaultProp:a??"",caller:yC});return h.jsx(Wmt,{scope:n,baseId:Ti(),value:f,onValueChange:m,orientation:s,dir:d,activationMode:l,children:h.jsx(yt.div,{dir:d,"data-orientation":s,...c,ref:t})})});hhe.displayName=yC;var fhe="TabsList",phe=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,a=yF(fhe,n),s=dhe(n);return h.jsx(M1,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:r,children:h.jsx(yt.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});phe.displayName=fhe;var mhe="TabsTrigger",ghe=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,s=yF(mhe,n),o=dhe(n),l=vhe(s.baseId,r),c=_he(s.baseId,r),d=r===s.value;return h.jsx(L1,{asChild:!0,...o,focusable:!i,active:d,children:h.jsx(yt.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...a,ref:t,onMouseDown:Ye(e.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Ye(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Ye(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})})});ghe.displayName=mhe;var bhe="TabsContent",yhe=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:a,...s}=e,o=yF(bhe,n),l=vhe(o.baseId,r),c=_he(o.baseId,r),d=r===o.value,f=v.useRef(d);return v.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),h.jsx(bi,{present:i||d,children:({present:m})=>h.jsx(yt.div,{"data-state":d?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":l,hidden:!m,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&a})})});yhe.displayName=bhe;function vhe(e,t){return`${e}-trigger-${t}`}function _he(e,t){return`${e}-content-${t}`}var Gmt=hhe,xhe=phe,She=ghe,whe=yhe;const qmt=Gmt,Ehe=v.forwardRef(({className:e,...t},n)=>h.jsx(xhe,{ref:n,className:ne("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Ehe.displayName=xhe.displayName;const BI=v.forwardRef(({className:e,...t},n)=>h.jsx(She,{ref:n,className:ne("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground",e),...t}));BI.displayName=She.displayName;const Vmt=v.forwardRef(({className:e,...t},n)=>h.jsx(whe,{ref:n,className:ne("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Vmt.displayName=whe.displayName;function Ymt(e){return Ntt(e)}function Kmt({checks:e,size:t="sm"}){const n=Ymt(e),r=t==="sm"?"w-2 h-2":"w-2.5 h-2.5",i={PASSING:"bg-green-500",FAILING:"bg-red-500",RUNNING:"bg-yellow-500 animate-pulse",UNKNOWN:"bg-gray-400",NONE:"bg-gray-400"},a={PASSING:"CI passed",FAILING:"CI failed",RUNNING:"Checks running...",UNKNOWN:"CI unknown",NONE:"No checks"};return h.jsx("span",{className:`${r} rounded-full inline-block flex-shrink-0 ${i[n]}`,title:a[n]})}function Che(e){const t=new Map,n=r=>r.conclusion==="FAILURE"?4:r.status!=="COMPLETED"||r.conclusion===null?3:r.conclusion==="SUCCESS"?2:1;for(const r of e){const i=t.get(r.name);(!i||n(r)>n(i))&&t.set(r.name,r)}return Array.from(t.values())}function Xmt({checks:e}){if(!e||e.length===0)return h.jsx(gn,{variant:"outline",className:"text-xs",children:Att("NONE")});const t=Che(e),n=t.filter(a=>a.conclusion==="FAILURE").length,r=t.filter(a=>a.status!=="COMPLETED"||a.conclusion===null).length,i=t.filter(a=>a.conclusion==="SUCCESS").length;return n>0?h.jsxs(gn,{variant:"destructive",className:"text-xs",children:[n," failed"]}):r>0?h.jsxs(gn,{variant:"secondary",className:"bg-yellow-500/20 text-yellow-600 text-xs",children:[r," pending"]}):h.jsxs(gn,{variant:"secondary",className:"bg-green-500/20 text-green-600 text-xs",children:[i," passed"]})}function Zmt({decision:e}){switch(e){case"APPROVED":return h.jsx(gn,{className:"bg-green-500/20 text-green-600 border-green-500/30 text-xs",children:"Approved"});case"CHANGES_REQUESTED":return h.jsx(gn,{className:"bg-red-500/20 text-red-600 border-red-500/30 text-xs",children:"Changes requested"});case"REVIEW_REQUIRED":return h.jsx(gn,{className:"bg-yellow-500/20 text-yellow-600 border-yellow-500/30 text-xs",children:"Review required"});default:return h.jsx(gn,{variant:"outline",className:"text-xs",children:"Pending"})}}function Qmt({check:e}){const t=()=>e.conclusion==="SUCCESS"?h.jsx("span",{className:"text-green-500",children:"✓"}):e.conclusion==="FAILURE"?h.jsx("span",{className:"text-red-500",children:"✗"}):e.conclusion==="SKIPPED"||e.conclusion==="CANCELLED"?h.jsx("span",{className:"text-gray-400",children:"○"}):h.jsx("span",{className:"text-yellow-500 animate-pulse",children:"◐"}),n=()=>e.conclusion==="SUCCESS"?"text-green-600":e.conclusion==="FAILURE"?"text-red-600":e.conclusion==="SKIPPED"||e.conclusion==="CANCELLED"?"text-gray-500":"text-yellow-600",r=h.jsxs("div",{className:"flex items-center gap-2 py-1 px-2 rounded hover:bg-muted/50 transition-colors group",children:[h.jsx("span",{className:"w-4 flex-shrink-0",children:t()}),h.jsx("span",{className:"flex-1 truncate text-sm",title:e.name,children:e.name}),h.jsx("span",{className:`text-xs ${n()}`,children:e.conclusion||e.status}),e.detailsUrl&&h.jsx("span",{className:"text-xs text-muted-foreground opacity-0 group-hover:opacity-100",children:"→"})]});return e.detailsUrl?h.jsx("a",{href:e.detailsUrl,target:"_blank",rel:"noopener noreferrer",className:"block",children:r}):r}function Jmt({checks:e,defaultExpanded:t=!0}){const[n,r]=v.useState(t);if(!e||e.length===0)return null;const i=Che(e),a=i.filter(c=>c.conclusion==="SUCCESS").length,s=i.filter(c=>c.conclusion==="FAILURE").length,o=i.filter(c=>c.status!=="COMPLETED"||c.conclusion===null).length,l=i.filter(c=>c.conclusion==="SKIPPED"||c.conclusion==="CANCELLED").length;return h.jsxs("div",{className:"border-b",children:[h.jsxs("button",{type:"button",onClick:()=>r(!n),className:"w-full px-3 py-1.5 flex items-center gap-2 text-left hover:bg-muted/30 transition-colors",children:[h.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"CI CHECKS"}),h.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[a>0&&h.jsxs("span",{className:"text-green-600",children:[a," passed"]}),s>0&&h.jsxs("span",{className:"text-red-600",children:[s," failed"]}),o>0&&h.jsxs("span",{className:"text-yellow-600",children:[o," pending"]}),l>0&&h.jsxs("span",{className:"text-gray-500",children:[l," skipped"]})]}),h.jsx("span",{className:"flex-1"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:n?"▼":"▶"})]}),n&&h.jsx("div",{className:"px-1 pb-1",children:i.map(c=>h.jsx(Qmt,{check:c},c.name))})]})}function egt(e){switch(e){case"CLEAN":return"bg-green-500/20 text-green-600 border-green-500/30";case"BLOCKED":case"DIRTY":return"bg-red-500/20 text-red-600 border-red-500/30";default:return""}}function tgt(e){switch(e){case"APPROVED":return"bg-green-500/20 text-green-600";case"CHANGES_REQUESTED":return"bg-red-500/20 text-red-600";default:return"bg-muted"}}function ngt(e){return e==="APPROVED"?"bg-green-800 hover:bg-green-800 cursor-default":"bg-green-600 hover:bg-green-700"}function rgt(e,t){return e?"Approving...":t==="APPROVED"?"Approved":"Approve"}function igt({line:e}){return h.jsxs("div",{className:`px-3 whitespace-pre ${hVe(e.type)}`,children:[h.jsx("span",{className:"select-none opacity-50 mr-2",children:fVe(e.type)}),e.content]})}function agt({diff:e}){const t=lVe(e);return h.jsx("div",{className:"divide-y",children:t.map(n=>h.jsxs("div",{className:"text-xs",children:[h.jsxs("div",{className:"px-3 py-1.5 bg-muted/50 font-mono sticky top-0 flex items-center gap-2",children:[h.jsx("span",{className:"font-medium truncate",children:n.name}),n.additions>0&&h.jsxs("span",{className:"text-green-600",children:["+",n.additions]}),n.deletions>0&&h.jsxs("span",{className:"text-red-600",children:["-",n.deletions]})]}),h.jsx("div",{className:"font-mono text-xs leading-tight overflow-x-auto",children:n.hunks.map(r=>h.jsxs("div",{children:[h.jsx("div",{className:"px-3 py-1 bg-blue-500/10 text-blue-600 text-xs",children:r.header}),r.lines.map((i,a)=>h.jsx(igt,{line:i},`${r.header}-${a}`))]},r.header))})]},n.name))})}function sgt({pr:e}){return h.jsxs("div",{className:"px-4 py-3 border-b bg-muted/30 flex-shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[h.jsx(gn,{variant:"secondary",className:"font-mono text-xs",children:e.repository.nameWithOwner}),h.jsxs("span",{className:"text-xs text-muted-foreground",children:["→ ",e.baseRefName]})]}),h.jsx("h2",{className:"font-semibold leading-tight line-clamp-2 text-sm",children:e.title}),e.labels&&e.labels.length>0&&h.jsx("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:e.labels.map(t=>h.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded",style:{backgroundColor:`#${t.color}20`,color:`#${t.color}`},children:t.name},t.name))})]})}function ogt({pr:e}){return h.jsxs("div",{className:"px-4 py-2 border-b flex items-center gap-2 text-xs flex-shrink-0 flex-wrap",children:[h.jsxs("span",{children:[h.jsx("strong",{children:e.changedFiles})," files"]}),h.jsx("span",{className:"text-green-600",children:h.jsxs("strong",{children:["+",e.additions]})}),h.jsx("span",{className:"text-red-600",children:h.jsxs("strong",{children:["-",e.deletions]})}),h.jsx("span",{className:"flex-1 min-w-0"}),h.jsx(Xmt,{checks:e.statusCheckRollup}),h.jsx(Zmt,{decision:e.reviewDecision}),h.jsx(gn,{variant:"outline",className:`text-xs px-1.5 py-0 flex-shrink-0 ${egt(e.mergeStateStatus)}`,children:e.mergeStateStatus})]})}function lgt({pr:e}){return!e.reviews||e.reviews.length===0?null:h.jsxs("div",{className:"px-4 py-2 border-b",children:[h.jsx("div",{className:"text-xs text-muted-foreground font-medium mb-1",children:"REVIEWS"}),h.jsx("div",{className:"flex flex-wrap gap-2",children:e.reviews.map(t=>h.jsxs("span",{className:`text-xs px-1.5 py-0.5 rounded ${tgt(t.state)}`,children:[t.author.login,": ",t.state]},t.id))})]})}function cgt({pr:e}){return!e.comments||e.comments.length===0?null:h.jsxs("div",{className:"divide-y",children:[h.jsx("div",{className:"px-4 py-2 bg-muted sticky top-0 border-b",children:h.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:["COMMENTS (",e.comments.length,")"]})}),e.comments.slice().reverse().map(t=>h.jsxs("div",{className:"px-4 py-2",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsx("span",{className:"font-medium text-sm",children:t.author.login}),h.jsx("span",{className:"text-xs text-muted-foreground",children:Wnt(t.createdAt)})]}),h.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none text-sm text-muted-foreground overflow-hidden break-words [&_table]:text-xs [&_table]:border-collapse [&_table]:w-full [&_table]:overflow-x-auto [&_table]:block [&_th]:border [&_th]:px-1 [&_th]:py-0.5 [&_td]:border [&_td]:px-1 [&_td]:py-0.5 [&_h2]:text-sm [&_h2]:font-semibold [&_h2]:mt-1 [&_h2]:mb-0.5 [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1 [&_pre]:overflow-x-auto [&_pre]:text-xs [&_code]:text-xs [&_code]:break-all",children:h.jsx(wie,{remarkPlugins:[Yie],rehypePlugins:[Omt,zmt],children:t.body})})]},t.id))]})}function ugt({pr:e}){return h.jsxs(h.Fragment,{children:[h.jsx(Jmt,{checks:e.statusCheckRollup,defaultExpanded:!0}),h.jsx(lgt,{pr:e}),h.jsx(cgt,{pr:e})]})}function dgt({diffLoading:e,diff:t}){return e?h.jsx("div",{className:"p-4 text-center text-muted-foreground text-xs",children:"Loading diff..."}):t?h.jsx(agt,{diff:t}):h.jsx("div",{className:"p-4 text-center text-muted-foreground text-xs",children:"No diff available"})}function hgt(){return h.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:h.jsxs("div",{className:"text-center",children:[h.jsx("p",{children:"No PR selected"}),h.jsxs("div",{className:"mt-2 flex items-center justify-center gap-1",children:[h.jsx(Jp,{children:"j"}),h.jsx(Jp,{children:"k"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"to navigate"})]})]})})}function fgt({activeTab:e,onTabChange:t}){return h.jsxs("div",{className:"px-4 py-2 border-b flex items-center justify-between flex-shrink-0 bg-muted",children:[h.jsx(qmt,{value:e,onValueChange:n=>t(n),children:h.jsxs(Ehe,{className:"h-8",children:[h.jsx(BI,{value:"info",children:"Info"}),h.jsx(BI,{value:"diff",children:"Diff"})]})}),h.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[h.jsx(Jp,{children:"i"}),h.jsx(Jp,{children:"d"})]})]})}function pgt({pr:e,approving:t,onOpenGitHub:n,onApprove:r}){return h.jsxs("div",{className:"px-4 py-2 border-t bg-muted flex gap-2 flex-shrink-0",children:[h.jsxs(We,{variant:"outline",size:"sm",onClick:n,className:"flex-1 h-8 min-w-0",children:[h.jsx("span",{className:"truncate",children:"GitHub"}),h.jsx("span",{className:"ml-2 flex items-center gap-1",children:h.jsx(Jp,{children:"o"})})]}),h.jsxs(We,{size:"sm",onClick:r,className:`flex-1 h-8 min-w-0 ${ngt(e.reviewDecision)}`,disabled:t||e.reviewDecision==="APPROVED",children:[h.jsx("span",{className:"truncate",children:rgt(t,e.reviewDecision)}),!t&&e.reviewDecision!=="APPROVED"&&h.jsx("span",{className:"ml-2 flex items-center gap-1 opacity-80",children:h.jsx(Jp,{children:"a"})})]})]})}function mgt({pr:e,diff:t,diffLoading:n,onFetchDiff:r,onOpenGitHub:i,onApprove:a,approving:s=!1}){const[o,l]=v.useState("info"),c=e?`${e.repository.nameWithOwner}#${e.number}`:null;return v.useEffect(()=>{c&&l("info")},[c]),v.useEffect(()=>{o==="diff"&&e&&!t&&!n&&r()},[o,e,t,n,r]),v.useEffect(()=>{const d=f=>{f.target instanceof HTMLInputElement||f.target instanceof HTMLTextAreaElement||(f.key==="d"&&e&&(f.preventDefault(),l("diff")),f.key==="i"&&e&&(f.preventDefault(),l("info")))};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e]),e?h.jsxs("div",{className:"h-full flex flex-col text-sm overflow-hidden",children:[h.jsx(sgt,{pr:e}),h.jsx(ogt,{pr:e}),h.jsx(fgt,{activeTab:o,onTabChange:l}),h.jsx("div",{className:"flex-1 overflow-auto",children:o==="info"?h.jsx(ugt,{pr:e}):h.jsx(dgt,{diffLoading:n,diff:t})}),h.jsx(pgt,{pr:e,approving:s,onOpenGitHub:i,onApprove:a})]}):h.jsx(hgt,{})}function ggt(e){const t=SO(e);return!t||t==="now"?t:`${t} ago`}const bgt=v.forwardRef(function({pr:t,isSelected:n,onSelect:r},i){const a=t.reviewDecision!=="APPROVED",s=t.reviewDecision==="APPROVED";return h.jsx("button",{type:"button",ref:i,onClick:r,className:`cursor-pointer transition-all outline-none border px-3 py-2 rounded-md w-full max-w-full overflow-hidden text-left ${n?"bg-muted border-border shadow-sm":"border-transparent hover:bg-muted/50"}`,children:h.jsxs("div",{className:"flex items-start gap-2 w-full",children:[h.jsx("div",{className:"flex-shrink-0 mt-1 w-3 flex items-center justify-center",children:h.jsx(Kmt,{checks:t.statusCheckRollup})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"font-mono text-xs text-primary/70 truncate max-w-[120px]",children:t.repository.name}),h.jsxs("span",{className:"font-mono text-xs text-muted-foreground whitespace-nowrap",children:["#",t.number]}),t.isDraft&&h.jsx(gn,{variant:"outline",className:"text-xs",children:"Draft"}),a&&h.jsx(gn,{className:"bg-orange-500/10 text-orange-700 border-orange-500/20 text-xs",children:"Review"}),s&&h.jsx(gn,{className:"bg-green-500/10 text-green-700 border-green-500/20 text-xs",children:"Approved"}),h.jsx("span",{className:"flex-1"}),h.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:ggt(t.updatedAt)})]}),h.jsx("div",{className:"font-medium text-sm truncate leading-tight",title:t.title,children:t.title}),h.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[h.jsx("span",{className:"truncate max-w-[80px]",children:t.author.login}),h.jsxs("span",{className:"text-green-600 whitespace-nowrap",children:["+",t.additions]}),h.jsxs("span",{className:"text-red-600 whitespace-nowrap",children:["-",t.deletions]}),t.comments.length>0&&h.jsxs("span",{className:"whitespace-nowrap",children:[t.comments.length," comments"]})]})]})]})})});function ygt(){return h.jsx(v.Suspense,{fallback:h.jsx(The,{}),children:h.jsx(vgt,{})})}function vgt(){const[e]=dbe(),t=e.get("repo"),n=e.get("pr"),[r,i]=v.useState(0),[a,s]=v.useState(new Map),[o,l]=v.useState(new Map),[c,d]=v.useState(!1),f=v.useRef(new Map),m=Ce.useUtils(),{data:g,isLoading:y}=Ce.prReview.listReviewRequests.useQuery(void 0,{refetchInterval:3e4}),_=g?.prs??[],S=_[r],w=S?`${S.repository.nameWithOwner}#${S.number}`:null,E=w?a.get(w):null,T=w?o.get(w):null,A=Ce.prReview.getPRDetails.useQuery({repo:S?.repository.nameWithOwner??"",number:S?.number??0},{enabled:!!S&&!E,staleTime:6e4});v.useEffect(()=>{A.data&&w&&!a.has(w)&&s(F=>new Map(F).set(w,A.data))},[A.data,w,a]),v.useEffect(()=>{if(t&&n&&_.length>0){const F=Number.parseInt(n,10),P=_.findIndex($=>$.repository.nameWithOwner===t&&$.number===F);P>=0&&i(P)}},[t,n,_]);const O=Ce.prReview.submitReview.useMutation({onSuccess:()=>{if(Qt.success("PR approved successfully"),m.prReview.listReviewRequests.invalidate(),w&&E){const F={...E,reviewDecision:"APPROVED"};s(P=>new Map(P).set(w,F))}},onError:F=>{Qt.error(`Failed to approve PR: ${F.message}`)}}),I=v.useCallback(async()=>{if(!(!(S&&w)||o.has(w))){d(!0);try{const F=await m.client.prReview.getDiff.query({repo:S.repository.nameWithOwner,number:S.number});l(P=>new Map(P).set(w,F.diff))}catch{Qt.error("Failed to load diff")}finally{d(!1)}}},[S,w,o,m.client.prReview.getDiff]),N=v.useCallback(()=>{S&&O.mutate({repo:S.repository.nameWithOwner,number:S.number,action:"approve"})},[S,O]),D=v.useCallback(()=>{S&&window.open(S.url,"_blank")},[S]);return v.useEffect(()=>{const F=P=>{if(!(P.target instanceof HTMLInputElement||P.target instanceof HTMLTextAreaElement))switch(P.key){case"j":P.preventDefault(),i($=>Math.min($+1,_.length-1));break;case"k":P.preventDefault(),i($=>Math.max($-1,0));break;case"o":P.preventDefault(),D();break;case"a":P.preventDefault(),E?.reviewDecision!=="APPROVED"&&N();break}};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[_.length,D,N,E?.reviewDecision]),v.useEffect(()=>{const F=f.current.get(r);F&&F.scrollIntoView({block:"nearest",behavior:"smooth"})},[r]),y?h.jsx(The,{}):_.length===0?h.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-sm font-medium",children:"No review requests"}),h.jsx("p",{className:"text-xs",children:"You have no pending PR reviews"})]})}):h.jsxs("div",{className:"h-full grid grid-cols-[minmax(380px,440px)_1fr] gap-0",children:[h.jsxs("div",{className:"border-r flex flex-col h-full overflow-hidden",children:[h.jsxs("div",{className:"px-4 py-3 border-b bg-muted/30",children:[h.jsx("h1",{className:"text-sm font-semibold",children:"Review Requests"}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:[_.length," PR",_.length!==1?"s":""," awaiting your review"]})]}),h.jsx("div",{className:"flex-1 overflow-auto p-2 space-y-2",children:_.map((F,P)=>{const $=`${F.repository.nameWithOwner}#${F.number}`,W=a.get($),V=F.repository.nameWithOwner.split("/")[1]||F.repository.nameWithOwner,H=W??{number:F.number,title:F.title,url:F.url,author:F.author,repository:{name:V,nameWithOwner:F.repository.nameWithOwner},createdAt:F.createdAt,updatedAt:F.createdAt,isDraft:F.isDraft,state:"OPEN",reviewDecision:F.reviewDecision,statusCheckRollup:null,reviews:[],comments:[],labels:[],additions:F.additions,deletions:F.deletions,changedFiles:F.changedFiles,headRefName:"",baseRefName:"",mergeStateStatus:"UNKNOWN"};return h.jsx(bgt,{ref:z=>{z&&f.current.set(P,z)},pr:H,isSelected:P===r,onSelect:()=>i(P)},$)})})]}),h.jsx("div",{className:"h-full overflow-hidden",children:h.jsx(mgt,{pr:E??null,diff:T??null,diffLoading:c,onFetchDiff:I,onOpenGitHub:D,onApprove:N,approving:O.isPending})})]})}function The(){return h.jsxs("div",{className:"h-full grid grid-cols-[minmax(380px,440px)_1fr] gap-0",children:[h.jsxs("div",{className:"border-r p-2 space-y-2",children:[h.jsx(ei,{className:"h-10 w-full"}),Array.from({length:8},(e,t)=>`skeleton-${t}`).map(e=>h.jsx(ei,{className:"h-16 w-full"},e))]}),h.jsxs("div",{className:"p-4",children:[h.jsx(ei,{className:"h-20 w-full mb-4"}),h.jsx(ei,{className:"h-8 w-full mb-2"}),h.jsx(ei,{className:"h-64 w-full"})]})]})}const _gt=ibe([{path:"/",element:h.jsx(bbe,{children:h.jsx(ynt,{})}),children:[{index:!0,element:h.jsx(art,{})},{path:"projects",children:[{index:!0,element:h.jsx(Ist,{})},{path:"new",element:h.jsx(Ost,{})},{path:":slug",element:h.jsx(rve,{}),children:[{index:!0,element:h.jsx(Dst,{})},{path:"workspaces",children:[{index:!0,element:h.jsx(kht,{})},{path:"new",element:h.jsx(Nht,{})},{path:":id",element:h.jsx(tht,{})}]}]}]},{path:"reviews",element:h.jsx(ygt,{})},{path:"admin",element:h.jsx(irt,{})},{path:"logs",element:h.jsx(yst,{})}]}]);function xgt(){return h.jsx(Age,{router:_gt})}const khe=document.getElementById("root");if(!khe)throw new Error("Root element not found");Hpe.createRoot(khe).render(h.jsx(v.StrictMode,{children:h.jsx(xgt,{})}));export{zZ as $,Bb as A,zOe as B,cMe as C,WD as D,DZ as E,da as F,$4e as G,z3e as H,qz as I,YBe as J,EDe as K,Mp as L,Egt as M,YE as N,HDe as O,cD as P,i8 as Q,D3e as R,qx as S,F4e as T,E0 as U,ZDe as V,w0 as W,ft as X,Nt as Y,I4e as Z,L as _,rMe as a,Ree as a$,A3e as a0,E8 as a1,w8 as a2,Lgt as a3,Rgt as a4,Dgt as a5,Ogt as a6,Ngt as a7,SD as a8,Mgt as a9,Q6e as aA,V6e as aB,q6e as aC,k4e as aD,vFe as aE,_4e as aF,LD as aG,wH as aH,e6e as aI,R3e as aJ,wgt as aK,Zy as aL,I0 as aM,Q5e as aN,Z5e as aO,yD as aP,ou as aQ,Sy as aR,b8 as aS,cPe as aT,Eh as aU,N4e as aV,Iee as aW,HE as aX,VE as aY,sw as aZ,Dee as a_,Agt as aa,kf as ab,Bgt as ac,Pgt as ad,Igt as ae,C6e as af,Une as ag,Jgt as ah,XBe as ai,ki as aj,Gu as ak,MD as al,fte as am,kh as an,Fee as ao,$t as ap,_l as aq,v as ar,cbt as as,h as at,g$e as au,Qgt as av,ebt as aw,Xgt as ax,vt as ay,Zgt as az,nMe as b,i4e as b0,bt as b1,vee as b2,Ka as b3,nPe as b4,bD as b5,nQ as b6,T0 as b7,aQ as b8,kgt as b9,F8 as bA,jD as bB,Tee as bC,pR as bD,A4e as bE,qE as bF,Gn as bG,UOe as ba,T4e as bb,v4e as bc,sFe as bd,PD as be,e4e as bf,R4e as bg,A0 as bh,xm as bi,rw as bj,d4e as bk,F$e as bl,N0 as bm,aw as bn,a4e as bo,Eee as bp,cFe as bq,uFe as br,kd as bs,W8 as bt,dFe as bu,BD as bv,lFe as bw,pFe as bx,Sm as by,Wu as bz,qn as c,On as d,UZ as e,Ei as f,aMe as g,bc as h,Qs as i,nje as j,vm as k,Pe as l,Uee as m,Cgt as n,nbt as o,sMe as p,oMe as q,tbt as r,iMe as s,KBe as t,go as u,H6e as v,H4e as w,jgt as x,tMe as y,Tgt as z};
|