claude-code-workflow 7.2.10 → 7.2.11
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/.claude/agents/cli-planning-agent.md +3 -0
- package/.claude/agents/debug-explore-agent.md +1 -0
- package/.claude/agents/tdd-developer.md +1 -0
- package/.claude/agents/team-worker.md +1 -1
- package/.claude/agents/test-action-planning-agent.md +3 -0
- package/.claude/agents/test-context-search-agent.md +1 -0
- package/.claude/agents/test-fix-agent.md +3 -0
- package/.claude/skills/review-code/SKILL.md +2 -0
- package/.claude/skills/review-cycle/SKILL.md +4 -0
- package/.claude/skills/skill-simplify/phases/02-optimize.md +4 -0
- package/.claude/skills/spec-generator/phases/05-epics-stories.md +4 -0
- package/.claude/skills/team-arch-opt/specs/team-config.json +5 -5
- package/.claude/skills/team-frontend-debug/roles/analyzer/role.md +3 -2
- package/.claude/skills/team-perf-opt/roles/coordinator/commands/monitor.md +1 -1
- package/.claude/skills/team-perf-opt/specs/team-config.json +5 -5
- package/.claude/skills/team-quality-assurance/roles/executor/role.md +2 -1
- package/.claude/skills/team-review/roles/reviewer/role.md +2 -1
- package/.claude/skills/team-tech-debt/roles/scanner/role.md +2 -1
- package/.claude/skills/team-testing/roles/executor/role.md +2 -1
- package/.claude/skills/team-testing/roles/generator/role.md +2 -1
- package/.claude/skills/team-ultra-analyze/roles/explorer/role.md +2 -1
- package/.claude/skills/team-ux-improve/specs/team-config.json +6 -6
- package/.claude/skills/workflow-execute/phases/06-review.md +4 -4
- package/.claude/skills/workflow-lite-test-review/SKILL.md +2 -0
- package/.claude/skills/workflow-plan/phases/05-plan-verify.md +4 -0
- package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +1 -0
- package/.claude/skills/workflow-tdd-plan/phases/05-tdd-task-generation.md +2 -1
- package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +1 -0
- package/.claude/skills/workflow-test-fix/phases/05-test-cycle-execute.md +2 -1
- package/.claude/skills/workflow-tune/SKILL.md +487 -0
- package/.claude/skills/workflow-tune/phases/01-setup.md +548 -0
- package/.claude/skills/workflow-tune/phases/02-step-execute.md +197 -0
- package/.claude/skills/workflow-tune/phases/03-step-analyze.md +386 -0
- package/.claude/skills/workflow-tune/phases/04-synthesize.md +257 -0
- package/.claude/skills/workflow-tune/phases/05-optimize-report.md +246 -0
- package/.claude/skills/workflow-tune/specs/workflow-eval-criteria.md +57 -0
- package/.claude/skills/workflow-tune/templates/step-analysis-prompt.md +88 -0
- package/.claude/skills/workflow-tune/templates/synthesis-prompt.md +90 -0
- package/.codex/skills/analyze-with-file/SKILL.md +2 -0
- package/.codex/skills/debug-with-file/SKILL.md +4 -0
- package/.codex/skills/issue-discover/SKILL.md +1 -0
- package/.codex/skills/review-cycle/phases/02-parallel-review.md +3 -0
- package/.codex/skills/team-designer/agents/validation-reporter.md +186 -0
- package/.codex/skills/team-iterdev/agents/gc-controller.md +193 -0
- package/.codex/skills/team-iterdev/agents/task-analyzer.md +206 -0
- package/.codex/skills/team-lifecycle-v4/agents/quality-gate.md +165 -0
- package/.codex/skills/team-lifecycle-v4/agents/requirement-clarifier.md +163 -0
- package/.codex/skills/team-lifecycle-v4/agents/supervisor.md +182 -0
- package/.codex/skills/team-uidesign/agents/completion-handler.md +177 -0
- package/.codex/skills/team-uidesign/agents/gc-loop-handler.md +162 -0
- package/.codex/skills/workflow-test-fix-cycle/phases/01-test-fix-gen.md +4 -0
- package/.codex/skills/workflow-test-fix-cycle/phases/02-test-cycle-execute.md +2 -0
- package/ccw/dist/commands/spec.d.ts.map +1 -1
- package/ccw/dist/commands/spec.js +9 -4
- package/ccw/dist/commands/spec.js.map +1 -1
- package/ccw/dist/core/routes/codexlens-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens-routes.js +3 -1
- package/ccw/dist/core/routes/codexlens-routes.js.map +1 -1
- package/ccw/dist/tools/spec-index-builder.d.ts +8 -4
- package/ccw/dist/tools/spec-index-builder.d.ts.map +1 -1
- package/ccw/dist/tools/spec-index-builder.js +8 -4
- package/ccw/dist/tools/spec-index-builder.js.map +1 -1
- package/ccw/dist/tools/spec-init.d.ts +1 -1
- package/ccw/dist/tools/spec-init.d.ts.map +1 -1
- package/ccw/dist/tools/spec-init.js +127 -0
- package/ccw/dist/tools/spec-init.js.map +1 -1
- package/ccw/dist/tools/spec-loader.d.ts.map +1 -1
- package/ccw/dist/tools/spec-loader.js +2 -1
- package/ccw/dist/tools/spec-loader.js.map +1 -1
- package/ccw/frontend/dist/assets/{AlertDialog-gTMl4gSG.js → AlertDialog-BW9jiZ-p.js} +2 -2
- package/ccw/frontend/dist/assets/{AlertDialog-gTMl4gSG.js.map → AlertDialog-BW9jiZ-p.js.map} +1 -1
- package/ccw/frontend/dist/assets/{AnalysisPage-Bc4p4SvJ.js → AnalysisPage-ds-w_nVO.js} +2 -2
- package/ccw/frontend/dist/assets/{AnalysisPage-Bc4p4SvJ.js.map → AnalysisPage-ds-w_nVO.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ApiSettingsPage-CVK108u2.js → ApiSettingsPage-DlCbXxTz.js} +2 -2
- package/ccw/frontend/dist/assets/{ApiSettingsPage-CVK108u2.js.map → ApiSettingsPage-DlCbXxTz.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CliModeToggle-34Sjwl05.js → CliModeToggle-Dq3nL4fF.js} +2 -2
- package/ccw/frontend/dist/assets/{CliModeToggle-34Sjwl05.js.map → CliModeToggle-Dq3nL4fF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CliSessionSharePage-bJZAYI38.js → CliSessionSharePage-BNDkEE4u.js} +2 -2
- package/ccw/frontend/dist/assets/{CliSessionSharePage-bJZAYI38.js.map → CliSessionSharePage-BNDkEE4u.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CliViewerPage-VYnQGjxU.js → CliViewerPage-ChM-uNx_.js} +2 -2
- package/ccw/frontend/dist/assets/{CliViewerPage-VYnQGjxU.js.map → CliViewerPage-ChM-uNx_.js.map} +1 -1
- package/ccw/frontend/dist/assets/CodexLensPage-DOcsYNQk.js +2 -0
- package/ccw/frontend/dist/assets/CodexLensPage-DOcsYNQk.js.map +1 -0
- package/ccw/frontend/dist/assets/{Collapsible-B_xd1Qbg.js → Collapsible-CRNbykXN.js} +2 -2
- package/ccw/frontend/dist/assets/{Collapsible-B_xd1Qbg.js.map → Collapsible-CRNbykXN.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CommandsManagerPage-Bjx1bPbH.js → CommandsManagerPage-C2JWcemF.js} +2 -2
- package/ccw/frontend/dist/assets/{CommandsManagerPage-Bjx1bPbH.js.map → CommandsManagerPage-C2JWcemF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{DeepWikiPage-EgHsHvAH.js → DeepWikiPage-CvleOtJy.js} +2 -2
- package/ccw/frontend/dist/assets/{DeepWikiPage-EgHsHvAH.js.map → DeepWikiPage-CvleOtJy.js.map} +1 -1
- package/ccw/frontend/dist/assets/{EndpointsPage-CuwpbCzK.js → EndpointsPage-CMOWQG64.js} +2 -2
- package/ccw/frontend/dist/assets/{EndpointsPage-CuwpbCzK.js.map → EndpointsPage-CMOWQG64.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ExplorerPage-cvlx0Zw0.js → ExplorerPage-DaFPRlNo.js} +2 -2
- package/ccw/frontend/dist/assets/{ExplorerPage-cvlx0Zw0.js.map → ExplorerPage-DaFPRlNo.js.map} +1 -1
- package/ccw/frontend/dist/assets/{FixSessionPage-C74-MPza.js → FixSessionPage-CC4p04Az.js} +2 -2
- package/ccw/frontend/dist/assets/{FixSessionPage-C74-MPza.js.map → FixSessionPage-CC4p04Az.js.map} +1 -1
- package/ccw/frontend/dist/assets/{FloatingFileBrowser-x_-6y_n2.js → FloatingFileBrowser-DROn1xZ5.js} +2 -2
- package/ccw/frontend/dist/assets/{FloatingFileBrowser-x_-6y_n2.js.map → FloatingFileBrowser-DROn1xZ5.js.map} +1 -1
- package/ccw/frontend/dist/assets/{FloatingPanel-BGwmbJR1.js → FloatingPanel-CmL_yhDv.js} +2 -2
- package/ccw/frontend/dist/assets/{FloatingPanel-BGwmbJR1.js.map → FloatingPanel-CmL_yhDv.js.map} +1 -1
- package/ccw/frontend/dist/assets/{GraphExplorerPage-Bg5-aQxi.js → GraphExplorerPage-DCV5ybKE.js} +2 -2
- package/ccw/frontend/dist/assets/{GraphExplorerPage-Bg5-aQxi.js.map → GraphExplorerPage-DCV5ybKE.js.map} +1 -1
- package/ccw/frontend/dist/assets/{HistoryPage-C00fh0HE.js → HistoryPage-D0fYQZgc.js} +2 -2
- package/ccw/frontend/dist/assets/{HistoryPage-C00fh0HE.js.map → HistoryPage-D0fYQZgc.js.map} +1 -1
- package/ccw/frontend/dist/assets/{HookManagerPage-CtVTB_ae.js → HookManagerPage-D2FuJfsM.js} +2 -2
- package/ccw/frontend/dist/assets/{HookManagerPage-CtVTB_ae.js.map → HookManagerPage-D2FuJfsM.js.map} +1 -1
- package/ccw/frontend/dist/assets/{InstallationsPage-CYuMQDbC.js → InstallationsPage-tjklillZ.js} +2 -2
- package/ccw/frontend/dist/assets/{InstallationsPage-CYuMQDbC.js.map → InstallationsPage-tjklillZ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{IssueHubPage-T_VSvUMh.js → IssueHubPage-E4JVrhO1.js} +2 -2
- package/ccw/frontend/dist/assets/{IssueHubPage-T_VSvUMh.js.map → IssueHubPage-E4JVrhO1.js.map} +1 -1
- package/ccw/frontend/dist/assets/{LiteTasksPage-DmcgvIvi.js → LiteTasksPage-aJuRoyLt.js} +2 -2
- package/ccw/frontend/dist/assets/{LiteTasksPage-DmcgvIvi.js.map → LiteTasksPage-aJuRoyLt.js.map} +1 -1
- package/ccw/frontend/dist/assets/{McpManagerPage-C_a7QSKz.js → McpManagerPage-BJeuWJv1.js} +2 -2
- package/ccw/frontend/dist/assets/{McpManagerPage-C_a7QSKz.js.map → McpManagerPage-BJeuWJv1.js.map} +1 -1
- package/ccw/frontend/dist/assets/{MemoryPage-CWKmXY5k.js → MemoryPage-BI4FAXhs.js} +2 -2
- package/ccw/frontend/dist/assets/{MemoryPage-CWKmXY5k.js.map → MemoryPage-BI4FAXhs.js.map} +1 -1
- package/ccw/frontend/dist/assets/{NotFoundPage-B1duXK6r.js → NotFoundPage-DD2svchp.js} +2 -2
- package/ccw/frontend/dist/assets/{NotFoundPage-B1duXK6r.js.map → NotFoundPage-DD2svchp.js.map} +1 -1
- package/ccw/frontend/dist/assets/{OrchestratorPage-Ib9TM6HE.js → OrchestratorPage-FC__7yYa.js} +2 -2
- package/ccw/frontend/dist/assets/{OrchestratorPage-Ib9TM6HE.js.map → OrchestratorPage-FC__7yYa.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ProjectOverviewPage-sXSWMbF8.js → ProjectOverviewPage-DBB_-FzV.js} +2 -2
- package/ccw/frontend/dist/assets/{ProjectOverviewPage-sXSWMbF8.js.map → ProjectOverviewPage-DBB_-FzV.js.map} +1 -1
- package/ccw/frontend/dist/assets/{PromptHistoryPage-B6jaqG12.js → PromptHistoryPage-BwOAvCH8.js} +2 -2
- package/ccw/frontend/dist/assets/{PromptHistoryPage-B6jaqG12.js.map → PromptHistoryPage-BwOAvCH8.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ReviewSessionPage-D5qJyr3s.js → ReviewSessionPage-Dd1-g_gp.js} +2 -2
- package/ccw/frontend/dist/assets/{ReviewSessionPage-D5qJyr3s.js.map → ReviewSessionPage-Dd1-g_gp.js.map} +1 -1
- package/ccw/frontend/dist/assets/{RulesManagerPage-DyawK8QE.js → RulesManagerPage-B3RGdsKD.js} +2 -2
- package/ccw/frontend/dist/assets/{RulesManagerPage-DyawK8QE.js.map → RulesManagerPage-B3RGdsKD.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SessionDetailPage-Cym_RvC9.js → SessionDetailPage-DM-W5R8K.js} +2 -2
- package/ccw/frontend/dist/assets/{SessionDetailPage-Cym_RvC9.js.map → SessionDetailPage-DM-W5R8K.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SessionsPage-Dkc1Hv8W.js → SessionsPage-BVz1KCc7.js} +2 -2
- package/ccw/frontend/dist/assets/{SessionsPage-Dkc1Hv8W.js.map → SessionsPage-BVz1KCc7.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SettingsPage-Rik9cUIj.js → SettingsPage-ComW7EZS.js} +4 -4
- package/ccw/frontend/dist/assets/{SettingsPage-Rik9cUIj.js.map → SettingsPage-ComW7EZS.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SkillsManagerPage-BGDWYAyI.js → SkillsManagerPage-CKom9XwV.js} +2 -2
- package/ccw/frontend/dist/assets/{SkillsManagerPage-BGDWYAyI.js.map → SkillsManagerPage-CKom9XwV.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SpecsSettingsPage-CTiA1DMP.js → SpecsSettingsPage-DQz7WP2s.js} +2 -2
- package/ccw/frontend/dist/assets/{SpecsSettingsPage-CTiA1DMP.js.map → SpecsSettingsPage-DQz7WP2s.js.map} +1 -1
- package/ccw/frontend/dist/assets/{Switch-BgAFC-Wk.js → Switch-BPMdND9H.js} +2 -2
- package/ccw/frontend/dist/assets/{Switch-BgAFC-Wk.js.map → Switch-BPMdND9H.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TabsNavigation-drSnu5jn.js → TabsNavigation-qqt70VYL.js} +2 -2
- package/ccw/frontend/dist/assets/{TabsNavigation-drSnu5jn.js.map → TabsNavigation-qqt70VYL.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TaskDrawer-ePC__6-P.js → TaskDrawer-BqK_qiHX.js} +2 -2
- package/ccw/frontend/dist/assets/{TaskDrawer-ePC__6-P.js.map → TaskDrawer-BqK_qiHX.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TeamPage-C6bdFWn8.js → TeamPage-u5_i0Rgh.js} +2 -2
- package/ccw/frontend/dist/assets/{TeamPage-C6bdFWn8.js.map → TeamPage-u5_i0Rgh.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TerminalDashboardPage-Zofi_DZM.js → TerminalDashboardPage-rUtC9e40.js} +2 -2
- package/ccw/frontend/dist/assets/{TerminalDashboardPage-Zofi_DZM.js.map → TerminalDashboardPage-rUtC9e40.js.map} +1 -1
- package/ccw/frontend/dist/assets/{archive-Bza1KlB9.js → archive-C3u8YNQF.js} +2 -2
- package/ccw/frontend/dist/assets/{archive-Bza1KlB9.js.map → archive-C3u8YNQF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{archive-restore-CpsDm-cG.js → archive-restore-DfQ998g5.js} +2 -2
- package/ccw/frontend/dist/assets/{archive-restore-CpsDm-cG.js.map → archive-restore-DfQ998g5.js.map} +1 -1
- package/ccw/frontend/dist/assets/{arrow-right-CibG_LVO.js → arrow-right-BshJM9Po.js} +2 -2
- package/ccw/frontend/dist/assets/{arrow-right-CibG_LVO.js.map → arrow-right-BshJM9Po.js.map} +1 -1
- package/ccw/frontend/dist/assets/{bookmark-plus-BheO8EgG.js → bookmark-plus-D03qJyOZ.js} +2 -2
- package/ccw/frontend/dist/assets/{bookmark-plus-BheO8EgG.js.map → bookmark-plus-D03qJyOZ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{bot-BlhM0Nl0.js → bot-CyzWuwq0.js} +2 -2
- package/ccw/frontend/dist/assets/{bot-BlhM0Nl0.js.map → bot-CyzWuwq0.js.map} +1 -1
- package/ccw/frontend/dist/assets/{braces-Dqjg_eCO.js → braces-BPgtyjsG.js} +2 -2
- package/ccw/frontend/dist/assets/{braces-Dqjg_eCO.js.map → braces-BPgtyjsG.js.map} +1 -1
- package/ccw/frontend/dist/assets/{circle-stop-DYZSLYU0.js → circle-stop-Dix1AOmw.js} +2 -2
- package/ccw/frontend/dist/assets/{circle-stop-DYZSLYU0.js.map → circle-stop-Dix1AOmw.js.map} +1 -1
- package/ccw/frontend/dist/assets/{cpu-DWCyAOAv.js → cpu-CCQ4Q0Zh.js} +2 -2
- package/ccw/frontend/dist/assets/{cpu-DWCyAOAv.js.map → cpu-CCQ4Q0Zh.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ellipsis-vertical-DIyoSEHx.js → ellipsis-vertical-BpTysg-Y.js} +2 -2
- package/ccw/frontend/dist/assets/{ellipsis-vertical-DIyoSEHx.js.map → ellipsis-vertical-BpTysg-Y.js.map} +1 -1
- package/ccw/frontend/dist/assets/{eye-DUy7aLEx.js → eye-DGY1rAZs.js} +2 -2
- package/ccw/frontend/dist/assets/{eye-DUy7aLEx.js.map → eye-DGY1rAZs.js.map} +1 -1
- package/ccw/frontend/dist/assets/{eye-off-CGRUVRDR.js → eye-off-D8t3JfWG.js} +2 -2
- package/ccw/frontend/dist/assets/{eye-off-CGRUVRDR.js.map → eye-off-D8t3JfWG.js.map} +1 -1
- package/ccw/frontend/dist/assets/{file-json-BxLBtU9d.js → file-json-BAdJb0n8.js} +2 -2
- package/ccw/frontend/dist/assets/{file-json-BxLBtU9d.js.map → file-json-BAdJb0n8.js.map} +1 -1
- package/ccw/frontend/dist/assets/{file-text-BoHsW2es.js → file-text-DrJFiOUB.js} +2 -2
- package/ccw/frontend/dist/assets/{file-text-BoHsW2es.js.map → file-text-DrJFiOUB.js.map} +1 -1
- package/ccw/frontend/dist/assets/{filter-B4vOqP6B.js → filter-CKqzYbz7.js} +2 -2
- package/ccw/frontend/dist/assets/{filter-B4vOqP6B.js.map → filter-CKqzYbz7.js.map} +1 -1
- package/ccw/frontend/dist/assets/{folder-BKhwCNFG.js → folder-CV8511y9.js} +2 -2
- package/ccw/frontend/dist/assets/{folder-BKhwCNFG.js.map → folder-CV8511y9.js.map} +1 -1
- package/ccw/frontend/dist/assets/{gauge-Dgf64gkT.js → gauge-XKvmu_uU.js} +2 -2
- package/ccw/frontend/dist/assets/{gauge-Dgf64gkT.js.map → gauge-XKvmu_uU.js.map} +1 -1
- package/ccw/frontend/dist/assets/{globe-Cus_S6Ux.js → globe-C56cDUzX.js} +2 -2
- package/ccw/frontend/dist/assets/{globe-Cus_S6Ux.js.map → globe-C56cDUzX.js.map} +1 -1
- package/ccw/frontend/dist/assets/{grid-3x3-DM08hpAN.js → grid-3x3-Bya-suFW.js} +2 -2
- package/ccw/frontend/dist/assets/{grid-3x3-DM08hpAN.js.map → grid-3x3-Bya-suFW.js.map} +1 -1
- package/ccw/frontend/dist/assets/{hard-drive-eCtll84F.js → hard-drive-CmuTZpsB.js} +2 -2
- package/ccw/frontend/dist/assets/{hard-drive-eCtll84F.js.map → hard-drive-CmuTZpsB.js.map} +1 -1
- package/ccw/frontend/dist/assets/{hash-Bd1RD285.js → hash-CRPT_tJQ.js} +2 -2
- package/ccw/frontend/dist/assets/{hash-Bd1RD285.js.map → hash-CRPT_tJQ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{history-eyyCQA6b.js → history-C1pJZQCL.js} +2 -2
- package/ccw/frontend/dist/assets/{history-eyyCQA6b.js.map → history-C1pJZQCL.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-ZnmWxcZg.js → index-B6TpijCe.js} +2 -2
- package/ccw/frontend/dist/assets/{index-ZnmWxcZg.js.map → index-B6TpijCe.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-b2C0iFd1.js → index-Bcq-7r6F.js} +2 -2
- package/ccw/frontend/dist/assets/{index-b2C0iFd1.js.map → index-Bcq-7r6F.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-Cs2ShCCy.js → index-CI8-rBff.js} +2 -2
- package/ccw/frontend/dist/assets/{index-Cs2ShCCy.js.map → index-CI8-rBff.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-CY6Lueph.js → index-Dmt9OiEf.js} +2 -2
- package/ccw/frontend/dist/assets/{index-CY6Lueph.js.map → index-Dmt9OiEf.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-DfeBbFXo.js → index-anSMmEF8.js} +2 -2
- package/ccw/frontend/dist/assets/{index-DfeBbFXo.js.map → index-anSMmEF8.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-B6I7GQC5.js → index-dWT2M6Ef.js} +4 -4
- package/ccw/frontend/dist/assets/{index-B6I7GQC5.js.map → index-dWT2M6Ef.js.map} +1 -1
- package/ccw/frontend/dist/assets/{layout-grid-ChrTrCby.js → layout-grid-TSO0BFQE.js} +2 -2
- package/ccw/frontend/dist/assets/{layout-grid-ChrTrCby.js.map → layout-grid-TSO0BFQE.js.map} +1 -1
- package/ccw/frontend/dist/assets/{lightbulb-CvXiTlzN.js → lightbulb-Caj6fIQD.js} +2 -2
- package/ccw/frontend/dist/assets/{lightbulb-CvXiTlzN.js.map → lightbulb-Caj6fIQD.js.map} +1 -1
- package/ccw/frontend/dist/assets/{link-2-W0Nl17ec.js → link-2-DE9lMxa-.js} +2 -2
- package/ccw/frontend/dist/assets/{link-2-W0Nl17ec.js.map → link-2-DE9lMxa-.js.map} +1 -1
- package/ccw/frontend/dist/assets/{link-CL4JmoHb.js → link-BZtPgLW0.js} +2 -2
- package/ccw/frontend/dist/assets/{link-CL4JmoHb.js.map → link-BZtPgLW0.js.map} +1 -1
- package/ccw/frontend/dist/assets/{list-CDmYFcio.js → list-DubWyY-U.js} +2 -2
- package/ccw/frontend/dist/assets/{list-CDmYFcio.js.map → list-DubWyY-U.js.map} +1 -1
- package/ccw/frontend/dist/assets/{map-pin-0Mfsw_3d.js → map-pin-DwN_48AF.js} +2 -2
- package/ccw/frontend/dist/assets/{map-pin-0Mfsw_3d.js.map → map-pin-DwN_48AF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{messages-square-C6h08ple.js → messages-square-bjxvaiM9.js} +2 -2
- package/ccw/frontend/dist/assets/{messages-square-C6h08ple.js.map → messages-square-bjxvaiM9.js.map} +1 -1
- package/ccw/frontend/dist/assets/{minimize-2-Cbu2yRzi.js → minimize-2-CGfBKD_V.js} +2 -2
- package/ccw/frontend/dist/assets/{minimize-2-Cbu2yRzi.js.map → minimize-2-CGfBKD_V.js.map} +1 -1
- package/ccw/frontend/dist/assets/{package-CoLVUZGJ.js → package-nzWY6ilt.js} +2 -2
- package/ccw/frontend/dist/assets/{package-CoLVUZGJ.js.map → package-nzWY6ilt.js.map} +1 -1
- package/ccw/frontend/dist/assets/{plug-BYTYqsw1.js → plug-CiLce49C.js} +2 -2
- package/ccw/frontend/dist/assets/{plug-BYTYqsw1.js.map → plug-CiLce49C.js.map} +1 -1
- package/ccw/frontend/dist/assets/{power-DmIojFl-.js → power-CFLmB-U9.js} +2 -2
- package/ccw/frontend/dist/assets/{power-DmIojFl-.js.map → power-CFLmB-U9.js.map} +1 -1
- package/ccw/frontend/dist/assets/{save-BFa03OnG.js → save-DuO6OF0C.js} +2 -2
- package/ccw/frontend/dist/assets/{save-BFa03OnG.js.map → save-DuO6OF0C.js.map} +1 -1
- package/ccw/frontend/dist/assets/{send-Vet3sN4J.js → send-CZk9p0mM.js} +2 -2
- package/ccw/frontend/dist/assets/{send-Vet3sN4J.js.map → send-CZk9p0mM.js.map} +1 -1
- package/ccw/frontend/dist/assets/{square-check-big-B9nzZRfE.js → square-check-big-BY_1YQQg.js} +2 -2
- package/ccw/frontend/dist/assets/{square-check-big-B9nzZRfE.js.map → square-check-big-BY_1YQQg.js.map} +1 -1
- package/ccw/frontend/dist/assets/{square-pen-C7K13x4Z.js → square-pen-CnZgm6g-.js} +2 -2
- package/ccw/frontend/dist/assets/{square-pen-C7K13x4Z.js.map → square-pen-CnZgm6g-.js.map} +1 -1
- package/ccw/frontend/dist/assets/{star-BCQHcnSe.js → star-Cn1F0qy7.js} +2 -2
- package/ccw/frontend/dist/assets/{star-BCQHcnSe.js.map → star-Cn1F0qy7.js.map} +1 -1
- package/ccw/frontend/dist/assets/{style-CJsrp48L.js → style-Dxs1iXCV.js} +2 -2
- package/ccw/frontend/dist/assets/{style-CJsrp48L.js.map → style-Dxs1iXCV.js.map} +1 -1
- package/ccw/frontend/dist/assets/{target-CBzCJCB1.js → target-Bz1fLRKH.js} +2 -2
- package/ccw/frontend/dist/assets/{target-CBzCJCB1.js.map → target-Bz1fLRKH.js.map} +1 -1
- package/ccw/frontend/dist/assets/{test-tube-BYTc5mvQ.js → test-tube-C6qCYlDr.js} +2 -2
- package/ccw/frontend/dist/assets/{test-tube-BYTc5mvQ.js.map → test-tube-C6qCYlDr.js.map} +1 -1
- package/ccw/frontend/dist/assets/{upload-DzyQj7ib.js → upload-C71kd4Qs.js} +2 -2
- package/ccw/frontend/dist/assets/{upload-DzyQj7ib.js.map → upload-C71kd4Qs.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useApiSettings-CFPww7gU.js → useApiSettings-CqP2BAJ7.js} +2 -2
- package/ccw/frontend/dist/assets/{useApiSettings-CFPww7gU.js.map → useApiSettings-CqP2BAJ7.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useCli-ByL_a5CD.js → useCli-PCoPoVeM.js} +2 -2
- package/ccw/frontend/dist/assets/{useCli-ByL_a5CD.js.map → useCli-PCoPoVeM.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useCommands-BvKIoOzB.js → useCommands-3OfPQPw4.js} +2 -2
- package/ccw/frontend/dist/assets/{useCommands-BvKIoOzB.js.map → useCommands-3OfPQPw4.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useDebounce-CmKmoP7n.js → useDebounce-bXiFhQx9.js} +2 -2
- package/ccw/frontend/dist/assets/{useDebounce-CmKmoP7n.js.map → useDebounce-bXiFhQx9.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useFileExplorer-G5UoArCU.js → useFileExplorer-DEyUm46_.js} +2 -2
- package/ccw/frontend/dist/assets/{useFileExplorer-G5UoArCU.js.map → useFileExplorer-DEyUm46_.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useLocale-D2iHK44M.js → useLocale-sXTrdxcJ.js} +2 -2
- package/ccw/frontend/dist/assets/{useLocale-D2iHK44M.js.map → useLocale-sXTrdxcJ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useSkills-CYU4zqhm.js → useSkills-D0W0kXYm.js} +3 -3
- package/ccw/frontend/dist/assets/{useSkills-CYU4zqhm.js.map → useSkills-D0W0kXYm.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useSystemSettings-JznNpij7.js → useSystemSettings-DZ-8lZsG.js} +2 -2
- package/ccw/frontend/dist/assets/{useSystemSettings-JznNpij7.js.map → useSystemSettings-DZ-8lZsG.js.map} +1 -1
- package/ccw/frontend/dist/assets/{wand-sparkles-DqS0VCeN.js → wand-sparkles-83GmAYuw.js} +2 -2
- package/ccw/frontend/dist/assets/{wand-sparkles-DqS0VCeN.js.map → wand-sparkles-83GmAYuw.js.map} +1 -1
- package/ccw/frontend/dist/index.html +1 -1
- package/package.json +1 -1
- package/.claude/skills/team-arch-opt/role-specs/analyzer.md +0 -80
- package/.claude/skills/team-arch-opt/role-specs/designer.md +0 -118
- package/.claude/skills/team-arch-opt/role-specs/refactorer.md +0 -106
- package/.claude/skills/team-arch-opt/role-specs/reviewer.md +0 -116
- package/.claude/skills/team-arch-opt/role-specs/validator.md +0 -117
- package/.claude/skills/team-brainstorm/role-specs/challenger.md +0 -63
- package/.claude/skills/team-brainstorm/role-specs/evaluator.md +0 -58
- package/.claude/skills/team-brainstorm/role-specs/ideator.md +0 -71
- package/.claude/skills/team-brainstorm/role-specs/synthesizer.md +0 -59
- package/.claude/skills/team-frontend/role-specs/analyst.md +0 -91
- package/.claude/skills/team-frontend/role-specs/architect.md +0 -85
- package/.claude/skills/team-frontend/role-specs/developer.md +0 -92
- package/.claude/skills/team-frontend/role-specs/qa.md +0 -78
- package/.claude/skills/team-issue/role-specs/explorer.md +0 -95
- package/.claude/skills/team-issue/role-specs/implementer.md +0 -89
- package/.claude/skills/team-issue/role-specs/integrator.md +0 -86
- package/.claude/skills/team-issue/role-specs/planner.md +0 -83
- package/.claude/skills/team-issue/role-specs/reviewer.md +0 -89
- package/.claude/skills/team-iterdev/role-specs/architect.md +0 -64
- package/.claude/skills/team-iterdev/role-specs/developer.md +0 -73
- package/.claude/skills/team-iterdev/role-specs/reviewer.md +0 -65
- package/.claude/skills/team-iterdev/role-specs/tester.md +0 -87
- package/.claude/skills/team-perf-opt/role-specs/benchmarker.md +0 -110
- package/.claude/skills/team-perf-opt/role-specs/optimizer.md +0 -102
- package/.claude/skills/team-perf-opt/role-specs/profiler.md +0 -73
- package/.claude/skills/team-perf-opt/role-specs/reviewer.md +0 -91
- package/.claude/skills/team-perf-opt/role-specs/strategist.md +0 -114
- package/.claude/skills/team-planex/role-specs/executor.md +0 -90
- package/.claude/skills/team-planex/role-specs/planner.md +0 -110
- package/.claude/skills/team-quality-assurance/role-specs/analyst.md +0 -79
- package/.claude/skills/team-quality-assurance/role-specs/executor.md +0 -64
- package/.claude/skills/team-quality-assurance/role-specs/generator.md +0 -67
- package/.claude/skills/team-quality-assurance/role-specs/scout.md +0 -66
- package/.claude/skills/team-quality-assurance/role-specs/strategist.md +0 -70
- package/.claude/skills/team-review/role-specs/fixer.md +0 -75
- package/.claude/skills/team-review/role-specs/reviewer.md +0 -66
- package/.claude/skills/team-review/role-specs/scanner.md +0 -70
- package/.claude/skills/team-roadmap-dev/role-specs/executor.md +0 -71
- package/.claude/skills/team-roadmap-dev/role-specs/planner.md +0 -77
- package/.claude/skills/team-roadmap-dev/role-specs/verifier.md +0 -73
- package/.claude/skills/team-tech-debt/role-specs/assessor.md +0 -70
- package/.claude/skills/team-tech-debt/role-specs/executor.md +0 -80
- package/.claude/skills/team-tech-debt/role-specs/planner.md +0 -71
- package/.claude/skills/team-tech-debt/role-specs/scanner.md +0 -85
- package/.claude/skills/team-tech-debt/role-specs/validator.md +0 -83
- package/.claude/skills/team-testing/role-specs/analyst.md +0 -94
- package/.claude/skills/team-testing/role-specs/executor.md +0 -97
- package/.claude/skills/team-testing/role-specs/generator.md +0 -96
- package/.claude/skills/team-testing/role-specs/strategist.md +0 -82
- package/.claude/skills/team-uidesign/role-specs/designer.md +0 -72
- package/.claude/skills/team-uidesign/role-specs/implementer.md +0 -74
- package/.claude/skills/team-uidesign/role-specs/researcher.md +0 -84
- package/.claude/skills/team-uidesign/role-specs/reviewer.md +0 -70
- package/.claude/skills/team-ux-improve/role-specs/designer.md +0 -191
- package/.claude/skills/team-ux-improve/role-specs/diagnoser.md +0 -110
- package/.claude/skills/team-ux-improve/role-specs/explorer.md +0 -109
- package/.claude/skills/team-ux-improve/role-specs/implementer.md +0 -164
- package/.claude/skills/team-ux-improve/role-specs/scanner.md +0 -117
- package/.claude/skills/team-ux-improve/role-specs/tester.md +0 -163
- package/ccw/frontend/dist/assets/CodexLensPage-My6DnfN6.js +0 -2
- package/ccw/frontend/dist/assets/CodexLensPage-My6DnfN6.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionsPage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionsPage-BVz1KCc7.js","assets/file-text-DrJFiOUB.js","assets/test-tube-C6qCYlDr.js","assets/ellipsis-vertical-BpTysg-Y.js","assets/eye-DGY1rAZs.js","assets/archive-C3u8YNQF.js","assets/TabsNavigation-qqt70VYL.js","assets/minimize-2-CGfBKD_V.js","assets/filter-CKqzYbz7.js","assets/ProjectOverviewPage-DBB_-FzV.js","assets/layout-grid-TSO0BFQE.js","assets/square-pen-CnZgm6g-.js","assets/save-DuO6OF0C.js","assets/square-check-big-BY_1YQQg.js","assets/lightbulb-Caj6fIQD.js","assets/SessionDetailPage-DM-W5R8K.js","assets/Collapsible-CRNbykXN.js","assets/TaskDrawer-BqK_qiHX.js","assets/link-BZtPgLW0.js","assets/index-CI8-rBff.js","assets/folder-CV8511y9.js","assets/style-BZV40eAE.css","assets/package-nzWY6ilt.js","assets/HistoryPage-D0fYQZgc.js","assets/messages-square-bjxvaiM9.js","assets/file-json-BAdJb0n8.js","assets/hash-CRPT_tJQ.js","assets/cpu-CCQ4Q0Zh.js","assets/bot-CyzWuwq0.js","assets/OrchestratorPage-FC__7yYa.js","assets/link-2-DE9lMxa-.js","assets/useCommands-3OfPQPw4.js","assets/errorSanitizer-IY9pf5g4.js","assets/useSkills-D0W0kXYm.js","assets/bookmark-plus-D03qJyOZ.js","assets/grid-3x3-Bya-suFW.js","assets/list-DubWyY-U.js","assets/upload-C71kd4Qs.js","assets/IssueHubPage-E4JVrhO1.js","assets/history-C1pJZQCL.js","assets/arrow-right-BshJM9Po.js","assets/AlertDialog-BW9jiZ-p.js","assets/map-pin-DwN_48AF.js","assets/target-Bz1fLRKH.js","assets/SkillsManagerPage-CKom9XwV.js","assets/power-CFLmB-U9.js","assets/CliModeToggle-Dq3nL4fF.js","assets/FloatingFileBrowser-DROn1xZ5.js","assets/FloatingPanel-CmL_yhDv.js","assets/useFileExplorer-DEyUm46_.js","assets/eye-off-D8t3JfWG.js","assets/globe-C56cDUzX.js","assets/Switch-BPMdND9H.js","assets/CommandsManagerPage-C2JWcemF.js","assets/MemoryPage-BI4FAXhs.js","assets/formatDistanceToNow-DXTjigy3.js","assets/index-anSMmEF8.js","assets/star-Cn1F0qy7.js","assets/archive-restore-DfQ998g5.js","assets/MemoryPage-BEHUn5zE.css","assets/SettingsPage-ComW7EZS.js","assets/useSystemSettings-DZ-8lZsG.js","assets/useLocale-sXTrdxcJ.js","assets/send-CZk9p0mM.js","assets/useDebounce-bXiFhQx9.js","assets/LiteTasksPage-aJuRoyLt.js","assets/ReviewSessionPage-Dd1-g_gp.js","assets/McpManagerPage-BJeuWJv1.js","assets/hard-drive-CmuTZpsB.js","assets/EndpointsPage-CMOWQG64.js","assets/useCli-PCoPoVeM.js","assets/plug-CiLce49C.js","assets/InstallationsPage-tjklillZ.js","assets/HookManagerPage-D2FuJfsM.js","assets/circle-stop-Dix1AOmw.js","assets/wand-sparkles-83GmAYuw.js","assets/RulesManagerPage-B3RGdsKD.js","assets/PromptHistoryPage-BwOAvCH8.js","assets/ExplorerPage-DaFPRlNo.js","assets/GraphExplorerPage-DCV5ybKE.js","assets/braces-BPgtyjsG.js","assets/ApiSettingsPage-DlCbXxTz.js","assets/useApiSettings-CqP2BAJ7.js","assets/CliViewerPage-ChM-uNx_.js","assets/style-Dxs1iXCV.js","assets/style-CroWzXsC.css","assets/index-Dmt9OiEf.js","assets/TeamPage-u5_i0Rgh.js","assets/TerminalDashboardPage-rUtC9e40.js","assets/gauge-XKvmu_uU.js","assets/AnalysisPage-ds-w_nVO.js","assets/SpecsSettingsPage-DQz7WP2s.js","assets/DeepWikiPage-CvleOtJy.js","assets/CodexLensPage-DOcsYNQk.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var kQ=Object.defineProperty;var lN=e=>{throw TypeError(e)};var TQ=(e,t,r)=>t in e?kQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var _o=(e,t,r)=>TQ(e,typeof t!="symbol"?t+"":t,r),Tx=(e,t,r)=>t.has(e)||lN("Cannot "+r);var te=(e,t,r)=>(Tx(e,t,"read from private field"),r?r.call(e):t.get(e)),Je=(e,t,r)=>t.has(e)?lN("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),je=(e,t,r,n)=>(Tx(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),bt=(e,t,r)=>(Tx(e,t,"access private method"),r);var Ng=(e,t,r,n)=>({set _(i){je(e,t,i,r)},get _(){return te(e,t,n)}});function E6(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in e)){const o=Object.getOwnPropertyDescriptor(n,i);o&&Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:()=>n[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"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();var Mg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Gt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Px={exports:{}},Zf={},Ax={exports:{}},Ct={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -519,7 +519,7 @@ For more details see https://formatjs.io/docs/getting-started/message-distributi
|
|
|
519
519
|
[zustand devtools middleware] Unsupported __setState action format.
|
|
520
520
|
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
521
521
|
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|
|
522
|
-
`);const b=v.state[a];if(b==null)return;JSON.stringify(i.getState())!==JSON.stringify(b)&&g(b);return}OM(i)&&i.dispatch(v)});case"DISPATCH":switch(y.payload.type){case"RESET":return g(_),a===void 0?d==null?void 0:d.init(i.getState()):d==null?void 0:d.init(Ug(l.name));case"COMMIT":if(a===void 0){d==null||d.init(i.getState());return}return d==null?void 0:d.init(Ug(l.name));case"ROLLBACK":return Gx(y.state,v=>{if(a===void 0){g(v),d==null||d.init(i.getState());return}g(v[a]),d==null||d.init(Ug(l.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return Gx(y.state,v=>{if(a===void 0){g(v);return}JSON.stringify(i.getState())!==JSON.stringify(v[a])&&g(v[a])});case"IMPORT_STATE":{const{nextLiftedState:v}=y.payload,b=(m=v.computedStates.slice(-1)[0])==null?void 0:m.state;if(!b)return;g(a===void 0?b:b[a]),d==null||d.send(null,v);return}case"PAUSE_RECORDING":return p=!p}return}}),_},En=Wne,Gx=(e,t)=>{let r;try{r=JSON.parse(e)}catch(n){console.error("[zustand devtools middleware] Could not parse the received json",n)}r!==void 0&&t(r)};function Vne(e,t){let r;try{r=e()}catch{return}return{getItem:i=>{var o;const s=l=>l===null?null:JSON.parse(l,void 0),a=(o=r.getItem(i))!=null?o:null;return a instanceof Promise?a.then(s):s(a)},setItem:(i,o)=>r.setItem(i,JSON.stringify(o,void 0)),removeItem:i=>r.removeItem(i)}}const _k=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return _k(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return _k(n)(r)}}}},Gne=(e,t)=>(r,n,i)=>{let o={storage:Vne(()=>window.localStorage),partialize:m=>m,version:0,merge:(m,v)=>({...v,...m}),...t},s=!1,a=0;const l=new Set,c=new Set;let d=o.storage;if(!d)return e((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...m)},n,i);const u=()=>{const m=o.partialize({...n()});return d.setItem(o.name,{state:m,version:o.version})},p=i.setState;i.setState=(m,v)=>(p(m,v),u());const g=e((...m)=>(r(...m),u()),n,i);i.getInitialState=()=>g;let _;const y=()=>{var m,v;if(!d)return;const b=++a;s=!1,l.forEach(E=>{var C;return E((C=n())!=null?C:g)});const x=((v=o.onRehydrateStorage)==null?void 0:v.call(o,(m=n())!=null?m:g))||void 0;return _k(d.getItem.bind(d))(o.name).then(E=>{if(E)if(typeof E.version=="number"&&E.version!==o.version){if(o.migrate){const C=o.migrate(E.state,E.version);return C instanceof Promise?C.then(k=>[!0,k]):[!0,C]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,E.state];return[!1,void 0]}).then(E=>{var C;if(b!==a)return;const[k,P]=E;if(_=o.merge(P,(C=n())!=null?C:g),r(_,!0),k)return u()}).then(()=>{b===a&&(x==null||x(_,void 0),_=n(),s=!0,c.forEach(E=>E(_)))}).catch(E=>{b===a&&(x==null||x(void 0,E))})};return i.persist={setOptions:m=>{o={...o,...m},m.storage&&(d=m.storage)},clearStorage:()=>{d==null||d.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>y(),hasHydrated:()=>s,onHydrate:m=>(l.add(m),()=>{l.delete(m)}),onFinishHydration:m=>(c.add(m),()=>{c.delete(m)})},o.skipHydration||y(),_||g},im=Gne,Na={WORKFLOW_TASK:"workflow-task",RECENT_SESSIONS:"recent-sessions"},Kne=[{i:Na.WORKFLOW_TASK,name:"Workflow & Tasks",visible:!0,minW:6,minH:4},{i:Na.RECENT_SESSIONS,name:"Recent Sessions",visible:!0,minW:6,minH:3}],Xne={lg:[{i:Na.WORKFLOW_TASK,x:0,y:0,w:12,h:5,minW:6,minH:4},{i:Na.RECENT_SESSIONS,x:0,y:5,w:12,h:4,minW:6,minH:3}],md:[{i:Na.WORKFLOW_TASK,x:0,y:0,w:6,h:5,minW:4,minH:4},{i:Na.RECENT_SESSIONS,x:0,y:5,w:6,h:4,minW:4,minH:3}],sm:[{i:Na.WORKFLOW_TASK,x:0,y:0,w:2,h:8,minW:2,minH:6},{i:Na.RECENT_SESSIONS,x:0,y:8,w:2,h:5,minW:2,minH:4}]},Kx={widgets:Kne,layouts:Xne},Zne=(e,t,r)=>{const n=e[t];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((i,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},oze={en:"English",zh:"中文"};function Qne(){if(typeof window>"u")return"zh";const e=navigator.language.toLowerCase();return e.startsWith("zh")?"zh":e.startsWith("en")?"en":"zh"}function Uv(){var e;if(typeof window>"u")return"zh";try{const t=localStorage.getItem("ccw-app-store");if(t){const r=JSON.parse(t);if((e=r.state)!=null&&e.locale&&(r.state.locale==="en"||r.state.locale==="zh"))return r.state.locale}}catch{}return Qne()}async function Yne(e){try{return(await Zne(Object.assign({"../locales/en/index.ts":()=>Lt(()=>import("./index-b2C0iFd1.js"),[]),"../locales/zh/index.ts":()=>Lt(()=>import("./index-ZnmWxcZg.js"),[])}),`../locales/${e}/index.ts`,4)).default||{}}catch(t){return console.error(`Failed to load messages for locale "${e}":`,t),{}}}const iA={en:{},zh:{}};async function Jne(e){const t=await Yne(e);return iA[e]=t,xk(e),t}const Kz=KP();let Xz=ZP({locale:Uv(),messages:iA[Uv()]},Kz);function xk(e){Xz=ZP({locale:e,messages:iA[e]},Kz),typeof document<"u"&&(document.documentElement.lang=e)}function sze(e,t){return Xz.formatMessage({id:e},t)}const Zz=[{id:"blue",name:"经典蓝",accentColor:"#5b8fc4",description:"Classic professional blue tone"},{id:"green",name:"深邃绿",accentColor:"#10b981",description:"Deep natural green tone"},{id:"orange",name:"活力橙",accentColor:"#f97316",description:"Vibrant energetic orange tone"},{id:"purple",name:"优雅紫",accentColor:"#a855f7",description:"Elegant creative purple tone"}],Qz=[{id:"light",name:"浅色"},{id:"dark",name:"深色"}];function Yz(e,t){return`${t}-${e}`}function eie(e,t){const r=Zz.find(i=>i.id===e),n=Qz.find(i=>i.id===t);return!r||!n?"Unknown Theme":`${r.name} · ${n.name}`}Zz.flatMap(e=>Qz.map(t=>({id:Yz(e.id,t.id),scheme:e.id,mode:t.id,name:eie(e.id,t.id)})));const Jz={blur:0,darkenOpacity:0,saturation:100,enableFrostedGlass:!1,enableGrain:!1,enableVignette:!1},Go={mode:"gradient-only",imageUrl:null,attribution:null,effects:Jz},wk=3,tie={id:"default",name:"Default",colorScheme:"blue",customHue:null,isCustomTheme:!1,gradientLevel:"standard",enableHoverGlow:!0,enableBackgroundAnimation:!1,styleTier:"standard",isDefault:!0},rie={soft:{saturationScale:.6,lightnessOffset:{light:5,dark:-3},contrastBoost:.9},standard:{saturationScale:1,lightnessOffset:{light:0,dark:0},contrastBoost:1},"high-contrast":{saturationScale:1.3,lightnessOffset:{light:-5,dark:3},contrastBoost:1.2}};function nie(e){const r=e.trim().match(/^([\d.]+)\s+([\d.]+)%?\s+([\d.]+)%?$/);if(!r)return null;const n=parseFloat(r[1]),i=parseFloat(r[2]),o=parseFloat(r[3]);return isNaN(n)||isNaN(i)||isNaN(o)?null:{h:n,s:i,l:o}}function iie(e,t,r){const n=Math.max(0,Math.min(100,Math.round(t*10)/10)),i=Math.max(0,Math.min(100,Math.round(r*10)/10));return`${Math.round(e)} ${n}% ${i}%`}function IM(e,t,r){if(t==="standard")return e;const n=rie[t],i=r==="light"?n.lightnessOffset.light:n.lightnessOffset.dark,o={};for(const[s,a]of Object.entries(e)){const l=nie(a);if(!l){o[s]=a;continue}let c=l.s*n.saturationScale;c=Math.max(0,Math.min(100,c));let d=50+(l.l-50)*n.contrastBoost;d=d+i,d=Math.max(0,Math.min(100,d)),o[s]=iie(l.h,c,d)}return o}function oie(e,t){const r=(e%360+360)%360,n={};if(t==="light"){n["--bg"]=`${r} 5% 98%`,n["--bg-secondary"]=`${r} 8% 96%`,n["--surface"]=`${r} 10% 99%`,n["--surface-hover"]=`${r} 12% 97%`,n["--border"]=`${r} 15% 88%`,n["--border-hover"]=`${r} 18% 82%`,n["--text"]=`${r} 20% 15%`,n["--text-secondary"]=`${r} 10% 45%`,n["--text-tertiary"]=`${r} 8% 60%`,n["--text-disabled"]=`${r} 5% 70%`,n["--accent"]=`${r} 70% 60%`,n["--accent-hover"]=`${r} 75% 55%`,n["--accent-active"]=`${r} 80% 50%`,n["--accent-light"]=`${r} 65% 90%`,n["--accent-lighter"]=`${r} 60% 95%`,n["--primary"]=`${r} 70% 60%`,n["--primary-hover"]=`${r} 75% 55%`,n["--primary-light"]=`${r} 65% 90%`,n["--primary-lighter"]=`${r} 60% 95%`;const i=(r+180)%360;n["--secondary"]=`${i} 60% 65%`,n["--secondary-hover"]=`${i} 65% 60%`,n["--secondary-light"]=`${i} 55% 90%`,n["--muted"]=`${r} 12% 92%`,n["--muted-hover"]=`${r} 15% 88%`,n["--muted-text"]=`${r} 10% 45%`,n["--success"]="120 60% 50%",n["--success-light"]="120 55% 92%",n["--success-text"]="120 70% 35%",n["--warning"]="38 90% 55%",n["--warning-light"]="38 85% 92%",n["--warning-text"]="38 95% 40%",n["--error"]="0 70% 55%",n["--error-light"]="0 65% 92%",n["--error-text"]="0 75% 40%",n["--info"]="200 70% 55%",n["--info-light"]="200 65% 92%",n["--info-text"]="200 75% 40%",n["--destructive"]="0 70% 55%",n["--destructive-hover"]="0 75% 50%",n["--destructive-light"]="0 65% 92%",n["--hover"]=`${r} 12% 94%`,n["--active"]=`${r} 15% 90%`,n["--focus"]=`${r} 70% 60%`,n["--background"]=n["--bg"],n["--foreground"]=n["--text"],n["--card"]=n["--surface"],n["--card-foreground"]=n["--text"],n["--primary-foreground"]="0 0% 100%",n["--secondary-foreground"]="0 0% 100%",n["--accent-foreground"]="0 0% 100%",n["--destructive-foreground"]="0 0% 100%",n["--muted-foreground"]=n["--text-secondary"],n["--sidebar-background"]=`${r} 30% 97%`,n["--sidebar-foreground"]=n["--text"],n["--input"]=n["--border"],n["--ring"]=n["--accent"],n["--indigo"]="239 65% 60%",n["--indigo-light"]="239 65% 92%",n["--orange"]="25 90% 55%",n["--orange-light"]="25 90% 92%"}else{n["--bg"]=`${r} 20% 10%`,n["--bg-secondary"]=`${r} 18% 12%`,n["--surface"]=`${r} 15% 14%`,n["--surface-hover"]=`${r} 18% 16%`,n["--border"]=`${r} 10% 22%`,n["--border-hover"]=`${r} 12% 28%`,n["--text"]=`${r} 10% 90%`,n["--text-secondary"]=`${r} 8% 65%`,n["--text-tertiary"]=`${r} 6% 50%`,n["--text-disabled"]=`${r} 5% 40%`,n["--accent"]=`${r} 70% 60%`,n["--accent-hover"]=`${r} 75% 65%`,n["--accent-active"]=`${r} 80% 70%`,n["--accent-light"]=`${r} 60% 25%`,n["--accent-lighter"]=`${r} 55% 20%`,n["--primary"]=`${r} 70% 60%`,n["--primary-hover"]=`${r} 75% 65%`,n["--primary-light"]=`${r} 60% 25%`,n["--primary-lighter"]=`${r} 55% 20%`;const i=(r+180)%360;n["--secondary"]=`${i} 60% 65%`,n["--secondary-hover"]=`${i} 65% 70%`,n["--secondary-light"]=`${i} 55% 25%`,n["--muted"]=`${r} 15% 18%`,n["--muted-hover"]=`${r} 18% 22%`,n["--muted-text"]=`${r} 8% 65%`,n["--success"]="120 60% 55%",n["--success-light"]="120 50% 20%",n["--success-text"]="120 65% 65%",n["--warning"]="38 90% 60%",n["--warning-light"]="38 80% 22%",n["--warning-text"]="38 95% 70%",n["--error"]="0 70% 60%",n["--error-light"]="0 60% 20%",n["--error-text"]="0 75% 70%",n["--info"]="200 70% 60%",n["--info-light"]="200 60% 20%",n["--info-text"]="200 75% 70%",n["--destructive"]="0 70% 60%",n["--destructive-hover"]="0 75% 65%",n["--destructive-light"]="0 60% 20%",n["--hover"]=`${r} 18% 16%`,n["--active"]=`${r} 20% 20%`,n["--focus"]=`${r} 70% 60%`,n["--background"]=n["--bg"],n["--foreground"]=n["--text"],n["--card"]=n["--surface"],n["--card-foreground"]=n["--text"],n["--primary-foreground"]=`${r} 30% 10%`,n["--secondary-foreground"]="0 0% 100%",n["--accent-foreground"]=`${r} 30% 10%`,n["--destructive-foreground"]="0 0% 100%",n["--muted-foreground"]=n["--text-secondary"],n["--sidebar-background"]=`${r} 25% 12%`,n["--sidebar-foreground"]=n["--text"],n["--input"]=n["--border"],n["--ring"]=n["--accent"],n["--indigo"]="239 60% 55%",n["--indigo-light"]="239 40% 20%",n["--orange"]="25 85% 50%",n["--orange-light"]="25 50% 20%"}return n}const sie=[["--text","--bg",4.5],["--text","--surface",4.5],["--text-secondary","--bg",4.5],["--text-secondary","--surface",4.5],["--muted-text","--muted",4.5],["--muted-text","--bg",4.5],["--text-tertiary","--bg",3],["--text-disabled","--bg",3],["--accent","--bg",3],["--accent","--surface",3],["--success-text","--success-light",4.5],["--warning-text","--warning-light",4.5],["--error-text","--error-light",4.5],["--info-text","--info-light",4.5],["--primary-foreground","--primary",4.5],["--destructive-foreground","--destructive",4.5],["--text","--muted",4.5]];function Sk(e){const r=e.trim().match(/^([\d.]+)\s+([\d.]+)%?\s+([\d.]+)%?$/);if(!r)return null;const n=parseFloat(r[1]),i=parseFloat(r[2])/100,o=parseFloat(r[3])/100;return isNaN(n)||isNaN(i)||isNaN(o)?null:[n,i,o]}function aie(e,t,r){const n=(1-Math.abs(2*r-1))*t,i=e/60,o=n*(1-Math.abs(i%2-1)),s=r-n/2;let a,l,c;i<1?(a=n,l=o,c=0):i<2?(a=o,l=n,c=0):i<3?(a=0,l=n,c=o):i<4?(a=0,l=o,c=n):i<5?(a=o,l=0,c=n):(a=n,l=0,c=o);const d=a+s,u=l+s,p=c+s,g=_=>_<=.04045?_/12.92:Math.pow((_+.055)/1.055,2.4);return[g(d),g(u),g(p)]}function Wa(e){const t=Sk(e);if(!t)return-1;const[r,n,i]=t,[o,s,a]=aie(r,n,i);return Math.round((.2126*o+.7152*s+.0722*a)*1e4)/1e4}function Xh(e,t){const r=Math.max(e,t),n=Math.min(e,t);return Math.round((r+.05)/(n+.05)*100)/100}function RM(e){const t=[];for(const[r,n,i]of sie){const o=e[r],s=e[n];if(!o||!s)continue;const a=Wa(o),l=Wa(s);if(a<0||l<0)continue;const c=Xh(a,l),d=c>=i-.01;t.push({fgVar:r,bgVar:n,ratio:c,required:i,passed:d})}return t}function Hv(e,t,r){const n=Math.max(0,Math.min(100,Math.round(r*10)/10)),i=Math.max(0,Math.min(100,Math.round(t*10)/10));return`${Math.round(e)} ${i}% ${n}%`}function aze(e,t,r,n){const i=r[e],o=r[t];if(!i||!o)return[];const s=Sk(i),a=Sk(o);if(!s||!a)return[];const l=[],c=Wa(o),d=NM(s[0],s[1],s[2],c,n);for(const g of d){const _=Hv(s[0],s[1]*100,g*100),y=Wa(_);if(y<0)continue;const m=Xh(y,c);m>=n-.01&&l.push({target:"fg",original:i,suggested:_,resultRatio:m,distance:Math.abs(g-s[2])})}const u=Wa(i),p=NM(a[0],a[1],a[2],u,n);for(const g of p){const _=Hv(a[0],a[1]*100,g*100),y=Wa(_);if(y<0)continue;const m=Xh(u,y);m>=n-.01&&l.push({target:"bg",original:o,suggested:_,resultRatio:m,distance:Math.abs(g-a[2])})}return l.sort((g,_)=>g.distance-_.distance),l.slice(0,3)}function NM(e,t,r,n,i){const o=[];for(let a=r-.01;a>=0;a-=.01){const l=Hv(e,t*100,a*100),c=Wa(l);if(c<0)continue;if(Xh(c,n)>=i){o.push(a);break}}for(let a=r+.01;a<=1;a+=.01){const l=Hv(e,t*100,a*100),c=Wa(l);if(c<0)continue;if(Xh(c,n)>=i){o.push(a);break}}return o}function Ck(e){return e==="reduce"?!0:e==="enable"||typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const eU=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",rh=e=>e==="system"?eU():e,wo=(e,t)=>{const r=e.find(n=>n.id===t);return(r==null?void 0:r.styleTier)??"standard"},Dn=(e,t,r,n="standard",i=!0,o=!1,s="system",a="standard")=>{if(typeof document>"u")return;const l=()=>{document.documentElement.classList.remove("light","dark"),document.documentElement.classList.add(e);const d=["--bg","--bg-secondary","--surface","--surface-hover","--border","--border-hover","--text","--text-secondary","--text-tertiary","--text-disabled","--accent","--accent-hover","--accent-active","--accent-light","--accent-lighter","--primary","--primary-hover","--primary-light","--primary-lighter","--secondary","--secondary-hover","--secondary-light","--muted","--muted-hover","--muted-text","--success","--success-light","--success-text","--warning","--warning-light","--warning-text","--error","--error-light","--error-text","--info","--info-light","--info-text","--destructive","--destructive-hover","--destructive-light","--hover","--active","--focus","--background","--foreground","--card","--card-foreground","--primary-foreground","--secondary-foreground","--accent-foreground","--destructive-foreground","--muted-foreground","--sidebar-background","--sidebar-foreground","--input","--ring","--indigo","--indigo-light","--orange","--orange-light"];if(r!==null){let p=oie(r,e);if(a!=="standard"&&(p=IM(p,a,e)),Object.entries(p).forEach(([g,_])=>{document.documentElement.style.setProperty(g,_)}),document.documentElement.setAttribute("data-theme",`custom-${e}`),a!=="standard"){const _=RM(p).filter(y=>!y.passed);_.length>0&&console.warn('[Theme] Style tier "%s" caused %d WCAG AA contrast failures:',a,_.length,_.map(y=>`${y.fgVar}/${y.bgVar}: ${y.ratio}:1 (min ${y.required}:1)`))}}else{d.forEach(g=>{document.documentElement.style.removeProperty(g)});const p=Yz(t,e);if(document.documentElement.setAttribute("data-theme",p),a!=="standard"){const g=getComputedStyle(document.documentElement),_={};for(const b of d){const x=g.getPropertyValue(b).trim();x&&(_[b]=x)}const y=IM(_,a,e);Object.entries(y).forEach(([b,x])=>{document.documentElement.style.setProperty(b,x)});const v=RM(y).filter(b=>!b.passed);v.length>0&&console.warn('[Theme] Style tier "%s" on preset "%s" caused %d WCAG AA contrast failures:',a,t,v.length,v.map(b=>`${b.fgVar}/${b.bgVar}: ${b.ratio}:1 (min ${b.required}:1)`))}}document.documentElement.setAttribute("data-color-scheme",t),document.documentElement.setAttribute("data-gradient",n),document.documentElement.setAttribute("data-hover-glow",String(i)),document.documentElement.setAttribute("data-bg-animation",String(o));const u=Ck(s);document.documentElement.setAttribute("data-reduced-motion",String(u)),document.documentElement.setAttribute("data-style-tier",a)};!Ck(s)&&typeof document<"u"&&"startViewTransition"in document?document.startViewTransition(l):l()},wu=e=>{if(typeof document>"u")return;const t=document.documentElement;t.setAttribute("data-bg-mode",e.mode),t.setAttribute("data-bg-blur",String(e.effects.blur)),t.setAttribute("data-bg-darken",String(e.effects.darkenOpacity)),t.setAttribute("data-bg-saturation",String(e.effects.saturation)),t.setAttribute("data-bg-frosted",String(e.effects.enableFrostedGlass)),t.setAttribute("data-bg-grain",String(e.effects.enableGrain)),t.setAttribute("data-bg-vignette",String(e.effects.enableVignette))},lie={theme:"system",resolvedTheme:"light",colorScheme:"blue",customHue:null,isCustomTheme:!1,gradientLevel:"standard",enableHoverGlow:!0,enableBackgroundAnimation:!1,motionPreference:"system",locale:Uv(),sidebarOpen:!0,sidebarCollapsed:!1,expandedNavGroups:["overview","workflow","knowledge","issues","tools","configuration"],currentView:"sessions",currentFilter:"all",currentLiteType:null,currentSessionDetailKey:null,isLoading:!1,loadingMessage:null,error:null,dashboardLayout:null,themeSlots:[tie],activeSlotId:"default",deletedSlotBuffer:null,isImmersiveMode:!1},_t=gn()(En(im((e,t)=>({...lie,setTheme:r=>{const n=rh(r);e({theme:r,resolvedTheme:n},!1,"setTheme");const i=t(),o=wo(i.themeSlots,i.activeSlotId);Dn(n,i.colorScheme,i.customHue,i.gradientLevel,i.enableHoverGlow,i.enableBackgroundAnimation,i.motionPreference,o)},setColorScheme:r=>{e(o=>({colorScheme:r,customHue:null,isCustomTheme:!1,themeSlots:o.themeSlots.map(s=>s.id===o.activeSlotId?{...s,colorScheme:r,customHue:null,isCustomTheme:!1}:s)}),!1,"setColorScheme");const n=t(),i=wo(n.themeSlots,n.activeSlotId);Dn(n.resolvedTheme,r,null,n.gradientLevel,n.enableHoverGlow,n.enableBackgroundAnimation,n.motionPreference,i)},setCustomHue:r=>{if(r===null){const o=t(),s=wo(o.themeSlots,o.activeSlotId);e(a=>({customHue:null,isCustomTheme:!1,themeSlots:a.themeSlots.map(l=>l.id===a.activeSlotId?{...l,customHue:null,isCustomTheme:!1}:l)}),!1,"setCustomHue"),Dn(o.resolvedTheme,o.colorScheme,null,o.gradientLevel,o.enableHoverGlow,o.enableBackgroundAnimation,o.motionPreference,s);return}e(o=>({customHue:r,isCustomTheme:!0,themeSlots:o.themeSlots.map(s=>s.id===o.activeSlotId?{...s,customHue:r,isCustomTheme:!0}:s)}),!1,"setCustomHue");const n=t(),i=wo(n.themeSlots,n.activeSlotId);Dn(n.resolvedTheme,n.colorScheme,r,n.gradientLevel,n.enableHoverGlow,n.enableBackgroundAnimation,n.motionPreference,i)},toggleTheme:()=>{const{theme:r}=t(),n=r==="dark"?"light":"dark";t().setTheme(n)},setGradientLevel:r=>{e(o=>({gradientLevel:r,themeSlots:o.themeSlots.map(s=>s.id===o.activeSlotId?{...s,gradientLevel:r}:s)}),!1,"setGradientLevel");const n=t(),i=wo(n.themeSlots,n.activeSlotId);Dn(n.resolvedTheme,n.colorScheme,n.customHue,r,n.enableHoverGlow,n.enableBackgroundAnimation,n.motionPreference,i)},setEnableHoverGlow:r=>{e(o=>({enableHoverGlow:r,themeSlots:o.themeSlots.map(s=>s.id===o.activeSlotId?{...s,enableHoverGlow:r}:s)}),!1,"setEnableHoverGlow");const n=t(),i=wo(n.themeSlots,n.activeSlotId);Dn(n.resolvedTheme,n.colorScheme,n.customHue,n.gradientLevel,r,n.enableBackgroundAnimation,n.motionPreference,i)},setEnableBackgroundAnimation:r=>{e(o=>({enableBackgroundAnimation:r,themeSlots:o.themeSlots.map(s=>s.id===o.activeSlotId?{...s,enableBackgroundAnimation:r}:s)}),!1,"setEnableBackgroundAnimation");const n=t(),i=wo(n.themeSlots,n.activeSlotId);Dn(n.resolvedTheme,n.colorScheme,n.customHue,n.gradientLevel,n.enableHoverGlow,r,n.motionPreference,i)},setMotionPreference:r=>{e({motionPreference:r},!1,"setMotionPreference");const n=t(),i=wo(n.themeSlots,n.activeSlotId);Dn(n.resolvedTheme,n.colorScheme,n.customHue,n.gradientLevel,n.enableHoverGlow,n.enableBackgroundAnimation,r,i)},setStyleTier:r=>{e(i=>({themeSlots:i.themeSlots.map(o=>o.id===i.activeSlotId?{...o,styleTier:r}:o)}),!1,"setStyleTier");const n=t();Dn(n.resolvedTheme,n.colorScheme,n.customHue,n.gradientLevel,n.enableHoverGlow,n.enableBackgroundAnimation,n.motionPreference,r)},setLocale:r=>{e({locale:r},!1,"setLocale"),xk(r)},setSidebarOpen:r=>{e({sidebarOpen:r},!1,"setSidebarOpen")},toggleSidebar:()=>{e(r=>({sidebarOpen:!r.sidebarOpen}),!1,"toggleSidebar")},setSidebarCollapsed:r=>{e({sidebarCollapsed:r},!1,"setSidebarCollapsed")},setExpandedNavGroups:r=>{e({expandedNavGroups:r},!1,"setExpandedNavGroups")},setCurrentView:r=>{e({currentView:r},!1,"setCurrentView")},setCurrentFilter:r=>{e({currentFilter:r},!1,"setCurrentFilter")},setCurrentLiteType:r=>{e({currentLiteType:r},!1,"setCurrentLiteType")},setCurrentSessionDetailKey:r=>{e({currentSessionDetailKey:r},!1,"setCurrentSessionDetailKey")},setLoading:(r,n=null)=>{e({isLoading:r,loadingMessage:n},!1,"setLoading")},setError:r=>{e({error:r},!1,"setError")},clearError:()=>{e({error:null},!1,"clearError")},setDashboardLayouts:r=>{e(n=>{var i;return{dashboardLayout:{widgets:((i=n.dashboardLayout)==null?void 0:i.widgets)||Kx.widgets,layouts:r}}},!1,"setDashboardLayouts")},setDashboardWidgets:r=>{e(n=>{var i;return{dashboardLayout:{widgets:r,layouts:((i=n.dashboardLayout)==null?void 0:i.layouts)||Kx.layouts}}},!1,"setDashboardWidgets")},resetDashboardLayout:()=>{e({dashboardLayout:Kx},!1,"resetDashboardLayout")},setActiveSlot:r=>{const{themeSlots:n,motionPreference:i}=t(),o=n.find(a=>a.id===r);if(!o)return;const s=rh(t().theme);e({activeSlotId:r,colorScheme:o.colorScheme,customHue:o.customHue,isCustomTheme:o.isCustomTheme,gradientLevel:o.gradientLevel,enableHoverGlow:o.enableHoverGlow,enableBackgroundAnimation:o.enableBackgroundAnimation},!1,"setActiveSlot"),Dn(s,o.colorScheme,o.customHue,o.gradientLevel,o.enableHoverGlow,o.enableBackgroundAnimation,i,o.styleTier),wu(o.backgroundConfig??Go)},copySlot:()=>{const r=t();if(r.themeSlots.length>=wk)return;const n=new Set(r.themeSlots.map(l=>l.id)),o=["custom-1","custom-2"].find(l=>!n.has(l));if(!o)return;const s=r.themeSlots.find(l=>l.id===r.activeSlotId);if(!s)return;const a={id:o,name:`Copy of ${s.name}`,colorScheme:r.colorScheme,customHue:r.customHue,isCustomTheme:r.isCustomTheme,gradientLevel:r.gradientLevel,enableHoverGlow:r.enableHoverGlow,enableBackgroundAnimation:r.enableBackgroundAnimation,styleTier:s.styleTier,isDefault:!1,backgroundConfig:s.backgroundConfig};e({themeSlots:[...r.themeSlots,a],activeSlotId:o},!1,"copySlot")},renameSlot:(r,n)=>{e(i=>({themeSlots:i.themeSlots.map(o=>o.id===r?{...o,name:n}:o)}),!1,"renameSlot")},deleteSlot:r=>{const n=t(),i=n.themeSlots.find(s=>s.id===r);if(!i||i.isDefault)return;e({themeSlots:n.themeSlots.filter(s=>s.id!==r),deletedSlotBuffer:i,activeSlotId:"default"},!1,"deleteSlot");const o=n.themeSlots.find(s=>s.id==="default");if(o){const s=rh(n.theme);e({colorScheme:o.colorScheme,customHue:o.customHue,isCustomTheme:o.isCustomTheme,gradientLevel:o.gradientLevel,enableHoverGlow:o.enableHoverGlow,enableBackgroundAnimation:o.enableBackgroundAnimation},!1,"deleteSlot/applyDefault"),Dn(s,o.colorScheme,o.customHue,o.gradientLevel,o.enableHoverGlow,o.enableBackgroundAnimation,n.motionPreference,o.styleTier),wu(o.backgroundConfig??Go)}setTimeout(()=>{var a;((a=_t.getState().deletedSlotBuffer)==null?void 0:a.id)===r&&_t.setState({deletedSlotBuffer:null},!1)},1e4)},undoDeleteSlot:()=>{const r=t(),n=r.deletedSlotBuffer;if(!n||r.themeSlots.length>=wk)return;e({themeSlots:[...r.themeSlots,n],deletedSlotBuffer:null,activeSlotId:n.id},!1,"undoDeleteSlot");const i=rh(r.theme);e({colorScheme:n.colorScheme,customHue:n.customHue,isCustomTheme:n.isCustomTheme,gradientLevel:n.gradientLevel,enableHoverGlow:n.enableHoverGlow,enableBackgroundAnimation:n.enableBackgroundAnimation},!1,"undoDeleteSlot/apply"),Dn(i,n.colorScheme,n.customHue,n.gradientLevel,n.enableHoverGlow,n.enableBackgroundAnimation,r.motionPreference,n.styleTier),wu(n.backgroundConfig??Go)},setBackgroundConfig:r=>{e(n=>({themeSlots:n.themeSlots.map(i=>i.id===n.activeSlotId?{...i,backgroundConfig:r}:i)}),!1,"setBackgroundConfig"),wu(r)},updateBackgroundEffect:(r,n)=>{const i=t(),o=i.themeSlots.find(l=>l.id===i.activeSlotId),s=(o==null?void 0:o.backgroundConfig)??Go,a={...s,effects:{...s.effects,[r]:n}};t().setBackgroundConfig(a)},setBackgroundMode:r=>{const n=t(),i=n.themeSlots.find(a=>a.id===n.activeSlotId),s={...(i==null?void 0:i.backgroundConfig)??Go,mode:r};t().setBackgroundConfig(s)},setBackgroundImage:(r,n)=>{const i=t(),o=i.themeSlots.find(l=>l.id===i.activeSlotId),s=(o==null?void 0:o.backgroundConfig)??Go,a={...s,imageUrl:r,attribution:n};r&&s.mode==="gradient-only"&&(a.mode="image-gradient"),!r&&s.mode!=="gradient-only"&&(a.mode="gradient-only"),t().setBackgroundConfig(a)},setImmersiveMode:r=>{e({isImmersiveMode:r},!1,"setImmersiveMode")},toggleImmersiveMode:()=>{e(r=>({isImmersiveMode:!r.isImmersiveMode}),!1,"toggleImmersiveMode")}}),{name:"ccw-app-store",partialize:e=>({theme:e.theme,colorScheme:e.colorScheme,customHue:e.customHue,gradientLevel:e.gradientLevel,enableHoverGlow:e.enableHoverGlow,enableBackgroundAnimation:e.enableBackgroundAnimation,motionPreference:e.motionPreference,locale:e.locale,sidebarCollapsed:e.sidebarCollapsed,expandedNavGroups:e.expandedNavGroups,dashboardLayout:e.dashboardLayout,themeSlots:e.themeSlots,activeSlotId:e.activeSlotId}),onRehydrateStorage:()=>e=>{if(e){if(!e.themeSlots||!Array.isArray(e.themeSlots)||e.themeSlots.length===0){const i={id:"default",name:"Default",colorScheme:e.colorScheme??"blue",customHue:e.customHue??null,isCustomTheme:(e.customHue??null)!==null,gradientLevel:e.gradientLevel??"standard",enableHoverGlow:e.enableHoverGlow??!0,enableBackgroundAnimation:e.enableBackgroundAnimation??!1,styleTier:"standard",isDefault:!0};e.themeSlots=[i],e.activeSlotId="default"}(!e.activeSlotId||!e.themeSlots.find(i=>i.id===e.activeSlotId))&&(e.activeSlotId="default");const t=rh(e.theme);e.resolvedTheme=t,e.isCustomTheme=e.customHue!==null;const r=wo(e.themeSlots,e.activeSlotId);Dn(t,e.colorScheme,e.customHue,e.gradientLevel??"standard",e.enableHoverGlow??!0,e.enableBackgroundAnimation??!1,e.motionPreference??"system",r);const n=e.themeSlots.find(i=>i.id===e.activeSlotId);wu((n==null?void 0:n.backgroundConfig)??Go)}e&&xk(e.locale)}}),{name:"AppStore"}));if(typeof window<"u"){window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{const i=_t.getState();if(i.theme==="system"){const o=eU();_t.setState({resolvedTheme:o});const s=wo(i.themeSlots,i.activeSlotId);Dn(o,i.colorScheme,i.customHue,i.gradientLevel,i.enableHoverGlow,i.enableBackgroundAnimation,i.motionPreference,s)}});const t=_t.getState(),r=wo(t.themeSlots,t.activeSlotId);Dn(t.resolvedTheme,t.colorScheme,t.customHue,t.gradientLevel,t.enableHoverGlow,t.enableBackgroundAnimation,t.motionPreference,r);const n=t.themeSlots.find(i=>i.id===t.activeSlotId);wu((n==null?void 0:n.backgroundConfig)??Go)}const cie=e=>e.theme,uie=e=>e.resolvedTheme,die=e=>e.customHue,fie=e=>e.isCustomTheme,hie=e=>e.gradientLevel,pie=e=>e.enableHoverGlow,mie=e=>e.enableBackgroundAnimation,gie=e=>e.motionPreference,lze=e=>e.locale,vie=e=>e.themeSlots,yie=e=>e.activeSlotId,bie=e=>e.deletedSlotBuffer,_ie=e=>e.isImmersiveMode,Ek=2,xie=800,wie=/^ccw(\d+):(.+)$/,Sie=["blue","green","orange","purple"],Cie=["soft","standard","high-contrast"],Eie=["off","standard","enhanced"],kie=["gradient-only","image-only","image-gradient"];function MM(e){const t={v:Ek,c:e.colorScheme,h:e.customHue,t:e.styleTier,g:e.gradientLevel,w:e.enableHoverGlow,a:e.enableBackgroundAnimation},r=e.backgroundConfig;r&&r.mode!=="gradient-only"&&(t.bm=r.mode,r.imageUrl&&(t.bi=r.imageUrl),r.attribution&&(t.bp=r.attribution.photographerName,t.bu=r.attribution.photographerUrl,t.bpu=r.attribution.photoUrl),t.be={b:r.effects.blur,d:r.effects.darkenOpacity,s:r.effects.saturation,f:r.effects.enableFrostedGlass,g:r.effects.enableGrain,v:r.effects.enableVignette});const n=JSON.stringify(t),o=new TextEncoder().encode(n);let s="";for(let c=0;c<o.length;c++)s+=String.fromCharCode(o[c]);const l=btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`ccw${Ek}:${l}`}function Tie(e){if(!e||typeof e!="string")return{ok:!1,error:"empty_input"};const t=e.trim();if(t.length>xie)return{ok:!1,error:"too_long"};const r=t.match(wie);if(!r)return{ok:!1,error:"invalid_format"};const n=parseInt(r[1],10);let o=r[2].replace(/-/g,"+").replace(/_/g,"/");const s=o.length%4;s===2?o+="==":s===3&&(o+="=");let a;try{const g=atob(o),_=new Uint8Array(g.length);for(let m=0;m<g.length;m++)_[m]=g.charCodeAt(m);a=new TextDecoder().decode(_)}catch{return{ok:!1,error:"decode_failed"}}let l;try{l=JSON.parse(a)}catch{return{ok:!1,error:"parse_failed"}}if(!l||typeof l!="object"||Array.isArray(l))return{ok:!1,error:"invalid_payload"};const c=l,d=typeof c.v=="number"?c.v:n,u=Pie(d);if(!u.compatible)return{ok:!1,error:"incompatible_version"};if(typeof c.c!="string"||!Sie.includes(c.c))return{ok:!1,error:"invalid_field"};if(c.h!==null&&(typeof c.h!="number"||!isFinite(c.h)))return{ok:!1,error:"invalid_field"};if(typeof c.t!="string"||!Cie.includes(c.t))return{ok:!1,error:"invalid_field"};if(typeof c.g!="string"||!Eie.includes(c.g))return{ok:!1,error:"invalid_field"};if(typeof c.w!="boolean"||typeof c.a!="boolean")return{ok:!1,error:"invalid_field"};const p={version:d,colorScheme:c.c,customHue:c.h,styleTier:c.t,gradientLevel:c.g,enableHoverGlow:c.w,enableBackgroundAnimation:c.a};if(typeof c.bm=="string"&&kie.includes(c.bm)){const g={...Jz};if(c.be&&typeof c.be=="object"&&!Array.isArray(c.be)){const _=c.be;typeof _.b=="number"&&(g.blur=_.b),typeof _.d=="number"&&(g.darkenOpacity=_.d),typeof _.s=="number"&&(g.saturation=_.s),typeof _.f=="boolean"&&(g.enableFrostedGlass=_.f),typeof _.g=="boolean"&&(g.enableGrain=_.g),typeof _.v=="boolean"&&(g.enableVignette=_.v)}p.backgroundConfig={mode:c.bm,imageUrl:typeof c.bi=="string"?c.bi:null,attribution:typeof c.bp=="string"&&typeof c.bu=="string"&&typeof c.bpu=="string"?{photographerName:c.bp,photographerUrl:c.bu,photoUrl:c.bpu}:null,effects:g}}return{ok:!0,payload:p,warning:u.warning}}function Pie(e){const t=Math.abs(e-Ek);return t>2?{compatible:!1}:t>0?{compatible:!0,warning:"version_mismatch"}:{compatible:!0}}function Aie(){const e=_t(cie),t=_t(uie),r=_t(xe=>xe.colorScheme),n=_t(die),i=_t(fie),o=_t(hie),s=_t(pie),a=_t(mie),l=_t(gie),c=_t(xe=>xe.setTheme),d=_t(xe=>xe.setColorScheme),u=_t(xe=>xe.setCustomHue),p=_t(xe=>xe.toggleTheme),g=_t(xe=>xe.setGradientLevel),_=_t(xe=>xe.setEnableHoverGlow),y=_t(xe=>xe.setEnableBackgroundAnimation),m=_t(xe=>xe.setMotionPreference),v=_t(xe=>xe.setStyleTier),b=_t(vie),x=_t(yie),E=_t(bie),C=_t(xe=>xe.setBackgroundConfig),k=_t(xe=>xe.updateBackgroundEffect),P=_t(xe=>xe.setBackgroundMode),T=_t(xe=>xe.setBackgroundImage),I=_t(xe=>xe.setActiveSlot),N=_t(xe=>xe.copySlot),B=_t(xe=>xe.renameSlot),M=_t(xe=>xe.deleteSlot),F=_t(xe=>xe.undoDeleteSlot),U=O.useCallback(xe=>{c(xe)},[c]),q=O.useCallback(xe=>{d(xe)},[d]),V=O.useCallback(xe=>{u(xe)},[u]),K=O.useCallback(()=>{p()},[p]),D=O.useCallback(xe=>{g(xe)},[g]),$=O.useCallback(xe=>{_(xe)},[_]),j=O.useCallback(xe=>{y(xe)},[y]),z=O.useCallback(xe=>{m(xe)},[m]),X=O.useCallback(xe=>{v(xe)},[v]),W=Ck(l),le=O.useMemo(()=>b.find(xe=>xe.id===x),[b,x]),ce=b.length<wk,ve=(le==null?void 0:le.styleTier)??"standard",H=(le==null?void 0:le.backgroundConfig)??Go,Q=O.useCallback(xe=>{I(xe)},[I]),Y=O.useCallback(()=>{N()},[N]),re=O.useCallback((xe,et)=>{B(xe,et)},[B]),ge=O.useCallback(xe=>{M(xe)},[M]),ee=O.useCallback(()=>{F()},[F]),Ie=O.useCallback(()=>MM(le||{colorScheme:r,customHue:n,gradientLevel:o,enableHoverGlow:s,enableBackgroundAnimation:a,styleTier:ve}),[le,x,r,n,i,o,s,a,ve]),Re=O.useCallback(xe=>Tie(xe),[]);return{theme:e,resolvedTheme:t,isDark:t==="dark",colorScheme:r,customHue:n,isCustomTheme:i,gradientLevel:o,enableHoverGlow:s,enableBackgroundAnimation:a,motionPreference:l,resolvedMotion:W,setTheme:U,setColorScheme:q,setCustomHue:V,toggleTheme:K,setGradientLevel:D,setEnableHoverGlow:$,setEnableBackgroundAnimation:j,setMotionPreference:z,styleTier:ve,setStyleTier:X,themeSlots:b,activeSlotId:x,activeSlot:le,deletedSlotBuffer:E,canAddSlot:ce,setActiveSlot:Q,copySlot:Y,renameSlot:re,deleteSlot:ge,undoDeleteSlot:ee,exportThemeCode:Ie,importThemeCode:Re,backgroundConfig:H,setBackgroundConfig:C,updateBackgroundEffect:k,setBackgroundMode:P,setBackgroundImage:T}}const tU=5;let Ih=[];function Oie(){return Ih.shift()}function Tv(e){e&&(Ih.includes(e)||Ih.length>=tU||Ih.push(e))}let nh=null;async function rU(){return nh||(nh=(async()=>{try{const e=await fetch("/api/csrf-token",{credentials:"same-origin"});if(!e.ok)throw new Error("Failed to fetch CSRF token");const r=(await e.json()).csrfToken;if(!r)throw new Error("No CSRF token in response");return r}finally{nh=null}})(),nh)}function Iie(e){const t=e.headers.get("X-CSRF-Token");t&&Tv(t)}async function nU(){try{const e=await fetch(`/api/csrf-token?count=${tU}`,{credentials:"same-origin"});if(!e.ok)throw new Error("Failed to initialize CSRF token pool");const t=await e.json();if(t.tokens&&Array.isArray(t.tokens))for(const r of t.tokens)Tv(r);else t.csrfToken&&Tv(t.csrfToken);console.log(`[CSRF] Token pool initialized with ${Ih.length} tokens`)}catch(e){console.error("[CSRF] Failed to initialize CSRF token pool:",e);try{const t=await rU();Tv(t)}catch(t){console.error("[CSRF] Fallback token fetch failed:",t)}}}async function oe(e,t={}){const r=new Headers(t.headers);if(t.method&&["POST","PUT","PATCH","DELETE"].includes(t.method)){let i=Oie();if(!i){console.warn("[CSRF] Token pool depleted, fetching synchronously");try{i=await rU()}catch{throw new Error("Failed to acquire CSRF token for request")}}i&&r.set("X-CSRF-Token",i)}t.body&&typeof t.body=="string"&&r.set("Content-Type","application/json");const n=await fetch(e,{...t,headers:r,credentials:"same-origin"});if(Iie(n),!n.ok){const i={message:n.statusText||"Request failed",status:n.status},o=n.headers.get("content-type");if(o&&o.includes("application/json"))try{const s=await n.json();s.message?i.message=s.message:s.error&&(i.message=s.error),s.code&&(i.code=s.code)}catch{}throw i}if(n.status!==204)try{return await n.json()}catch(i){const o=i instanceof Error?i.message:"Unknown error";throw new Error(`Failed to parse JSON response: ${o}`)}}function Rie(e){const t=e.toLowerCase();return t.includes("-review-")||t.includes("-code-review-")?"review":t.includes("-tdd-")||t.includes("-test-driven-")?"tdd":t.includes("-test-")||t.includes("-testing-")?"test":t.includes("-docs-")||t.includes("-doc-")||t.includes("-documentation-")?"docs":t.includes("-lite-plan-")?"lite-plan":t.includes("-lite-fix-")||t.includes("-fix-")?"lite-fix":"workflow"}function jM(e,t){const n={active:"in_progress",completed:"completed",archived:"archived",planning:"planning",paused:"paused"}[e.status]||e.status;let i=e.project||e.session_id,o;if(e.project&&e.project.includes(":")){const c=e.project.split(":");i=c[0].trim(),o=c.slice(1).join(":").trim()}let s=e.type||Rie(e.session_id);const a=e;let l;if(a.hasReview){s!=="review"&&(s="review");const c=a.reviewDimensions||[],d=c.reduce((u,p)=>{var g;return u+(((g=p.findings)==null?void 0:g.length)||0)},0);l={dimensions:c.map(u=>({name:u.name,findings:u.findings||[]})),dimensions_count:c.length,findings:d,iterations:void 0,fixes:void 0}}return{session_id:e.session_id,type:s,title:i,description:o,status:n,created_at:e.created_at,updated_at:e.updated_at,location:t,path:e.path,has_plan:e.has_plan,plan_updated_at:e.plan_updated_at,has_review:a.hasReview,review:l,summaries:e.summaries,tasks:(e.tasks||[]).map(c=>IU(c))}}async function iU(e){var t,r,n,i,o,s,a,l;try{const c=e?`/api/data?path=${encodeURIComponent(e)}`:"/api/data",d=await oe(c);return d?{totalSessions:((t=d.statistics)==null?void 0:t.totalSessions)??0,activeSessions:((r=d.statistics)==null?void 0:r.activeSessions)??0,archivedSessions:((n=d.statistics)==null?void 0:n.archivedSessions)??0,totalTasks:((i=d.statistics)==null?void 0:i.totalTasks)??0,completedTasks:((o=d.statistics)==null?void 0:o.completedTasks)??0,pendingTasks:((s=d.statistics)==null?void 0:s.pendingTasks)??0,failedTasks:((a=d.statistics)==null?void 0:a.failedTasks)??0,todayActivity:((l=d.statistics)==null?void 0:l.todayActivity)??0}:(console.warn("[API] No data received from /api/data for dashboard stats"),DM())}catch(c){return console.error("[API] Failed to fetch dashboard stats:",c),DM()}}function DM(){return{totalSessions:0,activeSessions:0,archivedSessions:0,totalTasks:0,completedTasks:0,pendingTasks:0,failedTasks:0,todayActivity:0}}async function oA(e){try{const t=e?`/api/data?path=${encodeURIComponent(e)}`:"/api/data",r=await oe(t);if(!r)return console.warn("[API] No data received from /api/data for sessions"),{activeSessions:[],archivedSessions:[]};const n=(r.activeSessions??[]).map(o=>{try{return jM(o,"active")}catch(s){return console.error("[API] Failed to transform active session:",o,s),{session_id:o.session_id,title:o.project||o.session_id,status:"in_progress",created_at:o.created_at,location:"active"}}}),i=(r.archivedSessions??[]).map(o=>{try{return jM(o,"archived")}catch(s){return console.error("[API] Failed to transform archived session:",o,s),{session_id:o.session_id,title:o.project||o.session_id,status:o.status==="active"?"in_progress":o.status,created_at:o.created_at,location:"archived"}}});return{activeSessions:n,archivedSessions:i}}catch(t){return console.error("[API] Failed to fetch sessions:",t),{activeSessions:[],archivedSessions:[]}}}async function oU(e){return oe(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"POST"})}async function sU(e){return oe(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}async function aU(){return(await oe("/api/recent-paths")).paths??[]}async function lU(e){return(await oe("/api/remove-recent-path",{method:"POST",body:JSON.stringify({path:e})})).paths}async function cU(e){return oe(`/api/switch-path?path=${encodeURIComponent(e)}`)}async function uU(e){const t=e?`/api/issues?path=${encodeURIComponent(e)}`:"/api/issues";return{issues:(await oe(t)).issues??[]}}async function dU(e){const t=e?`/api/issues/history?path=${encodeURIComponent(e)}`:"/api/issues/history";return{issues:(await oe(t)).issues??[]}}async function fU(e){const t=e?`/api/queue?path=${encodeURIComponent(e)}`:"/api/queue";return oe(t)}async function hU(e){return oe("/api/issues",{method:"POST",body:JSON.stringify(e)})}async function pU(e,t){return oe(`/api/issues/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}async function mU(e){return oe(`/api/issues/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Nie(e,t){const r=new FormData;t.forEach(i=>{r.append("files",i)});const n=await fetch(`/api/issues/${encodeURIComponent(e)}/attachments`,{method:"POST",body:r,credentials:"same-origin"});if(!n.ok){const i=await n.json().catch(()=>({error:"Upload failed"}));throw new Error(i.error||"Failed to upload attachments")}return n.json()}async function Mie(e={}){const t=new URLSearchParams;e.state&&t.set("state",e.state),e.limit&&t.set("limit",String(e.limit)),e.labels&&t.set("labels",e.labels),e.downloadImages&&t.set("downloadImages","true");const r=`/api/issues/pull${t.toString()?"?"+t.toString():""}`;return oe(r,{method:"POST"})}async function gU(e){return oe(`/api/queue/history?path=${encodeURIComponent(e)}`)}async function vU(e,t){return oe(`/api/queue/${encodeURIComponent(e)}?path=${encodeURIComponent(t)}`)}async function yU(e,t){return oe(`/api/queue/activate?path=${encodeURIComponent(t)}`,{method:"POST",body:JSON.stringify({queueId:e})})}async function bU(e){return oe(`/api/queue/deactivate?path=${encodeURIComponent(e)}`,{method:"POST"})}async function _U(e,t){return oe(`/api/queue/reorder?path=${encodeURIComponent(e)}`,{method:"POST",body:JSON.stringify(t)})}async function xU(e,t){return oe(`/api/queue/move?path=${encodeURIComponent(e)}`,{method:"POST",body:JSON.stringify(t)})}async function wU(e,t){return oe(`/api/queue/${encodeURIComponent(e)}?path=${encodeURIComponent(t)}`,{method:"DELETE"})}async function SU(e,t,r){return oe(`/api/queue/merge?path=${encodeURIComponent(r)}`,{method:"POST",body:JSON.stringify({sourceQueueId:e,targetQueueId:t})})}async function CU(e,t,r){return oe(`/api/queue/split?path=${encodeURIComponent(r)}`,{method:"POST",body:JSON.stringify({sourceQueueId:e,itemIds:t})})}async function EU(e){const t=e?`/api/discoveries?path=${encodeURIComponent(e)}`:"/api/discoveries",r=await oe(t);return(r.discoveries??r.sessions??[]).map(i=>{var a,l;let o="running";i.phase==="complete"||i.phase==="completed"?o="completed":i.phase==="failed"&&(o="failed");const s=((l=(a=i.progress)==null?void 0:a.perspective_analysis)==null?void 0:l.percent_complete)??0;return{id:i.discovery_id||i.id,name:i.target_pattern||i.discovery_id||i.name||"Discovery",status:o,progress:s,findings_count:i.total_findings??i.findings_count??0,created_at:i.created_at,completed_at:i.completed_at}})}async function kU(e,t){const r=t?`/api/discoveries/${encodeURIComponent(e)}/findings?path=${encodeURIComponent(t)}`:`/api/discoveries/${encodeURIComponent(e)}/findings`;return((await oe(r)).findings??[]).map(i=>({...i,severity:i.severity||i.priority||"medium"}))}async function TU(e,{findingIds:t,exportAll:r},n){const i=n?`/api/discoveries/${encodeURIComponent(e)}/export?path=${encodeURIComponent(n)}`:`/api/discoveries/${encodeURIComponent(e)}/export`;return oe(i,{method:"POST",body:JSON.stringify({finding_ids:t,export_all:r})})}async function jie(e,t="claude"){const r=(a,l)=>a.map(c=>({...c,location:l,enabled:!0})),n=(a,l)=>a.map(c=>({...c,location:l,enabled:!1})),i=a=>{const l=r(a.projectSkills??[],"project"),c=r(a.userSkills??[],"user"),d=n(a.disabledProjectSkills??[],"project"),u=n(a.disabledUserSkills??[],"user");return[...l,...c,...d,...u]},o=t==="codex"?"&cliType=codex":"";if(e)try{const a=`/api/skills?path=${encodeURIComponent(e)}&includeDisabled=true${o}`,l=await oe(a);return{skills:i(l)}}catch(a){const l=a;if(l.status===403||l.status===404)console.warn("[fetchSkills] 403/404 for project path, falling back to global skills");else throw a}const s=await oe(`/api/skills?includeDisabled=true${o}`);return{skills:i(s)}}async function Die(e,t,r,n="claude"){return oe(`/api/skills/${encodeURIComponent(e)}/enable`,{method:"POST",body:JSON.stringify({location:t,projectPath:r,cliType:n})})}async function Lie(e,t,r,n="claude"){return oe(`/api/skills/${encodeURIComponent(e)}/disable`,{method:"POST",body:JSON.stringify({location:t,projectPath:r,cliType:n})})}async function $ie(e,t,r,n="claude"){const i=n==="codex"?"&cliType=codex":"",o=r?`/api/skills/${encodeURIComponent(e)}?location=${t}&path=${encodeURIComponent(r)}${i}`:`/api/skills/${encodeURIComponent(e)}?location=${t}${i}`;return oe(o)}async function Bie(e,t,r,n="claude"){return oe(`/api/skills/${encodeURIComponent(e)}`,{method:"DELETE",body:JSON.stringify({location:t,projectPath:r,cliType:n})})}async function Fie(e){return oe("/api/skills/validate-import",{method:"POST",body:JSON.stringify({sourcePath:e})})}async function zie(e){return oe("/api/skills/create",{method:"POST",body:JSON.stringify(e)})}async function Uie(e){const{skillName:t,fileName:r,location:n,projectPath:i,cliType:o="claude"}=e,a=`/api/skills/${encodeURIComponent(t)}/file?filename=${encodeURIComponent(r)}&location=${n}&cliType=${o}${i?`&path=${encodeURIComponent(i)}`:""}`;return oe(a)}async function Hie(e){if(e)try{const t=`/api/commands?path=${encodeURIComponent(e)}`,r=await oe(t),n=[...r.projectCommands??[],...r.userCommands??[]];return{commands:r.commands??n,groups:r.groups,projectGroupsConfig:r.projectGroupsConfig,userGroupsConfig:r.userGroupsConfig}}catch(t){const r=t;if(r.status===403||r.status===404||r.status===400)console.warn("[fetchCommands] Path validation failed, falling back to global commands");else throw t}try{const t=await oe("/api/commands"),r=[...t.projectCommands??[],...t.userCommands??[]];return{commands:t.commands??r,groups:t.groups,projectGroupsConfig:t.projectGroupsConfig,userGroupsConfig:t.userGroupsConfig}}catch(t){throw console.error("[fetchCommands] Failed to fetch commands:",t),t}}async function qie(e,t,r,n){return oe(`/api/commands/${encodeURIComponent(e)}/toggle`,{method:"POST",body:JSON.stringify({enabled:t,location:r,projectPath:n})})}async function Wie(e,t,r,n){return oe(`/api/commands/group/${encodeURIComponent(e)}/toggle`,{method:"POST",body:JSON.stringify({enable:t,location:r,projectPath:n})})}async function Vie(e){return oe("/api/commands/validate-import",{method:"POST",body:JSON.stringify({sourcePath:e})})}async function Gie(e){return oe("/api/commands/create",{method:"POST",body:JSON.stringify(e)})}async function Kie(e){if(e)try{const r=`/api/core-memory/memories?path=${encodeURIComponent(e)}`,n=await oe(r);return{memories:n.memories??[],totalSize:n.totalSize??0,claudeMdCount:n.claudeMdCount??0}}catch(r){const n=r;if(n.status===403||n.status===404)console.warn("[fetchMemories] 403/404 for project path, falling back to global memories");else throw r}const t=await oe("/api/core-memory/memories");return{memories:t.memories??[],totalSize:t.totalSize??0,claudeMdCount:t.claudeMdCount??0}}async function Xie(e,t){return oe("/api/core-memory/memories",{method:"POST",body:JSON.stringify({...e,path:t})}).then(n=>n.memory)}async function Zie(e,t,r){return oe("/api/core-memory/memories",{method:"POST",body:JSON.stringify({id:e,...t,path:r})}).then(i=>i.memory)}async function Qie(e,t){const r=t?`/api/core-memory/memories/${encodeURIComponent(e)}?path=${encodeURIComponent(t)}`:`/api/core-memory/memories/${encodeURIComponent(e)}`;return oe(r,{method:"DELETE"})}async function Yie(e,t){const r=t?`/api/core-memory/memories/${encodeURIComponent(e)}/archive?path=${encodeURIComponent(t)}`:`/api/core-memory/memories/${encodeURIComponent(e)}/archive`;return oe(r,{method:"POST"})}async function Jie(e,t){const r=t?`/api/core-memory/memories/${encodeURIComponent(e)}/unarchive?path=${encodeURIComponent(t)}`:`/api/core-memory/memories/${encodeURIComponent(e)}/unarchive`;return oe(r,{method:"POST"})}async function eoe(e,t){const r=new URLSearchParams;return t&&r.set("path",t),oe(`/api/core-memory/extract?${r}`,{method:"POST",body:JSON.stringify({max_sessions:e})})}async function toe(e){const t=new URLSearchParams;return e&&t.set("path",e),oe(`/api/core-memory/extract/status?${t}`)}async function roe(e){const t=new URLSearchParams;return e&&t.set("path",e),oe(`/api/core-memory/consolidate?${t}`,{method:"POST"})}async function noe(e){const t=new URLSearchParams;return e&&t.set("path",e),oe(`/api/core-memory/consolidate/status?${t}`)}async function ioe(e,t){const r=new URLSearchParams;return t&&r.set("path",t),e!=null&&e.kind&&r.set("kind",e.kind),e!=null&&e.status_filter&&r.set("status_filter",e.status_filter),oe(`/api/core-memory/jobs?${r}`)}async function ooe(e=!1,t,r){const n=new URLSearchParams;return r&&n.set("path",r),e&&n.set("include_native","true"),oe(`/api/core-memory/extract/preview?${n}`)}async function soe(e){const t=new URLSearchParams;return e.path&&t.set("path",e.path),oe(`/api/core-memory/extract/selective?${t}`,{method:"POST",body:JSON.stringify({session_ids:e.sessionIds,include_native:e.includeNative})})}async function PU(e){const t=e?`/api/ccw?path=${encodeURIComponent(e)}`:"/api/ccw";return(await oe(t)).projectOverview??null}async function AU(e,t){const r=t?`/api/ccw/guidelines?path=${encodeURIComponent(t)}`:"/api/ccw/guidelines";return oe(r,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function aoe(e,t){const r=await oA(t),i=[...r.activeSessions,...r.archivedSessions].find(d=>d.session_id===e);if(!i)throw new Error(`Session not found: ${e}`);const o=i.path||i.session_id,s=await oe(`/api/session-detail?path=${encodeURIComponent(o)}&type=all`);let a=s.summary;!a&&s.summaries&&s.summaries.length>0&&(a=s.summaries[0].content||s.summaries[0].name||"");const l=s.context?{context:s.context}:void 0;return{session:{...i,tasks:s.tasks||i.tasks||[]},context:l,summary:a,summaries:s.summaries,implPlan:s.implPlan,conflicts:s.conflictResolution,review:s.review}}async function loe(e){const t=e?`/api/cli/history-native?path=${encodeURIComponent(e)}`:"/api/cli/history-native";return{executions:(await oe(t)).executions??[]}}async function coe(e){await oe(`/api/cli/history/${encodeURIComponent(e)}`,{method:"DELETE"})}async function uoe(e){await oe(`/api/cli/history/tool/${encodeURIComponent(e)}`,{method:"DELETE"})}async function doe(){await oe("/api/cli/history",{method:"DELETE"})}async function foe(e,t,r){return oe("/api/bulk-update-task-status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionPath:e,taskIds:t,newStatus:r})})}async function hoe(e,t,r){return oe("/api/update-task-status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionPath:e,taskId:t,newStatus:r})})}async function OU(e,t){const r=new URLSearchParams({id:e});return t&&r.set("path",t),await oe(`/api/cli/execution?${r.toString()}`)}async function poe(e,t){const r=new URLSearchParams({id:e});return t&&r.set("path",t),oe(`/api/cli/native-session?${r.toString()}`)}async function moe(e){const t=new URLSearchParams;if(e.filePath)t.set("filePath",e.filePath),e.tool&&t.set("tool",e.tool);else if(e.executionId)t.set("id",e.executionId);else throw new Error("Either executionId or filePath is required");e.projectPath&&t.set("path",e.projectPath),e.format&&t.set("format",e.format),e.thoughts&&t.set("thoughts","true"),e.tools&&t.set("tools","true"),e.tokens&&t.set("tokens","true");const r=`/api/cli/native-session?${t.toString()}`;if(e.format==="text"){const n=await fetch(r,{credentials:"same-origin"});if(!n.ok){const i=await n.json().catch(()=>({error:"Request failed"}));throw new Error(i.error||n.statusText)}return n.text()}return oe(r)}async function goe(e={}){const{tool:t,project:r,limit:n=50,cursor:i}=e,o=new URLSearchParams;t&&o.set("tool",t),r&&o.set("path",r),n&&o.set("limit",String(n)),i&&o.set("cursor",i);const s=o.toString();return oe(`/api/cli/native-sessions${s?`?${s}`:""}`)}function voe(e){if(!(!Array.isArray(e)||e.length===0))return e.map(t=>typeof t=="string"?{path:t}:t)}function IU(e){var g;if(!e||typeof e!="object")return{task_id:"N/A",status:"pending",_raw:e};const t=e.context,r=e.flow_control,n=e.meta,i=e.convergence,o=e.modification_points,s=t==null?void 0:t.requirements,a=e.details,l=e.description||(Array.isArray(s)&&s.length>0?s.join("; "):void 0)||(Array.isArray(a)&&a.length>0?a.join("; "):void 0)||e.scope,c=voe(e.files)||(r==null?void 0:r.target_files)||(o!=null&&o.length?o.filter(_=>_.file).map(_=>({path:_.file,name:_.target,change:_.change})):void 0),d=e.focus_paths||(t==null?void 0:t.focus_paths)||(c!=null&&c.length?c.map(_=>_.path).filter(Boolean):void 0)||[],u=e.acceptance,p=i||((g=t==null?void 0:t.acceptance)!=null&&g.length?{criteria:t.acceptance}:void 0)||(u!=null&&u.length?{criteria:u}:void 0);return{task_id:e.task_id||e.id||"N/A",title:e.title,description:l,status:e.status||"pending",priority:e.priority,created_at:e.created_at,updated_at:e.updated_at,has_summary:e.has_summary,estimated_complexity:e.estimated_complexity,depends_on:e.depends_on||(t==null?void 0:t.depends_on)||[],focus_paths:d,convergence:p,pre_analysis:e.pre_analysis||(r==null?void 0:r.pre_analysis),implementation:e.implementation||(r==null?void 0:r.implementation_approach),files:c,type:e.type||(n==null?void 0:n.type),scope:e.scope||(n==null?void 0:n.scope),action:e.action||(n==null?void 0:n.action),flow_control:r,context:t,meta:n,_raw:e}}function yoe(e){var i,o,s;const t=e.pre_analysis,r=e.implementation,n=e.files;return!(t!=null&&t.length)&&!(r!=null&&r.length)&&!(n!=null&&n.length)?e.flow_control:{pre_analysis:t||((i=e.flow_control)==null?void 0:i.pre_analysis),implementation_approach:r||((o=e.flow_control)==null?void 0:o.implementation_approach),target_files:n||((s=e.flow_control)==null?void 0:s.target_files)}}async function sA(e){const t=e?`/api/data?path=${encodeURIComponent(e)}`:"/api/data";return(await oe(t)).liteTasks||{}}async function RU(e,t,r){const n=await sA(r);return(t==="lite-plan"?n.litePlan||[]:t==="lite-fix"?n.liteFix||[]:n.multiCliPlan||[]).find(o=>o.id===e||o.session_id===e)||null}async function boe(e){return await oe(`/api/session-detail?path=${encodeURIComponent(e)}&type=context`)}async function NU(){var t;const e=await oe("/api/data");if(e.activeSessions){const r=e.activeSessions.filter(n=>n.type==="review"||n.hasReview);if(r.length>0)return r.map(n=>{var i;return{session_id:n.session_id,title:n.project||n.session_id,description:"",type:"review",phase:(i=n.reviewSummary)==null?void 0:i.phase,reviewDimensions:n.reviewDimensions||[],reviewSummary:n.reviewSummary,_isActive:!0,created_at:n.created_at,updated_at:void 0,status:n.status}})}return e.reviewSessions&&e.reviewSessions.length>0?e.reviewSessions:(t=e.reviewData)!=null&&t.sessions?e.reviewData.sessions.map(r=>({session_id:r.session_id,title:r.session_id,description:"",type:"review",phase:"in-progress",reviewDimensions:r.dimensions.map(n=>({name:n.name,findings:n.findings||[]})),_isActive:!0,created_at:void 0,updated_at:void 0,status:"active"})):[]}async function _oe(e){return(await NU()).find(r=>r.session_id===e)||null}function MU(e){return e.transport==="stdio"}function xoe(e){return e.transport==="http"}async function Tc(){return oe("/api/mcp-config")}function Xr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qv(e){const t=e.trim();if(!t)return"";let r=t.replace(/\\/g,"/");return/^\/[a-zA-Z]\//.test(r)&&(r=r.charAt(1).toUpperCase()+":"+r.slice(2)),/^[a-zA-Z]:\//.test(r)&&(r=r.charAt(0).toUpperCase()+r.slice(1)),r.replace(/\/+$/,"")}function jU(e,t){if(!t)return null;const r=qv(t);if(!r)return null;for(const n of Object.keys(e))if(qv(n)===r)return n;return t in e?t:null}function Wv(e){if(!Xr(e))return{transport:"stdio",command:""};const t=typeof e.url=="string"&&e.url.trim()!=="",r=e.type==="http"||e.transport==="http";if(t||r){const l=typeof e.url=="string"?e.url:"",c=Xr(e.headers)?Object.fromEntries(Object.entries(e.headers).flatMap(([_,y])=>typeof y=="string"?[[_,y]]:[])):void 0,d=typeof e.bearer_token_env_var=="string"?e.bearer_token_env_var:void 0,u=Xr(e.http_headers)?Object.fromEntries(Object.entries(e.http_headers).flatMap(([_,y])=>typeof y=="string"?[[_,y]]:[])):void 0,p=Array.isArray(e.env_http_headers)?e.env_http_headers.filter(_=>typeof _=="string"):void 0,g={transport:"http",url:l};return c&&Object.keys(c).length>0&&(g.headers=c),d&&(g.bearerTokenEnvVar=d),u&&Object.keys(u).length>0&&(g.httpHeaders=u),p&&p.length>0&&(g.envHttpHeaders=p),g}const n=typeof e.command=="string"?e.command:"",i=Array.isArray(e.args)?e.args.filter(l=>typeof l=="string"):void 0,o=Xr(e.env)?Object.fromEntries(Object.entries(e.env).flatMap(([l,c])=>typeof c=="string"?[[l,c]]:[])):void 0,s=typeof e.cwd=="string"?e.cwd:void 0,a={transport:"stdio",command:n};return i&&i.length>0&&(a.args=i),o&&Object.keys(o).length>0&&(a.env=o),s&&(a.cwd=s),a}async function x0(e){const t=await Tc(),r=Xr(t.projects)?t.projects:{},n=jU(r,e),i=n&&Xr(r[n])?r[n]:null,o=i&&Array.isArray(i.disabledMcpServers)?i.disabledMcpServers.filter(p=>typeof p=="string"):[],s=new Set(o),a=Xr(t.userServers)?t.userServers:{},l=i&&Xr(i.mcpServers)?i.mcpServers:{},c=Object.entries(a).map(([p,g])=>{const _=Wv(g);return{name:p,..._,enabled:!s.has(p),scope:"global"}}),d=Object.entries(l).map(([p,g])=>{const _=Wv(g);return{name:p,..._,enabled:!s.has(p),scope:"project"}}),u=[];for(const p of d){const g=c.find(_=>_.name===p.name);g&&u.push({name:p.name,projectServer:p,globalServer:g,effectiveScope:"global"})}return{project:d,global:c,conflicts:u}}function Ya(e,t){const r=e==null?void 0:e.trim();if(!r)throw new Error(`${t}: projectPath is required`);return r}function DU(e){if(e.transport==="http"){const n={url:"url"in e&&typeof e.url=="string"?e.url:""};return n.type="http",e.headers&&Object.keys(e.headers).length>0&&(n.headers=e.headers),e.bearerTokenEnvVar&&(n.bearer_token_env_var=e.bearerTokenEnvVar),e.httpHeaders&&Object.keys(e.httpHeaders).length>0&&(n.http_headers=e.httpHeaders),e.envHttpHeaders&&e.envHttpHeaders.length>0&&(n.env_http_headers=e.envHttpHeaders),n}const t={};return"command"in e&&typeof e.command=="string"&&(t.command=e.command),"args"in e&&Array.isArray(e.args)&&e.args.length>0&&(t.args=e.args),"env"in e&&e.env&&Object.keys(e.env).length>0&&(t.env=e.env),"cwd"in e&&typeof e.cwd=="string"&&e.cwd.trim()&&(t.cwd=e.cwd),t}function LM(e,t){const r=t.transport??"stdio",n=t.enabled??!0,i=t.scope??"project";if(r==="http"){const c="url"in t&&typeof t.url=="string"?t.url:"";return{name:e,transport:"http",url:c,enabled:n,scope:i}}const o="command"in t&&typeof t.command=="string"?t.command:"",s="args"in t&&Array.isArray(t.args)?t.args:void 0,a="env"in t&&t.env&&typeof t.env=="object"?t.env:void 0,l="cwd"in t&&typeof t.cwd=="string"?t.cwd:void 0;return{name:e,transport:"stdio",command:o,args:s,env:a,cwd:l,enabled:n,scope:i}}async function woe(e,t,r={}){var i;if(!t.scope)throw new Error("updateMcpServer: scope is required");if(t.transport==="http"){const o="url"in t?t.url:void 0;if(typeof o!="string"||!o.trim())throw new Error("updateMcpServer: url is required for HTTP servers")}else{const o="command"in t?t.command:void 0;if(typeof o!="string"||!o.trim())throw new Error("updateMcpServer: command is required for STDIO servers")}const n=DU(t);if(t.scope==="global"){const o=await oe("/api/mcp-add-global-server",{method:"POST",body:JSON.stringify({serverName:e,serverConfig:n})});if(o!=null&&o.error)throw new Error(o.error)}else{const o=Ya(r.projectPath,"updateMcpServer"),s=r.configType??"mcp",a=await oe("/api/mcp-copy-server",{method:"POST",body:JSON.stringify({projectPath:o,serverName:e,serverConfig:n,configType:s})});if(a!=null&&a.error)throw new Error(a.error)}if(typeof t.enabled=="boolean"){const o=(i=r.projectPath)==null?void 0:i.trim();if(o){const s=await oe("/api/mcp-toggle",{method:"POST",body:JSON.stringify({projectPath:o,serverName:e,enable:t.enabled})});if(s!=null&&s.error)throw new Error(s.error)}}if(r.projectPath){const o=await x0(r.projectPath);return[...o.project,...o.global].find(s=>s.name===e)??LM(e,t)}return LM(e,t)}async function Soe(e,t={}){var i,o,s;if(!((i=e.name)!=null&&i.trim()))throw new Error("createMcpServer: name is required");if(e.transport==="http"){if(!((o=e.url)!=null&&o.trim()))throw new Error("createMcpServer: url is required for HTTP servers")}else if(!((s=e.command)!=null&&s.trim()))throw new Error("createMcpServer: command is required for STDIO servers");const r=e.name.trim(),n=DU(e);if(e.scope==="global"){const a=await oe("/api/mcp-add-global-server",{method:"POST",body:JSON.stringify({serverName:r,serverConfig:n})});if(a!=null&&a.error)throw new Error(a.error)}else{const a=Ya(t.projectPath,"createMcpServer"),l=t.configType??"mcp",c=await oe("/api/mcp-copy-server",{method:"POST",body:JSON.stringify({projectPath:a,serverName:r,serverConfig:n,configType:l})});if(c!=null&&c.error)throw new Error(c.error)}if(e.enabled===!1){const a=Ya(t.projectPath,"createMcpServer"),l=await oe("/api/mcp-toggle",{method:"POST",body:JSON.stringify({projectPath:a,serverName:r,enable:!1})});if(l!=null&&l.error)throw new Error(l.error)}if(t.projectPath){const a=await x0(t.projectPath);return[...a.project,...a.global].find(l=>l.name===r)??e}return e}async function Coe(e,t,r={}){if(t==="global"){const o=await oe("/api/mcp-remove-global-server",{method:"POST",body:JSON.stringify({serverName:e})});if(o!=null&&o.error)throw new Error(o.error);return}const n=Ya(r.projectPath,"deleteMcpServer"),i=await oe("/api/mcp-remove-server",{method:"POST",body:JSON.stringify({projectPath:n,serverName:e})});if(i!=null&&i.error)throw new Error(i.error)}async function Eoe(e,t,r={}){const n=Ya(r.projectPath,"toggleMcpServer"),i=await oe("/api/mcp-toggle",{method:"POST",body:JSON.stringify({projectPath:n,serverName:e,enable:t})});if(i!=null&&i.error)throw new Error(i.error);const o=await x0(n);return[...o.project,...o.global].find(s=>s.name===e)??{name:e,transport:"stdio",command:"",enabled:t,scope:"project"}}async function LU(){const e=await oe("/api/codex-mcp-config"),t=Xr(e.servers)?e.servers:{};return{servers:Object.entries(t).map(([n,i])=>{const o=Wv(i),s=Xr(i)?i.enabled!==!1:!0;return{name:n,...o,enabled:s,scope:"global",configPath:e.configPath}}),configPath:e.configPath}}async function w0(e,t){return oe("/api/codex-mcp-add",{method:"POST",body:JSON.stringify({serverName:e,serverConfig:t})})}async function $U(e){return oe("/api/codex-mcp-remove",{method:"POST",body:JSON.stringify({serverName:e})})}async function koe(e,t){return oe("/api/codex-mcp-toggle",{method:"POST",body:JSON.stringify({serverName:e,enabled:t})})}async function Toe(){return(await oe("/api/mcp-templates")).templates??[]}async function Poe(e){return oe("/api/mcp-templates",{method:"POST",body:JSON.stringify(e)})}async function Aoe(e){return oe(`/api/mcp-templates/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Ooe(e){return oe("/api/mcp-templates/install",{method:"POST",body:JSON.stringify(e)})}async function Ioe(e){return(await oe(`/api/mcp-templates/search?q=${encodeURIComponent(e)}`)).templates??[]}async function Roe(){return(await oe("/api/mcp-templates/categories")).categories??[]}async function Noe(e){return(await oe(`/api/mcp-templates/category/${encodeURIComponent(e)}`)).templates??[]}async function Moe(){const e=await Tc();return{projects:Object.keys(e.projects??{}).sort((r,n)=>r.localeCompare(n))}}async function joe(e){const t=await Tc(),r=Xr(t.userServers)?t.userServers:{},n=Xr(t.enterpriseServers)?t.enterpriseServers:{},i=e&&e.length>0?new Set(e.map(s=>qv(s))):null,o={};for(const[s,a]of Object.entries(t.projects??{})){const l=qv(s);if(i&&!i.has(l))continue;const c=Xr(a)?a:{},d=Xr(c.mcpServers)?c.mcpServers:{},u=Array.isArray(c.disabledMcpServers)?c.disabledMcpServers.filter(g=>typeof g=="string"):[],p=new Set(u);o[s]=Object.entries(d).filter(([g])=>!(g in r)&&!(g in n)).flatMap(([g,_])=>{const y=Wv(_);return y.transport!=="stdio"?[]:[{name:g,command:y.command,args:y.args,env:y.env,enabled:!p.has(g)}]})}return{servers:o}}async function Doe(e){const t=e.serverNames??[];if(t.length===0||e.source===e.target)return{success:!0,copied:[],failed:[]};const r=[],n=[];if(e.source==="claude"&&e.target==="codex"){const i=await Tc(),o=Xr(i.projects)?i.projects:{},s=jU(o,e.projectPath??void 0),a=s&&Xr(o[s])?o[s]:null,l=a&&Xr(a.mcpServers)?a.mcpServers:{};for(const c of t)try{const d=l[c]??(i.userServers?i.userServers[c]:void 0)??(i.enterpriseServers?i.enterpriseServers[c]:void 0);if(!Xr(d)){n.push({name:c,error:"Source server config not found"});continue}const u=await w0(c,d);if(u!=null&&u.error){n.push({name:c,error:u.error});continue}r.push(c)}catch(d){n.push({name:c,error:d instanceof Error?d.message:String(d)})}return{success:r.length>0,copied:r,failed:n}}if(e.source==="codex"&&e.target==="claude"){const i=Ya(e.projectPath,"crossCliCopy"),o=await oe("/api/codex-mcp-config"),s=Xr(o.servers)?o.servers:{};for(const a of t)try{const l=s[a];if(!Xr(l)){n.push({name:a,error:"Source server config not found"});continue}const c=await oe("/api/mcp-copy-server",{method:"POST",body:JSON.stringify({projectPath:i,serverName:a,serverConfig:l,configType:"mcp"})});if(c!=null&&c.error){n.push({name:a,error:c.error});continue}r.push(a)}catch(l){n.push({name:a,error:l instanceof Error?l.message:String(l)})}return{success:r.length>0,copied:r,failed:n}}return{success:!1,copied:[],failed:t.map(i=>({name:i,error:"Unsupported copy direction"}))}}async function Loe(){return{endpoints:(await oe("/api/cli/endpoints")).endpoints??[]}}async function $oe(e,t){return oe(`/api/cli/endpoints/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}async function Boe(e){return oe("/api/cli/endpoints",{method:"POST",body:JSON.stringify(e)})}async function Foe(e){await oe(`/api/cli/endpoints/${encodeURIComponent(e)}`,{method:"DELETE"})}async function zoe(e,t){return oe(`/api/cli/endpoints/${encodeURIComponent(e)}/toggle`,{method:"POST",body:JSON.stringify({enabled:t})})}async function Uoe(){return{tools:(await oe("/api/cli/installations")).tools??[]}}async function Hoe(e){return oe(`/api/cli/installations/${encodeURIComponent(e)}/install`,{method:"POST"})}async function qoe(e){await oe(`/api/cli/installations/${encodeURIComponent(e)}/uninstall`,{method:"POST"})}async function Woe(e){return oe(`/api/cli/installations/${encodeURIComponent(e)}/upgrade`,{method:"POST"})}function Voe(e){const t=[];for(const r of["project","global"]){const n=e[r];if(!(!(n!=null&&n.hooks)||typeof n.hooks!="object"))for(const[i,o]of Object.entries(n.hooks))Array.isArray(o)&&o.forEach((s,a)=>{let l="";s.hooks&&Array.isArray(s.hooks)&&s.hooks.length>0&&(l=s.hooks.map(d=>d.command||d.prompt||"").filter(Boolean).join(" && ")),!l&&s.command&&(l=s.args?`${s.command} ${s.args.join(" ")}`:s.command),!l&&s.script&&(l=s.script);const c=`${r}-${i}-${a}`;t.push({name:c,description:s.description,enabled:s.enabled!==!1,command:l,trigger:i,matcher:s.matcher,scope:r,index:a,templateId:s._templateId})})}return t}async function Goe(e){const t=e?`/api/hooks?path=${encodeURIComponent(e)}`:"/api/hooks",r=await oe(t);return{hooks:Voe(r)}}async function Koe(e,t){return oe(`/api/hooks/${encodeURIComponent(e)}/toggle`,{method:"POST",body:JSON.stringify({enabled:t})})}async function Xoe(e,t,r){return oe("/api/hooks",{method:"POST",body:JSON.stringify({projectPath:"",scope:e,event:t,hookData:r})})}async function Zoe(e){return oe("/api/hooks",{method:"DELETE",body:JSON.stringify(e)})}async function Qoe(e){if(e)try{const n=`/api/rules?path=${encodeURIComponent(e)}`,i=await oe(n),o=[...i.projectRules??[],...i.userRules??[]];return{rules:i.rules??o}}catch(n){const i=n;if(i.status===403||i.status===404)console.warn("[fetchRules] 403/404 for project path, falling back to global rules");else throw n}const t=await oe("/api/rules"),r=[...t.projectRules??[],...t.userRules??[]];return{rules:t.rules??r}}async function Yoe(e,t){return oe(`/api/rules/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}async function Joe(e,t){return oe(`/api/rules/${encodeURIComponent(e)}/toggle`,{method:"POST",body:JSON.stringify({enabled:t})})}async function ese(e){return oe("/api/rules/create",{method:"POST",body:JSON.stringify(e)})}async function tse(e,t){return oe(`/api/rules/${encodeURIComponent(e)}`,{method:"DELETE",body:JSON.stringify({location:t})})}async function rse(e,t){return oe("/api/mcp-add-global-server",{method:"POST",body:JSON.stringify({serverName:e,serverConfig:t})})}async function nse(e,t,r,n="mcp"){const i=Ya(r,"copyMcpServerToProject");return oe("/api/mcp-copy-server",{method:"POST",body:JSON.stringify({projectPath:i,serverName:e,serverConfig:t,configType:n})})}async function aA(e){var t,r,n,i;try{const o=await Tc(),s=[];let a=null;if((t=o.globalServers)!=null&&t["ccw-tools"]?(s.push("global"),a=o.globalServers["ccw-tools"]):(r=o.userServers)!=null&&r["ccw-tools"]&&(s.push("global"),a=o.userServers["ccw-tools"]),o.projects){if(e){const u=e.replace(/\\/g,"/");for(const[p,g]of Object.entries(o.projects))if(p.replace(/\\/g,"/")===u&&((n=g.mcpServers)!=null&&n["ccw-tools"])){s.push("project"),a||(a=g.mcpServers["ccw-tools"]);break}}else for(const u of Object.values(o.projects))if((i=u.mcpServers)!=null&&i["ccw-tools"]){s.push("project"),a||(a=u.mcpServers["ccw-tools"]);break}}if(!a)return{isInstalled:!1,enabledTools:[],installedScopes:[]};const l=a.env||{},c=l.CCW_ENABLED_TOOLS;let d;return c==null?d=["write_file","edit_file","read_file","core_memory","ask_question"]:c===""||c==="all"?d=c===""?[]:["write_file","edit_file","read_file","core_memory","ask_question"]:d=c.split(",").map(u=>u.trim()).filter(Boolean),{isInstalled:!0,enabledTools:d,projectRoot:l.CCW_PROJECT_ROOT,allowedDirs:l.CCW_ALLOWED_DIRS,enableSandbox:l.CCW_ENABLE_SANDBOX==="1",installedScopes:s}}catch{return{isInstalled:!1,enabledTools:[],installedScopes:[]}}}async function ise(e){const t=await oe("/api/mcp-install-ccw",{method:"POST",body:JSON.stringify({scope:"global",env:e})});if(t!=null&&t.error)throw new Error(t.error||"Failed to update CCW config");return aA()}async function ose(e="global",t){const r=e==="project"?Ya(t,"installCcwMcp"):void 0,n=await oe("/api/mcp-install-ccw",{method:"POST",body:JSON.stringify({scope:e,projectPath:r,env:{enabledTools:["write_file","edit_file","read_file","core_memory","ask_question"]}})});if(n!=null&&n.error)throw new Error(n.error||`Failed to install CCW MCP (${e})`);return aA(r)}async function sse(){try{await oe("/api/mcp-remove-global-server",{method:"POST",body:JSON.stringify({serverName:"ccw-tools"})})}catch{}try{const e=await Tc();if(e.projects){const t=Object.entries(e.projects).filter(([r,n])=>{var i;return(i=n.mcpServers)==null?void 0:i["ccw-tools"]}).map(([r])=>oe("/api/mcp-remove-server",{method:"POST",body:JSON.stringify({projectPath:r,serverName:"ccw-tools"})}).catch(()=>{}));await Promise.all(t)}}catch{}}async function ase(e,t){if(e==="global")await oe("/api/mcp-remove-global-server",{method:"POST",body:JSON.stringify({serverName:"ccw-tools"})});else{if(!t)throw new Error("projectPath required for project scope uninstall");await oe("/api/mcp-remove-server",{method:"POST",body:JSON.stringify({projectPath:t,serverName:"ccw-tools"})})}}async function lA(){try{const{servers:e}=await LU(),t=e.find(o=>o.name==="ccw-tools");if(!t)return{isInstalled:!1,enabledTools:[],installedScopes:[]};const r=MU(t)?t.env||{}:{},n=r.CCW_ENABLED_TOOLS;let i;return n==null?i=["write_file","edit_file","read_file","core_memory","ask_question"]:n===""||n==="all"?i=n===""?[]:["write_file","edit_file","read_file","core_memory","ask_question"]:i=n.split(",").map(o=>o.trim()).filter(Boolean),{isInstalled:!0,enabledTools:i,projectRoot:r.CCW_PROJECT_ROOT,allowedDirs:r.CCW_ALLOWED_DIRS,enableSandbox:r.CCW_ENABLE_SANDBOX==="1",installedScopes:["global"]}}catch{return{isInstalled:!1,enabledTools:[],installedScopes:[]}}}function BU(e){const t={};return e.enabledTools!==void 0?t.CCW_ENABLED_TOOLS=e.enabledTools.join(","):t.CCW_ENABLED_TOOLS="write_file,edit_file,read_file,core_memory,ask_question",e.projectRoot&&(t.CCW_PROJECT_ROOT=e.projectRoot),e.allowedDirs&&(t.CCW_ALLOWED_DIRS=e.allowedDirs),e.enableSandbox&&(t.CCW_ENABLE_SANDBOX="1"),{command:"ccw-mcp",args:[],env:t}}async function lse(){const e=BU({enabledTools:["write_file","edit_file","read_file","core_memory","ask_question"]}),t=await w0("ccw-tools",e);if(t.error)throw new Error(t.error||"Failed to install CCW MCP to Codex");return lA()}async function cse(){const e=await $U("ccw-tools");if(!e.success)throw new Error(e.error||"Failed to uninstall CCW MCP from Codex")}async function use(e){const t=BU(e),r=await w0("ccw-tools",t);if(r.error)throw new Error(r.error||"Failed to update CCW config in Codex");return lA()}async function dse(e){const t=e?`/api/memory/prompts?path=${encodeURIComponent(e)}`:"/api/memory/prompts";return oe(t)}async function fse(e){const t=e?`/api/memory/insights?path=${encodeURIComponent(e)}`:"/api/memory/insights";return oe(t)}async function hse(e,t=20){const r=e?`/api/memory/insights?limit=${t}&path=${encodeURIComponent(e)}`:`/api/memory/insights?limit=${t}`;return oe(r)}async function pse(e,t){const r=`/api/memory/insights/${encodeURIComponent(e)}`;return oe(r)}async function mse(e={}){return oe("/api/memory/analyze",{method:"POST",body:JSON.stringify(e)})}async function gse(e){await oe("/api/memory/prompts/"+encodeURIComponent(e),{method:"DELETE"})}async function vse(e,t){const r=t?`/api/memory/insights/${encodeURIComponent(e)}?path=${encodeURIComponent(t)}`:`/api/memory/insights/${encodeURIComponent(e)}`;return oe(r,{method:"DELETE"})}async function yse(e){return oe("/api/memory/prompts/batch-delete",{method:"POST",body:JSON.stringify({promptIds:e})})}async function bse(e="/",t={}){const r=new URLSearchParams;return r.append("rootPath",e),t.maxDepth!==void 0&&r.append("maxDepth",String(t.maxDepth)),t.includeHidden!==void 0&&r.append("includeHidden",String(t.includeHidden)),t.excludePatterns&&r.append("excludePatterns",t.excludePatterns.join(",")),oe(`/api/explorer/tree?${r.toString()}`)}async function _se(e,t={}){const r=new URLSearchParams;return r.append("path",e),t.encoding&&r.append("encoding",t.encoding),t.maxSize!==void 0&&r.append("maxSize",String(t.maxSize)),oe(`/api/explorer/file?${r.toString()}`)}async function xse(e){return oe("/api/explorer/search",{method:"POST",body:JSON.stringify(e)})}async function wse(){return oe("/api/explorer/roots")}async function Sse(e={}){const t=new URLSearchParams;return e.rootPath&&t.append("rootPath",e.rootPath),e.maxDepth!==void 0&&t.append("maxDepth",String(e.maxDepth)),e.includeTypes&&t.append("includeTypes",e.includeTypes.join(",")),e.excludePatterns&&t.append("excludePatterns",e.excludePatterns.join(",")),oe(`/api/graph/dependencies?${t.toString()}`)}async function Cse(){return oe("/api/litellm-api/providers")}async function Ese(e){return oe("/api/litellm-api/providers",{method:"POST",body:JSON.stringify(e)})}async function kse(e,t){return oe(`/api/litellm-api/providers/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function Tse(e){return oe(`/api/litellm-api/providers/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Pse(e){return oe(`/api/litellm-api/providers/${encodeURIComponent(e)}/test`,{method:"POST"})}async function Ase(e){return oe(`/api/litellm-api/providers/${encodeURIComponent(e)}/health-check-now`,{method:"POST"})}async function Ose(){return oe("/api/litellm-api/endpoints")}async function Ise(e){return oe("/api/litellm-api/endpoints",{method:"POST",body:JSON.stringify(e)})}async function Rse(e,t){return oe(`/api/litellm-api/endpoints/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function Nse(e){return oe(`/api/litellm-api/endpoints/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Mse(){return oe("/api/litellm-api/cache/stats")}async function jse(){return oe("/api/litellm-api/cache/clear",{method:"POST"})}async function Dse(e){return oe("/api/litellm-api/config/cache",{method:"PUT",body:JSON.stringify(e)})}async function Lse(){return oe("/api/litellm-api/model-pools")}async function $se(e){return oe("/api/litellm-api/model-pools",{method:"POST",body:JSON.stringify(e)})}async function Bse(e,t){return oe(`/api/litellm-api/model-pools/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function Fse(e){return oe(`/api/litellm-api/model-pools/${encodeURIComponent(e)}`,{method:"DELETE"})}async function zse(e){return oe(`/api/litellm-api/model-pools/available-models/${encodeURIComponent(e)}`)}async function Use(e,t){return oe(`/api/litellm-api/model-pools/discover/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)}async function Hse(){return oe("/api/litellm-api/config/sync",{method:"POST"})}async function qse(){return oe("/api/cli/settings")}async function Wse(e){return oe("/api/cli/settings",{method:"POST",body:JSON.stringify(e)})}async function Vse(e,t){return oe(`/api/cli/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function Gse(e){return oe(`/api/cli/settings/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Kse(e,t){return oe(`/api/cli/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({enabled:t})})}async function Xse(){return oe("/api/cli/settings/codex/preview")}async function Zse(){return oe("/api/cli/settings/gemini/preview")}async function Qse(e,t){return oe(mn("/api/orchestrator/flows",t),{method:"POST",body:JSON.stringify(e)})}async function Yse(e,t,r){return oe(mn(`/api/orchestrator/flows/${encodeURIComponent(e)}/execute`,r),{method:"POST",body:JSON.stringify(t??{})})}async function Jse(){return oe("/api/language/chinese-response")}async function eae(e,t="claude"){return oe("/api/language/chinese-response",{method:"POST",body:JSON.stringify({enabled:e,target:t})})}async function tae(){return oe("/api/language/windows-platform")}async function rae(e){return oe("/api/language/windows-platform",{method:"POST",body:JSON.stringify({enabled:e})})}async function nae(){return oe("/api/language/codex-cli-enhancement")}async function iae(e){return oe("/api/language/codex-cli-enhancement",{method:"POST",body:JSON.stringify({enabled:e})})}async function oae(){return oe("/api/language/codex-cli-enhancement",{method:"POST",body:JSON.stringify({action:"refresh"})})}async function sae(){return oe("/api/status/all")}async function aae(){return oe("/api/cli/status")}async function lae(){return oe("/api/ccw/installations")}async function cae(e){return oe("/api/ccw/upgrade",{method:"POST",body:JSON.stringify({path:e})})}async function uae(){return oe("/api/cli/settings/export")}async function dae(e,t){return oe("/api/cli/settings/import",{method:"POST",body:JSON.stringify({data:e,options:t})})}async function fae(e){const t=new URLSearchParams;e&&t.set("location",e);const r=t.toString();return oe(`/api/teams${r?`?${r}`:""}`)}async function hae(e){return oe(`/api/teams/${encodeURIComponent(e)}/archive`,{method:"POST"})}async function pae(e){return oe(`/api/teams/${encodeURIComponent(e)}/unarchive`,{method:"POST"})}async function mae(e){return oe(`/api/teams/${encodeURIComponent(e)}`,{method:"DELETE"})}async function gae(e,t){const r=new URLSearchParams;t!=null&&t.from&&r.set("from",t.from),t!=null&&t.to&&r.set("to",t.to),t!=null&&t.type&&r.set("type",t.type),r.set("last",String(t.last));const n=r.toString();return oe(`/api/teams/${encodeURIComponent(e)}/messages${n?`?${n}`:""}`)}async function vae(e){return oe(`/api/teams/${encodeURIComponent(e)}/status`)}async function yae(e){return oe(`/api/teams/${encodeURIComponent(e)}/artifacts`)}async function bae(e,t){return oe(`/api/teams/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`)}function mn(e,t){if(!t)return e;const r=e.includes("?")?"&":"?";return`${e}${r}path=${encodeURIComponent(t)}`}async function FU(e){return oe(mn("/api/cli-sessions",e))}async function S0(e,t){return oe(mn("/api/cli-sessions",t),{method:"POST",body:JSON.stringify(e)})}async function zU(e,t){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/buffer`,t))}async function cA(e,t,r){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/send`,r),{method:"POST",body:JSON.stringify(t)})}async function _ae(e,t,r){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/execute`,r),{method:"POST",body:JSON.stringify(t)})}async function UU(e,t,r){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/resize`,r),{method:"POST",body:JSON.stringify(t)})}async function Vv(e,t){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/close`,t),{method:"POST",body:JSON.stringify({})})}async function HU(e,t){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/pause`,t),{method:"POST",body:JSON.stringify({})})}async function qU(e,t){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/resume`,t),{method:"POST",body:JSON.stringify({})})}async function xae(e){const t=new URLSearchParams;if(e!=null&&e.sessionKey&&t.set("sessionKey",e.sessionKey),e!=null&&e.q&&t.set("q",e.q),typeof(e==null?void 0:e.limit)=="number"&&t.set("limit",String(e.limit)),typeof(e==null?void 0:e.offset)=="number"&&t.set("offset",String(e.offset)),e!=null&&e.type){const n=Array.isArray(e.type)?e.type:[e.type];t.set("type",n.join(","))}const r=t.toString();return oe(mn(`/api/audit/cli-sessions${r?`?${r}`:""}`,e==null?void 0:e.projectPath))}async function wae(e,t,r){const n=new URLSearchParams;n.set("q",e),n.set("topK",String(t.topK)),t!=null&&t.minScore&&n.set("minScore",String(t.minScore)),t!=null&&t.category&&n.set("category",t.category);const i=await oe(mn(`/api/unified-memory/search?${n.toString()}`,r));if(i.success===!1)throw new Error(i.error||"Search failed");return i}async function Sae(e){const t=await oe(mn("/api/unified-memory/stats",e));if(t.success===!1)throw new Error(t.error||"Failed to load unified stats");return t}async function Cae(e,t,r){const n=new URLSearchParams;t&&n.set("limit",String(t));const i=n.toString(),o=await oe(mn(`/api/unified-memory/recommendations/${encodeURIComponent(e)}${i?`?${i}`:""}`,r));if(o.success===!1)throw new Error(o.error||"Failed to load recommendations");return o}async function Eae(e){return oe("/api/unified-memory/reindex",{method:"POST",body:JSON.stringify({path:e})})}async function kae(){return oe("/api/system/settings")}async function Tae(e,t){return oe("/api/system/hooks/install-recommended",{method:"POST",body:JSON.stringify({hookIds:e,scope:t})})}async function Pae(e){const t=e?`/api/specs/stats?path=${encodeURIComponent(e)}`:"/api/specs/stats";return oe(t)}async function Aae(e){const t=e?`/api/specs/list?path=${encodeURIComponent(e)}`:"/api/specs/list";return oe(t)}async function Oae(e){const t=e?`/api/specs/rebuild?path=${encodeURIComponent(e)}`:"/api/specs/rebuild";return oe(t,{method:"POST"})}async function Iae(e="required",t=!1,r,n){const i=new URLSearchParams;return i.set("mode",e),i.set("preview",String(t)),n&&i.set("category",n),oe(`/api/specs/injection-preview?${i.toString()}`)}const Rae=[{command:"ccw spec load",labelKey:"default",descriptionKey:"default",mode:"required"},{command:"ccw spec load --category exploration",labelKey:"exploration",descriptionKey:"exploration",category:"exploration",mode:"required"},{command:"ccw spec load --category planning",labelKey:"planning",descriptionKey:"planning",category:"planning",mode:"required"},{command:"ccw spec load --category execution",labelKey:"execution",descriptionKey:"execution",category:"execution",mode:"required"},{command:"ccw spec load --category general",labelKey:"general",descriptionKey:"general",category:"general",mode:"required"}];async function Nae(e,t){const n=new URLSearchParams().toString(),i=n?`${mn("/api/analysis",e)}&${n}`:mn("/api/analysis",e),o=await oe(i);if(!o.success)throw new Error(o.error||"Failed to fetch analysis sessions");return o.data}async function Mae(e,t){const r=await oe(mn(`/api/analysis/${encodeURIComponent(e)}`,t));if(!r.success)throw new Error(r.error||"Failed to fetch analysis detail");return r.data}const cze=Object.freeze(Object.defineProperty({__proto__:null,COMMAND_PREVIEWS:Rae,activateQueue:yU,addCodexMcpServer:w0,addGlobalMcpServer:rse,analyzePrompts:mse,archiveMemory:Yie,archiveSession:oU,archiveTeam:hae,batchDeletePrompts:yse,buildFlowControl:yoe,bulkUpdateTaskStatus:foe,clearCache:jse,closeCliSession:Vv,codexRemoveServer:$U,codexToggleServer:koe,copyMcpServerToProject:nse,createCliEndpoint:Boe,createCliSession:S0,createCliSettings:Wse,createCommand:Gie,createEndpoint:Ise,createIssue:hU,createMcpServer:Soe,createMemory:Xie,createModelPool:$se,createOrchestratorFlow:Qse,createProvider:Ese,createRule:ese,createSkill:zie,crossCliCopy:Doe,deactivateQueue:bU,deleteAllHistory:doe,deleteCliEndpoint:Foe,deleteCliSettings:Gse,deleteEndpoint:Nse,deleteExecution:coe,deleteExecutionsByTool:uoe,deleteHook:Zoe,deleteInsight:vse,deleteIssue:mU,deleteMcpServer:Coe,deleteMcpTemplate:Aoe,deleteMemory:Qie,deleteModelPool:Fse,deletePrompt:gse,deleteProvider:Tse,deleteQueue:wU,deleteRule:tse,deleteSession:sU,deleteSkill:Bie,deleteTeam:mae,disableSkill:Lie,discoverModelsForPool:Use,enableSkill:Die,executeInCliSession:_ae,executeOrchestratorFlow:Yse,exportDiscoveryFindingsAsIssues:TU,exportSettings:uae,fetchAggregatedStatus:sae,fetchAllProjects:Moe,fetchAnalysisDetail:Mae,fetchAnalysisSessions:Nae,fetchApi:oe,fetchArtifactContent:bae,fetchCacheStats:Mse,fetchCcwInstallations:lae,fetchCcwMcpConfig:aA,fetchCcwMcpConfigForCodex:lA,fetchChineseResponseStatus:Jse,fetchCliEndpoints:Loe,fetchCliInstallations:Uoe,fetchCliSessionAudit:xae,fetchCliSessionBuffer:zU,fetchCliSessions:FU,fetchCliSettings:qse,fetchCliToolStatus:aae,fetchCodexCliEnhancementStatus:nae,fetchCodexConfigPreview:Xse,fetchCodexMcpServers:LU,fetchCommands:Hie,fetchDashboardStats:iU,fetchDiscoveries:EU,fetchDiscoveryFindings:kU,fetchEndpoints:Ose,fetchExecutionDetail:OU,fetchFileContent:_se,fetchFileTree:bse,fetchGeminiConfigPreview:Zse,fetchGraphDependencies:Sse,fetchHistory:loe,fetchHooks:Goe,fetchInsightDetail:pse,fetchInsightsHistory:hse,fetchIssueHistory:dU,fetchIssueQueue:fU,fetchIssues:uU,fetchLiteSessionContext:boe,fetchLiteTaskSession:RU,fetchLiteTasks:sA,fetchMcpConfig:Tc,fetchMcpServers:x0,fetchMcpTemplateCategories:Roe,fetchMcpTemplates:Toe,fetchMcpTemplatesByCategory:Noe,fetchMemories:Kie,fetchModelPools:Lse,fetchNativeSession:poe,fetchNativeSessionWithOptions:moe,fetchNativeSessions:goe,fetchOtherProjectsServers:joe,fetchProjectOverview:PU,fetchPromptInsights:fse,fetchPrompts:dse,fetchProviders:Cse,fetchQueueById:vU,fetchQueueHistory:gU,fetchRecentPaths:aU,fetchRecommendations:Cae,fetchReviewSession:_oe,fetchReviewSessions:NU,fetchRootDirectories:wse,fetchRules:Qoe,fetchSessionDetail:aoe,fetchSessions:oA,fetchSkillDetail:$ie,fetchSkills:jie,fetchTeamArtifacts:yae,fetchTeamMessages:gae,fetchTeamStatus:vae,fetchTeams:fae,fetchUnifiedSearch:wae,fetchUnifiedStats:Sae,fetchWindowsPlatformStatus:tae,getAvailableModelsForPool:zse,getConsolidationStatus:noe,getExtractionStatus:toe,getInjectionPreview:Iae,getSpecStats:Pae,getSpecsList:Aae,getSystemSettings:kae,getV2Jobs:ioe,importSettings:dae,initializeCsrfToken:nU,installCcwMcp:ose,installCcwMcpToCodex:lse,installCliTool:Hoe,installMcpTemplate:Ooe,installRecommendedHooks:Tae,isHttpMcpServer:xoe,isStdioMcpServer:MU,mergeQueues:SU,moveQueueItem:xU,normalizeTask:IU,pauseCliSession:HU,previewExtractionQueue:ooe,pullIssuesFromGitHub:Mie,readSkillFile:Uie,rebuildSpecIndex:Oae,refreshCodexCliEnhancement:oae,removeRecentPath:lU,reorderQueueGroup:_U,resizeCliSession:UU,resumeCliSession:qU,saveHook:Xoe,saveMcpTemplate:Poe,searchFiles:xse,searchMcpTemplates:Ioe,sendCliSessionText:cA,splitQueue:CU,switchWorkspace:cU,syncApiConfig:Hse,testProvider:Pse,toggleChineseResponse:eae,toggleCliEndpoint:zoe,toggleCliSettingsEnabled:Kse,toggleCodexCliEnhancement:iae,toggleCommand:qie,toggleCommandGroup:Wie,toggleHook:Koe,toggleMcpServer:Eoe,toggleRule:Joe,toggleWindowsPlatform:rae,triggerConsolidation:roe,triggerExtraction:eoe,triggerProviderHealthCheck:Ase,triggerReindex:Eae,triggerSelectiveExtraction:soe,unarchiveMemory:Jie,unarchiveTeam:pae,uninstallCcwMcp:sse,uninstallCcwMcpFromCodex:cse,uninstallCcwMcpFromScope:ase,uninstallCliTool:qoe,updateCacheSettings:Dse,updateCcwConfig:ise,updateCcwConfigForCodex:use,updateCliEndpoint:$oe,updateCliSettings:Vse,updateEndpoint:Rse,updateIssue:pU,updateMcpServer:woe,updateMemory:Zie,updateModelPool:Bse,updateProjectGuidelines:AU,updateProvider:kse,updateRule:Yoe,updateTaskStatus:hoe,upgradeCcwInstallation:cae,upgradeCliTool:Woe,uploadAttachments:Nie,validateCommandImport:Vie,validateSkillImport:Fie},Symbol.toStringTag,{value:"Module"})),WU="ccw-workflow-store",jae=()=>{var e;try{const t=localStorage.getItem(WU);if(t){const r=JSON.parse(t);return((e=r==null?void 0:r.state)==null?void 0:e.projectPath)||""}}catch{}return""},Dae=e=>{try{localStorage.setItem(WU,JSON.stringify({state:{projectPath:e},version:1}))}catch{}},Wo=e=>`session-${e}`.replace(/[^a-zA-Z0-9-]/g,"-"),VU={status:null,search:"",dateRange:{start:null,end:null}},GU={field:"created_at",direction:"desc"},Lae={workflowData:{activeSessions:[],archivedSessions:[]},projectPath:jae(),recentPaths:[],serverPlatform:"win32",sessionDataStore:{},liteTaskDataStore:{},taskJsonStore:{},activeSessionId:null,filters:VU,sorting:GU},Rt=gn()(im((e,t)=>({...Lae,setSessions:(r,n)=>{const i={};[...r,...n].forEach(o=>{const s=Wo(o.session_id);i[s]=o}),e({workflowData:{activeSessions:r,archivedSessions:n},sessionDataStore:i},!1)},addSession:r=>{const n=Wo(r.session_id);e(i=>({workflowData:{...i.workflowData,activeSessions:[...i.workflowData.activeSessions,r]},sessionDataStore:{...i.sessionDataStore,[n]:r}}),!1)},updateSession:(r,n)=>{const i=Wo(r);e(o=>{const s=o.sessionDataStore[i];if(!s)return o;const a={...s,...n,updated_at:new Date().toISOString()},c=s.location==="active"?"activeSessions":"archivedSessions";return{sessionDataStore:{...o.sessionDataStore,[i]:a},workflowData:{...o.workflowData,[c]:o.workflowData[c].map(d=>d.session_id===r?a:d)}}},!1)},removeSession:r=>{const n=Wo(r);e(i=>{const{[n]:o,...s}=i.sessionDataStore;return{sessionDataStore:s,workflowData:{activeSessions:i.workflowData.activeSessions.filter(a=>a.session_id!==r),archivedSessions:i.workflowData.archivedSessions.filter(a=>a.session_id!==r)}}},!1)},archiveSession:r=>{const n=Wo(r);e(i=>{const o=i.sessionDataStore[n];if(!o||o.location==="archived")return i;const s={...o,location:"archived",status:"archived",updated_at:new Date().toISOString()};return{sessionDataStore:{...i.sessionDataStore,[n]:s},workflowData:{activeSessions:i.workflowData.activeSessions.filter(a=>a.session_id!==r),archivedSessions:[...i.workflowData.archivedSessions,s]}}},!1)},addTask:(r,n)=>{const i=Wo(r);e(o=>{var c;const s=o.sessionDataStore[i];if(!s||((c=s.tasks)==null?void 0:c.find(d=>d.task_id===n.task_id)))return o;const l={...s,tasks:[...s.tasks||[],n],updated_at:new Date().toISOString()};return{sessionDataStore:{...o.sessionDataStore,[i]:l}}},!1)},updateTask:(r,n,i)=>{const o=Wo(r);e(s=>{const a=s.sessionDataStore[o];if(!(a!=null&&a.tasks))return s;const l=a.tasks.map(d=>d.task_id===n?{...d,...i,updated_at:new Date().toISOString()}:d),c={...a,tasks:l,updated_at:new Date().toISOString()};return{sessionDataStore:{...s.sessionDataStore,[o]:c}}},!1)},removeTask:(r,n)=>{const i=Wo(r);e(o=>{const s=o.sessionDataStore[i];if(!(s!=null&&s.tasks))return o;const a={...s,tasks:s.tasks.filter(l=>l.task_id!==n),updated_at:new Date().toISOString()};return{sessionDataStore:{...o.sessionDataStore,[i]:a}}},!1)},setLiteTaskSession:(r,n)=>{e(i=>({liteTaskDataStore:{...i.liteTaskDataStore,[r]:n}}),!1)},removeLiteTaskSession:r=>{e(n=>{const{[r]:i,...o}=n.liteTaskDataStore;return{liteTaskDataStore:o}},!1)},setTaskJson:(r,n)=>{e(i=>({taskJsonStore:{...i.taskJsonStore,[r]:n}}),!1)},removeTaskJson:r=>{e(n=>{const{[r]:i,...o}=n.taskJsonStore;return{taskJsonStore:o}},!1)},setActiveSessionId:r=>{e({activeSessionId:r},!1)},setProjectPath:r=>{e({projectPath:r},!1)},addRecentPath:r=>{e(n=>{const i=n.recentPaths.filter(s=>s!==r);return{recentPaths:[r,...i].slice(0,10)}},!1)},setServerPlatform:r=>{e({serverPlatform:r},!1)},switchWorkspace:async r=>{const n=await cU(r),i={};[...n.activeSessions,...n.archivedSessions].forEach(s=>{const a=Wo(s.session_id);i[a]=s}),e({projectPath:n.projectPath,recentPaths:n.recentPaths,workflowData:{activeSessions:n.activeSessions,archivedSessions:n.archivedSessions},sessionDataStore:i},!1),Dae(n.projectPath);const o=t()._invalidateQueriesCallback;o&&o()},removeRecentPath:async r=>{const n=await lU(r);e({recentPaths:n},!1)},refreshRecentPaths:async()=>{const r=await aU();e({recentPaths:r},!1)},registerQueryInvalidator:r=>{e({_invalidateQueriesCallback:r},!1)},setFilters:r=>{e(n=>({filters:{...n.filters,...r}}),!1)},setSorting:r=>{e(n=>({sorting:{...n.sorting,...r}}),!1)},resetFilters:()=>{e({filters:VU,sorting:GU},!1)},getActiveSession:()=>{const{activeSessionId:r,sessionDataStore:n}=t();if(!r)return null;const i=Wo(r);return n[i]||null},getFilteredSessions:()=>{const{workflowData:r,filters:n,sorting:i}=t();let o=[...r.activeSessions,...r.archivedSessions];if(n.status&&n.status.length>0&&(o=o.filter(s=>n.status.includes(s.status))),n.search){const s=n.search.toLowerCase();o=o.filter(a=>{var l,c;return a.session_id.toLowerCase().includes(s)||((l=a.title)==null?void 0:l.toLowerCase().includes(s))||((c=a.description)==null?void 0:c.toLowerCase().includes(s))})}return(n.dateRange.start||n.dateRange.end)&&(o=o.filter(s=>{const a=new Date(s.created_at);return!(n.dateRange.start&&a<n.dateRange.start||n.dateRange.end&&a>n.dateRange.end)})),o.sort((s,a)=>{let l=0;switch(i.field){case"created_at":l=new Date(s.created_at).getTime()-new Date(a.created_at).getTime();break;case"updated_at":l=new Date(s.updated_at||s.created_at).getTime()-new Date(a.updated_at||a.created_at).getTime();break;case"title":l=(s.title||s.session_id).localeCompare(a.title||a.session_id);break;case"status":l=s.status.localeCompare(a.status);break}return i.direction==="desc"?-l:l}),o},getSessionByKey:r=>t().sessionDataStore[r]}),{name:"ccw-workflow-store",partialize:e=>({projectPath:e.projectPath}),skipHydration:!0})),fr=e=>e.projectPath,$ae={gemini:{enabled:!0,tags:["analysis","debug"],type:"builtin"},qwen:{enabled:!0,tags:[],type:"builtin"},codex:{enabled:!0,tags:[],type:"builtin"},claude:{enabled:!0,tags:[],type:"builtin"},opencode:{enabled:!0,tags:[],type:"builtin"}},KU={base:"/api",sessions:"/api/sessions",tasks:"/api/tasks",loops:"/api/loops",issues:"/api/issues",orchestrator:"/api/orchestrator"},XU={autoRefresh:!0,refreshInterval:3e4,notificationsEnabled:!0,soundEnabled:!1,compactView:!1,showCompletedTasks:!0,defaultSessionFilter:"all",defaultSortField:"created_at",defaultSortDirection:"desc"},ZU={dialogStyle:"modal",smartModeEnabled:!0,autoSelectionDuration:30,autoSelectionSoundEnabled:!1,pauseOnInteraction:!0,showA2UIButtonInToolbar:!0,drawerSide:"right",drawerSize:"md"},Bae={cliTools:$ae,defaultCliTool:"gemini",apiEndpoints:KU,userPreferences:XU,a2uiPreferences:ZU,featureFlags:{orchestratorEnabled:!0,darkModeEnabled:!0,notificationsEnabled:!0,experimentalFeatures:!1,dashboardQueuePanelEnabled:!1,dashboardInspectorEnabled:!1,dashboardExecutionMonitorEnabled:!1}};function Fae(){var e;if(typeof window>"u"||!((e=window.location)!=null&&e.origin))return null;try{return new URL("/api/cli/config",window.location.origin).toString()}catch{return null}}function zae(e){var o;const t=(o=e==null?void 0:e.config)==null?void 0:o.tools;if(!t||typeof t!="object")return null;const r=["builtin","cli-wrapper","api-endpoint"],n=s=>typeof s=="string"&&r.includes(s),i={};for(const[s,a]of Object.entries(t)){const l=a;i[s]={enabled:typeof l.enabled=="boolean"?l.enabled:!1,primaryModel:typeof l.primaryModel=="string"?l.primaryModel:"",secondaryModel:typeof l.secondaryModel=="string"?l.secondaryModel:"",tags:Array.isArray(l.tags)?l.tags.filter(c=>typeof c=="string"):[],type:n(l.type)?l.type:"builtin",envFile:typeof l.envFile=="string"?l.envFile:void 0,settingsFile:typeof l.settingsFile=="string"?l.settingsFile:void 0,availableModels:Array.isArray(l.availableModels)?l.availableModels.filter(c=>typeof c=="string"):void 0}}return Object.keys(i).length>0?i:null}let ih=null;async function Uae(e=!1){return!e&&ih||(ih=(async()=>{const t=Fae();if(!t)return;const n=await(await fetch(t)).json(),i=zae(n);i&&kk.getState().loadConfig({cliTools:i})})().catch(t=>{console.warn("[ConfigStore] Backend config sync failed, using local state:",t)}).finally(()=>{ih=null})),ih}const kk=gn()(En(im((e,t)=>({...Bae,setCliTools:r=>{e({cliTools:r},!1,"setCliTools")},updateCliTool:(r,n)=>{e(i=>({cliTools:{...i.cliTools,[r]:{...i.cliTools[r],...n}}}),!1,"updateCliTool")},setDefaultCliTool:r=>{var i;const{cliTools:n}=t();(i=n[r])!=null&&i.enabled&&e({defaultCliTool:r},!1,"setDefaultCliTool")},setApiEndpoints:r=>{e(n=>({apiEndpoints:{...n.apiEndpoints,...r}}),!1,"setApiEndpoints")},setUserPreferences:r=>{e(n=>({userPreferences:{...n.userPreferences,...r}}),!1,"setUserPreferences")},resetUserPreferences:()=>{e({userPreferences:XU},!1,"resetUserPreferences")},setA2uiPreferences:r=>{e({a2uiPreferences:r},!1,"setA2uiPreferences")},resetA2uiPreferences:()=>{e({a2uiPreferences:ZU},!1,"resetA2uiPreferences")},setFeatureFlag:(r,n)=>{e(i=>({featureFlags:{...i.featureFlags,[r]:n}}),!1,"setFeatureFlag")},loadConfig:r=>{e(n=>({...n,...r,cliTools:r.cliTools||n.cliTools,apiEndpoints:{...n.apiEndpoints,...r.apiEndpoints||{}},userPreferences:{...n.userPreferences,...r.userPreferences||{}},featureFlags:{...n.featureFlags,...r.featureFlags||{}}}),!1,"loadConfig")}}),{name:"ccw-config-store",version:1,migrate:(e,t)=>t===0?{...e,apiEndpoints:e.apiEndpoints||KU}:e,partialize:e=>({cliTools:e.cliTools,defaultCliTool:e.defaultCliTool,apiEndpoints:e.apiEndpoints,userPreferences:e.userPreferences,featureFlags:e.featureFlags})}),{name:"ConfigStore"})),uze=e=>e.cliTools,dze=e=>e.defaultCliTool,fze=e=>e.userPreferences,uA="ccw_notifications",Hae=100,qae=10080*60*1e3,Wae=[/\b[A-Za-z0-9_-]{20,}\b/g,/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,/\b[A-Za-z0-9+/=]{32,}={0,2}\b/g],Vae=e=>{const t=r=>{if(!r)return null;let n=r;for(const o of Wae)n=n.replace(o,"[REDACTED]");const i=500;return n.length>i&&(n=n.substring(0,i)+"..."),n};return{...e,title:t(e.title)||e.title,message:t(e.message)||e.message,a2uiSurface:void 0,a2uiState:void 0}},Xx=()=>`toast-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,QU=()=>{if(typeof window>"u")return[];try{const e=localStorage.getItem(uA);if(e){const t=JSON.parse(e),r=Date.now()-qae;return t.filter(n=>new Date(n.timestamp).getTime()>r)}}catch(e){console.error("[NotificationStore] Failed to load from storage:",e)}return[]},cu=e=>{if(!(typeof window>"u"))try{const r=e.slice(0,Hae).map(Vae);localStorage.setItem(uA,JSON.stringify(r))}catch(t){console.error("[NotificationStore] Failed to save to storage:",t)}},Gae={toasts:[],maxToasts:5,wsStatus:"disconnected",wsLastMessage:null,wsReconnectAttempts:0,isPanelVisible:!1,persistentNotifications:[],a2uiSurfaces:new Map,currentQuestion:null,currentPopupCard:null,actionStates:new Map},lt=gn()(En((e,t)=>({...Gae,addToast:r=>{const n=Xx(),i={...r,id:n,timestamp:new Date().toISOString(),dismissible:r.dismissible??!0,duration:r.duration??5e3};return e(o=>{const{maxToasts:s}=o;let a=[...o.toasts,i];return a.length>s&&(a=a.slice(-s)),{toasts:a}},!1,"addToast"),i.duration&&i.duration>0&&setTimeout(()=>{t().removeToast(n)},i.duration),n},removeToast:r=>{e(n=>({toasts:n.toasts.filter(i=>i.id!==r)}),!1,"removeToast")},clearAllToasts:()=>{e({toasts:[]},!1,"clearAllToasts")},setWsStatus:r=>{e({wsStatus:r},!1,"setWsStatus")},setWsLastMessage:r=>{e({wsLastMessage:r},!1,"setWsLastMessage")},incrementReconnectAttempts:()=>{e(r=>({wsReconnectAttempts:r.wsReconnectAttempts+1}),!1,"incrementReconnectAttempts")},resetReconnectAttempts:()=>{e({wsReconnectAttempts:0},!1,"resetReconnectAttempts")},togglePanel:()=>{e(r=>({isPanelVisible:!r.isPanelVisible}),!1,"togglePanel")},setPanelVisible:r=>{e({isPanelVisible:r},!1,"setPanelVisible")},addPersistentNotification:r=>{const n=Xx(),i={...r,id:n,timestamp:new Date().toISOString(),dismissible:r.dismissible??!0};e(s=>({persistentNotifications:[i,...s.persistentNotifications]}),!1,"addPersistentNotification");const o=t();cu(o.persistentNotifications)},removePersistentNotification:r=>{e(i=>({persistentNotifications:i.persistentNotifications.filter(o=>o.id!==r)}),!1,"removePersistentNotification");const n=t();cu(n.persistentNotifications)},clearPersistentNotifications:()=>{e({persistentNotifications:[]},!1,"clearPersistentNotifications"),typeof window<"u"&&localStorage.removeItem(uA)},loadPersistentNotifications:()=>{const r=QU();e({persistentNotifications:r},!1,"loadPersistentNotifications")},savePersistentNotifications:()=>{const r=t();cu(r.persistentNotifications)},markAllAsRead:()=>{e(n=>({persistentNotifications:n.persistentNotifications.map(i=>({...i,read:!0}))}),!1,"markAllAsRead");const r=t();cu(r.persistentNotifications)},toggleNotificationRead:r=>{e(n=>{const i=n.toasts.findIndex(a=>a.id===r),o=n.persistentNotifications.findIndex(a=>a.id===r);if(i===-1&&o===-1)return n;const s={...n};if(i!==-1){const a=[...n.toasts];a[i]={...a[i],read:!a[i].read},s.toasts=a}if(o!==-1){const a=[...n.persistentNotifications];a[o]={...a[o],read:!a[o].read},s.persistentNotifications=a,cu(a)}return s},!1,"toggleNotificationRead")},setActionState:(r,n)=>{e(i=>{const o=new Map(i.actionStates);return o.set(r,n),{actionStates:o}},!1,"setActionState")},executeAction:async(r,n,i)=>{const o=i||`${n}-${r.label}`,s=t(),a=s.actionStates.get(o);if((a==null?void 0:a.status)==="loading"||r.disabled)return;const l=new Map(s.actionStates);l.set(o,{status:"loading",lastAttempt:new Date().toISOString()}),e({actionStates:l});try{await r.onClick();const c=new Map(t().actionStates);c.set(o,{status:"success",lastAttempt:new Date().toISOString()}),e({actionStates:c})}catch(c){const d=new Map(t().actionStates);d.set(o,{status:"error",error:c instanceof Error?c.message:String(c),lastAttempt:new Date().toISOString()}),e({actionStates:d})}},retryAction:async r=>{if(!t().actionStates.get(r)){console.warn(`[NotificationStore] No action state found for key: ${r}`);return}t().setActionState(r,{status:"idle",lastAttempt:new Date().toISOString()})},addA2UINotification:(r,n="A2UI Surface")=>{if(r.displayMode==="popup")return e(a=>{const l=new Map(a.a2uiSurfaces);return l.set(r.surfaceId,r),{currentPopupCard:r,a2uiSurfaces:l}},!1,"addA2UINotification (popup)"),r.surfaceId;const i=Xx(),o={id:i,type:"a2ui",title:n,timestamp:new Date().toISOString(),dismissible:!0,duration:0,a2uiSurface:r,a2uiState:r.initialState||{},read:!1};e(a=>{const l=new Map(a.a2uiSurfaces);return l.set(r.surfaceId,r),{persistentNotifications:[o,...a.persistentNotifications],a2uiSurfaces:l,isPanelVisible:!0}},!1,"addA2UINotification (panel)");const s=t();return cu(s.persistentNotifications),i},updateA2UIState:(r,n)=>{e(i=>{const o=new Map(i.a2uiSurfaces),s=o.get(r);s&&o.set(r,{...s,initialState:{...s.initialState,...n}});const a=i.toasts.map(c=>c.a2uiSurface&&c.a2uiSurface.surfaceId===r?{...c,a2uiState:{...c.a2uiState,...n},a2uiSurface:s?{...c.a2uiSurface,initialState:{...c.a2uiSurface.initialState,...n}}:c.a2uiSurface}:c),l=i.persistentNotifications.map(c=>c.a2uiSurface&&c.a2uiSurface.surfaceId===r?{...c,a2uiState:{...c.a2uiState,...n},a2uiSurface:s?{...c.a2uiSurface,initialState:{...c.a2uiSurface.initialState,...n}}:c.a2uiSurface}:c);return{toasts:a,persistentNotifications:l,a2uiSurfaces:o}},!1,"updateA2UIState")},sendA2UIAction:(r,n,i={})=>{const o=new CustomEvent("a2ui-action",{detail:{type:"a2ui-action",actionId:r,surfaceId:n,parameters:i}});window.dispatchEvent(o)},setCurrentQuestion:r=>{e({currentQuestion:r},!1,"setCurrentQuestion")},setCurrentPopupCard:r=>{e({currentPopupCard:r},!1,"setCurrentPopupCard")}}),{name:"NotificationStore"}));if(typeof window<"u"){const e=QU();e.length>0&<.setState({persistentNotifications:e})}const Kae=e=>e.toasts,Xae=e=>e.wsStatus,YU=e=>e.wsLastMessage,Zae=e=>e.isPanelVisible,JU=e=>e.persistentNotifications,Qae=e=>e.currentQuestion,Yae=e=>e.currentPopupCard,hze={info:(e,t)=>lt.getState().addToast({type:"info",title:e,message:t}),success:(e,t)=>lt.getState().addToast({type:"success",title:e,message:t}),warning:(e,t)=>lt.getState().addToast({type:"warning",title:e,message:t}),error:(e,t)=>lt.getState().addToast({type:"error",title:e,message:t,duration:0})};function Jae(){const e=lt(Kae),t=lt(Xae),r=lt(YU),n=lt(Zae),i=lt(JU),o=lt(U=>U.addToast),s=lt(U=>U.removeToast),a=lt(U=>U.clearAllToasts),l=lt(U=>U.setWsStatus),c=lt(U=>U.setWsLastMessage),d=lt(U=>U.togglePanel),u=lt(U=>U.setPanelVisible),p=lt(U=>U.addPersistentNotification),g=lt(U=>U.removePersistentNotification),_=lt(U=>U.clearPersistentNotifications),y=t==="connected",m=O.useCallback((U,q,V,K)=>o({type:U,title:q,message:V,duration:K==null?void 0:K.duration,dismissible:K==null?void 0:K.dismissible,action:K==null?void 0:K.action}),[o]),v=O.useCallback((U,q)=>m("info",U,q),[m]),b=O.useCallback((U,q)=>m("success",U,q),[m]),x=O.useCallback((U,q)=>m("warning",U,q),[m]),E=O.useCallback((U,q)=>m("error",U,q,{duration:0}),[m]),C=O.useCallback(U=>{s(U)},[s]),k=O.useCallback(()=>{a()},[a]),P=O.useCallback(U=>{l(U)},[l]),T=O.useCallback(U=>{c(U)},[c]),I=O.useCallback(()=>{d()},[d]),N=O.useCallback(U=>{u(U)},[u]),B=O.useCallback((U,q,V)=>{p({type:U,title:q,message:V})},[p]),M=O.useCallback(U=>{g(U)},[g]),F=O.useCallback(()=>{_()},[_]);return{toasts:e,wsStatus:t,wsLastMessage:r,isWsConnected:y,isPanelVisible:n,persistentNotifications:i,addToast:m,info:v,success:b,warning:x,error:E,removeToast:C,clearAllToasts:k,setWsStatus:P,setWsLastMessage:T,togglePanel:I,setPanelVisible:N,addPersistentNotification:B,removePersistentNotification:M,clearPersistentNotifications:F}}const $M={"prompt-template":{defaultData:{label:"New Step",instruction:"",outputName:void 0,tool:void 0,mode:void 0,contextRefs:[]}}},ele=[{id:"slash-command-main",label:"Slash Command",description:"Execute /workflow commands (main thread)",icon:"Terminal",color:"bg-rose-500",category:"command",data:{label:"Slash Command",instruction:"",slashCommand:"",slashArgs:"",mode:"mainprocess",nodeCategory:"command"}},{id:"slash-command-async",label:"Slash Command (Async)",description:"Execute /workflow commands (background)",icon:"Terminal",color:"bg-rose-400",category:"command",data:{label:"Slash Command (Async)",instruction:"",slashCommand:"",slashArgs:"",mode:"async",nodeCategory:"command"}}],eH="ccw-orchestrator-custom-templates";function tH(){try{const e=localStorage.getItem(eH);return e?JSON.parse(e):[]}catch{return[]}}function BM(e){try{localStorage.setItem(eH,JSON.stringify(e))}catch(t){console.error("Failed to save custom templates:",t)}}const Hg=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,uu="/api/orchestrator",FM=50,tle=100,rle=80,nle=20;function zM(e,t,r){let n=e,i=t;for(let o=0;o<nle;o++){if(!r.some(a=>{const l=Math.abs(a.position.x-n),c=Math.abs(a.position.y-i);return l<FM&&c<FM}))return{x:n,y:i};n+=tle,i+=rle}return{x:n,y:i}}const ile={currentFlow:null,isModified:!1,nodes:[],edges:[],selectedNodeId:null,selectedEdgeId:null,flows:[],isLoadingFlows:!1,isPaletteOpen:!0,isPropertyPanelOpen:!1,leftPanelTab:"nodes",customTemplates:tH(),interactionMode:"pan"},ole=gn()(En((e,t)=>({...ile,setCurrentFlow:r=>{e({currentFlow:r,nodes:(r==null?void 0:r.nodes)??[],edges:(r==null?void 0:r.edges)??[],isModified:!1,selectedNodeId:null,selectedEdgeId:null},!1,"setCurrentFlow")},createFlow:(r,n)=>{const i={id:Hg("flow"),name:r,description:n,version:1,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),nodes:[],edges:[],variables:{},metadata:{source:"custom"}};return e({currentFlow:i,nodes:[],edges:[],isModified:!0,selectedNodeId:null,selectedEdgeId:null},!1,"createFlow"),i},saveFlow:async()=>{const{currentFlow:r,nodes:n,edges:i}=t();if(!r)return!1;try{const o={...r,nodes:n,edges:i,updated_at:new Date().toISOString()},s=!t().flows.some(p=>p.id===r.id),a=s?"POST":"PUT",l=s?`${uu}/flows`:`${uu}/flows/${r.id}`,c=await fetch(l,{method:a,headers:{"Content-Type":"application/json"},body:JSON.stringify(o),credentials:"same-origin"});if(!c.ok)throw new Error(`Failed to save flow: ${c.statusText}`);const d=await c.json(),u=d&&typeof d=="object"&&"data"in d?d.data:d;return e(p=>({currentFlow:u,isModified:!1,flows:s?[...p.flows,u]:p.flows.map(g=>g.id===u.id?u:g)}),!1,"saveFlow"),!0}catch(o){return console.error("Error saving flow:",o),!1}},loadFlow:async r=>{try{const n=await fetch(`${uu}/flows/${r}`,{credentials:"same-origin"});if(!n.ok)throw new Error(`Failed to load flow: ${n.statusText}`);const i=await n.json(),o=i&&typeof i=="object"&&"data"in i?i.data:i;return e({currentFlow:o,nodes:o.nodes,edges:o.edges,isModified:!1,selectedNodeId:null,selectedEdgeId:null},!1,"loadFlow"),!0}catch(n){return console.error("Error loading flow:",n),!1}},deleteFlow:async r=>{try{const n=await fetch(`${uu}/flows/${r}`,{method:"DELETE",credentials:"same-origin"});if(!n.ok)throw new Error(`Failed to delete flow: ${n.statusText}`);return e(i=>{var o,s,a;return{flows:i.flows.filter(l=>l.id!==r),currentFlow:((o=i.currentFlow)==null?void 0:o.id)===r?null:i.currentFlow,nodes:((s=i.currentFlow)==null?void 0:s.id)===r?[]:i.nodes,edges:((a=i.currentFlow)==null?void 0:a.id)===r?[]:i.edges}},!1,"deleteFlow"),!0}catch(n){return console.error("Error deleting flow:",n),!1}},duplicateFlow:async r=>{try{const n=await fetch(`${uu}/flows/${r}/duplicate`,{method:"POST",credentials:"same-origin"});if(!n.ok)throw new Error(`Failed to duplicate flow: ${n.statusText}`);const i=await n.json(),o=i&&typeof i=="object"&&"data"in i?i.data:i;return e(s=>({flows:[...s.flows,o]}),!1,"duplicateFlow"),o}catch(n){return console.error("Error duplicating flow:",n),null}},addNode:r=>{const n=$M["prompt-template"],i=Hg("node"),o=zM(r.x,r.y,t().nodes),s={id:i,type:"prompt-template",position:o,data:{...n.defaultData}};return e(a=>({nodes:[...a.nodes,s],isModified:!0,selectedNodeId:i}),!1,"addNode"),i},addNodeFromTemplate:(r,n)=>{const i=ele.find(d=>d.id===r)||t().customTemplates.find(d=>d.id===r);if(!i)return console.error(`Template not found: ${r}`),t().addNode(n);const o=Hg("node"),s=$M["prompt-template"],a=zM(n.x,n.y,t().nodes),l={...s.defaultData,...i.data,label:i.data.label||i.label,contextRefs:i.data.contextRefs||[]},c={id:o,type:"prompt-template",position:a,data:l};return e(d=>({nodes:[...d.nodes,c],isModified:!0,selectedNodeId:o}),!1,"addNodeFromTemplate"),o},updateNode:(r,n)=>{e(i=>({nodes:i.nodes.map(o=>o.id===r?{...o,data:{...o.data,...n}}:o),isModified:!0}),!1,"updateNode")},removeNode:r=>{e(n=>({nodes:n.nodes.filter(i=>i.id!==r),edges:n.edges.filter(i=>i.source!==r&&i.target!==r),isModified:!0,selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}),!1,"removeNode")},setNodes:r=>{e({nodes:r,isModified:!0},!1,"setNodes")},addEdge:(r,n,i,o)=>{const s=Hg("edge"),a={id:s,source:r,target:n,sourceHandle:i,targetHandle:o};return e(l=>({edges:[...l.edges,a],isModified:!0}),!1,"addEdge"),s},updateEdge:(r,n)=>{e(i=>({edges:i.edges.map(o=>o.id===r?{...o,data:{...o.data,...n}}:o),isModified:!0}),!1,"updateEdge")},removeEdge:r=>{e(n=>({edges:n.edges.filter(i=>i.id!==r),isModified:!0,selectedEdgeId:n.selectedEdgeId===r?null:n.selectedEdgeId}),!1,"removeEdge")},setEdges:r=>{e({edges:r,isModified:!0},!1,"setEdges")},setSelectedNodeId:r=>{e({selectedNodeId:r,selectedEdgeId:null,isPropertyPanelOpen:r!==null},!1,"setSelectedNodeId")},setSelectedEdgeId:r=>{e({selectedEdgeId:r,selectedNodeId:null},!1,"setSelectedEdgeId")},fetchFlows:async()=>{e({isLoadingFlows:!0},!1,"fetchFlows/start");try{const r=await fetch(`${uu}/flows`,{credentials:"same-origin"});if(!r.ok)throw new Error(`Failed to fetch flows: ${r.statusText}`);const n=await r.json(),i=Array.isArray(n==null?void 0:n.data)?n.data:(n==null?void 0:n.flows)||[];e({flows:i,isLoadingFlows:!1},!1,"fetchFlows/success")}catch(r){console.error("Error fetching flows:",r),e({isLoadingFlows:!1},!1,"fetchFlows/error")}},setIsPaletteOpen:r=>{e({isPaletteOpen:r},!1,"setIsPaletteOpen")},setIsPropertyPanelOpen:r=>{e({isPropertyPanelOpen:r},!1,"setIsPropertyPanelOpen")},setLeftPanelTab:r=>{e({leftPanelTab:r},!1,"setLeftPanelTab")},toggleInteractionMode:()=>{e(r=>({interactionMode:r.interactionMode==="pan"?"selection":"pan"}),!1,"toggleInteractionMode")},setInteractionMode:r=>{e({interactionMode:r},!1,"setInteractionMode")},addCustomTemplate:r=>{e(n=>{const i=[...n.customTemplates,r];return BM(i),{customTemplates:i}},!1,"addCustomTemplate")},removeCustomTemplate:r=>{e(n=>{const i=n.customTemplates.filter(o=>o.id!==r);return BM(i),{customTemplates:i}},!1,"removeCustomTemplate")},saveNodeAsTemplate:(r,n,i)=>{const o=t().nodes.find(u=>u.id===r);if(!o)return null;const{executionStatus:s,executionError:a,executionResult:l,...c}=o.data,d={id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,label:n,description:i,icon:"MessageSquare",color:"bg-blue-500",category:"command",data:{...c,label:n}};return t().addCustomTemplate(d),d},loadCustomTemplates:()=>{e({customTemplates:tH()},!1,"loadCustomTemplates")},resetFlow:()=>{e({currentFlow:null,nodes:[],edges:[],isModified:!1,selectedNodeId:null,selectedEdgeId:null},!1,"resetFlow")},getSelectedNode:()=>{const{nodes:r,selectedNodeId:n}=t();return r.find(i=>i.id===n)},markModified:()=>{e({isModified:!0},!1,"markModified")}}),{name:"FlowStore"})),sle=500,ale={currentExecution:null,nodeStates:{},logs:[],maxLogs:sle,nodeOutputs:{},nodeToolCalls:{},selectedNodeId:null,isMonitorPanelOpen:!1,autoScrollLogs:!0},lle=gn()(En((e,t)=>({...ale,startExecution:(r,n)=>{const i=new Date().toISOString();e({currentExecution:{execId:r,flowId:n,status:"running",startedAt:i,elapsedMs:0},nodeStates:{},logs:[]},!1,"startExecution")},setExecutionStatus:(r,n)=>{e(i=>i.currentExecution?{currentExecution:{...i.currentExecution,status:r,currentNodeId:n??i.currentExecution.currentNodeId}}:i,!1,"setExecutionStatus")},completeExecution:r=>{const n=new Date().toISOString();e(i=>{if(!i.currentExecution)return i;const o=new Date(i.currentExecution.startedAt).getTime(),s=Date.now()-o;return{currentExecution:{...i.currentExecution,status:r,completedAt:n,elapsedMs:s,currentNodeId:void 0}}},!1,"completeExecution")},clearExecution:()=>{e({currentExecution:null,nodeStates:{},logs:[]},!1,"clearExecution")},setNodeStarted:r=>{const n=new Date().toISOString();e(i=>({nodeStates:{...i.nodeStates,[r]:{nodeId:r,status:"running",startedAt:n}}}),!1,"setNodeStarted")},setNodeCompleted:(r,n)=>{const i=new Date().toISOString();e(o=>({nodeStates:{...o.nodeStates,[r]:{...o.nodeStates[r],nodeId:r,status:"completed",completedAt:i,result:n}}}),!1,"setNodeCompleted")},setNodeFailed:(r,n)=>{const i=new Date().toISOString();e(o=>({nodeStates:{...o.nodeStates,[r]:{...o.nodeStates[r],nodeId:r,status:"failed",completedAt:i,error:n}}}),!1,"setNodeFailed")},clearNodeStates:()=>{e({nodeStates:{}},!1,"clearNodeStates")},addLog:r=>{e(n=>{const i=[...n.logs,r];return i.length>n.maxLogs?{logs:i.slice(-n.maxLogs)}:{logs:i}},!1,"addLog")},clearLogs:()=>{e({logs:[]},!1,"clearLogs")},setMonitorPanelOpen:r=>{e({isMonitorPanelOpen:r},!1,"setMonitorPanelOpen")},setAutoScrollLogs:r=>{e({autoScrollLogs:r},!1,"setAutoScrollLogs")},addNodeOutput:(r,n)=>{e(i=>{const o=i.nodeOutputs[r];return o?{nodeOutputs:{...i.nodeOutputs,[r]:{...o,outputs:[...o.outputs,n]}}}:{nodeOutputs:{...i.nodeOutputs,[r]:{nodeId:r,outputs:[n],toolCalls:[],logs:[],variables:{},startTime:Date.now()}}}},!1,"addNodeOutput")},clearNodeOutputs:r=>{e(n=>{const i={...n.nodeOutputs};return delete i[r],{nodeOutputs:i}},!1,"clearNodeOutputs")},startToolCall:(r,n,i)=>{const o={callId:n,nodeId:r,status:"executing",kind:i.kind,subtype:i.subtype,description:i.description,startTime:Date.now(),outputLines:[],outputBuffer:{stdout:"",stderr:"",combined:""}};e(s=>{const a=s.nodeToolCalls[r]||[];return{nodeToolCalls:{...s.nodeToolCalls,[r]:[...a,o]}}},!1,"startToolCall")},updateToolCall:(r,n,i)=>{e(o=>{const s=o.nodeToolCalls[r];if(!s)return o;const a=s.findIndex(d=>d.callId===n);if(a===-1)return o;const l=[...s],c=l[a];if(i.status&&(c.status=i.status,i.status!=="executing"&&!c.endTime&&(c.endTime=Date.now(),c.duration=c.endTime-c.startTime)),i.outputChunk!==void 0){const d={type:i.stream==="stderr"?"stderr":"stdout",content:i.outputChunk,timestamp:Date.now()};c.outputLines.push(d),i.stream==="stderr"?(c.outputBuffer.stderr+=i.outputChunk,c.outputBuffer.combined+=i.outputChunk):(c.outputBuffer.stdout+=i.outputChunk,c.outputBuffer.combined+=i.outputChunk)}return l[a]=c,{nodeToolCalls:{...o.nodeToolCalls,[r]:l}}},!1,"updateToolCall")},completeToolCall:(r,n,i)=>{e(o=>{const s=o.nodeToolCalls[r];if(!s)return o;const a=s.findIndex(d=>d.callId===n);if(a===-1)return o;const l=[...s],c={...l[a]};return c.status=i.status,c.endTime=Date.now(),c.duration=c.endTime-c.startTime,i.exitCode!==void 0&&(c.exitCode=i.exitCode),i.error!==void 0&&(c.error=i.error),i.result!==void 0&&(c.result=i.result),l[a]=c,{nodeToolCalls:{...o.nodeToolCalls,[r]:l}}},!1,"completeToolCall")},toggleToolCallExpanded:(r,n)=>{e(i=>{const o=i.nodeToolCalls[r];if(!o)return i;const s=o.findIndex(l=>l.callId===n);if(s===-1)return i;const a=[...o];return a[s]={...a[s],isExpanded:!a[s].isExpanded},{nodeToolCalls:{...i.nodeToolCalls,[r]:a}}},!1,"toggleToolCallExpanded")},selectNode:r=>{e({selectedNodeId:r},!1,"selectNode")},getNodeOutputs:r=>t().nodeOutputs[r],getToolCallsForNode:r=>t().nodeToolCalls[r]||[]}),{name:"ExecutionStore"})),pze=e=>{var t;return((t=e.currentExecution)==null?void 0:t.status)==="running"},cle="cli-viewer-storage",ule=1,UM=e=>`pane-${e}`,dle=e=>`tab-${e}`,Zh=e=>typeof e=="string",fle=(e,t)=>{const r=(n,i)=>{for(let o=0;o<n.children.length;o++){const s=n.children[o];if(Zh(s)){if(s===t)return{found:!0,parent:n,index:o}}else{const a=r(s);if(a.found)return a}}return{found:!1,parent:null,index:-1}};return r(e)},hle=(e,t)=>{const r=i=>{const o=[];for(const l of i.children)if(Zh(l))l!==t&&o.push(l);else{const c=r(l);c&&c.children.length>0&&(c.children.length===1?o.push(c.children[0]):o.push(c))}if(o.length===0)return null;const s=i.sizes?i.sizes.filter((l,c)=>{const d=i.children[c];return!Zh(d)||d!==t}):void 0,a=s?(()=>{const l=s.reduce((c,d)=>c+d,0);return l>0?s.map(c=>c/l*100):void 0})():void 0;return{direction:i.direction,sizes:a,children:o}};return r(e)||{direction:"horizontal",children:[]}},ple=(e,t,r,n="horizontal")=>{if(!r){if(e.children.length===0)return{...e,children:[t],sizes:[100]};if(e.direction===n){const o=e.sizes||e.children.map(()=>100/e.children.length),s=o.reduce((c,d)=>c+d,0),a=s/(e.children.length+1),l=(s-a)/s;return{...e,children:[...e.children,t],sizes:[...o.map(c=>c*l),a]}}return{direction:n,sizes:[50,50],children:[e,t]}}const i=o=>{const s=[];let a=o.sizes?[]:void 0;for(let l=0;l<o.children.length;l++){const c=o.children[l],d=o.sizes?o.sizes[l]:void 0;if(Zh(c))if(c===r)if(o.direction===n){const u=(d||50)/2;s.push(c,t),a&&a.push(u,u)}else{const u={direction:n,sizes:[50,50],children:[c,t]};s.push(u),a&&d!==void 0&&a.push(d)}else s.push(c),a&&d!==void 0&&a.push(d);else fle(c,r).found?s.push(i(c)):s.push(c),a&&d!==void 0&&a.push(d)}return{...o,children:s,sizes:a}};return i(e)},qg=e=>{const t=[],r=n=>{for(const i of n.children)Zh(i)?t.push(i):r(i)};return r(e),t},rH=()=>({direction:"horizontal",children:[]}),mle={layout:rH(),panes:{},tabs:{},focusedPaneId:null,nextPaneIdCounter:1,nextTabIdCounter:1},dA=gn()(im(En((e,t)=>({...mle,setLayout:r=>{if(typeof r=="function"){const n=t().layout,i=r(n);e({layout:i},!1,"viewer/setLayout")}else e({layout:r},!1,"viewer/setLayout")},addPane:(r,n="horizontal")=>{const i=t(),o=UM(i.nextPaneIdCounter),s={id:o,tabs:[],activeTabId:null},a=ple(i.layout,o,r,n);return e({layout:a,panes:{...i.panes,[o]:s},focusedPaneId:o,nextPaneIdCounter:i.nextPaneIdCounter+1},!1,"viewer/addPane"),o},removePane:r=>{const n=t(),i=n.panes[r];if(!i){console.warn(`[ViewerStore] Pane not found: ${r}`);return}if(qg(n.layout).length<=1){console.warn("[ViewerStore] Cannot remove the last pane");return}const s=hle(n.layout,r),a={...n.panes};delete a[r];const l={...n.tabs};for(const d of i.tabs)delete l[d.id];let c=n.focusedPaneId;if(c===r){const d=qg(s);c=d.length>0?d[0]:null}e({layout:s,panes:a,tabs:l,focusedPaneId:c},!1,"viewer/removePane")},addTab:(r,n,i)=>{const o=t(),s=o.panes[r];if(!s)return console.warn(`[ViewerStore] Pane not found: ${r}`),"";const a=s.tabs.find(p=>p.executionId===n);if(a)return e({panes:{...o.panes,[r]:{...s,activeTabId:a.id}},focusedPaneId:r},!1,"viewer/addTab-existing"),a.id;for(const[p,g]of Object.entries(o.panes)){if(p===r)continue;const _=g.tabs.find(y=>y.executionId===n);if(_)return e({panes:{...o.panes,[p]:{...g,activeTabId:_.id}},focusedPaneId:p},!1,"viewer/addTab-existing-global"),_.id}const l=dle(o.nextTabIdCounter),c=s.tabs.reduce((p,g)=>Math.max(p,g.order),0),d={id:l,executionId:n,title:i,isPinned:!1,order:c+1},u={...s,tabs:[...s.tabs,d],activeTabId:l};return e({panes:{...o.panes,[r]:u},tabs:{...o.tabs,[l]:d},focusedPaneId:r,nextTabIdCounter:o.nextTabIdCounter+1},!1,"viewer/addTab"),l},removeTab:(r,n)=>{const i=t(),o=i.panes[r];if(!o){console.warn(`[ViewerStore] Pane not found: ${r}`);return}const s=o.tabs.findIndex(u=>u.id===n);if(s===-1){console.warn(`[ViewerStore] Tab not found: ${n}`);return}const a=o.tabs.filter(u=>u.id!==n);let l=null;if(o.activeTabId===n&&a.length>0){const u=Math.min(s,a.length-1);l=a[u].id}else o.activeTabId!==n&&(l=o.activeTabId);const c={...o,tabs:a,activeTabId:l},d={...i.tabs};delete d[n],e({panes:{...i.panes,[r]:c},tabs:d},!1,"viewer/removeTab"),a.length===0&&qg(t().layout).length>1&&queueMicrotask(()=>{var g;const p=t();((g=p.panes[r])==null?void 0:g.tabs.length)===0&&p.removePane(r)})},setActiveTab:(r,n)=>{const i=t(),o=i.panes[r];if(!o){console.warn(`[ViewerStore] Pane not found: ${r}`);return}if(!o.tabs.find(a=>a.id===n)){console.warn(`[ViewerStore] Tab not found in pane: ${n}`);return}e({panes:{...i.panes,[r]:{...o,activeTabId:n}},focusedPaneId:r},!1,"viewer/setActiveTab")},moveTab:(r,n,i,o)=>{const s=t(),a=s.panes[r],l=s.panes[i];if(!a||!l){console.warn("[ViewerStore] Source or target pane not found");return}const c=a.tabs.findIndex(x=>x.id===n);if(c===-1){console.warn(`[ViewerStore] Tab not found: ${n}`);return}const d=a.tabs[c],u=a.tabs.filter(x=>x.id!==n);let p=a.activeTabId;if(a.activeTabId===n&&u.length>0){const x=Math.min(c,u.length-1);p=u[x].id}else a.activeTabId===n&&(p=null);let g;if(r===i){const x=[...u].sort((E,C)=>E.order-C.order);if(o===0)g=x.length>0?x[0].order-1:1;else if(o>=x.length)g=x.length>0?x[x.length-1].order+1:1;else{const E=x[o-1].order,C=x[o].order;g=(E+C)/2}}else{const x=[...l.tabs].sort((E,C)=>E.order-C.order);if(o===0)g=x.length>0?x[0].order-1:1;else if(o>=x.length)g=x.length>0?x[x.length-1].order+1:1;else{const E=x[o-1].order,C=x[o].order;g=(E+C)/2}}const _={...d,order:g};let y;r===i?y=[...u,_]:y=[...l.tabs,_];const m={...a,tabs:r===i?y:u,activeTabId:r===i?n:p},v=r===i?m:{...l,tabs:y,activeTabId:n},b={...s.panes,[r]:m};r!==i&&(b[i]=v),e({panes:b,tabs:{...s.tabs,[n]:_},focusedPaneId:i},!1,"viewer/moveTab"),r!==i&&u.length===0&&qg(t().layout).length>1&&queueMicrotask(()=>{var C;const E=t();((C=E.panes[r])==null?void 0:C.tabs.length)===0&&E.removePane(r)})},togglePinTab:r=>{const n=t(),i=n.tabs[r];if(!i){console.warn(`[ViewerStore] Tab not found: ${r}`);return}const o={...i,isPinned:!i.isPinned},s={...n.panes};for(const a of Object.keys(s)){const l=s[a];if(l.tabs.findIndex(d=>d.id===r)!==-1){s[a]={...l,tabs:l.tabs.map(d=>d.id===r?o:d)};break}}e({tabs:{...n.tabs,[r]:o},panes:s},!1,"viewer/togglePinTab")},setFocusedPane:r=>{if(!t().panes[r]){console.warn(`[ViewerStore] Pane not found: ${r}`);return}e({focusedPaneId:r},!1,"viewer/setFocusedPane")},initializeDefaultLayout:r=>{let i=t().nextPaneIdCounter;const o=()=>({id:UM(i++),tabs:[],activeTabId:null});let s;const a={};switch(r){case"single":{const c=o();a[c.id]=c,s={direction:"horizontal",sizes:[100],children:[c.id]};break}case"split-h":{const c=o(),d=o();a[c.id]=c,a[d.id]=d,s={direction:"horizontal",sizes:[50,50],children:[c.id,d.id]};break}case"split-v":{const c=o(),d=o();a[c.id]=c,a[d.id]=d,s={direction:"vertical",sizes:[50,50],children:[c.id,d.id]};break}case"grid-2x2":{const c=o(),d=o(),u=o(),p=o();a[c.id]=c,a[d.id]=d,a[u.id]=u,a[p.id]=p,s={direction:"vertical",sizes:[50,50],children:[{direction:"horizontal",sizes:[50,50],children:[c.id,d.id]},{direction:"horizontal",sizes:[50,50],children:[u.id,p.id]}]};break}default:return}const l=Object.keys(a)[0]||null;e({layout:s,panes:a,tabs:{},focusedPaneId:l,nextPaneIdCounter:i,nextTabIdCounter:1},!1,"viewer/initializeDefaultLayout")},reset:()=>{e({layout:rH(),panes:{},tabs:{},focusedPaneId:null,nextPaneIdCounter:1,nextTabIdCounter:1},!1,"viewer/reset")}}),{name:"ViewerStore"}),{name:cle,version:ule,partialize:e=>({layout:e.layout,panes:e.panes,tabs:e.tabs,focusedPaneId:e.focusedPaneId,nextPaneIdCounter:e.nextPaneIdCounter,nextTabIdCounter:e.nextTabIdCounter})})),mze=()=>dA(e=>e.layout),gze=()=>dA(e=>e.panes),vze=()=>dA(e=>e.focusedPaneId),yze=(e,t)=>{const r=e.panes[t];return!r||!r.activeTabId?null:r.tabs.find(n=>n.id===r.activeTabId)||null},HM={isPanelOpen:!1,activeTerminalId:null,panelView:"terminal",terminalOrder:[]},Fn=gn()(En((e,t)=>({...HM,openTerminal:r=>{const{terminalOrder:n}=t(),i=n.includes(r)?n:[...n,r];e({isPanelOpen:!0,activeTerminalId:r,panelView:"terminal",terminalOrder:i},!1,"openTerminal")},closePanel:()=>{e({isPanelOpen:!1},!1,"closePanel")},togglePanel:()=>{const{isPanelOpen:r,activeTerminalId:n,terminalOrder:i}=t();if(r)e({isPanelOpen:!1},!1,"togglePanel/close");else{const o=n??i[0]??null;e({isPanelOpen:!0,activeTerminalId:o,panelView:o?"terminal":"queue"},!1,"togglePanel/open")}},setActiveTerminal:r=>{e({activeTerminalId:r},!1,"setActiveTerminal")},setPanelView:r=>{e({panelView:r},!1,"setPanelView")},addTerminal:r=>{const{terminalOrder:n}=t();n.includes(r)||e({terminalOrder:[...n,r]},!1,"addTerminal")},removeTerminal:r=>{const{terminalOrder:n,activeTerminalId:i}=t(),o=n.filter(a=>a!==r);let s=i;if(i===r){const a=n.indexOf(r);o.length===0?s=null:a>=o.length?s=o[o.length-1]:s=o[a]}e({terminalOrder:o,activeTerminalId:s,isPanelOpen:o.length>0?t().isPanelOpen:!1},!1,"removeTerminal")},resetState:()=>{e({...HM},!1,"resetState")}}),{name:"TerminalPanelStore"})),gle=e=>e.terminalOrder.length;function bze(){return Fn(t=>t.openTerminal)}const qM={executions:{}},Ud=gn()(En(e=>({...qM,addExecution:t=>{e(r=>({executions:{...r.executions,[t.id]:t}}),!1,"addExecution")},updateStatus:(t,r,n)=>{e(i=>{const o=i.executions[t];if(!o)return i;const s=r==="completed"||r==="failed";return{executions:{...i.executions,[t]:{...o,status:r,completedAt:s?new Date().toISOString():o.completedAt,error:n??o.error}}}},!1,"updateStatus")},removeExecution:t=>{e(r=>{const{[t]:n,...i}=r.executions;return{executions:i}},!1,"removeExecution")},clearCompleted:()=>{e(t=>{const r={};for(const[n,i]of Object.entries(t.executions))i.status!=="completed"&&i.status!=="failed"&&(r[n]=i);return{executions:r}},!1,"clearCompleted")},resetState:()=>{e({...qM},!1,"resetState")}}),{name:"QueueExecutionStore"})),vle=[],yle=e=>t=>{const r=Object.values(t.executions).filter(n=>n.queueItemId===e);return r.length===0?vle:r};function ble(e,t){return e.dependsOn.every(r=>{const n=t[r];return n&&(n.status==="completed"||n.status==="skipped")})}function WM(e,t){for(const r of e.steps){const n=t[r.id];if(n&&n.status==="pending"&&ble(r,t))return r.id}return null}function _le(e){return Object.values(e).every(t=>t.status==="completed"||t.status==="skipped"||t.status==="failed")}const VM={activePlans:{}},Bl=gn()(En((e,t)=>({...VM,startOrchestration:(r,n)=>{const i={};for(const s of r.steps)i[s.id]={status:"pending",retryCount:0};const o={plan:r,status:"running",currentStepIndex:0,stepStatuses:i,executionIdMap:{},sessionKey:n};e(s=>({activePlans:{...s.activePlans,[r.id]:o}}),!1,"startOrchestration")},pauseOrchestration:r=>{e(n=>{const i=n.activePlans[r];return!i||i.status!=="running"?n:{activePlans:{...n.activePlans,[r]:{...i,status:"paused"}}}},!1,"pauseOrchestration")},resumeOrchestration:r=>{e(n=>{const i=n.activePlans[r];return!i||i.status!=="paused"?n:{activePlans:{...n.activePlans,[r]:{...i,status:"running"}}}},!1,"resumeOrchestration")},stopOrchestration:(r,n)=>{e(i=>{const o=i.activePlans[r];return o?{activePlans:{...i.activePlans,[r]:{...o,status:"failed",error:n??"Orchestration stopped by user"}}}:i},!1,"stopOrchestration")},updateStepStatus:(r,n,i,o)=>{e(s=>{const a=s.activePlans[r];if(!a)return s;const l=a.stepStatuses[n];if(!l)return s;const c=new Date().toISOString(),d=i==="running",u=i==="completed"||i==="failed"||i==="skipped";return{activePlans:{...s.activePlans,[r]:{...a,stepStatuses:{...a.stepStatuses,[n]:{...l,status:i,startedAt:d?c:l.startedAt,completedAt:u?c:l.completedAt,result:(o==null?void 0:o.data)??l.result,error:(o==null?void 0:o.error)??l.error}}}}}},!1,"updateStepStatus")},registerExecution:(r,n,i)=>{e(o=>{const s=o.activePlans[r];return s?{activePlans:{...o.activePlans,[r]:{...s,executionIdMap:{...s.executionIdMap,[i]:n}}}}:o},!1,"registerExecution")},retryStep:(r,n)=>{e(i=>{const o=i.activePlans[r];if(!o)return i;const s=o.stepStatuses[n];return s?{activePlans:{...i.activePlans,[r]:{...o,status:"running",stepStatuses:{...o.stepStatuses,[n]:{...s,status:"pending",error:void 0,result:void 0,startedAt:void 0,completedAt:void 0,retryCount:s.retryCount+1}}}}}:i},!1,"retryStep")},skipStep:(r,n)=>{e(i=>{const o=i.activePlans[r];if(!o)return i;const s=o.stepStatuses[n];return s?{activePlans:{...i.activePlans,[r]:{...o,stepStatuses:{...o.stepStatuses,[n]:{...s,status:"skipped",completedAt:new Date().toISOString()}}}}}:i},!1,"skipStep")},_advanceToNextStep:r=>{const i=t().activePlans[r];if(!i||i.status!=="running")return null;const o=WM(i.plan,i.stepStatuses);if(o){const s=i.plan.steps.findIndex(a=>a.id===o);return e(a=>{const l=a.activePlans[r];return l?{activePlans:{...a.activePlans,[r]:{...l,currentStepIndex:s>=0?s:l.currentStepIndex}}}:a},!1,"_advanceToNextStep"),o}if(_le(i.stepStatuses)){const s=Object.values(i.stepStatuses).some(a=>a.status==="failed");e(a=>{const l=a.activePlans[r];return l?{activePlans:{...a.activePlans,[r]:{...l,status:s?"failed":"completed"}}}:a},!1,"_advanceToNextStep/complete")}return null},getNextReadyStep:r=>{const i=t().activePlans[r];return!i||i.status!=="running"?null:WM(i.plan,i.stepStatuses)},removePlan:r=>{e(n=>{const{[r]:i,...o}=n.activePlans;return{activePlans:o}},!1,"removePlan")},clearAll:()=>{e(VM,!1,"clearAll")}}),{name:"OrchestratorStore"})),xle=e=>e.activePlans,wle=e=>Object.values(e.activePlans).filter(t=>t.status==="running"||t.status==="paused").length,Sle=2*1024*1024,Cle=new TextEncoder;function Zx(e){return Cle.encode(e).length}const GM={sessions:{},outputChunks:{},outputBytes:{}},li=gn()(En((e,t)=>({...GM,setSessions:r=>e(n=>{const i={};for(const l of r)i[l.sessionKey]=l;const o=new Set(Object.keys(i)),s={...n.outputChunks},a={...n.outputBytes};for(const l of Object.keys(s))o.has(l)||delete s[l];for(const l of Object.keys(a))o.has(l)||delete a[l];return{sessions:i,outputChunks:s,outputBytes:a}}),upsertSession:r=>e(n=>({sessions:{...n.sessions,[r.sessionKey]:r}})),removeSession:r=>e(n=>{const i={...n.sessions},o={...n.outputChunks},s={...n.outputBytes};return delete i[r],delete o[r],delete s[r],{sessions:i,outputChunks:o,outputBytes:s}}),updateSessionPausedState:(r,n)=>e(i=>{const o=i.sessions[r];return o?{sessions:{...i.sessions,[r]:{...o,isPaused:n,updatedAt:new Date().toISOString()}}}:i}),resetState:()=>e({...GM}),setBuffer:(r,n)=>e(i=>({outputChunks:{...i.outputChunks,[r]:n?[{data:n,timestamp:Date.now()}]:[]},outputBytes:{...i.outputBytes,[r]:n?Zx(n):0}})),appendOutput:(r,n,i=Date.now())=>{if(!n)return;const o=Zx(n),{outputChunks:s,outputBytes:a}=t(),l=s[r]??[],c=a[r]??0,d=[...l,{data:n,timestamp:i}];let u=c+o;for(;u>Sle&&d.length>0;){const p=d.shift();p&&(u-=Zx(p.data))}e(p=>({outputChunks:{...p.outputChunks,[r]:d},outputBytes:{...p.outputBytes,[r]:Math.max(0,u)}}))},clearOutput:r=>e(n=>({outputChunks:{...n.outputChunks,[r]:[]},outputBytes:{...n.outputBytes,[r]:0}}))}),{name:"cliSessionStore"})),KM={groups:[],layout:{grid:"1x1",splits:[1]},activeTerminalId:null,terminalMetas:{}};let ri=null;function Ele(e){Hd.getState().updateTerminalMeta(e.sessionKey,{status:"locked",isLocked:!0,lockReason:e.reason,lockedByExecutionId:e.executionId,lockedAt:e.timestamp})}function kle(e){const t=Hd.getState(),r=t.terminalMetas[e.sessionKey];r!=null&&r.isLocked&&t.updateTerminalMeta(e.sessionKey,{status:"active",isLocked:!1,lockReason:void 0,lockedByExecutionId:void 0,lockedAt:void 0})}function Tle(e){const t=e.data;if(t.type!=="alert")return;const{sessionId:r,severity:n,message:i}=t,o={critical:"error",warning:"idle"},s=Hd.getState(),a=s.terminalMetas[r],l=(a==null?void 0:a.alertCount)??0;s.updateTerminalMeta(r,{status:o[n]??"idle",alertCount:l+1})}const Hd=gn()(En(e=>({...KM,createGroup:t=>{const n={id:`group-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,name:t,sessionIds:[]};e(i=>({groups:[...i.groups,n]}),!1,"createGroup")},removeGroup:t=>{e(r=>({groups:r.groups.filter(n=>n.id!==t)}),!1,"removeGroup")},moveSessionToGroup:(t,r)=>{e(n=>({groups:n.groups.map(o=>{const s=o.sessionIds.filter(a=>a!==t);return o.id===r?{...o,sessionIds:[...s,t]}:{...o,sessionIds:s}})}),!1,"moveSessionToGroup")},setActiveTerminal:t=>{e({activeTerminalId:t},!1,"setActiveTerminal")},updateTerminalMeta:(t,r)=>{e(n=>{const i=n.terminalMetas[t]??{title:t,status:"idle",alertCount:0};return{terminalMetas:{...n.terminalMetas,[t]:{...i,...r}}}},!1,"updateTerminalMeta")},resetState:()=>{ri&&(ri.terminate(),ri=null),e({...KM},!1,"resetState")},setGroupLayout:t=>{e({layout:t},!1,"setGroupLayout")},spawnMonitor:()=>{if(!ri)try{ri=new Worker(new URL("/assets/monitor.worker-CVRNUIeJ.js",import.meta.url),{type:"module"}),ri.onmessage=Tle,ri.onerror=t=>{}}catch{ri=null}},terminateMonitor:()=>{ri&&(ri.terminate(),ri=null)},feedMonitor:(t,r)=>{ri||Hd.getState().spawnMonitor(),ri&&ri.postMessage({type:"output",sessionId:t,text:r})},pauseSession:async t=>{const r=fr(Rt.getState());try{await HU(t,r??void 0),e(n=>{const i=n.terminalMetas[t];return i?{terminalMetas:{...n.terminalMetas,[t]:{...i,status:"paused"}}}:n},!1,"pauseSession")}catch(n){throw n}},resumeSession:async t=>{const r=fr(Rt.getState());e(n=>{const i=n.terminalMetas[t];return i?{terminalMetas:{...n.terminalMetas,[t]:{...i,status:"resuming"}}}:n},!1,"resumeSession/pending");try{await qU(t,r??void 0),e(n=>{const i=n.terminalMetas[t];return i?{terminalMetas:{...n.terminalMetas,[t]:{...i,status:"active"}}}:n},!1,"resumeSession/fulfilled")}catch(n){throw e(i=>{const o=i.terminalMetas[t];return o?{terminalMetas:{...i.terminalMetas,[t]:{...o,status:"paused"}}}:i},!1,"resumeSession/rejected"),n}},restartSession:async t=>{const r=fr(Rt.getState()),i=li.getState().sessions[t];if(!i)throw new Error(`Session not found: ${t}`);const o={workingDir:i.workingDir,tool:i.tool,model:i.model,resumeKey:i.resumeKey,shellKind:i.shellKind},s=a=>a==="pwsh"||a==="powershell"?"pwsh":a==="cmd"?"cmd":"bash";try{await Vv(t,r??void 0);const a=await S0({workingDir:o.workingDir,preferredShell:s(o.shellKind),tool:o.tool,model:o.model,resumeKey:o.resumeKey},r??void 0);return e(l=>{const c=l.terminalMetas[t];return c?{terminalMetas:{...l.terminalMetas,[t]:{...c,status:"active",alertCount:0}}}:l},!1,"restartSession"),a}catch(a){throw a}},closeSession:async t=>{const r=fr(Rt.getState()),n=li.getState();try{await Vv(t,r??void 0),n.removeSession(t),e(i=>{const o={...i.terminalMetas};return delete o[t],{terminalMetas:o}},!1,"closeSession")}catch(i){throw i}},lockSession:(t,r,n)=>{e(i=>{const o=i.terminalMetas[t];return o?{terminalMetas:{...i.terminalMetas,[t]:{...o,status:"locked",isLocked:!0,lockReason:r,lockedByExecutionId:n,lockedAt:new Date().toISOString()}}}:i},!1,"lockSession")},unlockSession:t=>{e(r=>{const n=r.terminalMetas[t];return n?{terminalMetas:{...r.terminalMetas,[t]:{...n,status:"active",isLocked:!1,lockReason:void 0,lockedByExecutionId:void 0,lockedAt:void 0}}}:r},!1,"unlockSession")}}),{name:"SessionManagerStore"})),_ze=e=>e.activeTerminalId,xze=e=>e.terminalMetas,XM={selectedIssueId:null,associationChain:null},Tk=gn()(En(e=>({...XM,setSelectedIssue:t=>{if(t===null){e({selectedIssueId:null,associationChain:null},!1,"setSelectedIssue/clear");return}const r=ZM(t);e({selectedIssueId:t,associationChain:r},!1,"setSelectedIssue")},buildAssociationChain:(t,r)=>{let n;switch(r){case"issue":n=ZM(t);break;case"queue":n=Ple(t);break;case"session":n=Ale(t);break;default:n={issueId:null,queueItemId:null,sessionId:null}}e({associationChain:n,selectedIssueId:n.issueId},!1,"buildAssociationChain")},resetState:()=>{e({...XM},!1,"resetState")},_updateQueueItemStatus:(t,r,n)=>{const i=Ud.getState(),s=Object.values(i.executions).find(a=>a.queueItemId===t);s&&["pending","running","completed","failed"].includes(r)&&i.updateStatus(s.id,r),n&&e(a=>a.associationChain&&a.associationChain.queueItemId===t?{associationChain:{...a.associationChain,sessionId:n}}:a,!1,"_updateQueueItemStatus")}}),{name:"IssueQueueIntegrationStore"}));function ZM(e){const r=Object.values(Ud.getState().executions).find(n=>n.issueId===e);return r?{issueId:e,queueItemId:r.queueItemId,sessionId:r.sessionKey??null}:{issueId:e,queueItemId:null,sessionId:null}}function Ple(e){const r=Object.values(Ud.getState().executions).find(n=>n.queueItemId===e);return r?{issueId:r.issueId,queueItemId:e,sessionId:r.sessionKey??null}:{issueId:null,queueItemId:e,sessionId:null}}function Ale(e){const r=Object.values(Ud.getState().executions).find(n=>n.sessionKey===e);return r?{issueId:r.issueId,queueItemId:r.queueItemId,sessionId:e}:{issueId:null,queueItemId:null,sessionId:e}}const wze=e=>e.selectedIssueId,Ole=e=>e.associationChain;function Qh(e){return typeof e=="string"}function Ile(e,t){const r=(n,i)=>{for(let o=0;o<n.children.length;o++){const s=n.children[o];if(Qh(s)){if(s===t)return{found:!0,parent:n,index:o}}else{const a=r(s);if(a.found)return a}}return{found:!1,parent:null,index:-1}};return r(e)}function Rle(e,t){const r=i=>{const o=[];for(const l of i.children)if(Qh(l))l!==t&&o.push(l);else{const c=r(l);c&&c.children.length>0&&(c.children.length===1?o.push(c.children[0]):o.push(c))}if(o.length===0)return null;const s=i.sizes?i.sizes.filter((l,c)=>{const d=i.children[c];return!Qh(d)||d!==t}):void 0,a=s?(()=>{const l=s.reduce((c,d)=>c+d,0);return l>0?s.map(c=>c/l*100):void 0})():void 0;return{direction:i.direction,sizes:a,children:o}};return r(e)||{direction:"horizontal",children:[]}}function QM(e,t,r,n="horizontal"){if(!r){if(e.children.length===0)return{...e,children:[t],sizes:[100]};if(e.direction===n){const o=e.sizes||e.children.map(()=>100/e.children.length),s=o.reduce((c,d)=>c+d,0),a=s/(e.children.length+1),l=(s-a)/s;return{...e,children:[...e.children,t],sizes:[...o.map(c=>c*l),a]}}return{direction:n,sizes:[50,50],children:[e,t]}}const i=o=>{const s=[];let a=o.sizes?[]:void 0;for(let l=0;l<o.children.length;l++){const c=o.children[l],d=o.sizes?o.sizes[l]:void 0;if(Qh(c))if(c===r)if(o.direction===n){const u=(d||50)/2;s.push(c,t),a&&a.push(u,u)}else{const u={direction:n,sizes:[50,50],children:[c,t]};s.push(u),a&&d!==void 0&&a.push(d)}else s.push(c),a&&d!==void 0&&a.push(d);else Ile(c,r).found?s.push(i(c)):s.push(c),a&&d!==void 0&&a.push(d)}return{...o,children:s,sizes:a}};return i(e)}function YM(e){const t=[],r=n=>{for(const i of n.children)Qh(i)?t.push(i):r(i)};return r(e),t}const Nle="terminal-grid-storage",Mle=2;function jle(e){return{id:e.id,sessionId:e.sessionId,cliTool:e.cliTool??null,displayMode:e.displayMode??"terminal",filePath:e.filePath??null}}function Dle(e,t){if(t<2){const r=e,n={};for(const[i,o]of Object.entries(r.panes))n[i]=jle(o);return{layout:r.layout,panes:n,focusedPaneId:r.focusedPaneId,nextPaneIdCounter:r.nextPaneIdCounter}}return e}const Pv=e=>`tpane-${e}`;function Lle(){const e=Pv(1);return{layout:{direction:"horizontal",sizes:[100],children:[e]},panes:{[e]:{id:e,sessionId:null,cliTool:null,displayMode:"terminal",filePath:null}},focusedPaneId:e,nextPaneIdCounter:2}}const Wg=Lle(),JM={layout:Wg.layout,panes:Wg.panes,focusedPaneId:Wg.focusedPaneId,nextPaneIdCounter:Wg.nextPaneIdCounter},$le=gn()(im(En((e,t)=>({...JM,setLayout:r=>{e({layout:r},!1,"terminalGrid/setLayout")},updateLayoutSizes:r=>{const n=t().layout;JSON.stringify(n.sizes)!==JSON.stringify(r)&&e({layout:{...n,sizes:r}},!1,"terminalGrid/updateLayoutSizes")},splitPane:(r,n)=>{const i=t(),o=Pv(i.nextPaneIdCounter),s=QM(i.layout,o,r,n);return e({layout:s,panes:{...i.panes,[o]:{id:o,sessionId:null,cliTool:null,displayMode:"terminal",filePath:null}},focusedPaneId:o,nextPaneIdCounter:i.nextPaneIdCounter+1},!1,"terminalGrid/splitPane"),o},closePane:r=>{const n=t();if(YM(n.layout).length<=1)return;const o=Rle(n.layout,r),s={...n.panes};delete s[r];let a=n.focusedPaneId;if(a===r){const l=YM(o);a=l.length>0?l[0]:null}e({layout:o,panes:s,focusedPaneId:a},!1,"terminalGrid/closePane")},assignSession:(r,n,i)=>{const o=t(),s=o.panes[r];s&&e({panes:{...o.panes,[r]:{...s,sessionId:n,cliTool:i!==void 0?i??null:n?s.cliTool:null}}},!1,"terminalGrid/assignSession")},setFocused:r=>{t().panes[r]&&e({focusedPaneId:r},!1,"terminalGrid/setFocused")},resetLayout:r=>{let n=t().nextPaneIdCounter;const i=()=>({id:Pv(n++),sessionId:null,cliTool:null,displayMode:"terminal",filePath:null});let o;const s={};switch(r){case"single":{const l=i();s[l.id]=l,o={direction:"horizontal",sizes:[100],children:[l.id]};break}case"split-h":{const l=i(),c=i();s[l.id]=l,s[c.id]=c,o={direction:"horizontal",sizes:[50,50],children:[l.id,c.id]};break}case"split-v":{const l=i(),c=i();s[l.id]=l,s[c.id]=c,o={direction:"vertical",sizes:[50,50],children:[l.id,c.id]};break}case"grid-2x2":{const l=i(),c=i(),d=i(),u=i();s[l.id]=l,s[c.id]=c,s[d.id]=d,s[u.id]=u,o={direction:"vertical",sizes:[50,50],children:[{direction:"horizontal",sizes:[50,50],children:[l.id,c.id]},{direction:"horizontal",sizes:[50,50],children:[d.id,u.id]}]};break}default:return}const a=Object.keys(s)[0]||null;e({layout:o,panes:s,focusedPaneId:a,nextPaneIdCounter:n},!1,"terminalGrid/resetLayout")},resetWorkspaceState:()=>{const r=t(),n=Object.keys(r.panes);if(n.length===0){e({...JM},!1,"terminalGrid/resetWorkspaceState");return}const i=n.reduce((s,a)=>{const l=r.panes[a];return s[a]={...l,sessionId:null,cliTool:null,displayMode:"terminal",filePath:null},s},{}),o=r.focusedPaneId&&i[r.focusedPaneId]?r.focusedPaneId:n[0]??null;e({layout:r.layout,panes:i,focusedPaneId:o,nextPaneIdCounter:r.nextPaneIdCounter},!1,"terminalGrid/resetWorkspaceState")},createSessionAndAssign:async(r,n,i)=>{try{const s=(await S0(n,i??void 0)).session,a=t(),l=a.panes[r];if(!(l!=null&&l.sessionId))return e({panes:{...a.panes,[r]:{...l,sessionId:s.sessionKey,cliTool:s.tool??n.tool??null}},focusedPaneId:r},!1,"terminalGrid/createSessionAndAssign"),{paneId:r,session:s};const d=Pv(a.nextPaneIdCounter),u=QM(a.layout,d,r,"horizontal");return e({layout:u,panes:{...a.panes,[d]:{id:d,sessionId:s.sessionKey,cliTool:s.tool??n.tool??null,displayMode:"terminal",filePath:null}},focusedPaneId:d,nextPaneIdCounter:a.nextPaneIdCounter+1},!1,"terminalGrid/createSessionAndAssign"),{paneId:d,session:s}}catch(o){const s=o instanceof Error||o!=null&&o.message?o.message:String(o);throw console.error("Failed to create CLI session:",s,{config:n,projectPath:i,rawError:o}),new Error(s)}},setPaneDisplayMode:(r,n)=>{const i=t(),o=i.panes[r];o&&e({panes:{...i.panes,[r]:{...o,displayMode:n,filePath:n==="terminal"?null:o.filePath}}},!1,"terminalGrid/setPaneDisplayMode")},setPaneFilePath:(r,n)=>{const i=t(),o=i.panes[r];o&&e({panes:{...i.panes,[r]:{...o,filePath:n}}},!1,"terminalGrid/setPaneFilePath")},showFileInPane:(r,n)=>{const i=t(),o=i.panes[r];o&&e({panes:{...i.panes,[r]:{...o,displayMode:"file",filePath:n}},focusedPaneId:r},!1,"terminalGrid/showFileInPane")}}),{name:"TerminalGridStore"}),{name:Nle,version:Mle,migrate:Dle,partialize:e=>({layout:e.layout,panes:e.panes,focusedPaneId:e.focusedPaneId,nextPaneIdCounter:e.nextPaneIdCounter})})),Sze=e=>e.layout,Cze=e=>e.panes,Eze=e=>e.focusedPaneId,Qx={title:"",description:"",type:"other",priority:"medium",tags:[],project_id:void 0},Ble=[{id:"title",field:"title",title:"Issue 标题",description:"请输入一个简洁明确的标题"},{id:"description",field:"description",title:"Issue 描述",description:"请详细描述问题或需求"},{id:"type",field:"type",title:"Issue 类型",description:"选择 Issue 的类型"},{id:"priority",field:"priority",title:"优先级",description:"设置 Issue 的处理优先级",isOptional:!0},{id:"summary",field:"summary",title:"确认提交",description:"请确认以下信息后提交"}];gn()(En((e,t)=>({isOpen:!1,mode:"wizard",currentStep:0,steps:Ble,formData:{...Qx},validationErrors:{},isSubmitting:!1,submitError:null,submittedIssueId:null,openDialog:(r="wizard")=>{e({isOpen:!0,mode:r,currentStep:0,formData:{...Qx},validationErrors:{},submitError:null,submittedIssueId:null})},closeDialog:()=>{e({isOpen:!1,isSubmitting:!1})},goToStep:r=>{const{steps:n,validateCurrentStep:i}=t();if(r>=0&&r<n.length){if(r>t().currentStep&&!i())return;e({currentStep:r})}},nextStep:()=>{const{currentStep:r,steps:n,validateCurrentStep:i}=t();r<n.length-1&&i()&&e({currentStep:r+1})},prevStep:()=>{const{currentStep:r}=t();r>0&&e({currentStep:r-1})},updateField:(r,n)=>{e(i=>({formData:{...i.formData,[r]:n},validationErrors:{...i.validationErrors,[r]:void 0}}))},setFormData:r=>{e(n=>({formData:{...n.formData,...r}}))},resetForm:()=>{e({formData:{...Qx},validationErrors:{},currentStep:0,submitError:null,submittedIssueId:null})},validateCurrentStep:()=>{var a;const{currentStep:r,steps:n,formData:i}=t(),o=(a=n[r])==null?void 0:a.field;if(o==="summary")return!0;const s={};return o==="title"&&(i.title.trim()?i.title.length>200&&(s.title="标题不能超过200个字符"):s.title="标题不能为空"),o==="description"&&(i.description.trim()?i.description.length>1e4&&(s.description="描述不能超过10000个字符"):s.description="描述不能为空"),e({validationErrors:s}),Object.keys(s).length===0},submitIssue:async()=>{var n,i;const{formData:r}=t();e({isSubmitting:!0,submitError:null});try{const o=await fetch("/api/issues",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:`ISSUE-${Date.now()}`,title:r.title,context:r.description,priority:r.priority==="urgent"?1:r.priority==="high"?2:r.priority==="medium"?3:4,tags:r.tags,status:"registered"})}),s=await o.json();return!o.ok||s.error?(e({isSubmitting:!1,submitError:s.error||"提交失败,请稍后重试"}),{success:!1,error:s.error}):(e({isSubmitting:!1,submittedIssueId:(n=s.issue)==null?void 0:n.id}),{success:!0,issueId:(i=s.issue)==null?void 0:i.id})}catch(o){const s=o instanceof Error?o.message:"网络错误,请稍后重试";return e({isSubmitting:!1,submitError:s}),{success:!1,error:s}}}}),{name:"issue-dialog-store"}));const ej={activeExecutions:{},currentExecutionId:null,isPanelOpen:!1},fA=gn()(En(e=>({...ej,handleExecutionMessage:t=>{const{type:r,payload:n}=t,{executionId:i,flowId:o,sessionKey:s,stepId:a,stepName:l,totalSteps:c,output:d,error:u,timestamp:p}=n;e(g=>{const _=g.activeExecutions[i];switch(r){case"EXECUTION_STARTED":return{activeExecutions:{...g.activeExecutions,[i]:{executionId:i,flowId:o,flowName:l||"Workflow",sessionKey:s??"",status:"running",totalSteps:c||0,completedSteps:0,steps:[],startedAt:p}},currentExecutionId:i,isPanelOpen:!0};case"EXECUTION_STEP_START":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"running",currentStepId:a,steps:[..._.steps.filter(y=>y.id!==a),{id:a||"",name:l||"",status:"running",startedAt:p}]}}}:g;case"EXECUTION_STEP_PROGRESS":return!_||!a?g:{activeExecutions:{...g.activeExecutions,[i]:{..._,steps:_.steps.map(y=>y.id===a?{...y,output:(y.output||"")+(d||"")}:y)}}};case"EXECUTION_STEP_COMPLETE":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,completedSteps:_.completedSteps+1,steps:_.steps.map(y=>y.id===a?{...y,status:"completed",completedAt:p}:y)}}}:g;case"EXECUTION_STEP_FAILED":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"paused",steps:_.steps.map(y=>y.id===a?{...y,status:"failed",error:u,completedAt:p}:y)}}}:g;case"EXECUTION_PAUSED":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"paused"}}}:g;case"EXECUTION_RESUMED":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"running"}}}:g;case"EXECUTION_STOPPED":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"cancelled",completedAt:p}}}:g;case"EXECUTION_COMPLETED":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"completed",completedAt:p}}}:g;case"EXECUTION_FAILED":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"failed",completedAt:p}}}:g;default:return g}},!1,`handleExecutionMessage/${r}`)},selectExecution:t=>{e({currentExecutionId:t},!1,"selectExecution")},pauseExecution:async t=>{try{const n=await(await fetch(`/api/orchestrator/executions/${t}/pause`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();n.success||console.error("[ExecutionMonitor] Pause failed:",n.error)}catch(r){console.error("[ExecutionMonitor] Pause error:",r)}},resumeExecution:async t=>{try{const n=await(await fetch(`/api/orchestrator/executions/${t}/resume`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();n.success||console.error("[ExecutionMonitor] Resume failed:",n.error)}catch(r){console.error("[ExecutionMonitor] Resume error:",r)}},stopExecution:async t=>{try{const n=await(await fetch(`/api/orchestrator/executions/${t}/stop`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();n.success||console.error("[ExecutionMonitor] Stop failed:",n.error)}catch(r){console.error("[ExecutionMonitor] Stop error:",r)}},setPanelOpen:t=>{e({isPanelOpen:t},!1,"setPanelOpen")},clearExecution:t=>{e(r=>{const n={...r.activeExecutions};return delete n[t],{activeExecutions:n,currentExecutionId:r.currentExecutionId===t?null:r.currentExecutionId}},!1,"clearExecution")},clearAllExecutions:()=>{e({activeExecutions:{},currentExecutionId:null},!1,"clearAllExecutions")},resetState:()=>{e({...ej},!1,"resetState")}}),{name:"ExecutionMonitorStore"})),kze=e=>e.activeExecutions,Tze=e=>e.currentExecutionId?e.activeExecutions[e.currentExecutionId]:null,Pze=e=>Object.values(e.activeExecutions).filter(t=>t.status==="running"||t.status==="paused").length;function _e(e,t,r){function n(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);const c=s.prototype,d=Object.keys(c);for(let u=0;u<d.length;u++){const p=d[u];p in a||(a[p]=c[p].bind(a))}}const i=(r==null?void 0:r.Parent)??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function s(a){var l;const c=r!=null&&r.Parent?new o:this;n(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const d of c._zod.deferred)d();return c}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>{var l,c;return r!=null&&r.Parent&&a instanceof r.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class Du extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class nH extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const iH={};function Ja(e){return iH}function oH(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function Pk(e,t){return typeof t=="bigint"?t.toString():t}function C0(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function hA(e){return e==null}function pA(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Fle(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){const l=n.match(/\d?e-(\d?)/);l!=null&&l[1]&&(i=Number.parseInt(l[1]))}const o=r>i?r:i,s=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return s%a/10**o}const tj=Symbol("evaluating");function Ht(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==tj)return n===void 0&&(n=tj,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Pc(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ac(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function rj(e){return JSON.stringify(e)}function zle(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const sH="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Yh(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ule=C0(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function id(e){if(Yh(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Yh(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function aH(e){return id(e)?{...e}:Array.isArray(e)?[...e]:e}const Hle=new Set(["string","number","symbol"]);function od(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ol(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r!=null&&r.parent)&&(n._zod.parent=e),n}function Qe(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function qle(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Wle={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Vle(e,t){const r=e._zod.def,n=Ac(e._zod.def,{get shape(){const i={};for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(i[o]=r.shape[o])}return Pc(this,"shape",i),i},checks:[]});return ol(e,n)}function Gle(e,t){const r=e._zod.def,n=Ac(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete i[o]}return Pc(this,"shape",i),i},checks:[]});return ol(e,n)}function Kle(e,t){if(!id(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const i=Ac(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return Pc(this,"shape",o),o},checks:[]});return ol(e,i)}function Xle(e,t){if(!id(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Pc(this,"shape",n),n},checks:e._zod.def.checks};return ol(e,r)}function Zle(e,t){const r=Ac(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Pc(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return ol(e,r)}function Qle(e,t,r){const n=Ac(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=e?new e({type:"optional",innerType:i[s]}):i[s])}else for(const s in i)o[s]=e?new e({type:"optional",innerType:i[s]}):i[s];return Pc(this,"shape",o),o},checks:[]});return ol(t,n)}function Yle(e,t,r){const n=Ac(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(r)for(const s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new e({type:"nonoptional",innerType:i[s]}))}else for(const s in i)o[s]=new e({type:"nonoptional",innerType:i[s]});return Pc(this,"shape",o),o},checks:[]});return ol(t,n)}function ku(e,t=0){var r;if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(((r=e.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function Tu(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Vg(e){return typeof e=="string"?e:e==null?void 0:e.message}function el(e,t,r){var i,o,s,a,l,c;const n={...e,path:e.path??[]};if(!e.message){const d=Vg((s=(o=(i=e.inst)==null?void 0:i._zod.def)==null?void 0:o.error)==null?void 0:s.call(o,e))??Vg((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??Vg((l=r.customError)==null?void 0:l.call(r,e))??Vg((c=r.localeError)==null?void 0:c.call(r,e))??"Invalid input";n.message=d}return delete n.inst,delete n.continue,t!=null&&t.reportInput||delete n.input,n}function mA(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Jh(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const lH=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Pk,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},cH=_e("$ZodError",lH),uH=_e("$ZodError",lH,{Parent:Error});function Jle(e,t=r=>r.message){const r={},n=[];for(const i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function ece(e,t=r=>r.message){const r={_errors:[]},n=i=>{for(const o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>n({issues:s}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let s=r,a=0;for(;a<o.path.length;){const l=o.path[a];a===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(t(o))):s[l]=s[l]||{_errors:[]},s=s[l],a++}}};return n(e),r}const gA=e=>(t,r,n,i)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Du;if(s.issues.length){const a=new((i==null?void 0:i.Err)??e)(s.issues.map(l=>el(l,o,Ja())));throw sH(a,i==null?void 0:i.callee),a}return s.value},vA=e=>async(t,r,n,i)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new((i==null?void 0:i.Err)??e)(s.issues.map(l=>el(l,o,Ja())));throw sH(a,i==null?void 0:i.callee),a}return s.value},E0=e=>(t,r,n)=>{const i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new Du;return o.issues.length?{success:!1,error:new(e??cH)(o.issues.map(s=>el(s,i,Ja())))}:{success:!0,data:o.value}},tce=E0(uH),k0=e=>async(t,r,n)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>el(s,i,Ja())))}:{success:!0,data:o.value}},rce=k0(uH),nce=e=>(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return gA(e)(t,r,i)},ice=e=>(t,r,n)=>gA(e)(t,r,n),oce=e=>async(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return vA(e)(t,r,i)},sce=e=>async(t,r,n)=>vA(e)(t,r,n),ace=e=>(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return E0(e)(t,r,i)},lce=e=>(t,r,n)=>E0(e)(t,r,n),cce=e=>async(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return k0(e)(t,r,i)},uce=e=>async(t,r,n)=>k0(e)(t,r,n),dce=/^[cC][^\s-]{8,}$/,fce=/^[0-9a-z]+$/,hce=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pce=/^[0-9a-vA-V]{20}$/,mce=/^[A-Za-z0-9]{27}$/,gce=/^[a-zA-Z0-9_-]{21}$/,vce=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,yce=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,nj=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,bce=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_ce="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function xce(){return new RegExp(_ce,"u")}const wce=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Sce=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Cce=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ece=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kce=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dH=/^[A-Za-z0-9_-]*$/,Tce=/^\+(?:[0-9]){6,14}[0-9]$/,fH="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Pce=new RegExp(`^${fH}$`);function hH(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ace(e){return new RegExp(`^${hH(e)}$`)}function Oce(e){const t=hH({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${fH}T(?:${n})$`)}const Ice=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Rce=/^-?\d+$/,Nce=/^-?\d+(?:\.\d+)?/,Mce=/^(?:true|false)$/i,jce=/^[^A-Z]*$/,Dce=/^[^a-z]*$/,ui=_e("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),pH={number:"number",bigint:"bigint",object:"date"},mH=_e("$ZodCheckLessThan",(e,t)=>{ui.init(e,t);const r=pH[typeof t.value];e._zod.onattach.push(n=>{const i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),gH=_e("$ZodCheckGreaterThan",(e,t)=>{ui.init(e,t);const r=pH[typeof t.value];e._zod.onattach.push(n=>{const i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Lce=_e("$ZodCheckMultipleOf",(e,t)=>{ui.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Fle(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),$ce=_e("$ZodCheckNumberFormat",(e,t)=>{var s;ui.init(e,t),t.format=t.format||"float64";const r=(s=t.format)==null?void 0:s.includes("int"),n=r?"int":"number",[i,o]=Wle[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=i,l.maximum=o,r&&(l.pattern=Rce)}),e._zod.check=a=>{const l=a.value;if(r){if(!Number.isInteger(l)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}l<i&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),l>o&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:o,inst:e})}}),Bce=_e("$ZodCheckMaxLength",(e,t)=>{var r;ui.init(e,t),(r=e._zod.def).when??(r.when=n=>{const i=n.value;return!hA(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{const i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const i=n.value;if(i.length<=t.maximum)return;const s=mA(i);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Fce=_e("$ZodCheckMinLength",(e,t)=>{var r;ui.init(e,t),(r=e._zod.def).when??(r.when=n=>{const i=n.value;return!hA(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{const i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const i=n.value;if(i.length>=t.minimum)return;const s=mA(i);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),zce=_e("$ZodCheckLengthEquals",(e,t)=>{var r;ui.init(e,t),(r=e._zod.def).when??(r.when=n=>{const i=n.value;return!hA(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{const i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{const i=n.value,o=i.length;if(o===t.length)return;const s=mA(i),a=o>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),T0=_e("$ZodCheckStringFormat",(e,t)=>{var r,n;ui.init(e,t),e._zod.onattach.push(i=>{const o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Uce=_e("$ZodCheckRegex",(e,t)=>{T0.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Hce=_e("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=jce),T0.init(e,t)}),qce=_e("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Dce),T0.init(e,t)}),Wce=_e("$ZodCheckIncludes",(e,t)=>{ui.init(e,t);const r=od(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),Vce=_e("$ZodCheckStartsWith",(e,t)=>{ui.init(e,t);const r=new RegExp(`^${od(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Gce=_e("$ZodCheckEndsWith",(e,t)=>{ui.init(e,t);const r=new RegExp(`.*${od(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Kce=_e("$ZodCheckOverwrite",(e,t)=>{ui.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Xce{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
522
|
+
`);const b=v.state[a];if(b==null)return;JSON.stringify(i.getState())!==JSON.stringify(b)&&g(b);return}OM(i)&&i.dispatch(v)});case"DISPATCH":switch(y.payload.type){case"RESET":return g(_),a===void 0?d==null?void 0:d.init(i.getState()):d==null?void 0:d.init(Ug(l.name));case"COMMIT":if(a===void 0){d==null||d.init(i.getState());return}return d==null?void 0:d.init(Ug(l.name));case"ROLLBACK":return Gx(y.state,v=>{if(a===void 0){g(v),d==null||d.init(i.getState());return}g(v[a]),d==null||d.init(Ug(l.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return Gx(y.state,v=>{if(a===void 0){g(v);return}JSON.stringify(i.getState())!==JSON.stringify(v[a])&&g(v[a])});case"IMPORT_STATE":{const{nextLiftedState:v}=y.payload,b=(m=v.computedStates.slice(-1)[0])==null?void 0:m.state;if(!b)return;g(a===void 0?b:b[a]),d==null||d.send(null,v);return}case"PAUSE_RECORDING":return p=!p}return}}),_},En=Wne,Gx=(e,t)=>{let r;try{r=JSON.parse(e)}catch(n){console.error("[zustand devtools middleware] Could not parse the received json",n)}r!==void 0&&t(r)};function Vne(e,t){let r;try{r=e()}catch{return}return{getItem:i=>{var o;const s=l=>l===null?null:JSON.parse(l,void 0),a=(o=r.getItem(i))!=null?o:null;return a instanceof Promise?a.then(s):s(a)},setItem:(i,o)=>r.setItem(i,JSON.stringify(o,void 0)),removeItem:i=>r.removeItem(i)}}const _k=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return _k(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return _k(n)(r)}}}},Gne=(e,t)=>(r,n,i)=>{let o={storage:Vne(()=>window.localStorage),partialize:m=>m,version:0,merge:(m,v)=>({...v,...m}),...t},s=!1,a=0;const l=new Set,c=new Set;let d=o.storage;if(!d)return e((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...m)},n,i);const u=()=>{const m=o.partialize({...n()});return d.setItem(o.name,{state:m,version:o.version})},p=i.setState;i.setState=(m,v)=>(p(m,v),u());const g=e((...m)=>(r(...m),u()),n,i);i.getInitialState=()=>g;let _;const y=()=>{var m,v;if(!d)return;const b=++a;s=!1,l.forEach(E=>{var C;return E((C=n())!=null?C:g)});const x=((v=o.onRehydrateStorage)==null?void 0:v.call(o,(m=n())!=null?m:g))||void 0;return _k(d.getItem.bind(d))(o.name).then(E=>{if(E)if(typeof E.version=="number"&&E.version!==o.version){if(o.migrate){const C=o.migrate(E.state,E.version);return C instanceof Promise?C.then(k=>[!0,k]):[!0,C]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,E.state];return[!1,void 0]}).then(E=>{var C;if(b!==a)return;const[k,P]=E;if(_=o.merge(P,(C=n())!=null?C:g),r(_,!0),k)return u()}).then(()=>{b===a&&(x==null||x(_,void 0),_=n(),s=!0,c.forEach(E=>E(_)))}).catch(E=>{b===a&&(x==null||x(void 0,E))})};return i.persist={setOptions:m=>{o={...o,...m},m.storage&&(d=m.storage)},clearStorage:()=>{d==null||d.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>y(),hasHydrated:()=>s,onHydrate:m=>(l.add(m),()=>{l.delete(m)}),onFinishHydration:m=>(c.add(m),()=>{c.delete(m)})},o.skipHydration||y(),_||g},im=Gne,Na={WORKFLOW_TASK:"workflow-task",RECENT_SESSIONS:"recent-sessions"},Kne=[{i:Na.WORKFLOW_TASK,name:"Workflow & Tasks",visible:!0,minW:6,minH:4},{i:Na.RECENT_SESSIONS,name:"Recent Sessions",visible:!0,minW:6,minH:3}],Xne={lg:[{i:Na.WORKFLOW_TASK,x:0,y:0,w:12,h:5,minW:6,minH:4},{i:Na.RECENT_SESSIONS,x:0,y:5,w:12,h:4,minW:6,minH:3}],md:[{i:Na.WORKFLOW_TASK,x:0,y:0,w:6,h:5,minW:4,minH:4},{i:Na.RECENT_SESSIONS,x:0,y:5,w:6,h:4,minW:4,minH:3}],sm:[{i:Na.WORKFLOW_TASK,x:0,y:0,w:2,h:8,minW:2,minH:6},{i:Na.RECENT_SESSIONS,x:0,y:8,w:2,h:5,minW:2,minH:4}]},Kx={widgets:Kne,layouts:Xne},Zne=(e,t,r)=>{const n=e[t];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((i,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},oze={en:"English",zh:"中文"};function Qne(){if(typeof window>"u")return"zh";const e=navigator.language.toLowerCase();return e.startsWith("zh")?"zh":e.startsWith("en")?"en":"zh"}function Uv(){var e;if(typeof window>"u")return"zh";try{const t=localStorage.getItem("ccw-app-store");if(t){const r=JSON.parse(t);if((e=r.state)!=null&&e.locale&&(r.state.locale==="en"||r.state.locale==="zh"))return r.state.locale}}catch{}return Qne()}async function Yne(e){try{return(await Zne(Object.assign({"../locales/en/index.ts":()=>Lt(()=>import("./index-Bcq-7r6F.js"),[]),"../locales/zh/index.ts":()=>Lt(()=>import("./index-B6TpijCe.js"),[])}),`../locales/${e}/index.ts`,4)).default||{}}catch(t){return console.error(`Failed to load messages for locale "${e}":`,t),{}}}const iA={en:{},zh:{}};async function Jne(e){const t=await Yne(e);return iA[e]=t,xk(e),t}const Kz=KP();let Xz=ZP({locale:Uv(),messages:iA[Uv()]},Kz);function xk(e){Xz=ZP({locale:e,messages:iA[e]},Kz),typeof document<"u"&&(document.documentElement.lang=e)}function sze(e,t){return Xz.formatMessage({id:e},t)}const Zz=[{id:"blue",name:"经典蓝",accentColor:"#5b8fc4",description:"Classic professional blue tone"},{id:"green",name:"深邃绿",accentColor:"#10b981",description:"Deep natural green tone"},{id:"orange",name:"活力橙",accentColor:"#f97316",description:"Vibrant energetic orange tone"},{id:"purple",name:"优雅紫",accentColor:"#a855f7",description:"Elegant creative purple tone"}],Qz=[{id:"light",name:"浅色"},{id:"dark",name:"深色"}];function Yz(e,t){return`${t}-${e}`}function eie(e,t){const r=Zz.find(i=>i.id===e),n=Qz.find(i=>i.id===t);return!r||!n?"Unknown Theme":`${r.name} · ${n.name}`}Zz.flatMap(e=>Qz.map(t=>({id:Yz(e.id,t.id),scheme:e.id,mode:t.id,name:eie(e.id,t.id)})));const Jz={blur:0,darkenOpacity:0,saturation:100,enableFrostedGlass:!1,enableGrain:!1,enableVignette:!1},Go={mode:"gradient-only",imageUrl:null,attribution:null,effects:Jz},wk=3,tie={id:"default",name:"Default",colorScheme:"blue",customHue:null,isCustomTheme:!1,gradientLevel:"standard",enableHoverGlow:!0,enableBackgroundAnimation:!1,styleTier:"standard",isDefault:!0},rie={soft:{saturationScale:.6,lightnessOffset:{light:5,dark:-3},contrastBoost:.9},standard:{saturationScale:1,lightnessOffset:{light:0,dark:0},contrastBoost:1},"high-contrast":{saturationScale:1.3,lightnessOffset:{light:-5,dark:3},contrastBoost:1.2}};function nie(e){const r=e.trim().match(/^([\d.]+)\s+([\d.]+)%?\s+([\d.]+)%?$/);if(!r)return null;const n=parseFloat(r[1]),i=parseFloat(r[2]),o=parseFloat(r[3]);return isNaN(n)||isNaN(i)||isNaN(o)?null:{h:n,s:i,l:o}}function iie(e,t,r){const n=Math.max(0,Math.min(100,Math.round(t*10)/10)),i=Math.max(0,Math.min(100,Math.round(r*10)/10));return`${Math.round(e)} ${n}% ${i}%`}function IM(e,t,r){if(t==="standard")return e;const n=rie[t],i=r==="light"?n.lightnessOffset.light:n.lightnessOffset.dark,o={};for(const[s,a]of Object.entries(e)){const l=nie(a);if(!l){o[s]=a;continue}let c=l.s*n.saturationScale;c=Math.max(0,Math.min(100,c));let d=50+(l.l-50)*n.contrastBoost;d=d+i,d=Math.max(0,Math.min(100,d)),o[s]=iie(l.h,c,d)}return o}function oie(e,t){const r=(e%360+360)%360,n={};if(t==="light"){n["--bg"]=`${r} 5% 98%`,n["--bg-secondary"]=`${r} 8% 96%`,n["--surface"]=`${r} 10% 99%`,n["--surface-hover"]=`${r} 12% 97%`,n["--border"]=`${r} 15% 88%`,n["--border-hover"]=`${r} 18% 82%`,n["--text"]=`${r} 20% 15%`,n["--text-secondary"]=`${r} 10% 45%`,n["--text-tertiary"]=`${r} 8% 60%`,n["--text-disabled"]=`${r} 5% 70%`,n["--accent"]=`${r} 70% 60%`,n["--accent-hover"]=`${r} 75% 55%`,n["--accent-active"]=`${r} 80% 50%`,n["--accent-light"]=`${r} 65% 90%`,n["--accent-lighter"]=`${r} 60% 95%`,n["--primary"]=`${r} 70% 60%`,n["--primary-hover"]=`${r} 75% 55%`,n["--primary-light"]=`${r} 65% 90%`,n["--primary-lighter"]=`${r} 60% 95%`;const i=(r+180)%360;n["--secondary"]=`${i} 60% 65%`,n["--secondary-hover"]=`${i} 65% 60%`,n["--secondary-light"]=`${i} 55% 90%`,n["--muted"]=`${r} 12% 92%`,n["--muted-hover"]=`${r} 15% 88%`,n["--muted-text"]=`${r} 10% 45%`,n["--success"]="120 60% 50%",n["--success-light"]="120 55% 92%",n["--success-text"]="120 70% 35%",n["--warning"]="38 90% 55%",n["--warning-light"]="38 85% 92%",n["--warning-text"]="38 95% 40%",n["--error"]="0 70% 55%",n["--error-light"]="0 65% 92%",n["--error-text"]="0 75% 40%",n["--info"]="200 70% 55%",n["--info-light"]="200 65% 92%",n["--info-text"]="200 75% 40%",n["--destructive"]="0 70% 55%",n["--destructive-hover"]="0 75% 50%",n["--destructive-light"]="0 65% 92%",n["--hover"]=`${r} 12% 94%`,n["--active"]=`${r} 15% 90%`,n["--focus"]=`${r} 70% 60%`,n["--background"]=n["--bg"],n["--foreground"]=n["--text"],n["--card"]=n["--surface"],n["--card-foreground"]=n["--text"],n["--primary-foreground"]="0 0% 100%",n["--secondary-foreground"]="0 0% 100%",n["--accent-foreground"]="0 0% 100%",n["--destructive-foreground"]="0 0% 100%",n["--muted-foreground"]=n["--text-secondary"],n["--sidebar-background"]=`${r} 30% 97%`,n["--sidebar-foreground"]=n["--text"],n["--input"]=n["--border"],n["--ring"]=n["--accent"],n["--indigo"]="239 65% 60%",n["--indigo-light"]="239 65% 92%",n["--orange"]="25 90% 55%",n["--orange-light"]="25 90% 92%"}else{n["--bg"]=`${r} 20% 10%`,n["--bg-secondary"]=`${r} 18% 12%`,n["--surface"]=`${r} 15% 14%`,n["--surface-hover"]=`${r} 18% 16%`,n["--border"]=`${r} 10% 22%`,n["--border-hover"]=`${r} 12% 28%`,n["--text"]=`${r} 10% 90%`,n["--text-secondary"]=`${r} 8% 65%`,n["--text-tertiary"]=`${r} 6% 50%`,n["--text-disabled"]=`${r} 5% 40%`,n["--accent"]=`${r} 70% 60%`,n["--accent-hover"]=`${r} 75% 65%`,n["--accent-active"]=`${r} 80% 70%`,n["--accent-light"]=`${r} 60% 25%`,n["--accent-lighter"]=`${r} 55% 20%`,n["--primary"]=`${r} 70% 60%`,n["--primary-hover"]=`${r} 75% 65%`,n["--primary-light"]=`${r} 60% 25%`,n["--primary-lighter"]=`${r} 55% 20%`;const i=(r+180)%360;n["--secondary"]=`${i} 60% 65%`,n["--secondary-hover"]=`${i} 65% 70%`,n["--secondary-light"]=`${i} 55% 25%`,n["--muted"]=`${r} 15% 18%`,n["--muted-hover"]=`${r} 18% 22%`,n["--muted-text"]=`${r} 8% 65%`,n["--success"]="120 60% 55%",n["--success-light"]="120 50% 20%",n["--success-text"]="120 65% 65%",n["--warning"]="38 90% 60%",n["--warning-light"]="38 80% 22%",n["--warning-text"]="38 95% 70%",n["--error"]="0 70% 60%",n["--error-light"]="0 60% 20%",n["--error-text"]="0 75% 70%",n["--info"]="200 70% 60%",n["--info-light"]="200 60% 20%",n["--info-text"]="200 75% 70%",n["--destructive"]="0 70% 60%",n["--destructive-hover"]="0 75% 65%",n["--destructive-light"]="0 60% 20%",n["--hover"]=`${r} 18% 16%`,n["--active"]=`${r} 20% 20%`,n["--focus"]=`${r} 70% 60%`,n["--background"]=n["--bg"],n["--foreground"]=n["--text"],n["--card"]=n["--surface"],n["--card-foreground"]=n["--text"],n["--primary-foreground"]=`${r} 30% 10%`,n["--secondary-foreground"]="0 0% 100%",n["--accent-foreground"]=`${r} 30% 10%`,n["--destructive-foreground"]="0 0% 100%",n["--muted-foreground"]=n["--text-secondary"],n["--sidebar-background"]=`${r} 25% 12%`,n["--sidebar-foreground"]=n["--text"],n["--input"]=n["--border"],n["--ring"]=n["--accent"],n["--indigo"]="239 60% 55%",n["--indigo-light"]="239 40% 20%",n["--orange"]="25 85% 50%",n["--orange-light"]="25 50% 20%"}return n}const sie=[["--text","--bg",4.5],["--text","--surface",4.5],["--text-secondary","--bg",4.5],["--text-secondary","--surface",4.5],["--muted-text","--muted",4.5],["--muted-text","--bg",4.5],["--text-tertiary","--bg",3],["--text-disabled","--bg",3],["--accent","--bg",3],["--accent","--surface",3],["--success-text","--success-light",4.5],["--warning-text","--warning-light",4.5],["--error-text","--error-light",4.5],["--info-text","--info-light",4.5],["--primary-foreground","--primary",4.5],["--destructive-foreground","--destructive",4.5],["--text","--muted",4.5]];function Sk(e){const r=e.trim().match(/^([\d.]+)\s+([\d.]+)%?\s+([\d.]+)%?$/);if(!r)return null;const n=parseFloat(r[1]),i=parseFloat(r[2])/100,o=parseFloat(r[3])/100;return isNaN(n)||isNaN(i)||isNaN(o)?null:[n,i,o]}function aie(e,t,r){const n=(1-Math.abs(2*r-1))*t,i=e/60,o=n*(1-Math.abs(i%2-1)),s=r-n/2;let a,l,c;i<1?(a=n,l=o,c=0):i<2?(a=o,l=n,c=0):i<3?(a=0,l=n,c=o):i<4?(a=0,l=o,c=n):i<5?(a=o,l=0,c=n):(a=n,l=0,c=o);const d=a+s,u=l+s,p=c+s,g=_=>_<=.04045?_/12.92:Math.pow((_+.055)/1.055,2.4);return[g(d),g(u),g(p)]}function Wa(e){const t=Sk(e);if(!t)return-1;const[r,n,i]=t,[o,s,a]=aie(r,n,i);return Math.round((.2126*o+.7152*s+.0722*a)*1e4)/1e4}function Xh(e,t){const r=Math.max(e,t),n=Math.min(e,t);return Math.round((r+.05)/(n+.05)*100)/100}function RM(e){const t=[];for(const[r,n,i]of sie){const o=e[r],s=e[n];if(!o||!s)continue;const a=Wa(o),l=Wa(s);if(a<0||l<0)continue;const c=Xh(a,l),d=c>=i-.01;t.push({fgVar:r,bgVar:n,ratio:c,required:i,passed:d})}return t}function Hv(e,t,r){const n=Math.max(0,Math.min(100,Math.round(r*10)/10)),i=Math.max(0,Math.min(100,Math.round(t*10)/10));return`${Math.round(e)} ${i}% ${n}%`}function aze(e,t,r,n){const i=r[e],o=r[t];if(!i||!o)return[];const s=Sk(i),a=Sk(o);if(!s||!a)return[];const l=[],c=Wa(o),d=NM(s[0],s[1],s[2],c,n);for(const g of d){const _=Hv(s[0],s[1]*100,g*100),y=Wa(_);if(y<0)continue;const m=Xh(y,c);m>=n-.01&&l.push({target:"fg",original:i,suggested:_,resultRatio:m,distance:Math.abs(g-s[2])})}const u=Wa(i),p=NM(a[0],a[1],a[2],u,n);for(const g of p){const _=Hv(a[0],a[1]*100,g*100),y=Wa(_);if(y<0)continue;const m=Xh(u,y);m>=n-.01&&l.push({target:"bg",original:o,suggested:_,resultRatio:m,distance:Math.abs(g-a[2])})}return l.sort((g,_)=>g.distance-_.distance),l.slice(0,3)}function NM(e,t,r,n,i){const o=[];for(let a=r-.01;a>=0;a-=.01){const l=Hv(e,t*100,a*100),c=Wa(l);if(c<0)continue;if(Xh(c,n)>=i){o.push(a);break}}for(let a=r+.01;a<=1;a+=.01){const l=Hv(e,t*100,a*100),c=Wa(l);if(c<0)continue;if(Xh(c,n)>=i){o.push(a);break}}return o}function Ck(e){return e==="reduce"?!0:e==="enable"||typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const eU=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",rh=e=>e==="system"?eU():e,wo=(e,t)=>{const r=e.find(n=>n.id===t);return(r==null?void 0:r.styleTier)??"standard"},Dn=(e,t,r,n="standard",i=!0,o=!1,s="system",a="standard")=>{if(typeof document>"u")return;const l=()=>{document.documentElement.classList.remove("light","dark"),document.documentElement.classList.add(e);const d=["--bg","--bg-secondary","--surface","--surface-hover","--border","--border-hover","--text","--text-secondary","--text-tertiary","--text-disabled","--accent","--accent-hover","--accent-active","--accent-light","--accent-lighter","--primary","--primary-hover","--primary-light","--primary-lighter","--secondary","--secondary-hover","--secondary-light","--muted","--muted-hover","--muted-text","--success","--success-light","--success-text","--warning","--warning-light","--warning-text","--error","--error-light","--error-text","--info","--info-light","--info-text","--destructive","--destructive-hover","--destructive-light","--hover","--active","--focus","--background","--foreground","--card","--card-foreground","--primary-foreground","--secondary-foreground","--accent-foreground","--destructive-foreground","--muted-foreground","--sidebar-background","--sidebar-foreground","--input","--ring","--indigo","--indigo-light","--orange","--orange-light"];if(r!==null){let p=oie(r,e);if(a!=="standard"&&(p=IM(p,a,e)),Object.entries(p).forEach(([g,_])=>{document.documentElement.style.setProperty(g,_)}),document.documentElement.setAttribute("data-theme",`custom-${e}`),a!=="standard"){const _=RM(p).filter(y=>!y.passed);_.length>0&&console.warn('[Theme] Style tier "%s" caused %d WCAG AA contrast failures:',a,_.length,_.map(y=>`${y.fgVar}/${y.bgVar}: ${y.ratio}:1 (min ${y.required}:1)`))}}else{d.forEach(g=>{document.documentElement.style.removeProperty(g)});const p=Yz(t,e);if(document.documentElement.setAttribute("data-theme",p),a!=="standard"){const g=getComputedStyle(document.documentElement),_={};for(const b of d){const x=g.getPropertyValue(b).trim();x&&(_[b]=x)}const y=IM(_,a,e);Object.entries(y).forEach(([b,x])=>{document.documentElement.style.setProperty(b,x)});const v=RM(y).filter(b=>!b.passed);v.length>0&&console.warn('[Theme] Style tier "%s" on preset "%s" caused %d WCAG AA contrast failures:',a,t,v.length,v.map(b=>`${b.fgVar}/${b.bgVar}: ${b.ratio}:1 (min ${b.required}:1)`))}}document.documentElement.setAttribute("data-color-scheme",t),document.documentElement.setAttribute("data-gradient",n),document.documentElement.setAttribute("data-hover-glow",String(i)),document.documentElement.setAttribute("data-bg-animation",String(o));const u=Ck(s);document.documentElement.setAttribute("data-reduced-motion",String(u)),document.documentElement.setAttribute("data-style-tier",a)};!Ck(s)&&typeof document<"u"&&"startViewTransition"in document?document.startViewTransition(l):l()},wu=e=>{if(typeof document>"u")return;const t=document.documentElement;t.setAttribute("data-bg-mode",e.mode),t.setAttribute("data-bg-blur",String(e.effects.blur)),t.setAttribute("data-bg-darken",String(e.effects.darkenOpacity)),t.setAttribute("data-bg-saturation",String(e.effects.saturation)),t.setAttribute("data-bg-frosted",String(e.effects.enableFrostedGlass)),t.setAttribute("data-bg-grain",String(e.effects.enableGrain)),t.setAttribute("data-bg-vignette",String(e.effects.enableVignette))},lie={theme:"system",resolvedTheme:"light",colorScheme:"blue",customHue:null,isCustomTheme:!1,gradientLevel:"standard",enableHoverGlow:!0,enableBackgroundAnimation:!1,motionPreference:"system",locale:Uv(),sidebarOpen:!0,sidebarCollapsed:!1,expandedNavGroups:["overview","workflow","knowledge","issues","tools","configuration"],currentView:"sessions",currentFilter:"all",currentLiteType:null,currentSessionDetailKey:null,isLoading:!1,loadingMessage:null,error:null,dashboardLayout:null,themeSlots:[tie],activeSlotId:"default",deletedSlotBuffer:null,isImmersiveMode:!1},_t=gn()(En(im((e,t)=>({...lie,setTheme:r=>{const n=rh(r);e({theme:r,resolvedTheme:n},!1,"setTheme");const i=t(),o=wo(i.themeSlots,i.activeSlotId);Dn(n,i.colorScheme,i.customHue,i.gradientLevel,i.enableHoverGlow,i.enableBackgroundAnimation,i.motionPreference,o)},setColorScheme:r=>{e(o=>({colorScheme:r,customHue:null,isCustomTheme:!1,themeSlots:o.themeSlots.map(s=>s.id===o.activeSlotId?{...s,colorScheme:r,customHue:null,isCustomTheme:!1}:s)}),!1,"setColorScheme");const n=t(),i=wo(n.themeSlots,n.activeSlotId);Dn(n.resolvedTheme,r,null,n.gradientLevel,n.enableHoverGlow,n.enableBackgroundAnimation,n.motionPreference,i)},setCustomHue:r=>{if(r===null){const o=t(),s=wo(o.themeSlots,o.activeSlotId);e(a=>({customHue:null,isCustomTheme:!1,themeSlots:a.themeSlots.map(l=>l.id===a.activeSlotId?{...l,customHue:null,isCustomTheme:!1}:l)}),!1,"setCustomHue"),Dn(o.resolvedTheme,o.colorScheme,null,o.gradientLevel,o.enableHoverGlow,o.enableBackgroundAnimation,o.motionPreference,s);return}e(o=>({customHue:r,isCustomTheme:!0,themeSlots:o.themeSlots.map(s=>s.id===o.activeSlotId?{...s,customHue:r,isCustomTheme:!0}:s)}),!1,"setCustomHue");const n=t(),i=wo(n.themeSlots,n.activeSlotId);Dn(n.resolvedTheme,n.colorScheme,r,n.gradientLevel,n.enableHoverGlow,n.enableBackgroundAnimation,n.motionPreference,i)},toggleTheme:()=>{const{theme:r}=t(),n=r==="dark"?"light":"dark";t().setTheme(n)},setGradientLevel:r=>{e(o=>({gradientLevel:r,themeSlots:o.themeSlots.map(s=>s.id===o.activeSlotId?{...s,gradientLevel:r}:s)}),!1,"setGradientLevel");const n=t(),i=wo(n.themeSlots,n.activeSlotId);Dn(n.resolvedTheme,n.colorScheme,n.customHue,r,n.enableHoverGlow,n.enableBackgroundAnimation,n.motionPreference,i)},setEnableHoverGlow:r=>{e(o=>({enableHoverGlow:r,themeSlots:o.themeSlots.map(s=>s.id===o.activeSlotId?{...s,enableHoverGlow:r}:s)}),!1,"setEnableHoverGlow");const n=t(),i=wo(n.themeSlots,n.activeSlotId);Dn(n.resolvedTheme,n.colorScheme,n.customHue,n.gradientLevel,r,n.enableBackgroundAnimation,n.motionPreference,i)},setEnableBackgroundAnimation:r=>{e(o=>({enableBackgroundAnimation:r,themeSlots:o.themeSlots.map(s=>s.id===o.activeSlotId?{...s,enableBackgroundAnimation:r}:s)}),!1,"setEnableBackgroundAnimation");const n=t(),i=wo(n.themeSlots,n.activeSlotId);Dn(n.resolvedTheme,n.colorScheme,n.customHue,n.gradientLevel,n.enableHoverGlow,r,n.motionPreference,i)},setMotionPreference:r=>{e({motionPreference:r},!1,"setMotionPreference");const n=t(),i=wo(n.themeSlots,n.activeSlotId);Dn(n.resolvedTheme,n.colorScheme,n.customHue,n.gradientLevel,n.enableHoverGlow,n.enableBackgroundAnimation,r,i)},setStyleTier:r=>{e(i=>({themeSlots:i.themeSlots.map(o=>o.id===i.activeSlotId?{...o,styleTier:r}:o)}),!1,"setStyleTier");const n=t();Dn(n.resolvedTheme,n.colorScheme,n.customHue,n.gradientLevel,n.enableHoverGlow,n.enableBackgroundAnimation,n.motionPreference,r)},setLocale:r=>{e({locale:r},!1,"setLocale"),xk(r)},setSidebarOpen:r=>{e({sidebarOpen:r},!1,"setSidebarOpen")},toggleSidebar:()=>{e(r=>({sidebarOpen:!r.sidebarOpen}),!1,"toggleSidebar")},setSidebarCollapsed:r=>{e({sidebarCollapsed:r},!1,"setSidebarCollapsed")},setExpandedNavGroups:r=>{e({expandedNavGroups:r},!1,"setExpandedNavGroups")},setCurrentView:r=>{e({currentView:r},!1,"setCurrentView")},setCurrentFilter:r=>{e({currentFilter:r},!1,"setCurrentFilter")},setCurrentLiteType:r=>{e({currentLiteType:r},!1,"setCurrentLiteType")},setCurrentSessionDetailKey:r=>{e({currentSessionDetailKey:r},!1,"setCurrentSessionDetailKey")},setLoading:(r,n=null)=>{e({isLoading:r,loadingMessage:n},!1,"setLoading")},setError:r=>{e({error:r},!1,"setError")},clearError:()=>{e({error:null},!1,"clearError")},setDashboardLayouts:r=>{e(n=>{var i;return{dashboardLayout:{widgets:((i=n.dashboardLayout)==null?void 0:i.widgets)||Kx.widgets,layouts:r}}},!1,"setDashboardLayouts")},setDashboardWidgets:r=>{e(n=>{var i;return{dashboardLayout:{widgets:r,layouts:((i=n.dashboardLayout)==null?void 0:i.layouts)||Kx.layouts}}},!1,"setDashboardWidgets")},resetDashboardLayout:()=>{e({dashboardLayout:Kx},!1,"resetDashboardLayout")},setActiveSlot:r=>{const{themeSlots:n,motionPreference:i}=t(),o=n.find(a=>a.id===r);if(!o)return;const s=rh(t().theme);e({activeSlotId:r,colorScheme:o.colorScheme,customHue:o.customHue,isCustomTheme:o.isCustomTheme,gradientLevel:o.gradientLevel,enableHoverGlow:o.enableHoverGlow,enableBackgroundAnimation:o.enableBackgroundAnimation},!1,"setActiveSlot"),Dn(s,o.colorScheme,o.customHue,o.gradientLevel,o.enableHoverGlow,o.enableBackgroundAnimation,i,o.styleTier),wu(o.backgroundConfig??Go)},copySlot:()=>{const r=t();if(r.themeSlots.length>=wk)return;const n=new Set(r.themeSlots.map(l=>l.id)),o=["custom-1","custom-2"].find(l=>!n.has(l));if(!o)return;const s=r.themeSlots.find(l=>l.id===r.activeSlotId);if(!s)return;const a={id:o,name:`Copy of ${s.name}`,colorScheme:r.colorScheme,customHue:r.customHue,isCustomTheme:r.isCustomTheme,gradientLevel:r.gradientLevel,enableHoverGlow:r.enableHoverGlow,enableBackgroundAnimation:r.enableBackgroundAnimation,styleTier:s.styleTier,isDefault:!1,backgroundConfig:s.backgroundConfig};e({themeSlots:[...r.themeSlots,a],activeSlotId:o},!1,"copySlot")},renameSlot:(r,n)=>{e(i=>({themeSlots:i.themeSlots.map(o=>o.id===r?{...o,name:n}:o)}),!1,"renameSlot")},deleteSlot:r=>{const n=t(),i=n.themeSlots.find(s=>s.id===r);if(!i||i.isDefault)return;e({themeSlots:n.themeSlots.filter(s=>s.id!==r),deletedSlotBuffer:i,activeSlotId:"default"},!1,"deleteSlot");const o=n.themeSlots.find(s=>s.id==="default");if(o){const s=rh(n.theme);e({colorScheme:o.colorScheme,customHue:o.customHue,isCustomTheme:o.isCustomTheme,gradientLevel:o.gradientLevel,enableHoverGlow:o.enableHoverGlow,enableBackgroundAnimation:o.enableBackgroundAnimation},!1,"deleteSlot/applyDefault"),Dn(s,o.colorScheme,o.customHue,o.gradientLevel,o.enableHoverGlow,o.enableBackgroundAnimation,n.motionPreference,o.styleTier),wu(o.backgroundConfig??Go)}setTimeout(()=>{var a;((a=_t.getState().deletedSlotBuffer)==null?void 0:a.id)===r&&_t.setState({deletedSlotBuffer:null},!1)},1e4)},undoDeleteSlot:()=>{const r=t(),n=r.deletedSlotBuffer;if(!n||r.themeSlots.length>=wk)return;e({themeSlots:[...r.themeSlots,n],deletedSlotBuffer:null,activeSlotId:n.id},!1,"undoDeleteSlot");const i=rh(r.theme);e({colorScheme:n.colorScheme,customHue:n.customHue,isCustomTheme:n.isCustomTheme,gradientLevel:n.gradientLevel,enableHoverGlow:n.enableHoverGlow,enableBackgroundAnimation:n.enableBackgroundAnimation},!1,"undoDeleteSlot/apply"),Dn(i,n.colorScheme,n.customHue,n.gradientLevel,n.enableHoverGlow,n.enableBackgroundAnimation,r.motionPreference,n.styleTier),wu(n.backgroundConfig??Go)},setBackgroundConfig:r=>{e(n=>({themeSlots:n.themeSlots.map(i=>i.id===n.activeSlotId?{...i,backgroundConfig:r}:i)}),!1,"setBackgroundConfig"),wu(r)},updateBackgroundEffect:(r,n)=>{const i=t(),o=i.themeSlots.find(l=>l.id===i.activeSlotId),s=(o==null?void 0:o.backgroundConfig)??Go,a={...s,effects:{...s.effects,[r]:n}};t().setBackgroundConfig(a)},setBackgroundMode:r=>{const n=t(),i=n.themeSlots.find(a=>a.id===n.activeSlotId),s={...(i==null?void 0:i.backgroundConfig)??Go,mode:r};t().setBackgroundConfig(s)},setBackgroundImage:(r,n)=>{const i=t(),o=i.themeSlots.find(l=>l.id===i.activeSlotId),s=(o==null?void 0:o.backgroundConfig)??Go,a={...s,imageUrl:r,attribution:n};r&&s.mode==="gradient-only"&&(a.mode="image-gradient"),!r&&s.mode!=="gradient-only"&&(a.mode="gradient-only"),t().setBackgroundConfig(a)},setImmersiveMode:r=>{e({isImmersiveMode:r},!1,"setImmersiveMode")},toggleImmersiveMode:()=>{e(r=>({isImmersiveMode:!r.isImmersiveMode}),!1,"toggleImmersiveMode")}}),{name:"ccw-app-store",partialize:e=>({theme:e.theme,colorScheme:e.colorScheme,customHue:e.customHue,gradientLevel:e.gradientLevel,enableHoverGlow:e.enableHoverGlow,enableBackgroundAnimation:e.enableBackgroundAnimation,motionPreference:e.motionPreference,locale:e.locale,sidebarCollapsed:e.sidebarCollapsed,expandedNavGroups:e.expandedNavGroups,dashboardLayout:e.dashboardLayout,themeSlots:e.themeSlots,activeSlotId:e.activeSlotId}),onRehydrateStorage:()=>e=>{if(e){if(!e.themeSlots||!Array.isArray(e.themeSlots)||e.themeSlots.length===0){const i={id:"default",name:"Default",colorScheme:e.colorScheme??"blue",customHue:e.customHue??null,isCustomTheme:(e.customHue??null)!==null,gradientLevel:e.gradientLevel??"standard",enableHoverGlow:e.enableHoverGlow??!0,enableBackgroundAnimation:e.enableBackgroundAnimation??!1,styleTier:"standard",isDefault:!0};e.themeSlots=[i],e.activeSlotId="default"}(!e.activeSlotId||!e.themeSlots.find(i=>i.id===e.activeSlotId))&&(e.activeSlotId="default");const t=rh(e.theme);e.resolvedTheme=t,e.isCustomTheme=e.customHue!==null;const r=wo(e.themeSlots,e.activeSlotId);Dn(t,e.colorScheme,e.customHue,e.gradientLevel??"standard",e.enableHoverGlow??!0,e.enableBackgroundAnimation??!1,e.motionPreference??"system",r);const n=e.themeSlots.find(i=>i.id===e.activeSlotId);wu((n==null?void 0:n.backgroundConfig)??Go)}e&&xk(e.locale)}}),{name:"AppStore"}));if(typeof window<"u"){window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{const i=_t.getState();if(i.theme==="system"){const o=eU();_t.setState({resolvedTheme:o});const s=wo(i.themeSlots,i.activeSlotId);Dn(o,i.colorScheme,i.customHue,i.gradientLevel,i.enableHoverGlow,i.enableBackgroundAnimation,i.motionPreference,s)}});const t=_t.getState(),r=wo(t.themeSlots,t.activeSlotId);Dn(t.resolvedTheme,t.colorScheme,t.customHue,t.gradientLevel,t.enableHoverGlow,t.enableBackgroundAnimation,t.motionPreference,r);const n=t.themeSlots.find(i=>i.id===t.activeSlotId);wu((n==null?void 0:n.backgroundConfig)??Go)}const cie=e=>e.theme,uie=e=>e.resolvedTheme,die=e=>e.customHue,fie=e=>e.isCustomTheme,hie=e=>e.gradientLevel,pie=e=>e.enableHoverGlow,mie=e=>e.enableBackgroundAnimation,gie=e=>e.motionPreference,lze=e=>e.locale,vie=e=>e.themeSlots,yie=e=>e.activeSlotId,bie=e=>e.deletedSlotBuffer,_ie=e=>e.isImmersiveMode,Ek=2,xie=800,wie=/^ccw(\d+):(.+)$/,Sie=["blue","green","orange","purple"],Cie=["soft","standard","high-contrast"],Eie=["off","standard","enhanced"],kie=["gradient-only","image-only","image-gradient"];function MM(e){const t={v:Ek,c:e.colorScheme,h:e.customHue,t:e.styleTier,g:e.gradientLevel,w:e.enableHoverGlow,a:e.enableBackgroundAnimation},r=e.backgroundConfig;r&&r.mode!=="gradient-only"&&(t.bm=r.mode,r.imageUrl&&(t.bi=r.imageUrl),r.attribution&&(t.bp=r.attribution.photographerName,t.bu=r.attribution.photographerUrl,t.bpu=r.attribution.photoUrl),t.be={b:r.effects.blur,d:r.effects.darkenOpacity,s:r.effects.saturation,f:r.effects.enableFrostedGlass,g:r.effects.enableGrain,v:r.effects.enableVignette});const n=JSON.stringify(t),o=new TextEncoder().encode(n);let s="";for(let c=0;c<o.length;c++)s+=String.fromCharCode(o[c]);const l=btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`ccw${Ek}:${l}`}function Tie(e){if(!e||typeof e!="string")return{ok:!1,error:"empty_input"};const t=e.trim();if(t.length>xie)return{ok:!1,error:"too_long"};const r=t.match(wie);if(!r)return{ok:!1,error:"invalid_format"};const n=parseInt(r[1],10);let o=r[2].replace(/-/g,"+").replace(/_/g,"/");const s=o.length%4;s===2?o+="==":s===3&&(o+="=");let a;try{const g=atob(o),_=new Uint8Array(g.length);for(let m=0;m<g.length;m++)_[m]=g.charCodeAt(m);a=new TextDecoder().decode(_)}catch{return{ok:!1,error:"decode_failed"}}let l;try{l=JSON.parse(a)}catch{return{ok:!1,error:"parse_failed"}}if(!l||typeof l!="object"||Array.isArray(l))return{ok:!1,error:"invalid_payload"};const c=l,d=typeof c.v=="number"?c.v:n,u=Pie(d);if(!u.compatible)return{ok:!1,error:"incompatible_version"};if(typeof c.c!="string"||!Sie.includes(c.c))return{ok:!1,error:"invalid_field"};if(c.h!==null&&(typeof c.h!="number"||!isFinite(c.h)))return{ok:!1,error:"invalid_field"};if(typeof c.t!="string"||!Cie.includes(c.t))return{ok:!1,error:"invalid_field"};if(typeof c.g!="string"||!Eie.includes(c.g))return{ok:!1,error:"invalid_field"};if(typeof c.w!="boolean"||typeof c.a!="boolean")return{ok:!1,error:"invalid_field"};const p={version:d,colorScheme:c.c,customHue:c.h,styleTier:c.t,gradientLevel:c.g,enableHoverGlow:c.w,enableBackgroundAnimation:c.a};if(typeof c.bm=="string"&&kie.includes(c.bm)){const g={...Jz};if(c.be&&typeof c.be=="object"&&!Array.isArray(c.be)){const _=c.be;typeof _.b=="number"&&(g.blur=_.b),typeof _.d=="number"&&(g.darkenOpacity=_.d),typeof _.s=="number"&&(g.saturation=_.s),typeof _.f=="boolean"&&(g.enableFrostedGlass=_.f),typeof _.g=="boolean"&&(g.enableGrain=_.g),typeof _.v=="boolean"&&(g.enableVignette=_.v)}p.backgroundConfig={mode:c.bm,imageUrl:typeof c.bi=="string"?c.bi:null,attribution:typeof c.bp=="string"&&typeof c.bu=="string"&&typeof c.bpu=="string"?{photographerName:c.bp,photographerUrl:c.bu,photoUrl:c.bpu}:null,effects:g}}return{ok:!0,payload:p,warning:u.warning}}function Pie(e){const t=Math.abs(e-Ek);return t>2?{compatible:!1}:t>0?{compatible:!0,warning:"version_mismatch"}:{compatible:!0}}function Aie(){const e=_t(cie),t=_t(uie),r=_t(xe=>xe.colorScheme),n=_t(die),i=_t(fie),o=_t(hie),s=_t(pie),a=_t(mie),l=_t(gie),c=_t(xe=>xe.setTheme),d=_t(xe=>xe.setColorScheme),u=_t(xe=>xe.setCustomHue),p=_t(xe=>xe.toggleTheme),g=_t(xe=>xe.setGradientLevel),_=_t(xe=>xe.setEnableHoverGlow),y=_t(xe=>xe.setEnableBackgroundAnimation),m=_t(xe=>xe.setMotionPreference),v=_t(xe=>xe.setStyleTier),b=_t(vie),x=_t(yie),E=_t(bie),C=_t(xe=>xe.setBackgroundConfig),k=_t(xe=>xe.updateBackgroundEffect),P=_t(xe=>xe.setBackgroundMode),T=_t(xe=>xe.setBackgroundImage),I=_t(xe=>xe.setActiveSlot),N=_t(xe=>xe.copySlot),B=_t(xe=>xe.renameSlot),M=_t(xe=>xe.deleteSlot),F=_t(xe=>xe.undoDeleteSlot),U=O.useCallback(xe=>{c(xe)},[c]),q=O.useCallback(xe=>{d(xe)},[d]),V=O.useCallback(xe=>{u(xe)},[u]),K=O.useCallback(()=>{p()},[p]),D=O.useCallback(xe=>{g(xe)},[g]),$=O.useCallback(xe=>{_(xe)},[_]),j=O.useCallback(xe=>{y(xe)},[y]),z=O.useCallback(xe=>{m(xe)},[m]),X=O.useCallback(xe=>{v(xe)},[v]),W=Ck(l),le=O.useMemo(()=>b.find(xe=>xe.id===x),[b,x]),ce=b.length<wk,ve=(le==null?void 0:le.styleTier)??"standard",H=(le==null?void 0:le.backgroundConfig)??Go,Q=O.useCallback(xe=>{I(xe)},[I]),Y=O.useCallback(()=>{N()},[N]),re=O.useCallback((xe,et)=>{B(xe,et)},[B]),ge=O.useCallback(xe=>{M(xe)},[M]),ee=O.useCallback(()=>{F()},[F]),Ie=O.useCallback(()=>MM(le||{colorScheme:r,customHue:n,gradientLevel:o,enableHoverGlow:s,enableBackgroundAnimation:a,styleTier:ve}),[le,x,r,n,i,o,s,a,ve]),Re=O.useCallback(xe=>Tie(xe),[]);return{theme:e,resolvedTheme:t,isDark:t==="dark",colorScheme:r,customHue:n,isCustomTheme:i,gradientLevel:o,enableHoverGlow:s,enableBackgroundAnimation:a,motionPreference:l,resolvedMotion:W,setTheme:U,setColorScheme:q,setCustomHue:V,toggleTheme:K,setGradientLevel:D,setEnableHoverGlow:$,setEnableBackgroundAnimation:j,setMotionPreference:z,styleTier:ve,setStyleTier:X,themeSlots:b,activeSlotId:x,activeSlot:le,deletedSlotBuffer:E,canAddSlot:ce,setActiveSlot:Q,copySlot:Y,renameSlot:re,deleteSlot:ge,undoDeleteSlot:ee,exportThemeCode:Ie,importThemeCode:Re,backgroundConfig:H,setBackgroundConfig:C,updateBackgroundEffect:k,setBackgroundMode:P,setBackgroundImage:T}}const tU=5;let Ih=[];function Oie(){return Ih.shift()}function Tv(e){e&&(Ih.includes(e)||Ih.length>=tU||Ih.push(e))}let nh=null;async function rU(){return nh||(nh=(async()=>{try{const e=await fetch("/api/csrf-token",{credentials:"same-origin"});if(!e.ok)throw new Error("Failed to fetch CSRF token");const r=(await e.json()).csrfToken;if(!r)throw new Error("No CSRF token in response");return r}finally{nh=null}})(),nh)}function Iie(e){const t=e.headers.get("X-CSRF-Token");t&&Tv(t)}async function nU(){try{const e=await fetch(`/api/csrf-token?count=${tU}`,{credentials:"same-origin"});if(!e.ok)throw new Error("Failed to initialize CSRF token pool");const t=await e.json();if(t.tokens&&Array.isArray(t.tokens))for(const r of t.tokens)Tv(r);else t.csrfToken&&Tv(t.csrfToken);console.log(`[CSRF] Token pool initialized with ${Ih.length} tokens`)}catch(e){console.error("[CSRF] Failed to initialize CSRF token pool:",e);try{const t=await rU();Tv(t)}catch(t){console.error("[CSRF] Fallback token fetch failed:",t)}}}async function oe(e,t={}){const r=new Headers(t.headers);if(t.method&&["POST","PUT","PATCH","DELETE"].includes(t.method)){let i=Oie();if(!i){console.warn("[CSRF] Token pool depleted, fetching synchronously");try{i=await rU()}catch{throw new Error("Failed to acquire CSRF token for request")}}i&&r.set("X-CSRF-Token",i)}t.body&&typeof t.body=="string"&&r.set("Content-Type","application/json");const n=await fetch(e,{...t,headers:r,credentials:"same-origin"});if(Iie(n),!n.ok){const i={message:n.statusText||"Request failed",status:n.status},o=n.headers.get("content-type");if(o&&o.includes("application/json"))try{const s=await n.json();s.message?i.message=s.message:s.error&&(i.message=s.error),s.code&&(i.code=s.code)}catch{}throw i}if(n.status!==204)try{return await n.json()}catch(i){const o=i instanceof Error?i.message:"Unknown error";throw new Error(`Failed to parse JSON response: ${o}`)}}function Rie(e){const t=e.toLowerCase();return t.includes("-review-")||t.includes("-code-review-")?"review":t.includes("-tdd-")||t.includes("-test-driven-")?"tdd":t.includes("-test-")||t.includes("-testing-")?"test":t.includes("-docs-")||t.includes("-doc-")||t.includes("-documentation-")?"docs":t.includes("-lite-plan-")?"lite-plan":t.includes("-lite-fix-")||t.includes("-fix-")?"lite-fix":"workflow"}function jM(e,t){const n={active:"in_progress",completed:"completed",archived:"archived",planning:"planning",paused:"paused"}[e.status]||e.status;let i=e.project||e.session_id,o;if(e.project&&e.project.includes(":")){const c=e.project.split(":");i=c[0].trim(),o=c.slice(1).join(":").trim()}let s=e.type||Rie(e.session_id);const a=e;let l;if(a.hasReview){s!=="review"&&(s="review");const c=a.reviewDimensions||[],d=c.reduce((u,p)=>{var g;return u+(((g=p.findings)==null?void 0:g.length)||0)},0);l={dimensions:c.map(u=>({name:u.name,findings:u.findings||[]})),dimensions_count:c.length,findings:d,iterations:void 0,fixes:void 0}}return{session_id:e.session_id,type:s,title:i,description:o,status:n,created_at:e.created_at,updated_at:e.updated_at,location:t,path:e.path,has_plan:e.has_plan,plan_updated_at:e.plan_updated_at,has_review:a.hasReview,review:l,summaries:e.summaries,tasks:(e.tasks||[]).map(c=>IU(c))}}async function iU(e){var t,r,n,i,o,s,a,l;try{const c=e?`/api/data?path=${encodeURIComponent(e)}`:"/api/data",d=await oe(c);return d?{totalSessions:((t=d.statistics)==null?void 0:t.totalSessions)??0,activeSessions:((r=d.statistics)==null?void 0:r.activeSessions)??0,archivedSessions:((n=d.statistics)==null?void 0:n.archivedSessions)??0,totalTasks:((i=d.statistics)==null?void 0:i.totalTasks)??0,completedTasks:((o=d.statistics)==null?void 0:o.completedTasks)??0,pendingTasks:((s=d.statistics)==null?void 0:s.pendingTasks)??0,failedTasks:((a=d.statistics)==null?void 0:a.failedTasks)??0,todayActivity:((l=d.statistics)==null?void 0:l.todayActivity)??0}:(console.warn("[API] No data received from /api/data for dashboard stats"),DM())}catch(c){return console.error("[API] Failed to fetch dashboard stats:",c),DM()}}function DM(){return{totalSessions:0,activeSessions:0,archivedSessions:0,totalTasks:0,completedTasks:0,pendingTasks:0,failedTasks:0,todayActivity:0}}async function oA(e){try{const t=e?`/api/data?path=${encodeURIComponent(e)}`:"/api/data",r=await oe(t);if(!r)return console.warn("[API] No data received from /api/data for sessions"),{activeSessions:[],archivedSessions:[]};const n=(r.activeSessions??[]).map(o=>{try{return jM(o,"active")}catch(s){return console.error("[API] Failed to transform active session:",o,s),{session_id:o.session_id,title:o.project||o.session_id,status:"in_progress",created_at:o.created_at,location:"active"}}}),i=(r.archivedSessions??[]).map(o=>{try{return jM(o,"archived")}catch(s){return console.error("[API] Failed to transform archived session:",o,s),{session_id:o.session_id,title:o.project||o.session_id,status:o.status==="active"?"in_progress":o.status,created_at:o.created_at,location:"archived"}}});return{activeSessions:n,archivedSessions:i}}catch(t){return console.error("[API] Failed to fetch sessions:",t),{activeSessions:[],archivedSessions:[]}}}async function oU(e){return oe(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"POST"})}async function sU(e){return oe(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}async function aU(){return(await oe("/api/recent-paths")).paths??[]}async function lU(e){return(await oe("/api/remove-recent-path",{method:"POST",body:JSON.stringify({path:e})})).paths}async function cU(e){return oe(`/api/switch-path?path=${encodeURIComponent(e)}`)}async function uU(e){const t=e?`/api/issues?path=${encodeURIComponent(e)}`:"/api/issues";return{issues:(await oe(t)).issues??[]}}async function dU(e){const t=e?`/api/issues/history?path=${encodeURIComponent(e)}`:"/api/issues/history";return{issues:(await oe(t)).issues??[]}}async function fU(e){const t=e?`/api/queue?path=${encodeURIComponent(e)}`:"/api/queue";return oe(t)}async function hU(e){return oe("/api/issues",{method:"POST",body:JSON.stringify(e)})}async function pU(e,t){return oe(`/api/issues/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}async function mU(e){return oe(`/api/issues/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Nie(e,t){const r=new FormData;t.forEach(i=>{r.append("files",i)});const n=await fetch(`/api/issues/${encodeURIComponent(e)}/attachments`,{method:"POST",body:r,credentials:"same-origin"});if(!n.ok){const i=await n.json().catch(()=>({error:"Upload failed"}));throw new Error(i.error||"Failed to upload attachments")}return n.json()}async function Mie(e={}){const t=new URLSearchParams;e.state&&t.set("state",e.state),e.limit&&t.set("limit",String(e.limit)),e.labels&&t.set("labels",e.labels),e.downloadImages&&t.set("downloadImages","true");const r=`/api/issues/pull${t.toString()?"?"+t.toString():""}`;return oe(r,{method:"POST"})}async function gU(e){return oe(`/api/queue/history?path=${encodeURIComponent(e)}`)}async function vU(e,t){return oe(`/api/queue/${encodeURIComponent(e)}?path=${encodeURIComponent(t)}`)}async function yU(e,t){return oe(`/api/queue/activate?path=${encodeURIComponent(t)}`,{method:"POST",body:JSON.stringify({queueId:e})})}async function bU(e){return oe(`/api/queue/deactivate?path=${encodeURIComponent(e)}`,{method:"POST"})}async function _U(e,t){return oe(`/api/queue/reorder?path=${encodeURIComponent(e)}`,{method:"POST",body:JSON.stringify(t)})}async function xU(e,t){return oe(`/api/queue/move?path=${encodeURIComponent(e)}`,{method:"POST",body:JSON.stringify(t)})}async function wU(e,t){return oe(`/api/queue/${encodeURIComponent(e)}?path=${encodeURIComponent(t)}`,{method:"DELETE"})}async function SU(e,t,r){return oe(`/api/queue/merge?path=${encodeURIComponent(r)}`,{method:"POST",body:JSON.stringify({sourceQueueId:e,targetQueueId:t})})}async function CU(e,t,r){return oe(`/api/queue/split?path=${encodeURIComponent(r)}`,{method:"POST",body:JSON.stringify({sourceQueueId:e,itemIds:t})})}async function EU(e){const t=e?`/api/discoveries?path=${encodeURIComponent(e)}`:"/api/discoveries",r=await oe(t);return(r.discoveries??r.sessions??[]).map(i=>{var a,l;let o="running";i.phase==="complete"||i.phase==="completed"?o="completed":i.phase==="failed"&&(o="failed");const s=((l=(a=i.progress)==null?void 0:a.perspective_analysis)==null?void 0:l.percent_complete)??0;return{id:i.discovery_id||i.id,name:i.target_pattern||i.discovery_id||i.name||"Discovery",status:o,progress:s,findings_count:i.total_findings??i.findings_count??0,created_at:i.created_at,completed_at:i.completed_at}})}async function kU(e,t){const r=t?`/api/discoveries/${encodeURIComponent(e)}/findings?path=${encodeURIComponent(t)}`:`/api/discoveries/${encodeURIComponent(e)}/findings`;return((await oe(r)).findings??[]).map(i=>({...i,severity:i.severity||i.priority||"medium"}))}async function TU(e,{findingIds:t,exportAll:r},n){const i=n?`/api/discoveries/${encodeURIComponent(e)}/export?path=${encodeURIComponent(n)}`:`/api/discoveries/${encodeURIComponent(e)}/export`;return oe(i,{method:"POST",body:JSON.stringify({finding_ids:t,export_all:r})})}async function jie(e,t="claude"){const r=(a,l)=>a.map(c=>({...c,location:l,enabled:!0})),n=(a,l)=>a.map(c=>({...c,location:l,enabled:!1})),i=a=>{const l=r(a.projectSkills??[],"project"),c=r(a.userSkills??[],"user"),d=n(a.disabledProjectSkills??[],"project"),u=n(a.disabledUserSkills??[],"user");return[...l,...c,...d,...u]},o=t==="codex"?"&cliType=codex":"";if(e)try{const a=`/api/skills?path=${encodeURIComponent(e)}&includeDisabled=true${o}`,l=await oe(a);return{skills:i(l)}}catch(a){const l=a;if(l.status===403||l.status===404)console.warn("[fetchSkills] 403/404 for project path, falling back to global skills");else throw a}const s=await oe(`/api/skills?includeDisabled=true${o}`);return{skills:i(s)}}async function Die(e,t,r,n="claude"){return oe(`/api/skills/${encodeURIComponent(e)}/enable`,{method:"POST",body:JSON.stringify({location:t,projectPath:r,cliType:n})})}async function Lie(e,t,r,n="claude"){return oe(`/api/skills/${encodeURIComponent(e)}/disable`,{method:"POST",body:JSON.stringify({location:t,projectPath:r,cliType:n})})}async function $ie(e,t,r,n="claude"){const i=n==="codex"?"&cliType=codex":"",o=r?`/api/skills/${encodeURIComponent(e)}?location=${t}&path=${encodeURIComponent(r)}${i}`:`/api/skills/${encodeURIComponent(e)}?location=${t}${i}`;return oe(o)}async function Bie(e,t,r,n="claude"){return oe(`/api/skills/${encodeURIComponent(e)}`,{method:"DELETE",body:JSON.stringify({location:t,projectPath:r,cliType:n})})}async function Fie(e){return oe("/api/skills/validate-import",{method:"POST",body:JSON.stringify({sourcePath:e})})}async function zie(e){return oe("/api/skills/create",{method:"POST",body:JSON.stringify(e)})}async function Uie(e){const{skillName:t,fileName:r,location:n,projectPath:i,cliType:o="claude"}=e,a=`/api/skills/${encodeURIComponent(t)}/file?filename=${encodeURIComponent(r)}&location=${n}&cliType=${o}${i?`&path=${encodeURIComponent(i)}`:""}`;return oe(a)}async function Hie(e){if(e)try{const t=`/api/commands?path=${encodeURIComponent(e)}`,r=await oe(t),n=[...r.projectCommands??[],...r.userCommands??[]];return{commands:r.commands??n,groups:r.groups,projectGroupsConfig:r.projectGroupsConfig,userGroupsConfig:r.userGroupsConfig}}catch(t){const r=t;if(r.status===403||r.status===404||r.status===400)console.warn("[fetchCommands] Path validation failed, falling back to global commands");else throw t}try{const t=await oe("/api/commands"),r=[...t.projectCommands??[],...t.userCommands??[]];return{commands:t.commands??r,groups:t.groups,projectGroupsConfig:t.projectGroupsConfig,userGroupsConfig:t.userGroupsConfig}}catch(t){throw console.error("[fetchCommands] Failed to fetch commands:",t),t}}async function qie(e,t,r,n){return oe(`/api/commands/${encodeURIComponent(e)}/toggle`,{method:"POST",body:JSON.stringify({enabled:t,location:r,projectPath:n})})}async function Wie(e,t,r,n){return oe(`/api/commands/group/${encodeURIComponent(e)}/toggle`,{method:"POST",body:JSON.stringify({enable:t,location:r,projectPath:n})})}async function Vie(e){return oe("/api/commands/validate-import",{method:"POST",body:JSON.stringify({sourcePath:e})})}async function Gie(e){return oe("/api/commands/create",{method:"POST",body:JSON.stringify(e)})}async function Kie(e){if(e)try{const r=`/api/core-memory/memories?path=${encodeURIComponent(e)}`,n=await oe(r);return{memories:n.memories??[],totalSize:n.totalSize??0,claudeMdCount:n.claudeMdCount??0}}catch(r){const n=r;if(n.status===403||n.status===404)console.warn("[fetchMemories] 403/404 for project path, falling back to global memories");else throw r}const t=await oe("/api/core-memory/memories");return{memories:t.memories??[],totalSize:t.totalSize??0,claudeMdCount:t.claudeMdCount??0}}async function Xie(e,t){return oe("/api/core-memory/memories",{method:"POST",body:JSON.stringify({...e,path:t})}).then(n=>n.memory)}async function Zie(e,t,r){return oe("/api/core-memory/memories",{method:"POST",body:JSON.stringify({id:e,...t,path:r})}).then(i=>i.memory)}async function Qie(e,t){const r=t?`/api/core-memory/memories/${encodeURIComponent(e)}?path=${encodeURIComponent(t)}`:`/api/core-memory/memories/${encodeURIComponent(e)}`;return oe(r,{method:"DELETE"})}async function Yie(e,t){const r=t?`/api/core-memory/memories/${encodeURIComponent(e)}/archive?path=${encodeURIComponent(t)}`:`/api/core-memory/memories/${encodeURIComponent(e)}/archive`;return oe(r,{method:"POST"})}async function Jie(e,t){const r=t?`/api/core-memory/memories/${encodeURIComponent(e)}/unarchive?path=${encodeURIComponent(t)}`:`/api/core-memory/memories/${encodeURIComponent(e)}/unarchive`;return oe(r,{method:"POST"})}async function eoe(e,t){const r=new URLSearchParams;return t&&r.set("path",t),oe(`/api/core-memory/extract?${r}`,{method:"POST",body:JSON.stringify({max_sessions:e})})}async function toe(e){const t=new URLSearchParams;return e&&t.set("path",e),oe(`/api/core-memory/extract/status?${t}`)}async function roe(e){const t=new URLSearchParams;return e&&t.set("path",e),oe(`/api/core-memory/consolidate?${t}`,{method:"POST"})}async function noe(e){const t=new URLSearchParams;return e&&t.set("path",e),oe(`/api/core-memory/consolidate/status?${t}`)}async function ioe(e,t){const r=new URLSearchParams;return t&&r.set("path",t),e!=null&&e.kind&&r.set("kind",e.kind),e!=null&&e.status_filter&&r.set("status_filter",e.status_filter),oe(`/api/core-memory/jobs?${r}`)}async function ooe(e=!1,t,r){const n=new URLSearchParams;return r&&n.set("path",r),e&&n.set("include_native","true"),oe(`/api/core-memory/extract/preview?${n}`)}async function soe(e){const t=new URLSearchParams;return e.path&&t.set("path",e.path),oe(`/api/core-memory/extract/selective?${t}`,{method:"POST",body:JSON.stringify({session_ids:e.sessionIds,include_native:e.includeNative})})}async function PU(e){const t=e?`/api/ccw?path=${encodeURIComponent(e)}`:"/api/ccw";return(await oe(t)).projectOverview??null}async function AU(e,t){const r=t?`/api/ccw/guidelines?path=${encodeURIComponent(t)}`:"/api/ccw/guidelines";return oe(r,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function aoe(e,t){const r=await oA(t),i=[...r.activeSessions,...r.archivedSessions].find(d=>d.session_id===e);if(!i)throw new Error(`Session not found: ${e}`);const o=i.path||i.session_id,s=await oe(`/api/session-detail?path=${encodeURIComponent(o)}&type=all`);let a=s.summary;!a&&s.summaries&&s.summaries.length>0&&(a=s.summaries[0].content||s.summaries[0].name||"");const l=s.context?{context:s.context}:void 0;return{session:{...i,tasks:s.tasks||i.tasks||[]},context:l,summary:a,summaries:s.summaries,implPlan:s.implPlan,conflicts:s.conflictResolution,review:s.review}}async function loe(e){const t=e?`/api/cli/history-native?path=${encodeURIComponent(e)}`:"/api/cli/history-native";return{executions:(await oe(t)).executions??[]}}async function coe(e){await oe(`/api/cli/history/${encodeURIComponent(e)}`,{method:"DELETE"})}async function uoe(e){await oe(`/api/cli/history/tool/${encodeURIComponent(e)}`,{method:"DELETE"})}async function doe(){await oe("/api/cli/history",{method:"DELETE"})}async function foe(e,t,r){return oe("/api/bulk-update-task-status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionPath:e,taskIds:t,newStatus:r})})}async function hoe(e,t,r){return oe("/api/update-task-status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionPath:e,taskId:t,newStatus:r})})}async function OU(e,t){const r=new URLSearchParams({id:e});return t&&r.set("path",t),await oe(`/api/cli/execution?${r.toString()}`)}async function poe(e,t){const r=new URLSearchParams({id:e});return t&&r.set("path",t),oe(`/api/cli/native-session?${r.toString()}`)}async function moe(e){const t=new URLSearchParams;if(e.filePath)t.set("filePath",e.filePath),e.tool&&t.set("tool",e.tool);else if(e.executionId)t.set("id",e.executionId);else throw new Error("Either executionId or filePath is required");e.projectPath&&t.set("path",e.projectPath),e.format&&t.set("format",e.format),e.thoughts&&t.set("thoughts","true"),e.tools&&t.set("tools","true"),e.tokens&&t.set("tokens","true");const r=`/api/cli/native-session?${t.toString()}`;if(e.format==="text"){const n=await fetch(r,{credentials:"same-origin"});if(!n.ok){const i=await n.json().catch(()=>({error:"Request failed"}));throw new Error(i.error||n.statusText)}return n.text()}return oe(r)}async function goe(e={}){const{tool:t,project:r,limit:n=50,cursor:i}=e,o=new URLSearchParams;t&&o.set("tool",t),r&&o.set("path",r),n&&o.set("limit",String(n)),i&&o.set("cursor",i);const s=o.toString();return oe(`/api/cli/native-sessions${s?`?${s}`:""}`)}function voe(e){if(!(!Array.isArray(e)||e.length===0))return e.map(t=>typeof t=="string"?{path:t}:t)}function IU(e){var g;if(!e||typeof e!="object")return{task_id:"N/A",status:"pending",_raw:e};const t=e.context,r=e.flow_control,n=e.meta,i=e.convergence,o=e.modification_points,s=t==null?void 0:t.requirements,a=e.details,l=e.description||(Array.isArray(s)&&s.length>0?s.join("; "):void 0)||(Array.isArray(a)&&a.length>0?a.join("; "):void 0)||e.scope,c=voe(e.files)||(r==null?void 0:r.target_files)||(o!=null&&o.length?o.filter(_=>_.file).map(_=>({path:_.file,name:_.target,change:_.change})):void 0),d=e.focus_paths||(t==null?void 0:t.focus_paths)||(c!=null&&c.length?c.map(_=>_.path).filter(Boolean):void 0)||[],u=e.acceptance,p=i||((g=t==null?void 0:t.acceptance)!=null&&g.length?{criteria:t.acceptance}:void 0)||(u!=null&&u.length?{criteria:u}:void 0);return{task_id:e.task_id||e.id||"N/A",title:e.title,description:l,status:e.status||"pending",priority:e.priority,created_at:e.created_at,updated_at:e.updated_at,has_summary:e.has_summary,estimated_complexity:e.estimated_complexity,depends_on:e.depends_on||(t==null?void 0:t.depends_on)||[],focus_paths:d,convergence:p,pre_analysis:e.pre_analysis||(r==null?void 0:r.pre_analysis),implementation:e.implementation||(r==null?void 0:r.implementation_approach),files:c,type:e.type||(n==null?void 0:n.type),scope:e.scope||(n==null?void 0:n.scope),action:e.action||(n==null?void 0:n.action),flow_control:r,context:t,meta:n,_raw:e}}function yoe(e){var i,o,s;const t=e.pre_analysis,r=e.implementation,n=e.files;return!(t!=null&&t.length)&&!(r!=null&&r.length)&&!(n!=null&&n.length)?e.flow_control:{pre_analysis:t||((i=e.flow_control)==null?void 0:i.pre_analysis),implementation_approach:r||((o=e.flow_control)==null?void 0:o.implementation_approach),target_files:n||((s=e.flow_control)==null?void 0:s.target_files)}}async function sA(e){const t=e?`/api/data?path=${encodeURIComponent(e)}`:"/api/data";return(await oe(t)).liteTasks||{}}async function RU(e,t,r){const n=await sA(r);return(t==="lite-plan"?n.litePlan||[]:t==="lite-fix"?n.liteFix||[]:n.multiCliPlan||[]).find(o=>o.id===e||o.session_id===e)||null}async function boe(e){return await oe(`/api/session-detail?path=${encodeURIComponent(e)}&type=context`)}async function NU(){var t;const e=await oe("/api/data");if(e.activeSessions){const r=e.activeSessions.filter(n=>n.type==="review"||n.hasReview);if(r.length>0)return r.map(n=>{var i;return{session_id:n.session_id,title:n.project||n.session_id,description:"",type:"review",phase:(i=n.reviewSummary)==null?void 0:i.phase,reviewDimensions:n.reviewDimensions||[],reviewSummary:n.reviewSummary,_isActive:!0,created_at:n.created_at,updated_at:void 0,status:n.status}})}return e.reviewSessions&&e.reviewSessions.length>0?e.reviewSessions:(t=e.reviewData)!=null&&t.sessions?e.reviewData.sessions.map(r=>({session_id:r.session_id,title:r.session_id,description:"",type:"review",phase:"in-progress",reviewDimensions:r.dimensions.map(n=>({name:n.name,findings:n.findings||[]})),_isActive:!0,created_at:void 0,updated_at:void 0,status:"active"})):[]}async function _oe(e){return(await NU()).find(r=>r.session_id===e)||null}function MU(e){return e.transport==="stdio"}function xoe(e){return e.transport==="http"}async function Tc(){return oe("/api/mcp-config")}function Xr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qv(e){const t=e.trim();if(!t)return"";let r=t.replace(/\\/g,"/");return/^\/[a-zA-Z]\//.test(r)&&(r=r.charAt(1).toUpperCase()+":"+r.slice(2)),/^[a-zA-Z]:\//.test(r)&&(r=r.charAt(0).toUpperCase()+r.slice(1)),r.replace(/\/+$/,"")}function jU(e,t){if(!t)return null;const r=qv(t);if(!r)return null;for(const n of Object.keys(e))if(qv(n)===r)return n;return t in e?t:null}function Wv(e){if(!Xr(e))return{transport:"stdio",command:""};const t=typeof e.url=="string"&&e.url.trim()!=="",r=e.type==="http"||e.transport==="http";if(t||r){const l=typeof e.url=="string"?e.url:"",c=Xr(e.headers)?Object.fromEntries(Object.entries(e.headers).flatMap(([_,y])=>typeof y=="string"?[[_,y]]:[])):void 0,d=typeof e.bearer_token_env_var=="string"?e.bearer_token_env_var:void 0,u=Xr(e.http_headers)?Object.fromEntries(Object.entries(e.http_headers).flatMap(([_,y])=>typeof y=="string"?[[_,y]]:[])):void 0,p=Array.isArray(e.env_http_headers)?e.env_http_headers.filter(_=>typeof _=="string"):void 0,g={transport:"http",url:l};return c&&Object.keys(c).length>0&&(g.headers=c),d&&(g.bearerTokenEnvVar=d),u&&Object.keys(u).length>0&&(g.httpHeaders=u),p&&p.length>0&&(g.envHttpHeaders=p),g}const n=typeof e.command=="string"?e.command:"",i=Array.isArray(e.args)?e.args.filter(l=>typeof l=="string"):void 0,o=Xr(e.env)?Object.fromEntries(Object.entries(e.env).flatMap(([l,c])=>typeof c=="string"?[[l,c]]:[])):void 0,s=typeof e.cwd=="string"?e.cwd:void 0,a={transport:"stdio",command:n};return i&&i.length>0&&(a.args=i),o&&Object.keys(o).length>0&&(a.env=o),s&&(a.cwd=s),a}async function x0(e){const t=await Tc(),r=Xr(t.projects)?t.projects:{},n=jU(r,e),i=n&&Xr(r[n])?r[n]:null,o=i&&Array.isArray(i.disabledMcpServers)?i.disabledMcpServers.filter(p=>typeof p=="string"):[],s=new Set(o),a=Xr(t.userServers)?t.userServers:{},l=i&&Xr(i.mcpServers)?i.mcpServers:{},c=Object.entries(a).map(([p,g])=>{const _=Wv(g);return{name:p,..._,enabled:!s.has(p),scope:"global"}}),d=Object.entries(l).map(([p,g])=>{const _=Wv(g);return{name:p,..._,enabled:!s.has(p),scope:"project"}}),u=[];for(const p of d){const g=c.find(_=>_.name===p.name);g&&u.push({name:p.name,projectServer:p,globalServer:g,effectiveScope:"global"})}return{project:d,global:c,conflicts:u}}function Ya(e,t){const r=e==null?void 0:e.trim();if(!r)throw new Error(`${t}: projectPath is required`);return r}function DU(e){if(e.transport==="http"){const n={url:"url"in e&&typeof e.url=="string"?e.url:""};return n.type="http",e.headers&&Object.keys(e.headers).length>0&&(n.headers=e.headers),e.bearerTokenEnvVar&&(n.bearer_token_env_var=e.bearerTokenEnvVar),e.httpHeaders&&Object.keys(e.httpHeaders).length>0&&(n.http_headers=e.httpHeaders),e.envHttpHeaders&&e.envHttpHeaders.length>0&&(n.env_http_headers=e.envHttpHeaders),n}const t={};return"command"in e&&typeof e.command=="string"&&(t.command=e.command),"args"in e&&Array.isArray(e.args)&&e.args.length>0&&(t.args=e.args),"env"in e&&e.env&&Object.keys(e.env).length>0&&(t.env=e.env),"cwd"in e&&typeof e.cwd=="string"&&e.cwd.trim()&&(t.cwd=e.cwd),t}function LM(e,t){const r=t.transport??"stdio",n=t.enabled??!0,i=t.scope??"project";if(r==="http"){const c="url"in t&&typeof t.url=="string"?t.url:"";return{name:e,transport:"http",url:c,enabled:n,scope:i}}const o="command"in t&&typeof t.command=="string"?t.command:"",s="args"in t&&Array.isArray(t.args)?t.args:void 0,a="env"in t&&t.env&&typeof t.env=="object"?t.env:void 0,l="cwd"in t&&typeof t.cwd=="string"?t.cwd:void 0;return{name:e,transport:"stdio",command:o,args:s,env:a,cwd:l,enabled:n,scope:i}}async function woe(e,t,r={}){var i;if(!t.scope)throw new Error("updateMcpServer: scope is required");if(t.transport==="http"){const o="url"in t?t.url:void 0;if(typeof o!="string"||!o.trim())throw new Error("updateMcpServer: url is required for HTTP servers")}else{const o="command"in t?t.command:void 0;if(typeof o!="string"||!o.trim())throw new Error("updateMcpServer: command is required for STDIO servers")}const n=DU(t);if(t.scope==="global"){const o=await oe("/api/mcp-add-global-server",{method:"POST",body:JSON.stringify({serverName:e,serverConfig:n})});if(o!=null&&o.error)throw new Error(o.error)}else{const o=Ya(r.projectPath,"updateMcpServer"),s=r.configType??"mcp",a=await oe("/api/mcp-copy-server",{method:"POST",body:JSON.stringify({projectPath:o,serverName:e,serverConfig:n,configType:s})});if(a!=null&&a.error)throw new Error(a.error)}if(typeof t.enabled=="boolean"){const o=(i=r.projectPath)==null?void 0:i.trim();if(o){const s=await oe("/api/mcp-toggle",{method:"POST",body:JSON.stringify({projectPath:o,serverName:e,enable:t.enabled})});if(s!=null&&s.error)throw new Error(s.error)}}if(r.projectPath){const o=await x0(r.projectPath);return[...o.project,...o.global].find(s=>s.name===e)??LM(e,t)}return LM(e,t)}async function Soe(e,t={}){var i,o,s;if(!((i=e.name)!=null&&i.trim()))throw new Error("createMcpServer: name is required");if(e.transport==="http"){if(!((o=e.url)!=null&&o.trim()))throw new Error("createMcpServer: url is required for HTTP servers")}else if(!((s=e.command)!=null&&s.trim()))throw new Error("createMcpServer: command is required for STDIO servers");const r=e.name.trim(),n=DU(e);if(e.scope==="global"){const a=await oe("/api/mcp-add-global-server",{method:"POST",body:JSON.stringify({serverName:r,serverConfig:n})});if(a!=null&&a.error)throw new Error(a.error)}else{const a=Ya(t.projectPath,"createMcpServer"),l=t.configType??"mcp",c=await oe("/api/mcp-copy-server",{method:"POST",body:JSON.stringify({projectPath:a,serverName:r,serverConfig:n,configType:l})});if(c!=null&&c.error)throw new Error(c.error)}if(e.enabled===!1){const a=Ya(t.projectPath,"createMcpServer"),l=await oe("/api/mcp-toggle",{method:"POST",body:JSON.stringify({projectPath:a,serverName:r,enable:!1})});if(l!=null&&l.error)throw new Error(l.error)}if(t.projectPath){const a=await x0(t.projectPath);return[...a.project,...a.global].find(l=>l.name===r)??e}return e}async function Coe(e,t,r={}){if(t==="global"){const o=await oe("/api/mcp-remove-global-server",{method:"POST",body:JSON.stringify({serverName:e})});if(o!=null&&o.error)throw new Error(o.error);return}const n=Ya(r.projectPath,"deleteMcpServer"),i=await oe("/api/mcp-remove-server",{method:"POST",body:JSON.stringify({projectPath:n,serverName:e})});if(i!=null&&i.error)throw new Error(i.error)}async function Eoe(e,t,r={}){const n=Ya(r.projectPath,"toggleMcpServer"),i=await oe("/api/mcp-toggle",{method:"POST",body:JSON.stringify({projectPath:n,serverName:e,enable:t})});if(i!=null&&i.error)throw new Error(i.error);const o=await x0(n);return[...o.project,...o.global].find(s=>s.name===e)??{name:e,transport:"stdio",command:"",enabled:t,scope:"project"}}async function LU(){const e=await oe("/api/codex-mcp-config"),t=Xr(e.servers)?e.servers:{};return{servers:Object.entries(t).map(([n,i])=>{const o=Wv(i),s=Xr(i)?i.enabled!==!1:!0;return{name:n,...o,enabled:s,scope:"global",configPath:e.configPath}}),configPath:e.configPath}}async function w0(e,t){return oe("/api/codex-mcp-add",{method:"POST",body:JSON.stringify({serverName:e,serverConfig:t})})}async function $U(e){return oe("/api/codex-mcp-remove",{method:"POST",body:JSON.stringify({serverName:e})})}async function koe(e,t){return oe("/api/codex-mcp-toggle",{method:"POST",body:JSON.stringify({serverName:e,enabled:t})})}async function Toe(){return(await oe("/api/mcp-templates")).templates??[]}async function Poe(e){return oe("/api/mcp-templates",{method:"POST",body:JSON.stringify(e)})}async function Aoe(e){return oe(`/api/mcp-templates/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Ooe(e){return oe("/api/mcp-templates/install",{method:"POST",body:JSON.stringify(e)})}async function Ioe(e){return(await oe(`/api/mcp-templates/search?q=${encodeURIComponent(e)}`)).templates??[]}async function Roe(){return(await oe("/api/mcp-templates/categories")).categories??[]}async function Noe(e){return(await oe(`/api/mcp-templates/category/${encodeURIComponent(e)}`)).templates??[]}async function Moe(){const e=await Tc();return{projects:Object.keys(e.projects??{}).sort((r,n)=>r.localeCompare(n))}}async function joe(e){const t=await Tc(),r=Xr(t.userServers)?t.userServers:{},n=Xr(t.enterpriseServers)?t.enterpriseServers:{},i=e&&e.length>0?new Set(e.map(s=>qv(s))):null,o={};for(const[s,a]of Object.entries(t.projects??{})){const l=qv(s);if(i&&!i.has(l))continue;const c=Xr(a)?a:{},d=Xr(c.mcpServers)?c.mcpServers:{},u=Array.isArray(c.disabledMcpServers)?c.disabledMcpServers.filter(g=>typeof g=="string"):[],p=new Set(u);o[s]=Object.entries(d).filter(([g])=>!(g in r)&&!(g in n)).flatMap(([g,_])=>{const y=Wv(_);return y.transport!=="stdio"?[]:[{name:g,command:y.command,args:y.args,env:y.env,enabled:!p.has(g)}]})}return{servers:o}}async function Doe(e){const t=e.serverNames??[];if(t.length===0||e.source===e.target)return{success:!0,copied:[],failed:[]};const r=[],n=[];if(e.source==="claude"&&e.target==="codex"){const i=await Tc(),o=Xr(i.projects)?i.projects:{},s=jU(o,e.projectPath??void 0),a=s&&Xr(o[s])?o[s]:null,l=a&&Xr(a.mcpServers)?a.mcpServers:{};for(const c of t)try{const d=l[c]??(i.userServers?i.userServers[c]:void 0)??(i.enterpriseServers?i.enterpriseServers[c]:void 0);if(!Xr(d)){n.push({name:c,error:"Source server config not found"});continue}const u=await w0(c,d);if(u!=null&&u.error){n.push({name:c,error:u.error});continue}r.push(c)}catch(d){n.push({name:c,error:d instanceof Error?d.message:String(d)})}return{success:r.length>0,copied:r,failed:n}}if(e.source==="codex"&&e.target==="claude"){const i=Ya(e.projectPath,"crossCliCopy"),o=await oe("/api/codex-mcp-config"),s=Xr(o.servers)?o.servers:{};for(const a of t)try{const l=s[a];if(!Xr(l)){n.push({name:a,error:"Source server config not found"});continue}const c=await oe("/api/mcp-copy-server",{method:"POST",body:JSON.stringify({projectPath:i,serverName:a,serverConfig:l,configType:"mcp"})});if(c!=null&&c.error){n.push({name:a,error:c.error});continue}r.push(a)}catch(l){n.push({name:a,error:l instanceof Error?l.message:String(l)})}return{success:r.length>0,copied:r,failed:n}}return{success:!1,copied:[],failed:t.map(i=>({name:i,error:"Unsupported copy direction"}))}}async function Loe(){return{endpoints:(await oe("/api/cli/endpoints")).endpoints??[]}}async function $oe(e,t){return oe(`/api/cli/endpoints/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}async function Boe(e){return oe("/api/cli/endpoints",{method:"POST",body:JSON.stringify(e)})}async function Foe(e){await oe(`/api/cli/endpoints/${encodeURIComponent(e)}`,{method:"DELETE"})}async function zoe(e,t){return oe(`/api/cli/endpoints/${encodeURIComponent(e)}/toggle`,{method:"POST",body:JSON.stringify({enabled:t})})}async function Uoe(){return{tools:(await oe("/api/cli/installations")).tools??[]}}async function Hoe(e){return oe(`/api/cli/installations/${encodeURIComponent(e)}/install`,{method:"POST"})}async function qoe(e){await oe(`/api/cli/installations/${encodeURIComponent(e)}/uninstall`,{method:"POST"})}async function Woe(e){return oe(`/api/cli/installations/${encodeURIComponent(e)}/upgrade`,{method:"POST"})}function Voe(e){const t=[];for(const r of["project","global"]){const n=e[r];if(!(!(n!=null&&n.hooks)||typeof n.hooks!="object"))for(const[i,o]of Object.entries(n.hooks))Array.isArray(o)&&o.forEach((s,a)=>{let l="";s.hooks&&Array.isArray(s.hooks)&&s.hooks.length>0&&(l=s.hooks.map(d=>d.command||d.prompt||"").filter(Boolean).join(" && ")),!l&&s.command&&(l=s.args?`${s.command} ${s.args.join(" ")}`:s.command),!l&&s.script&&(l=s.script);const c=`${r}-${i}-${a}`;t.push({name:c,description:s.description,enabled:s.enabled!==!1,command:l,trigger:i,matcher:s.matcher,scope:r,index:a,templateId:s._templateId})})}return t}async function Goe(e){const t=e?`/api/hooks?path=${encodeURIComponent(e)}`:"/api/hooks",r=await oe(t);return{hooks:Voe(r)}}async function Koe(e,t){return oe(`/api/hooks/${encodeURIComponent(e)}/toggle`,{method:"POST",body:JSON.stringify({enabled:t})})}async function Xoe(e,t,r){return oe("/api/hooks",{method:"POST",body:JSON.stringify({projectPath:"",scope:e,event:t,hookData:r})})}async function Zoe(e){return oe("/api/hooks",{method:"DELETE",body:JSON.stringify(e)})}async function Qoe(e){if(e)try{const n=`/api/rules?path=${encodeURIComponent(e)}`,i=await oe(n),o=[...i.projectRules??[],...i.userRules??[]];return{rules:i.rules??o}}catch(n){const i=n;if(i.status===403||i.status===404)console.warn("[fetchRules] 403/404 for project path, falling back to global rules");else throw n}const t=await oe("/api/rules"),r=[...t.projectRules??[],...t.userRules??[]];return{rules:t.rules??r}}async function Yoe(e,t){return oe(`/api/rules/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}async function Joe(e,t){return oe(`/api/rules/${encodeURIComponent(e)}/toggle`,{method:"POST",body:JSON.stringify({enabled:t})})}async function ese(e){return oe("/api/rules/create",{method:"POST",body:JSON.stringify(e)})}async function tse(e,t){return oe(`/api/rules/${encodeURIComponent(e)}`,{method:"DELETE",body:JSON.stringify({location:t})})}async function rse(e,t){return oe("/api/mcp-add-global-server",{method:"POST",body:JSON.stringify({serverName:e,serverConfig:t})})}async function nse(e,t,r,n="mcp"){const i=Ya(r,"copyMcpServerToProject");return oe("/api/mcp-copy-server",{method:"POST",body:JSON.stringify({projectPath:i,serverName:e,serverConfig:t,configType:n})})}async function aA(e){var t,r,n,i;try{const o=await Tc(),s=[];let a=null;if((t=o.globalServers)!=null&&t["ccw-tools"]?(s.push("global"),a=o.globalServers["ccw-tools"]):(r=o.userServers)!=null&&r["ccw-tools"]&&(s.push("global"),a=o.userServers["ccw-tools"]),o.projects){if(e){const u=e.replace(/\\/g,"/");for(const[p,g]of Object.entries(o.projects))if(p.replace(/\\/g,"/")===u&&((n=g.mcpServers)!=null&&n["ccw-tools"])){s.push("project"),a||(a=g.mcpServers["ccw-tools"]);break}}else for(const u of Object.values(o.projects))if((i=u.mcpServers)!=null&&i["ccw-tools"]){s.push("project"),a||(a=u.mcpServers["ccw-tools"]);break}}if(!a)return{isInstalled:!1,enabledTools:[],installedScopes:[]};const l=a.env||{},c=l.CCW_ENABLED_TOOLS;let d;return c==null?d=["write_file","edit_file","read_file","core_memory","ask_question"]:c===""||c==="all"?d=c===""?[]:["write_file","edit_file","read_file","core_memory","ask_question"]:d=c.split(",").map(u=>u.trim()).filter(Boolean),{isInstalled:!0,enabledTools:d,projectRoot:l.CCW_PROJECT_ROOT,allowedDirs:l.CCW_ALLOWED_DIRS,enableSandbox:l.CCW_ENABLE_SANDBOX==="1",installedScopes:s}}catch{return{isInstalled:!1,enabledTools:[],installedScopes:[]}}}async function ise(e){const t=await oe("/api/mcp-install-ccw",{method:"POST",body:JSON.stringify({scope:"global",env:e})});if(t!=null&&t.error)throw new Error(t.error||"Failed to update CCW config");return aA()}async function ose(e="global",t){const r=e==="project"?Ya(t,"installCcwMcp"):void 0,n=await oe("/api/mcp-install-ccw",{method:"POST",body:JSON.stringify({scope:e,projectPath:r,env:{enabledTools:["write_file","edit_file","read_file","core_memory","ask_question"]}})});if(n!=null&&n.error)throw new Error(n.error||`Failed to install CCW MCP (${e})`);return aA(r)}async function sse(){try{await oe("/api/mcp-remove-global-server",{method:"POST",body:JSON.stringify({serverName:"ccw-tools"})})}catch{}try{const e=await Tc();if(e.projects){const t=Object.entries(e.projects).filter(([r,n])=>{var i;return(i=n.mcpServers)==null?void 0:i["ccw-tools"]}).map(([r])=>oe("/api/mcp-remove-server",{method:"POST",body:JSON.stringify({projectPath:r,serverName:"ccw-tools"})}).catch(()=>{}));await Promise.all(t)}}catch{}}async function ase(e,t){if(e==="global")await oe("/api/mcp-remove-global-server",{method:"POST",body:JSON.stringify({serverName:"ccw-tools"})});else{if(!t)throw new Error("projectPath required for project scope uninstall");await oe("/api/mcp-remove-server",{method:"POST",body:JSON.stringify({projectPath:t,serverName:"ccw-tools"})})}}async function lA(){try{const{servers:e}=await LU(),t=e.find(o=>o.name==="ccw-tools");if(!t)return{isInstalled:!1,enabledTools:[],installedScopes:[]};const r=MU(t)?t.env||{}:{},n=r.CCW_ENABLED_TOOLS;let i;return n==null?i=["write_file","edit_file","read_file","core_memory","ask_question"]:n===""||n==="all"?i=n===""?[]:["write_file","edit_file","read_file","core_memory","ask_question"]:i=n.split(",").map(o=>o.trim()).filter(Boolean),{isInstalled:!0,enabledTools:i,projectRoot:r.CCW_PROJECT_ROOT,allowedDirs:r.CCW_ALLOWED_DIRS,enableSandbox:r.CCW_ENABLE_SANDBOX==="1",installedScopes:["global"]}}catch{return{isInstalled:!1,enabledTools:[],installedScopes:[]}}}function BU(e){const t={};return e.enabledTools!==void 0?t.CCW_ENABLED_TOOLS=e.enabledTools.join(","):t.CCW_ENABLED_TOOLS="write_file,edit_file,read_file,core_memory,ask_question",e.projectRoot&&(t.CCW_PROJECT_ROOT=e.projectRoot),e.allowedDirs&&(t.CCW_ALLOWED_DIRS=e.allowedDirs),e.enableSandbox&&(t.CCW_ENABLE_SANDBOX="1"),{command:"ccw-mcp",args:[],env:t}}async function lse(){const e=BU({enabledTools:["write_file","edit_file","read_file","core_memory","ask_question"]}),t=await w0("ccw-tools",e);if(t.error)throw new Error(t.error||"Failed to install CCW MCP to Codex");return lA()}async function cse(){const e=await $U("ccw-tools");if(!e.success)throw new Error(e.error||"Failed to uninstall CCW MCP from Codex")}async function use(e){const t=BU(e),r=await w0("ccw-tools",t);if(r.error)throw new Error(r.error||"Failed to update CCW config in Codex");return lA()}async function dse(e){const t=e?`/api/memory/prompts?path=${encodeURIComponent(e)}`:"/api/memory/prompts";return oe(t)}async function fse(e){const t=e?`/api/memory/insights?path=${encodeURIComponent(e)}`:"/api/memory/insights";return oe(t)}async function hse(e,t=20){const r=e?`/api/memory/insights?limit=${t}&path=${encodeURIComponent(e)}`:`/api/memory/insights?limit=${t}`;return oe(r)}async function pse(e,t){const r=`/api/memory/insights/${encodeURIComponent(e)}`;return oe(r)}async function mse(e={}){return oe("/api/memory/analyze",{method:"POST",body:JSON.stringify(e)})}async function gse(e){await oe("/api/memory/prompts/"+encodeURIComponent(e),{method:"DELETE"})}async function vse(e,t){const r=t?`/api/memory/insights/${encodeURIComponent(e)}?path=${encodeURIComponent(t)}`:`/api/memory/insights/${encodeURIComponent(e)}`;return oe(r,{method:"DELETE"})}async function yse(e){return oe("/api/memory/prompts/batch-delete",{method:"POST",body:JSON.stringify({promptIds:e})})}async function bse(e="/",t={}){const r=new URLSearchParams;return r.append("rootPath",e),t.maxDepth!==void 0&&r.append("maxDepth",String(t.maxDepth)),t.includeHidden!==void 0&&r.append("includeHidden",String(t.includeHidden)),t.excludePatterns&&r.append("excludePatterns",t.excludePatterns.join(",")),oe(`/api/explorer/tree?${r.toString()}`)}async function _se(e,t={}){const r=new URLSearchParams;return r.append("path",e),t.encoding&&r.append("encoding",t.encoding),t.maxSize!==void 0&&r.append("maxSize",String(t.maxSize)),oe(`/api/explorer/file?${r.toString()}`)}async function xse(e){return oe("/api/explorer/search",{method:"POST",body:JSON.stringify(e)})}async function wse(){return oe("/api/explorer/roots")}async function Sse(e={}){const t=new URLSearchParams;return e.rootPath&&t.append("rootPath",e.rootPath),e.maxDepth!==void 0&&t.append("maxDepth",String(e.maxDepth)),e.includeTypes&&t.append("includeTypes",e.includeTypes.join(",")),e.excludePatterns&&t.append("excludePatterns",e.excludePatterns.join(",")),oe(`/api/graph/dependencies?${t.toString()}`)}async function Cse(){return oe("/api/litellm-api/providers")}async function Ese(e){return oe("/api/litellm-api/providers",{method:"POST",body:JSON.stringify(e)})}async function kse(e,t){return oe(`/api/litellm-api/providers/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function Tse(e){return oe(`/api/litellm-api/providers/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Pse(e){return oe(`/api/litellm-api/providers/${encodeURIComponent(e)}/test`,{method:"POST"})}async function Ase(e){return oe(`/api/litellm-api/providers/${encodeURIComponent(e)}/health-check-now`,{method:"POST"})}async function Ose(){return oe("/api/litellm-api/endpoints")}async function Ise(e){return oe("/api/litellm-api/endpoints",{method:"POST",body:JSON.stringify(e)})}async function Rse(e,t){return oe(`/api/litellm-api/endpoints/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function Nse(e){return oe(`/api/litellm-api/endpoints/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Mse(){return oe("/api/litellm-api/cache/stats")}async function jse(){return oe("/api/litellm-api/cache/clear",{method:"POST"})}async function Dse(e){return oe("/api/litellm-api/config/cache",{method:"PUT",body:JSON.stringify(e)})}async function Lse(){return oe("/api/litellm-api/model-pools")}async function $se(e){return oe("/api/litellm-api/model-pools",{method:"POST",body:JSON.stringify(e)})}async function Bse(e,t){return oe(`/api/litellm-api/model-pools/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function Fse(e){return oe(`/api/litellm-api/model-pools/${encodeURIComponent(e)}`,{method:"DELETE"})}async function zse(e){return oe(`/api/litellm-api/model-pools/available-models/${encodeURIComponent(e)}`)}async function Use(e,t){return oe(`/api/litellm-api/model-pools/discover/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)}async function Hse(){return oe("/api/litellm-api/config/sync",{method:"POST"})}async function qse(){return oe("/api/cli/settings")}async function Wse(e){return oe("/api/cli/settings",{method:"POST",body:JSON.stringify(e)})}async function Vse(e,t){return oe(`/api/cli/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}async function Gse(e){return oe(`/api/cli/settings/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Kse(e,t){return oe(`/api/cli/settings/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({enabled:t})})}async function Xse(){return oe("/api/cli/settings/codex/preview")}async function Zse(){return oe("/api/cli/settings/gemini/preview")}async function Qse(e,t){return oe(mn("/api/orchestrator/flows",t),{method:"POST",body:JSON.stringify(e)})}async function Yse(e,t,r){return oe(mn(`/api/orchestrator/flows/${encodeURIComponent(e)}/execute`,r),{method:"POST",body:JSON.stringify(t??{})})}async function Jse(){return oe("/api/language/chinese-response")}async function eae(e,t="claude"){return oe("/api/language/chinese-response",{method:"POST",body:JSON.stringify({enabled:e,target:t})})}async function tae(){return oe("/api/language/windows-platform")}async function rae(e){return oe("/api/language/windows-platform",{method:"POST",body:JSON.stringify({enabled:e})})}async function nae(){return oe("/api/language/codex-cli-enhancement")}async function iae(e){return oe("/api/language/codex-cli-enhancement",{method:"POST",body:JSON.stringify({enabled:e})})}async function oae(){return oe("/api/language/codex-cli-enhancement",{method:"POST",body:JSON.stringify({action:"refresh"})})}async function sae(){return oe("/api/status/all")}async function aae(){return oe("/api/cli/status")}async function lae(){return oe("/api/ccw/installations")}async function cae(e){return oe("/api/ccw/upgrade",{method:"POST",body:JSON.stringify({path:e})})}async function uae(){return oe("/api/cli/settings/export")}async function dae(e,t){return oe("/api/cli/settings/import",{method:"POST",body:JSON.stringify({data:e,options:t})})}async function fae(e){const t=new URLSearchParams;e&&t.set("location",e);const r=t.toString();return oe(`/api/teams${r?`?${r}`:""}`)}async function hae(e){return oe(`/api/teams/${encodeURIComponent(e)}/archive`,{method:"POST"})}async function pae(e){return oe(`/api/teams/${encodeURIComponent(e)}/unarchive`,{method:"POST"})}async function mae(e){return oe(`/api/teams/${encodeURIComponent(e)}`,{method:"DELETE"})}async function gae(e,t){const r=new URLSearchParams;t!=null&&t.from&&r.set("from",t.from),t!=null&&t.to&&r.set("to",t.to),t!=null&&t.type&&r.set("type",t.type),r.set("last",String(t.last));const n=r.toString();return oe(`/api/teams/${encodeURIComponent(e)}/messages${n?`?${n}`:""}`)}async function vae(e){return oe(`/api/teams/${encodeURIComponent(e)}/status`)}async function yae(e){return oe(`/api/teams/${encodeURIComponent(e)}/artifacts`)}async function bae(e,t){return oe(`/api/teams/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`)}function mn(e,t){if(!t)return e;const r=e.includes("?")?"&":"?";return`${e}${r}path=${encodeURIComponent(t)}`}async function FU(e){return oe(mn("/api/cli-sessions",e))}async function S0(e,t){return oe(mn("/api/cli-sessions",t),{method:"POST",body:JSON.stringify(e)})}async function zU(e,t){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/buffer`,t))}async function cA(e,t,r){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/send`,r),{method:"POST",body:JSON.stringify(t)})}async function _ae(e,t,r){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/execute`,r),{method:"POST",body:JSON.stringify(t)})}async function UU(e,t,r){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/resize`,r),{method:"POST",body:JSON.stringify(t)})}async function Vv(e,t){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/close`,t),{method:"POST",body:JSON.stringify({})})}async function HU(e,t){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/pause`,t),{method:"POST",body:JSON.stringify({})})}async function qU(e,t){return oe(mn(`/api/cli-sessions/${encodeURIComponent(e)}/resume`,t),{method:"POST",body:JSON.stringify({})})}async function xae(e){const t=new URLSearchParams;if(e!=null&&e.sessionKey&&t.set("sessionKey",e.sessionKey),e!=null&&e.q&&t.set("q",e.q),typeof(e==null?void 0:e.limit)=="number"&&t.set("limit",String(e.limit)),typeof(e==null?void 0:e.offset)=="number"&&t.set("offset",String(e.offset)),e!=null&&e.type){const n=Array.isArray(e.type)?e.type:[e.type];t.set("type",n.join(","))}const r=t.toString();return oe(mn(`/api/audit/cli-sessions${r?`?${r}`:""}`,e==null?void 0:e.projectPath))}async function wae(e,t,r){const n=new URLSearchParams;n.set("q",e),n.set("topK",String(t.topK)),t!=null&&t.minScore&&n.set("minScore",String(t.minScore)),t!=null&&t.category&&n.set("category",t.category);const i=await oe(mn(`/api/unified-memory/search?${n.toString()}`,r));if(i.success===!1)throw new Error(i.error||"Search failed");return i}async function Sae(e){const t=await oe(mn("/api/unified-memory/stats",e));if(t.success===!1)throw new Error(t.error||"Failed to load unified stats");return t}async function Cae(e,t,r){const n=new URLSearchParams;t&&n.set("limit",String(t));const i=n.toString(),o=await oe(mn(`/api/unified-memory/recommendations/${encodeURIComponent(e)}${i?`?${i}`:""}`,r));if(o.success===!1)throw new Error(o.error||"Failed to load recommendations");return o}async function Eae(e){return oe("/api/unified-memory/reindex",{method:"POST",body:JSON.stringify({path:e})})}async function kae(){return oe("/api/system/settings")}async function Tae(e,t){return oe("/api/system/hooks/install-recommended",{method:"POST",body:JSON.stringify({hookIds:e,scope:t})})}async function Pae(e){const t=e?`/api/specs/stats?path=${encodeURIComponent(e)}`:"/api/specs/stats";return oe(t)}async function Aae(e){const t=e?`/api/specs/list?path=${encodeURIComponent(e)}`:"/api/specs/list";return oe(t)}async function Oae(e){const t=e?`/api/specs/rebuild?path=${encodeURIComponent(e)}`:"/api/specs/rebuild";return oe(t,{method:"POST"})}async function Iae(e="required",t=!1,r,n){const i=new URLSearchParams;return i.set("mode",e),i.set("preview",String(t)),n&&i.set("category",n),oe(`/api/specs/injection-preview?${i.toString()}`)}const Rae=[{command:"ccw spec load",labelKey:"default",descriptionKey:"default",mode:"required"},{command:"ccw spec load --category exploration",labelKey:"exploration",descriptionKey:"exploration",category:"exploration",mode:"required"},{command:"ccw spec load --category planning",labelKey:"planning",descriptionKey:"planning",category:"planning",mode:"required"},{command:"ccw spec load --category execution",labelKey:"execution",descriptionKey:"execution",category:"execution",mode:"required"},{command:"ccw spec load --category general",labelKey:"general",descriptionKey:"general",category:"general",mode:"required"}];async function Nae(e,t){const n=new URLSearchParams().toString(),i=n?`${mn("/api/analysis",e)}&${n}`:mn("/api/analysis",e),o=await oe(i);if(!o.success)throw new Error(o.error||"Failed to fetch analysis sessions");return o.data}async function Mae(e,t){const r=await oe(mn(`/api/analysis/${encodeURIComponent(e)}`,t));if(!r.success)throw new Error(r.error||"Failed to fetch analysis detail");return r.data}const cze=Object.freeze(Object.defineProperty({__proto__:null,COMMAND_PREVIEWS:Rae,activateQueue:yU,addCodexMcpServer:w0,addGlobalMcpServer:rse,analyzePrompts:mse,archiveMemory:Yie,archiveSession:oU,archiveTeam:hae,batchDeletePrompts:yse,buildFlowControl:yoe,bulkUpdateTaskStatus:foe,clearCache:jse,closeCliSession:Vv,codexRemoveServer:$U,codexToggleServer:koe,copyMcpServerToProject:nse,createCliEndpoint:Boe,createCliSession:S0,createCliSettings:Wse,createCommand:Gie,createEndpoint:Ise,createIssue:hU,createMcpServer:Soe,createMemory:Xie,createModelPool:$se,createOrchestratorFlow:Qse,createProvider:Ese,createRule:ese,createSkill:zie,crossCliCopy:Doe,deactivateQueue:bU,deleteAllHistory:doe,deleteCliEndpoint:Foe,deleteCliSettings:Gse,deleteEndpoint:Nse,deleteExecution:coe,deleteExecutionsByTool:uoe,deleteHook:Zoe,deleteInsight:vse,deleteIssue:mU,deleteMcpServer:Coe,deleteMcpTemplate:Aoe,deleteMemory:Qie,deleteModelPool:Fse,deletePrompt:gse,deleteProvider:Tse,deleteQueue:wU,deleteRule:tse,deleteSession:sU,deleteSkill:Bie,deleteTeam:mae,disableSkill:Lie,discoverModelsForPool:Use,enableSkill:Die,executeInCliSession:_ae,executeOrchestratorFlow:Yse,exportDiscoveryFindingsAsIssues:TU,exportSettings:uae,fetchAggregatedStatus:sae,fetchAllProjects:Moe,fetchAnalysisDetail:Mae,fetchAnalysisSessions:Nae,fetchApi:oe,fetchArtifactContent:bae,fetchCacheStats:Mse,fetchCcwInstallations:lae,fetchCcwMcpConfig:aA,fetchCcwMcpConfigForCodex:lA,fetchChineseResponseStatus:Jse,fetchCliEndpoints:Loe,fetchCliInstallations:Uoe,fetchCliSessionAudit:xae,fetchCliSessionBuffer:zU,fetchCliSessions:FU,fetchCliSettings:qse,fetchCliToolStatus:aae,fetchCodexCliEnhancementStatus:nae,fetchCodexConfigPreview:Xse,fetchCodexMcpServers:LU,fetchCommands:Hie,fetchDashboardStats:iU,fetchDiscoveries:EU,fetchDiscoveryFindings:kU,fetchEndpoints:Ose,fetchExecutionDetail:OU,fetchFileContent:_se,fetchFileTree:bse,fetchGeminiConfigPreview:Zse,fetchGraphDependencies:Sse,fetchHistory:loe,fetchHooks:Goe,fetchInsightDetail:pse,fetchInsightsHistory:hse,fetchIssueHistory:dU,fetchIssueQueue:fU,fetchIssues:uU,fetchLiteSessionContext:boe,fetchLiteTaskSession:RU,fetchLiteTasks:sA,fetchMcpConfig:Tc,fetchMcpServers:x0,fetchMcpTemplateCategories:Roe,fetchMcpTemplates:Toe,fetchMcpTemplatesByCategory:Noe,fetchMemories:Kie,fetchModelPools:Lse,fetchNativeSession:poe,fetchNativeSessionWithOptions:moe,fetchNativeSessions:goe,fetchOtherProjectsServers:joe,fetchProjectOverview:PU,fetchPromptInsights:fse,fetchPrompts:dse,fetchProviders:Cse,fetchQueueById:vU,fetchQueueHistory:gU,fetchRecentPaths:aU,fetchRecommendations:Cae,fetchReviewSession:_oe,fetchReviewSessions:NU,fetchRootDirectories:wse,fetchRules:Qoe,fetchSessionDetail:aoe,fetchSessions:oA,fetchSkillDetail:$ie,fetchSkills:jie,fetchTeamArtifacts:yae,fetchTeamMessages:gae,fetchTeamStatus:vae,fetchTeams:fae,fetchUnifiedSearch:wae,fetchUnifiedStats:Sae,fetchWindowsPlatformStatus:tae,getAvailableModelsForPool:zse,getConsolidationStatus:noe,getExtractionStatus:toe,getInjectionPreview:Iae,getSpecStats:Pae,getSpecsList:Aae,getSystemSettings:kae,getV2Jobs:ioe,importSettings:dae,initializeCsrfToken:nU,installCcwMcp:ose,installCcwMcpToCodex:lse,installCliTool:Hoe,installMcpTemplate:Ooe,installRecommendedHooks:Tae,isHttpMcpServer:xoe,isStdioMcpServer:MU,mergeQueues:SU,moveQueueItem:xU,normalizeTask:IU,pauseCliSession:HU,previewExtractionQueue:ooe,pullIssuesFromGitHub:Mie,readSkillFile:Uie,rebuildSpecIndex:Oae,refreshCodexCliEnhancement:oae,removeRecentPath:lU,reorderQueueGroup:_U,resizeCliSession:UU,resumeCliSession:qU,saveHook:Xoe,saveMcpTemplate:Poe,searchFiles:xse,searchMcpTemplates:Ioe,sendCliSessionText:cA,splitQueue:CU,switchWorkspace:cU,syncApiConfig:Hse,testProvider:Pse,toggleChineseResponse:eae,toggleCliEndpoint:zoe,toggleCliSettingsEnabled:Kse,toggleCodexCliEnhancement:iae,toggleCommand:qie,toggleCommandGroup:Wie,toggleHook:Koe,toggleMcpServer:Eoe,toggleRule:Joe,toggleWindowsPlatform:rae,triggerConsolidation:roe,triggerExtraction:eoe,triggerProviderHealthCheck:Ase,triggerReindex:Eae,triggerSelectiveExtraction:soe,unarchiveMemory:Jie,unarchiveTeam:pae,uninstallCcwMcp:sse,uninstallCcwMcpFromCodex:cse,uninstallCcwMcpFromScope:ase,uninstallCliTool:qoe,updateCacheSettings:Dse,updateCcwConfig:ise,updateCcwConfigForCodex:use,updateCliEndpoint:$oe,updateCliSettings:Vse,updateEndpoint:Rse,updateIssue:pU,updateMcpServer:woe,updateMemory:Zie,updateModelPool:Bse,updateProjectGuidelines:AU,updateProvider:kse,updateRule:Yoe,updateTaskStatus:hoe,upgradeCcwInstallation:cae,upgradeCliTool:Woe,uploadAttachments:Nie,validateCommandImport:Vie,validateSkillImport:Fie},Symbol.toStringTag,{value:"Module"})),WU="ccw-workflow-store",jae=()=>{var e;try{const t=localStorage.getItem(WU);if(t){const r=JSON.parse(t);return((e=r==null?void 0:r.state)==null?void 0:e.projectPath)||""}}catch{}return""},Dae=e=>{try{localStorage.setItem(WU,JSON.stringify({state:{projectPath:e},version:1}))}catch{}},Wo=e=>`session-${e}`.replace(/[^a-zA-Z0-9-]/g,"-"),VU={status:null,search:"",dateRange:{start:null,end:null}},GU={field:"created_at",direction:"desc"},Lae={workflowData:{activeSessions:[],archivedSessions:[]},projectPath:jae(),recentPaths:[],serverPlatform:"win32",sessionDataStore:{},liteTaskDataStore:{},taskJsonStore:{},activeSessionId:null,filters:VU,sorting:GU},Rt=gn()(im((e,t)=>({...Lae,setSessions:(r,n)=>{const i={};[...r,...n].forEach(o=>{const s=Wo(o.session_id);i[s]=o}),e({workflowData:{activeSessions:r,archivedSessions:n},sessionDataStore:i},!1)},addSession:r=>{const n=Wo(r.session_id);e(i=>({workflowData:{...i.workflowData,activeSessions:[...i.workflowData.activeSessions,r]},sessionDataStore:{...i.sessionDataStore,[n]:r}}),!1)},updateSession:(r,n)=>{const i=Wo(r);e(o=>{const s=o.sessionDataStore[i];if(!s)return o;const a={...s,...n,updated_at:new Date().toISOString()},c=s.location==="active"?"activeSessions":"archivedSessions";return{sessionDataStore:{...o.sessionDataStore,[i]:a},workflowData:{...o.workflowData,[c]:o.workflowData[c].map(d=>d.session_id===r?a:d)}}},!1)},removeSession:r=>{const n=Wo(r);e(i=>{const{[n]:o,...s}=i.sessionDataStore;return{sessionDataStore:s,workflowData:{activeSessions:i.workflowData.activeSessions.filter(a=>a.session_id!==r),archivedSessions:i.workflowData.archivedSessions.filter(a=>a.session_id!==r)}}},!1)},archiveSession:r=>{const n=Wo(r);e(i=>{const o=i.sessionDataStore[n];if(!o||o.location==="archived")return i;const s={...o,location:"archived",status:"archived",updated_at:new Date().toISOString()};return{sessionDataStore:{...i.sessionDataStore,[n]:s},workflowData:{activeSessions:i.workflowData.activeSessions.filter(a=>a.session_id!==r),archivedSessions:[...i.workflowData.archivedSessions,s]}}},!1)},addTask:(r,n)=>{const i=Wo(r);e(o=>{var c;const s=o.sessionDataStore[i];if(!s||((c=s.tasks)==null?void 0:c.find(d=>d.task_id===n.task_id)))return o;const l={...s,tasks:[...s.tasks||[],n],updated_at:new Date().toISOString()};return{sessionDataStore:{...o.sessionDataStore,[i]:l}}},!1)},updateTask:(r,n,i)=>{const o=Wo(r);e(s=>{const a=s.sessionDataStore[o];if(!(a!=null&&a.tasks))return s;const l=a.tasks.map(d=>d.task_id===n?{...d,...i,updated_at:new Date().toISOString()}:d),c={...a,tasks:l,updated_at:new Date().toISOString()};return{sessionDataStore:{...s.sessionDataStore,[o]:c}}},!1)},removeTask:(r,n)=>{const i=Wo(r);e(o=>{const s=o.sessionDataStore[i];if(!(s!=null&&s.tasks))return o;const a={...s,tasks:s.tasks.filter(l=>l.task_id!==n),updated_at:new Date().toISOString()};return{sessionDataStore:{...o.sessionDataStore,[i]:a}}},!1)},setLiteTaskSession:(r,n)=>{e(i=>({liteTaskDataStore:{...i.liteTaskDataStore,[r]:n}}),!1)},removeLiteTaskSession:r=>{e(n=>{const{[r]:i,...o}=n.liteTaskDataStore;return{liteTaskDataStore:o}},!1)},setTaskJson:(r,n)=>{e(i=>({taskJsonStore:{...i.taskJsonStore,[r]:n}}),!1)},removeTaskJson:r=>{e(n=>{const{[r]:i,...o}=n.taskJsonStore;return{taskJsonStore:o}},!1)},setActiveSessionId:r=>{e({activeSessionId:r},!1)},setProjectPath:r=>{e({projectPath:r},!1)},addRecentPath:r=>{e(n=>{const i=n.recentPaths.filter(s=>s!==r);return{recentPaths:[r,...i].slice(0,10)}},!1)},setServerPlatform:r=>{e({serverPlatform:r},!1)},switchWorkspace:async r=>{const n=await cU(r),i={};[...n.activeSessions,...n.archivedSessions].forEach(s=>{const a=Wo(s.session_id);i[a]=s}),e({projectPath:n.projectPath,recentPaths:n.recentPaths,workflowData:{activeSessions:n.activeSessions,archivedSessions:n.archivedSessions},sessionDataStore:i},!1),Dae(n.projectPath);const o=t()._invalidateQueriesCallback;o&&o()},removeRecentPath:async r=>{const n=await lU(r);e({recentPaths:n},!1)},refreshRecentPaths:async()=>{const r=await aU();e({recentPaths:r},!1)},registerQueryInvalidator:r=>{e({_invalidateQueriesCallback:r},!1)},setFilters:r=>{e(n=>({filters:{...n.filters,...r}}),!1)},setSorting:r=>{e(n=>({sorting:{...n.sorting,...r}}),!1)},resetFilters:()=>{e({filters:VU,sorting:GU},!1)},getActiveSession:()=>{const{activeSessionId:r,sessionDataStore:n}=t();if(!r)return null;const i=Wo(r);return n[i]||null},getFilteredSessions:()=>{const{workflowData:r,filters:n,sorting:i}=t();let o=[...r.activeSessions,...r.archivedSessions];if(n.status&&n.status.length>0&&(o=o.filter(s=>n.status.includes(s.status))),n.search){const s=n.search.toLowerCase();o=o.filter(a=>{var l,c;return a.session_id.toLowerCase().includes(s)||((l=a.title)==null?void 0:l.toLowerCase().includes(s))||((c=a.description)==null?void 0:c.toLowerCase().includes(s))})}return(n.dateRange.start||n.dateRange.end)&&(o=o.filter(s=>{const a=new Date(s.created_at);return!(n.dateRange.start&&a<n.dateRange.start||n.dateRange.end&&a>n.dateRange.end)})),o.sort((s,a)=>{let l=0;switch(i.field){case"created_at":l=new Date(s.created_at).getTime()-new Date(a.created_at).getTime();break;case"updated_at":l=new Date(s.updated_at||s.created_at).getTime()-new Date(a.updated_at||a.created_at).getTime();break;case"title":l=(s.title||s.session_id).localeCompare(a.title||a.session_id);break;case"status":l=s.status.localeCompare(a.status);break}return i.direction==="desc"?-l:l}),o},getSessionByKey:r=>t().sessionDataStore[r]}),{name:"ccw-workflow-store",partialize:e=>({projectPath:e.projectPath}),skipHydration:!0})),fr=e=>e.projectPath,$ae={gemini:{enabled:!0,tags:["analysis","debug"],type:"builtin"},qwen:{enabled:!0,tags:[],type:"builtin"},codex:{enabled:!0,tags:[],type:"builtin"},claude:{enabled:!0,tags:[],type:"builtin"},opencode:{enabled:!0,tags:[],type:"builtin"}},KU={base:"/api",sessions:"/api/sessions",tasks:"/api/tasks",loops:"/api/loops",issues:"/api/issues",orchestrator:"/api/orchestrator"},XU={autoRefresh:!0,refreshInterval:3e4,notificationsEnabled:!0,soundEnabled:!1,compactView:!1,showCompletedTasks:!0,defaultSessionFilter:"all",defaultSortField:"created_at",defaultSortDirection:"desc"},ZU={dialogStyle:"modal",smartModeEnabled:!0,autoSelectionDuration:30,autoSelectionSoundEnabled:!1,pauseOnInteraction:!0,showA2UIButtonInToolbar:!0,drawerSide:"right",drawerSize:"md"},Bae={cliTools:$ae,defaultCliTool:"gemini",apiEndpoints:KU,userPreferences:XU,a2uiPreferences:ZU,featureFlags:{orchestratorEnabled:!0,darkModeEnabled:!0,notificationsEnabled:!0,experimentalFeatures:!1,dashboardQueuePanelEnabled:!1,dashboardInspectorEnabled:!1,dashboardExecutionMonitorEnabled:!1}};function Fae(){var e;if(typeof window>"u"||!((e=window.location)!=null&&e.origin))return null;try{return new URL("/api/cli/config",window.location.origin).toString()}catch{return null}}function zae(e){var o;const t=(o=e==null?void 0:e.config)==null?void 0:o.tools;if(!t||typeof t!="object")return null;const r=["builtin","cli-wrapper","api-endpoint"],n=s=>typeof s=="string"&&r.includes(s),i={};for(const[s,a]of Object.entries(t)){const l=a;i[s]={enabled:typeof l.enabled=="boolean"?l.enabled:!1,primaryModel:typeof l.primaryModel=="string"?l.primaryModel:"",secondaryModel:typeof l.secondaryModel=="string"?l.secondaryModel:"",tags:Array.isArray(l.tags)?l.tags.filter(c=>typeof c=="string"):[],type:n(l.type)?l.type:"builtin",envFile:typeof l.envFile=="string"?l.envFile:void 0,settingsFile:typeof l.settingsFile=="string"?l.settingsFile:void 0,availableModels:Array.isArray(l.availableModels)?l.availableModels.filter(c=>typeof c=="string"):void 0}}return Object.keys(i).length>0?i:null}let ih=null;async function Uae(e=!1){return!e&&ih||(ih=(async()=>{const t=Fae();if(!t)return;const n=await(await fetch(t)).json(),i=zae(n);i&&kk.getState().loadConfig({cliTools:i})})().catch(t=>{console.warn("[ConfigStore] Backend config sync failed, using local state:",t)}).finally(()=>{ih=null})),ih}const kk=gn()(En(im((e,t)=>({...Bae,setCliTools:r=>{e({cliTools:r},!1,"setCliTools")},updateCliTool:(r,n)=>{e(i=>({cliTools:{...i.cliTools,[r]:{...i.cliTools[r],...n}}}),!1,"updateCliTool")},setDefaultCliTool:r=>{var i;const{cliTools:n}=t();(i=n[r])!=null&&i.enabled&&e({defaultCliTool:r},!1,"setDefaultCliTool")},setApiEndpoints:r=>{e(n=>({apiEndpoints:{...n.apiEndpoints,...r}}),!1,"setApiEndpoints")},setUserPreferences:r=>{e(n=>({userPreferences:{...n.userPreferences,...r}}),!1,"setUserPreferences")},resetUserPreferences:()=>{e({userPreferences:XU},!1,"resetUserPreferences")},setA2uiPreferences:r=>{e({a2uiPreferences:r},!1,"setA2uiPreferences")},resetA2uiPreferences:()=>{e({a2uiPreferences:ZU},!1,"resetA2uiPreferences")},setFeatureFlag:(r,n)=>{e(i=>({featureFlags:{...i.featureFlags,[r]:n}}),!1,"setFeatureFlag")},loadConfig:r=>{e(n=>({...n,...r,cliTools:r.cliTools||n.cliTools,apiEndpoints:{...n.apiEndpoints,...r.apiEndpoints||{}},userPreferences:{...n.userPreferences,...r.userPreferences||{}},featureFlags:{...n.featureFlags,...r.featureFlags||{}}}),!1,"loadConfig")}}),{name:"ccw-config-store",version:1,migrate:(e,t)=>t===0?{...e,apiEndpoints:e.apiEndpoints||KU}:e,partialize:e=>({cliTools:e.cliTools,defaultCliTool:e.defaultCliTool,apiEndpoints:e.apiEndpoints,userPreferences:e.userPreferences,featureFlags:e.featureFlags})}),{name:"ConfigStore"})),uze=e=>e.cliTools,dze=e=>e.defaultCliTool,fze=e=>e.userPreferences,uA="ccw_notifications",Hae=100,qae=10080*60*1e3,Wae=[/\b[A-Za-z0-9_-]{20,}\b/g,/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,/\b[A-Za-z0-9+/=]{32,}={0,2}\b/g],Vae=e=>{const t=r=>{if(!r)return null;let n=r;for(const o of Wae)n=n.replace(o,"[REDACTED]");const i=500;return n.length>i&&(n=n.substring(0,i)+"..."),n};return{...e,title:t(e.title)||e.title,message:t(e.message)||e.message,a2uiSurface:void 0,a2uiState:void 0}},Xx=()=>`toast-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,QU=()=>{if(typeof window>"u")return[];try{const e=localStorage.getItem(uA);if(e){const t=JSON.parse(e),r=Date.now()-qae;return t.filter(n=>new Date(n.timestamp).getTime()>r)}}catch(e){console.error("[NotificationStore] Failed to load from storage:",e)}return[]},cu=e=>{if(!(typeof window>"u"))try{const r=e.slice(0,Hae).map(Vae);localStorage.setItem(uA,JSON.stringify(r))}catch(t){console.error("[NotificationStore] Failed to save to storage:",t)}},Gae={toasts:[],maxToasts:5,wsStatus:"disconnected",wsLastMessage:null,wsReconnectAttempts:0,isPanelVisible:!1,persistentNotifications:[],a2uiSurfaces:new Map,currentQuestion:null,currentPopupCard:null,actionStates:new Map},lt=gn()(En((e,t)=>({...Gae,addToast:r=>{const n=Xx(),i={...r,id:n,timestamp:new Date().toISOString(),dismissible:r.dismissible??!0,duration:r.duration??5e3};return e(o=>{const{maxToasts:s}=o;let a=[...o.toasts,i];return a.length>s&&(a=a.slice(-s)),{toasts:a}},!1,"addToast"),i.duration&&i.duration>0&&setTimeout(()=>{t().removeToast(n)},i.duration),n},removeToast:r=>{e(n=>({toasts:n.toasts.filter(i=>i.id!==r)}),!1,"removeToast")},clearAllToasts:()=>{e({toasts:[]},!1,"clearAllToasts")},setWsStatus:r=>{e({wsStatus:r},!1,"setWsStatus")},setWsLastMessage:r=>{e({wsLastMessage:r},!1,"setWsLastMessage")},incrementReconnectAttempts:()=>{e(r=>({wsReconnectAttempts:r.wsReconnectAttempts+1}),!1,"incrementReconnectAttempts")},resetReconnectAttempts:()=>{e({wsReconnectAttempts:0},!1,"resetReconnectAttempts")},togglePanel:()=>{e(r=>({isPanelVisible:!r.isPanelVisible}),!1,"togglePanel")},setPanelVisible:r=>{e({isPanelVisible:r},!1,"setPanelVisible")},addPersistentNotification:r=>{const n=Xx(),i={...r,id:n,timestamp:new Date().toISOString(),dismissible:r.dismissible??!0};e(s=>({persistentNotifications:[i,...s.persistentNotifications]}),!1,"addPersistentNotification");const o=t();cu(o.persistentNotifications)},removePersistentNotification:r=>{e(i=>({persistentNotifications:i.persistentNotifications.filter(o=>o.id!==r)}),!1,"removePersistentNotification");const n=t();cu(n.persistentNotifications)},clearPersistentNotifications:()=>{e({persistentNotifications:[]},!1,"clearPersistentNotifications"),typeof window<"u"&&localStorage.removeItem(uA)},loadPersistentNotifications:()=>{const r=QU();e({persistentNotifications:r},!1,"loadPersistentNotifications")},savePersistentNotifications:()=>{const r=t();cu(r.persistentNotifications)},markAllAsRead:()=>{e(n=>({persistentNotifications:n.persistentNotifications.map(i=>({...i,read:!0}))}),!1,"markAllAsRead");const r=t();cu(r.persistentNotifications)},toggleNotificationRead:r=>{e(n=>{const i=n.toasts.findIndex(a=>a.id===r),o=n.persistentNotifications.findIndex(a=>a.id===r);if(i===-1&&o===-1)return n;const s={...n};if(i!==-1){const a=[...n.toasts];a[i]={...a[i],read:!a[i].read},s.toasts=a}if(o!==-1){const a=[...n.persistentNotifications];a[o]={...a[o],read:!a[o].read},s.persistentNotifications=a,cu(a)}return s},!1,"toggleNotificationRead")},setActionState:(r,n)=>{e(i=>{const o=new Map(i.actionStates);return o.set(r,n),{actionStates:o}},!1,"setActionState")},executeAction:async(r,n,i)=>{const o=i||`${n}-${r.label}`,s=t(),a=s.actionStates.get(o);if((a==null?void 0:a.status)==="loading"||r.disabled)return;const l=new Map(s.actionStates);l.set(o,{status:"loading",lastAttempt:new Date().toISOString()}),e({actionStates:l});try{await r.onClick();const c=new Map(t().actionStates);c.set(o,{status:"success",lastAttempt:new Date().toISOString()}),e({actionStates:c})}catch(c){const d=new Map(t().actionStates);d.set(o,{status:"error",error:c instanceof Error?c.message:String(c),lastAttempt:new Date().toISOString()}),e({actionStates:d})}},retryAction:async r=>{if(!t().actionStates.get(r)){console.warn(`[NotificationStore] No action state found for key: ${r}`);return}t().setActionState(r,{status:"idle",lastAttempt:new Date().toISOString()})},addA2UINotification:(r,n="A2UI Surface")=>{if(r.displayMode==="popup")return e(a=>{const l=new Map(a.a2uiSurfaces);return l.set(r.surfaceId,r),{currentPopupCard:r,a2uiSurfaces:l}},!1,"addA2UINotification (popup)"),r.surfaceId;const i=Xx(),o={id:i,type:"a2ui",title:n,timestamp:new Date().toISOString(),dismissible:!0,duration:0,a2uiSurface:r,a2uiState:r.initialState||{},read:!1};e(a=>{const l=new Map(a.a2uiSurfaces);return l.set(r.surfaceId,r),{persistentNotifications:[o,...a.persistentNotifications],a2uiSurfaces:l,isPanelVisible:!0}},!1,"addA2UINotification (panel)");const s=t();return cu(s.persistentNotifications),i},updateA2UIState:(r,n)=>{e(i=>{const o=new Map(i.a2uiSurfaces),s=o.get(r);s&&o.set(r,{...s,initialState:{...s.initialState,...n}});const a=i.toasts.map(c=>c.a2uiSurface&&c.a2uiSurface.surfaceId===r?{...c,a2uiState:{...c.a2uiState,...n},a2uiSurface:s?{...c.a2uiSurface,initialState:{...c.a2uiSurface.initialState,...n}}:c.a2uiSurface}:c),l=i.persistentNotifications.map(c=>c.a2uiSurface&&c.a2uiSurface.surfaceId===r?{...c,a2uiState:{...c.a2uiState,...n},a2uiSurface:s?{...c.a2uiSurface,initialState:{...c.a2uiSurface.initialState,...n}}:c.a2uiSurface}:c);return{toasts:a,persistentNotifications:l,a2uiSurfaces:o}},!1,"updateA2UIState")},sendA2UIAction:(r,n,i={})=>{const o=new CustomEvent("a2ui-action",{detail:{type:"a2ui-action",actionId:r,surfaceId:n,parameters:i}});window.dispatchEvent(o)},setCurrentQuestion:r=>{e({currentQuestion:r},!1,"setCurrentQuestion")},setCurrentPopupCard:r=>{e({currentPopupCard:r},!1,"setCurrentPopupCard")}}),{name:"NotificationStore"}));if(typeof window<"u"){const e=QU();e.length>0&<.setState({persistentNotifications:e})}const Kae=e=>e.toasts,Xae=e=>e.wsStatus,YU=e=>e.wsLastMessage,Zae=e=>e.isPanelVisible,JU=e=>e.persistentNotifications,Qae=e=>e.currentQuestion,Yae=e=>e.currentPopupCard,hze={info:(e,t)=>lt.getState().addToast({type:"info",title:e,message:t}),success:(e,t)=>lt.getState().addToast({type:"success",title:e,message:t}),warning:(e,t)=>lt.getState().addToast({type:"warning",title:e,message:t}),error:(e,t)=>lt.getState().addToast({type:"error",title:e,message:t,duration:0})};function Jae(){const e=lt(Kae),t=lt(Xae),r=lt(YU),n=lt(Zae),i=lt(JU),o=lt(U=>U.addToast),s=lt(U=>U.removeToast),a=lt(U=>U.clearAllToasts),l=lt(U=>U.setWsStatus),c=lt(U=>U.setWsLastMessage),d=lt(U=>U.togglePanel),u=lt(U=>U.setPanelVisible),p=lt(U=>U.addPersistentNotification),g=lt(U=>U.removePersistentNotification),_=lt(U=>U.clearPersistentNotifications),y=t==="connected",m=O.useCallback((U,q,V,K)=>o({type:U,title:q,message:V,duration:K==null?void 0:K.duration,dismissible:K==null?void 0:K.dismissible,action:K==null?void 0:K.action}),[o]),v=O.useCallback((U,q)=>m("info",U,q),[m]),b=O.useCallback((U,q)=>m("success",U,q),[m]),x=O.useCallback((U,q)=>m("warning",U,q),[m]),E=O.useCallback((U,q)=>m("error",U,q,{duration:0}),[m]),C=O.useCallback(U=>{s(U)},[s]),k=O.useCallback(()=>{a()},[a]),P=O.useCallback(U=>{l(U)},[l]),T=O.useCallback(U=>{c(U)},[c]),I=O.useCallback(()=>{d()},[d]),N=O.useCallback(U=>{u(U)},[u]),B=O.useCallback((U,q,V)=>{p({type:U,title:q,message:V})},[p]),M=O.useCallback(U=>{g(U)},[g]),F=O.useCallback(()=>{_()},[_]);return{toasts:e,wsStatus:t,wsLastMessage:r,isWsConnected:y,isPanelVisible:n,persistentNotifications:i,addToast:m,info:v,success:b,warning:x,error:E,removeToast:C,clearAllToasts:k,setWsStatus:P,setWsLastMessage:T,togglePanel:I,setPanelVisible:N,addPersistentNotification:B,removePersistentNotification:M,clearPersistentNotifications:F}}const $M={"prompt-template":{defaultData:{label:"New Step",instruction:"",outputName:void 0,tool:void 0,mode:void 0,contextRefs:[]}}},ele=[{id:"slash-command-main",label:"Slash Command",description:"Execute /workflow commands (main thread)",icon:"Terminal",color:"bg-rose-500",category:"command",data:{label:"Slash Command",instruction:"",slashCommand:"",slashArgs:"",mode:"mainprocess",nodeCategory:"command"}},{id:"slash-command-async",label:"Slash Command (Async)",description:"Execute /workflow commands (background)",icon:"Terminal",color:"bg-rose-400",category:"command",data:{label:"Slash Command (Async)",instruction:"",slashCommand:"",slashArgs:"",mode:"async",nodeCategory:"command"}}],eH="ccw-orchestrator-custom-templates";function tH(){try{const e=localStorage.getItem(eH);return e?JSON.parse(e):[]}catch{return[]}}function BM(e){try{localStorage.setItem(eH,JSON.stringify(e))}catch(t){console.error("Failed to save custom templates:",t)}}const Hg=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,uu="/api/orchestrator",FM=50,tle=100,rle=80,nle=20;function zM(e,t,r){let n=e,i=t;for(let o=0;o<nle;o++){if(!r.some(a=>{const l=Math.abs(a.position.x-n),c=Math.abs(a.position.y-i);return l<FM&&c<FM}))return{x:n,y:i};n+=tle,i+=rle}return{x:n,y:i}}const ile={currentFlow:null,isModified:!1,nodes:[],edges:[],selectedNodeId:null,selectedEdgeId:null,flows:[],isLoadingFlows:!1,isPaletteOpen:!0,isPropertyPanelOpen:!1,leftPanelTab:"nodes",customTemplates:tH(),interactionMode:"pan"},ole=gn()(En((e,t)=>({...ile,setCurrentFlow:r=>{e({currentFlow:r,nodes:(r==null?void 0:r.nodes)??[],edges:(r==null?void 0:r.edges)??[],isModified:!1,selectedNodeId:null,selectedEdgeId:null},!1,"setCurrentFlow")},createFlow:(r,n)=>{const i={id:Hg("flow"),name:r,description:n,version:1,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),nodes:[],edges:[],variables:{},metadata:{source:"custom"}};return e({currentFlow:i,nodes:[],edges:[],isModified:!0,selectedNodeId:null,selectedEdgeId:null},!1,"createFlow"),i},saveFlow:async()=>{const{currentFlow:r,nodes:n,edges:i}=t();if(!r)return!1;try{const o={...r,nodes:n,edges:i,updated_at:new Date().toISOString()},s=!t().flows.some(p=>p.id===r.id),a=s?"POST":"PUT",l=s?`${uu}/flows`:`${uu}/flows/${r.id}`,c=await fetch(l,{method:a,headers:{"Content-Type":"application/json"},body:JSON.stringify(o),credentials:"same-origin"});if(!c.ok)throw new Error(`Failed to save flow: ${c.statusText}`);const d=await c.json(),u=d&&typeof d=="object"&&"data"in d?d.data:d;return e(p=>({currentFlow:u,isModified:!1,flows:s?[...p.flows,u]:p.flows.map(g=>g.id===u.id?u:g)}),!1,"saveFlow"),!0}catch(o){return console.error("Error saving flow:",o),!1}},loadFlow:async r=>{try{const n=await fetch(`${uu}/flows/${r}`,{credentials:"same-origin"});if(!n.ok)throw new Error(`Failed to load flow: ${n.statusText}`);const i=await n.json(),o=i&&typeof i=="object"&&"data"in i?i.data:i;return e({currentFlow:o,nodes:o.nodes,edges:o.edges,isModified:!1,selectedNodeId:null,selectedEdgeId:null},!1,"loadFlow"),!0}catch(n){return console.error("Error loading flow:",n),!1}},deleteFlow:async r=>{try{const n=await fetch(`${uu}/flows/${r}`,{method:"DELETE",credentials:"same-origin"});if(!n.ok)throw new Error(`Failed to delete flow: ${n.statusText}`);return e(i=>{var o,s,a;return{flows:i.flows.filter(l=>l.id!==r),currentFlow:((o=i.currentFlow)==null?void 0:o.id)===r?null:i.currentFlow,nodes:((s=i.currentFlow)==null?void 0:s.id)===r?[]:i.nodes,edges:((a=i.currentFlow)==null?void 0:a.id)===r?[]:i.edges}},!1,"deleteFlow"),!0}catch(n){return console.error("Error deleting flow:",n),!1}},duplicateFlow:async r=>{try{const n=await fetch(`${uu}/flows/${r}/duplicate`,{method:"POST",credentials:"same-origin"});if(!n.ok)throw new Error(`Failed to duplicate flow: ${n.statusText}`);const i=await n.json(),o=i&&typeof i=="object"&&"data"in i?i.data:i;return e(s=>({flows:[...s.flows,o]}),!1,"duplicateFlow"),o}catch(n){return console.error("Error duplicating flow:",n),null}},addNode:r=>{const n=$M["prompt-template"],i=Hg("node"),o=zM(r.x,r.y,t().nodes),s={id:i,type:"prompt-template",position:o,data:{...n.defaultData}};return e(a=>({nodes:[...a.nodes,s],isModified:!0,selectedNodeId:i}),!1,"addNode"),i},addNodeFromTemplate:(r,n)=>{const i=ele.find(d=>d.id===r)||t().customTemplates.find(d=>d.id===r);if(!i)return console.error(`Template not found: ${r}`),t().addNode(n);const o=Hg("node"),s=$M["prompt-template"],a=zM(n.x,n.y,t().nodes),l={...s.defaultData,...i.data,label:i.data.label||i.label,contextRefs:i.data.contextRefs||[]},c={id:o,type:"prompt-template",position:a,data:l};return e(d=>({nodes:[...d.nodes,c],isModified:!0,selectedNodeId:o}),!1,"addNodeFromTemplate"),o},updateNode:(r,n)=>{e(i=>({nodes:i.nodes.map(o=>o.id===r?{...o,data:{...o.data,...n}}:o),isModified:!0}),!1,"updateNode")},removeNode:r=>{e(n=>({nodes:n.nodes.filter(i=>i.id!==r),edges:n.edges.filter(i=>i.source!==r&&i.target!==r),isModified:!0,selectedNodeId:n.selectedNodeId===r?null:n.selectedNodeId}),!1,"removeNode")},setNodes:r=>{e({nodes:r,isModified:!0},!1,"setNodes")},addEdge:(r,n,i,o)=>{const s=Hg("edge"),a={id:s,source:r,target:n,sourceHandle:i,targetHandle:o};return e(l=>({edges:[...l.edges,a],isModified:!0}),!1,"addEdge"),s},updateEdge:(r,n)=>{e(i=>({edges:i.edges.map(o=>o.id===r?{...o,data:{...o.data,...n}}:o),isModified:!0}),!1,"updateEdge")},removeEdge:r=>{e(n=>({edges:n.edges.filter(i=>i.id!==r),isModified:!0,selectedEdgeId:n.selectedEdgeId===r?null:n.selectedEdgeId}),!1,"removeEdge")},setEdges:r=>{e({edges:r,isModified:!0},!1,"setEdges")},setSelectedNodeId:r=>{e({selectedNodeId:r,selectedEdgeId:null,isPropertyPanelOpen:r!==null},!1,"setSelectedNodeId")},setSelectedEdgeId:r=>{e({selectedEdgeId:r,selectedNodeId:null},!1,"setSelectedEdgeId")},fetchFlows:async()=>{e({isLoadingFlows:!0},!1,"fetchFlows/start");try{const r=await fetch(`${uu}/flows`,{credentials:"same-origin"});if(!r.ok)throw new Error(`Failed to fetch flows: ${r.statusText}`);const n=await r.json(),i=Array.isArray(n==null?void 0:n.data)?n.data:(n==null?void 0:n.flows)||[];e({flows:i,isLoadingFlows:!1},!1,"fetchFlows/success")}catch(r){console.error("Error fetching flows:",r),e({isLoadingFlows:!1},!1,"fetchFlows/error")}},setIsPaletteOpen:r=>{e({isPaletteOpen:r},!1,"setIsPaletteOpen")},setIsPropertyPanelOpen:r=>{e({isPropertyPanelOpen:r},!1,"setIsPropertyPanelOpen")},setLeftPanelTab:r=>{e({leftPanelTab:r},!1,"setLeftPanelTab")},toggleInteractionMode:()=>{e(r=>({interactionMode:r.interactionMode==="pan"?"selection":"pan"}),!1,"toggleInteractionMode")},setInteractionMode:r=>{e({interactionMode:r},!1,"setInteractionMode")},addCustomTemplate:r=>{e(n=>{const i=[...n.customTemplates,r];return BM(i),{customTemplates:i}},!1,"addCustomTemplate")},removeCustomTemplate:r=>{e(n=>{const i=n.customTemplates.filter(o=>o.id!==r);return BM(i),{customTemplates:i}},!1,"removeCustomTemplate")},saveNodeAsTemplate:(r,n,i)=>{const o=t().nodes.find(u=>u.id===r);if(!o)return null;const{executionStatus:s,executionError:a,executionResult:l,...c}=o.data,d={id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,label:n,description:i,icon:"MessageSquare",color:"bg-blue-500",category:"command",data:{...c,label:n}};return t().addCustomTemplate(d),d},loadCustomTemplates:()=>{e({customTemplates:tH()},!1,"loadCustomTemplates")},resetFlow:()=>{e({currentFlow:null,nodes:[],edges:[],isModified:!1,selectedNodeId:null,selectedEdgeId:null},!1,"resetFlow")},getSelectedNode:()=>{const{nodes:r,selectedNodeId:n}=t();return r.find(i=>i.id===n)},markModified:()=>{e({isModified:!0},!1,"markModified")}}),{name:"FlowStore"})),sle=500,ale={currentExecution:null,nodeStates:{},logs:[],maxLogs:sle,nodeOutputs:{},nodeToolCalls:{},selectedNodeId:null,isMonitorPanelOpen:!1,autoScrollLogs:!0},lle=gn()(En((e,t)=>({...ale,startExecution:(r,n)=>{const i=new Date().toISOString();e({currentExecution:{execId:r,flowId:n,status:"running",startedAt:i,elapsedMs:0},nodeStates:{},logs:[]},!1,"startExecution")},setExecutionStatus:(r,n)=>{e(i=>i.currentExecution?{currentExecution:{...i.currentExecution,status:r,currentNodeId:n??i.currentExecution.currentNodeId}}:i,!1,"setExecutionStatus")},completeExecution:r=>{const n=new Date().toISOString();e(i=>{if(!i.currentExecution)return i;const o=new Date(i.currentExecution.startedAt).getTime(),s=Date.now()-o;return{currentExecution:{...i.currentExecution,status:r,completedAt:n,elapsedMs:s,currentNodeId:void 0}}},!1,"completeExecution")},clearExecution:()=>{e({currentExecution:null,nodeStates:{},logs:[]},!1,"clearExecution")},setNodeStarted:r=>{const n=new Date().toISOString();e(i=>({nodeStates:{...i.nodeStates,[r]:{nodeId:r,status:"running",startedAt:n}}}),!1,"setNodeStarted")},setNodeCompleted:(r,n)=>{const i=new Date().toISOString();e(o=>({nodeStates:{...o.nodeStates,[r]:{...o.nodeStates[r],nodeId:r,status:"completed",completedAt:i,result:n}}}),!1,"setNodeCompleted")},setNodeFailed:(r,n)=>{const i=new Date().toISOString();e(o=>({nodeStates:{...o.nodeStates,[r]:{...o.nodeStates[r],nodeId:r,status:"failed",completedAt:i,error:n}}}),!1,"setNodeFailed")},clearNodeStates:()=>{e({nodeStates:{}},!1,"clearNodeStates")},addLog:r=>{e(n=>{const i=[...n.logs,r];return i.length>n.maxLogs?{logs:i.slice(-n.maxLogs)}:{logs:i}},!1,"addLog")},clearLogs:()=>{e({logs:[]},!1,"clearLogs")},setMonitorPanelOpen:r=>{e({isMonitorPanelOpen:r},!1,"setMonitorPanelOpen")},setAutoScrollLogs:r=>{e({autoScrollLogs:r},!1,"setAutoScrollLogs")},addNodeOutput:(r,n)=>{e(i=>{const o=i.nodeOutputs[r];return o?{nodeOutputs:{...i.nodeOutputs,[r]:{...o,outputs:[...o.outputs,n]}}}:{nodeOutputs:{...i.nodeOutputs,[r]:{nodeId:r,outputs:[n],toolCalls:[],logs:[],variables:{},startTime:Date.now()}}}},!1,"addNodeOutput")},clearNodeOutputs:r=>{e(n=>{const i={...n.nodeOutputs};return delete i[r],{nodeOutputs:i}},!1,"clearNodeOutputs")},startToolCall:(r,n,i)=>{const o={callId:n,nodeId:r,status:"executing",kind:i.kind,subtype:i.subtype,description:i.description,startTime:Date.now(),outputLines:[],outputBuffer:{stdout:"",stderr:"",combined:""}};e(s=>{const a=s.nodeToolCalls[r]||[];return{nodeToolCalls:{...s.nodeToolCalls,[r]:[...a,o]}}},!1,"startToolCall")},updateToolCall:(r,n,i)=>{e(o=>{const s=o.nodeToolCalls[r];if(!s)return o;const a=s.findIndex(d=>d.callId===n);if(a===-1)return o;const l=[...s],c=l[a];if(i.status&&(c.status=i.status,i.status!=="executing"&&!c.endTime&&(c.endTime=Date.now(),c.duration=c.endTime-c.startTime)),i.outputChunk!==void 0){const d={type:i.stream==="stderr"?"stderr":"stdout",content:i.outputChunk,timestamp:Date.now()};c.outputLines.push(d),i.stream==="stderr"?(c.outputBuffer.stderr+=i.outputChunk,c.outputBuffer.combined+=i.outputChunk):(c.outputBuffer.stdout+=i.outputChunk,c.outputBuffer.combined+=i.outputChunk)}return l[a]=c,{nodeToolCalls:{...o.nodeToolCalls,[r]:l}}},!1,"updateToolCall")},completeToolCall:(r,n,i)=>{e(o=>{const s=o.nodeToolCalls[r];if(!s)return o;const a=s.findIndex(d=>d.callId===n);if(a===-1)return o;const l=[...s],c={...l[a]};return c.status=i.status,c.endTime=Date.now(),c.duration=c.endTime-c.startTime,i.exitCode!==void 0&&(c.exitCode=i.exitCode),i.error!==void 0&&(c.error=i.error),i.result!==void 0&&(c.result=i.result),l[a]=c,{nodeToolCalls:{...o.nodeToolCalls,[r]:l}}},!1,"completeToolCall")},toggleToolCallExpanded:(r,n)=>{e(i=>{const o=i.nodeToolCalls[r];if(!o)return i;const s=o.findIndex(l=>l.callId===n);if(s===-1)return i;const a=[...o];return a[s]={...a[s],isExpanded:!a[s].isExpanded},{nodeToolCalls:{...i.nodeToolCalls,[r]:a}}},!1,"toggleToolCallExpanded")},selectNode:r=>{e({selectedNodeId:r},!1,"selectNode")},getNodeOutputs:r=>t().nodeOutputs[r],getToolCallsForNode:r=>t().nodeToolCalls[r]||[]}),{name:"ExecutionStore"})),pze=e=>{var t;return((t=e.currentExecution)==null?void 0:t.status)==="running"},cle="cli-viewer-storage",ule=1,UM=e=>`pane-${e}`,dle=e=>`tab-${e}`,Zh=e=>typeof e=="string",fle=(e,t)=>{const r=(n,i)=>{for(let o=0;o<n.children.length;o++){const s=n.children[o];if(Zh(s)){if(s===t)return{found:!0,parent:n,index:o}}else{const a=r(s);if(a.found)return a}}return{found:!1,parent:null,index:-1}};return r(e)},hle=(e,t)=>{const r=i=>{const o=[];for(const l of i.children)if(Zh(l))l!==t&&o.push(l);else{const c=r(l);c&&c.children.length>0&&(c.children.length===1?o.push(c.children[0]):o.push(c))}if(o.length===0)return null;const s=i.sizes?i.sizes.filter((l,c)=>{const d=i.children[c];return!Zh(d)||d!==t}):void 0,a=s?(()=>{const l=s.reduce((c,d)=>c+d,0);return l>0?s.map(c=>c/l*100):void 0})():void 0;return{direction:i.direction,sizes:a,children:o}};return r(e)||{direction:"horizontal",children:[]}},ple=(e,t,r,n="horizontal")=>{if(!r){if(e.children.length===0)return{...e,children:[t],sizes:[100]};if(e.direction===n){const o=e.sizes||e.children.map(()=>100/e.children.length),s=o.reduce((c,d)=>c+d,0),a=s/(e.children.length+1),l=(s-a)/s;return{...e,children:[...e.children,t],sizes:[...o.map(c=>c*l),a]}}return{direction:n,sizes:[50,50],children:[e,t]}}const i=o=>{const s=[];let a=o.sizes?[]:void 0;for(let l=0;l<o.children.length;l++){const c=o.children[l],d=o.sizes?o.sizes[l]:void 0;if(Zh(c))if(c===r)if(o.direction===n){const u=(d||50)/2;s.push(c,t),a&&a.push(u,u)}else{const u={direction:n,sizes:[50,50],children:[c,t]};s.push(u),a&&d!==void 0&&a.push(d)}else s.push(c),a&&d!==void 0&&a.push(d);else fle(c,r).found?s.push(i(c)):s.push(c),a&&d!==void 0&&a.push(d)}return{...o,children:s,sizes:a}};return i(e)},qg=e=>{const t=[],r=n=>{for(const i of n.children)Zh(i)?t.push(i):r(i)};return r(e),t},rH=()=>({direction:"horizontal",children:[]}),mle={layout:rH(),panes:{},tabs:{},focusedPaneId:null,nextPaneIdCounter:1,nextTabIdCounter:1},dA=gn()(im(En((e,t)=>({...mle,setLayout:r=>{if(typeof r=="function"){const n=t().layout,i=r(n);e({layout:i},!1,"viewer/setLayout")}else e({layout:r},!1,"viewer/setLayout")},addPane:(r,n="horizontal")=>{const i=t(),o=UM(i.nextPaneIdCounter),s={id:o,tabs:[],activeTabId:null},a=ple(i.layout,o,r,n);return e({layout:a,panes:{...i.panes,[o]:s},focusedPaneId:o,nextPaneIdCounter:i.nextPaneIdCounter+1},!1,"viewer/addPane"),o},removePane:r=>{const n=t(),i=n.panes[r];if(!i){console.warn(`[ViewerStore] Pane not found: ${r}`);return}if(qg(n.layout).length<=1){console.warn("[ViewerStore] Cannot remove the last pane");return}const s=hle(n.layout,r),a={...n.panes};delete a[r];const l={...n.tabs};for(const d of i.tabs)delete l[d.id];let c=n.focusedPaneId;if(c===r){const d=qg(s);c=d.length>0?d[0]:null}e({layout:s,panes:a,tabs:l,focusedPaneId:c},!1,"viewer/removePane")},addTab:(r,n,i)=>{const o=t(),s=o.panes[r];if(!s)return console.warn(`[ViewerStore] Pane not found: ${r}`),"";const a=s.tabs.find(p=>p.executionId===n);if(a)return e({panes:{...o.panes,[r]:{...s,activeTabId:a.id}},focusedPaneId:r},!1,"viewer/addTab-existing"),a.id;for(const[p,g]of Object.entries(o.panes)){if(p===r)continue;const _=g.tabs.find(y=>y.executionId===n);if(_)return e({panes:{...o.panes,[p]:{...g,activeTabId:_.id}},focusedPaneId:p},!1,"viewer/addTab-existing-global"),_.id}const l=dle(o.nextTabIdCounter),c=s.tabs.reduce((p,g)=>Math.max(p,g.order),0),d={id:l,executionId:n,title:i,isPinned:!1,order:c+1},u={...s,tabs:[...s.tabs,d],activeTabId:l};return e({panes:{...o.panes,[r]:u},tabs:{...o.tabs,[l]:d},focusedPaneId:r,nextTabIdCounter:o.nextTabIdCounter+1},!1,"viewer/addTab"),l},removeTab:(r,n)=>{const i=t(),o=i.panes[r];if(!o){console.warn(`[ViewerStore] Pane not found: ${r}`);return}const s=o.tabs.findIndex(u=>u.id===n);if(s===-1){console.warn(`[ViewerStore] Tab not found: ${n}`);return}const a=o.tabs.filter(u=>u.id!==n);let l=null;if(o.activeTabId===n&&a.length>0){const u=Math.min(s,a.length-1);l=a[u].id}else o.activeTabId!==n&&(l=o.activeTabId);const c={...o,tabs:a,activeTabId:l},d={...i.tabs};delete d[n],e({panes:{...i.panes,[r]:c},tabs:d},!1,"viewer/removeTab"),a.length===0&&qg(t().layout).length>1&&queueMicrotask(()=>{var g;const p=t();((g=p.panes[r])==null?void 0:g.tabs.length)===0&&p.removePane(r)})},setActiveTab:(r,n)=>{const i=t(),o=i.panes[r];if(!o){console.warn(`[ViewerStore] Pane not found: ${r}`);return}if(!o.tabs.find(a=>a.id===n)){console.warn(`[ViewerStore] Tab not found in pane: ${n}`);return}e({panes:{...i.panes,[r]:{...o,activeTabId:n}},focusedPaneId:r},!1,"viewer/setActiveTab")},moveTab:(r,n,i,o)=>{const s=t(),a=s.panes[r],l=s.panes[i];if(!a||!l){console.warn("[ViewerStore] Source or target pane not found");return}const c=a.tabs.findIndex(x=>x.id===n);if(c===-1){console.warn(`[ViewerStore] Tab not found: ${n}`);return}const d=a.tabs[c],u=a.tabs.filter(x=>x.id!==n);let p=a.activeTabId;if(a.activeTabId===n&&u.length>0){const x=Math.min(c,u.length-1);p=u[x].id}else a.activeTabId===n&&(p=null);let g;if(r===i){const x=[...u].sort((E,C)=>E.order-C.order);if(o===0)g=x.length>0?x[0].order-1:1;else if(o>=x.length)g=x.length>0?x[x.length-1].order+1:1;else{const E=x[o-1].order,C=x[o].order;g=(E+C)/2}}else{const x=[...l.tabs].sort((E,C)=>E.order-C.order);if(o===0)g=x.length>0?x[0].order-1:1;else if(o>=x.length)g=x.length>0?x[x.length-1].order+1:1;else{const E=x[o-1].order,C=x[o].order;g=(E+C)/2}}const _={...d,order:g};let y;r===i?y=[...u,_]:y=[...l.tabs,_];const m={...a,tabs:r===i?y:u,activeTabId:r===i?n:p},v=r===i?m:{...l,tabs:y,activeTabId:n},b={...s.panes,[r]:m};r!==i&&(b[i]=v),e({panes:b,tabs:{...s.tabs,[n]:_},focusedPaneId:i},!1,"viewer/moveTab"),r!==i&&u.length===0&&qg(t().layout).length>1&&queueMicrotask(()=>{var C;const E=t();((C=E.panes[r])==null?void 0:C.tabs.length)===0&&E.removePane(r)})},togglePinTab:r=>{const n=t(),i=n.tabs[r];if(!i){console.warn(`[ViewerStore] Tab not found: ${r}`);return}const o={...i,isPinned:!i.isPinned},s={...n.panes};for(const a of Object.keys(s)){const l=s[a];if(l.tabs.findIndex(d=>d.id===r)!==-1){s[a]={...l,tabs:l.tabs.map(d=>d.id===r?o:d)};break}}e({tabs:{...n.tabs,[r]:o},panes:s},!1,"viewer/togglePinTab")},setFocusedPane:r=>{if(!t().panes[r]){console.warn(`[ViewerStore] Pane not found: ${r}`);return}e({focusedPaneId:r},!1,"viewer/setFocusedPane")},initializeDefaultLayout:r=>{let i=t().nextPaneIdCounter;const o=()=>({id:UM(i++),tabs:[],activeTabId:null});let s;const a={};switch(r){case"single":{const c=o();a[c.id]=c,s={direction:"horizontal",sizes:[100],children:[c.id]};break}case"split-h":{const c=o(),d=o();a[c.id]=c,a[d.id]=d,s={direction:"horizontal",sizes:[50,50],children:[c.id,d.id]};break}case"split-v":{const c=o(),d=o();a[c.id]=c,a[d.id]=d,s={direction:"vertical",sizes:[50,50],children:[c.id,d.id]};break}case"grid-2x2":{const c=o(),d=o(),u=o(),p=o();a[c.id]=c,a[d.id]=d,a[u.id]=u,a[p.id]=p,s={direction:"vertical",sizes:[50,50],children:[{direction:"horizontal",sizes:[50,50],children:[c.id,d.id]},{direction:"horizontal",sizes:[50,50],children:[u.id,p.id]}]};break}default:return}const l=Object.keys(a)[0]||null;e({layout:s,panes:a,tabs:{},focusedPaneId:l,nextPaneIdCounter:i,nextTabIdCounter:1},!1,"viewer/initializeDefaultLayout")},reset:()=>{e({layout:rH(),panes:{},tabs:{},focusedPaneId:null,nextPaneIdCounter:1,nextTabIdCounter:1},!1,"viewer/reset")}}),{name:"ViewerStore"}),{name:cle,version:ule,partialize:e=>({layout:e.layout,panes:e.panes,tabs:e.tabs,focusedPaneId:e.focusedPaneId,nextPaneIdCounter:e.nextPaneIdCounter,nextTabIdCounter:e.nextTabIdCounter})})),mze=()=>dA(e=>e.layout),gze=()=>dA(e=>e.panes),vze=()=>dA(e=>e.focusedPaneId),yze=(e,t)=>{const r=e.panes[t];return!r||!r.activeTabId?null:r.tabs.find(n=>n.id===r.activeTabId)||null},HM={isPanelOpen:!1,activeTerminalId:null,panelView:"terminal",terminalOrder:[]},Fn=gn()(En((e,t)=>({...HM,openTerminal:r=>{const{terminalOrder:n}=t(),i=n.includes(r)?n:[...n,r];e({isPanelOpen:!0,activeTerminalId:r,panelView:"terminal",terminalOrder:i},!1,"openTerminal")},closePanel:()=>{e({isPanelOpen:!1},!1,"closePanel")},togglePanel:()=>{const{isPanelOpen:r,activeTerminalId:n,terminalOrder:i}=t();if(r)e({isPanelOpen:!1},!1,"togglePanel/close");else{const o=n??i[0]??null;e({isPanelOpen:!0,activeTerminalId:o,panelView:o?"terminal":"queue"},!1,"togglePanel/open")}},setActiveTerminal:r=>{e({activeTerminalId:r},!1,"setActiveTerminal")},setPanelView:r=>{e({panelView:r},!1,"setPanelView")},addTerminal:r=>{const{terminalOrder:n}=t();n.includes(r)||e({terminalOrder:[...n,r]},!1,"addTerminal")},removeTerminal:r=>{const{terminalOrder:n,activeTerminalId:i}=t(),o=n.filter(a=>a!==r);let s=i;if(i===r){const a=n.indexOf(r);o.length===0?s=null:a>=o.length?s=o[o.length-1]:s=o[a]}e({terminalOrder:o,activeTerminalId:s,isPanelOpen:o.length>0?t().isPanelOpen:!1},!1,"removeTerminal")},resetState:()=>{e({...HM},!1,"resetState")}}),{name:"TerminalPanelStore"})),gle=e=>e.terminalOrder.length;function bze(){return Fn(t=>t.openTerminal)}const qM={executions:{}},Ud=gn()(En(e=>({...qM,addExecution:t=>{e(r=>({executions:{...r.executions,[t.id]:t}}),!1,"addExecution")},updateStatus:(t,r,n)=>{e(i=>{const o=i.executions[t];if(!o)return i;const s=r==="completed"||r==="failed";return{executions:{...i.executions,[t]:{...o,status:r,completedAt:s?new Date().toISOString():o.completedAt,error:n??o.error}}}},!1,"updateStatus")},removeExecution:t=>{e(r=>{const{[t]:n,...i}=r.executions;return{executions:i}},!1,"removeExecution")},clearCompleted:()=>{e(t=>{const r={};for(const[n,i]of Object.entries(t.executions))i.status!=="completed"&&i.status!=="failed"&&(r[n]=i);return{executions:r}},!1,"clearCompleted")},resetState:()=>{e({...qM},!1,"resetState")}}),{name:"QueueExecutionStore"})),vle=[],yle=e=>t=>{const r=Object.values(t.executions).filter(n=>n.queueItemId===e);return r.length===0?vle:r};function ble(e,t){return e.dependsOn.every(r=>{const n=t[r];return n&&(n.status==="completed"||n.status==="skipped")})}function WM(e,t){for(const r of e.steps){const n=t[r.id];if(n&&n.status==="pending"&&ble(r,t))return r.id}return null}function _le(e){return Object.values(e).every(t=>t.status==="completed"||t.status==="skipped"||t.status==="failed")}const VM={activePlans:{}},Bl=gn()(En((e,t)=>({...VM,startOrchestration:(r,n)=>{const i={};for(const s of r.steps)i[s.id]={status:"pending",retryCount:0};const o={plan:r,status:"running",currentStepIndex:0,stepStatuses:i,executionIdMap:{},sessionKey:n};e(s=>({activePlans:{...s.activePlans,[r.id]:o}}),!1,"startOrchestration")},pauseOrchestration:r=>{e(n=>{const i=n.activePlans[r];return!i||i.status!=="running"?n:{activePlans:{...n.activePlans,[r]:{...i,status:"paused"}}}},!1,"pauseOrchestration")},resumeOrchestration:r=>{e(n=>{const i=n.activePlans[r];return!i||i.status!=="paused"?n:{activePlans:{...n.activePlans,[r]:{...i,status:"running"}}}},!1,"resumeOrchestration")},stopOrchestration:(r,n)=>{e(i=>{const o=i.activePlans[r];return o?{activePlans:{...i.activePlans,[r]:{...o,status:"failed",error:n??"Orchestration stopped by user"}}}:i},!1,"stopOrchestration")},updateStepStatus:(r,n,i,o)=>{e(s=>{const a=s.activePlans[r];if(!a)return s;const l=a.stepStatuses[n];if(!l)return s;const c=new Date().toISOString(),d=i==="running",u=i==="completed"||i==="failed"||i==="skipped";return{activePlans:{...s.activePlans,[r]:{...a,stepStatuses:{...a.stepStatuses,[n]:{...l,status:i,startedAt:d?c:l.startedAt,completedAt:u?c:l.completedAt,result:(o==null?void 0:o.data)??l.result,error:(o==null?void 0:o.error)??l.error}}}}}},!1,"updateStepStatus")},registerExecution:(r,n,i)=>{e(o=>{const s=o.activePlans[r];return s?{activePlans:{...o.activePlans,[r]:{...s,executionIdMap:{...s.executionIdMap,[i]:n}}}}:o},!1,"registerExecution")},retryStep:(r,n)=>{e(i=>{const o=i.activePlans[r];if(!o)return i;const s=o.stepStatuses[n];return s?{activePlans:{...i.activePlans,[r]:{...o,status:"running",stepStatuses:{...o.stepStatuses,[n]:{...s,status:"pending",error:void 0,result:void 0,startedAt:void 0,completedAt:void 0,retryCount:s.retryCount+1}}}}}:i},!1,"retryStep")},skipStep:(r,n)=>{e(i=>{const o=i.activePlans[r];if(!o)return i;const s=o.stepStatuses[n];return s?{activePlans:{...i.activePlans,[r]:{...o,stepStatuses:{...o.stepStatuses,[n]:{...s,status:"skipped",completedAt:new Date().toISOString()}}}}}:i},!1,"skipStep")},_advanceToNextStep:r=>{const i=t().activePlans[r];if(!i||i.status!=="running")return null;const o=WM(i.plan,i.stepStatuses);if(o){const s=i.plan.steps.findIndex(a=>a.id===o);return e(a=>{const l=a.activePlans[r];return l?{activePlans:{...a.activePlans,[r]:{...l,currentStepIndex:s>=0?s:l.currentStepIndex}}}:a},!1,"_advanceToNextStep"),o}if(_le(i.stepStatuses)){const s=Object.values(i.stepStatuses).some(a=>a.status==="failed");e(a=>{const l=a.activePlans[r];return l?{activePlans:{...a.activePlans,[r]:{...l,status:s?"failed":"completed"}}}:a},!1,"_advanceToNextStep/complete")}return null},getNextReadyStep:r=>{const i=t().activePlans[r];return!i||i.status!=="running"?null:WM(i.plan,i.stepStatuses)},removePlan:r=>{e(n=>{const{[r]:i,...o}=n.activePlans;return{activePlans:o}},!1,"removePlan")},clearAll:()=>{e(VM,!1,"clearAll")}}),{name:"OrchestratorStore"})),xle=e=>e.activePlans,wle=e=>Object.values(e.activePlans).filter(t=>t.status==="running"||t.status==="paused").length,Sle=2*1024*1024,Cle=new TextEncoder;function Zx(e){return Cle.encode(e).length}const GM={sessions:{},outputChunks:{},outputBytes:{}},li=gn()(En((e,t)=>({...GM,setSessions:r=>e(n=>{const i={};for(const l of r)i[l.sessionKey]=l;const o=new Set(Object.keys(i)),s={...n.outputChunks},a={...n.outputBytes};for(const l of Object.keys(s))o.has(l)||delete s[l];for(const l of Object.keys(a))o.has(l)||delete a[l];return{sessions:i,outputChunks:s,outputBytes:a}}),upsertSession:r=>e(n=>({sessions:{...n.sessions,[r.sessionKey]:r}})),removeSession:r=>e(n=>{const i={...n.sessions},o={...n.outputChunks},s={...n.outputBytes};return delete i[r],delete o[r],delete s[r],{sessions:i,outputChunks:o,outputBytes:s}}),updateSessionPausedState:(r,n)=>e(i=>{const o=i.sessions[r];return o?{sessions:{...i.sessions,[r]:{...o,isPaused:n,updatedAt:new Date().toISOString()}}}:i}),resetState:()=>e({...GM}),setBuffer:(r,n)=>e(i=>({outputChunks:{...i.outputChunks,[r]:n?[{data:n,timestamp:Date.now()}]:[]},outputBytes:{...i.outputBytes,[r]:n?Zx(n):0}})),appendOutput:(r,n,i=Date.now())=>{if(!n)return;const o=Zx(n),{outputChunks:s,outputBytes:a}=t(),l=s[r]??[],c=a[r]??0,d=[...l,{data:n,timestamp:i}];let u=c+o;for(;u>Sle&&d.length>0;){const p=d.shift();p&&(u-=Zx(p.data))}e(p=>({outputChunks:{...p.outputChunks,[r]:d},outputBytes:{...p.outputBytes,[r]:Math.max(0,u)}}))},clearOutput:r=>e(n=>({outputChunks:{...n.outputChunks,[r]:[]},outputBytes:{...n.outputBytes,[r]:0}}))}),{name:"cliSessionStore"})),KM={groups:[],layout:{grid:"1x1",splits:[1]},activeTerminalId:null,terminalMetas:{}};let ri=null;function Ele(e){Hd.getState().updateTerminalMeta(e.sessionKey,{status:"locked",isLocked:!0,lockReason:e.reason,lockedByExecutionId:e.executionId,lockedAt:e.timestamp})}function kle(e){const t=Hd.getState(),r=t.terminalMetas[e.sessionKey];r!=null&&r.isLocked&&t.updateTerminalMeta(e.sessionKey,{status:"active",isLocked:!1,lockReason:void 0,lockedByExecutionId:void 0,lockedAt:void 0})}function Tle(e){const t=e.data;if(t.type!=="alert")return;const{sessionId:r,severity:n,message:i}=t,o={critical:"error",warning:"idle"},s=Hd.getState(),a=s.terminalMetas[r],l=(a==null?void 0:a.alertCount)??0;s.updateTerminalMeta(r,{status:o[n]??"idle",alertCount:l+1})}const Hd=gn()(En(e=>({...KM,createGroup:t=>{const n={id:`group-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,name:t,sessionIds:[]};e(i=>({groups:[...i.groups,n]}),!1,"createGroup")},removeGroup:t=>{e(r=>({groups:r.groups.filter(n=>n.id!==t)}),!1,"removeGroup")},moveSessionToGroup:(t,r)=>{e(n=>({groups:n.groups.map(o=>{const s=o.sessionIds.filter(a=>a!==t);return o.id===r?{...o,sessionIds:[...s,t]}:{...o,sessionIds:s}})}),!1,"moveSessionToGroup")},setActiveTerminal:t=>{e({activeTerminalId:t},!1,"setActiveTerminal")},updateTerminalMeta:(t,r)=>{e(n=>{const i=n.terminalMetas[t]??{title:t,status:"idle",alertCount:0};return{terminalMetas:{...n.terminalMetas,[t]:{...i,...r}}}},!1,"updateTerminalMeta")},resetState:()=>{ri&&(ri.terminate(),ri=null),e({...KM},!1,"resetState")},setGroupLayout:t=>{e({layout:t},!1,"setGroupLayout")},spawnMonitor:()=>{if(!ri)try{ri=new Worker(new URL("/assets/monitor.worker-CVRNUIeJ.js",import.meta.url),{type:"module"}),ri.onmessage=Tle,ri.onerror=t=>{}}catch{ri=null}},terminateMonitor:()=>{ri&&(ri.terminate(),ri=null)},feedMonitor:(t,r)=>{ri||Hd.getState().spawnMonitor(),ri&&ri.postMessage({type:"output",sessionId:t,text:r})},pauseSession:async t=>{const r=fr(Rt.getState());try{await HU(t,r??void 0),e(n=>{const i=n.terminalMetas[t];return i?{terminalMetas:{...n.terminalMetas,[t]:{...i,status:"paused"}}}:n},!1,"pauseSession")}catch(n){throw n}},resumeSession:async t=>{const r=fr(Rt.getState());e(n=>{const i=n.terminalMetas[t];return i?{terminalMetas:{...n.terminalMetas,[t]:{...i,status:"resuming"}}}:n},!1,"resumeSession/pending");try{await qU(t,r??void 0),e(n=>{const i=n.terminalMetas[t];return i?{terminalMetas:{...n.terminalMetas,[t]:{...i,status:"active"}}}:n},!1,"resumeSession/fulfilled")}catch(n){throw e(i=>{const o=i.terminalMetas[t];return o?{terminalMetas:{...i.terminalMetas,[t]:{...o,status:"paused"}}}:i},!1,"resumeSession/rejected"),n}},restartSession:async t=>{const r=fr(Rt.getState()),i=li.getState().sessions[t];if(!i)throw new Error(`Session not found: ${t}`);const o={workingDir:i.workingDir,tool:i.tool,model:i.model,resumeKey:i.resumeKey,shellKind:i.shellKind},s=a=>a==="pwsh"||a==="powershell"?"pwsh":a==="cmd"?"cmd":"bash";try{await Vv(t,r??void 0);const a=await S0({workingDir:o.workingDir,preferredShell:s(o.shellKind),tool:o.tool,model:o.model,resumeKey:o.resumeKey},r??void 0);return e(l=>{const c=l.terminalMetas[t];return c?{terminalMetas:{...l.terminalMetas,[t]:{...c,status:"active",alertCount:0}}}:l},!1,"restartSession"),a}catch(a){throw a}},closeSession:async t=>{const r=fr(Rt.getState()),n=li.getState();try{await Vv(t,r??void 0),n.removeSession(t),e(i=>{const o={...i.terminalMetas};return delete o[t],{terminalMetas:o}},!1,"closeSession")}catch(i){throw i}},lockSession:(t,r,n)=>{e(i=>{const o=i.terminalMetas[t];return o?{terminalMetas:{...i.terminalMetas,[t]:{...o,status:"locked",isLocked:!0,lockReason:r,lockedByExecutionId:n,lockedAt:new Date().toISOString()}}}:i},!1,"lockSession")},unlockSession:t=>{e(r=>{const n=r.terminalMetas[t];return n?{terminalMetas:{...r.terminalMetas,[t]:{...n,status:"active",isLocked:!1,lockReason:void 0,lockedByExecutionId:void 0,lockedAt:void 0}}}:r},!1,"unlockSession")}}),{name:"SessionManagerStore"})),_ze=e=>e.activeTerminalId,xze=e=>e.terminalMetas,XM={selectedIssueId:null,associationChain:null},Tk=gn()(En(e=>({...XM,setSelectedIssue:t=>{if(t===null){e({selectedIssueId:null,associationChain:null},!1,"setSelectedIssue/clear");return}const r=ZM(t);e({selectedIssueId:t,associationChain:r},!1,"setSelectedIssue")},buildAssociationChain:(t,r)=>{let n;switch(r){case"issue":n=ZM(t);break;case"queue":n=Ple(t);break;case"session":n=Ale(t);break;default:n={issueId:null,queueItemId:null,sessionId:null}}e({associationChain:n,selectedIssueId:n.issueId},!1,"buildAssociationChain")},resetState:()=>{e({...XM},!1,"resetState")},_updateQueueItemStatus:(t,r,n)=>{const i=Ud.getState(),s=Object.values(i.executions).find(a=>a.queueItemId===t);s&&["pending","running","completed","failed"].includes(r)&&i.updateStatus(s.id,r),n&&e(a=>a.associationChain&&a.associationChain.queueItemId===t?{associationChain:{...a.associationChain,sessionId:n}}:a,!1,"_updateQueueItemStatus")}}),{name:"IssueQueueIntegrationStore"}));function ZM(e){const r=Object.values(Ud.getState().executions).find(n=>n.issueId===e);return r?{issueId:e,queueItemId:r.queueItemId,sessionId:r.sessionKey??null}:{issueId:e,queueItemId:null,sessionId:null}}function Ple(e){const r=Object.values(Ud.getState().executions).find(n=>n.queueItemId===e);return r?{issueId:r.issueId,queueItemId:e,sessionId:r.sessionKey??null}:{issueId:null,queueItemId:e,sessionId:null}}function Ale(e){const r=Object.values(Ud.getState().executions).find(n=>n.sessionKey===e);return r?{issueId:r.issueId,queueItemId:r.queueItemId,sessionId:e}:{issueId:null,queueItemId:null,sessionId:e}}const wze=e=>e.selectedIssueId,Ole=e=>e.associationChain;function Qh(e){return typeof e=="string"}function Ile(e,t){const r=(n,i)=>{for(let o=0;o<n.children.length;o++){const s=n.children[o];if(Qh(s)){if(s===t)return{found:!0,parent:n,index:o}}else{const a=r(s);if(a.found)return a}}return{found:!1,parent:null,index:-1}};return r(e)}function Rle(e,t){const r=i=>{const o=[];for(const l of i.children)if(Qh(l))l!==t&&o.push(l);else{const c=r(l);c&&c.children.length>0&&(c.children.length===1?o.push(c.children[0]):o.push(c))}if(o.length===0)return null;const s=i.sizes?i.sizes.filter((l,c)=>{const d=i.children[c];return!Qh(d)||d!==t}):void 0,a=s?(()=>{const l=s.reduce((c,d)=>c+d,0);return l>0?s.map(c=>c/l*100):void 0})():void 0;return{direction:i.direction,sizes:a,children:o}};return r(e)||{direction:"horizontal",children:[]}}function QM(e,t,r,n="horizontal"){if(!r){if(e.children.length===0)return{...e,children:[t],sizes:[100]};if(e.direction===n){const o=e.sizes||e.children.map(()=>100/e.children.length),s=o.reduce((c,d)=>c+d,0),a=s/(e.children.length+1),l=(s-a)/s;return{...e,children:[...e.children,t],sizes:[...o.map(c=>c*l),a]}}return{direction:n,sizes:[50,50],children:[e,t]}}const i=o=>{const s=[];let a=o.sizes?[]:void 0;for(let l=0;l<o.children.length;l++){const c=o.children[l],d=o.sizes?o.sizes[l]:void 0;if(Qh(c))if(c===r)if(o.direction===n){const u=(d||50)/2;s.push(c,t),a&&a.push(u,u)}else{const u={direction:n,sizes:[50,50],children:[c,t]};s.push(u),a&&d!==void 0&&a.push(d)}else s.push(c),a&&d!==void 0&&a.push(d);else Ile(c,r).found?s.push(i(c)):s.push(c),a&&d!==void 0&&a.push(d)}return{...o,children:s,sizes:a}};return i(e)}function YM(e){const t=[],r=n=>{for(const i of n.children)Qh(i)?t.push(i):r(i)};return r(e),t}const Nle="terminal-grid-storage",Mle=2;function jle(e){return{id:e.id,sessionId:e.sessionId,cliTool:e.cliTool??null,displayMode:e.displayMode??"terminal",filePath:e.filePath??null}}function Dle(e,t){if(t<2){const r=e,n={};for(const[i,o]of Object.entries(r.panes))n[i]=jle(o);return{layout:r.layout,panes:n,focusedPaneId:r.focusedPaneId,nextPaneIdCounter:r.nextPaneIdCounter}}return e}const Pv=e=>`tpane-${e}`;function Lle(){const e=Pv(1);return{layout:{direction:"horizontal",sizes:[100],children:[e]},panes:{[e]:{id:e,sessionId:null,cliTool:null,displayMode:"terminal",filePath:null}},focusedPaneId:e,nextPaneIdCounter:2}}const Wg=Lle(),JM={layout:Wg.layout,panes:Wg.panes,focusedPaneId:Wg.focusedPaneId,nextPaneIdCounter:Wg.nextPaneIdCounter},$le=gn()(im(En((e,t)=>({...JM,setLayout:r=>{e({layout:r},!1,"terminalGrid/setLayout")},updateLayoutSizes:r=>{const n=t().layout;JSON.stringify(n.sizes)!==JSON.stringify(r)&&e({layout:{...n,sizes:r}},!1,"terminalGrid/updateLayoutSizes")},splitPane:(r,n)=>{const i=t(),o=Pv(i.nextPaneIdCounter),s=QM(i.layout,o,r,n);return e({layout:s,panes:{...i.panes,[o]:{id:o,sessionId:null,cliTool:null,displayMode:"terminal",filePath:null}},focusedPaneId:o,nextPaneIdCounter:i.nextPaneIdCounter+1},!1,"terminalGrid/splitPane"),o},closePane:r=>{const n=t();if(YM(n.layout).length<=1)return;const o=Rle(n.layout,r),s={...n.panes};delete s[r];let a=n.focusedPaneId;if(a===r){const l=YM(o);a=l.length>0?l[0]:null}e({layout:o,panes:s,focusedPaneId:a},!1,"terminalGrid/closePane")},assignSession:(r,n,i)=>{const o=t(),s=o.panes[r];s&&e({panes:{...o.panes,[r]:{...s,sessionId:n,cliTool:i!==void 0?i??null:n?s.cliTool:null}}},!1,"terminalGrid/assignSession")},setFocused:r=>{t().panes[r]&&e({focusedPaneId:r},!1,"terminalGrid/setFocused")},resetLayout:r=>{let n=t().nextPaneIdCounter;const i=()=>({id:Pv(n++),sessionId:null,cliTool:null,displayMode:"terminal",filePath:null});let o;const s={};switch(r){case"single":{const l=i();s[l.id]=l,o={direction:"horizontal",sizes:[100],children:[l.id]};break}case"split-h":{const l=i(),c=i();s[l.id]=l,s[c.id]=c,o={direction:"horizontal",sizes:[50,50],children:[l.id,c.id]};break}case"split-v":{const l=i(),c=i();s[l.id]=l,s[c.id]=c,o={direction:"vertical",sizes:[50,50],children:[l.id,c.id]};break}case"grid-2x2":{const l=i(),c=i(),d=i(),u=i();s[l.id]=l,s[c.id]=c,s[d.id]=d,s[u.id]=u,o={direction:"vertical",sizes:[50,50],children:[{direction:"horizontal",sizes:[50,50],children:[l.id,c.id]},{direction:"horizontal",sizes:[50,50],children:[d.id,u.id]}]};break}default:return}const a=Object.keys(s)[0]||null;e({layout:o,panes:s,focusedPaneId:a,nextPaneIdCounter:n},!1,"terminalGrid/resetLayout")},resetWorkspaceState:()=>{const r=t(),n=Object.keys(r.panes);if(n.length===0){e({...JM},!1,"terminalGrid/resetWorkspaceState");return}const i=n.reduce((s,a)=>{const l=r.panes[a];return s[a]={...l,sessionId:null,cliTool:null,displayMode:"terminal",filePath:null},s},{}),o=r.focusedPaneId&&i[r.focusedPaneId]?r.focusedPaneId:n[0]??null;e({layout:r.layout,panes:i,focusedPaneId:o,nextPaneIdCounter:r.nextPaneIdCounter},!1,"terminalGrid/resetWorkspaceState")},createSessionAndAssign:async(r,n,i)=>{try{const s=(await S0(n,i??void 0)).session,a=t(),l=a.panes[r];if(!(l!=null&&l.sessionId))return e({panes:{...a.panes,[r]:{...l,sessionId:s.sessionKey,cliTool:s.tool??n.tool??null}},focusedPaneId:r},!1,"terminalGrid/createSessionAndAssign"),{paneId:r,session:s};const d=Pv(a.nextPaneIdCounter),u=QM(a.layout,d,r,"horizontal");return e({layout:u,panes:{...a.panes,[d]:{id:d,sessionId:s.sessionKey,cliTool:s.tool??n.tool??null,displayMode:"terminal",filePath:null}},focusedPaneId:d,nextPaneIdCounter:a.nextPaneIdCounter+1},!1,"terminalGrid/createSessionAndAssign"),{paneId:d,session:s}}catch(o){const s=o instanceof Error||o!=null&&o.message?o.message:String(o);throw console.error("Failed to create CLI session:",s,{config:n,projectPath:i,rawError:o}),new Error(s)}},setPaneDisplayMode:(r,n)=>{const i=t(),o=i.panes[r];o&&e({panes:{...i.panes,[r]:{...o,displayMode:n,filePath:n==="terminal"?null:o.filePath}}},!1,"terminalGrid/setPaneDisplayMode")},setPaneFilePath:(r,n)=>{const i=t(),o=i.panes[r];o&&e({panes:{...i.panes,[r]:{...o,filePath:n}}},!1,"terminalGrid/setPaneFilePath")},showFileInPane:(r,n)=>{const i=t(),o=i.panes[r];o&&e({panes:{...i.panes,[r]:{...o,displayMode:"file",filePath:n}},focusedPaneId:r},!1,"terminalGrid/showFileInPane")}}),{name:"TerminalGridStore"}),{name:Nle,version:Mle,migrate:Dle,partialize:e=>({layout:e.layout,panes:e.panes,focusedPaneId:e.focusedPaneId,nextPaneIdCounter:e.nextPaneIdCounter})})),Sze=e=>e.layout,Cze=e=>e.panes,Eze=e=>e.focusedPaneId,Qx={title:"",description:"",type:"other",priority:"medium",tags:[],project_id:void 0},Ble=[{id:"title",field:"title",title:"Issue 标题",description:"请输入一个简洁明确的标题"},{id:"description",field:"description",title:"Issue 描述",description:"请详细描述问题或需求"},{id:"type",field:"type",title:"Issue 类型",description:"选择 Issue 的类型"},{id:"priority",field:"priority",title:"优先级",description:"设置 Issue 的处理优先级",isOptional:!0},{id:"summary",field:"summary",title:"确认提交",description:"请确认以下信息后提交"}];gn()(En((e,t)=>({isOpen:!1,mode:"wizard",currentStep:0,steps:Ble,formData:{...Qx},validationErrors:{},isSubmitting:!1,submitError:null,submittedIssueId:null,openDialog:(r="wizard")=>{e({isOpen:!0,mode:r,currentStep:0,formData:{...Qx},validationErrors:{},submitError:null,submittedIssueId:null})},closeDialog:()=>{e({isOpen:!1,isSubmitting:!1})},goToStep:r=>{const{steps:n,validateCurrentStep:i}=t();if(r>=0&&r<n.length){if(r>t().currentStep&&!i())return;e({currentStep:r})}},nextStep:()=>{const{currentStep:r,steps:n,validateCurrentStep:i}=t();r<n.length-1&&i()&&e({currentStep:r+1})},prevStep:()=>{const{currentStep:r}=t();r>0&&e({currentStep:r-1})},updateField:(r,n)=>{e(i=>({formData:{...i.formData,[r]:n},validationErrors:{...i.validationErrors,[r]:void 0}}))},setFormData:r=>{e(n=>({formData:{...n.formData,...r}}))},resetForm:()=>{e({formData:{...Qx},validationErrors:{},currentStep:0,submitError:null,submittedIssueId:null})},validateCurrentStep:()=>{var a;const{currentStep:r,steps:n,formData:i}=t(),o=(a=n[r])==null?void 0:a.field;if(o==="summary")return!0;const s={};return o==="title"&&(i.title.trim()?i.title.length>200&&(s.title="标题不能超过200个字符"):s.title="标题不能为空"),o==="description"&&(i.description.trim()?i.description.length>1e4&&(s.description="描述不能超过10000个字符"):s.description="描述不能为空"),e({validationErrors:s}),Object.keys(s).length===0},submitIssue:async()=>{var n,i;const{formData:r}=t();e({isSubmitting:!0,submitError:null});try{const o=await fetch("/api/issues",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:`ISSUE-${Date.now()}`,title:r.title,context:r.description,priority:r.priority==="urgent"?1:r.priority==="high"?2:r.priority==="medium"?3:4,tags:r.tags,status:"registered"})}),s=await o.json();return!o.ok||s.error?(e({isSubmitting:!1,submitError:s.error||"提交失败,请稍后重试"}),{success:!1,error:s.error}):(e({isSubmitting:!1,submittedIssueId:(n=s.issue)==null?void 0:n.id}),{success:!0,issueId:(i=s.issue)==null?void 0:i.id})}catch(o){const s=o instanceof Error?o.message:"网络错误,请稍后重试";return e({isSubmitting:!1,submitError:s}),{success:!1,error:s}}}}),{name:"issue-dialog-store"}));const ej={activeExecutions:{},currentExecutionId:null,isPanelOpen:!1},fA=gn()(En(e=>({...ej,handleExecutionMessage:t=>{const{type:r,payload:n}=t,{executionId:i,flowId:o,sessionKey:s,stepId:a,stepName:l,totalSteps:c,output:d,error:u,timestamp:p}=n;e(g=>{const _=g.activeExecutions[i];switch(r){case"EXECUTION_STARTED":return{activeExecutions:{...g.activeExecutions,[i]:{executionId:i,flowId:o,flowName:l||"Workflow",sessionKey:s??"",status:"running",totalSteps:c||0,completedSteps:0,steps:[],startedAt:p}},currentExecutionId:i,isPanelOpen:!0};case"EXECUTION_STEP_START":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"running",currentStepId:a,steps:[..._.steps.filter(y=>y.id!==a),{id:a||"",name:l||"",status:"running",startedAt:p}]}}}:g;case"EXECUTION_STEP_PROGRESS":return!_||!a?g:{activeExecutions:{...g.activeExecutions,[i]:{..._,steps:_.steps.map(y=>y.id===a?{...y,output:(y.output||"")+(d||"")}:y)}}};case"EXECUTION_STEP_COMPLETE":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,completedSteps:_.completedSteps+1,steps:_.steps.map(y=>y.id===a?{...y,status:"completed",completedAt:p}:y)}}}:g;case"EXECUTION_STEP_FAILED":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"paused",steps:_.steps.map(y=>y.id===a?{...y,status:"failed",error:u,completedAt:p}:y)}}}:g;case"EXECUTION_PAUSED":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"paused"}}}:g;case"EXECUTION_RESUMED":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"running"}}}:g;case"EXECUTION_STOPPED":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"cancelled",completedAt:p}}}:g;case"EXECUTION_COMPLETED":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"completed",completedAt:p}}}:g;case"EXECUTION_FAILED":return _?{activeExecutions:{...g.activeExecutions,[i]:{..._,status:"failed",completedAt:p}}}:g;default:return g}},!1,`handleExecutionMessage/${r}`)},selectExecution:t=>{e({currentExecutionId:t},!1,"selectExecution")},pauseExecution:async t=>{try{const n=await(await fetch(`/api/orchestrator/executions/${t}/pause`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();n.success||console.error("[ExecutionMonitor] Pause failed:",n.error)}catch(r){console.error("[ExecutionMonitor] Pause error:",r)}},resumeExecution:async t=>{try{const n=await(await fetch(`/api/orchestrator/executions/${t}/resume`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();n.success||console.error("[ExecutionMonitor] Resume failed:",n.error)}catch(r){console.error("[ExecutionMonitor] Resume error:",r)}},stopExecution:async t=>{try{const n=await(await fetch(`/api/orchestrator/executions/${t}/stop`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();n.success||console.error("[ExecutionMonitor] Stop failed:",n.error)}catch(r){console.error("[ExecutionMonitor] Stop error:",r)}},setPanelOpen:t=>{e({isPanelOpen:t},!1,"setPanelOpen")},clearExecution:t=>{e(r=>{const n={...r.activeExecutions};return delete n[t],{activeExecutions:n,currentExecutionId:r.currentExecutionId===t?null:r.currentExecutionId}},!1,"clearExecution")},clearAllExecutions:()=>{e({activeExecutions:{},currentExecutionId:null},!1,"clearAllExecutions")},resetState:()=>{e({...ej},!1,"resetState")}}),{name:"ExecutionMonitorStore"})),kze=e=>e.activeExecutions,Tze=e=>e.currentExecutionId?e.activeExecutions[e.currentExecutionId]:null,Pze=e=>Object.values(e.activeExecutions).filter(t=>t.status==="running"||t.status==="paused").length;function _e(e,t,r){function n(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);const c=s.prototype,d=Object.keys(c);for(let u=0;u<d.length;u++){const p=d[u];p in a||(a[p]=c[p].bind(a))}}const i=(r==null?void 0:r.Parent)??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function s(a){var l;const c=r!=null&&r.Parent?new o:this;n(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const d of c._zod.deferred)d();return c}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>{var l,c;return r!=null&&r.Parent&&a instanceof r.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class Du extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class nH extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const iH={};function Ja(e){return iH}function oH(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function Pk(e,t){return typeof t=="bigint"?t.toString():t}function C0(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function hA(e){return e==null}function pA(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Fle(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){const l=n.match(/\d?e-(\d?)/);l!=null&&l[1]&&(i=Number.parseInt(l[1]))}const o=r>i?r:i,s=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return s%a/10**o}const tj=Symbol("evaluating");function Ht(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==tj)return n===void 0&&(n=tj,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Pc(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ac(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function rj(e){return JSON.stringify(e)}function zle(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const sH="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Yh(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ule=C0(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function id(e){if(Yh(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Yh(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function aH(e){return id(e)?{...e}:Array.isArray(e)?[...e]:e}const Hle=new Set(["string","number","symbol"]);function od(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ol(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r!=null&&r.parent)&&(n._zod.parent=e),n}function Qe(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function qle(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Wle={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Vle(e,t){const r=e._zod.def,n=Ac(e._zod.def,{get shape(){const i={};for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(i[o]=r.shape[o])}return Pc(this,"shape",i),i},checks:[]});return ol(e,n)}function Gle(e,t){const r=e._zod.def,n=Ac(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete i[o]}return Pc(this,"shape",i),i},checks:[]});return ol(e,n)}function Kle(e,t){if(!id(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const i=Ac(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return Pc(this,"shape",o),o},checks:[]});return ol(e,i)}function Xle(e,t){if(!id(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Pc(this,"shape",n),n},checks:e._zod.def.checks};return ol(e,r)}function Zle(e,t){const r=Ac(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Pc(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return ol(e,r)}function Qle(e,t,r){const n=Ac(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=e?new e({type:"optional",innerType:i[s]}):i[s])}else for(const s in i)o[s]=e?new e({type:"optional",innerType:i[s]}):i[s];return Pc(this,"shape",o),o},checks:[]});return ol(t,n)}function Yle(e,t,r){const n=Ac(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(r)for(const s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new e({type:"nonoptional",innerType:i[s]}))}else for(const s in i)o[s]=new e({type:"nonoptional",innerType:i[s]});return Pc(this,"shape",o),o},checks:[]});return ol(t,n)}function ku(e,t=0){var r;if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(((r=e.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function Tu(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Vg(e){return typeof e=="string"?e:e==null?void 0:e.message}function el(e,t,r){var i,o,s,a,l,c;const n={...e,path:e.path??[]};if(!e.message){const d=Vg((s=(o=(i=e.inst)==null?void 0:i._zod.def)==null?void 0:o.error)==null?void 0:s.call(o,e))??Vg((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??Vg((l=r.customError)==null?void 0:l.call(r,e))??Vg((c=r.localeError)==null?void 0:c.call(r,e))??"Invalid input";n.message=d}return delete n.inst,delete n.continue,t!=null&&t.reportInput||delete n.input,n}function mA(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Jh(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const lH=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Pk,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},cH=_e("$ZodError",lH),uH=_e("$ZodError",lH,{Parent:Error});function Jle(e,t=r=>r.message){const r={},n=[];for(const i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function ece(e,t=r=>r.message){const r={_errors:[]},n=i=>{for(const o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>n({issues:s}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let s=r,a=0;for(;a<o.path.length;){const l=o.path[a];a===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(t(o))):s[l]=s[l]||{_errors:[]},s=s[l],a++}}};return n(e),r}const gA=e=>(t,r,n,i)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Du;if(s.issues.length){const a=new((i==null?void 0:i.Err)??e)(s.issues.map(l=>el(l,o,Ja())));throw sH(a,i==null?void 0:i.callee),a}return s.value},vA=e=>async(t,r,n,i)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new((i==null?void 0:i.Err)??e)(s.issues.map(l=>el(l,o,Ja())));throw sH(a,i==null?void 0:i.callee),a}return s.value},E0=e=>(t,r,n)=>{const i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new Du;return o.issues.length?{success:!1,error:new(e??cH)(o.issues.map(s=>el(s,i,Ja())))}:{success:!0,data:o.value}},tce=E0(uH),k0=e=>async(t,r,n)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>el(s,i,Ja())))}:{success:!0,data:o.value}},rce=k0(uH),nce=e=>(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return gA(e)(t,r,i)},ice=e=>(t,r,n)=>gA(e)(t,r,n),oce=e=>async(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return vA(e)(t,r,i)},sce=e=>async(t,r,n)=>vA(e)(t,r,n),ace=e=>(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return E0(e)(t,r,i)},lce=e=>(t,r,n)=>E0(e)(t,r,n),cce=e=>async(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return k0(e)(t,r,i)},uce=e=>async(t,r,n)=>k0(e)(t,r,n),dce=/^[cC][^\s-]{8,}$/,fce=/^[0-9a-z]+$/,hce=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pce=/^[0-9a-vA-V]{20}$/,mce=/^[A-Za-z0-9]{27}$/,gce=/^[a-zA-Z0-9_-]{21}$/,vce=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,yce=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,nj=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,bce=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_ce="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function xce(){return new RegExp(_ce,"u")}const wce=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Sce=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Cce=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ece=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kce=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dH=/^[A-Za-z0-9_-]*$/,Tce=/^\+(?:[0-9]){6,14}[0-9]$/,fH="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Pce=new RegExp(`^${fH}$`);function hH(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ace(e){return new RegExp(`^${hH(e)}$`)}function Oce(e){const t=hH({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${fH}T(?:${n})$`)}const Ice=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Rce=/^-?\d+$/,Nce=/^-?\d+(?:\.\d+)?/,Mce=/^(?:true|false)$/i,jce=/^[^A-Z]*$/,Dce=/^[^a-z]*$/,ui=_e("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),pH={number:"number",bigint:"bigint",object:"date"},mH=_e("$ZodCheckLessThan",(e,t)=>{ui.init(e,t);const r=pH[typeof t.value];e._zod.onattach.push(n=>{const i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),gH=_e("$ZodCheckGreaterThan",(e,t)=>{ui.init(e,t);const r=pH[typeof t.value];e._zod.onattach.push(n=>{const i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Lce=_e("$ZodCheckMultipleOf",(e,t)=>{ui.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Fle(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),$ce=_e("$ZodCheckNumberFormat",(e,t)=>{var s;ui.init(e,t),t.format=t.format||"float64";const r=(s=t.format)==null?void 0:s.includes("int"),n=r?"int":"number",[i,o]=Wle[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=i,l.maximum=o,r&&(l.pattern=Rce)}),e._zod.check=a=>{const l=a.value;if(r){if(!Number.isInteger(l)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}l<i&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),l>o&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:o,inst:e})}}),Bce=_e("$ZodCheckMaxLength",(e,t)=>{var r;ui.init(e,t),(r=e._zod.def).when??(r.when=n=>{const i=n.value;return!hA(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{const i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const i=n.value;if(i.length<=t.maximum)return;const s=mA(i);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Fce=_e("$ZodCheckMinLength",(e,t)=>{var r;ui.init(e,t),(r=e._zod.def).when??(r.when=n=>{const i=n.value;return!hA(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{const i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const i=n.value;if(i.length>=t.minimum)return;const s=mA(i);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),zce=_e("$ZodCheckLengthEquals",(e,t)=>{var r;ui.init(e,t),(r=e._zod.def).when??(r.when=n=>{const i=n.value;return!hA(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{const i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{const i=n.value,o=i.length;if(o===t.length)return;const s=mA(i),a=o>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),T0=_e("$ZodCheckStringFormat",(e,t)=>{var r,n;ui.init(e,t),e._zod.onattach.push(i=>{const o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Uce=_e("$ZodCheckRegex",(e,t)=>{T0.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Hce=_e("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=jce),T0.init(e,t)}),qce=_e("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Dce),T0.init(e,t)}),Wce=_e("$ZodCheckIncludes",(e,t)=>{ui.init(e,t);const r=od(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),Vce=_e("$ZodCheckStartsWith",(e,t)=>{ui.init(e,t);const r=new RegExp(`^${od(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Gce=_e("$ZodCheckEndsWith",(e,t)=>{ui.init(e,t);const r=new RegExp(`.*${od(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Kce=_e("$ZodCheckOverwrite",(e,t)=>{ui.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Xce{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
523
523
|
`).filter(s=>s),i=Math.min(...n.map(s=>s.length-s.trimStart().length)),o=n.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of o)this.content.push(s)}compile(){const t=Function,r=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new t(...r,i.join(`
|
|
524
524
|
`))}}const Zce={major:4,minor:2,patch:1},Er=_e("$ZodType",(e,t)=>{var i;var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Zce;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),(i=e._zod.deferred)==null||i.push(()=>{e._zod.run=e._zod.parse});else{const o=(a,l,c)=>{let d=ku(a),u;for(const p of l){if(p._zod.def.when){if(!p._zod.def.when(a))continue}else if(d)continue;const g=a.issues.length,_=p._zod.check(a);if(_ instanceof Promise&&(c==null?void 0:c.async)===!1)throw new Du;if(u||_ instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await _,a.issues.length!==g&&(d||(d=ku(a,g)))});else{if(a.issues.length===g)continue;d||(d=ku(a,g))}}return u?u.then(()=>a):a},s=(a,l,c)=>{if(ku(a))return a.aborted=!0,a;const d=o(l,n,c);if(d instanceof Promise){if(c.async===!1)throw new Du;return d.then(u=>e._zod.parse(u,c))}return e._zod.parse(d,c)};e._zod.run=(a,l)=>{if(l.skipChecks)return e._zod.parse(a,l);if(l.direction==="backward"){const d=e._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return d instanceof Promise?d.then(u=>s(u,a,l)):s(d,a,l)}const c=e._zod.parse(a,l);if(c instanceof Promise){if(l.async===!1)throw new Du;return c.then(d=>o(d,n,l))}return o(c,n,l)}}e["~standard"]={validate:o=>{var s;try{const a=tce(e,o);return a.success?{value:a.data}:{issues:(s=a.error)==null?void 0:s.issues}}catch{return rce(e,o).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}}),yA=_e("$ZodString",(e,t)=>{var r;Er.init(e,t),e._zod.pattern=[...((r=e==null?void 0:e._zod.bag)==null?void 0:r.patterns)??[]].pop()??Ice(e._zod.bag),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),kr=_e("$ZodStringFormat",(e,t)=>{T0.init(e,t),yA.init(e,t)}),Qce=_e("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=yce),kr.init(e,t)}),Yce=_e("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=nj(n))}else t.pattern??(t.pattern=nj());kr.init(e,t)}),Jce=_e("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=bce),kr.init(e,t)}),eue=_e("$ZodURL",(e,t)=>{kr.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),tue=_e("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=xce()),kr.init(e,t)}),rue=_e("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=gce),kr.init(e,t)}),nue=_e("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=dce),kr.init(e,t)}),iue=_e("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=fce),kr.init(e,t)}),oue=_e("$ZodULID",(e,t)=>{t.pattern??(t.pattern=hce),kr.init(e,t)}),sue=_e("$ZodXID",(e,t)=>{t.pattern??(t.pattern=pce),kr.init(e,t)}),aue=_e("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=mce),kr.init(e,t)}),lue=_e("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Oce(t)),kr.init(e,t)}),cue=_e("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Pce),kr.init(e,t)}),uue=_e("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ace(t)),kr.init(e,t)}),due=_e("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vce),kr.init(e,t)}),fue=_e("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wce),kr.init(e,t),e._zod.bag.format="ipv4"}),hue=_e("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Sce),kr.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),pue=_e("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Cce),kr.init(e,t)}),mue=_e("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ece),kr.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[i,o]=n;if(!o)throw new Error;const s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function vH(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const gue=_e("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=kce),kr.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{vH(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function vue(e){if(!dH.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return vH(r)}const yue=_e("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=dH),kr.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{vue(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),bue=_e("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Tce),kr.init(e,t)});function _ue(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const i=JSON.parse(atob(n));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const xue=_e("$ZodJWT",(e,t)=>{kr.init(e,t),e._zod.check=r=>{_ue(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),yH=_e("$ZodNumber",(e,t)=>{Er.init(e,t),e._zod.pattern=e._zod.bag.pattern??Nce,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),wue=_e("$ZodNumberFormat",(e,t)=>{$ce.init(e,t),yH.init(e,t)}),Sue=_e("$ZodBoolean",(e,t)=>{Er.init(e,t),e._zod.pattern=Mce,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),Cue=_e("$ZodUnknown",(e,t)=>{Er.init(e,t),e._zod.parse=r=>r}),Eue=_e("$ZodNever",(e,t)=>{Er.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function ij(e,t,r){e.issues.length&&t.issues.push(...Tu(r,e.issues)),t.value[r]=e.value}const kue=_e("$ZodArray",(e,t)=>{Er.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);const o=[];for(let s=0;s<i.length;s++){const a=i[s],l=t.element._zod.run({value:a,issues:[]},n);l instanceof Promise?o.push(l.then(c=>ij(c,r,s))):ij(l,r,s)}return o.length?Promise.all(o).then(()=>r):r}});function Gv(e,t,r,n){e.issues.length&&t.issues.push(...Tu(r,e.issues)),e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function bH(e){var n,i,o,s;const t=Object.keys(e.shape);for(const a of t)if(!((s=(o=(i=(n=e.shape)==null?void 0:n[a])==null?void 0:i._zod)==null?void 0:o.traits)!=null&&s.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const r=qle(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function _H(e,t,r,n,i,o){const s=[],a=i.keySet,l=i.catchall._zod,c=l.def.type;for(const d in t){if(a.has(d))continue;if(c==="never"){s.push(d);continue}const u=l.run({value:t[d],issues:[]},n);u instanceof Promise?e.push(u.then(p=>Gv(p,r,d,t))):Gv(u,r,d,t)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const Tue=_e("$ZodObject",(e,t)=>{Er.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!(r!=null&&r.get)){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l={...a};return Object.defineProperty(t,"shape",{value:l}),l}})}const n=C0(()=>bH(t));Ht(e._zod,"propValues",()=>{const a=t.shape,l={};for(const c in a){const d=a[c]._zod;if(d.values){l[c]??(l[c]=new Set);for(const u of d.values)l[c].add(u)}}return l});const i=Yh,o=t.catchall;let s;e._zod.parse=(a,l)=>{s??(s=n.value);const c=a.value;if(!i(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),a;a.value={};const d=[],u=s.shape;for(const p of s.keys){const _=u[p]._zod.run({value:c[p],issues:[]},l);_ instanceof Promise?d.push(_.then(y=>Gv(y,a,p,c))):Gv(_,a,p,c)}return o?_H(d,c,a,l,n.value,e):d.length?Promise.all(d).then(()=>a):a}}),Pue=_e("$ZodObjectJIT",(e,t)=>{Tue.init(e,t);const r=e._zod.parse,n=C0(()=>bH(t)),i=p=>{const g=new Xce(["shape","payload","ctx"]),_=n.value,y=x=>{const E=rj(x);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};g.write("const input = payload.value;");const m=Object.create(null);let v=0;for(const x of _.keys)m[x]=`key_${v++}`;g.write("const newResult = {};");for(const x of _.keys){const E=m[x],C=rj(x);g.write(`const ${E} = ${y(x)};`),g.write(`
|
|
525
525
|
if (${E}.issues.length) {
|
|
@@ -704,5 +704,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
704
704
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fBe(e,t){if(e){if(typeof e=="string")return vP(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vP(e,t)}}function hBe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function pBe(e){if(Array.isArray(e))return vP(e)}function vP(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function mBe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qF(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,CX(n.key),n)}}function gBe(e,t,r){return t&&qF(e.prototype,t),r&&qF(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function vBe(e,t,r){return t=u0(t),yBe(e,SX()?Reflect.construct(t,r||[],u0(e).constructor):t.apply(e,r))}function yBe(e,t){if(t&&(Rd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bBe(e)}function bBe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function SX(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(SX=function(){return!!e})()}function u0(e){return u0=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},u0(e)}function _Be(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&yP(e,t)}function yP(e,t){return yP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},yP(e,t)}function Ao(e,t,r){return t=CX(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function CX(e){var t=xBe(e,"string");return Rd(t)=="symbol"?t:t+""}function xBe(e,t){if(Rd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Rd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var km=(function(e){function t(){var r;mBe(this,t);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return r=vBe(this,t,[].concat(i)),Ao(r,"state",{isAnimationFinished:!0,totalLength:0}),Ao(r,"generateSimpleStrokeDasharray",function(s,a){return"".concat(a,"px ").concat(s-a,"px")}),Ao(r,"getStrokeDasharray",function(s,a,l){var c=l.reduce(function(v,b){return v+b});if(!c)return r.generateSimpleStrokeDasharray(a,s);for(var d=Math.floor(s/c),u=s%c,p=a-s,g=[],_=0,y=0;_<l.length;y+=l[_],++_)if(y+l[_]>u){g=[].concat(bu(l.slice(0,_)),[u-y]);break}var m=g.length%2===0?[0,p]:[p];return[].concat(bu(t.repeat(l,d)),bu(g),m).map(function(v){return"".concat(v,"px")}).join(", ")}),Ao(r,"id",uf("recharts-line-")),Ao(r,"pathRef",function(s){r.mainCurve=s}),Ao(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),Ao(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return _Be(t,e),gBe(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,s=o.points,a=o.xAxis,l=o.yAxis,c=o.layout,d=o.children,u=Mi(d,Cm);if(!u)return null;var p=function(y,m){return{x:y.x,y:y.y,value:y.value,errorVal:sn(y.payload,m)}},g={clipPath:n?"url(#clipPath-".concat(i,")"):null};return Z.createElement(qt,g,u.map(function(_){return Z.cloneElement(_,{key:"bar-".concat(_.props.dataKey),data:s,xAxis:a,yAxis:l,layout:c,dataPointFormatter:p})}))}},{key:"renderDots",value:function(n,i,o){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var a=this.props,l=a.dot,c=a.points,d=a.dataKey,u=it(this.props,!1),p=it(l,!0),g=c.map(function(y,m){var v=wi(wi(wi({key:"dot-".concat(m),r:3},u),p),{},{index:m,cx:y.x,cy:y.y,value:y.value,dataKey:d,payload:y.payload,points:c});return t.renderDotItem(l,v)}),_={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(o,")"):null};return Z.createElement(qt,zh({className:"recharts-line-dots",key:"dots"},_),g)}},{key:"renderCurveStatically",value:function(n,i,o,s){var a=this.props,l=a.type,c=a.layout,d=a.connectNulls;a.ref;var u=UF(a,lBe),p=wi(wi(wi({},it(u,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(o,")"):null,points:n},s),{},{type:l,layout:c,connectNulls:d});return Z.createElement(Hy,zh({},p,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var o=this,s=this.props,a=s.points,l=s.strokeDasharray,c=s.isAnimationActive,d=s.animationBegin,u=s.animationDuration,p=s.animationEasing,g=s.animationId,_=s.animateNewValues,y=s.width,m=s.height,v=this.state,b=v.prevPoints,x=v.totalLength;return Z.createElement(ls,{begin:d,duration:u,isActive:c,easing:p,from:{t:0},to:{t:1},key:"line-".concat(g),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(E){var C=E.t;if(b){var k=b.length/a.length,P=a.map(function(M,F){var U=Math.floor(F*k);if(b[U]){var q=b[U],V=Pi(q.x,M.x),K=Pi(q.y,M.y);return wi(wi({},M),{},{x:V(C),y:K(C)})}if(_){var D=Pi(y*2,M.x),$=Pi(m/2,M.y);return wi(wi({},M),{},{x:D(C),y:$(C)})}return wi(wi({},M),{},{x:M.x,y:M.y})});return o.renderCurveStatically(P,n,i)}var T=Pi(0,x),I=T(C),N;if(l){var B="".concat(l).split(/[,\s]+/gim).map(function(M){return parseFloat(M)});N=o.getStrokeDasharray(I,x,B)}else N=o.generateSimpleStrokeDasharray(x,I);return o.renderCurveStatically(a,n,i,{strokeDasharray:N})})}},{key:"renderCurve",value:function(n,i){var o=this.props,s=o.points,a=o.isAnimationActive,l=this.state,c=l.prevPoints,d=l.totalLength;return a&&s&&s.length&&(!c&&d>0||!Sm(c,s))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(s,n,i)}},{key:"render",value:function(){var n,i=this.props,o=i.hide,s=i.dot,a=i.points,l=i.className,c=i.xAxis,d=i.yAxis,u=i.top,p=i.left,g=i.width,_=i.height,y=i.isAnimationActive,m=i.id;if(o||!a||!a.length)return null;var v=this.state.isAnimationFinished,b=a.length===1,x=mt("recharts-line",l),E=c&&c.allowDataOverflow,C=d&&d.allowDataOverflow,k=E||C,P=pt(m)?this.id:m,T=(n=it(s,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},I=T.r,N=I===void 0?3:I,B=T.strokeWidth,M=B===void 0?2:B,F=uPe(s)?s:{},U=F.clipDot,q=U===void 0?!0:U,V=N*2+M;return Z.createElement(qt,{className:x},E||C?Z.createElement("defs",null,Z.createElement("clipPath",{id:"clipPath-".concat(P)},Z.createElement("rect",{x:E?p:p-g/2,y:C?u:u-_/2,width:E?g:g*2,height:C?_:_*2})),!q&&Z.createElement("clipPath",{id:"clipPath-dots-".concat(P)},Z.createElement("rect",{x:p-V/2,y:u-V/2,width:g+V,height:_+V}))):null,!b&&this.renderCurve(k,P),this.renderErrorBar(k,P),(b||s)&&this.renderDots(k,q,P),(!y||v)&&qs.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var o=n.length%2!==0?[].concat(bu(n),[0]):n,s=[],a=0;a<i;++a)s=[].concat(bu(s),bu(o));return s}},{key:"renderDotItem",value:function(n,i){var o;if(Z.isValidElement(n))o=Z.cloneElement(n,i);else if(ht(n))o=n(i);else{var s=i.key,a=UF(i,cBe),l=mt("recharts-line-dot",typeof n!="boolean"?n.className:"");o=Z.createElement(Ib,zh({key:s},a,{className:l}))}return o}}])})(O.PureComponent);Ao(km,"displayName","Line");Ao(km,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!jc.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Ao(km,"getComposedData",function(e){var t=e.props,r=e.xAxis,n=e.yAxis,i=e.xAxisTicks,o=e.yAxisTicks,s=e.dataKey,a=e.bandSize,l=e.displayedData,c=e.offset,d=t.layout,u=l.map(function(p,g){var _=sn(p,s);return d==="horizontal"?{x:Q4({axis:r,ticks:i,bandSize:a,entry:p,index:g}),y:pt(_)?null:n.scale(_),value:_,payload:p}:{x:pt(_)?null:r.scale(_),y:Q4({axis:n,ticks:o,bandSize:a,entry:p,index:g}),value:_,payload:p}});return wi({points:u,layout:d},c)});function Nd(e){"@babel/helpers - typeof";return Nd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nd(e)}function wBe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function SBe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,TX(n.key),n)}}function CBe(e,t,r){return t&&SBe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function EBe(e,t,r){return t=d0(t),kBe(e,EX()?Reflect.construct(t,r||[],d0(e).constructor):t.apply(e,r))}function kBe(e,t){if(t&&(Nd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return TBe(e)}function TBe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function EX(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(EX=function(){return!!e})()}function d0(e){return d0=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},d0(e)}function PBe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&bP(e,t)}function bP(e,t){return bP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},bP(e,t)}function kX(e,t,r){return t=TX(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function TX(e){var t=ABe(e,"string");return Nd(t)=="symbol"?t:t+""}function ABe(e,t){if(Nd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Nd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function _P(){return _P=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_P.apply(this,arguments)}function OBe(e){var t=e.xAxisId,r=fX(),n=hX(),i=uX(t);return i==null?null:O.createElement(Hb,_P({},i,{className:mt("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(s){return Gl(s,!0)}}))}var R2=(function(e){function t(){return wBe(this,t),EBe(this,t,arguments)}return PBe(t,e),CBe(t,[{key:"render",value:function(){return O.createElement(OBe,this.props)}}])})(O.Component);kX(R2,"displayName","XAxis");kX(R2,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function Md(e){"@babel/helpers - typeof";return Md=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Md(e)}function IBe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function RBe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,OX(n.key),n)}}function NBe(e,t,r){return t&&RBe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function MBe(e,t,r){return t=f0(t),jBe(e,PX()?Reflect.construct(t,r||[],f0(e).constructor):t.apply(e,r))}function jBe(e,t){if(t&&(Md(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return DBe(e)}function DBe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function PX(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PX=function(){return!!e})()}function f0(e){return f0=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},f0(e)}function LBe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xP(e,t)}function xP(e,t){return xP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},xP(e,t)}function AX(e,t,r){return t=OX(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function OX(e){var t=$Be(e,"string");return Md(t)=="symbol"?t:t+""}function $Be(e,t){if(Md(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Md(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function wP(){return wP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},wP.apply(this,arguments)}var BBe=function(t){var r=t.yAxisId,n=fX(),i=hX(),o=dX(r);return o==null?null:O.createElement(Hb,wP({},o,{className:mt("recharts-".concat(o.axisType," ").concat(o.axisType),o.className),viewBox:{x:0,y:0,width:n,height:i},ticksGenerator:function(a){return Gl(a,!0)}}))},N2=(function(e){function t(){return IBe(this,t),MBe(this,t,arguments)}return LBe(t,e),NBe(t,[{key:"render",value:function(){return O.createElement(BBe,this.props)}}])})(O.Component);AX(N2,"displayName","YAxis");AX(N2,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function WF(e){return HBe(e)||UBe(e)||zBe(e)||FBe()}function FBe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
705
705
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zBe(e,t){if(e){if(typeof e=="string")return SP(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return SP(e,t)}}function UBe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function HBe(e){if(Array.isArray(e))return SP(e)}function SP(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var CP=function(t,r,n,i,o){var s=Mi(t,O2),a=Mi(t,Fb),l=[].concat(WF(s),WF(a)),c=Mi(t,Ub),d="".concat(i,"Id"),u=i[0],p=r;if(l.length&&(p=l.reduce(function(y,m){if(m.props[d]===n&&ns(m.props,"extendDomain")&&Me(m.props[u])){var v=m.props[u];return[Math.min(y[0],v),Math.max(y[1],v)]}return y},p)),c.length){var g="".concat(u,"1"),_="".concat(u,"2");p=c.reduce(function(y,m){if(m.props[d]===n&&ns(m.props,"extendDomain")&&Me(m.props[g])&&Me(m.props[_])){var v=m.props[g],b=m.props[_];return[Math.min(y[0],v,b),Math.max(y[1],v,b)]}return y},p)}return o&&o.length&&(p=o.reduce(function(y,m){return Me(m)?[Math.min(y[0],m),Math.max(y[1],m)]:y},p)),p},IE={exports:{}},VF;function qBe(){return VF||(VF=1,(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(l,c,d){this.fn=l,this.context=c,this.once=d||!1}function o(l,c,d,u,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var g=new i(d,u||l,p),_=r?r+c:c;return l._events[_]?l._events[_].fn?l._events[_]=[l._events[_],g]:l._events[_].push(g):(l._events[_]=g,l._eventsCount++),l}function s(l,c){--l._eventsCount===0?l._events=new n:delete l._events[c]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],d,u;if(this._eventsCount===0)return c;for(u in d=this._events)t.call(d,u)&&c.push(r?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},a.prototype.listeners=function(c){var d=r?r+c:c,u=this._events[d];if(!u)return[];if(u.fn)return[u.fn];for(var p=0,g=u.length,_=new Array(g);p<g;p++)_[p]=u[p].fn;return _},a.prototype.listenerCount=function(c){var d=r?r+c:c,u=this._events[d];return u?u.fn?1:u.length:0},a.prototype.emit=function(c,d,u,p,g,_){var y=r?r+c:c;if(!this._events[y])return!1;var m=this._events[y],v=arguments.length,b,x;if(m.fn){switch(m.once&&this.removeListener(c,m.fn,void 0,!0),v){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,d),!0;case 3:return m.fn.call(m.context,d,u),!0;case 4:return m.fn.call(m.context,d,u,p),!0;case 5:return m.fn.call(m.context,d,u,p,g),!0;case 6:return m.fn.call(m.context,d,u,p,g,_),!0}for(x=1,b=new Array(v-1);x<v;x++)b[x-1]=arguments[x];m.fn.apply(m.context,b)}else{var E=m.length,C;for(x=0;x<E;x++)switch(m[x].once&&this.removeListener(c,m[x].fn,void 0,!0),v){case 1:m[x].fn.call(m[x].context);break;case 2:m[x].fn.call(m[x].context,d);break;case 3:m[x].fn.call(m[x].context,d,u);break;case 4:m[x].fn.call(m[x].context,d,u,p);break;default:if(!b)for(C=1,b=new Array(v-1);C<v;C++)b[C-1]=arguments[C];m[x].fn.apply(m[x].context,b)}}return!0},a.prototype.on=function(c,d,u){return o(this,c,d,u,!1)},a.prototype.once=function(c,d,u){return o(this,c,d,u,!0)},a.prototype.removeListener=function(c,d,u,p){var g=r?r+c:c;if(!this._events[g])return this;if(!d)return s(this,g),this;var _=this._events[g];if(_.fn)_.fn===d&&(!p||_.once)&&(!u||_.context===u)&&s(this,g);else{for(var y=0,m=[],v=_.length;y<v;y++)(_[y].fn!==d||p&&!_[y].once||u&&_[y].context!==u)&&m.push(_[y]);m.length?this._events[g]=m.length===1?m[0]:m:s(this,g)}return this},a.prototype.removeAllListeners=function(c){var d;return c?(d=r?r+c:c,this._events[d]&&s(this,d)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a})(IE)),IE.exports}var WBe=qBe();const VBe=Gt(WBe);var RE=new VBe,NE="recharts.syncMouseEvents";function Up(e){"@babel/helpers - typeof";return Up=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Up(e)}function GBe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function KBe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,IX(n.key),n)}}function XBe(e,t,r){return t&&KBe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ME(e,t,r){return t=IX(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function IX(e){var t=ZBe(e,"string");return Up(t)=="symbol"?t:t+""}function ZBe(e,t){if(Up(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Up(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var QBe=(function(){function e(){GBe(this,e),ME(this,"activeIndex",0),ME(this,"coordinateList",[]),ME(this,"layout","horizontal")}return XBe(e,[{key:"setDetails",value:function(r){var n,i=r.coordinateList,o=i===void 0?null:i,s=r.container,a=s===void 0?null:s,l=r.layout,c=l===void 0?null:l,d=r.offset,u=d===void 0?null:d,p=r.mouseHandlerCallback,g=p===void 0?null:p;this.coordinateList=(n=o??this.coordinateList)!==null&&n!==void 0?n:[],this.container=a??this.container,this.layout=c??this.layout,this.offset=u??this.offset,this.mouseHandlerCallback=g??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(r){if(this.coordinateList.length!==0)switch(r.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,n;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var i=this.container.getBoundingClientRect(),o=i.x,s=i.y,a=i.height,l=this.coordinateList[this.activeIndex].coordinate,c=((r=window)===null||r===void 0?void 0:r.scrollX)||0,d=((n=window)===null||n===void 0?void 0:n.scrollY)||0,u=o+l+c,p=s+this.offset.top+a/2+d;this.mouseHandlerCallback({pageX:u,pageY:p})}}}])})();function YBe(e,t,r){if(r==="number"&&t===!0&&Array.isArray(e)){var n=e==null?void 0:e[0],i=e==null?void 0:e[1];if(n&&i&&Me(n)&&Me(i))return!0}return!1}function JBe(e,t,r,n){var i=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-i,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function RX(e){var t=e.cx,r=e.cy,n=e.radius,i=e.startAngle,o=e.endAngle,s=hr(t,r,n,i),a=hr(t,r,n,o);return{points:[s,a],cx:t,cy:r,radius:n,startAngle:i,endAngle:o}}function eFe(e,t,r){var n,i,o,s;if(e==="horizontal")n=t.x,o=n,i=r.top,s=r.top+r.height;else if(e==="vertical")i=t.y,s=i,n=r.left,o=r.left+r.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var a=t.cx,l=t.cy,c=t.innerRadius,d=t.outerRadius,u=t.angle,p=hr(a,l,c,u),g=hr(a,l,d,u);n=p.x,i=p.y,o=g.x,s=g.y}else return RX(t);return[{x:n,y:i},{x:o,y:s}]}function Hp(e){"@babel/helpers - typeof";return Hp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hp(e)}function GF(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function bv(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?GF(Object(r),!0).forEach(function(n){tFe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):GF(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tFe(e,t,r){return t=rFe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rFe(e){var t=nFe(e,"string");return Hp(t)=="symbol"?t:t+""}function nFe(e,t){if(Hp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Hp(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function iFe(e){var t,r,n=e.element,i=e.tooltipEventType,o=e.isActive,s=e.activeCoordinate,a=e.activePayload,l=e.offset,c=e.activeTooltipIndex,d=e.tooltipAxisBandSize,u=e.layout,p=e.chartName,g=(t=n.props.cursor)!==null&&t!==void 0?t:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!g||!o||!s||p!=="ScatterChart"&&i!=="axis")return null;var _,y=Hy;if(p==="ScatterChart")_=s,y=F3e;else if(p==="BarChart")_=JBe(u,s,l,d),y=T2;else if(u==="radial"){var m=RX(s),v=m.cx,b=m.cy,x=m.radius,E=m.startAngle,C=m.endAngle;_={cx:v,cy:b,startAngle:E,endAngle:C,innerRadius:x,outerRadius:x},y=NK}else _={points:eFe(u,s,l)},y=Hy;var k=bv(bv(bv(bv({stroke:"#ccc",pointerEvents:"none"},l),_),it(g,!1)),{},{payload:a,payloadIndex:c,className:mt("recharts-tooltip-cursor",g.className)});return O.isValidElement(g)?O.cloneElement(g,k):O.createElement(y,k)}var oFe=["item"],sFe=["children","className","width","height","style","compact","title","desc"];function jd(e){"@babel/helpers - typeof";return jd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jd(e)}function Ru(){return Ru=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ru.apply(this,arguments)}function KF(e,t){return cFe(e)||lFe(e,t)||MX(e,t)||aFe()}function aFe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
706
706
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lFe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,s,a=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(l=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);l=!0);}catch(d){c=!0,i=d}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw i}}return a}}function cFe(e){if(Array.isArray(e))return e}function XF(e,t){if(e==null)return{};var r=uFe(e,t),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function uFe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function dFe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fFe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,jX(n.key),n)}}function hFe(e,t,r){return t&&fFe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function pFe(e,t,r){return t=h0(t),mFe(e,NX()?Reflect.construct(t,r||[],h0(e).constructor):t.apply(e,r))}function mFe(e,t){if(t&&(jd(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gFe(e)}function gFe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function NX(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(NX=function(){return!!e})()}function h0(e){return h0=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},h0(e)}function vFe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&EP(e,t)}function EP(e,t){return EP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},EP(e,t)}function Dd(e){return _Fe(e)||bFe(e)||MX(e)||yFe()}function yFe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
707
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MX(e,t){if(e){if(typeof e=="string")return kP(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kP(e,t)}}function bFe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _Fe(e){if(Array.isArray(e))return kP(e)}function kP(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ZF(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ye(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ZF(Object(r),!0).forEach(function(n){at(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ZF(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function at(e,t,r){return t=jX(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jX(e){var t=xFe(e,"string");return jd(t)=="symbol"?t:t+""}function xFe(e,t){if(jd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(jd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var wFe={xAxis:["bottom","top"],yAxis:["left","right"]},SFe={width:"100%",height:"100%"},DX={x:0,y:0};function _v(e){return e}var CFe=function(t,r){return r==="horizontal"?t.x:r==="vertical"?t.y:r==="centric"?t.angle:t.radius},EFe=function(t,r,n,i){var o=r.find(function(d){return d&&d.index===n});if(o){if(t==="horizontal")return{x:o.coordinate,y:i.y};if(t==="vertical")return{x:i.x,y:o.coordinate};if(t==="centric"){var s=o.coordinate,a=i.radius;return ye(ye(ye({},i),hr(i.cx,i.cy,a,s)),{},{angle:s,radius:a})}var l=o.coordinate,c=i.angle;return ye(ye(ye({},i),hr(i.cx,i.cy,l,c)),{},{angle:c,radius:l})}return DX},qb=function(t,r){var n=r.graphicalItems,i=r.dataStartIndex,o=r.dataEndIndex,s=(n??[]).reduce(function(a,l){var c=l.props.data;return c&&c.length?[].concat(Dd(a),Dd(c)):a},[]);return s.length>0?s:t&&t.length&&Me(i)&&Me(o)?t.slice(i,o+1):[]};function LX(e){return e==="number"?[0,"auto"]:void 0}var TP=function(t,r,n,i){var o=t.graphicalItems,s=t.tooltipAxis,a=qb(r,t);return n<0||!o||!o.length||n>=a.length?null:o.reduce(function(l,c){var d,u=(d=c.props.data)!==null&&d!==void 0?d:r;u&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(u=u.slice(t.dataStartIndex,t.dataEndIndex+1));var p;if(s.dataKey&&!s.allowDuplicatedCategory){var g=u===void 0?a:u;p=py(g,s.dataKey,i)}else p=u&&u[n]||a[n];return p?[].concat(Dd(l),[TK(c,p)]):l},[])},QF=function(t,r,n,i){var o=i||{x:t.chartX,y:t.chartY},s=CFe(o,n),a=t.orderedTooltipTicks,l=t.tooltipAxis,c=t.tooltipTicks,d=aje(s,a,c,l);if(d>=0&&c){var u=c[d]&&c[d].value,p=TP(t,r,d,u),g=EFe(n,a,d,o);return{activeTooltipIndex:d,activeLabel:u,activePayload:p,activeCoordinate:g}}return null},kFe=function(t,r){var n=r.axes,i=r.graphicalItems,o=r.axisType,s=r.axisIdKey,a=r.stackGroups,l=r.dataStartIndex,c=r.dataEndIndex,d=t.layout,u=t.children,p=t.stackOffset,g=wK(d,o);return n.reduce(function(_,y){var m,v=y.type.defaultProps!==void 0?ye(ye({},y.type.defaultProps),y.props):y.props,b=v.type,x=v.dataKey,E=v.allowDataOverflow,C=v.allowDuplicatedCategory,k=v.scale,P=v.ticks,T=v.includeHidden,I=v[s];if(_[I])return _;var N=qb(t.data,{graphicalItems:i.filter(function(X){var W,le=s in X.props?X.props[s]:(W=X.type.defaultProps)===null||W===void 0?void 0:W[s];return le===I}),dataStartIndex:l,dataEndIndex:c}),B=N.length,M,F,U;YBe(v.domain,E,b)&&(M=zT(v.domain,null,E),g&&(b==="number"||k!=="auto")&&(U=Lh(N,x,"category")));var q=LX(b);if(!M||M.length===0){var V,K=(V=v.domain)!==null&&V!==void 0?V:q;if(x){if(M=Lh(N,x,b),b==="category"&&g){var D=ePe(M);C&&D?(F=M,M=e0(0,B)):C||(M=tB(K,M,y).reduce(function(X,W){return X.indexOf(W)>=0?X:[].concat(Dd(X),[W])},[]))}else if(b==="category")C?M=M.filter(function(X){return X!==""&&!pt(X)}):M=tB(K,M,y).reduce(function(X,W){return X.indexOf(W)>=0||W===""||pt(W)?X:[].concat(Dd(X),[W])},[]);else if(b==="number"){var $=fje(N,i.filter(function(X){var W,le,ce=s in X.props?X.props[s]:(W=X.type.defaultProps)===null||W===void 0?void 0:W[s],ve="hide"in X.props?X.props.hide:(le=X.type.defaultProps)===null||le===void 0?void 0:le.hide;return ce===I&&(T||!ve)}),x,o,d);$&&(M=$)}g&&(b==="number"||k!=="auto")&&(U=Lh(N,x,"category"))}else g?M=e0(0,B):a&&a[I]&&a[I].hasStack&&b==="number"?M=p==="expand"?[0,1]:kK(a[I].stackGroups,l,c):M=xK(N,i.filter(function(X){var W=s in X.props?X.props[s]:X.type.defaultProps[s],le="hide"in X.props?X.props.hide:X.type.defaultProps.hide;return W===I&&(T||!le)}),b,d,!0);if(b==="number")M=CP(u,M,I,o,P),K&&(M=zT(K,M,E));else if(b==="category"&&K){var j=K,z=M.every(function(X){return j.indexOf(X)>=0});z&&(M=j)}}return ye(ye({},_),{},at({},I,ye(ye({},v),{},{axisType:o,domain:M,categoricalDomain:U,duplicateDomain:F,originalDomain:(m=v.domain)!==null&&m!==void 0?m:q,isCategorical:g,layout:d})))},{})},TFe=function(t,r){var n=r.graphicalItems,i=r.Axis,o=r.axisType,s=r.axisIdKey,a=r.stackGroups,l=r.dataStartIndex,c=r.dataEndIndex,d=t.layout,u=t.children,p=qb(t.data,{graphicalItems:n,dataStartIndex:l,dataEndIndex:c}),g=p.length,_=wK(d,o),y=-1;return n.reduce(function(m,v){var b=v.type.defaultProps!==void 0?ye(ye({},v.type.defaultProps),v.props):v.props,x=b[s],E=LX("number");if(!m[x]){y++;var C;return _?C=e0(0,g):a&&a[x]&&a[x].hasStack?(C=kK(a[x].stackGroups,l,c),C=CP(u,C,x,o)):(C=zT(E,xK(p,n.filter(function(k){var P,T,I=s in k.props?k.props[s]:(P=k.type.defaultProps)===null||P===void 0?void 0:P[s],N="hide"in k.props?k.props.hide:(T=k.type.defaultProps)===null||T===void 0?void 0:T.hide;return I===x&&!N}),"number",d),i.defaultProps.allowDataOverflow),C=CP(u,C,x,o)),ye(ye({},m),{},at({},x,ye(ye({axisType:o},i.defaultProps),{},{hide:!0,orientation:Ni(wFe,"".concat(o,".").concat(y%2),null),domain:C,originalDomain:E,isCategorical:_,layout:d})))}return m},{})},PFe=function(t,r){var n=r.axisType,i=n===void 0?"xAxis":n,o=r.AxisComp,s=r.graphicalItems,a=r.stackGroups,l=r.dataStartIndex,c=r.dataEndIndex,d=t.children,u="".concat(i,"Id"),p=Mi(d,o),g={};return p&&p.length?g=kFe(t,{axes:p,graphicalItems:s,axisType:i,axisIdKey:u,stackGroups:a,dataStartIndex:l,dataEndIndex:c}):s&&s.length&&(g=TFe(t,{Axis:o,graphicalItems:s,axisType:i,axisIdKey:u,stackGroups:a,dataStartIndex:l,dataEndIndex:c})),g},AFe=function(t){var r=Cu(t),n=Gl(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:e2(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:Fy(r,n)}},YF=function(t){var r=t.children,n=t.defaultShowTooltip,i=Ci(r,kd),o=0,s=0;return t.data&&t.data.length!==0&&(s=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(s=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!n}},OFe=function(t){return!t||!t.length?!1:t.some(function(r){var n=zs(r&&r.type);return n&&n.indexOf("Bar")>=0})},JF=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},IFe=function(t,r){var n=t.props,i=t.graphicalItems,o=t.xAxisMap,s=o===void 0?{}:o,a=t.yAxisMap,l=a===void 0?{}:a,c=n.width,d=n.height,u=n.children,p=n.margin||{},g=Ci(u,kd),_=Ci(u,zu),y=Object.keys(l).reduce(function(C,k){var P=l[k],T=P.orientation;return!P.mirror&&!P.hide?ye(ye({},C),{},at({},T,C[T]+P.width)):C},{left:p.left||0,right:p.right||0}),m=Object.keys(s).reduce(function(C,k){var P=s[k],T=P.orientation;return!P.mirror&&!P.hide?ye(ye({},C),{},at({},T,Ni(C,"".concat(T))+P.height)):C},{top:p.top||0,bottom:p.bottom||0}),v=ye(ye({},m),y),b=v.bottom;g&&(v.bottom+=g.props.height||kd.defaultProps.height),_&&r&&(v=uje(v,i,n,r));var x=c-v.left-v.right,E=d-v.top-v.bottom;return ye(ye({brushBottom:b},v),{},{width:Math.max(x,0),height:Math.max(E,0)})},RFe=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},$X=function(t){var r=t.chartName,n=t.GraphicalChild,i=t.defaultTooltipEventType,o=i===void 0?"axis":i,s=t.validateTooltipEventTypes,a=s===void 0?["axis"]:s,l=t.axisComponents,c=t.legendContent,d=t.formatAxisMap,u=t.defaultProps,p=function(v,b){var x=b.graphicalItems,E=b.stackGroups,C=b.offset,k=b.updateId,P=b.dataStartIndex,T=b.dataEndIndex,I=v.barSize,N=v.layout,B=v.barGap,M=v.barCategoryGap,F=v.maxBarSize,U=JF(N),q=U.numericAxisName,V=U.cateAxisName,K=OFe(x),D=[];return x.forEach(function($,j){var z=qb(v.data,{graphicalItems:[$],dataStartIndex:P,dataEndIndex:T}),X=$.type.defaultProps!==void 0?ye(ye({},$.type.defaultProps),$.props):$.props,W=X.dataKey,le=X.maxBarSize,ce=X["".concat(q,"Id")],ve=X["".concat(V,"Id")],H={},Q=l.reduce(function(sr,Pt){var Kt=b["".concat(Pt.axisType,"Map")],Tr=X["".concat(Pt.axisType,"Id")];Kt&&Kt[Tr]||Pt.axisType==="zAxis"||wc();var ar=Kt[Tr];return ye(ye({},sr),{},at(at({},Pt.axisType,ar),"".concat(Pt.axisType,"Ticks"),Gl(ar)))},H),Y=Q[V],re=Q["".concat(V,"Ticks")],ge=E&&E[ce]&&E[ce].hasStack&&xje($,E[ce].stackGroups),ee=zs($.type).indexOf("Bar")>=0,Ie=Fy(Y,re),Re=[],xe=K&&lje({barSize:I,stackGroups:E,totalSize:RFe(Q,V)});if(ee){var et,be,ot=pt(le)?F:le,xt=(et=(be=Fy(Y,re,!0))!==null&&be!==void 0?be:ot)!==null&&et!==void 0?et:0;Re=cje({barGap:B,barCategoryGap:M,bandSize:xt!==Ie?xt:Ie,sizeList:xe[ve],maxBarSize:ot}),xt!==Ie&&(Re=Re.map(function(sr){return ye(ye({},sr),{},{position:ye(ye({},sr.position),{},{offset:sr.position.offset-xt/2})})}))}var pr=$&&$.type&&$.type.getComposedData;pr&&D.push({props:ye(ye({},pr(ye(ye({},Q),{},{displayedData:z,props:v,dataKey:W,item:$,bandSize:Ie,barPosition:Re,offset:C,stackedData:ge,layout:N,dataStartIndex:P,dataEndIndex:T}))),{},at(at(at({key:$.key||"item-".concat(j)},q,Q[q]),V,Q[V]),"animationId",k)),childIndex:hPe($,v.children),item:$})}),D},g=function(v,b){var x=v.props,E=v.dataStartIndex,C=v.dataEndIndex,k=v.updateId;if(!m3({props:x}))return null;var P=x.children,T=x.layout,I=x.stackOffset,N=x.data,B=x.reverseStackOrder,M=JF(T),F=M.numericAxisName,U=M.cateAxisName,q=Mi(P,n),V=bje(N,q,"".concat(F,"Id"),"".concat(U,"Id"),I,B),K=l.reduce(function(X,W){var le="".concat(W.axisType,"Map");return ye(ye({},X),{},at({},le,PFe(x,ye(ye({},W),{},{graphicalItems:q,stackGroups:W.axisType===F&&V,dataStartIndex:E,dataEndIndex:C}))))},{}),D=IFe(ye(ye({},K),{},{props:x,graphicalItems:q}),b==null?void 0:b.legendBBox);Object.keys(K).forEach(function(X){K[X]=d(x,K[X],D,X.replace("Map",""),r)});var $=K["".concat(U,"Map")],j=AFe($),z=p(x,ye(ye({},K),{},{dataStartIndex:E,dataEndIndex:C,updateId:k,graphicalItems:q,stackGroups:V,offset:D}));return ye(ye({formattedGraphicalItems:z,graphicalItems:q,offset:D,stackGroups:V},j),K)},_=(function(m){function v(b){var x,E,C;return dFe(this,v),C=pFe(this,v,[b]),at(C,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),at(C,"accessibilityManager",new QBe),at(C,"handleLegendBBoxUpdate",function(k){if(k){var P=C.state,T=P.dataStartIndex,I=P.dataEndIndex,N=P.updateId;C.setState(ye({legendBBox:k},g({props:C.props,dataStartIndex:T,dataEndIndex:I,updateId:N},ye(ye({},C.state),{},{legendBBox:k}))))}}),at(C,"handleReceiveSyncEvent",function(k,P,T){if(C.props.syncId===k){if(T===C.eventEmitterSymbol&&typeof C.props.syncMethod!="function")return;C.applySyncEvent(P)}}),at(C,"handleBrushChange",function(k){var P=k.startIndex,T=k.endIndex;if(P!==C.state.dataStartIndex||T!==C.state.dataEndIndex){var I=C.state.updateId;C.setState(function(){return ye({dataStartIndex:P,dataEndIndex:T},g({props:C.props,dataStartIndex:P,dataEndIndex:T,updateId:I},C.state))}),C.triggerSyncEvent({dataStartIndex:P,dataEndIndex:T})}}),at(C,"handleMouseEnter",function(k){var P=C.getMouseInfo(k);if(P){var T=ye(ye({},P),{},{isTooltipActive:!0});C.setState(T),C.triggerSyncEvent(T);var I=C.props.onMouseEnter;ht(I)&&I(T,k)}}),at(C,"triggeredAfterMouseMove",function(k){var P=C.getMouseInfo(k),T=P?ye(ye({},P),{},{isTooltipActive:!0}):{isTooltipActive:!1};C.setState(T),C.triggerSyncEvent(T);var I=C.props.onMouseMove;ht(I)&&I(T,k)}),at(C,"handleItemMouseEnter",function(k){C.setState(function(){return{isTooltipActive:!0,activeItem:k,activePayload:k.tooltipPayload,activeCoordinate:k.tooltipPosition||{x:k.cx,y:k.cy}}})}),at(C,"handleItemMouseLeave",function(){C.setState(function(){return{isTooltipActive:!1}})}),at(C,"handleMouseMove",function(k){k.persist(),C.throttleTriggeredAfterMouseMove(k)}),at(C,"handleMouseLeave",function(k){C.throttleTriggeredAfterMouseMove.cancel();var P={isTooltipActive:!1};C.setState(P),C.triggerSyncEvent(P);var T=C.props.onMouseLeave;ht(T)&&T(P,k)}),at(C,"handleOuterEvent",function(k){var P=fPe(k),T=Ni(C.props,"".concat(P));if(P&&ht(T)){var I,N;/.*touch.*/i.test(P)?N=C.getMouseInfo(k.changedTouches[0]):N=C.getMouseInfo(k),T((I=N)!==null&&I!==void 0?I:{},k)}}),at(C,"handleClick",function(k){var P=C.getMouseInfo(k);if(P){var T=ye(ye({},P),{},{isTooltipActive:!0});C.setState(T),C.triggerSyncEvent(T);var I=C.props.onClick;ht(I)&&I(T,k)}}),at(C,"handleMouseDown",function(k){var P=C.props.onMouseDown;if(ht(P)){var T=C.getMouseInfo(k);P(T,k)}}),at(C,"handleMouseUp",function(k){var P=C.props.onMouseUp;if(ht(P)){var T=C.getMouseInfo(k);P(T,k)}}),at(C,"handleTouchMove",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&C.throttleTriggeredAfterMouseMove(k.changedTouches[0])}),at(C,"handleTouchStart",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&C.handleMouseDown(k.changedTouches[0])}),at(C,"handleTouchEnd",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&C.handleMouseUp(k.changedTouches[0])}),at(C,"handleDoubleClick",function(k){var P=C.props.onDoubleClick;if(ht(P)){var T=C.getMouseInfo(k);P(T,k)}}),at(C,"handleContextMenu",function(k){var P=C.props.onContextMenu;if(ht(P)){var T=C.getMouseInfo(k);P(T,k)}}),at(C,"triggerSyncEvent",function(k){C.props.syncId!==void 0&&RE.emit(NE,C.props.syncId,k,C.eventEmitterSymbol)}),at(C,"applySyncEvent",function(k){var P=C.props,T=P.layout,I=P.syncMethod,N=C.state.updateId,B=k.dataStartIndex,M=k.dataEndIndex;if(k.dataStartIndex!==void 0||k.dataEndIndex!==void 0)C.setState(ye({dataStartIndex:B,dataEndIndex:M},g({props:C.props,dataStartIndex:B,dataEndIndex:M,updateId:N},C.state)));else if(k.activeTooltipIndex!==void 0){var F=k.chartX,U=k.chartY,q=k.activeTooltipIndex,V=C.state,K=V.offset,D=V.tooltipTicks;if(!K)return;if(typeof I=="function")q=I(D,k);else if(I==="value"){q=-1;for(var $=0;$<D.length;$++)if(D[$].value===k.activeLabel){q=$;break}}var j=ye(ye({},K),{},{x:K.left,y:K.top}),z=Math.min(F,j.x+j.width),X=Math.min(U,j.y+j.height),W=D[q]&&D[q].value,le=TP(C.state,C.props.data,q),ce=D[q]?{x:T==="horizontal"?D[q].coordinate:z,y:T==="horizontal"?X:D[q].coordinate}:DX;C.setState(ye(ye({},k),{},{activeLabel:W,activeCoordinate:ce,activePayload:le,activeTooltipIndex:q}))}else C.setState(k)}),at(C,"renderCursor",function(k){var P,T=C.state,I=T.isTooltipActive,N=T.activeCoordinate,B=T.activePayload,M=T.offset,F=T.activeTooltipIndex,U=T.tooltipAxisBandSize,q=C.getTooltipEventType(),V=(P=k.props.active)!==null&&P!==void 0?P:I,K=C.props.layout,D=k.key||"_recharts-cursor";return Z.createElement(iFe,{key:D,activeCoordinate:N,activePayload:B,activeTooltipIndex:F,chartName:r,element:k,isActive:V,layout:K,offset:M,tooltipAxisBandSize:U,tooltipEventType:q})}),at(C,"renderPolarAxis",function(k,P,T){var I=Ni(k,"type.axisType"),N=Ni(C.state,"".concat(I,"Map")),B=k.type.defaultProps,M=B!==void 0?ye(ye({},B),k.props):k.props,F=N&&N[M["".concat(I,"Id")]];return O.cloneElement(k,ye(ye({},F),{},{className:mt(I,F.className),key:k.key||"".concat(P,"-").concat(T),ticks:Gl(F,!0)}))}),at(C,"renderPolarGrid",function(k){var P=k.props,T=P.radialLines,I=P.polarAngles,N=P.polarRadius,B=C.state,M=B.radiusAxisMap,F=B.angleAxisMap,U=Cu(M),q=Cu(F),V=q.cx,K=q.cy,D=q.innerRadius,$=q.outerRadius;return O.cloneElement(k,{polarAngles:Array.isArray(I)?I:Gl(q,!0).map(function(j){return j.coordinate}),polarRadius:Array.isArray(N)?N:Gl(U,!0).map(function(j){return j.coordinate}),cx:V,cy:K,innerRadius:D,outerRadius:$,key:k.key||"polar-grid",radialLines:T})}),at(C,"renderLegend",function(){var k=C.state.formattedGraphicalItems,P=C.props,T=P.children,I=P.width,N=P.height,B=C.props.margin||{},M=I-(B.left||0)-(B.right||0),F=bK({children:T,formattedGraphicalItems:k,legendWidth:M,legendContent:c});if(!F)return null;var U=F.item,q=XF(F,oFe);return O.cloneElement(U,ye(ye({},q),{},{chartWidth:I,chartHeight:N,margin:B,onBBoxUpdate:C.handleLegendBBoxUpdate}))}),at(C,"renderTooltip",function(){var k,P=C.props,T=P.children,I=P.accessibilityLayer,N=Ci(T,Os);if(!N)return null;var B=C.state,M=B.isTooltipActive,F=B.activeCoordinate,U=B.activePayload,q=B.activeLabel,V=B.offset,K=(k=N.props.active)!==null&&k!==void 0?k:M;return O.cloneElement(N,{viewBox:ye(ye({},V),{},{x:V.left,y:V.top}),active:K,label:q,payload:K?U:[],coordinate:F,accessibilityLayer:I})}),at(C,"renderBrush",function(k){var P=C.props,T=P.margin,I=P.data,N=C.state,B=N.offset,M=N.dataStartIndex,F=N.dataEndIndex,U=N.updateId;return O.cloneElement(k,{key:k.key||"_recharts-brush",onChange:mv(C.handleBrushChange,k.props.onChange),data:I,x:Me(k.props.x)?k.props.x:B.left,y:Me(k.props.y)?k.props.y:B.top+B.height+B.brushBottom-(T.bottom||0),width:Me(k.props.width)?k.props.width:B.width,startIndex:M,endIndex:F,updateId:"brush-".concat(U)})}),at(C,"renderReferenceElement",function(k,P,T){if(!k)return null;var I=C,N=I.clipPathId,B=C.state,M=B.xAxisMap,F=B.yAxisMap,U=B.offset,q=k.type.defaultProps||{},V=k.props,K=V.xAxisId,D=K===void 0?q.xAxisId:K,$=V.yAxisId,j=$===void 0?q.yAxisId:$;return O.cloneElement(k,{key:k.key||"".concat(P,"-").concat(T),xAxis:M[D],yAxis:F[j],viewBox:{x:U.left,y:U.top,width:U.width,height:U.height},clipPathId:N})}),at(C,"renderActivePoints",function(k){var P=k.item,T=k.activePoint,I=k.basePoint,N=k.childIndex,B=k.isRange,M=[],F=P.props.key,U=P.item.type.defaultProps!==void 0?ye(ye({},P.item.type.defaultProps),P.item.props):P.item.props,q=U.activeDot,V=U.dataKey,K=ye(ye({index:N,dataKey:V,cx:T.x,cy:T.y,r:4,fill:k2(P.item),strokeWidth:2,stroke:"#fff",payload:T.payload,value:T.value},it(q,!1)),my(q));return M.push(v.renderActiveDot(q,K,"".concat(F,"-activePoint-").concat(N))),I?M.push(v.renderActiveDot(q,ye(ye({},K),{},{cx:I.x,cy:I.y}),"".concat(F,"-basePoint-").concat(N))):B&&M.push(null),M}),at(C,"renderGraphicChild",function(k,P,T){var I=C.filterFormatItem(k,P,T);if(!I)return null;var N=C.getTooltipEventType(),B=C.state,M=B.isTooltipActive,F=B.tooltipAxis,U=B.activeTooltipIndex,q=B.activeLabel,V=C.props.children,K=Ci(V,Os),D=I.props,$=D.points,j=D.isRange,z=D.baseLine,X=I.item.type.defaultProps!==void 0?ye(ye({},I.item.type.defaultProps),I.item.props):I.item.props,W=X.activeDot,le=X.hide,ce=X.activeBar,ve=X.activeShape,H=!!(!le&&M&&K&&(W||ce||ve)),Q={};N!=="axis"&&K&&K.props.trigger==="click"?Q={onClick:mv(C.handleItemMouseEnter,k.props.onClick)}:N!=="axis"&&(Q={onMouseLeave:mv(C.handleItemMouseLeave,k.props.onMouseLeave),onMouseEnter:mv(C.handleItemMouseEnter,k.props.onMouseEnter)});var Y=O.cloneElement(k,ye(ye({},I.props),Q));function re(Pt){return typeof F.dataKey=="function"?F.dataKey(Pt.payload):null}if(H)if(U>=0){var ge,ee;if(F.dataKey&&!F.allowDuplicatedCategory){var Ie=typeof F.dataKey=="function"?re:"payload.".concat(F.dataKey.toString());ge=py($,Ie,q),ee=j&&z&&py(z,Ie,q)}else ge=$==null?void 0:$[U],ee=j&&z&&z[U];if(ve||ce){var Re=k.props.activeIndex!==void 0?k.props.activeIndex:U;return[O.cloneElement(k,ye(ye(ye({},I.props),Q),{},{activeIndex:Re})),null,null]}if(!pt(ge))return[Y].concat(Dd(C.renderActivePoints({item:I,activePoint:ge,basePoint:ee,childIndex:U,isRange:j})))}else{var xe,et=(xe=C.getItemByXY(C.state.activeCoordinate))!==null&&xe!==void 0?xe:{graphicalItem:Y},be=et.graphicalItem,ot=be.item,xt=ot===void 0?k:ot,pr=be.childIndex,sr=ye(ye(ye({},I.props),Q),{},{activeIndex:pr});return[O.cloneElement(xt,sr),null,null]}return j?[Y,null,null]:[Y,null]}),at(C,"renderCustomized",function(k,P,T){return O.cloneElement(k,ye(ye({key:"recharts-customized-".concat(T)},C.props),C.state))}),at(C,"renderMap",{CartesianGrid:{handler:_v,once:!0},ReferenceArea:{handler:C.renderReferenceElement},ReferenceLine:{handler:_v},ReferenceDot:{handler:C.renderReferenceElement},XAxis:{handler:_v},YAxis:{handler:_v},Brush:{handler:C.renderBrush,once:!0},Bar:{handler:C.renderGraphicChild},Line:{handler:C.renderGraphicChild},Area:{handler:C.renderGraphicChild},Radar:{handler:C.renderGraphicChild},RadialBar:{handler:C.renderGraphicChild},Scatter:{handler:C.renderGraphicChild},Pie:{handler:C.renderGraphicChild},Funnel:{handler:C.renderGraphicChild},Tooltip:{handler:C.renderCursor,once:!0},PolarGrid:{handler:C.renderPolarGrid,once:!0},PolarAngleAxis:{handler:C.renderPolarAxis},PolarRadiusAxis:{handler:C.renderPolarAxis},Customized:{handler:C.renderCustomized}}),C.clipPathId="".concat((x=b.id)!==null&&x!==void 0?x:uf("recharts"),"-clip"),C.throttleTriggeredAfterMouseMove=yG(C.triggeredAfterMouseMove,(E=b.throttleDelay)!==null&&E!==void 0?E:1e3/60),C.state={},C}return vFe(v,m),hFe(v,[{key:"componentDidMount",value:function(){var x,E;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x:0,top:(E=this.props.margin.top)!==null&&E!==void 0?E:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var x=this.props,E=x.children,C=x.data,k=x.height,P=x.layout,T=Ci(E,Os);if(T){var I=T.props.defaultIndex;if(!(typeof I!="number"||I<0||I>this.state.tooltipTicks.length-1)){var N=this.state.tooltipTicks[I]&&this.state.tooltipTicks[I].value,B=TP(this.state,C,I,N),M=this.state.tooltipTicks[I].coordinate,F=(this.state.offset.top+k)/2,U=P==="horizontal",q=U?{x:M,y:F}:{y:M,x:F},V=this.state.formattedGraphicalItems.find(function(D){var $=D.item;return $.type.name==="Scatter"});V&&(q=ye(ye({},q),V.props.points[I].tooltipPosition),B=V.props.points[I].tooltipPayload);var K={activeTooltipIndex:I,isTooltipActive:!0,activeLabel:N,activePayload:B,activeCoordinate:q};this.setState(K),this.renderCursor(T),this.accessibilityManager.setIndex(I)}}}},{key:"getSnapshotBeforeUpdate",value:function(x,E){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==E.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==x.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==x.margin){var C,k;this.accessibilityManager.setDetails({offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(k=this.props.margin.top)!==null&&k!==void 0?k:0}})}return null}},{key:"componentDidUpdate",value:function(x){cT([Ci(x.children,Os)],[Ci(this.props.children,Os)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var x=Ci(this.props.children,Os);if(x&&typeof x.props.shared=="boolean"){var E=x.props.shared?"axis":"item";return a.indexOf(E)>=0?E:o}return o}},{key:"getMouseInfo",value:function(x){if(!this.container)return null;var E=this.container,C=E.getBoundingClientRect(),k=J2e(C),P={chartX:Math.round(x.pageX-k.left),chartY:Math.round(x.pageY-k.top)},T=C.width/E.offsetWidth||1,I=this.inRange(P.chartX,P.chartY,T);if(!I)return null;var N=this.state,B=N.xAxisMap,M=N.yAxisMap,F=this.getTooltipEventType(),U=QF(this.state,this.props.data,this.props.layout,I);if(F!=="axis"&&B&&M){var q=Cu(B).scale,V=Cu(M).scale,K=q&&q.invert?q.invert(P.chartX):null,D=V&&V.invert?V.invert(P.chartY):null;return ye(ye({},P),{},{xValue:K,yValue:D},U)}return U?ye(ye({},P),U):null}},{key:"inRange",value:function(x,E){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,k=this.props.layout,P=x/C,T=E/C;if(k==="horizontal"||k==="vertical"){var I=this.state.offset,N=P>=I.left&&P<=I.left+I.width&&T>=I.top&&T<=I.top+I.height;return N?{x:P,y:T}:null}var B=this.state,M=B.angleAxisMap,F=B.radiusAxisMap;if(M&&F){var U=Cu(M);return iB({x:P,y:T},U)}return null}},{key:"parseEventsOfWrapper",value:function(){var x=this.props.children,E=this.getTooltipEventType(),C=Ci(x,Os),k={};C&&E==="axis"&&(C.props.trigger==="click"?k={onClick:this.handleClick}:k={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var P=my(this.props,this.handleOuterEvent);return ye(ye({},P),k)}},{key:"addListener",value:function(){RE.on(NE,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){RE.removeListener(NE,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(x,E,C){for(var k=this.state.formattedGraphicalItems,P=0,T=k.length;P<T;P++){var I=k[P];if(I.item===x||I.props.key===x.key||E===zs(I.item.type)&&C===I.childIndex)return I}return null}},{key:"renderClipPath",value:function(){var x=this.clipPathId,E=this.state.offset,C=E.left,k=E.top,P=E.height,T=E.width;return Z.createElement("defs",null,Z.createElement("clipPath",{id:x},Z.createElement("rect",{x:C,y:k,height:P,width:T})))}},{key:"getXScales",value:function(){var x=this.state.xAxisMap;return x?Object.entries(x).reduce(function(E,C){var k=KF(C,2),P=k[0],T=k[1];return ye(ye({},E),{},at({},P,T.scale))},{}):null}},{key:"getYScales",value:function(){var x=this.state.yAxisMap;return x?Object.entries(x).reduce(function(E,C){var k=KF(C,2),P=k[0],T=k[1];return ye(ye({},E),{},at({},P,T.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(x){var E;return(E=this.state.xAxisMap)===null||E===void 0||(E=E[x])===null||E===void 0?void 0:E.scale}},{key:"getYScaleByAxisId",value:function(x){var E;return(E=this.state.yAxisMap)===null||E===void 0||(E=E[x])===null||E===void 0?void 0:E.scale}},{key:"getItemByXY",value:function(x){var E=this.state,C=E.formattedGraphicalItems,k=E.activeItem;if(C&&C.length)for(var P=0,T=C.length;P<T;P++){var I=C[P],N=I.props,B=I.item,M=B.type.defaultProps!==void 0?ye(ye({},B.type.defaultProps),B.props):B.props,F=zs(B.type);if(F==="Bar"){var U=(N.data||[]).find(function(D){return _3e(x,D)});if(U)return{graphicalItem:I,payload:U}}else if(F==="RadialBar"){var q=(N.data||[]).find(function(D){return iB(x,D)});if(q)return{graphicalItem:I,payload:q}}else if(Db(I,k)||Lb(I,k)||Lp(I,k)){var V=H5e({graphicalItem:I,activeTooltipItem:k,itemData:M.data}),K=M.activeIndex===void 0?V:M.activeIndex;return{graphicalItem:ye(ye({},I),{},{childIndex:K}),payload:Lp(I,k)?M.data[V]:I.props.data[V]}}}return null}},{key:"render",value:function(){var x=this;if(!m3(this))return null;var E=this.props,C=E.children,k=E.className,P=E.width,T=E.height,I=E.style,N=E.compact,B=E.title,M=E.desc,F=XF(E,sFe),U=it(F,!1);if(N)return Z.createElement(IF,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},Z.createElement(dT,Ru({},U,{width:P,height:T,title:B,desc:M}),this.renderClipPath(),v3(C,this.renderMap)));if(this.props.accessibilityLayer){var q,V;U.tabIndex=(q=this.props.tabIndex)!==null&&q!==void 0?q:0,U.role=(V=this.props.role)!==null&&V!==void 0?V:"application",U.onKeyDown=function(D){x.accessibilityManager.keyboardEvent(D)},U.onFocus=function(){x.accessibilityManager.focus()}}var K=this.parseEventsOfWrapper();return Z.createElement(IF,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},Z.createElement("div",Ru({className:mt("recharts-wrapper",k),style:ye({position:"relative",cursor:"default",width:P,height:T},I)},K,{ref:function($){x.container=$}}),Z.createElement(dT,Ru({},U,{width:P,height:T,title:B,desc:M,style:SFe}),this.renderClipPath(),v3(C,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(O.Component);at(_,"displayName",r),at(_,"defaultProps",ye({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},u)),at(_,"getDerivedStateFromProps",function(m,v){var b=m.dataKey,x=m.data,E=m.children,C=m.width,k=m.height,P=m.layout,T=m.stackOffset,I=m.margin,N=v.dataStartIndex,B=v.dataEndIndex;if(v.updateId===void 0){var M=YF(m);return ye(ye(ye({},M),{},{updateId:0},g(ye(ye({props:m},M),{},{updateId:0}),v)),{},{prevDataKey:b,prevData:x,prevWidth:C,prevHeight:k,prevLayout:P,prevStackOffset:T,prevMargin:I,prevChildren:E})}if(b!==v.prevDataKey||x!==v.prevData||C!==v.prevWidth||k!==v.prevHeight||P!==v.prevLayout||T!==v.prevStackOffset||!Fu(I,v.prevMargin)){var F=YF(m),U={chartX:v.chartX,chartY:v.chartY,isTooltipActive:v.isTooltipActive},q=ye(ye({},QF(v,x,P)),{},{updateId:v.updateId+1}),V=ye(ye(ye({},F),U),q);return ye(ye(ye({},V),g(ye({props:m},V),v)),{},{prevDataKey:b,prevData:x,prevWidth:C,prevHeight:k,prevLayout:P,prevStackOffset:T,prevMargin:I,prevChildren:E})}if(!cT(E,v.prevChildren)){var K,D,$,j,z=Ci(E,kd),X=z&&(K=(D=z.props)===null||D===void 0?void 0:D.startIndex)!==null&&K!==void 0?K:N,W=z&&($=(j=z.props)===null||j===void 0?void 0:j.endIndex)!==null&&$!==void 0?$:B,le=X!==N||W!==B,ce=!pt(x),ve=ce&&!le?v.updateId:v.updateId+1;return ye(ye({updateId:ve},g(ye(ye({props:m},v),{},{updateId:ve,dataStartIndex:X,dataEndIndex:W}),v)),{},{prevChildren:E,dataStartIndex:X,dataEndIndex:W})}return null}),at(_,"renderActiveDot",function(m,v,b){var x;return O.isValidElement(m)?x=O.cloneElement(m,v):ht(m)?x=m(v):x=Z.createElement(Ib,v),Z.createElement(qt,{className:"recharts-active-dot",key:b},x)});var y=O.forwardRef(function(v,b){return Z.createElement(_,Ru({},v,{ref:b}))});return y.displayName=_.displayName,y},NFe=$X({chartName:"LineChart",GraphicalChild:km,axisComponents:[{axisType:"xAxis",AxisComp:R2},{axisType:"yAxis",AxisComp:N2}],formatAxisMap:G$e}),MFe=$X({chartName:"PieChart",GraphicalChild:oa,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:jb},{axisType:"radiusAxis",AxisComp:Nb}],formatAxisMap:Ije,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function e6(e){const[t,r,n]=e.split(" ").map(g=>parseFloat(g)),i=t/360,o=r/100,s=n/100,a=(g,_,y)=>(y<0&&(y+=1),y>1&&(y-=1),y<1/6?g+(_-g)*6*y:y<1/2?_:y<2/3?g+(_-g)*(2/3-y)*6:g),l=s<.5?s*(1+o):s+o-s*o,c=2*s-l,d=Math.round(a(c,l,i+1/3)*255),u=Math.round(a(c,l,i)*255),p=Math.round(a(c,l,i-1/3)*255);return`#${((1<<24)+(d<<16)+(u<<8)+p).toString(16).slice(1)}`}function jFe(){const e=document.documentElement,t=getComputedStyle(e),r=n=>{const i=t.getPropertyValue(n).trim();return e6(i||{"--primary":"220 60% 65%","--success":"142 71% 45%","--warning":"38 92% 50%","--info":"220 60% 60%","--destructive":"8 75% 55%","--indigo":"239 65% 60%","--orange":"25 90% 55%","--muted":"220 20% 96%"}[n]||"220 60% 65%")};return{primary:r("--primary"),success:r("--success"),warning:r("--warning"),info:r("--info"),destructive:r("--destructive"),indigo:r("--indigo"),orange:r("--orange"),muted:r("--muted")}}function DFe({data:e,className:t="",height:r=50,color:n,strokeWidth:i=2}){const o=O.useMemo(()=>jFe(),[]),s=n||o.primary,a=O.useMemo(()=>e.map((l,c)=>({index:c,value:l})),[e]);return!e||e.length===0?null:w.jsx("div",{className:`w-full ${t}`,children:w.jsx(bG,{width:"100%",height:r,children:w.jsx(NFe,{data:a,margin:{top:2,right:2,bottom:2,left:2},children:w.jsx(km,{type:"monotone",dataKey:"value",stroke:s,strokeWidth:i,dot:!1,isAnimationActive:!1})})})})}const BX={all:["workflowStatusCounts"],detail:e=>[...BX.all,"detail",e]},LFe=30*1e3;function $Fe(e={}){const{staleTime:t=LFe,enabled:r=!0,refetchInterval:n=0}=e,i=Rt(fr),o=r&&!!i,s=ji({queryKey:BX.detail(i||""),queryFn:async()=>{if(!i)throw new Error("Project path is required");const l=await fetch(`/api/workflow-status-counts?projectPath=${encodeURIComponent(i)}`);if(!l.ok)throw new Error("Failed to fetch workflow status counts");return l.json()},staleTime:t,enabled:o,refetchInterval:n>0?n:!1,retry:2,retryDelay:l=>Math.min(1e3*2**l,1e4)}),a=async()=>{await s.refetch()};return{data:s.data,isLoading:s.isLoading,isFetching:s.isFetching,error:s.error,isStale:s.isStale,refetch:a}}const M2={all:["projectOverview"],detail:e=>[...M2.all,"detail",e]},BFe=300*1e3;function FFe(e={}){const{staleTime:t=BFe,enabled:r=!0}=e,n=Rt(fr),i=r&&!!n,o=ji({queryKey:M2.detail(n),queryFn:()=>PU(n),staleTime:t,enabled:i,retry:2,retryDelay:s=>Math.min(1e3*2**s,1e4)});return{projectOverview:o.data,isLoading:o.isLoading,error:o.error,refetch:o.refetch}}function Qze(){const e=Gn(),t=Rt(fr),r=Ei({mutationFn:n=>AU(n,t),onSuccess:()=>{e.invalidateQueries({queryKey:M2.detail()})}});return{updateGuidelines:r.mutateAsync,isUpdating:r.isPending,error:r.error}}const xv={completed:{bg:"bg-success",text:"text-success",dot:"bg-emerald-500",fill:"#10b981"},in_progress:{bg:"bg-warning",text:"text-warning",dot:"bg-amber-500",fill:"#f59e0b"},planning:{bg:"bg-violet-500",text:"text-violet-600",dot:"bg-violet-500",fill:"#8b5cf6"},paused:{bg:"bg-slate-400",text:"text-slate-500",dot:"bg-slate-400",fill:"#94a3b8"},archived:{bg:"bg-slate-300",text:"text-slate-400",dot:"bg-slate-300",fill:"#cbd5e1"}},zFe={completed:"sessions.status.completed",in_progress:"sessions.status.inProgress",planning:"sessions.status.planning",paused:"sessions.status.paused",archived:"sessions.status.archived"},t6={pending:{bg:"bg-muted",text:"text-muted-foreground",icon:to},completed:{bg:"bg-success/20",text:"text-success",icon:Wh},in_progress:{bg:"bg-warning/20",text:"text-warning",icon:to},blocked:{bg:"bg-destructive/20",text:"text-destructive",icon:Qa},skipped:{bg:"bg-slate-400/20",text:"text-slate-500",icon:to}};function UFe({className:e}){const{formatMessage:t}=$t();return w.jsx("div",{className:he("flex items-center justify-center h-full",e),children:w.jsx(dd,{className:"max-w-sm w-full border-dashed",children:w.jsxs(RO,{className:"flex flex-col items-center gap-4 py-8",children:[w.jsx("div",{className:"w-14 h-14 rounded-full bg-muted flex items-center justify-center",children:w.jsx(Vh,{className:"w-7 h-7 text-muted-foreground"})}),w.jsxs("div",{className:"text-center space-y-2",children:[w.jsx("h3",{className:"text-base font-semibold",children:t({id:"home.emptyState.noSessions.title"})}),w.jsx("p",{className:"text-sm text-muted-foreground",children:t({id:"home.emptyState.noSessions.message"})})]}),w.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[w.jsx("code",{className:"px-3 py-2 bg-muted rounded text-xs font-mono text-center",children:"/workflow-plan"}),w.jsx("p",{className:"text-xs text-muted-foreground text-center",children:t({id:"home.emptyState.noSessions.hint"})})]})]})})})}const r6={planning:{bg:"bg-violet-500/20",text:"text-violet-600"},in_progress:{bg:"bg-warning/20",text:"text-warning"},completed:{bg:"bg-success/20",text:"text-success"},paused:{bg:"bg-slate-400/20",text:"text-slate-500"},ready:{bg:"bg-success/20",text:"text-success"},initialized:{bg:"bg-info/20",text:"text-info"},archived:{bg:"bg-slate-300/20",text:"text-slate-400"},failed:{bg:"bg-destructive/20",text:"text-destructive"}},n6={primary:{card:"border-primary/30 bg-primary/5",icon:"bg-primary/10 text-primary"},info:{card:"border-info/30 bg-info/5",icon:"bg-info/10 text-info"},success:{card:"border-success/30 bg-success/5",icon:"bg-success/10 text-success"},warning:{card:"border-warning/30 bg-warning/5",icon:"bg-warning/10 text-warning"},danger:{card:"border-destructive/30 bg-destructive/5",icon:"bg-destructive/10 text-destructive"},default:{card:"border-border",icon:"bg-muted text-muted-foreground"}};function _u({icon:e,title:t,value:r,variant:n,sparklineData:i}){const o=n6[n]||n6.default;return w.jsxs("div",{className:he("rounded-lg border p-3 transition-all hover:shadow-sm h-full flex flex-col",o.card),children:[w.jsxs("div",{className:"flex items-start justify-between gap-2",children:[w.jsxs("div",{className:"flex-1 min-w-0",children:[w.jsx("p",{className:"text-xs font-medium text-muted-foreground truncate",children:t}),w.jsx("p",{className:"text-xl font-bold text-card-foreground mt-1",children:r.toLocaleString()})]}),w.jsx("div",{className:he("flex h-7 w-7 items-center justify-center rounded-md shrink-0",o.icon),children:w.jsx(e,{className:"h-4 w-4"})})]}),i&&i.length>0&&w.jsx("div",{className:"mt-auto pt-2 -mx-1",children:w.jsx(DFe,{data:i,height:28,strokeWidth:1.5})})]})}function xu(e,t=.3){const n=[];let i=Math.max(0,e*(1-t));for(let o=0;o<6;o++){n.push(Math.round(i));const s=(Math.random()-.5)*2*t*e;i=Math.max(0,i+s)}return n.push(e),n}function HFe({className:e}){var N,B,M,F,U,q,V,K,D,$,j,z,X,W,le,ce,ve,H,Q,Y,re,ge,ee,Ie,Re,xe,et;const{formatMessage:t}=$t(),r=Sc(),{data:n,isLoading:i}=$Fe(),{stats:o,isLoading:s}=ipe({refetchInterval:6e4}),{projectOverview:a,isLoading:l}=FFe(),{activeSessions:c,isLoading:d}=LH({filter:{location:"active"}}),u=n||[],p=u.reduce((be,ot)=>be+ot.count,0),g=u.length>0,_=O.useMemo(()=>({activeSessions:xu((o==null?void 0:o.activeSessions)??0,.4),totalTasks:xu((o==null?void 0:o.totalTasks)??0,.3),completedTasks:xu((o==null?void 0:o.completedTasks)??0,.25),pendingTasks:xu((o==null?void 0:o.pendingTasks)??0,.35),failedTasks:xu((o==null?void 0:o.failedTasks)??0,.5),todayActivity:xu((o==null?void 0:o.todayActivity)??0,.6)}),[o]),[y,m]=O.useState(!1),[v,b]=O.useState(0),x=c.length,E=c[v],C=O.useCallback(be=>{if(!be)return"";const ot=new Date(be);return isNaN(ot.getTime())?"":ot.toLocaleDateString()},[]);O.useEffect(()=>{if(x<=1)return;const be=setInterval(()=>{b(ot=>(ot+1)%x)},5e3);return()=>clearInterval(be)},[x]);const k=()=>{b(be=>be===0?x-1:be-1)},P=()=>{b(be=>(be+1)%x)},T=be=>{r(`/sessions/${be}`)},I=be=>be==="in_progress"?"in_progress":be==="blocked"?"blocked":be==="skipped"?"skipped":be;return w.jsxs("div",{className:he("flex flex-col gap-2",e),children:[w.jsx(dd,{className:"shrink-0 border-gradient-brand",children:l?w.jsxs("div",{className:"px-4 py-3 flex items-center gap-4",children:[w.jsx("div",{className:"h-5 w-32 bg-muted rounded animate-pulse"}),w.jsx("div",{className:"h-4 w-48 bg-muted rounded animate-pulse"})]}):w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"px-5 py-4 flex items-center gap-6 flex-wrap",children:[w.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[w.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:w.jsx(CM,{className:"h-5 w-5 text-primary"})}),w.jsxs("div",{className:"min-w-0",children:[w.jsx("h2",{className:"text-base font-semibold text-foreground truncate",children:(a==null?void 0:a.projectName)||"Claude Code Workflow"}),w.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[300px]",children:(a==null?void 0:a.description)||"AI-powered workflow management system"})]})]}),w.jsx("div",{className:"h-10 w-px bg-border hidden md:block"}),w.jsxs("div",{className:"flex items-center gap-2.5 text-xs",children:[w.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-blue-500/10 text-blue-600 font-medium",children:[w.jsx(CM,{className:"h-3.5 w-3.5"}),((M=(B=(N=a==null?void 0:a.technologyStack)==null?void 0:N.languages)==null?void 0:B[0])==null?void 0:M.name)||"TypeScript"]}),w.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-green-500/10 text-green-600 font-medium",children:[w.jsx(yk,{className:"h-3.5 w-3.5"}),((U=(F=a==null?void 0:a.technologyStack)==null?void 0:F.frameworks)==null?void 0:U[0])||"Node.js"]}),w.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-violet-500/10 text-violet-600 font-medium",children:[w.jsx(vk,{className:"h-3.5 w-3.5"}),((q=a==null?void 0:a.architecture)==null?void 0:q.style)||"Modular Monolith"]}),((K=(V=a==null?void 0:a.technologyStack)==null?void 0:V.build_tools)==null?void 0:K[0])&&w.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-orange-500/10 text-orange-600 font-medium",children:[w.jsx(ju,{className:"h-3.5 w-3.5"}),a.technologyStack.build_tools[0]]})]}),w.jsx("div",{className:"h-10 w-px bg-border hidden lg:block"}),w.jsxs("div",{className:"flex items-center gap-5 text-xs",children:[w.jsxs("div",{className:"flex items-center gap-2 text-emerald-600",children:[w.jsx(bk,{className:"h-3.5 w-3.5"}),w.jsx("span",{className:"font-semibold",children:(($=(D=a==null?void 0:a.developmentIndex)==null?void 0:D.feature)==null?void 0:$.length)||0}),w.jsx("span",{className:"text-muted-foreground",children:t({id:"projectOverview.devIndex.category.features"})})]}),w.jsxs("div",{className:"flex items-center gap-2 text-amber-600",children:[w.jsx(xM,{className:"h-3.5 w-3.5"}),w.jsx("span",{className:"font-semibold",children:((z=(j=a==null?void 0:a.developmentIndex)==null?void 0:j.bugfix)==null?void 0:z.length)||0}),w.jsx("span",{className:"text-muted-foreground",children:t({id:"projectOverview.devIndex.category.bugfixes"})})]}),w.jsxs("div",{className:"flex items-center gap-2 text-blue-600",children:[w.jsx(Vx,{className:"h-3.5 w-3.5"}),w.jsx("span",{className:"font-semibold",children:((W=(X=a==null?void 0:a.developmentIndex)==null?void 0:X.enhancement)==null?void 0:W.length)||0}),w.jsx("span",{className:"text-muted-foreground",children:t({id:"projectOverview.devIndex.category.enhancements"})})]})]}),w.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground ml-auto",children:[w.jsxs("span",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-md bg-muted/50",children:[w.jsx(wM,{className:"h-3.5 w-3.5"}),a!=null&&a.initializedAt?new Date(a.initializedAt).toLocaleDateString():new Date().toLocaleDateString()]}),w.jsx(Ze,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-muted",onClick:()=>m(!y),children:y?w.jsx(y0,{className:"h-4 w-4"}):w.jsx(ea,{className:"h-4 w-4"})})]})]}),y&&w.jsxs("div",{className:"px-5 pb-4 grid grid-cols-4 gap-6 border-t border-border/50 pt-4",children:[w.jsxs("div",{className:"space-y-2",children:[w.jsxs("h4",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[w.jsx(vk,{className:"h-4 w-4 text-primary"}),t({id:"projectOverview.architecture.title"})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsx("div",{className:"flex items-center gap-2",children:w.jsx("span",{className:"text-sm font-medium text-foreground",children:((le=a==null?void 0:a.architecture)==null?void 0:le.style)||"Modular Monolith"})}),w.jsxs("p",{className:"text-xs text-muted-foreground",children:[t({id:"projectOverview.architecture.layers"}),":"]}),w.jsx("div",{className:"flex flex-wrap gap-1.5",children:(((ce=a==null?void 0:a.architecture)==null?void 0:ce.layers)||["CLI Tools","Core Services","Dashboard UI","Data Layer"]).slice(0,5).map((be,ot)=>w.jsx("span",{className:"text-xs px-2 py-1 rounded-md bg-muted text-muted-foreground font-medium",children:be},ot))})]})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs("h4",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[w.jsx(ju,{className:"h-4 w-4 text-orange-500"}),t({id:"projectOverview.components.title"})]}),w.jsx("div",{className:"space-y-1.5",children:((a==null?void 0:a.keyComponents)||[{name:"Session Manager",description:"Workflow session lifecycle"},{name:"Dashboard Generator",description:"Dynamic widget rendering"},{name:"Data Aggregator",description:"Stats and metrics collection"},{name:"Task Scheduler",description:"Async task orchestration"}]).slice(0,4).map((be,ot)=>w.jsxs("div",{className:"flex items-start gap-2",children:[w.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-orange-500 mt-1.5 shrink-0"}),w.jsxs("div",{className:"min-w-0",children:[w.jsx("p",{className:"text-xs font-medium text-foreground truncate",children:be.name}),be.description&&w.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:be.description})]})]},ot))})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs("h4",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[w.jsx(Vx,{className:"h-4 w-4 text-blue-500"}),t({id:"projectOverview.devIndex.title"})]}),w.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[w.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-emerald-500/10",children:[w.jsx(bk,{className:"h-3.5 w-3.5 text-emerald-600"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-semibold text-emerald-600",children:((H=(ve=a==null?void 0:a.developmentIndex)==null?void 0:ve.feature)==null?void 0:H.length)||10}),w.jsx("p",{className:"text-[10px] text-emerald-600/80",children:t({id:"projectOverview.devIndex.category.features"})})]})]}),w.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-blue-500/10",children:[w.jsx(Vx,{className:"h-3.5 w-3.5 text-blue-600"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-semibold text-blue-600",children:((Y=(Q=a==null?void 0:a.developmentIndex)==null?void 0:Q.enhancement)==null?void 0:Y.length)||5}),w.jsx("p",{className:"text-[10px] text-blue-600/80",children:t({id:"projectOverview.devIndex.category.enhancements"})})]})]}),w.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-amber-500/10",children:[w.jsx(xM,{className:"h-3.5 w-3.5 text-amber-600"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-semibold text-amber-600",children:((ge=(re=a==null?void 0:a.developmentIndex)==null?void 0:re.bugfix)==null?void 0:ge.length)||3}),w.jsx("p",{className:"text-[10px] text-amber-600/80",children:t({id:"projectOverview.devIndex.category.bugfixes"})})]})]}),w.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-violet-500/10",children:[w.jsx(ju,{className:"h-3.5 w-3.5 text-violet-600"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-semibold text-violet-600",children:((Ie=(ee=a==null?void 0:a.developmentIndex)==null?void 0:ee.refactor)==null?void 0:Ie.length)||2}),w.jsx("p",{className:"text-[10px] text-violet-600/80",children:t({id:"projectOverview.devIndex.category.refactorings"})})]})]})]})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs("h4",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[w.jsx(Hz,{className:"h-4 w-4 text-violet-500"}),t({id:"projectOverview.architecture.patterns"})]}),w.jsx("div",{className:"flex flex-wrap gap-1.5",children:(((Re=a==null?void 0:a.architecture)==null?void 0:Re.patterns)||["Factory","Strategy","Observer","Singleton","Decorator"]).slice(0,6).map((be,ot)=>w.jsx("span",{className:"text-xs px-2.5 py-1 rounded-md bg-primary/10 text-primary font-medium",children:be},ot))})]})]})]})}),w.jsxs(dd,{className:"h-[400px] flex shrink-0 overflow-hidden",children:[w.jsxs("div",{className:"w-[28%] p-3 flex flex-col border-r border-border",children:[w.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-1.5",children:[w.jsx(tne,{className:"h-4 w-4"}),t({id:"home.sections.statistics"})]}),s?w.jsx("div",{className:"grid grid-cols-2 grid-rows-3 gap-2.5 flex-1",children:[1,2,3,4,5,6].map(be=>w.jsx("div",{className:"bg-muted rounded animate-pulse"},be))}):w.jsxs("div",{className:"grid grid-cols-2 grid-rows-3 gap-2.5 flex-1",children:[w.jsx(_u,{icon:_0,title:t({id:"home.stats.activeSessions"}),value:(o==null?void 0:o.activeSessions)??0,variant:"primary",sparklineData:_.activeSessions}),w.jsx(_u,{icon:Vh,title:t({id:"home.stats.totalTasks"}),value:(o==null?void 0:o.totalTasks)??0,variant:"info",sparklineData:_.totalTasks}),w.jsx(_u,{icon:Wh,title:t({id:"home.stats.completedTasks"}),value:(o==null?void 0:o.completedTasks)??0,variant:"success",sparklineData:_.completedTasks}),w.jsx(_u,{icon:to,title:t({id:"home.stats.pendingTasks"}),value:(o==null?void 0:o.pendingTasks)??0,variant:"warning",sparklineData:_.pendingTasks}),w.jsx(_u,{icon:Qa,title:t({id:"common.status.failed"}),value:(o==null?void 0:o.failedTasks)??0,variant:"danger",sparklineData:_.failedTasks}),w.jsx(_u,{icon:$z,title:t({id:"common.stats.todayActivity"}),value:(o==null?void 0:o.todayActivity)??0,variant:"default",sparklineData:_.todayActivity})]})]}),w.jsxs("div",{className:"w-[22%] p-3 flex flex-col border-r border-border",children:[w.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-1.5",children:[w.jsx(SM,{className:"h-4 w-4"}),t({id:"home.widgets.workflowStatus"})]}),i?w.jsx("div",{className:"flex-1 flex items-center justify-center",children:w.jsx("div",{className:"w-24 h-24 rounded-full bg-muted animate-pulse"})}):g?w.jsxs("div",{className:"flex-1 flex flex-col",children:[w.jsx("div",{className:"flex-1 min-h-0",children:w.jsx(bG,{width:"100%",height:"100%",children:w.jsx(MFe,{children:w.jsx(oa,{data:u,cx:"50%",cy:"50%",innerRadius:"55%",outerRadius:"85%",paddingAngle:2,dataKey:"count",children:u.map(be=>{const ot=xv[be.status]||xv.completed;return w.jsx(bb,{fill:ot.fill},be.status)})})})})}),w.jsx("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 mt-3",children:u.map(be=>{const ot=xv[be.status]||xv.completed,xt=p>0?Math.round(be.count/p*100):0;return w.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[w.jsx("div",{className:he("w-2.5 h-2.5 rounded-full shrink-0",ot.dot)}),w.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t({id:zFe[be.status]??"sessions.status.inProgress"})}),w.jsxs("span",{className:"text-xs font-medium text-foreground ml-auto",children:[xt,"%"]})]},be.status)})})]}):w.jsx("div",{className:"flex-1 flex items-center justify-center",children:w.jsxs("div",{className:"text-center",children:[w.jsx(SM,{className:"w-12 h-12 mx-auto text-muted-foreground/30 mb-2"}),w.jsx("p",{className:"text-xs text-muted-foreground",children:t({id:"home.emptyState.noSessions.message"})})]})})]}),w.jsxs("div",{className:"flex-1 min-w-0 p-4 flex flex-col",children:[w.jsxs("div",{className:"flex items-center justify-between mb-3",children:[w.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-1.5",children:[w.jsx(Vh,{className:"h-4 w-4"}),t({id:"home.sections.taskDetails"})]}),x>0&&w.jsxs("div",{className:"flex items-center gap-1.5",children:[w.jsx(Ze,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:k,disabled:x<=1,children:w.jsx(rne,{className:"h-4 w-4"})}),w.jsxs("span",{className:"text-xs text-muted-foreground min-w-[45px] text-center",children:[v+1," / ",x]}),w.jsx(Ze,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:P,disabled:x<=1,children:w.jsx(Fz,{className:"h-4 w-4"})})]})]}),d?w.jsx("div",{className:"flex-1 flex items-center justify-center",children:w.jsxs("div",{className:"w-full max-w-sm space-y-3",children:[w.jsx("div",{className:"h-8 bg-muted rounded animate-pulse"}),w.jsx("div",{className:"h-4 bg-muted rounded animate-pulse w-3/4"}),w.jsx("div",{className:"h-20 bg-muted rounded animate-pulse"})]})}):x===0?w.jsx(UFe,{}):E?w.jsxs("div",{className:"flex-1 flex flex-col min-h-0 rounded-lg border border-border bg-accent/20 p-3 overflow-hidden cursor-pointer hover:border-primary/30 transition-colors",onClick:()=>T(E.session_id),children:[w.jsxs("div",{className:"mb-2 pb-2 border-b border-border shrink-0 min-w-0",children:[w.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[w.jsx("div",{className:he("px-2 py-1 rounded text-xs font-medium shrink-0",((xe=r6[E.status])==null?void 0:xe.bg)||"bg-muted",((et=r6[E.status])==null?void 0:et.text)||"text-muted-foreground"),children:t({id:`common.status.${E.status==="in_progress"?"inProgress":E.status}`})}),w.jsxs("div",{className:"flex-1 min-w-0 overflow-hidden",children:[w.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:E.title||E.session_id}),w.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.session_id})]})]}),E.description&&w.jsx("p",{className:"text-xs text-muted-foreground mt-2 line-clamp-2",children:E.description}),E.tasks&&E.tasks.length>0&&w.jsxs("div",{className:"mt-2.5 space-y-1",children:[w.jsxs("div",{className:"flex items-center justify-between text-xs",children:[w.jsx("span",{className:"text-muted-foreground",children:t({id:"common.labels.progress"})}),w.jsxs("span",{className:"font-medium text-foreground",children:[E.tasks.filter(be=>be.status==="completed").length,"/",E.tasks.length]})]}),w.jsx(sb,{value:E.tasks.length>0?E.tasks.filter(be=>be.status==="completed").length/E.tasks.length*100:0,className:"h-1.5 bg-muted",indicatorClassName:"bg-success"})]}),w.jsx("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:w.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground ml-auto",children:[w.jsx(wM,{className:"h-3 w-3"}),C(E.updated_at||E.created_at)]})})]}),E.tasks&&E.tasks.length>0?w.jsx("div",{className:"flex-1 overflow-auto min-h-0",children:w.jsx("div",{className:"grid grid-cols-2 gap-2 w-full",children:E.tasks.map((be,ot)=>{const xt=I(be.status),pr=t6[xt]||t6.pending,sr=pr.icon,Pt=E.tasks.length%2===1&&ot===E.tasks.length-1;return w.jsxs("div",{className:he("flex items-center gap-2 p-2 rounded hover:bg-background/50 transition-colors min-w-0",Pt&&"col-span-2"),children:[w.jsx("div",{className:he("p-1 rounded shrink-0",pr.bg),children:w.jsx(sr,{className:he("h-3 w-3",pr.text)})}),w.jsx("p",{className:he("flex-1 text-xs font-medium truncate",be.status==="completed"?"text-muted-foreground line-through":"text-foreground"),children:be.title||be.task_id})]},`${E.session_id}-${be.task_id}-${ot}`)})})}):w.jsx("div",{className:"flex-1 flex items-center justify-center",children:w.jsx("p",{className:"text-xs text-muted-foreground",children:t({id:"home.emptyState.noTasks.message"})})})]}):null,x>1&&w.jsx("div",{className:"flex items-center justify-center gap-1 mt-2",children:c.map((be,ot)=>w.jsx("button",{onClick:()=>b(ot),className:he("w-1.5 h-1.5 rounded-full transition-colors",ot===v?"bg-primary":"bg-muted hover:bg-muted-foreground/50")},ot))})]})]})]})}const qFe=O.memo(HFe);function WFe(e={}){const t=Gn(),r=Rt(fr),n=(e.enabled??!0)&&!!r,{data:i={litePlan:[],liteFix:[],multiCliPlan:[]},isLoading:o,error:s,refetch:a}=ji({queryKey:ke.liteTasks(r),queryFn:()=>sA(r),staleTime:3e4,refetchInterval:e.refetchInterval,enabled:n}),l=[...(i.litePlan||[]).map(u=>({...u,_type:"lite-plan"})),...(i.liteFix||[]).map(u=>({...u,_type:"lite-fix"})),...(i.multiCliPlan||[]).map(u=>({...u,_type:"multi-cli-plan"}))],c=u=>{switch(u){case"lite-plan":return i.litePlan||[];case"lite-fix":return i.liteFix||[];case"multi-cli-plan":return i.multiCliPlan||[]}},d=(u,p)=>{t.prefetchQuery({queryKey:["liteTask",u,p],queryFn:()=>RU(u,p,r),staleTime:6e4})};return{litePlan:i.litePlan||[],liteFix:i.liteFix||[],multiCliPlan:i.multiCliPlan||[],allSessions:l,getSessionsByType:c,prefetchSession:d,isLoading:o,error:s,refetch:a}}const VFe=[{key:"all",label:"home.tabs.allTasks",icon:_0},{key:"workflow",label:"home.tabs.workflow",icon:nm},{key:"lite",label:"home.tabs.liteTasks",icon:Gh}],GFe={in_progress:Wn,running:Wn,planning:Uz,completed:Wh,failed:Qa,paused:nne,pending:to,cancelled:Qa,idle:to,initializing:Wn,ready:Wh},KFe={in_progress:"bg-warning/20 text-warning border-warning/30",running:"bg-warning/20 text-warning border-warning/30",planning:"bg-violet-500/20 text-violet-600 border-violet-500/30",completed:"bg-success/20 text-success border-success/30",failed:"bg-destructive/20 text-destructive border-destructive/30",paused:"bg-slate-400/20 text-slate-500 border-slate-400/30",pending:"bg-muted text-muted-foreground border-border",cancelled:"bg-destructive/20 text-destructive border-destructive/30",idle:"bg-muted text-muted-foreground border-border",initializing:"bg-info/20 text-info border-info/30",ready:"bg-success/20 text-success border-success/30"},i6={in_progress:"inProgress",running:"running",planning:"planning",completed:"completed",failed:"failed",paused:"paused",pending:"pending",cancelled:"cancelled",idle:"idle",initializing:"initializing",ready:"ready"},XFe={"lite-plan":Uz,"lite-fix":ju,"multi-cli-plan":Hz},ZFe={all:"bg-muted text-muted-foreground",workflow:"bg-primary/20 text-primary",lite:"bg-amber-500/20 text-amber-600"};function QFe({item:e,onClick:t}){const{formatMessage:r}=$t(),n=GFe[e.status]||to,i=e.subType?XFe[e.subType]||Gh:e.type==="workflow"?nm:Gh,o=e.status==="in_progress"||e.status==="running"||e.status==="initializing";return w.jsx("button",{onClick:t,className:"w-full text-left p-3 rounded-lg border border-border bg-card hover:bg-accent/50 hover:border-primary/30 transition-all group",children:w.jsxs("div",{className:"flex items-start gap-2.5 min-w-0",children:[w.jsx("div",{className:he("p-1.5 rounded-md shrink-0",ZFe[e.type]),children:w.jsx(i,{className:"h-4 w-4"})}),w.jsxs("div",{className:"flex-1 min-w-0 overflow-hidden",children:[w.jsxs("div",{className:"flex items-start gap-2 mb-1 min-w-0",children:[w.jsx("h4",{className:"text-sm font-medium text-foreground truncate flex-1 min-w-0 group-hover:text-primary transition-colors",children:e.name}),w.jsxs(Vn,{className:he("text-[10px] px-1.5 py-0 shrink-0 border",KFe[e.status]),children:[w.jsx(n,{className:he("h-2.5 w-2.5 mr-0.5",o&&"animate-spin")}),r({id:`common.status.${e.statusKey}`})]})]}),e.description&&w.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-1.5",children:e.description}),typeof e.progress=="number"&&e.progress>0&&w.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[w.jsx(sb,{value:e.progress,className:"h-1 flex-1 bg-muted"}),w.jsxs("span",{className:"text-[10px] text-muted-foreground w-8 text-right",children:[e.progress,"%"]})]}),w.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[w.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground",children:[w.jsx(to,{className:"h-2.5 w-2.5"}),e.createdAt]}),e.subType&&w.jsx(Vn,{variant:"outline",className:"text-[9px] px-1 py-0 bg-background",children:e.subType}),e.tags&&e.tags.slice(0,2).map(s=>w.jsxs(Vn,{variant:"outline",className:"text-[9px] px-1 py-0 gap-0.5 bg-background",children:[w.jsx(One,{className:"h-2 w-2"}),s]},s)),e.tags&&e.tags.length>2&&w.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["+",e.tags.length-2]})]})]})]})})}function YFe(){return w.jsx("div",{className:"p-3 rounded-lg border border-border bg-card animate-pulse",children:w.jsxs("div",{className:"flex items-start gap-2.5",children:[w.jsx("div",{className:"w-8 h-8 rounded-md bg-muted"}),w.jsxs("div",{className:"flex-1",children:[w.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[w.jsx("div",{className:"h-4 bg-muted rounded flex-1"}),w.jsx("div",{className:"h-4 w-16 bg-muted rounded"})]}),w.jsx("div",{className:"h-3 bg-muted rounded w-3/4 mb-2"}),w.jsxs("div",{className:"flex gap-2",children:[w.jsx("div",{className:"h-3 w-16 bg-muted rounded"}),w.jsx("div",{className:"h-3 w-12 bg-muted rounded"})]})]})]})})}function JFe({className:e,maxItems:t=6}){const{formatMessage:r}=$t(),n=Sc(),[i,o]=O.useState("all"),{activeSessions:s,isLoading:a}=LH({filter:{location:"active"}}),{allSessions:l,isLoading:c}=WFe(),d=O.useCallback(m=>{if(!m)return r({id:"common.time.justNow"});const v=new Date(m);if(isNaN(v.getTime()))return r({id:"common.time.justNow"});const x=new Date().getTime()-v.getTime(),E=Math.floor(x/6e4),C=Math.floor(E/60),k=Math.floor(C/24);return E<1?r({id:"common.time.justNow"}):E<60?r({id:"common.time.minutesAgo"},{count:E}):C<24?r({id:"common.time.hoursAgo"},{count:C}):r({id:"common.time.daysAgo"},{count:k})},[r]),u=O.useMemo(()=>{const m=[];return s.forEach(v=>{const b=v.status||"pending";m.push({id:v.session_id,name:v.title||v.description||v.session_id,type:"workflow",status:b,statusKey:i6[b]||b,createdAt:d(v.created_at),description:v.description||`Session: ${v.session_id}`,tags:[],progress:void 0})}),l.forEach(v=>{const b=v.status||"pending",x=v.session_id||v.id;m.push({id:x,name:v.title||x,type:"lite",subType:v._type,status:b,statusKey:i6[b]||b,createdAt:d(v.createdAt),description:v.description||`${v._type} task`,tags:[],progress:void 0})}),m},[s,l,d]),p=O.useMemo(()=>i==="all"?u.slice(0,t):u.filter(m=>m.type===i).slice(0,t),[u,i,t]),g=m=>{switch(m.type){case"workflow":n(`/sessions/${m.id}`);break;case"lite":n(`/lite-tasks/${m.subType}/${m.id}`);break}},_=()=>{n("/sessions")},y=a||c;return w.jsx("div",{className:e,children:w.jsxs(dd,{className:"h-full p-4 flex flex-col",children:[w.jsxs("div",{className:"flex items-center justify-between mb-3",children:[w.jsx("h3",{className:"text-sm font-semibold text-foreground",children:r({id:"home.sections.recentTasks"})}),w.jsx(Ze,{variant:"link",size:"sm",className:"text-xs h-auto p-0",onClick:_,children:r({id:"common.actions.viewAll"})})]}),w.jsx("div",{className:"flex gap-1 mb-3 overflow-x-auto pb-1",children:VFe.map(m=>{const v=m.icon,b=m.key==="all"?u.length:u.filter(x=>x.type===m.key).length;return w.jsxs(Ze,{variant:i===m.key?"default":"ghost",size:"sm",onClick:()=>o(m.key),className:he("whitespace-nowrap text-xs gap-1 h-7 px-2",i===m.key&&"bg-primary text-primary-foreground"),children:[w.jsx(v,{className:"h-3 w-3"}),r({id:m.label}),w.jsxs("span",{className:"text-[10px] opacity-70",children:["(",b,")"]})]},m.key)})}),w.jsx("div",{className:"flex-1 overflow-auto",children:y?w.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2",children:Array.from({length:6}).map((m,v)=>w.jsx(YFe,{},v))}):p.length===0?w.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[w.jsx(_0,{className:"h-10 w-10 text-muted-foreground mb-2"}),w.jsx("p",{className:"text-sm text-muted-foreground",children:r({id:"home.emptyState.noTasks.message"})})]}):w.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2",children:p.map(m=>w.jsx(QFe,{item:m,onClick:()=>g(m)},`${m.type}-${m.id}`))})})]})})}const e6e=O.memo(JFe);function t6e(){const{formatMessage:e}=$t(),[t,r]=O.useState(!1),n=()=>{window.location.reload()};return w.jsxs("div",{className:"space-y-6",children:[w.jsx(dTe,{titleKey:"home.dashboard.title",descriptionKey:"home.dashboard.description",onRefresh:n}),t&&w.jsxs("div",{className:"flex items-center gap-2 p-4 rounded-lg bg-destructive/10 border border-destructive/30 text-destructive",children:[w.jsx(Ds,{className:"h-5 w-5 flex-shrink-0"}),w.jsxs("div",{className:"flex-1",children:[w.jsx("p",{className:"text-sm font-medium",children:e({id:"home.errors.loadFailed"})}),w.jsx("p",{className:"text-xs mt-0.5",children:e({id:"common.errors.unknownError"})})]}),w.jsx(Ze,{variant:"outline",size:"sm",onClick:n,children:e({id:"home.errors.retry"})})]}),w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx(qFe,{}),w.jsx(e6e,{})]})]})}const r6e=O.lazy(()=>Lt(()=>import("./SessionsPage-Dkc1Hv8W.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(e=>({default:e.SessionsPage}))),n6e=O.lazy(()=>Lt(()=>import("./FixSessionPage-C74-MPza.js"),[]).then(e=>({default:e.FixSessionPage}))),i6e=O.lazy(()=>Lt(()=>import("./ProjectOverviewPage-sXSWMbF8.js"),__vite__mapDeps([9,10,11,12,13,14])).then(e=>({default:e.ProjectOverviewPage}))),o6e=O.lazy(()=>Lt(()=>import("./SessionDetailPage-Cym_RvC9.js"),__vite__mapDeps([15,16,17,1,18,2,19,20,21,22,13,4,6])).then(e=>({default:e.SessionDetailPage}))),s6e=O.lazy(()=>Lt(()=>import("./HistoryPage-C00fh0HE.js"),__vite__mapDeps([23,24,20,25,26,3,4,27,28,5,7])).then(e=>({default:e.HistoryPage}))),a6e=O.lazy(()=>Lt(()=>import("./OrchestratorPage-Ib9TM6HE.js"),__vite__mapDeps([29,19,30,1,31,32,33,34,12,7,35,36,37,21])).then(e=>({default:e.OrchestratorPage}))),l6e=O.lazy(()=>Lt(()=>import("./IssueHubPage-T_VSvUMh.js"),__vite__mapDeps([38,10,3,11,1,39,26,36,40,41,42,14,43,37,7])).then(e=>({default:e.IssueHubPage}))),c6e=O.lazy(()=>Lt(()=>import("./SkillsManagerPage-BGDWYAyI.js"),__vite__mapDeps([44,6,16,41,45,3,1,42,46,27,20,4,11,7,47,48,49,50,51,52,33,32,36,35,21])).then(e=>({default:e.SkillsManagerPage}))),u6e=O.lazy(()=>Lt(()=>import("./CommandsManagerPage-Bjx1bPbH.js"),__vite__mapDeps([53,6,31,32,52,16,47,48,49,20,50,4,7])).then(e=>({default:e.CommandsManagerPage}))),d6e=O.lazy(()=>Lt(()=>import("./MemoryPage-CWKmXY5k.js"),__vite__mapDeps([54,6,4,55,1,56,7,57,5,26,11,58,59])).then(e=>({default:e.MemoryPage}))),f6e=O.lazy(()=>Lt(()=>import("./SettingsPage-Rik9cUIj.js"),__vite__mapDeps([60,41,61,62,2,18,63,50,4,12,64,27,37,22,20])).then(e=>({default:e.SettingsPage}))),h6e=O.lazy(()=>Lt(()=>import("./NotFoundPage-B1duXK6r.js"),[]).then(e=>({default:e.NotFoundPage}))),o6=O.lazy(()=>Lt(()=>import("./LiteTasksPage-DmcgvIvi.js"),__vite__mapDeps([65,6,17,16,1,18,2,19,20,21,22,7,24,26,27,43,30])).then(e=>({default:e.LiteTasksPage}))),p6e=O.lazy(()=>Lt(()=>import("./ReviewSessionPage-D5qJyr3s.js"),__vite__mapDeps([66,1])).then(e=>({default:e.ReviewSessionPage}))),m6e=O.lazy(()=>Lt(()=>import("./McpManagerPage-C_a7QSKz.js"),__vite__mapDeps([67,41,51,50,4,46,27,18,45,47,48,49,20,68,12,24,1,8,40,55,6,34,11])).then(e=>({default:e.McpManagerPage}))),g6e=O.lazy(()=>Lt(()=>import("./EndpointsPage-CuwpbCzK.js"),__vite__mapDeps([69,70,62,32,52,71,45,11])).then(e=>({default:e.EndpointsPage}))),v6e=O.lazy(()=>Lt(()=>import("./InstallationsPage-CYuMQDbC.js"),__vite__mapDeps([72,70,62,32,22,37])).then(e=>({default:e.InstallationsPage}))),y6e=O.lazy(()=>Lt(()=>import("./HookManagerPage-CtVTB_ae.js"),__vite__mapDeps([73,41,45,11,63,70,62,32,74,75])).then(e=>({default:e.HookManagerPage}))),b6e=O.lazy(()=>Lt(()=>import("./RulesManagerPage-DyawK8QE.js"),__vite__mapDeps([76,70,62,32,52,20,3,11,6,7,51,8])).then(e=>({default:e.RulesManagerPage}))),_6e=O.lazy(()=>Lt(()=>import("./PromptHistoryPage-B6jaqG12.js"),__vite__mapDeps([77,26,57,14,75,27,28,1,39,8])).then(e=>({default:e.PromptHistoryPage}))),x6e=O.lazy(()=>Lt(()=>import("./ExplorerPage-cvlx0Zw0.js"),__vite__mapDeps([78,49,20,36,35])).then(e=>({default:e.ExplorerPage}))),w6e=O.lazy(()=>Lt(()=>import("./GraphExplorerPage-Bg5-aQxi.js"),__vite__mapDeps([79,19,8,1,22,80,21])).then(e=>({default:e.GraphExplorerPage}))),S6e=O.lazy(()=>Lt(()=>import("./ApiSettingsPage-CVK108u2.js"),__vite__mapDeps([81,6,52,82,62,32,3,11,16,50,4,41,1,68,12,18])).then(e=>({default:e.ApiSettingsPage}))),C6e=O.lazy(()=>Lt(()=>import("./CliViewerPage-VYnQGjxU.js"),__vite__mapDeps([83,84,85,86,80,56,10,7])).then(e=>({default:e.CliViewerPage}))),E6e=O.lazy(()=>Lt(()=>import("./CliSessionSharePage-bJZAYI38.js"),[]).then(e=>({default:e.CliSessionSharePage}))),k6e=O.lazy(()=>Lt(()=>import("./TeamPage-C6bdFWn8.js"),__vite__mapDeps([87,6,52,8,1,22,20,25,3,4,58,5,7])).then(e=>({default:e.TeamPage}))),T6e=O.lazy(()=>Lt(()=>import("./TerminalDashboardPage-Zofi_DZM.js"),__vite__mapDeps([88,84,85,82,62,32,20,89,10,7,49,41,1,48,63,74,40,28,50,4])).then(e=>({default:e.TerminalDashboardPage}))),P6e=O.lazy(()=>Lt(()=>import("./AnalysisPage-Bc4p4SvJ.js"),__vite__mapDeps([90,6,86,80,56,7,1])).then(e=>({default:e.AnalysisPage}))),A6e=O.lazy(()=>Lt(()=>import("./SpecsSettingsPage-CTiA1DMP.js"),__vite__mapDeps([91,52,1,3,4,11,51,20,12,61,71,8,39,89])).then(e=>({default:e.SpecsSettingsPage}))),O6e=O.lazy(()=>Lt(()=>import("./DeepWikiPage-EgHsHvAH.js"),__vite__mapDeps([92,6,64,1,26,30])).then(e=>({default:e.DeepWikiPage}))),I6e=O.lazy(()=>Lt(()=>import("./CodexLensPage-My6DnfN6.js"),__vite__mapDeps([93,6,12,50,4])).then(e=>({default:e.CodexLensPage})));function Ut(e){return w.jsx(cTe,{children:w.jsx(O.Suspense,{fallback:w.jsx(uTe,{}),children:e})})}const R6e=[{path:"cli-sessions/share",element:Ut(w.jsx(E6e,{}))},{path:"/",element:w.jsx(aTe,{}),children:[{index:!0,element:w.jsx(t6e,{})},{path:"sessions",element:Ut(w.jsx(r6e,{}))},{path:"sessions/:sessionId",element:Ut(w.jsx(o6e,{}))},{path:"sessions/:sessionId/fix",element:Ut(w.jsx(n6e,{}))},{path:"sessions/:sessionId/review",element:Ut(w.jsx(p6e,{}))},{path:"lite-tasks/:subType/:id",element:Ut(w.jsx(o6,{}))},{path:"lite-tasks",element:Ut(w.jsx(o6,{}))},{path:"project",element:Ut(w.jsx(i6e,{}))},{path:"history",element:Ut(w.jsx(s6e,{}))},{path:"orchestrator",element:Ut(w.jsx(a6e,{}))},{path:"loops",element:w.jsx($g,{to:"/terminal-dashboard",replace:!0})},{path:"cli-viewer",element:Ut(w.jsx(C6e,{}))},{path:"issues",element:Ut(w.jsx(l6e,{}))},{path:"issues/queue",element:w.jsx($g,{to:"/issues?tab=queue",replace:!0})},{path:"issues/discovery",element:w.jsx($g,{to:"/issues?tab=discovery",replace:!0})},{path:"skills",element:Ut(w.jsx(c6e,{}))},{path:"commands",element:Ut(w.jsx(u6e,{}))},{path:"memory",element:Ut(w.jsx(d6e,{}))},{path:"prompts",element:Ut(w.jsx(_6e,{}))},{path:"settings",element:Ut(w.jsx(f6e,{}))},{path:"settings/mcp",element:Ut(w.jsx(m6e,{}))},{path:"settings/endpoints",element:Ut(w.jsx(g6e,{}))},{path:"settings/installations",element:Ut(w.jsx(v6e,{}))},{path:"settings/rules",element:Ut(w.jsx(b6e,{}))},{path:"settings/specs",element:Ut(w.jsx(A6e,{}))},{path:"api-settings",element:Ut(w.jsx(S6e,{}))},{path:"hooks",element:Ut(w.jsx(y6e,{}))},{path:"explorer",element:Ut(w.jsx(x6e,{}))},{path:"graph",element:Ut(w.jsx(w6e,{}))},{path:"teams",element:Ut(w.jsx(k6e,{}))},{path:"analysis",element:Ut(w.jsx(P6e,{}))},{path:"deepwiki",element:Ut(w.jsx(O6e,{}))},{path:"codexlens",element:Ut(w.jsx(I6e,{}))},{path:"terminal-dashboard",element:Ut(w.jsx(T6e,{}))},{path:"skill-hub",element:w.jsx($g,{to:"/skills?tab=hub",replace:!0})},{path:"*",element:Ut(w.jsx(h6e,{}))}]}],N6e="/".replace(/\/$/,"")||"",M6e=zJ(R6e,{basename:N6e}),PP=new iY({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1e3*60*10,retry:1,refetchOnWindowFocus:!1},mutations:{retry:1}}});function j6e({locale:e,messages:t}){return O.useEffect(()=>{nU().catch(console.error),Uae().catch(()=>{})},[]),w.jsx(zte,{locale:e,messages:t,children:w.jsx(oY,{client:PP,children:w.jsxs(Tye,{children:[w.jsx(D6e,{}),w.jsx(L6e,{}),w.jsx($6e,{}),w.jsx(XJ,{router:M6e}),w.jsx(pre,{richColors:!0,position:"top-right"})]})})})}function D6e(){const e=Rt(t=>t.registerQueryInvalidator);return O.useEffect(()=>{e(()=>{zn.getState().resetState(),li.getState().resetState(),fA.getState().resetState(),Hd.getState().resetState(),Tk.getState().resetState(),Ud.getState().resetState();const r=nc.getState();r.resetState(),Rt.getState().projectPath&&r.loadInitialState().catch(i=>{console.error("[QueueSchedulerSync] Failed to sync scheduler state:",i)}),Fn.getState().resetState(),$le.getState().resetWorkspaceState(),PP.invalidateQueries({queryKey:tO}),PP.invalidateQueries({predicate:i=>{const o=i.queryKey;if(!Array.isArray(o))return!1;const s=o[0];return s==="workspace"||s==="projectOverview"||s==="workflowStatusCounts"||s==="dashboardStats"}})})},[e]),null}function L6e(){const e=Rt(fr),t=li(r=>r.setSessions);return O.useEffect(()=>{let r=!1;return e?(FU(e).then(({sessions:n})=>{r||t(n)}).catch(n=>{console.error("[CliSessionSync] Failed to sync CLI sessions:",n),r||t([])}),()=>{r=!0}):(t([]),()=>{r=!0})},[e,t]),null}function $6e(){return E7(!0,15e3),null}let FX=-1;const mf=e=>{addEventListener("pageshow",(t=>{t.persisted&&(FX=t.timeStamp,e(t))}),!0)},cs=(e,t,r,n)=>{let i,o;return s=>{t.value>=0&&(s||n)&&(o=t.value-(i??0),(o||i===void 0)&&(i=t.value,t.delta=o,t.rating=((a,l)=>a>l[1]?"poor":a>l[0]?"needs-improvement":"good")(t.value,r),e(t)))}},j2=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},D2=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Tm=()=>{const e=D2();return(e==null?void 0:e.activationStart)??0},us=(e,t=-1)=>{const r=D2();let n="navigate";return FX>=0?n="back-forward-cache":r&&(document.prerendering||Tm()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},jE=new WeakMap;function L2(e,t){return jE.get(e)||jE.set(e,new t),jE.get(e)}class B6e{constructor(){_o(this,"t");_o(this,"i",0);_o(this,"o",[])}h(t){var i;if(t.hadRecentInput)return;const r=this.o[0],n=this.o.at(-1);this.i&&r&&n&&t.startTime-n.startTime<1e3&&t.startTime-r.startTime<5e3?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),(i=this.t)==null||i.call(this,t)}}const Pm=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const n=new PerformanceObserver((i=>{Promise.resolve().then((()=>{t(i.getEntries())}))}));return n.observe({type:e,buffered:!0,...r}),n}}catch{}},$2=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let Nu=-1;const zX=new Set,s6=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,AP=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(const t of zX)t();isFinite(Nu)||(Nu=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",AP,!0))}},Wb=()=>{var e;if(Nu<0){const t=Tm();Nu=(document.prerendering||(e=globalThis.performance.getEntriesByType("visibility-state").filter((n=>n.name==="hidden"&&n.startTime>t))[0])==null?void 0:e.startTime)??s6(),addEventListener("visibilitychange",AP,!0),addEventListener("prerenderingchange",AP,!0),mf((()=>{setTimeout((()=>{Nu=s6()}))}))}return{get firstHiddenTime(){return Nu},onHidden(t){zX.add(t)}}},Vb=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},a6=[1800,3e3],UX=(e,t={})=>{Vb((()=>{const r=Wb();let n,i=us("FCP");const o=Pm("paint",(s=>{for(const a of s)a.name==="first-contentful-paint"&&(o.disconnect(),a.startTime<r.firstHiddenTime&&(i.value=Math.max(a.startTime-Tm(),0),i.entries.push(a),n(!0)))}));o&&(n=cs(e,i,a6,t.reportAllChanges),mf((s=>{i=us("FCP"),n=cs(e,i,a6,t.reportAllChanges),j2((()=>{i.value=performance.now()-s.timeStamp,n(!0)}))})))}))},l6=[.1,.25],F6e=(e,t={})=>{const r=Wb();UX($2((()=>{let n,i=us("CLS",0);const o=L2(t,B6e),s=l=>{for(const c of l)o.h(c);o.i>i.value&&(i.value=o.i,i.entries=o.o,n())},a=Pm("layout-shift",s);a&&(n=cs(e,i,l6,t.reportAllChanges),r.onHidden((()=>{s(a.takeRecords()),n(!0)})),mf((()=>{o.i=0,i=us("CLS",0),n=cs(e,i,l6,t.reportAllChanges),j2((()=>n()))})),setTimeout(n))})))};let HX=0,DE=1/0,wv=0;const z6e=e=>{for(const t of e)t.interactionId&&(DE=Math.min(DE,t.interactionId),wv=Math.max(wv,t.interactionId),HX=wv?(wv-DE)/7+1:0)};let OP;const c6=()=>OP?HX:performance.interactionCount??0,U6e=()=>{"interactionCount"in performance||OP||(OP=Pm("event",z6e,{type:"event",buffered:!0,durationThreshold:0}))};let u6=0;class H6e{constructor(){_o(this,"u",[]);_o(this,"l",new Map);_o(this,"m");_o(this,"p")}v(){u6=c6(),this.u.length=0,this.l.clear()}L(){const t=Math.min(this.u.length-1,Math.floor((c6()-u6)/50));return this.u[t]}h(t){var i,o;if((i=this.m)==null||i.call(this,t),!t.interactionId&&t.entryType!=="first-input")return;const r=this.u.at(-1);let n=this.l.get(t.interactionId);if(n||this.u.length<10||t.duration>r.P){if(n?t.duration>n.P?(n.entries=[t],n.P=t.duration):t.duration===n.P&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],P:t.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((s,a)=>a.P-s.P)),this.u.length>10){const s=this.u.splice(10);for(const a of s)this.l.delete(a.id)}(o=this.p)==null||o.call(this,n)}}}const qX=e=>{const t=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?e():(e=$2(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})})))},d6=[200,500],q6e=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const r=Wb();Vb((()=>{U6e();let n,i=us("INP");const o=L2(t,H6e),s=l=>{qX((()=>{for(const d of l)o.h(d);const c=o.L();c&&c.P!==i.value&&(i.value=c.P,i.entries=c.entries,n())}))},a=Pm("event",s,{durationThreshold:t.durationThreshold??40});n=cs(e,i,d6,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),r.onHidden((()=>{s(a.takeRecords()),n(!0)})),mf((()=>{o.v(),i=us("INP"),n=cs(e,i,d6,t.reportAllChanges)})))}))};class W6e{constructor(){_o(this,"m")}h(t){var r;(r=this.m)==null||r.call(this,t)}}const f6=[2500,4e3],V6e=(e,t={})=>{Vb((()=>{const r=Wb();let n,i=us("LCP");const o=L2(t,W6e),s=l=>{t.reportAllChanges||(l=l.slice(-1));for(const c of l)o.h(c),c.startTime<r.firstHiddenTime&&(i.value=Math.max(c.startTime-Tm(),0),i.entries=[c],n())},a=Pm("largest-contentful-paint",s);if(a){n=cs(e,i,f6,t.reportAllChanges);const l=$2((()=>{s(a.takeRecords()),a.disconnect(),n(!0)})),c=d=>{d.isTrusted&&(qX(l),removeEventListener(d.type,c,{capture:!0}))};for(const d of["keydown","click","visibilitychange"])addEventListener(d,c,{capture:!0});mf((d=>{i=us("LCP"),n=cs(e,i,f6,t.reportAllChanges),j2((()=>{i.value=performance.now()-d.timeStamp,n(!0)}))}))}}))},h6=[800,1800],IP=e=>{document.prerendering?Vb((()=>IP(e))):document.readyState!=="complete"?addEventListener("load",(()=>IP(e)),!0):setTimeout(e)},G6e=(e,t={})=>{let r=us("TTFB"),n=cs(e,r,h6,t.reportAllChanges);IP((()=>{const i=D2();i&&(r.value=Math.max(i.responseStart-Tm(),0),r.entries=[i],n(!0),mf((()=>{r=us("TTFB",0),n=cs(e,r,h6,t.reportAllChanges),n(!0)})))}))},Eu={LCP:2500,INP:200,CLS:.1,FCP:1800,TTFB:600};function _h(e,t){switch(e){case"LCP":return t<=Eu.LCP;case"INP":return t<=Eu.INP;case"CLS":return t<=Eu.CLS;case"FCP":return t<=Eu.FCP;case"TTFB":return t<=Eu.TTFB;default:return!0}}function xh(e,t){const r=Eu[e];if(!r||t<=r)return"good";const n=r*1.25;return t<=n?"needs-improvement":"poor"}function K6e(e,t=!1){V6e(r=>{const n={...r,vitalsName:"LCP",isBad:!_h("LCP",r.value),rating:xh("LCP",r.value)};e(n)}),q6e(r=>{const n={...r,vitalsName:"INP",isBad:!_h("INP",r.value),rating:xh("INP",r.value)};e(n)}),F6e(r=>{const n={...r,vitalsName:"CLS",isBad:!_h("CLS",r.value),rating:xh("CLS",r.value)};e(n)}),t&&(UX(r=>{const n={...r,vitalsName:"FCP",isBad:!_h("FCP",r.value),rating:xh("FCP",r.value)};e(n)}),G6e(r=>{const n={...r,vitalsName:"TTFB",isBad:!_h("TTFB",r.value),rating:xh("TTFB",r.value)};e(n)}))}function X6e(){K6e(e=>{const t=e.isBad?"background: #ff6b6b; color: white; padding: 2px 6px; border-radius: 3px;":"background: #51cf66; color: white; padding: 2px 6px; border-radius: 3px;";console.log(`%c${e.vitalsName}%c ${e.value.toFixed(2)}ms (${e.rating})`,t,"background: none;")})}async function Z6e(){const e=document.getElementById("root");if(!e)throw new Error("Failed to find the root element");const t=await Uv(),r=await Jne(t);jQ.createRoot(e).render(w.jsx(O.StrictMode,{children:w.jsx(j6e,{locale:t,messages:r})})),X6e()}Z6e().catch(e=>{console.error("Failed to bootstrap application:",e)});export{ine as $,Yd as A,Vn as B,dd as C,bye as D,g8 as E,une as F,Qd as G,tze as H,A0 as I,Yre as J,Qa as K,Vh as L,b0 as M,Wn as N,Ne as O,FFe as P,Qze as Q,eA as R,rA as S,nA as T,bk as U,xM as V,ju as W,Di as X,ene as Y,Gh as Z,nze as _,RO as a,nm as a$,CM as a0,Hz as a1,Yj as a2,Fk as a3,iy as a4,o0e as a5,kne as a6,Ene as a7,tne as a8,Rt as a9,Y6e as aA,gY as aB,ke as aC,xae as aD,OU as aE,Gn as aF,Z as aG,Ei as aH,coe as aI,uoe as aJ,doe as aK,loe as aL,goe as aM,Ine as aN,poe as aO,es as aP,gk as aQ,one as aR,Rne as aS,moe as aT,dne as aU,bne as aV,ole as aW,lle as aX,pze as aY,ele as aZ,hze as a_,fr as aa,ji as ab,aoe as ac,tm as ad,vk as ae,Vx as af,foe as ag,hoe as ah,tV as ai,rV as aj,One as ak,Jae as al,EM as am,lne as an,Fz as ao,ea as ap,JCe as aq,yW as ar,eEe as as,xW as at,wW as au,qz as av,Gz as aw,QQ as ax,kN as ay,J6e as az,tA as b,qie as b$,Lye as b0,Bye as b1,li as b2,FU as b3,S0 as b4,zz as b5,bze as b6,Cne as b7,NP as b8,wc as b9,co as bA,ze as bB,os as bC,j0 as bD,CCe as bE,Bze as bF,Li as bG,I0 as bH,zH as bI,Cn as bJ,kc as bK,Uie as bL,Fie as bM,zie as bN,EO as bO,St as bP,dc as bQ,Tt as bR,sl as bS,$ie as bT,sze as bU,Die as bV,Lie as bW,Lt as bX,jie as bY,Vie as bZ,Gie as b_,BP as ba,$d as bb,Ize as bc,Nze as bd,Wz as be,PO as bf,jze as bg,Ud as bh,_ae as bi,Fn as bj,Qse as bk,Yse as bl,$H as bm,Mze as bn,Rze as bo,sb as bp,Ec as bq,Dze as br,rze as bs,Mie as bt,Co as bu,Nie as bv,jt as bw,Fze as bx,ct as by,No as bz,he as c,joe as c$,Wie as c0,Hie as c1,ize as c2,Xie as c3,Zie as c4,Qie as c5,Yie as c6,Jie as c7,Kie as c8,Eae as c9,Nne as cA,JP as cB,yne as cC,H9 as cD,kk as cE,uze as cF,dze as cG,fze as cH,xne as cI,rm as cJ,_ne as cK,hne as cL,Ev as cM,WFe as cN,Uz as cO,boe as cP,Tne as cQ,IU as cR,yoe as cS,_oe as cT,woe as cU,Soe as cV,Coe as cW,Eoe as cX,Aoe as cY,Ooe as cZ,Doe as c_,wae as ca,Sae as cb,Cae as cc,eoe as cd,roe as ce,soe as cf,toe as cg,noe as ch,ioe as ci,ooe as cj,ane as ck,lq as cl,jq as cm,$z as cn,Aie as co,Go as cp,oie as cq,IM as cr,wk as cs,Zz as ct,Qz as cu,eie as cv,RM as cw,aze as cx,y0 as cy,vne as cz,_ye as d,Gt as d$,x0 as d0,Toe as d1,Moe as d2,xoe as d3,MU as d4,Poe as d5,yk as d6,lse as d7,ose as d8,cse as d9,Hoe as dA,qoe as dB,Woe as dC,Koe as dD,Zoe as dE,tse as dF,Joe as dG,Loe as dH,Uoe as dI,Goe as dJ,Qoe as dK,DFe as dL,mse as dM,gse as dN,yse as dO,vse as dP,dse as dQ,fse as dR,hse as dS,pse as dT,Sye as dU,Sse as dV,Ay as dW,bp as dX,c4 as dY,sRe as dZ,ff as d_,sse as da,use as db,ise as dc,Roe as dd,Ioe as de,Noe as df,rse as dg,nse as dh,Tc as di,LU as dj,ase as dk,koe as dl,$U as dm,aA as dn,lA as dp,fne as dq,cne as dr,rne as ds,Xoe as dt,ese as du,Yoe as dv,zoe as dw,Boe as dx,$oe as dy,Foe as dz,Ze as e,Uke as e$,Xse as e0,Zse as e1,$ye as e2,zn as e3,dA as e4,Hze as e5,gze as e6,yze as e7,E7 as e8,yCe as e9,sV as eA,$le as eB,Eze as eC,Hd as eD,Lne as eE,cA as eF,zU as eG,UU as eH,Cze as eI,YM as eJ,xze as eK,mne as eL,Sze as eM,Qh as eN,_ze as eO,wze as eP,aV as eQ,yle as eR,Wze as eS,Kze as eT,Vze as eU,Gze as eV,Xze as eW,Tze as eX,kze as eY,Bl as eZ,xle as e_,vze as ea,mze as eb,Oh as ec,w0e as ed,Ake as ee,Ike as ef,gn as eg,En as eh,im as ei,hae as ej,pae as ek,mae as el,fae as em,gae as en,vae as eo,Vz as ep,Jre as eq,yae as er,bae as es,VW as et,GW as eu,Tk as ev,Ole as ew,fA as ex,Pze as ey,nc as ez,F9 as f,Jse as f$,_se as f0,xse as f1,bse as f2,wse as f3,Tse as f4,kse as f5,Pse as f6,Ase as f7,Nse as f8,Rse as f9,tp as fA,Nme as fB,Vd as fC,$ze as fD,lze as fE,oze as fF,Gke as fG,cV as fH,uV as fI,fV as fJ,Zze as fK,Mae as fL,Nae as fM,Z0 as fN,vO as fO,Rae as fP,Iae as fQ,nV as fR,eae as fS,rae as fT,iae as fU,oae as fV,uae as fW,dae as fX,cae as fY,Oae as fZ,Tae as f_,Dse as fa,jse as fb,Fse as fc,Bse as fd,Gse as fe,Kse as ff,Ese as fg,Ise as fh,$se as fi,Use as fj,Wse as fk,Vse as fl,Hse as fm,Cse as fn,Ose as fo,Mse as fp,Lse as fq,zse as fr,qse as fs,PA as ft,zze as fu,AA as fv,Uze as fw,hc as fx,Gd as fy,Kd as fz,Rv as g,tae as g0,nae as g1,sae as g2,aae as g3,lae as g4,kae as g5,Pae as g6,Aae as g7,G0e as g8,sy as g9,oe as ga,cze as gb,Lze as gc,$k as h,wM as i,w as j,Wh as k,to as l,Ds as m,Sc as n,_t as o,LH as p,Aze as q,O as r,_ie as s,Oze as t,$t as u,z9 as v,_0 as w,lm as x,Xd as y,Zd as z};
|
|
708
|
-
//# sourceMappingURL=index-
|
|
707
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MX(e,t){if(e){if(typeof e=="string")return kP(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kP(e,t)}}function bFe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _Fe(e){if(Array.isArray(e))return kP(e)}function kP(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ZF(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ye(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ZF(Object(r),!0).forEach(function(n){at(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ZF(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function at(e,t,r){return t=jX(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jX(e){var t=xFe(e,"string");return jd(t)=="symbol"?t:t+""}function xFe(e,t){if(jd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(jd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var wFe={xAxis:["bottom","top"],yAxis:["left","right"]},SFe={width:"100%",height:"100%"},DX={x:0,y:0};function _v(e){return e}var CFe=function(t,r){return r==="horizontal"?t.x:r==="vertical"?t.y:r==="centric"?t.angle:t.radius},EFe=function(t,r,n,i){var o=r.find(function(d){return d&&d.index===n});if(o){if(t==="horizontal")return{x:o.coordinate,y:i.y};if(t==="vertical")return{x:i.x,y:o.coordinate};if(t==="centric"){var s=o.coordinate,a=i.radius;return ye(ye(ye({},i),hr(i.cx,i.cy,a,s)),{},{angle:s,radius:a})}var l=o.coordinate,c=i.angle;return ye(ye(ye({},i),hr(i.cx,i.cy,l,c)),{},{angle:c,radius:l})}return DX},qb=function(t,r){var n=r.graphicalItems,i=r.dataStartIndex,o=r.dataEndIndex,s=(n??[]).reduce(function(a,l){var c=l.props.data;return c&&c.length?[].concat(Dd(a),Dd(c)):a},[]);return s.length>0?s:t&&t.length&&Me(i)&&Me(o)?t.slice(i,o+1):[]};function LX(e){return e==="number"?[0,"auto"]:void 0}var TP=function(t,r,n,i){var o=t.graphicalItems,s=t.tooltipAxis,a=qb(r,t);return n<0||!o||!o.length||n>=a.length?null:o.reduce(function(l,c){var d,u=(d=c.props.data)!==null&&d!==void 0?d:r;u&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(u=u.slice(t.dataStartIndex,t.dataEndIndex+1));var p;if(s.dataKey&&!s.allowDuplicatedCategory){var g=u===void 0?a:u;p=py(g,s.dataKey,i)}else p=u&&u[n]||a[n];return p?[].concat(Dd(l),[TK(c,p)]):l},[])},QF=function(t,r,n,i){var o=i||{x:t.chartX,y:t.chartY},s=CFe(o,n),a=t.orderedTooltipTicks,l=t.tooltipAxis,c=t.tooltipTicks,d=aje(s,a,c,l);if(d>=0&&c){var u=c[d]&&c[d].value,p=TP(t,r,d,u),g=EFe(n,a,d,o);return{activeTooltipIndex:d,activeLabel:u,activePayload:p,activeCoordinate:g}}return null},kFe=function(t,r){var n=r.axes,i=r.graphicalItems,o=r.axisType,s=r.axisIdKey,a=r.stackGroups,l=r.dataStartIndex,c=r.dataEndIndex,d=t.layout,u=t.children,p=t.stackOffset,g=wK(d,o);return n.reduce(function(_,y){var m,v=y.type.defaultProps!==void 0?ye(ye({},y.type.defaultProps),y.props):y.props,b=v.type,x=v.dataKey,E=v.allowDataOverflow,C=v.allowDuplicatedCategory,k=v.scale,P=v.ticks,T=v.includeHidden,I=v[s];if(_[I])return _;var N=qb(t.data,{graphicalItems:i.filter(function(X){var W,le=s in X.props?X.props[s]:(W=X.type.defaultProps)===null||W===void 0?void 0:W[s];return le===I}),dataStartIndex:l,dataEndIndex:c}),B=N.length,M,F,U;YBe(v.domain,E,b)&&(M=zT(v.domain,null,E),g&&(b==="number"||k!=="auto")&&(U=Lh(N,x,"category")));var q=LX(b);if(!M||M.length===0){var V,K=(V=v.domain)!==null&&V!==void 0?V:q;if(x){if(M=Lh(N,x,b),b==="category"&&g){var D=ePe(M);C&&D?(F=M,M=e0(0,B)):C||(M=tB(K,M,y).reduce(function(X,W){return X.indexOf(W)>=0?X:[].concat(Dd(X),[W])},[]))}else if(b==="category")C?M=M.filter(function(X){return X!==""&&!pt(X)}):M=tB(K,M,y).reduce(function(X,W){return X.indexOf(W)>=0||W===""||pt(W)?X:[].concat(Dd(X),[W])},[]);else if(b==="number"){var $=fje(N,i.filter(function(X){var W,le,ce=s in X.props?X.props[s]:(W=X.type.defaultProps)===null||W===void 0?void 0:W[s],ve="hide"in X.props?X.props.hide:(le=X.type.defaultProps)===null||le===void 0?void 0:le.hide;return ce===I&&(T||!ve)}),x,o,d);$&&(M=$)}g&&(b==="number"||k!=="auto")&&(U=Lh(N,x,"category"))}else g?M=e0(0,B):a&&a[I]&&a[I].hasStack&&b==="number"?M=p==="expand"?[0,1]:kK(a[I].stackGroups,l,c):M=xK(N,i.filter(function(X){var W=s in X.props?X.props[s]:X.type.defaultProps[s],le="hide"in X.props?X.props.hide:X.type.defaultProps.hide;return W===I&&(T||!le)}),b,d,!0);if(b==="number")M=CP(u,M,I,o,P),K&&(M=zT(K,M,E));else if(b==="category"&&K){var j=K,z=M.every(function(X){return j.indexOf(X)>=0});z&&(M=j)}}return ye(ye({},_),{},at({},I,ye(ye({},v),{},{axisType:o,domain:M,categoricalDomain:U,duplicateDomain:F,originalDomain:(m=v.domain)!==null&&m!==void 0?m:q,isCategorical:g,layout:d})))},{})},TFe=function(t,r){var n=r.graphicalItems,i=r.Axis,o=r.axisType,s=r.axisIdKey,a=r.stackGroups,l=r.dataStartIndex,c=r.dataEndIndex,d=t.layout,u=t.children,p=qb(t.data,{graphicalItems:n,dataStartIndex:l,dataEndIndex:c}),g=p.length,_=wK(d,o),y=-1;return n.reduce(function(m,v){var b=v.type.defaultProps!==void 0?ye(ye({},v.type.defaultProps),v.props):v.props,x=b[s],E=LX("number");if(!m[x]){y++;var C;return _?C=e0(0,g):a&&a[x]&&a[x].hasStack?(C=kK(a[x].stackGroups,l,c),C=CP(u,C,x,o)):(C=zT(E,xK(p,n.filter(function(k){var P,T,I=s in k.props?k.props[s]:(P=k.type.defaultProps)===null||P===void 0?void 0:P[s],N="hide"in k.props?k.props.hide:(T=k.type.defaultProps)===null||T===void 0?void 0:T.hide;return I===x&&!N}),"number",d),i.defaultProps.allowDataOverflow),C=CP(u,C,x,o)),ye(ye({},m),{},at({},x,ye(ye({axisType:o},i.defaultProps),{},{hide:!0,orientation:Ni(wFe,"".concat(o,".").concat(y%2),null),domain:C,originalDomain:E,isCategorical:_,layout:d})))}return m},{})},PFe=function(t,r){var n=r.axisType,i=n===void 0?"xAxis":n,o=r.AxisComp,s=r.graphicalItems,a=r.stackGroups,l=r.dataStartIndex,c=r.dataEndIndex,d=t.children,u="".concat(i,"Id"),p=Mi(d,o),g={};return p&&p.length?g=kFe(t,{axes:p,graphicalItems:s,axisType:i,axisIdKey:u,stackGroups:a,dataStartIndex:l,dataEndIndex:c}):s&&s.length&&(g=TFe(t,{Axis:o,graphicalItems:s,axisType:i,axisIdKey:u,stackGroups:a,dataStartIndex:l,dataEndIndex:c})),g},AFe=function(t){var r=Cu(t),n=Gl(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:e2(n,function(i){return i.coordinate}),tooltipAxis:r,tooltipAxisBandSize:Fy(r,n)}},YF=function(t){var r=t.children,n=t.defaultShowTooltip,i=Ci(r,kd),o=0,s=0;return t.data&&t.data.length!==0&&(s=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(s=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!n}},OFe=function(t){return!t||!t.length?!1:t.some(function(r){var n=zs(r&&r.type);return n&&n.indexOf("Bar")>=0})},JF=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},IFe=function(t,r){var n=t.props,i=t.graphicalItems,o=t.xAxisMap,s=o===void 0?{}:o,a=t.yAxisMap,l=a===void 0?{}:a,c=n.width,d=n.height,u=n.children,p=n.margin||{},g=Ci(u,kd),_=Ci(u,zu),y=Object.keys(l).reduce(function(C,k){var P=l[k],T=P.orientation;return!P.mirror&&!P.hide?ye(ye({},C),{},at({},T,C[T]+P.width)):C},{left:p.left||0,right:p.right||0}),m=Object.keys(s).reduce(function(C,k){var P=s[k],T=P.orientation;return!P.mirror&&!P.hide?ye(ye({},C),{},at({},T,Ni(C,"".concat(T))+P.height)):C},{top:p.top||0,bottom:p.bottom||0}),v=ye(ye({},m),y),b=v.bottom;g&&(v.bottom+=g.props.height||kd.defaultProps.height),_&&r&&(v=uje(v,i,n,r));var x=c-v.left-v.right,E=d-v.top-v.bottom;return ye(ye({brushBottom:b},v),{},{width:Math.max(x,0),height:Math.max(E,0)})},RFe=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},$X=function(t){var r=t.chartName,n=t.GraphicalChild,i=t.defaultTooltipEventType,o=i===void 0?"axis":i,s=t.validateTooltipEventTypes,a=s===void 0?["axis"]:s,l=t.axisComponents,c=t.legendContent,d=t.formatAxisMap,u=t.defaultProps,p=function(v,b){var x=b.graphicalItems,E=b.stackGroups,C=b.offset,k=b.updateId,P=b.dataStartIndex,T=b.dataEndIndex,I=v.barSize,N=v.layout,B=v.barGap,M=v.barCategoryGap,F=v.maxBarSize,U=JF(N),q=U.numericAxisName,V=U.cateAxisName,K=OFe(x),D=[];return x.forEach(function($,j){var z=qb(v.data,{graphicalItems:[$],dataStartIndex:P,dataEndIndex:T}),X=$.type.defaultProps!==void 0?ye(ye({},$.type.defaultProps),$.props):$.props,W=X.dataKey,le=X.maxBarSize,ce=X["".concat(q,"Id")],ve=X["".concat(V,"Id")],H={},Q=l.reduce(function(sr,Pt){var Kt=b["".concat(Pt.axisType,"Map")],Tr=X["".concat(Pt.axisType,"Id")];Kt&&Kt[Tr]||Pt.axisType==="zAxis"||wc();var ar=Kt[Tr];return ye(ye({},sr),{},at(at({},Pt.axisType,ar),"".concat(Pt.axisType,"Ticks"),Gl(ar)))},H),Y=Q[V],re=Q["".concat(V,"Ticks")],ge=E&&E[ce]&&E[ce].hasStack&&xje($,E[ce].stackGroups),ee=zs($.type).indexOf("Bar")>=0,Ie=Fy(Y,re),Re=[],xe=K&&lje({barSize:I,stackGroups:E,totalSize:RFe(Q,V)});if(ee){var et,be,ot=pt(le)?F:le,xt=(et=(be=Fy(Y,re,!0))!==null&&be!==void 0?be:ot)!==null&&et!==void 0?et:0;Re=cje({barGap:B,barCategoryGap:M,bandSize:xt!==Ie?xt:Ie,sizeList:xe[ve],maxBarSize:ot}),xt!==Ie&&(Re=Re.map(function(sr){return ye(ye({},sr),{},{position:ye(ye({},sr.position),{},{offset:sr.position.offset-xt/2})})}))}var pr=$&&$.type&&$.type.getComposedData;pr&&D.push({props:ye(ye({},pr(ye(ye({},Q),{},{displayedData:z,props:v,dataKey:W,item:$,bandSize:Ie,barPosition:Re,offset:C,stackedData:ge,layout:N,dataStartIndex:P,dataEndIndex:T}))),{},at(at(at({key:$.key||"item-".concat(j)},q,Q[q]),V,Q[V]),"animationId",k)),childIndex:hPe($,v.children),item:$})}),D},g=function(v,b){var x=v.props,E=v.dataStartIndex,C=v.dataEndIndex,k=v.updateId;if(!m3({props:x}))return null;var P=x.children,T=x.layout,I=x.stackOffset,N=x.data,B=x.reverseStackOrder,M=JF(T),F=M.numericAxisName,U=M.cateAxisName,q=Mi(P,n),V=bje(N,q,"".concat(F,"Id"),"".concat(U,"Id"),I,B),K=l.reduce(function(X,W){var le="".concat(W.axisType,"Map");return ye(ye({},X),{},at({},le,PFe(x,ye(ye({},W),{},{graphicalItems:q,stackGroups:W.axisType===F&&V,dataStartIndex:E,dataEndIndex:C}))))},{}),D=IFe(ye(ye({},K),{},{props:x,graphicalItems:q}),b==null?void 0:b.legendBBox);Object.keys(K).forEach(function(X){K[X]=d(x,K[X],D,X.replace("Map",""),r)});var $=K["".concat(U,"Map")],j=AFe($),z=p(x,ye(ye({},K),{},{dataStartIndex:E,dataEndIndex:C,updateId:k,graphicalItems:q,stackGroups:V,offset:D}));return ye(ye({formattedGraphicalItems:z,graphicalItems:q,offset:D,stackGroups:V},j),K)},_=(function(m){function v(b){var x,E,C;return dFe(this,v),C=pFe(this,v,[b]),at(C,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),at(C,"accessibilityManager",new QBe),at(C,"handleLegendBBoxUpdate",function(k){if(k){var P=C.state,T=P.dataStartIndex,I=P.dataEndIndex,N=P.updateId;C.setState(ye({legendBBox:k},g({props:C.props,dataStartIndex:T,dataEndIndex:I,updateId:N},ye(ye({},C.state),{},{legendBBox:k}))))}}),at(C,"handleReceiveSyncEvent",function(k,P,T){if(C.props.syncId===k){if(T===C.eventEmitterSymbol&&typeof C.props.syncMethod!="function")return;C.applySyncEvent(P)}}),at(C,"handleBrushChange",function(k){var P=k.startIndex,T=k.endIndex;if(P!==C.state.dataStartIndex||T!==C.state.dataEndIndex){var I=C.state.updateId;C.setState(function(){return ye({dataStartIndex:P,dataEndIndex:T},g({props:C.props,dataStartIndex:P,dataEndIndex:T,updateId:I},C.state))}),C.triggerSyncEvent({dataStartIndex:P,dataEndIndex:T})}}),at(C,"handleMouseEnter",function(k){var P=C.getMouseInfo(k);if(P){var T=ye(ye({},P),{},{isTooltipActive:!0});C.setState(T),C.triggerSyncEvent(T);var I=C.props.onMouseEnter;ht(I)&&I(T,k)}}),at(C,"triggeredAfterMouseMove",function(k){var P=C.getMouseInfo(k),T=P?ye(ye({},P),{},{isTooltipActive:!0}):{isTooltipActive:!1};C.setState(T),C.triggerSyncEvent(T);var I=C.props.onMouseMove;ht(I)&&I(T,k)}),at(C,"handleItemMouseEnter",function(k){C.setState(function(){return{isTooltipActive:!0,activeItem:k,activePayload:k.tooltipPayload,activeCoordinate:k.tooltipPosition||{x:k.cx,y:k.cy}}})}),at(C,"handleItemMouseLeave",function(){C.setState(function(){return{isTooltipActive:!1}})}),at(C,"handleMouseMove",function(k){k.persist(),C.throttleTriggeredAfterMouseMove(k)}),at(C,"handleMouseLeave",function(k){C.throttleTriggeredAfterMouseMove.cancel();var P={isTooltipActive:!1};C.setState(P),C.triggerSyncEvent(P);var T=C.props.onMouseLeave;ht(T)&&T(P,k)}),at(C,"handleOuterEvent",function(k){var P=fPe(k),T=Ni(C.props,"".concat(P));if(P&&ht(T)){var I,N;/.*touch.*/i.test(P)?N=C.getMouseInfo(k.changedTouches[0]):N=C.getMouseInfo(k),T((I=N)!==null&&I!==void 0?I:{},k)}}),at(C,"handleClick",function(k){var P=C.getMouseInfo(k);if(P){var T=ye(ye({},P),{},{isTooltipActive:!0});C.setState(T),C.triggerSyncEvent(T);var I=C.props.onClick;ht(I)&&I(T,k)}}),at(C,"handleMouseDown",function(k){var P=C.props.onMouseDown;if(ht(P)){var T=C.getMouseInfo(k);P(T,k)}}),at(C,"handleMouseUp",function(k){var P=C.props.onMouseUp;if(ht(P)){var T=C.getMouseInfo(k);P(T,k)}}),at(C,"handleTouchMove",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&C.throttleTriggeredAfterMouseMove(k.changedTouches[0])}),at(C,"handleTouchStart",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&C.handleMouseDown(k.changedTouches[0])}),at(C,"handleTouchEnd",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&C.handleMouseUp(k.changedTouches[0])}),at(C,"handleDoubleClick",function(k){var P=C.props.onDoubleClick;if(ht(P)){var T=C.getMouseInfo(k);P(T,k)}}),at(C,"handleContextMenu",function(k){var P=C.props.onContextMenu;if(ht(P)){var T=C.getMouseInfo(k);P(T,k)}}),at(C,"triggerSyncEvent",function(k){C.props.syncId!==void 0&&RE.emit(NE,C.props.syncId,k,C.eventEmitterSymbol)}),at(C,"applySyncEvent",function(k){var P=C.props,T=P.layout,I=P.syncMethod,N=C.state.updateId,B=k.dataStartIndex,M=k.dataEndIndex;if(k.dataStartIndex!==void 0||k.dataEndIndex!==void 0)C.setState(ye({dataStartIndex:B,dataEndIndex:M},g({props:C.props,dataStartIndex:B,dataEndIndex:M,updateId:N},C.state)));else if(k.activeTooltipIndex!==void 0){var F=k.chartX,U=k.chartY,q=k.activeTooltipIndex,V=C.state,K=V.offset,D=V.tooltipTicks;if(!K)return;if(typeof I=="function")q=I(D,k);else if(I==="value"){q=-1;for(var $=0;$<D.length;$++)if(D[$].value===k.activeLabel){q=$;break}}var j=ye(ye({},K),{},{x:K.left,y:K.top}),z=Math.min(F,j.x+j.width),X=Math.min(U,j.y+j.height),W=D[q]&&D[q].value,le=TP(C.state,C.props.data,q),ce=D[q]?{x:T==="horizontal"?D[q].coordinate:z,y:T==="horizontal"?X:D[q].coordinate}:DX;C.setState(ye(ye({},k),{},{activeLabel:W,activeCoordinate:ce,activePayload:le,activeTooltipIndex:q}))}else C.setState(k)}),at(C,"renderCursor",function(k){var P,T=C.state,I=T.isTooltipActive,N=T.activeCoordinate,B=T.activePayload,M=T.offset,F=T.activeTooltipIndex,U=T.tooltipAxisBandSize,q=C.getTooltipEventType(),V=(P=k.props.active)!==null&&P!==void 0?P:I,K=C.props.layout,D=k.key||"_recharts-cursor";return Z.createElement(iFe,{key:D,activeCoordinate:N,activePayload:B,activeTooltipIndex:F,chartName:r,element:k,isActive:V,layout:K,offset:M,tooltipAxisBandSize:U,tooltipEventType:q})}),at(C,"renderPolarAxis",function(k,P,T){var I=Ni(k,"type.axisType"),N=Ni(C.state,"".concat(I,"Map")),B=k.type.defaultProps,M=B!==void 0?ye(ye({},B),k.props):k.props,F=N&&N[M["".concat(I,"Id")]];return O.cloneElement(k,ye(ye({},F),{},{className:mt(I,F.className),key:k.key||"".concat(P,"-").concat(T),ticks:Gl(F,!0)}))}),at(C,"renderPolarGrid",function(k){var P=k.props,T=P.radialLines,I=P.polarAngles,N=P.polarRadius,B=C.state,M=B.radiusAxisMap,F=B.angleAxisMap,U=Cu(M),q=Cu(F),V=q.cx,K=q.cy,D=q.innerRadius,$=q.outerRadius;return O.cloneElement(k,{polarAngles:Array.isArray(I)?I:Gl(q,!0).map(function(j){return j.coordinate}),polarRadius:Array.isArray(N)?N:Gl(U,!0).map(function(j){return j.coordinate}),cx:V,cy:K,innerRadius:D,outerRadius:$,key:k.key||"polar-grid",radialLines:T})}),at(C,"renderLegend",function(){var k=C.state.formattedGraphicalItems,P=C.props,T=P.children,I=P.width,N=P.height,B=C.props.margin||{},M=I-(B.left||0)-(B.right||0),F=bK({children:T,formattedGraphicalItems:k,legendWidth:M,legendContent:c});if(!F)return null;var U=F.item,q=XF(F,oFe);return O.cloneElement(U,ye(ye({},q),{},{chartWidth:I,chartHeight:N,margin:B,onBBoxUpdate:C.handleLegendBBoxUpdate}))}),at(C,"renderTooltip",function(){var k,P=C.props,T=P.children,I=P.accessibilityLayer,N=Ci(T,Os);if(!N)return null;var B=C.state,M=B.isTooltipActive,F=B.activeCoordinate,U=B.activePayload,q=B.activeLabel,V=B.offset,K=(k=N.props.active)!==null&&k!==void 0?k:M;return O.cloneElement(N,{viewBox:ye(ye({},V),{},{x:V.left,y:V.top}),active:K,label:q,payload:K?U:[],coordinate:F,accessibilityLayer:I})}),at(C,"renderBrush",function(k){var P=C.props,T=P.margin,I=P.data,N=C.state,B=N.offset,M=N.dataStartIndex,F=N.dataEndIndex,U=N.updateId;return O.cloneElement(k,{key:k.key||"_recharts-brush",onChange:mv(C.handleBrushChange,k.props.onChange),data:I,x:Me(k.props.x)?k.props.x:B.left,y:Me(k.props.y)?k.props.y:B.top+B.height+B.brushBottom-(T.bottom||0),width:Me(k.props.width)?k.props.width:B.width,startIndex:M,endIndex:F,updateId:"brush-".concat(U)})}),at(C,"renderReferenceElement",function(k,P,T){if(!k)return null;var I=C,N=I.clipPathId,B=C.state,M=B.xAxisMap,F=B.yAxisMap,U=B.offset,q=k.type.defaultProps||{},V=k.props,K=V.xAxisId,D=K===void 0?q.xAxisId:K,$=V.yAxisId,j=$===void 0?q.yAxisId:$;return O.cloneElement(k,{key:k.key||"".concat(P,"-").concat(T),xAxis:M[D],yAxis:F[j],viewBox:{x:U.left,y:U.top,width:U.width,height:U.height},clipPathId:N})}),at(C,"renderActivePoints",function(k){var P=k.item,T=k.activePoint,I=k.basePoint,N=k.childIndex,B=k.isRange,M=[],F=P.props.key,U=P.item.type.defaultProps!==void 0?ye(ye({},P.item.type.defaultProps),P.item.props):P.item.props,q=U.activeDot,V=U.dataKey,K=ye(ye({index:N,dataKey:V,cx:T.x,cy:T.y,r:4,fill:k2(P.item),strokeWidth:2,stroke:"#fff",payload:T.payload,value:T.value},it(q,!1)),my(q));return M.push(v.renderActiveDot(q,K,"".concat(F,"-activePoint-").concat(N))),I?M.push(v.renderActiveDot(q,ye(ye({},K),{},{cx:I.x,cy:I.y}),"".concat(F,"-basePoint-").concat(N))):B&&M.push(null),M}),at(C,"renderGraphicChild",function(k,P,T){var I=C.filterFormatItem(k,P,T);if(!I)return null;var N=C.getTooltipEventType(),B=C.state,M=B.isTooltipActive,F=B.tooltipAxis,U=B.activeTooltipIndex,q=B.activeLabel,V=C.props.children,K=Ci(V,Os),D=I.props,$=D.points,j=D.isRange,z=D.baseLine,X=I.item.type.defaultProps!==void 0?ye(ye({},I.item.type.defaultProps),I.item.props):I.item.props,W=X.activeDot,le=X.hide,ce=X.activeBar,ve=X.activeShape,H=!!(!le&&M&&K&&(W||ce||ve)),Q={};N!=="axis"&&K&&K.props.trigger==="click"?Q={onClick:mv(C.handleItemMouseEnter,k.props.onClick)}:N!=="axis"&&(Q={onMouseLeave:mv(C.handleItemMouseLeave,k.props.onMouseLeave),onMouseEnter:mv(C.handleItemMouseEnter,k.props.onMouseEnter)});var Y=O.cloneElement(k,ye(ye({},I.props),Q));function re(Pt){return typeof F.dataKey=="function"?F.dataKey(Pt.payload):null}if(H)if(U>=0){var ge,ee;if(F.dataKey&&!F.allowDuplicatedCategory){var Ie=typeof F.dataKey=="function"?re:"payload.".concat(F.dataKey.toString());ge=py($,Ie,q),ee=j&&z&&py(z,Ie,q)}else ge=$==null?void 0:$[U],ee=j&&z&&z[U];if(ve||ce){var Re=k.props.activeIndex!==void 0?k.props.activeIndex:U;return[O.cloneElement(k,ye(ye(ye({},I.props),Q),{},{activeIndex:Re})),null,null]}if(!pt(ge))return[Y].concat(Dd(C.renderActivePoints({item:I,activePoint:ge,basePoint:ee,childIndex:U,isRange:j})))}else{var xe,et=(xe=C.getItemByXY(C.state.activeCoordinate))!==null&&xe!==void 0?xe:{graphicalItem:Y},be=et.graphicalItem,ot=be.item,xt=ot===void 0?k:ot,pr=be.childIndex,sr=ye(ye(ye({},I.props),Q),{},{activeIndex:pr});return[O.cloneElement(xt,sr),null,null]}return j?[Y,null,null]:[Y,null]}),at(C,"renderCustomized",function(k,P,T){return O.cloneElement(k,ye(ye({key:"recharts-customized-".concat(T)},C.props),C.state))}),at(C,"renderMap",{CartesianGrid:{handler:_v,once:!0},ReferenceArea:{handler:C.renderReferenceElement},ReferenceLine:{handler:_v},ReferenceDot:{handler:C.renderReferenceElement},XAxis:{handler:_v},YAxis:{handler:_v},Brush:{handler:C.renderBrush,once:!0},Bar:{handler:C.renderGraphicChild},Line:{handler:C.renderGraphicChild},Area:{handler:C.renderGraphicChild},Radar:{handler:C.renderGraphicChild},RadialBar:{handler:C.renderGraphicChild},Scatter:{handler:C.renderGraphicChild},Pie:{handler:C.renderGraphicChild},Funnel:{handler:C.renderGraphicChild},Tooltip:{handler:C.renderCursor,once:!0},PolarGrid:{handler:C.renderPolarGrid,once:!0},PolarAngleAxis:{handler:C.renderPolarAxis},PolarRadiusAxis:{handler:C.renderPolarAxis},Customized:{handler:C.renderCustomized}}),C.clipPathId="".concat((x=b.id)!==null&&x!==void 0?x:uf("recharts"),"-clip"),C.throttleTriggeredAfterMouseMove=yG(C.triggeredAfterMouseMove,(E=b.throttleDelay)!==null&&E!==void 0?E:1e3/60),C.state={},C}return vFe(v,m),hFe(v,[{key:"componentDidMount",value:function(){var x,E;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x:0,top:(E=this.props.margin.top)!==null&&E!==void 0?E:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var x=this.props,E=x.children,C=x.data,k=x.height,P=x.layout,T=Ci(E,Os);if(T){var I=T.props.defaultIndex;if(!(typeof I!="number"||I<0||I>this.state.tooltipTicks.length-1)){var N=this.state.tooltipTicks[I]&&this.state.tooltipTicks[I].value,B=TP(this.state,C,I,N),M=this.state.tooltipTicks[I].coordinate,F=(this.state.offset.top+k)/2,U=P==="horizontal",q=U?{x:M,y:F}:{y:M,x:F},V=this.state.formattedGraphicalItems.find(function(D){var $=D.item;return $.type.name==="Scatter"});V&&(q=ye(ye({},q),V.props.points[I].tooltipPosition),B=V.props.points[I].tooltipPayload);var K={activeTooltipIndex:I,isTooltipActive:!0,activeLabel:N,activePayload:B,activeCoordinate:q};this.setState(K),this.renderCursor(T),this.accessibilityManager.setIndex(I)}}}},{key:"getSnapshotBeforeUpdate",value:function(x,E){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==E.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==x.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==x.margin){var C,k;this.accessibilityManager.setDetails({offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(k=this.props.margin.top)!==null&&k!==void 0?k:0}})}return null}},{key:"componentDidUpdate",value:function(x){cT([Ci(x.children,Os)],[Ci(this.props.children,Os)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var x=Ci(this.props.children,Os);if(x&&typeof x.props.shared=="boolean"){var E=x.props.shared?"axis":"item";return a.indexOf(E)>=0?E:o}return o}},{key:"getMouseInfo",value:function(x){if(!this.container)return null;var E=this.container,C=E.getBoundingClientRect(),k=J2e(C),P={chartX:Math.round(x.pageX-k.left),chartY:Math.round(x.pageY-k.top)},T=C.width/E.offsetWidth||1,I=this.inRange(P.chartX,P.chartY,T);if(!I)return null;var N=this.state,B=N.xAxisMap,M=N.yAxisMap,F=this.getTooltipEventType(),U=QF(this.state,this.props.data,this.props.layout,I);if(F!=="axis"&&B&&M){var q=Cu(B).scale,V=Cu(M).scale,K=q&&q.invert?q.invert(P.chartX):null,D=V&&V.invert?V.invert(P.chartY):null;return ye(ye({},P),{},{xValue:K,yValue:D},U)}return U?ye(ye({},P),U):null}},{key:"inRange",value:function(x,E){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,k=this.props.layout,P=x/C,T=E/C;if(k==="horizontal"||k==="vertical"){var I=this.state.offset,N=P>=I.left&&P<=I.left+I.width&&T>=I.top&&T<=I.top+I.height;return N?{x:P,y:T}:null}var B=this.state,M=B.angleAxisMap,F=B.radiusAxisMap;if(M&&F){var U=Cu(M);return iB({x:P,y:T},U)}return null}},{key:"parseEventsOfWrapper",value:function(){var x=this.props.children,E=this.getTooltipEventType(),C=Ci(x,Os),k={};C&&E==="axis"&&(C.props.trigger==="click"?k={onClick:this.handleClick}:k={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var P=my(this.props,this.handleOuterEvent);return ye(ye({},P),k)}},{key:"addListener",value:function(){RE.on(NE,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){RE.removeListener(NE,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(x,E,C){for(var k=this.state.formattedGraphicalItems,P=0,T=k.length;P<T;P++){var I=k[P];if(I.item===x||I.props.key===x.key||E===zs(I.item.type)&&C===I.childIndex)return I}return null}},{key:"renderClipPath",value:function(){var x=this.clipPathId,E=this.state.offset,C=E.left,k=E.top,P=E.height,T=E.width;return Z.createElement("defs",null,Z.createElement("clipPath",{id:x},Z.createElement("rect",{x:C,y:k,height:P,width:T})))}},{key:"getXScales",value:function(){var x=this.state.xAxisMap;return x?Object.entries(x).reduce(function(E,C){var k=KF(C,2),P=k[0],T=k[1];return ye(ye({},E),{},at({},P,T.scale))},{}):null}},{key:"getYScales",value:function(){var x=this.state.yAxisMap;return x?Object.entries(x).reduce(function(E,C){var k=KF(C,2),P=k[0],T=k[1];return ye(ye({},E),{},at({},P,T.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(x){var E;return(E=this.state.xAxisMap)===null||E===void 0||(E=E[x])===null||E===void 0?void 0:E.scale}},{key:"getYScaleByAxisId",value:function(x){var E;return(E=this.state.yAxisMap)===null||E===void 0||(E=E[x])===null||E===void 0?void 0:E.scale}},{key:"getItemByXY",value:function(x){var E=this.state,C=E.formattedGraphicalItems,k=E.activeItem;if(C&&C.length)for(var P=0,T=C.length;P<T;P++){var I=C[P],N=I.props,B=I.item,M=B.type.defaultProps!==void 0?ye(ye({},B.type.defaultProps),B.props):B.props,F=zs(B.type);if(F==="Bar"){var U=(N.data||[]).find(function(D){return _3e(x,D)});if(U)return{graphicalItem:I,payload:U}}else if(F==="RadialBar"){var q=(N.data||[]).find(function(D){return iB(x,D)});if(q)return{graphicalItem:I,payload:q}}else if(Db(I,k)||Lb(I,k)||Lp(I,k)){var V=H5e({graphicalItem:I,activeTooltipItem:k,itemData:M.data}),K=M.activeIndex===void 0?V:M.activeIndex;return{graphicalItem:ye(ye({},I),{},{childIndex:K}),payload:Lp(I,k)?M.data[V]:I.props.data[V]}}}return null}},{key:"render",value:function(){var x=this;if(!m3(this))return null;var E=this.props,C=E.children,k=E.className,P=E.width,T=E.height,I=E.style,N=E.compact,B=E.title,M=E.desc,F=XF(E,sFe),U=it(F,!1);if(N)return Z.createElement(IF,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},Z.createElement(dT,Ru({},U,{width:P,height:T,title:B,desc:M}),this.renderClipPath(),v3(C,this.renderMap)));if(this.props.accessibilityLayer){var q,V;U.tabIndex=(q=this.props.tabIndex)!==null&&q!==void 0?q:0,U.role=(V=this.props.role)!==null&&V!==void 0?V:"application",U.onKeyDown=function(D){x.accessibilityManager.keyboardEvent(D)},U.onFocus=function(){x.accessibilityManager.focus()}}var K=this.parseEventsOfWrapper();return Z.createElement(IF,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},Z.createElement("div",Ru({className:mt("recharts-wrapper",k),style:ye({position:"relative",cursor:"default",width:P,height:T},I)},K,{ref:function($){x.container=$}}),Z.createElement(dT,Ru({},U,{width:P,height:T,title:B,desc:M,style:SFe}),this.renderClipPath(),v3(C,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(O.Component);at(_,"displayName",r),at(_,"defaultProps",ye({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},u)),at(_,"getDerivedStateFromProps",function(m,v){var b=m.dataKey,x=m.data,E=m.children,C=m.width,k=m.height,P=m.layout,T=m.stackOffset,I=m.margin,N=v.dataStartIndex,B=v.dataEndIndex;if(v.updateId===void 0){var M=YF(m);return ye(ye(ye({},M),{},{updateId:0},g(ye(ye({props:m},M),{},{updateId:0}),v)),{},{prevDataKey:b,prevData:x,prevWidth:C,prevHeight:k,prevLayout:P,prevStackOffset:T,prevMargin:I,prevChildren:E})}if(b!==v.prevDataKey||x!==v.prevData||C!==v.prevWidth||k!==v.prevHeight||P!==v.prevLayout||T!==v.prevStackOffset||!Fu(I,v.prevMargin)){var F=YF(m),U={chartX:v.chartX,chartY:v.chartY,isTooltipActive:v.isTooltipActive},q=ye(ye({},QF(v,x,P)),{},{updateId:v.updateId+1}),V=ye(ye(ye({},F),U),q);return ye(ye(ye({},V),g(ye({props:m},V),v)),{},{prevDataKey:b,prevData:x,prevWidth:C,prevHeight:k,prevLayout:P,prevStackOffset:T,prevMargin:I,prevChildren:E})}if(!cT(E,v.prevChildren)){var K,D,$,j,z=Ci(E,kd),X=z&&(K=(D=z.props)===null||D===void 0?void 0:D.startIndex)!==null&&K!==void 0?K:N,W=z&&($=(j=z.props)===null||j===void 0?void 0:j.endIndex)!==null&&$!==void 0?$:B,le=X!==N||W!==B,ce=!pt(x),ve=ce&&!le?v.updateId:v.updateId+1;return ye(ye({updateId:ve},g(ye(ye({props:m},v),{},{updateId:ve,dataStartIndex:X,dataEndIndex:W}),v)),{},{prevChildren:E,dataStartIndex:X,dataEndIndex:W})}return null}),at(_,"renderActiveDot",function(m,v,b){var x;return O.isValidElement(m)?x=O.cloneElement(m,v):ht(m)?x=m(v):x=Z.createElement(Ib,v),Z.createElement(qt,{className:"recharts-active-dot",key:b},x)});var y=O.forwardRef(function(v,b){return Z.createElement(_,Ru({},v,{ref:b}))});return y.displayName=_.displayName,y},NFe=$X({chartName:"LineChart",GraphicalChild:km,axisComponents:[{axisType:"xAxis",AxisComp:R2},{axisType:"yAxis",AxisComp:N2}],formatAxisMap:G$e}),MFe=$X({chartName:"PieChart",GraphicalChild:oa,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:jb},{axisType:"radiusAxis",AxisComp:Nb}],formatAxisMap:Ije,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function e6(e){const[t,r,n]=e.split(" ").map(g=>parseFloat(g)),i=t/360,o=r/100,s=n/100,a=(g,_,y)=>(y<0&&(y+=1),y>1&&(y-=1),y<1/6?g+(_-g)*6*y:y<1/2?_:y<2/3?g+(_-g)*(2/3-y)*6:g),l=s<.5?s*(1+o):s+o-s*o,c=2*s-l,d=Math.round(a(c,l,i+1/3)*255),u=Math.round(a(c,l,i)*255),p=Math.round(a(c,l,i-1/3)*255);return`#${((1<<24)+(d<<16)+(u<<8)+p).toString(16).slice(1)}`}function jFe(){const e=document.documentElement,t=getComputedStyle(e),r=n=>{const i=t.getPropertyValue(n).trim();return e6(i||{"--primary":"220 60% 65%","--success":"142 71% 45%","--warning":"38 92% 50%","--info":"220 60% 60%","--destructive":"8 75% 55%","--indigo":"239 65% 60%","--orange":"25 90% 55%","--muted":"220 20% 96%"}[n]||"220 60% 65%")};return{primary:r("--primary"),success:r("--success"),warning:r("--warning"),info:r("--info"),destructive:r("--destructive"),indigo:r("--indigo"),orange:r("--orange"),muted:r("--muted")}}function DFe({data:e,className:t="",height:r=50,color:n,strokeWidth:i=2}){const o=O.useMemo(()=>jFe(),[]),s=n||o.primary,a=O.useMemo(()=>e.map((l,c)=>({index:c,value:l})),[e]);return!e||e.length===0?null:w.jsx("div",{className:`w-full ${t}`,children:w.jsx(bG,{width:"100%",height:r,children:w.jsx(NFe,{data:a,margin:{top:2,right:2,bottom:2,left:2},children:w.jsx(km,{type:"monotone",dataKey:"value",stroke:s,strokeWidth:i,dot:!1,isAnimationActive:!1})})})})}const BX={all:["workflowStatusCounts"],detail:e=>[...BX.all,"detail",e]},LFe=30*1e3;function $Fe(e={}){const{staleTime:t=LFe,enabled:r=!0,refetchInterval:n=0}=e,i=Rt(fr),o=r&&!!i,s=ji({queryKey:BX.detail(i||""),queryFn:async()=>{if(!i)throw new Error("Project path is required");const l=await fetch(`/api/workflow-status-counts?projectPath=${encodeURIComponent(i)}`);if(!l.ok)throw new Error("Failed to fetch workflow status counts");return l.json()},staleTime:t,enabled:o,refetchInterval:n>0?n:!1,retry:2,retryDelay:l=>Math.min(1e3*2**l,1e4)}),a=async()=>{await s.refetch()};return{data:s.data,isLoading:s.isLoading,isFetching:s.isFetching,error:s.error,isStale:s.isStale,refetch:a}}const M2={all:["projectOverview"],detail:e=>[...M2.all,"detail",e]},BFe=300*1e3;function FFe(e={}){const{staleTime:t=BFe,enabled:r=!0}=e,n=Rt(fr),i=r&&!!n,o=ji({queryKey:M2.detail(n),queryFn:()=>PU(n),staleTime:t,enabled:i,retry:2,retryDelay:s=>Math.min(1e3*2**s,1e4)});return{projectOverview:o.data,isLoading:o.isLoading,error:o.error,refetch:o.refetch}}function Qze(){const e=Gn(),t=Rt(fr),r=Ei({mutationFn:n=>AU(n,t),onSuccess:()=>{e.invalidateQueries({queryKey:M2.detail()})}});return{updateGuidelines:r.mutateAsync,isUpdating:r.isPending,error:r.error}}const xv={completed:{bg:"bg-success",text:"text-success",dot:"bg-emerald-500",fill:"#10b981"},in_progress:{bg:"bg-warning",text:"text-warning",dot:"bg-amber-500",fill:"#f59e0b"},planning:{bg:"bg-violet-500",text:"text-violet-600",dot:"bg-violet-500",fill:"#8b5cf6"},paused:{bg:"bg-slate-400",text:"text-slate-500",dot:"bg-slate-400",fill:"#94a3b8"},archived:{bg:"bg-slate-300",text:"text-slate-400",dot:"bg-slate-300",fill:"#cbd5e1"}},zFe={completed:"sessions.status.completed",in_progress:"sessions.status.inProgress",planning:"sessions.status.planning",paused:"sessions.status.paused",archived:"sessions.status.archived"},t6={pending:{bg:"bg-muted",text:"text-muted-foreground",icon:to},completed:{bg:"bg-success/20",text:"text-success",icon:Wh},in_progress:{bg:"bg-warning/20",text:"text-warning",icon:to},blocked:{bg:"bg-destructive/20",text:"text-destructive",icon:Qa},skipped:{bg:"bg-slate-400/20",text:"text-slate-500",icon:to}};function UFe({className:e}){const{formatMessage:t}=$t();return w.jsx("div",{className:he("flex items-center justify-center h-full",e),children:w.jsx(dd,{className:"max-w-sm w-full border-dashed",children:w.jsxs(RO,{className:"flex flex-col items-center gap-4 py-8",children:[w.jsx("div",{className:"w-14 h-14 rounded-full bg-muted flex items-center justify-center",children:w.jsx(Vh,{className:"w-7 h-7 text-muted-foreground"})}),w.jsxs("div",{className:"text-center space-y-2",children:[w.jsx("h3",{className:"text-base font-semibold",children:t({id:"home.emptyState.noSessions.title"})}),w.jsx("p",{className:"text-sm text-muted-foreground",children:t({id:"home.emptyState.noSessions.message"})})]}),w.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[w.jsx("code",{className:"px-3 py-2 bg-muted rounded text-xs font-mono text-center",children:"/workflow-plan"}),w.jsx("p",{className:"text-xs text-muted-foreground text-center",children:t({id:"home.emptyState.noSessions.hint"})})]})]})})})}const r6={planning:{bg:"bg-violet-500/20",text:"text-violet-600"},in_progress:{bg:"bg-warning/20",text:"text-warning"},completed:{bg:"bg-success/20",text:"text-success"},paused:{bg:"bg-slate-400/20",text:"text-slate-500"},ready:{bg:"bg-success/20",text:"text-success"},initialized:{bg:"bg-info/20",text:"text-info"},archived:{bg:"bg-slate-300/20",text:"text-slate-400"},failed:{bg:"bg-destructive/20",text:"text-destructive"}},n6={primary:{card:"border-primary/30 bg-primary/5",icon:"bg-primary/10 text-primary"},info:{card:"border-info/30 bg-info/5",icon:"bg-info/10 text-info"},success:{card:"border-success/30 bg-success/5",icon:"bg-success/10 text-success"},warning:{card:"border-warning/30 bg-warning/5",icon:"bg-warning/10 text-warning"},danger:{card:"border-destructive/30 bg-destructive/5",icon:"bg-destructive/10 text-destructive"},default:{card:"border-border",icon:"bg-muted text-muted-foreground"}};function _u({icon:e,title:t,value:r,variant:n,sparklineData:i}){const o=n6[n]||n6.default;return w.jsxs("div",{className:he("rounded-lg border p-3 transition-all hover:shadow-sm h-full flex flex-col",o.card),children:[w.jsxs("div",{className:"flex items-start justify-between gap-2",children:[w.jsxs("div",{className:"flex-1 min-w-0",children:[w.jsx("p",{className:"text-xs font-medium text-muted-foreground truncate",children:t}),w.jsx("p",{className:"text-xl font-bold text-card-foreground mt-1",children:r.toLocaleString()})]}),w.jsx("div",{className:he("flex h-7 w-7 items-center justify-center rounded-md shrink-0",o.icon),children:w.jsx(e,{className:"h-4 w-4"})})]}),i&&i.length>0&&w.jsx("div",{className:"mt-auto pt-2 -mx-1",children:w.jsx(DFe,{data:i,height:28,strokeWidth:1.5})})]})}function xu(e,t=.3){const n=[];let i=Math.max(0,e*(1-t));for(let o=0;o<6;o++){n.push(Math.round(i));const s=(Math.random()-.5)*2*t*e;i=Math.max(0,i+s)}return n.push(e),n}function HFe({className:e}){var N,B,M,F,U,q,V,K,D,$,j,z,X,W,le,ce,ve,H,Q,Y,re,ge,ee,Ie,Re,xe,et;const{formatMessage:t}=$t(),r=Sc(),{data:n,isLoading:i}=$Fe(),{stats:o,isLoading:s}=ipe({refetchInterval:6e4}),{projectOverview:a,isLoading:l}=FFe(),{activeSessions:c,isLoading:d}=LH({filter:{location:"active"}}),u=n||[],p=u.reduce((be,ot)=>be+ot.count,0),g=u.length>0,_=O.useMemo(()=>({activeSessions:xu((o==null?void 0:o.activeSessions)??0,.4),totalTasks:xu((o==null?void 0:o.totalTasks)??0,.3),completedTasks:xu((o==null?void 0:o.completedTasks)??0,.25),pendingTasks:xu((o==null?void 0:o.pendingTasks)??0,.35),failedTasks:xu((o==null?void 0:o.failedTasks)??0,.5),todayActivity:xu((o==null?void 0:o.todayActivity)??0,.6)}),[o]),[y,m]=O.useState(!1),[v,b]=O.useState(0),x=c.length,E=c[v],C=O.useCallback(be=>{if(!be)return"";const ot=new Date(be);return isNaN(ot.getTime())?"":ot.toLocaleDateString()},[]);O.useEffect(()=>{if(x<=1)return;const be=setInterval(()=>{b(ot=>(ot+1)%x)},5e3);return()=>clearInterval(be)},[x]);const k=()=>{b(be=>be===0?x-1:be-1)},P=()=>{b(be=>(be+1)%x)},T=be=>{r(`/sessions/${be}`)},I=be=>be==="in_progress"?"in_progress":be==="blocked"?"blocked":be==="skipped"?"skipped":be;return w.jsxs("div",{className:he("flex flex-col gap-2",e),children:[w.jsx(dd,{className:"shrink-0 border-gradient-brand",children:l?w.jsxs("div",{className:"px-4 py-3 flex items-center gap-4",children:[w.jsx("div",{className:"h-5 w-32 bg-muted rounded animate-pulse"}),w.jsx("div",{className:"h-4 w-48 bg-muted rounded animate-pulse"})]}):w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"px-5 py-4 flex items-center gap-6 flex-wrap",children:[w.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[w.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:w.jsx(CM,{className:"h-5 w-5 text-primary"})}),w.jsxs("div",{className:"min-w-0",children:[w.jsx("h2",{className:"text-base font-semibold text-foreground truncate",children:(a==null?void 0:a.projectName)||"Claude Code Workflow"}),w.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[300px]",children:(a==null?void 0:a.description)||"AI-powered workflow management system"})]})]}),w.jsx("div",{className:"h-10 w-px bg-border hidden md:block"}),w.jsxs("div",{className:"flex items-center gap-2.5 text-xs",children:[w.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-blue-500/10 text-blue-600 font-medium",children:[w.jsx(CM,{className:"h-3.5 w-3.5"}),((M=(B=(N=a==null?void 0:a.technologyStack)==null?void 0:N.languages)==null?void 0:B[0])==null?void 0:M.name)||"TypeScript"]}),w.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-green-500/10 text-green-600 font-medium",children:[w.jsx(yk,{className:"h-3.5 w-3.5"}),((U=(F=a==null?void 0:a.technologyStack)==null?void 0:F.frameworks)==null?void 0:U[0])||"Node.js"]}),w.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-violet-500/10 text-violet-600 font-medium",children:[w.jsx(vk,{className:"h-3.5 w-3.5"}),((q=a==null?void 0:a.architecture)==null?void 0:q.style)||"Modular Monolith"]}),((K=(V=a==null?void 0:a.technologyStack)==null?void 0:V.build_tools)==null?void 0:K[0])&&w.jsxs("span",{className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-orange-500/10 text-orange-600 font-medium",children:[w.jsx(ju,{className:"h-3.5 w-3.5"}),a.technologyStack.build_tools[0]]})]}),w.jsx("div",{className:"h-10 w-px bg-border hidden lg:block"}),w.jsxs("div",{className:"flex items-center gap-5 text-xs",children:[w.jsxs("div",{className:"flex items-center gap-2 text-emerald-600",children:[w.jsx(bk,{className:"h-3.5 w-3.5"}),w.jsx("span",{className:"font-semibold",children:(($=(D=a==null?void 0:a.developmentIndex)==null?void 0:D.feature)==null?void 0:$.length)||0}),w.jsx("span",{className:"text-muted-foreground",children:t({id:"projectOverview.devIndex.category.features"})})]}),w.jsxs("div",{className:"flex items-center gap-2 text-amber-600",children:[w.jsx(xM,{className:"h-3.5 w-3.5"}),w.jsx("span",{className:"font-semibold",children:((z=(j=a==null?void 0:a.developmentIndex)==null?void 0:j.bugfix)==null?void 0:z.length)||0}),w.jsx("span",{className:"text-muted-foreground",children:t({id:"projectOverview.devIndex.category.bugfixes"})})]}),w.jsxs("div",{className:"flex items-center gap-2 text-blue-600",children:[w.jsx(Vx,{className:"h-3.5 w-3.5"}),w.jsx("span",{className:"font-semibold",children:((W=(X=a==null?void 0:a.developmentIndex)==null?void 0:X.enhancement)==null?void 0:W.length)||0}),w.jsx("span",{className:"text-muted-foreground",children:t({id:"projectOverview.devIndex.category.enhancements"})})]})]}),w.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground ml-auto",children:[w.jsxs("span",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-md bg-muted/50",children:[w.jsx(wM,{className:"h-3.5 w-3.5"}),a!=null&&a.initializedAt?new Date(a.initializedAt).toLocaleDateString():new Date().toLocaleDateString()]}),w.jsx(Ze,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-muted",onClick:()=>m(!y),children:y?w.jsx(y0,{className:"h-4 w-4"}):w.jsx(ea,{className:"h-4 w-4"})})]})]}),y&&w.jsxs("div",{className:"px-5 pb-4 grid grid-cols-4 gap-6 border-t border-border/50 pt-4",children:[w.jsxs("div",{className:"space-y-2",children:[w.jsxs("h4",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[w.jsx(vk,{className:"h-4 w-4 text-primary"}),t({id:"projectOverview.architecture.title"})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsx("div",{className:"flex items-center gap-2",children:w.jsx("span",{className:"text-sm font-medium text-foreground",children:((le=a==null?void 0:a.architecture)==null?void 0:le.style)||"Modular Monolith"})}),w.jsxs("p",{className:"text-xs text-muted-foreground",children:[t({id:"projectOverview.architecture.layers"}),":"]}),w.jsx("div",{className:"flex flex-wrap gap-1.5",children:(((ce=a==null?void 0:a.architecture)==null?void 0:ce.layers)||["CLI Tools","Core Services","Dashboard UI","Data Layer"]).slice(0,5).map((be,ot)=>w.jsx("span",{className:"text-xs px-2 py-1 rounded-md bg-muted text-muted-foreground font-medium",children:be},ot))})]})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs("h4",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[w.jsx(ju,{className:"h-4 w-4 text-orange-500"}),t({id:"projectOverview.components.title"})]}),w.jsx("div",{className:"space-y-1.5",children:((a==null?void 0:a.keyComponents)||[{name:"Session Manager",description:"Workflow session lifecycle"},{name:"Dashboard Generator",description:"Dynamic widget rendering"},{name:"Data Aggregator",description:"Stats and metrics collection"},{name:"Task Scheduler",description:"Async task orchestration"}]).slice(0,4).map((be,ot)=>w.jsxs("div",{className:"flex items-start gap-2",children:[w.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-orange-500 mt-1.5 shrink-0"}),w.jsxs("div",{className:"min-w-0",children:[w.jsx("p",{className:"text-xs font-medium text-foreground truncate",children:be.name}),be.description&&w.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:be.description})]})]},ot))})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs("h4",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[w.jsx(Vx,{className:"h-4 w-4 text-blue-500"}),t({id:"projectOverview.devIndex.title"})]}),w.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[w.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-emerald-500/10",children:[w.jsx(bk,{className:"h-3.5 w-3.5 text-emerald-600"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-semibold text-emerald-600",children:((H=(ve=a==null?void 0:a.developmentIndex)==null?void 0:ve.feature)==null?void 0:H.length)||10}),w.jsx("p",{className:"text-[10px] text-emerald-600/80",children:t({id:"projectOverview.devIndex.category.features"})})]})]}),w.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-blue-500/10",children:[w.jsx(Vx,{className:"h-3.5 w-3.5 text-blue-600"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-semibold text-blue-600",children:((Y=(Q=a==null?void 0:a.developmentIndex)==null?void 0:Q.enhancement)==null?void 0:Y.length)||5}),w.jsx("p",{className:"text-[10px] text-blue-600/80",children:t({id:"projectOverview.devIndex.category.enhancements"})})]})]}),w.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-amber-500/10",children:[w.jsx(xM,{className:"h-3.5 w-3.5 text-amber-600"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-semibold text-amber-600",children:((ge=(re=a==null?void 0:a.developmentIndex)==null?void 0:re.bugfix)==null?void 0:ge.length)||3}),w.jsx("p",{className:"text-[10px] text-amber-600/80",children:t({id:"projectOverview.devIndex.category.bugfixes"})})]})]}),w.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-violet-500/10",children:[w.jsx(ju,{className:"h-3.5 w-3.5 text-violet-600"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-semibold text-violet-600",children:((Ie=(ee=a==null?void 0:a.developmentIndex)==null?void 0:ee.refactor)==null?void 0:Ie.length)||2}),w.jsx("p",{className:"text-[10px] text-violet-600/80",children:t({id:"projectOverview.devIndex.category.refactorings"})})]})]})]})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsxs("h4",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[w.jsx(Hz,{className:"h-4 w-4 text-violet-500"}),t({id:"projectOverview.architecture.patterns"})]}),w.jsx("div",{className:"flex flex-wrap gap-1.5",children:(((Re=a==null?void 0:a.architecture)==null?void 0:Re.patterns)||["Factory","Strategy","Observer","Singleton","Decorator"]).slice(0,6).map((be,ot)=>w.jsx("span",{className:"text-xs px-2.5 py-1 rounded-md bg-primary/10 text-primary font-medium",children:be},ot))})]})]})]})}),w.jsxs(dd,{className:"h-[400px] flex shrink-0 overflow-hidden",children:[w.jsxs("div",{className:"w-[28%] p-3 flex flex-col border-r border-border",children:[w.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-1.5",children:[w.jsx(tne,{className:"h-4 w-4"}),t({id:"home.sections.statistics"})]}),s?w.jsx("div",{className:"grid grid-cols-2 grid-rows-3 gap-2.5 flex-1",children:[1,2,3,4,5,6].map(be=>w.jsx("div",{className:"bg-muted rounded animate-pulse"},be))}):w.jsxs("div",{className:"grid grid-cols-2 grid-rows-3 gap-2.5 flex-1",children:[w.jsx(_u,{icon:_0,title:t({id:"home.stats.activeSessions"}),value:(o==null?void 0:o.activeSessions)??0,variant:"primary",sparklineData:_.activeSessions}),w.jsx(_u,{icon:Vh,title:t({id:"home.stats.totalTasks"}),value:(o==null?void 0:o.totalTasks)??0,variant:"info",sparklineData:_.totalTasks}),w.jsx(_u,{icon:Wh,title:t({id:"home.stats.completedTasks"}),value:(o==null?void 0:o.completedTasks)??0,variant:"success",sparklineData:_.completedTasks}),w.jsx(_u,{icon:to,title:t({id:"home.stats.pendingTasks"}),value:(o==null?void 0:o.pendingTasks)??0,variant:"warning",sparklineData:_.pendingTasks}),w.jsx(_u,{icon:Qa,title:t({id:"common.status.failed"}),value:(o==null?void 0:o.failedTasks)??0,variant:"danger",sparklineData:_.failedTasks}),w.jsx(_u,{icon:$z,title:t({id:"common.stats.todayActivity"}),value:(o==null?void 0:o.todayActivity)??0,variant:"default",sparklineData:_.todayActivity})]})]}),w.jsxs("div",{className:"w-[22%] p-3 flex flex-col border-r border-border",children:[w.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-1.5",children:[w.jsx(SM,{className:"h-4 w-4"}),t({id:"home.widgets.workflowStatus"})]}),i?w.jsx("div",{className:"flex-1 flex items-center justify-center",children:w.jsx("div",{className:"w-24 h-24 rounded-full bg-muted animate-pulse"})}):g?w.jsxs("div",{className:"flex-1 flex flex-col",children:[w.jsx("div",{className:"flex-1 min-h-0",children:w.jsx(bG,{width:"100%",height:"100%",children:w.jsx(MFe,{children:w.jsx(oa,{data:u,cx:"50%",cy:"50%",innerRadius:"55%",outerRadius:"85%",paddingAngle:2,dataKey:"count",children:u.map(be=>{const ot=xv[be.status]||xv.completed;return w.jsx(bb,{fill:ot.fill},be.status)})})})})}),w.jsx("div",{className:"grid grid-cols-2 gap-x-3 gap-y-1.5 mt-3",children:u.map(be=>{const ot=xv[be.status]||xv.completed,xt=p>0?Math.round(be.count/p*100):0;return w.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[w.jsx("div",{className:he("w-2.5 h-2.5 rounded-full shrink-0",ot.dot)}),w.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t({id:zFe[be.status]??"sessions.status.inProgress"})}),w.jsxs("span",{className:"text-xs font-medium text-foreground ml-auto",children:[xt,"%"]})]},be.status)})})]}):w.jsx("div",{className:"flex-1 flex items-center justify-center",children:w.jsxs("div",{className:"text-center",children:[w.jsx(SM,{className:"w-12 h-12 mx-auto text-muted-foreground/30 mb-2"}),w.jsx("p",{className:"text-xs text-muted-foreground",children:t({id:"home.emptyState.noSessions.message"})})]})})]}),w.jsxs("div",{className:"flex-1 min-w-0 p-4 flex flex-col",children:[w.jsxs("div",{className:"flex items-center justify-between mb-3",children:[w.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-1.5",children:[w.jsx(Vh,{className:"h-4 w-4"}),t({id:"home.sections.taskDetails"})]}),x>0&&w.jsxs("div",{className:"flex items-center gap-1.5",children:[w.jsx(Ze,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:k,disabled:x<=1,children:w.jsx(rne,{className:"h-4 w-4"})}),w.jsxs("span",{className:"text-xs text-muted-foreground min-w-[45px] text-center",children:[v+1," / ",x]}),w.jsx(Ze,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:P,disabled:x<=1,children:w.jsx(Fz,{className:"h-4 w-4"})})]})]}),d?w.jsx("div",{className:"flex-1 flex items-center justify-center",children:w.jsxs("div",{className:"w-full max-w-sm space-y-3",children:[w.jsx("div",{className:"h-8 bg-muted rounded animate-pulse"}),w.jsx("div",{className:"h-4 bg-muted rounded animate-pulse w-3/4"}),w.jsx("div",{className:"h-20 bg-muted rounded animate-pulse"})]})}):x===0?w.jsx(UFe,{}):E?w.jsxs("div",{className:"flex-1 flex flex-col min-h-0 rounded-lg border border-border bg-accent/20 p-3 overflow-hidden cursor-pointer hover:border-primary/30 transition-colors",onClick:()=>T(E.session_id),children:[w.jsxs("div",{className:"mb-2 pb-2 border-b border-border shrink-0 min-w-0",children:[w.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[w.jsx("div",{className:he("px-2 py-1 rounded text-xs font-medium shrink-0",((xe=r6[E.status])==null?void 0:xe.bg)||"bg-muted",((et=r6[E.status])==null?void 0:et.text)||"text-muted-foreground"),children:t({id:`common.status.${E.status==="in_progress"?"inProgress":E.status}`})}),w.jsxs("div",{className:"flex-1 min-w-0 overflow-hidden",children:[w.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:E.title||E.session_id}),w.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.session_id})]})]}),E.description&&w.jsx("p",{className:"text-xs text-muted-foreground mt-2 line-clamp-2",children:E.description}),E.tasks&&E.tasks.length>0&&w.jsxs("div",{className:"mt-2.5 space-y-1",children:[w.jsxs("div",{className:"flex items-center justify-between text-xs",children:[w.jsx("span",{className:"text-muted-foreground",children:t({id:"common.labels.progress"})}),w.jsxs("span",{className:"font-medium text-foreground",children:[E.tasks.filter(be=>be.status==="completed").length,"/",E.tasks.length]})]}),w.jsx(sb,{value:E.tasks.length>0?E.tasks.filter(be=>be.status==="completed").length/E.tasks.length*100:0,className:"h-1.5 bg-muted",indicatorClassName:"bg-success"})]}),w.jsx("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:w.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground ml-auto",children:[w.jsx(wM,{className:"h-3 w-3"}),C(E.updated_at||E.created_at)]})})]}),E.tasks&&E.tasks.length>0?w.jsx("div",{className:"flex-1 overflow-auto min-h-0",children:w.jsx("div",{className:"grid grid-cols-2 gap-2 w-full",children:E.tasks.map((be,ot)=>{const xt=I(be.status),pr=t6[xt]||t6.pending,sr=pr.icon,Pt=E.tasks.length%2===1&&ot===E.tasks.length-1;return w.jsxs("div",{className:he("flex items-center gap-2 p-2 rounded hover:bg-background/50 transition-colors min-w-0",Pt&&"col-span-2"),children:[w.jsx("div",{className:he("p-1 rounded shrink-0",pr.bg),children:w.jsx(sr,{className:he("h-3 w-3",pr.text)})}),w.jsx("p",{className:he("flex-1 text-xs font-medium truncate",be.status==="completed"?"text-muted-foreground line-through":"text-foreground"),children:be.title||be.task_id})]},`${E.session_id}-${be.task_id}-${ot}`)})})}):w.jsx("div",{className:"flex-1 flex items-center justify-center",children:w.jsx("p",{className:"text-xs text-muted-foreground",children:t({id:"home.emptyState.noTasks.message"})})})]}):null,x>1&&w.jsx("div",{className:"flex items-center justify-center gap-1 mt-2",children:c.map((be,ot)=>w.jsx("button",{onClick:()=>b(ot),className:he("w-1.5 h-1.5 rounded-full transition-colors",ot===v?"bg-primary":"bg-muted hover:bg-muted-foreground/50")},ot))})]})]})]})}const qFe=O.memo(HFe);function WFe(e={}){const t=Gn(),r=Rt(fr),n=(e.enabled??!0)&&!!r,{data:i={litePlan:[],liteFix:[],multiCliPlan:[]},isLoading:o,error:s,refetch:a}=ji({queryKey:ke.liteTasks(r),queryFn:()=>sA(r),staleTime:3e4,refetchInterval:e.refetchInterval,enabled:n}),l=[...(i.litePlan||[]).map(u=>({...u,_type:"lite-plan"})),...(i.liteFix||[]).map(u=>({...u,_type:"lite-fix"})),...(i.multiCliPlan||[]).map(u=>({...u,_type:"multi-cli-plan"}))],c=u=>{switch(u){case"lite-plan":return i.litePlan||[];case"lite-fix":return i.liteFix||[];case"multi-cli-plan":return i.multiCliPlan||[]}},d=(u,p)=>{t.prefetchQuery({queryKey:["liteTask",u,p],queryFn:()=>RU(u,p,r),staleTime:6e4})};return{litePlan:i.litePlan||[],liteFix:i.liteFix||[],multiCliPlan:i.multiCliPlan||[],allSessions:l,getSessionsByType:c,prefetchSession:d,isLoading:o,error:s,refetch:a}}const VFe=[{key:"all",label:"home.tabs.allTasks",icon:_0},{key:"workflow",label:"home.tabs.workflow",icon:nm},{key:"lite",label:"home.tabs.liteTasks",icon:Gh}],GFe={in_progress:Wn,running:Wn,planning:Uz,completed:Wh,failed:Qa,paused:nne,pending:to,cancelled:Qa,idle:to,initializing:Wn,ready:Wh},KFe={in_progress:"bg-warning/20 text-warning border-warning/30",running:"bg-warning/20 text-warning border-warning/30",planning:"bg-violet-500/20 text-violet-600 border-violet-500/30",completed:"bg-success/20 text-success border-success/30",failed:"bg-destructive/20 text-destructive border-destructive/30",paused:"bg-slate-400/20 text-slate-500 border-slate-400/30",pending:"bg-muted text-muted-foreground border-border",cancelled:"bg-destructive/20 text-destructive border-destructive/30",idle:"bg-muted text-muted-foreground border-border",initializing:"bg-info/20 text-info border-info/30",ready:"bg-success/20 text-success border-success/30"},i6={in_progress:"inProgress",running:"running",planning:"planning",completed:"completed",failed:"failed",paused:"paused",pending:"pending",cancelled:"cancelled",idle:"idle",initializing:"initializing",ready:"ready"},XFe={"lite-plan":Uz,"lite-fix":ju,"multi-cli-plan":Hz},ZFe={all:"bg-muted text-muted-foreground",workflow:"bg-primary/20 text-primary",lite:"bg-amber-500/20 text-amber-600"};function QFe({item:e,onClick:t}){const{formatMessage:r}=$t(),n=GFe[e.status]||to,i=e.subType?XFe[e.subType]||Gh:e.type==="workflow"?nm:Gh,o=e.status==="in_progress"||e.status==="running"||e.status==="initializing";return w.jsx("button",{onClick:t,className:"w-full text-left p-3 rounded-lg border border-border bg-card hover:bg-accent/50 hover:border-primary/30 transition-all group",children:w.jsxs("div",{className:"flex items-start gap-2.5 min-w-0",children:[w.jsx("div",{className:he("p-1.5 rounded-md shrink-0",ZFe[e.type]),children:w.jsx(i,{className:"h-4 w-4"})}),w.jsxs("div",{className:"flex-1 min-w-0 overflow-hidden",children:[w.jsxs("div",{className:"flex items-start gap-2 mb-1 min-w-0",children:[w.jsx("h4",{className:"text-sm font-medium text-foreground truncate flex-1 min-w-0 group-hover:text-primary transition-colors",children:e.name}),w.jsxs(Vn,{className:he("text-[10px] px-1.5 py-0 shrink-0 border",KFe[e.status]),children:[w.jsx(n,{className:he("h-2.5 w-2.5 mr-0.5",o&&"animate-spin")}),r({id:`common.status.${e.statusKey}`})]})]}),e.description&&w.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-1.5",children:e.description}),typeof e.progress=="number"&&e.progress>0&&w.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[w.jsx(sb,{value:e.progress,className:"h-1 flex-1 bg-muted"}),w.jsxs("span",{className:"text-[10px] text-muted-foreground w-8 text-right",children:[e.progress,"%"]})]}),w.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[w.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground",children:[w.jsx(to,{className:"h-2.5 w-2.5"}),e.createdAt]}),e.subType&&w.jsx(Vn,{variant:"outline",className:"text-[9px] px-1 py-0 bg-background",children:e.subType}),e.tags&&e.tags.slice(0,2).map(s=>w.jsxs(Vn,{variant:"outline",className:"text-[9px] px-1 py-0 gap-0.5 bg-background",children:[w.jsx(One,{className:"h-2 w-2"}),s]},s)),e.tags&&e.tags.length>2&&w.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["+",e.tags.length-2]})]})]})]})})}function YFe(){return w.jsx("div",{className:"p-3 rounded-lg border border-border bg-card animate-pulse",children:w.jsxs("div",{className:"flex items-start gap-2.5",children:[w.jsx("div",{className:"w-8 h-8 rounded-md bg-muted"}),w.jsxs("div",{className:"flex-1",children:[w.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[w.jsx("div",{className:"h-4 bg-muted rounded flex-1"}),w.jsx("div",{className:"h-4 w-16 bg-muted rounded"})]}),w.jsx("div",{className:"h-3 bg-muted rounded w-3/4 mb-2"}),w.jsxs("div",{className:"flex gap-2",children:[w.jsx("div",{className:"h-3 w-16 bg-muted rounded"}),w.jsx("div",{className:"h-3 w-12 bg-muted rounded"})]})]})]})})}function JFe({className:e,maxItems:t=6}){const{formatMessage:r}=$t(),n=Sc(),[i,o]=O.useState("all"),{activeSessions:s,isLoading:a}=LH({filter:{location:"active"}}),{allSessions:l,isLoading:c}=WFe(),d=O.useCallback(m=>{if(!m)return r({id:"common.time.justNow"});const v=new Date(m);if(isNaN(v.getTime()))return r({id:"common.time.justNow"});const x=new Date().getTime()-v.getTime(),E=Math.floor(x/6e4),C=Math.floor(E/60),k=Math.floor(C/24);return E<1?r({id:"common.time.justNow"}):E<60?r({id:"common.time.minutesAgo"},{count:E}):C<24?r({id:"common.time.hoursAgo"},{count:C}):r({id:"common.time.daysAgo"},{count:k})},[r]),u=O.useMemo(()=>{const m=[];return s.forEach(v=>{const b=v.status||"pending";m.push({id:v.session_id,name:v.title||v.description||v.session_id,type:"workflow",status:b,statusKey:i6[b]||b,createdAt:d(v.created_at),description:v.description||`Session: ${v.session_id}`,tags:[],progress:void 0})}),l.forEach(v=>{const b=v.status||"pending",x=v.session_id||v.id;m.push({id:x,name:v.title||x,type:"lite",subType:v._type,status:b,statusKey:i6[b]||b,createdAt:d(v.createdAt),description:v.description||`${v._type} task`,tags:[],progress:void 0})}),m},[s,l,d]),p=O.useMemo(()=>i==="all"?u.slice(0,t):u.filter(m=>m.type===i).slice(0,t),[u,i,t]),g=m=>{switch(m.type){case"workflow":n(`/sessions/${m.id}`);break;case"lite":n(`/lite-tasks/${m.subType}/${m.id}`);break}},_=()=>{n("/sessions")},y=a||c;return w.jsx("div",{className:e,children:w.jsxs(dd,{className:"h-full p-4 flex flex-col",children:[w.jsxs("div",{className:"flex items-center justify-between mb-3",children:[w.jsx("h3",{className:"text-sm font-semibold text-foreground",children:r({id:"home.sections.recentTasks"})}),w.jsx(Ze,{variant:"link",size:"sm",className:"text-xs h-auto p-0",onClick:_,children:r({id:"common.actions.viewAll"})})]}),w.jsx("div",{className:"flex gap-1 mb-3 overflow-x-auto pb-1",children:VFe.map(m=>{const v=m.icon,b=m.key==="all"?u.length:u.filter(x=>x.type===m.key).length;return w.jsxs(Ze,{variant:i===m.key?"default":"ghost",size:"sm",onClick:()=>o(m.key),className:he("whitespace-nowrap text-xs gap-1 h-7 px-2",i===m.key&&"bg-primary text-primary-foreground"),children:[w.jsx(v,{className:"h-3 w-3"}),r({id:m.label}),w.jsxs("span",{className:"text-[10px] opacity-70",children:["(",b,")"]})]},m.key)})}),w.jsx("div",{className:"flex-1 overflow-auto",children:y?w.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2",children:Array.from({length:6}).map((m,v)=>w.jsx(YFe,{},v))}):p.length===0?w.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[w.jsx(_0,{className:"h-10 w-10 text-muted-foreground mb-2"}),w.jsx("p",{className:"text-sm text-muted-foreground",children:r({id:"home.emptyState.noTasks.message"})})]}):w.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2",children:p.map(m=>w.jsx(QFe,{item:m,onClick:()=>g(m)},`${m.type}-${m.id}`))})})]})})}const e6e=O.memo(JFe);function t6e(){const{formatMessage:e}=$t(),[t,r]=O.useState(!1),n=()=>{window.location.reload()};return w.jsxs("div",{className:"space-y-6",children:[w.jsx(dTe,{titleKey:"home.dashboard.title",descriptionKey:"home.dashboard.description",onRefresh:n}),t&&w.jsxs("div",{className:"flex items-center gap-2 p-4 rounded-lg bg-destructive/10 border border-destructive/30 text-destructive",children:[w.jsx(Ds,{className:"h-5 w-5 flex-shrink-0"}),w.jsxs("div",{className:"flex-1",children:[w.jsx("p",{className:"text-sm font-medium",children:e({id:"home.errors.loadFailed"})}),w.jsx("p",{className:"text-xs mt-0.5",children:e({id:"common.errors.unknownError"})})]}),w.jsx(Ze,{variant:"outline",size:"sm",onClick:n,children:e({id:"home.errors.retry"})})]}),w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx(qFe,{}),w.jsx(e6e,{})]})]})}const r6e=O.lazy(()=>Lt(()=>import("./SessionsPage-BVz1KCc7.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(e=>({default:e.SessionsPage}))),n6e=O.lazy(()=>Lt(()=>import("./FixSessionPage-CC4p04Az.js"),[]).then(e=>({default:e.FixSessionPage}))),i6e=O.lazy(()=>Lt(()=>import("./ProjectOverviewPage-DBB_-FzV.js"),__vite__mapDeps([9,10,11,12,13,14])).then(e=>({default:e.ProjectOverviewPage}))),o6e=O.lazy(()=>Lt(()=>import("./SessionDetailPage-DM-W5R8K.js"),__vite__mapDeps([15,16,17,1,18,2,19,20,21,22,13,4,6])).then(e=>({default:e.SessionDetailPage}))),s6e=O.lazy(()=>Lt(()=>import("./HistoryPage-D0fYQZgc.js"),__vite__mapDeps([23,24,20,25,26,3,4,27,28,5,7])).then(e=>({default:e.HistoryPage}))),a6e=O.lazy(()=>Lt(()=>import("./OrchestratorPage-FC__7yYa.js"),__vite__mapDeps([29,19,30,1,31,32,33,34,12,7,35,36,37,21])).then(e=>({default:e.OrchestratorPage}))),l6e=O.lazy(()=>Lt(()=>import("./IssueHubPage-E4JVrhO1.js"),__vite__mapDeps([38,10,3,11,1,39,26,36,40,41,42,14,43,37,7])).then(e=>({default:e.IssueHubPage}))),c6e=O.lazy(()=>Lt(()=>import("./SkillsManagerPage-CKom9XwV.js"),__vite__mapDeps([44,6,16,41,45,3,1,42,46,27,20,4,11,7,47,48,49,50,51,52,33,32,36,35,21])).then(e=>({default:e.SkillsManagerPage}))),u6e=O.lazy(()=>Lt(()=>import("./CommandsManagerPage-C2JWcemF.js"),__vite__mapDeps([53,6,31,32,52,16,47,48,49,20,50,4,7])).then(e=>({default:e.CommandsManagerPage}))),d6e=O.lazy(()=>Lt(()=>import("./MemoryPage-BI4FAXhs.js"),__vite__mapDeps([54,6,4,55,1,56,7,57,5,26,11,58,59])).then(e=>({default:e.MemoryPage}))),f6e=O.lazy(()=>Lt(()=>import("./SettingsPage-ComW7EZS.js"),__vite__mapDeps([60,41,61,62,2,18,63,50,4,12,64,27,37,22,20])).then(e=>({default:e.SettingsPage}))),h6e=O.lazy(()=>Lt(()=>import("./NotFoundPage-DD2svchp.js"),[]).then(e=>({default:e.NotFoundPage}))),o6=O.lazy(()=>Lt(()=>import("./LiteTasksPage-aJuRoyLt.js"),__vite__mapDeps([65,6,17,16,1,18,2,19,20,21,22,7,24,26,27,43,30])).then(e=>({default:e.LiteTasksPage}))),p6e=O.lazy(()=>Lt(()=>import("./ReviewSessionPage-Dd1-g_gp.js"),__vite__mapDeps([66,1])).then(e=>({default:e.ReviewSessionPage}))),m6e=O.lazy(()=>Lt(()=>import("./McpManagerPage-BJeuWJv1.js"),__vite__mapDeps([67,41,51,50,4,46,27,18,45,47,48,49,20,68,12,24,1,8,40,55,6,34,11])).then(e=>({default:e.McpManagerPage}))),g6e=O.lazy(()=>Lt(()=>import("./EndpointsPage-CMOWQG64.js"),__vite__mapDeps([69,70,62,32,52,71,45,11])).then(e=>({default:e.EndpointsPage}))),v6e=O.lazy(()=>Lt(()=>import("./InstallationsPage-tjklillZ.js"),__vite__mapDeps([72,70,62,32,22,37])).then(e=>({default:e.InstallationsPage}))),y6e=O.lazy(()=>Lt(()=>import("./HookManagerPage-D2FuJfsM.js"),__vite__mapDeps([73,41,45,11,63,70,62,32,74,75])).then(e=>({default:e.HookManagerPage}))),b6e=O.lazy(()=>Lt(()=>import("./RulesManagerPage-B3RGdsKD.js"),__vite__mapDeps([76,70,62,32,52,20,3,11,6,7,51,8])).then(e=>({default:e.RulesManagerPage}))),_6e=O.lazy(()=>Lt(()=>import("./PromptHistoryPage-BwOAvCH8.js"),__vite__mapDeps([77,26,57,14,75,27,28,1,39,8])).then(e=>({default:e.PromptHistoryPage}))),x6e=O.lazy(()=>Lt(()=>import("./ExplorerPage-DaFPRlNo.js"),__vite__mapDeps([78,49,20,36,35])).then(e=>({default:e.ExplorerPage}))),w6e=O.lazy(()=>Lt(()=>import("./GraphExplorerPage-DCV5ybKE.js"),__vite__mapDeps([79,19,8,1,22,80,21])).then(e=>({default:e.GraphExplorerPage}))),S6e=O.lazy(()=>Lt(()=>import("./ApiSettingsPage-DlCbXxTz.js"),__vite__mapDeps([81,6,52,82,62,32,3,11,16,50,4,41,1,68,12,18])).then(e=>({default:e.ApiSettingsPage}))),C6e=O.lazy(()=>Lt(()=>import("./CliViewerPage-ChM-uNx_.js"),__vite__mapDeps([83,84,85,86,80,56,10,7])).then(e=>({default:e.CliViewerPage}))),E6e=O.lazy(()=>Lt(()=>import("./CliSessionSharePage-BNDkEE4u.js"),[]).then(e=>({default:e.CliSessionSharePage}))),k6e=O.lazy(()=>Lt(()=>import("./TeamPage-u5_i0Rgh.js"),__vite__mapDeps([87,6,52,8,1,22,20,25,3,4,58,5,7])).then(e=>({default:e.TeamPage}))),T6e=O.lazy(()=>Lt(()=>import("./TerminalDashboardPage-rUtC9e40.js"),__vite__mapDeps([88,84,85,82,62,32,20,89,10,7,49,41,1,48,63,74,40,28,50,4])).then(e=>({default:e.TerminalDashboardPage}))),P6e=O.lazy(()=>Lt(()=>import("./AnalysisPage-ds-w_nVO.js"),__vite__mapDeps([90,6,86,80,56,7,1])).then(e=>({default:e.AnalysisPage}))),A6e=O.lazy(()=>Lt(()=>import("./SpecsSettingsPage-DQz7WP2s.js"),__vite__mapDeps([91,52,1,3,4,11,51,20,12,61,71,8,39,89])).then(e=>({default:e.SpecsSettingsPage}))),O6e=O.lazy(()=>Lt(()=>import("./DeepWikiPage-CvleOtJy.js"),__vite__mapDeps([92,6,64,1,26,30])).then(e=>({default:e.DeepWikiPage}))),I6e=O.lazy(()=>Lt(()=>import("./CodexLensPage-DOcsYNQk.js"),__vite__mapDeps([93,6,12,50,4])).then(e=>({default:e.CodexLensPage})));function Ut(e){return w.jsx(cTe,{children:w.jsx(O.Suspense,{fallback:w.jsx(uTe,{}),children:e})})}const R6e=[{path:"cli-sessions/share",element:Ut(w.jsx(E6e,{}))},{path:"/",element:w.jsx(aTe,{}),children:[{index:!0,element:w.jsx(t6e,{})},{path:"sessions",element:Ut(w.jsx(r6e,{}))},{path:"sessions/:sessionId",element:Ut(w.jsx(o6e,{}))},{path:"sessions/:sessionId/fix",element:Ut(w.jsx(n6e,{}))},{path:"sessions/:sessionId/review",element:Ut(w.jsx(p6e,{}))},{path:"lite-tasks/:subType/:id",element:Ut(w.jsx(o6,{}))},{path:"lite-tasks",element:Ut(w.jsx(o6,{}))},{path:"project",element:Ut(w.jsx(i6e,{}))},{path:"history",element:Ut(w.jsx(s6e,{}))},{path:"orchestrator",element:Ut(w.jsx(a6e,{}))},{path:"loops",element:w.jsx($g,{to:"/terminal-dashboard",replace:!0})},{path:"cli-viewer",element:Ut(w.jsx(C6e,{}))},{path:"issues",element:Ut(w.jsx(l6e,{}))},{path:"issues/queue",element:w.jsx($g,{to:"/issues?tab=queue",replace:!0})},{path:"issues/discovery",element:w.jsx($g,{to:"/issues?tab=discovery",replace:!0})},{path:"skills",element:Ut(w.jsx(c6e,{}))},{path:"commands",element:Ut(w.jsx(u6e,{}))},{path:"memory",element:Ut(w.jsx(d6e,{}))},{path:"prompts",element:Ut(w.jsx(_6e,{}))},{path:"settings",element:Ut(w.jsx(f6e,{}))},{path:"settings/mcp",element:Ut(w.jsx(m6e,{}))},{path:"settings/endpoints",element:Ut(w.jsx(g6e,{}))},{path:"settings/installations",element:Ut(w.jsx(v6e,{}))},{path:"settings/rules",element:Ut(w.jsx(b6e,{}))},{path:"settings/specs",element:Ut(w.jsx(A6e,{}))},{path:"api-settings",element:Ut(w.jsx(S6e,{}))},{path:"hooks",element:Ut(w.jsx(y6e,{}))},{path:"explorer",element:Ut(w.jsx(x6e,{}))},{path:"graph",element:Ut(w.jsx(w6e,{}))},{path:"teams",element:Ut(w.jsx(k6e,{}))},{path:"analysis",element:Ut(w.jsx(P6e,{}))},{path:"deepwiki",element:Ut(w.jsx(O6e,{}))},{path:"codexlens",element:Ut(w.jsx(I6e,{}))},{path:"terminal-dashboard",element:Ut(w.jsx(T6e,{}))},{path:"skill-hub",element:w.jsx($g,{to:"/skills?tab=hub",replace:!0})},{path:"*",element:Ut(w.jsx(h6e,{}))}]}],N6e="/".replace(/\/$/,"")||"",M6e=zJ(R6e,{basename:N6e}),PP=new iY({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1e3*60*10,retry:1,refetchOnWindowFocus:!1},mutations:{retry:1}}});function j6e({locale:e,messages:t}){return O.useEffect(()=>{nU().catch(console.error),Uae().catch(()=>{})},[]),w.jsx(zte,{locale:e,messages:t,children:w.jsx(oY,{client:PP,children:w.jsxs(Tye,{children:[w.jsx(D6e,{}),w.jsx(L6e,{}),w.jsx($6e,{}),w.jsx(XJ,{router:M6e}),w.jsx(pre,{richColors:!0,position:"top-right"})]})})})}function D6e(){const e=Rt(t=>t.registerQueryInvalidator);return O.useEffect(()=>{e(()=>{zn.getState().resetState(),li.getState().resetState(),fA.getState().resetState(),Hd.getState().resetState(),Tk.getState().resetState(),Ud.getState().resetState();const r=nc.getState();r.resetState(),Rt.getState().projectPath&&r.loadInitialState().catch(i=>{console.error("[QueueSchedulerSync] Failed to sync scheduler state:",i)}),Fn.getState().resetState(),$le.getState().resetWorkspaceState(),PP.invalidateQueries({queryKey:tO}),PP.invalidateQueries({predicate:i=>{const o=i.queryKey;if(!Array.isArray(o))return!1;const s=o[0];return s==="workspace"||s==="projectOverview"||s==="workflowStatusCounts"||s==="dashboardStats"}})})},[e]),null}function L6e(){const e=Rt(fr),t=li(r=>r.setSessions);return O.useEffect(()=>{let r=!1;return e?(FU(e).then(({sessions:n})=>{r||t(n)}).catch(n=>{console.error("[CliSessionSync] Failed to sync CLI sessions:",n),r||t([])}),()=>{r=!0}):(t([]),()=>{r=!0})},[e,t]),null}function $6e(){return E7(!0,15e3),null}let FX=-1;const mf=e=>{addEventListener("pageshow",(t=>{t.persisted&&(FX=t.timeStamp,e(t))}),!0)},cs=(e,t,r,n)=>{let i,o;return s=>{t.value>=0&&(s||n)&&(o=t.value-(i??0),(o||i===void 0)&&(i=t.value,t.delta=o,t.rating=((a,l)=>a>l[1]?"poor":a>l[0]?"needs-improvement":"good")(t.value,r),e(t)))}},j2=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},D2=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Tm=()=>{const e=D2();return(e==null?void 0:e.activationStart)??0},us=(e,t=-1)=>{const r=D2();let n="navigate";return FX>=0?n="back-forward-cache":r&&(document.prerendering||Tm()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},jE=new WeakMap;function L2(e,t){return jE.get(e)||jE.set(e,new t),jE.get(e)}class B6e{constructor(){_o(this,"t");_o(this,"i",0);_o(this,"o",[])}h(t){var i;if(t.hadRecentInput)return;const r=this.o[0],n=this.o.at(-1);this.i&&r&&n&&t.startTime-n.startTime<1e3&&t.startTime-r.startTime<5e3?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),(i=this.t)==null||i.call(this,t)}}const Pm=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const n=new PerformanceObserver((i=>{Promise.resolve().then((()=>{t(i.getEntries())}))}));return n.observe({type:e,buffered:!0,...r}),n}}catch{}},$2=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let Nu=-1;const zX=new Set,s6=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,AP=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(const t of zX)t();isFinite(Nu)||(Nu=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",AP,!0))}},Wb=()=>{var e;if(Nu<0){const t=Tm();Nu=(document.prerendering||(e=globalThis.performance.getEntriesByType("visibility-state").filter((n=>n.name==="hidden"&&n.startTime>t))[0])==null?void 0:e.startTime)??s6(),addEventListener("visibilitychange",AP,!0),addEventListener("prerenderingchange",AP,!0),mf((()=>{setTimeout((()=>{Nu=s6()}))}))}return{get firstHiddenTime(){return Nu},onHidden(t){zX.add(t)}}},Vb=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},a6=[1800,3e3],UX=(e,t={})=>{Vb((()=>{const r=Wb();let n,i=us("FCP");const o=Pm("paint",(s=>{for(const a of s)a.name==="first-contentful-paint"&&(o.disconnect(),a.startTime<r.firstHiddenTime&&(i.value=Math.max(a.startTime-Tm(),0),i.entries.push(a),n(!0)))}));o&&(n=cs(e,i,a6,t.reportAllChanges),mf((s=>{i=us("FCP"),n=cs(e,i,a6,t.reportAllChanges),j2((()=>{i.value=performance.now()-s.timeStamp,n(!0)}))})))}))},l6=[.1,.25],F6e=(e,t={})=>{const r=Wb();UX($2((()=>{let n,i=us("CLS",0);const o=L2(t,B6e),s=l=>{for(const c of l)o.h(c);o.i>i.value&&(i.value=o.i,i.entries=o.o,n())},a=Pm("layout-shift",s);a&&(n=cs(e,i,l6,t.reportAllChanges),r.onHidden((()=>{s(a.takeRecords()),n(!0)})),mf((()=>{o.i=0,i=us("CLS",0),n=cs(e,i,l6,t.reportAllChanges),j2((()=>n()))})),setTimeout(n))})))};let HX=0,DE=1/0,wv=0;const z6e=e=>{for(const t of e)t.interactionId&&(DE=Math.min(DE,t.interactionId),wv=Math.max(wv,t.interactionId),HX=wv?(wv-DE)/7+1:0)};let OP;const c6=()=>OP?HX:performance.interactionCount??0,U6e=()=>{"interactionCount"in performance||OP||(OP=Pm("event",z6e,{type:"event",buffered:!0,durationThreshold:0}))};let u6=0;class H6e{constructor(){_o(this,"u",[]);_o(this,"l",new Map);_o(this,"m");_o(this,"p")}v(){u6=c6(),this.u.length=0,this.l.clear()}L(){const t=Math.min(this.u.length-1,Math.floor((c6()-u6)/50));return this.u[t]}h(t){var i,o;if((i=this.m)==null||i.call(this,t),!t.interactionId&&t.entryType!=="first-input")return;const r=this.u.at(-1);let n=this.l.get(t.interactionId);if(n||this.u.length<10||t.duration>r.P){if(n?t.duration>n.P?(n.entries=[t],n.P=t.duration):t.duration===n.P&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],P:t.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((s,a)=>a.P-s.P)),this.u.length>10){const s=this.u.splice(10);for(const a of s)this.l.delete(a.id)}(o=this.p)==null||o.call(this,n)}}}const qX=e=>{const t=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?e():(e=$2(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})})))},d6=[200,500],q6e=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const r=Wb();Vb((()=>{U6e();let n,i=us("INP");const o=L2(t,H6e),s=l=>{qX((()=>{for(const d of l)o.h(d);const c=o.L();c&&c.P!==i.value&&(i.value=c.P,i.entries=c.entries,n())}))},a=Pm("event",s,{durationThreshold:t.durationThreshold??40});n=cs(e,i,d6,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),r.onHidden((()=>{s(a.takeRecords()),n(!0)})),mf((()=>{o.v(),i=us("INP"),n=cs(e,i,d6,t.reportAllChanges)})))}))};class W6e{constructor(){_o(this,"m")}h(t){var r;(r=this.m)==null||r.call(this,t)}}const f6=[2500,4e3],V6e=(e,t={})=>{Vb((()=>{const r=Wb();let n,i=us("LCP");const o=L2(t,W6e),s=l=>{t.reportAllChanges||(l=l.slice(-1));for(const c of l)o.h(c),c.startTime<r.firstHiddenTime&&(i.value=Math.max(c.startTime-Tm(),0),i.entries=[c],n())},a=Pm("largest-contentful-paint",s);if(a){n=cs(e,i,f6,t.reportAllChanges);const l=$2((()=>{s(a.takeRecords()),a.disconnect(),n(!0)})),c=d=>{d.isTrusted&&(qX(l),removeEventListener(d.type,c,{capture:!0}))};for(const d of["keydown","click","visibilitychange"])addEventListener(d,c,{capture:!0});mf((d=>{i=us("LCP"),n=cs(e,i,f6,t.reportAllChanges),j2((()=>{i.value=performance.now()-d.timeStamp,n(!0)}))}))}}))},h6=[800,1800],IP=e=>{document.prerendering?Vb((()=>IP(e))):document.readyState!=="complete"?addEventListener("load",(()=>IP(e)),!0):setTimeout(e)},G6e=(e,t={})=>{let r=us("TTFB"),n=cs(e,r,h6,t.reportAllChanges);IP((()=>{const i=D2();i&&(r.value=Math.max(i.responseStart-Tm(),0),r.entries=[i],n(!0),mf((()=>{r=us("TTFB",0),n=cs(e,r,h6,t.reportAllChanges),n(!0)})))}))},Eu={LCP:2500,INP:200,CLS:.1,FCP:1800,TTFB:600};function _h(e,t){switch(e){case"LCP":return t<=Eu.LCP;case"INP":return t<=Eu.INP;case"CLS":return t<=Eu.CLS;case"FCP":return t<=Eu.FCP;case"TTFB":return t<=Eu.TTFB;default:return!0}}function xh(e,t){const r=Eu[e];if(!r||t<=r)return"good";const n=r*1.25;return t<=n?"needs-improvement":"poor"}function K6e(e,t=!1){V6e(r=>{const n={...r,vitalsName:"LCP",isBad:!_h("LCP",r.value),rating:xh("LCP",r.value)};e(n)}),q6e(r=>{const n={...r,vitalsName:"INP",isBad:!_h("INP",r.value),rating:xh("INP",r.value)};e(n)}),F6e(r=>{const n={...r,vitalsName:"CLS",isBad:!_h("CLS",r.value),rating:xh("CLS",r.value)};e(n)}),t&&(UX(r=>{const n={...r,vitalsName:"FCP",isBad:!_h("FCP",r.value),rating:xh("FCP",r.value)};e(n)}),G6e(r=>{const n={...r,vitalsName:"TTFB",isBad:!_h("TTFB",r.value),rating:xh("TTFB",r.value)};e(n)}))}function X6e(){K6e(e=>{const t=e.isBad?"background: #ff6b6b; color: white; padding: 2px 6px; border-radius: 3px;":"background: #51cf66; color: white; padding: 2px 6px; border-radius: 3px;";console.log(`%c${e.vitalsName}%c ${e.value.toFixed(2)}ms (${e.rating})`,t,"background: none;")})}async function Z6e(){const e=document.getElementById("root");if(!e)throw new Error("Failed to find the root element");const t=await Uv(),r=await Jne(t);jQ.createRoot(e).render(w.jsx(O.StrictMode,{children:w.jsx(j6e,{locale:t,messages:r})})),X6e()}Z6e().catch(e=>{console.error("Failed to bootstrap application:",e)});export{ine as $,Yd as A,Vn as B,dd as C,bye as D,g8 as E,une as F,Qd as G,tze as H,A0 as I,Yre as J,Qa as K,Vh as L,b0 as M,Wn as N,Ne as O,FFe as P,Qze as Q,eA as R,rA as S,nA as T,bk as U,xM as V,ju as W,Di as X,ene as Y,Gh as Z,nze as _,RO as a,nm as a$,CM as a0,Hz as a1,Yj as a2,Fk as a3,iy as a4,o0e as a5,kne as a6,Ene as a7,tne as a8,Rt as a9,Y6e as aA,gY as aB,ke as aC,xae as aD,OU as aE,Gn as aF,Z as aG,Ei as aH,coe as aI,uoe as aJ,doe as aK,loe as aL,goe as aM,Ine as aN,poe as aO,es as aP,gk as aQ,one as aR,Rne as aS,moe as aT,dne as aU,bne as aV,ole as aW,lle as aX,pze as aY,ele as aZ,hze as a_,fr as aa,ji as ab,aoe as ac,tm as ad,vk as ae,Vx as af,foe as ag,hoe as ah,tV as ai,rV as aj,One as ak,Jae as al,EM as am,lne as an,Fz as ao,ea as ap,JCe as aq,yW as ar,eEe as as,xW as at,wW as au,qz as av,Gz as aw,QQ as ax,kN as ay,J6e as az,tA as b,qie as b$,Lye as b0,Bye as b1,li as b2,FU as b3,S0 as b4,zz as b5,bze as b6,Cne as b7,NP as b8,wc as b9,co as bA,ze as bB,os as bC,j0 as bD,CCe as bE,Bze as bF,Li as bG,I0 as bH,zH as bI,Cn as bJ,kc as bK,Uie as bL,Fie as bM,zie as bN,EO as bO,St as bP,dc as bQ,Tt as bR,sl as bS,$ie as bT,sze as bU,Die as bV,Lie as bW,Lt as bX,jie as bY,Vie as bZ,Gie as b_,BP as ba,$d as bb,Ize as bc,Nze as bd,Wz as be,PO as bf,jze as bg,Ud as bh,_ae as bi,Fn as bj,Qse as bk,Yse as bl,$H as bm,Mze as bn,Rze as bo,sb as bp,Ec as bq,Dze as br,rze as bs,Mie as bt,Co as bu,Nie as bv,jt as bw,Fze as bx,ct as by,No as bz,he as c,joe as c$,Wie as c0,Hie as c1,ize as c2,Xie as c3,Zie as c4,Qie as c5,Yie as c6,Jie as c7,Kie as c8,Eae as c9,Nne as cA,JP as cB,yne as cC,H9 as cD,kk as cE,uze as cF,dze as cG,fze as cH,xne as cI,rm as cJ,_ne as cK,hne as cL,Ev as cM,WFe as cN,Uz as cO,boe as cP,Tne as cQ,IU as cR,yoe as cS,_oe as cT,woe as cU,Soe as cV,Coe as cW,Eoe as cX,Aoe as cY,Ooe as cZ,Doe as c_,wae as ca,Sae as cb,Cae as cc,eoe as cd,roe as ce,soe as cf,toe as cg,noe as ch,ioe as ci,ooe as cj,ane as ck,lq as cl,jq as cm,$z as cn,Aie as co,Go as cp,oie as cq,IM as cr,wk as cs,Zz as ct,Qz as cu,eie as cv,RM as cw,aze as cx,y0 as cy,vne as cz,_ye as d,Gt as d$,x0 as d0,Toe as d1,Moe as d2,xoe as d3,MU as d4,Poe as d5,yk as d6,lse as d7,ose as d8,cse as d9,Hoe as dA,qoe as dB,Woe as dC,Koe as dD,Zoe as dE,tse as dF,Joe as dG,Loe as dH,Uoe as dI,Goe as dJ,Qoe as dK,DFe as dL,mse as dM,gse as dN,yse as dO,vse as dP,dse as dQ,fse as dR,hse as dS,pse as dT,Sye as dU,Sse as dV,Ay as dW,bp as dX,c4 as dY,sRe as dZ,ff as d_,sse as da,use as db,ise as dc,Roe as dd,Ioe as de,Noe as df,rse as dg,nse as dh,Tc as di,LU as dj,ase as dk,koe as dl,$U as dm,aA as dn,lA as dp,fne as dq,cne as dr,rne as ds,Xoe as dt,ese as du,Yoe as dv,zoe as dw,Boe as dx,$oe as dy,Foe as dz,Ze as e,Uke as e$,Xse as e0,Zse as e1,$ye as e2,zn as e3,dA as e4,Hze as e5,gze as e6,yze as e7,E7 as e8,yCe as e9,sV as eA,$le as eB,Eze as eC,Hd as eD,Lne as eE,cA as eF,zU as eG,UU as eH,Cze as eI,YM as eJ,xze as eK,mne as eL,Sze as eM,Qh as eN,_ze as eO,wze as eP,aV as eQ,yle as eR,Wze as eS,Kze as eT,Vze as eU,Gze as eV,Xze as eW,Tze as eX,kze as eY,Bl as eZ,xle as e_,vze as ea,mze as eb,Oh as ec,w0e as ed,Ake as ee,Ike as ef,gn as eg,En as eh,im as ei,hae as ej,pae as ek,mae as el,fae as em,gae as en,vae as eo,Vz as ep,Jre as eq,yae as er,bae as es,VW as et,GW as eu,Tk as ev,Ole as ew,fA as ex,Pze as ey,nc as ez,F9 as f,Jse as f$,_se as f0,xse as f1,bse as f2,wse as f3,Tse as f4,kse as f5,Pse as f6,Ase as f7,Nse as f8,Rse as f9,tp as fA,Nme as fB,Vd as fC,$ze as fD,lze as fE,oze as fF,Gke as fG,cV as fH,uV as fI,fV as fJ,Zze as fK,Mae as fL,Nae as fM,Z0 as fN,vO as fO,Rae as fP,Iae as fQ,nV as fR,eae as fS,rae as fT,iae as fU,oae as fV,uae as fW,dae as fX,cae as fY,Oae as fZ,Tae as f_,Dse as fa,jse as fb,Fse as fc,Bse as fd,Gse as fe,Kse as ff,Ese as fg,Ise as fh,$se as fi,Use as fj,Wse as fk,Vse as fl,Hse as fm,Cse as fn,Ose as fo,Mse as fp,Lse as fq,zse as fr,qse as fs,PA as ft,zze as fu,AA as fv,Uze as fw,hc as fx,Gd as fy,Kd as fz,Rv as g,tae as g0,nae as g1,sae as g2,aae as g3,lae as g4,kae as g5,Pae as g6,Aae as g7,G0e as g8,sy as g9,oe as ga,cze as gb,Lze as gc,$k as h,wM as i,w as j,Wh as k,to as l,Ds as m,Sc as n,_t as o,LH as p,Aze as q,O as r,_ie as s,Oze as t,$t as u,z9 as v,_0 as w,lm as x,Xd as y,Zd as z};
|
|
708
|
+
//# sourceMappingURL=index-dWT2M6Ef.js.map
|