maestro-flow 0.3.11 → 0.3.13
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/CLAUDE.md +7 -0
- package/.claude/agents/conceptual-planning-agent.md +1 -0
- package/.claude/agents/workflow-analyzer.md +113 -114
- package/.claude/agents/workflow-collab-planner.md +143 -144
- package/.claude/agents/workflow-debugger.md +101 -103
- package/.claude/agents/workflow-executor.md +127 -128
- package/.claude/agents/workflow-integration-checker.md +82 -82
- package/.claude/agents/workflow-nyquist-auditor.md +84 -84
- package/.claude/agents/workflow-phase-researcher.md +85 -85
- package/.claude/agents/workflow-plan-checker.md +90 -90
- package/.claude/agents/workflow-planner.md +177 -178
- package/.claude/agents/workflow-roadmapper.md +81 -83
- package/.claude/agents/workflow-verifier.md +118 -119
- package/.claude/commands/learn-retro.md +2 -2
- package/.claude/commands/learn-second-opinion.md +2 -2
- package/.claude/commands/maestro-analyze.md +10 -2
- package/.claude/commands/maestro-brainstorm.md +2 -1
- package/.claude/commands/maestro-execute.md +21 -4
- package/.claude/commands/maestro-fork.md +133 -111
- package/.claude/commands/maestro-merge.md +85 -77
- package/.claude/commands/maestro-milestone-complete.md +14 -0
- package/.claude/commands/maestro-plan.md +100 -8
- package/.claude/commands/maestro-roadmap.md +113 -2
- package/.claude/commands/maestro-ui-design.md +7 -7
- package/.claude/commands/maestro-update.md +176 -0
- package/.claude/commands/maestro-verify.md +18 -3
- package/.claude/commands/maestro.md +1 -0
- package/.claude/commands/manage-codebase-rebuild.md +0 -1
- package/.claude/commands/manage-harvest.md +1 -1
- package/.claude/commands/manage-learn.md +5 -5
- package/.claude/commands/manage-memory-capture.md +4 -4
- package/.claude/commands/manage-memory.md +1 -1
- package/.claude/commands/manage-wiki.md +62 -0
- package/.claude/commands/quality-business-test.md +5 -5
- package/.claude/commands/quality-debug.md +53 -6
- package/.claude/commands/quality-retrospective.md +9 -7
- package/.claude/commands/quality-review.md +39 -7
- package/.claude/commands/quality-sync.md +1 -1
- package/.claude/commands/quality-test-gen.md +5 -4
- package/.claude/commands/quality-test.md +45 -12
- package/.claude/commands/spec-remove.md +51 -0
- package/.claude/commands/spec-setup.md +1 -3
- package/.claude/commands/wiki-connect.md +9 -5
- package/.claude/commands/wiki-digest.md +6 -3
- package/.codex/skills/maestro/SKILL.md +2 -2
- package/.codex/skills/maestro-analyze/SKILL.md +4 -4
- package/.codex/skills/maestro-brainstorm/SKILL.md +4 -4
- package/.codex/skills/maestro-coordinate/SKILL.md +2 -2
- package/.codex/skills/maestro-execute/SKILL.md +15 -5
- package/.codex/skills/maestro-fork/SKILL.md +98 -68
- package/.codex/skills/maestro-init/SKILL.md +5 -4
- package/.codex/skills/maestro-merge/SKILL.md +69 -62
- package/.codex/skills/maestro-milestone-complete/SKILL.md +18 -1
- package/.codex/skills/maestro-plan/SKILL.md +6 -6
- package/.codex/skills/maestro-roadmap/SKILL.md +3 -4
- package/.codex/skills/maestro-spec-generate/SKILL.md +2 -2
- package/.codex/skills/maestro-ui-design/SKILL.md +6 -6
- package/.codex/skills/maestro-verify/SKILL.md +29 -20
- package/.codex/skills/manage-codebase-rebuild/SKILL.md +4 -4
- package/.codex/skills/manage-harvest/SKILL.md +10 -1
- package/.codex/skills/manage-issue-discover/SKILL.md +3 -3
- package/.codex/skills/manage-learn/SKILL.md +3 -2
- package/.codex/skills/manage-memory/SKILL.md +3 -3
- package/.codex/skills/manage-memory-capture/SKILL.md +8 -14
- package/.codex/skills/manage-status/SKILL.md +9 -4
- package/.codex/skills/manage-wiki/SKILL.md +55 -0
- package/.codex/skills/quality-business-test/SKILL.md +8 -6
- package/.codex/skills/quality-debug/SKILL.md +22 -9
- package/.codex/skills/quality-integration-test/SKILL.md +11 -7
- package/.codex/skills/quality-retrospective/SKILL.md +48 -29
- package/.codex/skills/quality-review/SKILL.md +10 -7
- package/.codex/skills/quality-test/SKILL.md +10 -5
- package/.codex/skills/quality-test-gen/SKILL.md +13 -9
- package/.codex/skills/spec-add/SKILL.md +11 -3
- package/.codex/skills/spec-load/SKILL.md +7 -0
- package/.codex/skills/spec-map/SKILL.md +2 -2
- package/.codex/skills/spec-remove/SKILL.md +101 -0
- package/.codex/skills/spec-setup/SKILL.md +4 -8
- package/.codex/skills/wiki-connect/SKILL.md +6 -5
- package/.codex/skills/wiki-digest/SKILL.md +2 -2
- package/README.md +2 -0
- package/README.zh-CN.md +2 -0
- package/dashboard/dist/assets/{ArtifactsPage-DZNCi6tn.js → ArtifactsPage-CUrrDGgN.js} +1 -1
- package/dashboard/dist/assets/ChatInput-pUOLJIKE.js +49 -0
- package/dashboard/dist/assets/ChatPage-B8Xqkt0v.js +27 -0
- package/dashboard/dist/assets/{CollabPage-B4NAHXS2.js → CollabPage-DIUXeazv.js} +1 -1
- package/dashboard/dist/assets/{ExecutionPanel-CFt4LJyq.js → ExecutionPanel-VmYeADFj.js} +1 -1
- package/dashboard/dist/assets/KanbanPage-DLq8v7hg.js +21 -0
- package/dashboard/dist/assets/{MarkdownRenderer-X4af_WNb.js → MarkdownRenderer-D7AehrnR.js} +1 -1
- package/dashboard/dist/assets/{McpPage-BKfCVIyU.js → McpPage-BY0SjTgw.js} +2 -2
- package/dashboard/dist/assets/{OutputPanel-BlBQFJSW.js → OutputPanel-B-Rjwgmv.js} +1 -1
- package/dashboard/dist/assets/{ProblemsPanel-De3DLvoI.js → ProblemsPanel-GEpF-oi4.js} +1 -1
- package/dashboard/dist/assets/RequirementBoardPage-xs8uDM7I.js +6 -0
- package/dashboard/dist/assets/{RequirementPage-Bllxe2XI.js → RequirementPage-BKDSFwjA.js} +5 -10
- package/dashboard/dist/assets/SpecsPage-DLFb9ZH0.js +36 -0
- package/dashboard/dist/assets/SupervisorPage-SOki_kgz.js +6 -0
- package/dashboard/dist/assets/TeamsPage-BO2kP70F.js +11 -0
- package/dashboard/dist/assets/{TreeBrowser-Q12qobZs.js → TreeBrowser-B9DHdULE.js} +1 -1
- package/dashboard/dist/assets/{WorkflowPage-D_Fzdy3_.js → WorkflowPage-C8hWbYim.js} +1 -1
- package/dashboard/dist/assets/{check-u6fGOwQO.js → check-DJDk3A2a.js} +1 -1
- package/dashboard/dist/assets/{chevron-right-Csu22t58.js → chevron-right-C7bVDreZ.js} +1 -1
- package/dashboard/dist/assets/{circle-CMrkbRNg.js → circle-Qfgy4LB_.js} +1 -1
- package/dashboard/dist/assets/{circle-alert-c3tH1P4z.js → circle-alert-Na1vf6qQ.js} +1 -1
- package/dashboard/dist/assets/{circle-check-gYxxSYuH.js → circle-check-CEGgy3NV.js} +1 -1
- package/dashboard/dist/assets/{circle-check-big-TDSeWstm.js → circle-check-big-3JB8zRYj.js} +1 -1
- package/dashboard/dist/assets/{code-CFN2uX9V.js → code-Ble63Idz.js} +1 -1
- package/dashboard/dist/assets/{columns-3-38xIDlzy.js → columns-3-BUcKlxve.js} +1 -1
- package/dashboard/dist/assets/{download-DC7KkKyP.js → download-CMqkfn8x.js} +1 -1
- package/dashboard/dist/assets/{folder-CWq_lAnf.js → folder-B9ewx9LL.js} +1 -1
- package/dashboard/dist/assets/index-C2Mcb4TJ.js +231 -0
- package/dashboard/dist/assets/index-DyBbPc18.css +1 -0
- package/dashboard/dist/assets/{index-Do71weNR.js → index-JTmGteaT.js} +1 -1
- package/dashboard/dist/assets/{list-CgIP_2A-.js → list-DI8Wn2aT.js} +1 -1
- package/dashboard/dist/assets/loader-B5F6PzFT.js +11 -0
- package/dashboard/dist/assets/{minus-DYoN5UGk.js → minus-Lp_BfctG.js} +1 -1
- package/dashboard/dist/assets/{pen-line-Bh_WKYHm.js → pen-line-Ch7sphzZ.js} +1 -1
- package/dashboard/dist/assets/pencil-_yRMHmGT.js +6 -0
- package/dashboard/dist/assets/{proxy-BKxDAKTj.js → proxy-D72Y8a4Y.js} +1 -1
- package/dashboard/dist/assets/{search-SieXnOgr.js → search-BS6fI6Bg.js} +1 -1
- package/dashboard/dist/assets/{shallow-Bme1JY57.js → shallow-BXasQBvr.js} +1 -1
- package/dashboard/dist/assets/table-CeGlFjlP.js +6 -0
- package/dashboard/dist/assets/{terminal-BB3Xfuv5.js → terminal-BJic2yW-.js} +1 -1
- package/dashboard/dist/assets/{trash-2-C8f4vFFM.js → trash-2-Czz4X8Fb.js} +1 -1
- package/dashboard/dist/assets/{zap-4uwlzVm0.js → zap-C3H0jVFA.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js +16 -1
- package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.d.ts +9 -0
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +109 -9
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.test.js +49 -0
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.test.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/delegate-broker-monitor.js +1 -2
- package/dashboard/dist-server/dashboard/src/server/agents/delegate-broker-monitor.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.d.ts +1 -1
- package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.js +2 -1
- package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/index.js +3 -0
- package/dashboard/dist-server/dashboard/src/server/index.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/collab.js +124 -0
- package/dashboard/dist-server/dashboard/src/server/routes/collab.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/index.js +5 -4
- package/dashboard/dist-server/dashboard/src/server/routes/index.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/specs.d.ts +5 -13
- package/dashboard/dist-server/dashboard/src/server/routes/specs.js +97 -155
- package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/wiki.d.ts +11 -1
- package/dashboard/dist-server/dashboard/src/server/routes/wiki.integration.test.js +27 -6
- package/dashboard/dist-server/dashboard/src/server/routes/wiki.integration.test.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/wiki.js +25 -7
- package/dashboard/dist-server/dashboard/src/server/routes/wiki.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js +8 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/search.js +1 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.d.ts +29 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js +148 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/spec-entry-parser.js.map +1 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js +4 -2
- package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +8 -2
- package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +5 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +80 -38
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js +8 -6
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-types.d.ts +40 -5
- package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js +21 -23
- package/dashboard/dist-server/dashboard/src/server/wiki/writer-stress.test.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/writer.d.ts +33 -3
- package/dashboard/dist-server/dashboard/src/server/wiki/writer.js +184 -12
- package/dashboard/dist-server/dashboard/src/server/wiki/writer.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.d.ts +10 -0
- package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.js +73 -0
- package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.js.map +1 -0
- package/dashboard/dist-server/dashboard/src/shared/collab-types.d.ts +31 -0
- package/dashboard/dist-server/dashboard/src/shared/collab-types.js +28 -0
- package/dashboard/dist-server/dashboard/src/shared/collab-types.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/constants.js +5 -0
- package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/coordinate-types.d.ts +22 -0
- package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +12 -0
- package/dashboard/dist-server/dashboard/src/shared/issue-types.js +12 -0
- package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/team-types.d.ts +1 -0
- package/dashboard/dist-server/dashboard/src/shared/team-types.js +7 -0
- package/dashboard/dist-server/dashboard/src/shared/team-types.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/ws-protocol.d.ts +27 -1
- package/dashboard/dist-server/dashboard/src/shared/ws-protocol.js.map +1 -1
- package/dashboard/dist-server/shared/agent-types.d.ts +4 -0
- package/dashboard/dist-server/src/commands/delegate.js +26 -0
- package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
- package/dashboard/dist-server/src/coordinator/graph-types.d.ts +11 -1
- package/dashboard/dist-server/src/coordinator/graph-walker.js +29 -2
- package/dashboard/dist-server/src/coordinator/graph-walker.js.map +1 -1
- package/dashboard/dist-server/src/coordinator/prompt-assembler.js +3 -2
- package/dashboard/dist-server/src/coordinator/prompt-assembler.js.map +1 -1
- package/dashboard/dist-server/src/hooks/constants.d.ts +29 -60
- package/dashboard/dist-server/src/hooks/constants.js +105 -82
- package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
- package/dashboard/dist-server/src/types/index.d.ts +2 -1
- package/dist/shared/agent-types.d.ts +4 -0
- package/dist/shared/agent-types.d.ts.map +1 -1
- package/dist/src/commands/delegate.d.ts.map +1 -1
- package/dist/src/commands/delegate.js +26 -0
- package/dist/src/commands/delegate.js.map +1 -1
- package/dist/src/commands/hooks.d.ts +2 -4
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +4 -7
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/install-backend.d.ts.map +1 -1
- package/dist/src/commands/install-backend.js +29 -18
- package/dist/src/commands/install-backend.js.map +1 -1
- package/dist/src/commands/install-ui/InstallConfirm.d.ts +2 -3
- package/dist/src/commands/install-ui/InstallConfirm.d.ts.map +1 -1
- package/dist/src/commands/install-ui/InstallConfirm.js +1 -1
- package/dist/src/commands/install-ui/InstallConfirm.js.map +1 -1
- package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
- package/dist/src/commands/install-ui/InstallExecution.js +1 -2
- package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
- package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
- package/dist/src/commands/install-ui/InstallFlow.js +5 -7
- package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
- package/dist/src/commands/install-ui/StatuslineConfig.d.ts +3 -6
- package/dist/src/commands/install-ui/StatuslineConfig.d.ts.map +1 -1
- package/dist/src/commands/install-ui/StatuslineConfig.js +21 -17
- package/dist/src/commands/install-ui/StatuslineConfig.js.map +1 -1
- package/dist/src/commands/update.d.ts.map +1 -1
- package/dist/src/commands/update.js +95 -0
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/wiki.d.ts.map +1 -1
- package/dist/src/commands/wiki.js +75 -11
- package/dist/src/commands/wiki.js.map +1 -1
- package/dist/src/coordinator/graph-types.d.ts +11 -1
- package/dist/src/coordinator/graph-types.d.ts.map +1 -1
- package/dist/src/coordinator/graph-walker.d.ts.map +1 -1
- package/dist/src/coordinator/graph-walker.js +29 -2
- package/dist/src/coordinator/graph-walker.js.map +1 -1
- package/dist/src/coordinator/prompt-assembler.d.ts.map +1 -1
- package/dist/src/coordinator/prompt-assembler.js +3 -2
- package/dist/src/coordinator/prompt-assembler.js.map +1 -1
- package/dist/src/hooks/__tests__/statusline-visual-test.d.ts +4 -1
- package/dist/src/hooks/__tests__/statusline-visual-test.d.ts.map +1 -1
- package/dist/src/hooks/__tests__/statusline-visual-test.js +55 -152
- package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -1
- package/dist/src/hooks/constants.d.ts +29 -60
- package/dist/src/hooks/constants.d.ts.map +1 -1
- package/dist/src/hooks/constants.js +105 -82
- package/dist/src/hooks/constants.js.map +1 -1
- package/dist/src/hooks/skill-context.d.ts +3 -0
- package/dist/src/hooks/skill-context.d.ts.map +1 -1
- package/dist/src/hooks/skill-context.js +149 -15
- package/dist/src/hooks/skill-context.js.map +1 -1
- package/dist/src/hooks/statusline.d.ts +11 -8
- package/dist/src/hooks/statusline.d.ts.map +1 -1
- package/dist/src/hooks/statusline.js +284 -179
- package/dist/src/hooks/statusline.js.map +1 -1
- package/dist/src/hooks/workspace.d.ts.map +1 -1
- package/dist/src/hooks/workspace.js +2 -1
- package/dist/src/hooks/workspace.js.map +1 -1
- package/dist/src/migrations/_template.d.ts +12 -0
- package/dist/src/migrations/_template.d.ts.map +1 -0
- package/dist/src/migrations/_template.js +55 -0
- package/dist/src/migrations/_template.js.map +1 -0
- package/dist/src/migrations/index.d.ts +14 -0
- package/dist/src/migrations/index.d.ts.map +1 -0
- package/dist/src/migrations/index.js +20 -0
- package/dist/src/migrations/index.js.map +1 -0
- package/dist/src/migrations/run.d.ts +12 -0
- package/dist/src/migrations/run.d.ts.map +1 -0
- package/dist/src/migrations/run.js +119 -0
- package/dist/src/migrations/run.js.map +1 -0
- package/dist/src/migrations/v1-to-v2.d.ts +10 -0
- package/dist/src/migrations/v1-to-v2.d.ts.map +1 -0
- package/dist/src/migrations/v1-to-v2.js +71 -0
- package/dist/src/migrations/v1-to-v2.js.map +1 -0
- package/dist/src/tools/merge-validator.d.ts.map +1 -1
- package/dist/src/tools/merge-validator.js +114 -16
- package/dist/src/tools/merge-validator.js.map +1 -1
- package/dist/src/tools/team-activity.d.ts.map +1 -1
- package/dist/src/tools/team-activity.js +22 -0
- package/dist/src/tools/team-activity.js.map +1 -1
- package/dist/src/tools/transition-recorder.d.ts +2 -17
- package/dist/src/tools/transition-recorder.d.ts.map +1 -1
- package/dist/src/tools/transition-recorder.js +6 -3
- package/dist/src/tools/transition-recorder.js.map +1 -1
- package/dist/src/types/index.d.ts +2 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/utils/migration-registry.d.ts +65 -0
- package/dist/src/utils/migration-registry.d.ts.map +1 -0
- package/dist/src/utils/migration-registry.js +117 -0
- package/dist/src/utils/migration-registry.js.map +1 -0
- package/dist/src/utils/state-schema.d.ts +153 -0
- package/dist/src/utils/state-schema.d.ts.map +1 -0
- package/dist/src/utils/state-schema.js +329 -0
- package/dist/src/utils/state-schema.js.map +1 -0
- package/package.json +1 -1
- package/shared/agent-types.ts +4 -0
- package/templates/state.json +17 -39
- package/templates/worktree-scope.json +9 -10
- package/templates/worktrees.json +26 -27
- package/workflows/brainstorm.md +10 -1
- package/workflows/codebase-rebuild.md +2 -12
- package/workflows/debug.md +17 -8
- package/workflows/execute.md +18 -4
- package/workflows/fork.md +52 -37
- package/workflows/init.md +1 -4
- package/workflows/integration-test.md +13 -2
- package/workflows/issue.md +8 -4
- package/workflows/learn.md +25 -10
- package/workflows/maestro.codex.md +8 -1
- package/workflows/maestro.md +13 -3
- package/workflows/memory.md +26 -71
- package/workflows/merge.md +48 -52
- package/workflows/milestone-complete.md +24 -7
- package/workflows/retrospective.md +87 -80
- package/workflows/review.md +11 -5
- package/workflows/specs-remove.md +115 -0
- package/workflows/specs-setup.md +10 -32
- package/workflows/status.md +291 -290
- package/workflows/sync.md +5 -5
- package/workflows/test.md +11 -2
- package/workflows/ui-style.md +8 -2
- package/workflows/verify.md +2 -2
- package/workflows/wiki-connect.md +188 -0
- package/workflows/wiki-digest.md +221 -0
- package/workflows/wiki-manage.md +204 -0
- package/dashboard/dist/assets/ChatInput-Bvr-FeEq.js +0 -49
- package/dashboard/dist/assets/ChatPage-D9zTkJZo.js +0 -22
- package/dashboard/dist/assets/KanbanPage-C8USth6H.js +0 -21
- package/dashboard/dist/assets/RequirementBoardPage-Bf1trzqs.js +0 -11
- package/dashboard/dist/assets/SpecsPage-9lwxKT27.js +0 -36
- package/dashboard/dist/assets/SupervisorPage-SusdfHFq.js +0 -6
- package/dashboard/dist/assets/TeamsPage-DsuM6OwC.js +0 -6
- package/dashboard/dist/assets/arrow-left-Bqtb2hle.js +0 -6
- package/dashboard/dist/assets/index-DWG-WrzT.js +0 -231
- package/dashboard/dist/assets/index-GUNJodSR.css +0 -1
- package/dashboard/dist/assets/table-llyEtj-7.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as K,o as ge,
|
|
1
|
+
import{d as K,o as ge,a7 as E,j as e,r as y,X as ve,a8 as Q,a5 as se,R as ye,P as je,O as Ne,f as we,T as Ce,h as ke,i as B,V as Me,n as Le}from"./index-C2Mcb4TJ.js";import{L as Oe}from"./list-DI8Wn2aT.js";import{T as oe}from"./terminal-BJic2yW-.js";import{S as ae}from"./search-BS6fI6Bg.js";import{T as Se}from"./trash-2-Czz4X8Fb.js";import{C as Ee}from"./chevron-right-C7bVDreZ.js";import{F as Ae,a as De,D as Ie}from"./folder-B9ewx9LL.js";import{D as Te}from"./download-CMqkfn8x.js";import{m as M}from"./proxy-D72Y8a4Y.js";import{P as Pe}from"./pen-line-Ch7sphzZ.js";import{A as Be}from"./index-JTmGteaT.js";import{C as We}from"./check-DJDk3A2a.js";import{C as Re}from"./code-Ble63Idz.js";import{M as _e}from"./minus-Lp_BfctG.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -18,4 +18,4 @@ import{d as K,o as ge,H as E,j as e,r as y,X as ve,J as Q,D as se,R as ye,P as j
|
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Je=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],He=K("wrench",Je);function Ye(t,o,r){return t==="project"&&r?`project:${o}@${r}`:`${t}:${o}`}function Ue(t){const o=[],r=t.globalServers??{},n=t.projects??{},a=t.enterpriseServers??{},i=t.codex;for(const[d,m]of Object.entries(r))o.push(H(d,m,"global"));for(const[d,m]of Object.entries(n)){const b=m.mcpServers??{},l=m.disabledMcpServers??[];for(const[x,p]of Object.entries(b))o.push({...H(x,p,"project",d),enabled:!l.includes(x)})}for(const[d,m]of Object.entries(a))o.push({...H(d,m,"enterprise"),enabled:!0});if(i!=null&&i.servers)for(const[d,m]of Object.entries(i.servers)){const b=o.find(l=>l.name===d&&l.scope==="global");b?b.cli.codex=!0:o.push({...H(d,m,"codex"),cli:{claude:!1,codex:!0}})}return o}function H(t,o,r,n){const a=typeof o.url=="string";return{id:Ye(r,t,n),name:t,scope:r,projectPath:n,enabled:o.enabled!==!1,transport:a?"http":"stdio",command:typeof o.command=="string"?o.command:void 0,args:Array.isArray(o.args)?o.args:void 0,url:a?o.url:void 0,env:typeof o.env=="object"&&o.env!==null?o.env:void 0,cli:{claude:r!=="codex",codex:r==="codex"},raw:o}}const f=ge((t,o)=>({servers:[],templates:[],categories:[],loading:!1,error:null,activeView:"list",scopeFilter:"all",search:"",selectedServer:null,templateSearch:"",templateCategory:null,editingServer:null,setActiveView:r=>t({activeView:r}),setScopeFilter:r=>t({scopeFilter:r}),setSearch:r=>t({search:r}),setSelectedServer:r=>t({selectedServer:r}),setTemplateSearch:r=>t({templateSearch:r}),setTemplateCategory:r=>t({templateCategory:r}),setEditingServer:r=>t({editingServer:r}),fetchConfig:async()=>{t({loading:!0,error:null});try{const r=await fetch(E.CONFIG);if(!r.ok)throw new Error(`Failed: ${r.status}`);const n=await r.json();t({servers:Ue(n),loading:!1})}catch(r){t({loading:!1,error:String(r)})}},fetchTemplates:async()=>{try{const[r,n]=await Promise.all([fetch(E.TEMPLATES),fetch(E.TEMPLATES_CATEGORIES)]);if(!r.ok||!n.ok)return;const a=await r.json(),i=await n.json();t({templates:a.templates??[],categories:i.categories??[]})}catch{}},toggleServer:async(r,n,a)=>{t(i=>({servers:i.servers.map(d=>d.name===n?{...d,enabled:a}:d)}));try{await fetch(E.TOGGLE,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r,serverName:n,enable:a})})}catch{o().fetchConfig()}},removeServer:async(r,n)=>{const a=o().servers;t(i=>({servers:i.servers.filter(d=>d.name!==n)}));try{(await fetch(E.REMOVE_SERVER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r,serverName:n})})).ok||t({servers:a})}catch{t({servers:a})}},addGlobalServer:async(r,n)=>{try{await fetch(E.ADD_GLOBAL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverName:r,serverConfig:n})}),o().fetchConfig()}catch{}},removeGlobalServer:async r=>{const n=o().servers;t(a=>({servers:a.servers.filter(i=>i.name!==r)}));try{(await fetch(E.REMOVE_GLOBAL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverName:r})})).ok||t({servers:n})}catch{t({servers:n})}},updateServer:async(r,n)=>{try{await fetch(E.UPDATE_SERVER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:r.scope,serverName:r.name,serverConfig:n,projectPath:r.projectPath})}),t({editingServer:null}),o().fetchConfig()}catch{}},installTemplate:async(r,n,a)=>{try{await fetch(E.TEMPLATES_INSTALL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateName:r,projectPath:n,scope:a})}),o().fetchConfig()}catch{}},filteredServers:()=>{const{servers:r,scopeFilter:n,search:a}=o();let i=r;if(n!=="all"&&(i=i.filter(d=>d.scope===n)),a){const d=a.toLowerCase();i=i.filter(m=>{var b,l;return m.name.toLowerCase().includes(d)||(((b=m.command)==null?void 0:b.toLowerCase().includes(d))??!1)||(((l=m.url)==null?void 0:l.toLowerCase().includes(d))??!1)})}return i},filteredTemplates:()=>{const{templates:r,templateSearch:n,templateCategory:a}=o();let i=r;if(a&&(i=i.filter(d=>d.category===a)),n){const d=n.toLowerCase();i=i.filter(m=>{var b;return m.name.toLowerCase().includes(d)||(((b=m.description)==null?void 0:b.toLowerCase().includes(d))??!1)})}return i},projectGroups:()=>{const{servers:r}=o(),n=new Map;for(const i of r){const d=i.projectPath??null,m=n.get(d)??[];m.push(i),n.set(d,m)}const a=[];for(const[i,d]of n)a.push({projectPath:i,servers:d});return a},selectedEntry:()=>{const{servers:r,selectedServer:n}=o();return n?r.find(a=>a.id===n)??null:null}}));function G({size:t=14,className:o,style:r}){return e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",className:o,style:r,children:e.jsx("path",{d:"M17.304 3.541l-5.15 16.918H9.29l5.15-16.918zm-9.757 10.3l-2.1 3.613H2.131l3.256-5.576zm2.74-7.354L6.41 13.49l-2.037-3.5L8.052 3.54z"})})}function V({size:t=14,className:o,style:r}){return e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",className:o,style:r,children:e.jsx("path",{d:"M22.282 9.821a5.985 5.985 0 0 0-.516-4.91 6.046 6.046 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.985 5.985 0 0 0-3.998 2.9 6.046 6.046 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.051 6.051 0 0 0 6.515 2.9A5.985 5.985 0 0 0 13.26 24a6.056 6.056 0 0 0 5.772-4.206 5.99 5.99 0 0 0 3.997-2.9 6.056 6.056 0 0 0-.747-7.073zM13.26 22.43a4.476 4.476 0 0 1-2.876-1.04l.14-.08 4.779-2.759a.795.795 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494zM3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.771.771 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646zM2.34 7.896a4.485 4.485 0 0 1 2.366-1.973V11.6a.766.766 0 0 0 .388.677l5.815 3.354-2.02 1.168a.076.076 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.124 7.2a.076.076 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.41-.676zm2.01-3.023l-.141-.085-4.774-2.782a.776.776 0 0 0-.785 0L9.409 9.23V6.897a.066.066 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zM8.307 12.863l-2.02-1.164a.08.08 0 0 1-.038-.057V6.074a4.5 4.5 0 0 1 7.375-3.453l-.14.08-4.779 2.758a.795.795 0 0 0-.393.681zm1.097-2.361l2.602-1.506 2.607 1.506v3.012l-2.602 1.506-2.607-1.506z"})})}const ne={global:{bg:"rgba(91,141,184,0.12)",text:"var(--color-accent-blue, #5B8DB8)"},project:{bg:"rgba(145,120,181,0.12)",text:"var(--color-status-planning, #9178B5)"},enterprise:{bg:"rgba(200,134,58,0.12)",text:"var(--color-status-verifying, #C8863A)"},codex:{bg:"rgba(90,158,120,0.12)",text:"var(--color-status-completed, #5A9E78)"}},le={stdio:{bg:"rgba(91,141,184,0.08)",text:"var(--color-accent-blue, #5B8DB8)"},http:{bg:"rgba(145,120,181,0.08)",text:"var(--color-status-planning, #9178B5)"}};function Xe({server:t,onClose:o}){var x;const r=f(p=>p.removeServer),n=f(p=>p.removeGlobalServer),a=f(p=>p.setEditingServer),i=y.useMemo(()=>t.env?Object.entries(t.env):[],[t.env]),d=y.useMemo(()=>JSON.stringify(t.raw,null,2),[t.raw]),m=ne[t.scope]??ne.global,b=le[t.transport]??le.stdio;function l(){t.scope==="global"?n(t.name):r(t.projectPath??"",t.name),o()}return e.jsxs(M.aside,{initial:{width:0,opacity:0},animate:{width:380,opacity:1},exit:{width:0,opacity:0},transition:{type:"spring",stiffness:400,damping:30},className:"shrink-0 border-l border-border bg-bg-card overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-[10px] px-[18px] py-[14px] border-b border-border-divider shrink-0",children:[e.jsx("div",{className:"w-9 h-9 rounded-[var(--radius-lg)] shrink-0 flex items-center justify-center",style:{background:b.bg,color:b.text},children:t.transport==="stdio"?e.jsx(oe,{size:18,strokeWidth:1.8}):e.jsx(q,{size:18,strokeWidth:1.8})}),e.jsx("span",{className:"text-[15px] font-bold text-text-primary flex-1 min-w-0 truncate",children:t.name}),e.jsx("button",{type:"button",onClick:o,"aria-label":"Close detail panel",className:"flex items-center justify-center w-7 h-7 rounded-[var(--radius-md)] text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors",children:e.jsx(ve,{size:14,strokeWidth:2})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-[18px] py-[16px]",style:{width:380},children:[e.jsxs(_,{label:"Info",children:[e.jsx(Y,{label:"Scope",children:e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase tracking-[0.03em] font-mono",style:{background:m.bg,color:m.text},children:t.scope})}),e.jsx(Y,{label:"Transport",children:e.jsx("span",{className:"text-[9px] font-semibold px-[7px] py-[2px] rounded-[4px] uppercase",style:{background:b.bg,color:b.text},children:t.transport})}),e.jsx(Y,{label:"Status",children:e.jsxs("span",{className:"text-[12px] font-semibold flex items-center gap-[4px]",style:{color:t.enabled?"var(--color-status-completed, #5A9E78)":"var(--color-text-tertiary)"},children:[e.jsx("span",{className:"w-[7px] h-[7px] rounded-full inline-block",style:{background:t.enabled?"var(--color-status-completed, #5A9E78)":"var(--color-text-tertiary)"}}),t.enabled?"Enabled":"Disabled"]})}),t.projectPath&&e.jsx(Y,{label:"Source",children:e.jsx("span",{className:"font-mono text-[11px] text-text-primary break-all",children:t.projectPath})})]}),e.jsxs(_,{label:"CLI Presence",children:[e.jsx(ie,{icon:e.jsx(G,{size:12}),label:"Claude Code",present:t.cli.claude,tintBg:"rgba(200,134,58,0.08)",tintColor:"var(--color-status-verifying, #C8863A)"}),e.jsx(ie,{icon:e.jsx(V,{size:12}),label:"Codex CLI",present:t.cli.codex,tintBg:"rgba(90,158,120,0.08)",tintColor:"var(--color-status-completed, #5A9E78)"})]}),e.jsx(_,{label:"Command",children:e.jsx("div",{className:"bg-bg-secondary border border-border-divider rounded-[var(--radius-lg)] px-3 py-[10px] font-mono text-[11px] text-text-primary leading-[1.7] whitespace-pre-wrap break-all",children:t.command?`${t.command}${(x=t.args)!=null&&x.length?" "+t.args.join(" "):""}`:t.url??"(no command)"})}),i.length>0&&e.jsx(_,{label:"Environment",children:e.jsx("div",{className:"bg-bg-secondary border border-border-divider rounded-[var(--radius-lg)] overflow-hidden",children:e.jsx("table",{className:"w-full border-collapse",children:e.jsx("tbody",{children:i.map(([p,s])=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-2 py-1 text-[11px] font-mono font-medium whitespace-nowrap border-b border-border-divider",style:{color:"var(--color-accent-blue, #5B8DB8)"},children:p}),e.jsx("td",{className:"px-2 py-1 text-[11px] font-mono text-text-secondary break-all border-b border-border-divider",children:s})]},p))})})})}),e.jsx(_,{label:"Raw Config",children:e.jsx("div",{className:"rounded-[var(--radius-lg)] px-3 py-[10px] font-mono text-[11px] leading-[1.7] whitespace-pre-wrap break-all",style:{background:"var(--color-code-bg, #2C2723)",color:"var(--color-code-text, #D9D0C4)",border:"1px solid var(--color-code-border, #3D3731)"},children:d})})]}),e.jsxs("div",{className:"flex gap-[6px] px-[18px] py-3 border-t border-border-divider shrink-0",children:[e.jsxs("button",{type:"button",onClick:()=>a(t),className:"flex-1 flex items-center justify-center gap-[4px] px-[10px] py-[5px] rounded-[var(--radius-md)] border border-border bg-bg-card text-[10px] font-semibold text-text-secondary hover:border-text-tertiary hover:text-text-primary transition-all",children:[e.jsx(Pe,{size:11,strokeWidth:2}),"Edit"]}),e.jsxs("button",{type:"button",onClick:l,className:"flex-1 flex items-center justify-center gap-[4px] px-[10px] py-[5px] rounded-[var(--radius-md)] border border-border bg-bg-card text-[10px] font-semibold text-status-failed hover:border-status-failed hover:bg-red-50 transition-all",children:[e.jsx(Se,{size:11,strokeWidth:2}),"Remove"]})]})]})}function _({label:t,children:o}){return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-[0.05em] text-text-tertiary mb-[6px]",children:t}),o]})}function Y({label:t,children:o}){return e.jsxs("div",{className:"flex items-center gap-2 py-[3px]",children:[e.jsx("span",{className:"text-[11px] font-semibold text-text-secondary min-w-[70px] shrink-0",children:t}),o]})}function ie({icon:t,label:o,present:r,tintBg:n,tintColor:a}){return e.jsxs("div",{className:"flex items-center gap-[10px] px-[10px] py-2 rounded-[var(--radius-md)] mb-1",style:{background:r?n:void 0},children:[e.jsx("div",{className:"w-6 h-[18px] rounded-[4px] flex items-center justify-center",style:{background:n,color:a},children:t}),e.jsx("span",{className:"text-[12px] font-semibold text-text-primary flex-1",children:o}),e.jsx("span",{className:"text-[10px] font-semibold",style:{color:r?"var(--color-status-completed, #5A9E78)":"var(--color-text-tertiary)"},children:r?"Installed":"Not found"})]})}const re=["write_file","edit_file","read_file","read_many_files","team_msg","core_memory"],u=ge((t,o)=>({open:!1,step:"mode",mode:"global",projectPath:"",detection:null,selectedComponents:new Set,backup:!0,mcpEnabled:!0,enabledTools:new Set(re),detecting:!1,installing:!1,result:null,error:null,manifests:[],setOpen:r=>{t(r?{open:r,step:"mode",result:null,error:null,detection:null}:{open:r})},setStep:r=>t({step:r}),setMode:r=>t({mode:r}),setProjectPath:r=>t({projectPath:r}),toggleComponent:r=>t(n=>{const a=new Set(n.selectedComponents);return a.has(r)?a.delete(r):a.add(r),{selectedComponents:a}}),selectAllComponents:()=>t(r=>{if(!r.detection)return{};const n=r.detection.components.filter(a=>a.available).map(a=>a.id);return r.selectedComponents.has("mcp")&&n.push("mcp"),{selectedComponents:new Set(n)}}),setBackup:r=>t({backup:r}),setMcpEnabled:r=>t({mcpEnabled:r}),toggleTool:r=>t(n=>{const a=new Set(n.enabledTools);return a.has(r)?a.delete(r):a.add(r),{enabledTools:a}}),detect:async()=>{const{mode:r,projectPath:n}=o();t({detecting:!0,error:null});try{const a=await fetch(Q.DETECT,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:r,projectPath:r==="project"?n:void 0})}),i=await a.json();if(!a.ok)throw new Error(i.error??`HTTP ${a.status}`);const d=i,m=d.components.filter(b=>b.available).map(b=>b.id);m.push("mcp"),t({detecting:!1,detection:d,selectedComponents:new Set(m),step:"configure"})}catch(a){t({detecting:!1,error:String(a)})}},install:async()=>{const{mode:r,projectPath:n,selectedComponents:a,backup:i,mcpEnabled:d,enabledTools:m}=o();t({installing:!0,error:null,step:"progress"});try{const l=await(await fetch(Q.EXECUTE,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:r,projectPath:r==="project"?n:void 0,components:Array.from(a),backup:i,mcpConfig:d&&a.has("mcp")?{enabled:!0,enabledTools:Array.from(m)}:void 0})})).json();t({installing:!1,result:l})}catch(b){t({installing:!1,result:{success:!1,filesInstalled:0,dirsCreated:0,manifestPath:"",disabledItemsRestored:0,mcpRegistered:!1,components:[],error:String(b)}})}},fetchManifests:async()=>{try{const r=await fetch(Q.MANIFESTS);if(!r.ok)return;const n=await r.json();t({manifests:n.manifests??[]})}catch{}},reset:()=>t({step:"mode",mode:"global",projectPath:"",detection:null,selectedComponents:new Set,backup:!0,mcpEnabled:!0,enabledTools:new Set(re),detecting:!1,installing:!1,result:null,error:null})}));function Ke(t){const o=t.includes("/")?"/":t.includes("\\")?"\\":"/",r=t.endsWith(o)?t.slice(0,-1):t,n=r.lastIndexOf(o);return n>=0?r.slice(n+1):r}const qe=[{id:"all",label:"All"},{id:"global",label:"Global",color:"var(--color-accent-blue, #5B8DB8)"},{id:"project",label:"Project",color:"var(--color-status-planning, #9178B5)"},{id:"enterprise",label:"Enterprise",color:"var(--color-status-verifying, #C8863A)"}],ce={global:{bg:"rgba(91,141,184,0.12)",text:"var(--color-accent-blue, #5B8DB8)"},project:{bg:"rgba(145,120,181,0.12)",text:"var(--color-status-planning, #9178B5)"},enterprise:{bg:"rgba(200,134,58,0.12)",text:"var(--color-status-verifying, #C8863A)"},codex:{bg:"rgba(90,158,120,0.12)",text:"var(--color-status-completed, #5A9E78)"}};function Qe(){const t=f(c=>c.servers),o=f(c=>c.scopeFilter),r=f(c=>c.search),n=y.useMemo(()=>{let c=t;if(o!=="all"&&(c=c.filter(C=>C.scope===o)),r){const C=r.toLowerCase();c=c.filter(z=>{var O,T;return z.name.toLowerCase().includes(C)||(((O=z.command)==null?void 0:O.toLowerCase().includes(C))??!1)||(((T=z.url)==null?void 0:T.toLowerCase().includes(C))??!1)})}return c},[t,o,r]),a=f(c=>c.selectedServer),i=f(c=>c.setScopeFilter),d=f(c=>c.setSearch),m=f(c=>c.setSelectedServer),b=f(c=>c.toggleServer),l=f(c=>c.removeServer),x=f(c=>c.removeGlobalServer),p=f(c=>c.setEditingServer),s=u(c=>c.setOpen),h=t.filter(c=>c.enabled).length,w=t.filter(c=>c.scope==="global").length,k=t.filter(c=>c.scope==="project").length,S=t.filter(c=>c.scope==="enterprise").length,A=t.filter(c=>c.transport==="stdio").length,L=t.filter(c=>c.transport==="http").length,$={all:t.length,global:w,project:k,enterprise:S},W=a?t.find(c=>c.id===a)??null:null;function g(c){b(c.projectPath??"",c.name,!c.enabled)}function j(c){c.scope==="global"?x(c.name):l(c.projectPath??"",c.name)}function N(c){p(c)}return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center gap-5 px-5 py-2 border-b border-border-divider bg-bg-primary shrink-0",children:[e.jsx(U,{color:"var(--color-status-completed, #5A9E78)",value:h,label:"Active"}),e.jsx(U,{color:"var(--color-accent-blue, #5B8DB8)",value:w,label:"Global"}),e.jsx(U,{color:"var(--color-status-planning, #9178B5)",value:k,label:"Project"}),e.jsx(U,{color:"var(--color-status-verifying, #C8863A)",value:S,label:"Enterprise"})]}),e.jsxs("div",{className:"flex items-center gap-[10px] px-5 py-2 border-b border-border-divider shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-[6px] px-3 py-[6px] rounded-[var(--radius-lg)] bg-bg-card border border-border w-[260px] focus-within:border-[var(--color-status-planning,#9178B5)] transition-colors",children:[e.jsx(ae,{size:13,strokeWidth:2,className:"text-text-tertiary shrink-0"}),e.jsx("input",{type:"text",placeholder:"Search servers...",value:r,onChange:c=>d(c.target.value),className:"border-none bg-transparent outline-none text-[12px] text-text-primary w-full placeholder:text-text-tertiary"})]}),e.jsx("div",{className:"flex gap-[6px]",children:qe.map(c=>{const C=o===c.id;return e.jsxs("button",{type:"button",onClick:()=>i(c.id),className:["flex items-center gap-1 px-[10px] py-1 rounded-full border text-[10px] font-semibold whitespace-nowrap transition-all cursor-pointer",C?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-tertiary border-border hover:border-text-tertiary hover:text-text-secondary"].join(" "),children:[c.color&&!C&&e.jsx("span",{className:"w-[6px] h-[6px] rounded-full",style:{background:c.color}}),c.label,e.jsx("span",{className:"font-mono text-[9px] opacity-60",children:$[c.id]})]},c.id)})}),e.jsx("div",{className:"w-px h-[18px] bg-border-divider"}),e.jsx("div",{className:"flex gap-[6px]",children:["stdio","http"].map(c=>e.jsxs("button",{type:"button",className:"flex items-center gap-1 px-[10px] py-1 rounded-full border border-border bg-bg-card text-[10px] font-semibold text-text-tertiary hover:border-text-tertiary hover:text-text-secondary transition-all cursor-pointer whitespace-nowrap",children:[c.toUpperCase(),e.jsx("span",{className:"font-mono text-[9px] opacity-60",children:c==="stdio"?A:L})]},c))}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button",onClick:()=>s(!0),className:"flex items-center gap-[6px] px-[14px] py-[6px] rounded-[var(--radius-lg)] border border-border bg-bg-card text-[11px] font-semibold text-text-secondary cursor-pointer transition-all hover:border-text-tertiary hover:text-text-primary whitespace-nowrap",children:[e.jsx(Te,{size:13,strokeWidth:2}),"Install Wizard"]}),e.jsxs("button",{type:"button",className:"flex items-center gap-[6px] px-[14px] py-[6px] rounded-[var(--radius-lg)] border-none bg-text-primary text-white text-[11px] font-semibold cursor-pointer transition-all hover:-translate-y-px hover:shadow-md whitespace-nowrap",children:[e.jsx(se,{size:13,strokeWidth:2}),"Add Server"]})]}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("div",{className:"flex-1 overflow-y-auto min-w-0",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap w-[36px]"}),e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap",children:"Name"}),e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap",children:"Command / URL"}),e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap",children:"Scope"}),e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap",children:"CLI"}),e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap w-[50px]",children:"On"}),e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap w-[140px]"})]})}),e.jsx("tbody",{children:(()=>{if(!(o==="all"||o==="project"))return n.map(v=>e.jsx(Z,{server:v,selected:a===v.id,onSelect:()=>m(a===v.id?null:v.id),onToggle:()=>g(v),onEdit:()=>N(v),onRemove:()=>j(v)},v.id));const C=n.filter(v=>v.scope==="project"),z=n.filter(v=>v.scope!=="project"),O=new Map;for(const v of C){const R=v.projectPath??"",J=O.get(R)??[];J.push(v),O.set(R,J)}const T=[];for(const v of z)T.push(e.jsx(Z,{server:v,selected:a===v.id,onSelect:()=>m(a===v.id?null:v.id),onToggle:()=>g(v),onEdit:()=>N(v),onRemove:()=>j(v)},v.id));for(const[v,R]of O){const J=Ke(v);T.push(e.jsx(Ze,{folderName:J,fullPath:v,count:R.length},`group:${v}`));for(const P of R)T.push(e.jsx(Z,{server:P,selected:a===P.id,onSelect:()=>m(a===P.id?null:P.id),onToggle:()=>g(P),onEdit:()=>N(P),onRemove:()=>j(P)},P.id))}return T.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"text-center py-8 text-text-tertiary text-[length:var(--font-size-sm)]",children:"No servers found"})}):T})()})]})}),e.jsx(Be,{children:W&&e.jsx(Xe,{server:W,onClose:()=>m(null)})})]})]})}function U({color:t,value:o,label:r}){return e.jsxs("div",{className:"flex items-center gap-[6px]",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:t}}),e.jsx("span",{className:"text-[16px] font-extrabold text-text-primary font-mono",children:o}),e.jsx("span",{className:"text-[10px] font-semibold text-text-tertiary uppercase tracking-[0.04em]",children:r})]})}function Ze({folderName:t,fullPath:o,count:r}){return e.jsx("tr",{className:"group-header-row",children:e.jsx("td",{colSpan:7,className:"px-[14px] py-[6px] bg-[rgba(145,120,181,0.04)] border-b border-border-divider",children:e.jsxs("div",{className:"flex items-center gap-[8px]",children:[e.jsx(Ae,{size:13,strokeWidth:1.8,style:{color:"var(--color-status-planning, #9178B5)",opacity:.7}}),e.jsx("span",{className:"text-[11px] font-bold text-text-secondary",title:o,children:t}),e.jsx("span",{className:"text-[9px] font-mono text-text-tertiary opacity-60",children:r})]})})})}function Z({server:t,selected:o,onSelect:r,onToggle:n,onEdit:a,onRemove:i}){var x;const d=ce[t.scope]??ce.global,m=t.command?`${t.command}${(x=t.args)!=null&&x.length?" "+t.args.join(" "):""}`:t.url??"",b=!t.cli.claude&&t.cli.codex,l=t.cli.claude&&!t.cli.codex;return e.jsxs("tr",{onClick:r,className:["cursor-pointer transition-colors group",o?"[&>td]:bg-[rgba(145,120,181,0.07)]":"hover:[&>td]:bg-bg-hover"].join(" "),children:[e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle",children:e.jsx("div",{className:"w-7 h-7 rounded-[var(--radius-md)] shrink-0 flex items-center justify-center",style:{background:t.transport==="stdio"?"rgba(91,141,184,0.08)":"rgba(145,120,181,0.08)",color:t.transport==="stdio"?"var(--color-accent-blue, #5B8DB8)":"var(--color-status-planning, #9178B5)"},children:t.transport==="stdio"?e.jsx(oe,{size:14,strokeWidth:1.8}):e.jsx(q,{size:14,strokeWidth:1.8})})}),e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle",children:e.jsx("span",{className:"text-[12px] font-semibold text-text-primary",children:t.name})}),e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle",children:e.jsx("span",{className:"font-mono text-[11px] text-text-tertiary max-w-[280px] whitespace-nowrap overflow-hidden text-ellipsis block",children:m})}),e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle whitespace-nowrap",children:e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase tracking-[0.03em] font-mono",style:{background:d.bg,color:d.text},children:t.scope})}),e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle",children:e.jsxs("div",{className:"flex gap-[3px]",children:[e.jsx("span",{className:["w-5 h-4 rounded-[3px] flex items-center justify-center",t.cli.claude?"":"opacity-25"].join(" "),style:{background:"rgba(200,134,58,0.08)",color:"var(--color-status-verifying, #C8863A)"},title:"Claude Code",children:e.jsx(G,{size:11})}),e.jsx("span",{className:["w-5 h-4 rounded-[3px] flex items-center justify-center",t.cli.codex?"":"opacity-25"].join(" "),style:{background:"rgba(90,158,120,0.08)",color:"var(--color-status-completed, #5A9E78)"},title:"Codex CLI",children:e.jsx(V,{size:11})})]})}),e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle text-center",children:e.jsxs("label",{className:"relative inline-block w-8 h-[18px] cursor-pointer",onClick:p=>p.stopPropagation(),children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:n,disabled:t.scope==="enterprise",className:"sr-only peer"}),e.jsx("div",{className:["w-8 h-[18px] rounded-full transition-colors duration-200",t.scope==="enterprise"?"opacity-50 cursor-default":""].join(" "),style:{background:t.enabled?"var(--color-status-completed, #5A9E78)":"var(--color-border, #E8E5DE)"},children:e.jsx("div",{className:"absolute top-[2px] left-[2px] w-[14px] h-[14px] rounded-full bg-white shadow-sm transition-transform duration-200",style:{transform:t.enabled?"translateX(14px)":"translateX(0)"}})})]})}),e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle",children:e.jsxs("div",{className:"flex gap-1 items-center opacity-0 group-hover:opacity-100 transition-opacity",onClick:p=>p.stopPropagation(),children:[(l||b)&&e.jsx("button",{type:"button",className:"flex items-center gap-[3px] px-2 py-1 rounded-[5px] border border-border bg-bg-card text-text-tertiary hover:border-[var(--color-accent-blue,#5B8DB8)] hover:text-[var(--color-accent-blue,#5B8DB8)] hover:bg-[rgba(91,141,184,0.04)] transition-all whitespace-nowrap",title:l?"Copy to Codex":"Copy to Claude",children:l?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{size:10,strokeWidth:2.5}),e.jsx("span",{className:"w-[14px] h-[11px] rounded-[2px] flex items-center justify-center",style:{background:"rgba(90,158,120,0.08)",color:"var(--color-status-completed, #5A9E78)"},children:e.jsx(V,{size:9})})]}):e.jsxs(e.Fragment,{children:[e.jsx(ze,{size:10,strokeWidth:2.5}),e.jsx("span",{className:"w-[14px] h-[11px] rounded-[2px] flex items-center justify-center",style:{background:"rgba(200,134,58,0.08)",color:"var(--color-status-verifying, #C8863A)"},children:e.jsx(G,{size:9})})]})}),e.jsx("button",{type:"button",onClick:a,className:"flex items-center gap-1 px-[10px] py-[5px] rounded-[var(--radius-md)] border border-border bg-bg-card text-[10px] font-semibold text-text-secondary hover:border-text-tertiary hover:text-text-primary transition-all",children:e.jsx(Pe,{size:11,strokeWidth:2})}),t.scope!=="enterprise"&&e.jsx("button",{type:"button",onClick:i,className:"flex items-center gap-1 px-[10px] py-[5px] rounded-[var(--radius-md)] border border-border bg-bg-card text-[10px] font-semibold text-status-failed hover:border-status-failed hover:bg-red-50 transition-all",children:e.jsx(Se,{size:11,strokeWidth:2})})]})})]})}function et(t){const o=t.includes("/")?"/":t.includes("\\")?"\\":"/",r=t.endsWith(o)?t.slice(0,-1):t,n=r.lastIndexOf(o);return n>=0?r.slice(n+1):r}const tt={global:{label:"Global Servers",color:"var(--color-accent-blue, #5B8DB8)"},project:{label:"Project Servers",color:"var(--color-status-planning, #9178B5)"},enterprise:{label:"Enterprise Managed",color:"var(--color-status-verifying, #C8863A)"},codex:{label:"Codex Servers",color:"var(--color-status-completed, #5A9E78)"}},de={global:{bg:"rgba(91,141,184,0.12)",text:"var(--color-accent-blue, #5B8DB8)"},project:{bg:"rgba(145,120,181,0.12)",text:"var(--color-status-planning, #9178B5)"},enterprise:{bg:"rgba(200,134,58,0.12)",text:"var(--color-status-verifying, #C8863A)"},codex:{bg:"rgba(90,158,120,0.12)",text:"var(--color-status-completed, #5A9E78)"}},xe={stdio:{bg:"rgba(91,141,184,0.08)",text:"var(--color-accent-blue, #5B8DB8)"},http:{bg:"rgba(145,120,181,0.08)",text:"var(--color-status-planning, #9178B5)"}};function rt(){const t=f(l=>l.servers),o=f(l=>l.scopeFilter),r=f(l=>l.search),n=f(l=>l.selectedServer),a=f(l=>l.setSelectedServer),i=f(l=>l.toggleServer),d=y.useMemo(()=>{let l=t;if(o!=="all"&&(l=l.filter(x=>x.scope===o)),r){const x=r.toLowerCase();l=l.filter(p=>{var s,h;return p.name.toLowerCase().includes(x)||(((s=p.command)==null?void 0:s.toLowerCase().includes(x))??!1)||(((h=p.url)==null?void 0:h.toLowerCase().includes(x))??!1)})}return l},[t,o,r]),m=y.useMemo(()=>{const l=new Map;for(const p of d){const s=l.get(p.scope)??[];s.push(p),l.set(p.scope,s)}const x=[];for(const p of["global","project","enterprise","codex"]){const s=l.get(p);if(s&&s.length>0){const h=tt[p]??{label:p,color:"var(--color-text-tertiary)"},w={scope:p,label:h.label,color:h.color,servers:s};if(p==="project"){const k=new Map;for(const S of s){const A=S.projectPath??"__unknown__",L=k.get(A)??[];L.push(S),k.set(A,L)}w.projectSubGroups=[];for(const[S,A]of k)w.projectSubGroups.push({projectPath:S,folderName:et(S),servers:A})}x.push(w)}}return x},[d]);function b(l){i(l.projectPath??"",l.name,!l.enabled)}return d.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[length:var(--font-size-sm)]",children:"No servers found"}):e.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:m.map((l,x)=>e.jsxs(M.div,{className:"mb-5",initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:x*.06},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-[10px] pb-[6px] border-b border-border-divider",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:l.color}}),e.jsx("span",{className:"text-[12px] font-bold text-text-primary",children:l.label}),e.jsxs("span",{className:"text-[10px] text-text-tertiary font-mono",children:[l.servers.length," server",l.servers.length!==1?"s":""]})]}),l.projectSubGroups?e.jsx("div",{className:"flex flex-col gap-[14px]",children:l.projectSubGroups.map(p=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-[8px] mb-[8px]",children:[e.jsx(Ae,{size:13,strokeWidth:1.8,style:{color:"var(--color-status-planning, #9178B5)",opacity:.7}}),e.jsx("span",{className:"text-[11px] font-bold text-text-secondary",title:p.projectPath,children:p.folderName}),e.jsx("span",{className:"text-[9px] font-mono text-text-tertiary opacity-60",children:p.servers.length})]}),e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-[10px]",children:p.servers.map((s,h)=>e.jsx(pe,{server:s,selected:n===s.id,isEnterprise:!1,delay:h*.04,onSelect:()=>a(n===s.id?null:s.id),onToggle:()=>b(s)},s.id))})]},p.projectPath))}):e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-[10px]",children:l.servers.map((p,s)=>e.jsx(pe,{server:p,selected:n===p.id,isEnterprise:l.scope==="enterprise",delay:s*.04,onSelect:()=>a(n===p.id?null:p.id),onToggle:()=>b(p)},p.id))})]},l.scope))})}function pe({server:t,selected:o,isEnterprise:r,delay:n,onSelect:a,onToggle:i}){var s;const d=de[t.scope]??de.global,m=xe[t.transport]??xe.stdio,b=t.command?`${t.command}${(s=t.args)!=null&&s.length?" "+t.args.join(" "):""}`:t.url??"",l=t.env?Object.keys(t.env):[],x=!t.cli.claude&&t.cli.codex,p=t.cli.claude&&!t.cli.codex;return e.jsxs(M.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,delay:n},onClick:a,className:["bg-bg-card border rounded-[10px] p-[14px] cursor-pointer transition-all duration-200 flex flex-col gap-2",o?"border-[var(--color-status-planning,#9178B5)] shadow-[0_0_0_2px_rgba(145,120,181,0.2)]":"border-border hover:border-text-tertiary hover:shadow-md hover:-translate-y-[2px]"].join(" "),style:r?{borderColor:"rgba(200,134,58,0.3)",background:"rgba(200,134,58,0.04)"}:void 0,children:[e.jsxs("div",{className:"flex items-center gap-[10px]",children:[e.jsx("div",{className:"w-9 h-9 rounded-[var(--radius-lg)] shrink-0 flex items-center justify-center",style:{background:t.transport==="stdio"?"rgba(91,141,184,0.08)":"rgba(145,120,181,0.08)",color:t.transport==="stdio"?"var(--color-accent-blue, #5B8DB8)":"var(--color-status-planning, #9178B5)"},children:t.transport==="stdio"?e.jsx(oe,{size:18,strokeWidth:1.8}):e.jsx(q,{size:18,strokeWidth:1.8})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[13px] font-bold text-text-primary truncate",children:t.name}),e.jsxs("div",{className:"flex gap-[5px] mt-[3px]",children:[e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase tracking-[0.03em] font-mono",style:{background:d.bg,color:d.text},children:t.scope}),e.jsx("span",{className:"text-[9px] font-semibold px-[7px] py-[2px] rounded-[4px] uppercase",style:{background:m.bg,color:m.text},children:t.transport})]})]}),e.jsxs("label",{className:"relative inline-block w-8 h-[18px] shrink-0 cursor-pointer",onClick:h=>h.stopPropagation(),children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:i,disabled:r,className:"sr-only"}),e.jsx("div",{className:["w-8 h-[18px] rounded-full transition-colors duration-200 relative",r?"opacity-50 cursor-default":""].join(" "),style:{background:t.enabled?"var(--color-status-completed, #5A9E78)":"var(--color-border, #E8E5DE)"},children:e.jsx("div",{className:"absolute top-[2px] left-[2px] w-[14px] h-[14px] rounded-full bg-white shadow-sm transition-transform duration-200",style:{transform:t.enabled?"translateX(14px)":"translateX(0)"}})})]})]}),b&&e.jsx("div",{className:"font-mono text-[10px] text-text-secondary bg-bg-secondary rounded-[var(--radius-md)] px-[10px] py-[6px] whitespace-nowrap overflow-hidden text-ellipsis",style:r?{background:"rgba(200,134,58,0.08)"}:void 0,children:r?"managed (read-only)":b}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"flex gap-1 flex-wrap flex-1 min-w-0",children:l.map(h=>e.jsx("span",{className:"text-[9px] font-mono px-[6px] py-[2px] rounded-[4px]",style:{background:"rgba(91,141,184,0.08)",color:"var(--color-accent-blue, #5B8DB8)"},children:h},h))}),e.jsxs("div",{className:"flex gap-[3px] shrink-0 items-center",children:[(p||x)&&e.jsx("button",{type:"button",onClick:h=>h.stopPropagation(),className:"flex items-center gap-[3px] px-[7px] py-[3px] rounded-[4px] border border-border bg-bg-card text-text-tertiary transition-all hover:border-[var(--color-accent-blue,#5B8DB8)] hover:text-[var(--color-accent-blue,#5B8DB8)] hover:bg-[rgba(91,141,184,0.04)]",title:p?"Copy to Codex":"Copy to Claude",children:p?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{size:9,strokeWidth:2.5}),e.jsx(V,{size:11,style:{color:"var(--color-status-completed, #5A9E78)"}})]}):e.jsxs(e.Fragment,{children:[e.jsx(ze,{size:9,strokeWidth:2.5}),e.jsx(G,{size:11,style:{color:"var(--color-status-verifying, #C8863A)"}})]})}),e.jsxs("div",{className:"flex gap-[3px]",children:[e.jsx("span",{className:["w-5 h-4 rounded-[3px] flex items-center justify-center",t.cli.claude?"":"opacity-25"].join(" "),style:{background:"rgba(200,134,58,0.08)",color:"var(--color-status-verifying, #C8863A)"},title:"Claude Code",children:e.jsx(G,{size:11})}),e.jsx("span",{className:["w-5 h-4 rounded-[3px] flex items-center justify-center",t.cli.codex?"":"opacity-25"].join(" "),style:{background:"rgba(90,158,120,0.08)",color:"var(--color-status-completed, #5A9E78)"},title:"Codex CLI",children:e.jsx(V,{size:11})})]})]})]})]})}const me={database:{icon:e.jsx(Ie,{size:18,strokeWidth:1.8}),bg:"rgba(91,141,184,0.08)",color:"var(--color-accent-blue, #5B8DB8)"},search:{icon:e.jsx(ae,{size:18,strokeWidth:1.8}),bg:"rgba(145,120,181,0.08)",color:"var(--color-status-planning, #9178B5)"},code:{icon:e.jsx(Re,{size:18,strokeWidth:1.8}),bg:"rgba(90,158,120,0.08)",color:"var(--color-status-completed, #5A9E78)"},filesystem:{icon:e.jsx(De,{size:18,strokeWidth:1.8}),bg:"rgba(184,149,64,0.08)",color:"var(--color-status-idle, #B89540)"},api:{icon:e.jsx(q,{size:18,strokeWidth:1.8}),bg:"rgba(200,134,58,0.08)",color:"var(--color-status-verifying, #C8863A)"},utility:{icon:e.jsx(He,{size:18,strokeWidth:1.8}),bg:"rgba(160,157,151,0.08)",color:"var(--color-text-tertiary, #A09D97)"}},st={database:{bg:"rgba(91,141,184,0.12)",color:"var(--color-accent-blue, #5B8DB8)"},sql:{bg:"rgba(90,158,120,0.12)",color:"var(--color-status-completed, #5A9E78)"},search:{bg:"rgba(145,120,181,0.12)",color:"var(--color-status-planning, #9178B5)"},code:{bg:"rgba(90,158,120,0.12)",color:"var(--color-status-completed, #5A9E78)"},tools:{bg:"rgba(90,158,120,0.12)",color:"var(--color-status-completed, #5A9E78)"},filesystem:{bg:"rgba(184,149,64,0.12)",color:"var(--color-status-idle, #B89540)"},files:{bg:"rgba(184,149,64,0.12)",color:"var(--color-status-idle, #B89540)"},api:{bg:"rgba(200,134,58,0.12)",color:"var(--color-status-verifying, #C8863A)"},web:{bg:"rgba(200,134,58,0.12)",color:"var(--color-status-verifying, #C8863A)"},docs:{bg:"rgba(145,120,181,0.12)",color:"var(--color-status-planning, #9178B5)"},research:{bg:"rgba(200,134,58,0.12)",color:"var(--color-status-verifying, #C8863A)"}},ot={database:"var(--color-accent-blue, #5B8DB8)",search:"var(--color-status-planning, #9178B5)",code:"var(--color-status-completed, #5A9E78)",filesystem:"var(--color-status-idle, #B89540)",api:"var(--color-status-verifying, #C8863A)",utility:"var(--color-text-tertiary, #A09D97)"};function at(){const t=f(s=>s.templates),o=f(s=>s.categories),r=f(s=>s.servers),n=f(s=>s.templateSearch),a=f(s=>s.templateCategory),i=y.useMemo(()=>{let s=t;if(a&&(s=s.filter(h=>h.category===a)),n){const h=n.toLowerCase();s=s.filter(w=>{var k;return w.name.toLowerCase().includes(h)||(((k=w.description)==null?void 0:k.toLowerCase().includes(h))??!1)})}return s},[t,n,a]),d=f(s=>s.setTemplateSearch),m=f(s=>s.setTemplateCategory),b=f(s=>s.installTemplate),l=y.useMemo(()=>new Set(r.map(s=>s.name.toLowerCase())),[r]),x=y.useMemo(()=>{const s={};for(const h of t)h.category&&(s[h.category]=(s[h.category]??0)+1);return s},[t]),p=y.useMemo(()=>t.filter(s=>l.has(s.name.toLowerCase())).length,[t,l]);return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center gap-5 px-5 py-2 border-b border-border-divider bg-bg-primary shrink-0",children:[e.jsx(ee,{color:"var(--color-status-planning, #9178B5)",value:t.length,label:"Templates"}),e.jsx(ee,{color:"var(--color-accent-blue, #5B8DB8)",value:o.length,label:"Categories"}),e.jsx(ee,{color:"var(--color-status-completed, #5A9E78)",value:p,label:"Installed"})]}),e.jsxs("div",{className:"flex items-center gap-[10px] px-5 py-2 border-b border-border-divider shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-[6px] px-3 py-[6px] rounded-[var(--radius-lg)] bg-bg-card border border-border w-[260px] focus-within:border-[var(--color-status-planning,#9178B5)] transition-colors",children:[e.jsx(ae,{size:13,strokeWidth:2,className:"text-text-tertiary shrink-0"}),e.jsx("input",{type:"text",placeholder:"Search templates...",value:n,onChange:s=>d(s.target.value),className:"border-none bg-transparent outline-none text-[12px] text-text-primary w-full placeholder:text-text-tertiary"})]}),e.jsxs("div",{className:"flex gap-[6px]",children:[e.jsxs("button",{type:"button",onClick:()=>m(null),className:["flex items-center gap-1 px-[10px] py-1 rounded-full border text-[10px] font-semibold whitespace-nowrap transition-all cursor-pointer",a===null?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-tertiary border-border hover:border-text-tertiary hover:text-text-secondary"].join(" "),children:["All",e.jsx("span",{className:"font-mono text-[9px] opacity-60",children:t.length})]}),o.map(s=>{const h=a===s,w=ot[s.toLowerCase()];return e.jsxs("button",{type:"button",onClick:()=>m(h?null:s),className:["flex items-center gap-1 px-[10px] py-1 rounded-full border text-[10px] font-semibold whitespace-nowrap transition-all cursor-pointer",h?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-tertiary border-border hover:border-text-tertiary hover:text-text-secondary"].join(" "),children:[w&&!h&&e.jsx("span",{className:"w-[6px] h-[6px] rounded-full",style:{background:w}}),s,e.jsx("span",{className:"font-mono text-[9px] opacity-60",children:x[s]??0})]},s)})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button",className:"flex items-center gap-[6px] px-[14px] py-[6px] rounded-[var(--radius-lg)] border-none bg-text-primary text-white text-[11px] font-semibold cursor-pointer transition-all hover:-translate-y-px hover:shadow-md whitespace-nowrap",children:[e.jsx(se,{size:13,strokeWidth:2}),"New Template"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:i.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[length:var(--font-size-sm)]",children:"No templates found"}):e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(300px,1fr))] gap-3",children:i.map((s,h)=>e.jsx(nt,{template:s,installed:l.has(s.name.toLowerCase()),delay:h*.04,onInstall:()=>void b(s.name)},s.id))})})]})}function ee({color:t,value:o,label:r}){return e.jsxs("div",{className:"flex items-center gap-[6px]",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:t}}),e.jsx("span",{className:"text-[16px] font-extrabold text-text-primary font-mono",children:o}),e.jsx("span",{className:"text-[10px] font-semibold text-text-tertiary uppercase tracking-[0.04em]",children:r})]})}function nt({template:t,installed:o,delay:r,onInstall:n}){var m,b;const a=((m=t.category)==null?void 0:m.toLowerCase())??"",i=me[a]??me.utility,d=t.serverConfig.command?`${t.serverConfig.command}${(b=t.serverConfig.args)!=null&&b.length?" "+t.serverConfig.args.join(" "):""}`:"";return e.jsxs(M.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,delay:r},className:"bg-bg-card border border-border rounded-[10px] p-[14px] transition-all duration-200 cursor-pointer flex flex-col gap-[10px] hover:border-text-tertiary hover:shadow-md hover:-translate-y-[2px]",children:[e.jsxs("div",{className:"flex items-start gap-[10px]",children:[e.jsx("div",{className:"w-9 h-9 rounded-[var(--radius-lg)] shrink-0 flex items-center justify-center",style:{background:i.bg,color:i.color},children:i.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[13px] font-bold text-text-primary",children:t.name}),t.description&&e.jsx("div",{className:"text-[11px] text-text-secondary leading-[1.5] mt-[2px] line-clamp-2",children:t.description})]})]}),d&&e.jsx("div",{className:"font-mono text-[10px] text-text-secondary bg-bg-secondary rounded-[var(--radius-md)] px-[10px] py-[6px] whitespace-nowrap overflow-hidden text-ellipsis",children:d}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex gap-1 flex-wrap",children:(t.tags??[]).map(l=>{const x=st[l.toLowerCase()]??{bg:"rgba(160,157,151,0.12)",color:"var(--color-text-tertiary)"};return e.jsx("span",{className:"text-[9px] font-semibold px-[6px] py-[2px] rounded-[4px] uppercase tracking-[0.03em]",style:{background:x.bg,color:x.color},children:l},l)})}),o?e.jsxs("span",{className:"flex items-center gap-1 px-[10px] py-1 rounded-[var(--radius-md)] border text-[10px] font-semibold whitespace-nowrap",style:{borderColor:"var(--color-status-completed, #5A9E78)",color:"var(--color-status-completed, #5A9E78)",background:"rgba(90,158,120,0.06)"},children:[e.jsx(We,{size:10,strokeWidth:2.5}),"Installed"]}):e.jsxs("button",{type:"button",onClick:l=>{l.stopPropagation(),n()},className:"flex items-center gap-1 px-[10px] py-1 rounded-[var(--radius-md)] border border-border bg-bg-card text-[10px] font-semibold text-text-secondary transition-all hover:border-[var(--color-status-completed,#5A9E78)] hover:text-[var(--color-status-completed,#5A9E78)] hover:bg-[rgba(90,158,120,0.04)] whitespace-nowrap cursor-pointer",children:[e.jsx(Te,{size:10,strokeWidth:2.5}),"Install"]})]})]})}const be={global:{bg:"rgba(91,141,184,0.12)",text:"var(--color-accent-blue, #5B8DB8)"},project:{bg:"rgba(145,120,181,0.12)",text:"var(--color-status-planning, #9178B5)"},enterprise:{bg:"rgba(200,134,58,0.12)",text:"var(--color-status-verifying, #C8863A)"},codex:{bg:"rgba(90,158,120,0.12)",text:"var(--color-status-completed, #5A9E78)"}};function lt(){const t=f(n=>n.editingServer),o=f(n=>n.setEditingServer),r=f(n=>n.updateServer);return t?e.jsx(ye,{open:!!t,onOpenChange:n=>{n||o(null)},children:e.jsxs(je,{children:[e.jsx(Ne,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),e.jsxs(we,{className:B("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-[560px] max-w-[95vw] max-h-[85vh]","rounded-[var(--radius-lg)] border border-border bg-bg-primary shadow-lg","flex flex-col overflow-hidden","focus:outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ce,{className:"text-[14px] font-semibold text-text-primary",children:"Edit Server"}),e.jsx(ct,{scope:t.scope})]}),e.jsx(ke,{className:B("w-7 h-7 flex items-center justify-center rounded-[var(--radius-sm)]","text-text-tertiary hover:text-text-primary hover:bg-bg-hover","transition-colors"),"aria-label":"Close",children:e.jsx(ve,{size:14,strokeWidth:2})})]}),e.jsx(it,{server:t,onSave:n=>void r(t,n),onCancel:()=>o(null)})]})]})}):null}function it({server:t,onSave:o,onCancel:r}){var W;const n=t.transport==="stdio",a=t.scope==="enterprise",[i,d]=y.useState(t.command??""),[m,b]=y.useState(((W=t.args)==null?void 0:W.join(" "))??""),[l,x]=y.useState(t.url??""),[p,s]=y.useState(()=>t.env?Object.entries(t.env).map(([g,j])=>({key:g,value:j})):[]),[h,w]=y.useState(!1),k=y.useMemo(()=>()=>{const g={...t.raw};if(n){g.command=i;const N=m.trim().split(/\s+/).filter(Boolean);N.length>0?g.args=N:delete g.args,delete g.url}else g.url=l,delete g.command,delete g.args;delete g.env;const j={};for(const N of p)N.key.trim()&&(j[N.key.trim()]=N.value);return Object.keys(j).length>0&&(g.env=j),delete g.enabled,g},[t.raw,n,i,m,l,p]);function S(){w(!0),o(k())}function A(){s(g=>[...g,{key:"",value:""}])}function L(g){s(j=>j.filter((N,c)=>c!==g))}function $(g,j,N){s(c=>c.map((C,z)=>z===g?{...C,[j]:N}:C))}return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:[e.jsx(D,{label:"Server Name",children:e.jsx("input",{type:"text",value:t.name,readOnly:!0,className:"w-full px-3 py-2 rounded-[var(--radius-md)] border border-border bg-bg-secondary text-[12px] text-text-tertiary font-mono cursor-not-allowed"})}),e.jsx(D,{label:"Transport",children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase tracking-[0.03em] font-mono",style:{background:n?"rgba(91,141,184,0.08)":"rgba(145,120,181,0.08)",color:n?"var(--color-accent-blue, #5B8DB8)":"var(--color-status-planning, #9178B5)"},children:t.transport})})}),a&&e.jsx("div",{className:"mb-4 px-3 py-2 rounded-[var(--radius-md)] border border-[var(--color-status-verifying,#C8863A)] bg-[rgba(200,134,58,0.06)] text-[11px] text-[var(--color-status-verifying,#C8863A)]",children:"Enterprise-managed servers cannot be edited from the dashboard."}),n&&e.jsx(D,{label:"Command",children:e.jsx("input",{type:"text",value:i,onChange:g=>d(g.target.value),disabled:a,placeholder:"e.g. npx",className:F})}),n&&e.jsx(D,{label:"Arguments",children:e.jsx("input",{type:"text",value:m,onChange:g=>b(g.target.value),disabled:a,placeholder:"space-separated arguments",className:F})}),!n&&e.jsx(D,{label:"URL",children:e.jsx("input",{type:"text",value:l,onChange:g=>x(g.target.value),disabled:a,placeholder:"https://...",className:F})}),e.jsx(D,{label:"Environment Variables",children:e.jsxs("div",{className:"space-y-2",children:[p.map((g,j)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:g.key,onChange:N=>$(j,"key",N.target.value),disabled:a,placeholder:"KEY",className:B(F,"w-[160px] shrink-0 font-mono text-[11px]")}),e.jsx("input",{type:"text",value:g.value,onChange:N=>$(j,"value",N.target.value),disabled:a,placeholder:"value",className:B(F,"flex-1 font-mono text-[11px]")}),!a&&e.jsx("button",{type:"button",onClick:()=>L(j),className:"shrink-0 w-6 h-6 flex items-center justify-center rounded-[var(--radius-sm)] text-text-tertiary hover:text-status-failed hover:bg-red-50 transition-colors",children:e.jsx(_e,{size:12,strokeWidth:2})})]},j)),!a&&e.jsxs("button",{type:"button",onClick:A,className:"flex items-center gap-1 px-2 py-1 text-[10px] font-semibold text-text-tertiary hover:text-text-primary transition-colors",children:[e.jsx(se,{size:11,strokeWidth:2}),"Add variable"]})]})})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-border shrink-0",children:[e.jsx("button",{type:"button",onClick:r,className:"px-4 py-[6px] rounded-[var(--radius-md)] border border-border bg-bg-card text-[11px] font-semibold text-text-secondary hover:text-text-primary transition-colors",children:"Cancel"}),e.jsx("button",{type:"button",onClick:S,disabled:h||a,className:B("px-4 py-[6px] rounded-[var(--radius-md)] border-none bg-text-primary text-white text-[11px] font-semibold transition-all","hover:-translate-y-px hover:shadow-md",(h||a)&&"opacity-50 cursor-not-allowed hover:translate-y-0 hover:shadow-none"),children:h?"Saving...":"Save Changes"})]})]})}const F=B("w-full px-3 py-2 rounded-[var(--radius-md)] border border-border bg-bg-card","text-[12px] text-text-primary outline-none","focus:border-[var(--color-status-planning,#9178B5)] transition-colors","placeholder:text-text-tertiary","disabled:opacity-50 disabled:cursor-not-allowed");function D({label:t,children:o}){return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-[0.05em] text-text-tertiary mb-[6px]",children:t}),o]})}function ct({scope:t}){const o=be[t]??be.global;return e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase tracking-[0.03em] font-mono",style:{background:o.bg,color:o.text},children:t})}const ue=[{id:"mode",label:"Mode"},{id:"configure",label:"Configure"},{id:"review",label:"Review"},{id:"progress",label:"Install"}];function dt({current:t}){const o=ue.findIndex(r=>r.id===t);return e.jsx("div",{className:"flex items-center gap-1 px-1",children:ue.map((r,n)=>{const a=n<o,i=n===o;return e.jsxs("div",{className:"flex items-center gap-1",children:[n>0&&e.jsx("div",{className:"w-8 h-px",style:{background:a?"var(--color-status-completed, #5A9E78)":"var(--color-border, #E8E5DE)"}}),e.jsxs("div",{className:"flex items-center gap-[6px]",children:[e.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-bold font-mono",style:{background:a?"var(--color-status-completed, #5A9E78)":i?"var(--color-text-primary, #1A1917)":"var(--color-bg-card, #F8F7F5)",color:a||i?"#fff":"var(--color-text-tertiary)",border:!a&&!i?"1px solid var(--color-border, #E8E5DE)":"none"},children:a?e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}):n+1}),e.jsx("span",{className:"text-[11px] font-semibold whitespace-nowrap",style:{color:i?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:r.label})]})]},r.id)})})}function xt(){const t=u(x=>x.mode),o=u(x=>x.setMode),r=u(x=>x.projectPath),n=u(x=>x.setProjectPath),a=u(x=>x.detecting),i=u(x=>x.error),d=u(x=>x.detect),m=u(x=>x.manifests),b=u(x=>x.fetchManifests);y.useEffect(()=>{b()},[b]);const l=t==="global"||t==="project"&&r.trim().length>0;return e.jsxs("div",{className:"flex flex-col gap-6 max-w-[520px] mx-auto py-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-[14px] font-semibold text-text-primary mb-1",children:"Installation Mode"}),e.jsx("p",{className:"text-[12px] text-text-tertiary",children:"Choose where to install maestro commands, agents, and workflows."})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(he,{selected:t==="global",onClick:()=>o("global"),title:"Global",description:"Install to home directory (~/.claude/, ~/.maestro/). Available across all projects.",recommended:!0}),e.jsx(he,{selected:t==="project",onClick:()=>o("project"),title:"Project",description:"Install to a specific project directory. Commands are project-scoped."})]}),t==="project"&&e.jsxs("div",{className:"flex flex-col gap-[6px]",children:[e.jsx("label",{className:"text-[11px] font-semibold text-text-secondary uppercase tracking-[0.04em]",children:"Project Path"}),e.jsx("input",{type:"text",value:r,onChange:x=>n(x.target.value),placeholder:"/path/to/your/project",className:"w-full px-3 py-2 rounded-[var(--radius-md)] border border-border bg-bg-card text-[12px] text-text-primary placeholder:text-text-tertiary focus:outline-none focus:border-[var(--color-status-planning,#9178B5)] transition-colors"})]}),m.length>0&&e.jsxs("div",{className:"rounded-[var(--radius-md)] border border-border bg-[rgba(184,149,64,0.04)] px-4 py-3",children:[e.jsx("p",{className:"text-[11px] font-semibold text-[var(--color-status-executing,#B89540)] mb-1",children:"Existing installations found"}),e.jsx("div",{className:"flex flex-col gap-1",children:m.slice(0,3).map(x=>e.jsxs("p",{className:"text-[10px] text-text-tertiary font-mono",children:[x.scope," — v",x.version," — ",new Date(x.installedAt).toLocaleDateString()]},x.id))})]}),i&&e.jsx("div",{className:"rounded-[var(--radius-md)] border border-[rgba(196,101,85,0.3)] bg-[rgba(196,101,85,0.04)] px-4 py-3",children:e.jsx("p",{className:"text-[11px] text-status-failed",children:i})}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsx("button",{type:"button",disabled:!l||a,onClick:()=>void d(),className:"flex items-center gap-[6px] px-5 py-[8px] rounded-[var(--radius-lg)] border-none bg-text-primary text-white text-[12px] font-semibold cursor-pointer transition-all hover:-translate-y-px hover:shadow-md disabled:opacity-40 disabled:cursor-default disabled:transform-none",children:a?e.jsxs(e.Fragment,{children:[e.jsx(pt,{}),"Scanning..."]}):"Next"})})]})}function he({selected:t,onClick:o,title:r,description:n,recommended:a}){return e.jsxs("button",{type:"button",onClick:o,className:"flex items-start gap-3 p-4 rounded-[var(--radius-lg)] border text-left transition-all cursor-pointer w-full",style:{borderColor:t?"var(--color-text-primary, #1A1917)":"var(--color-border, #E8E5DE)",background:t?"rgba(26,25,23,0.02)":"var(--color-bg-card, #F8F7F5)"},children:[e.jsx("div",{className:"w-[18px] h-[18px] rounded-full border-2 flex items-center justify-center shrink-0 mt-[1px]",style:{borderColor:t?"var(--color-text-primary, #1A1917)":"var(--color-border, #E8E5DE)"},children:t&&e.jsx("div",{className:"w-[10px] h-[10px] rounded-full",style:{background:"var(--color-text-primary, #1A1917)"}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-text-primary",children:r}),a&&e.jsx("span",{className:"text-[8px] font-bold px-[6px] py-[1px] rounded-full bg-[rgba(90,158,120,0.1)] text-[var(--color-status-completed,#5A9E78)] uppercase tracking-wider",children:"Recommended"})]}),e.jsx("p",{className:"text-[11px] text-text-tertiary mt-[2px] leading-[1.4]",children:n})]})]})}function pt(){return e.jsxs("svg",{className:"animate-spin w-[14px] h-[14px]",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",opacity:"0.3"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}function mt(){const t=u(s=>s.detection),o=u(s=>s.selectedComponents),r=u(s=>s.toggleComponent),n=u(s=>s.selectAllComponents),a=u(s=>s.backup),i=u(s=>s.setBackup),d=u(s=>s.mcpEnabled),m=u(s=>s.setMcpEnabled),b=u(s=>s.enabledTools),l=u(s=>s.toggleTool),x=u(s=>s.setStep);if(!t)return null;const p=t.components.filter(s=>s.available).every(s=>o.has(s.id));return e.jsxs("div",{className:"flex flex-col gap-5 max-w-[560px] mx-auto py-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-[13px] font-semibold text-text-primary",children:"Components"}),e.jsx("button",{type:"button",onClick:n,className:"text-[10px] font-semibold text-text-tertiary hover:text-text-primary transition-colors cursor-pointer",children:p?"All selected":"Select all"})]}),e.jsxs("div",{className:"flex flex-col gap-[6px]",children:[t.components.map(s=>e.jsxs("label",{className:"flex items-center gap-3 px-3 py-[10px] rounded-[var(--radius-md)] border border-border bg-bg-card cursor-pointer hover:bg-bg-hover transition-colors",style:{opacity:s.available?1:.4,pointerEvents:s.available?"auto":"none"},children:[e.jsx("input",{type:"checkbox",checked:o.has(s.id),onChange:()=>r(s.id),disabled:!s.available,className:"w-[14px] h-[14px] accent-[var(--color-text-primary,#1A1917)] cursor-pointer"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-[12px] font-semibold text-text-primary",children:s.label}),e.jsxs("span",{className:"text-[10px] text-text-tertiary ml-2 font-mono",children:[s.fileCount," files"]})]}),e.jsx("span",{className:"text-[9px] text-text-tertiary font-mono max-w-[200px] truncate",title:s.targetDir,children:s.targetDir.replace(/\\/g,"/").replace(/^.*\/\./,"~/.")})]},s.id)),e.jsxs("label",{className:"flex items-center gap-3 px-3 py-[10px] rounded-[var(--radius-md)] border border-border bg-bg-card cursor-pointer hover:bg-bg-hover transition-colors",children:[e.jsx("input",{type:"checkbox",checked:o.has("mcp"),onChange:()=>r("mcp"),className:"w-[14px] h-[14px] accent-[var(--color-text-primary,#1A1917)] cursor-pointer"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-[12px] font-semibold text-text-primary",children:"MCP Server"}),e.jsx("span",{className:"text-[10px] text-text-tertiary ml-2",children:"Register maestro-tools MCP"})]})]})]})]}),t.existingManifest&&e.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[rgba(184,149,64,0.3)] bg-[rgba(184,149,64,0.04)] px-4 py-3",children:[e.jsxs("p",{className:"text-[11px] font-semibold text-[var(--color-status-executing,#B89540)] mb-2",children:["Existing installation (v",t.existingManifest.version,") will be overwritten"]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:a,onChange:s=>i(s.target.checked),className:"w-[14px] h-[14px] accent-[var(--color-status-executing,#B89540)] cursor-pointer"}),e.jsx("span",{className:"text-[11px] text-text-secondary",children:"Create backup before installing"})]})]}),o.has("mcp")&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-[13px] font-semibold text-text-primary",children:"MCP Tools"}),e.jsxs("label",{className:"flex items-center gap-[6px] cursor-pointer ml-auto",children:[e.jsx("input",{type:"checkbox",checked:d,onChange:s=>m(s.target.checked),className:"w-[13px] h-[13px] accent-[var(--color-text-primary,#1A1917)] cursor-pointer"}),e.jsx("span",{className:"text-[10px] text-text-secondary font-semibold",children:"Enable MCP"})]})]}),d&&e.jsx("div",{className:"flex flex-wrap gap-[6px]",children:re.map(s=>e.jsx("button",{type:"button",onClick:()=>l(s),className:"px-[10px] py-[5px] rounded-full border text-[10px] font-mono font-semibold transition-all cursor-pointer",style:{borderColor:b.has(s)?"var(--color-text-primary)":"var(--color-border)",background:b.has(s)?"var(--color-text-primary)":"var(--color-bg-card)",color:b.has(s)?"#fff":"var(--color-text-tertiary)"},children:s},s))})]}),t.disabledItems.length>0&&e.jsxs("div",{className:"rounded-[var(--radius-md)] border border-border bg-bg-card px-4 py-3",children:[e.jsxs("p",{className:"text-[11px] font-semibold text-text-secondary mb-1",children:[t.disabledItems.length," disabled item(s) will be preserved"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.disabledItems.map(s=>e.jsxs("span",{className:"text-[9px] font-mono text-text-tertiary px-[6px] py-[2px] rounded bg-bg-secondary",children:[s.name," (",s.type,")"]},s.relativePath))})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx("button",{type:"button",onClick:()=>x("mode"),className:"px-4 py-[7px] rounded-[var(--radius-lg)] border border-border bg-bg-card text-[12px] font-semibold text-text-secondary hover:text-text-primary hover:border-text-tertiary transition-all cursor-pointer",children:"Back"}),e.jsx("button",{type:"button",onClick:()=>x("review"),disabled:o.size===0,className:"px-5 py-[8px] rounded-[var(--radius-lg)] border-none bg-text-primary text-white text-[12px] font-semibold cursor-pointer transition-all hover:-translate-y-px hover:shadow-md disabled:opacity-40 disabled:cursor-default disabled:transform-none",children:"Review"})]})]})}function bt(){const t=u(s=>s.mode),o=u(s=>s.projectPath),r=u(s=>s.detection),n=u(s=>s.selectedComponents),a=u(s=>s.backup),i=u(s=>s.mcpEnabled),d=u(s=>s.enabledTools),m=u(s=>s.setStep),b=u(s=>s.install);if(!r)return null;const l=r.components.filter(s=>s.available&&n.has(s.id)),x=l.reduce((s,h)=>s+h.fileCount,0),p=n.has("mcp");return e.jsxs("div",{className:"flex flex-col gap-5 max-w-[560px] mx-auto py-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-[14px] font-semibold text-text-primary mb-1",children:"Review Installation"}),e.jsx("p",{className:"text-[12px] text-text-tertiary",children:"Confirm the following will be installed."})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(X,{label:"Mode",value:t}),e.jsx(X,{label:"Components",value:String(l.length+(p?1:0))}),e.jsx(X,{label:"Files",value:String(x)}),e.jsx(X,{label:"Backup",value:a&&r.existingManifest?"Yes":"No"})]}),t==="project"&&o&&e.jsxs("div",{className:"flex gap-2 items-center text-[11px]",children:[e.jsx("span",{className:"font-semibold text-text-secondary",children:"Project:"}),e.jsx("span",{className:"font-mono text-text-tertiary",children:o})]}),e.jsx("div",{className:"rounded-[var(--radius-md)] border border-border overflow-hidden",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left text-[9px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-3 py-[6px] bg-bg-secondary border-b border-border",children:"Component"}),e.jsx("th",{className:"text-left text-[9px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-3 py-[6px] bg-bg-secondary border-b border-border",children:"Target"}),e.jsx("th",{className:"text-right text-[9px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-3 py-[6px] bg-bg-secondary border-b border-border w-[60px]",children:"Files"})]})}),e.jsxs("tbody",{children:[l.map(s=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2 border-b border-border-divider text-[11px] font-semibold text-text-primary",children:s.label}),e.jsx("td",{className:"px-3 py-2 border-b border-border-divider text-[10px] font-mono text-text-tertiary max-w-[250px] truncate",title:s.targetDir,children:s.targetDir.replace(/\\/g,"/").replace(/^.*\/\./,"~/.")}),e.jsx("td",{className:"px-3 py-2 border-b border-border-divider text-[11px] font-mono text-text-secondary text-right",children:s.fileCount})]},s.id)),p&&e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2 border-b border-border-divider text-[11px] font-semibold text-text-primary",children:"MCP Server"}),e.jsx("td",{className:"px-3 py-2 border-b border-border-divider text-[10px] font-mono text-text-tertiary",children:t==="project"?".mcp.json":"~/.claude.json"}),e.jsx("td",{className:"px-3 py-2 border-b border-border-divider text-[11px] font-mono text-text-secondary text-right",children:"—"})]})]})]})}),p&&i&&e.jsxs("div",{className:"rounded-[var(--radius-md)] border border-border bg-bg-card px-4 py-3",children:[e.jsx("p",{className:"text-[10px] font-semibold text-text-secondary uppercase tracking-[0.04em] mb-1",children:"MCP Tools"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:Array.from(d).map(s=>e.jsx("span",{className:"text-[9px] font-mono font-semibold px-[7px] py-[2px] rounded-full bg-[rgba(90,158,120,0.08)] text-[var(--color-status-completed,#5A9E78)]",children:s},s))})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx("button",{type:"button",onClick:()=>m("configure"),className:"px-4 py-[7px] rounded-[var(--radius-lg)] border border-border bg-bg-card text-[12px] font-semibold text-text-secondary hover:text-text-primary hover:border-text-tertiary transition-all cursor-pointer",children:"Back"}),e.jsx("button",{type:"button",onClick:()=>void b(),className:"px-5 py-[8px] rounded-[var(--radius-lg)] border-none bg-[var(--color-status-completed,#5A9E78)] text-white text-[12px] font-semibold cursor-pointer transition-all hover:-translate-y-px hover:shadow-md",children:"Install"})]})]})}function X({label:t,value:o}){return e.jsxs("div",{className:"flex-1 rounded-[var(--radius-md)] border border-border bg-bg-card px-3 py-2 text-center",children:[e.jsx("div",{className:"text-[14px] font-extrabold text-text-primary font-mono capitalize",children:o}),e.jsx("div",{className:"text-[9px] font-semibold text-text-tertiary uppercase tracking-[0.04em]",children:t})]})}function ut(){const t=u(a=>a.installing),o=u(a=>a.result),r=u(a=>a.setOpen),n=u(a=>a.reset);return t?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-16",children:[e.jsxs("svg",{className:"animate-spin w-8 h-8 text-text-primary",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",opacity:"0.15"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]}),e.jsx("p",{className:"text-[13px] font-semibold text-text-primary",children:"Installing..."}),e.jsx("p",{className:"text-[11px] text-text-tertiary",children:"Copying files and registering configuration"})]}):o?o.success?e.jsxs("div",{className:"flex flex-col items-center gap-5 py-10 max-w-[440px] mx-auto",children:[e.jsx("div",{className:"w-12 h-12 rounded-full flex items-center justify-center",style:{background:"rgba(90,158,120,0.1)"},children:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-status-completed, #5A9E78)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-[14px] font-semibold text-text-primary mb-1",children:"Installation Complete"}),e.jsx("p",{className:"text-[11px] text-text-tertiary",children:"All components installed successfully."})]}),e.jsxs("div",{className:"w-full rounded-[var(--radius-md)] border border-border bg-bg-card overflow-hidden",children:[e.jsx(I,{label:"Files installed",value:String(o.filesInstalled)}),e.jsx(I,{label:"Directories created",value:String(o.dirsCreated)}),e.jsx(I,{label:"Components",value:o.components.join(", ")}),o.disabledItemsRestored>0&&e.jsx(I,{label:"Disabled items restored",value:String(o.disabledItemsRestored)}),e.jsx(I,{label:"MCP registered",value:o.mcpRegistered?"Yes":"No"}),e.jsx(I,{label:"Manifest",value:o.manifestPath.replace(/\\/g,"/").split("/").slice(-1)[0],last:!0})]}),e.jsx("button",{type:"button",onClick:()=>r(!1),className:"px-5 py-[8px] rounded-[var(--radius-lg)] border-none bg-text-primary text-white text-[12px] font-semibold cursor-pointer transition-all hover:-translate-y-px hover:shadow-md",children:"Done"})]}):e.jsxs("div",{className:"flex flex-col items-center gap-5 py-10 max-w-[440px] mx-auto",children:[e.jsx("div",{className:"w-12 h-12 rounded-full flex items-center justify-center",style:{background:"rgba(196,101,85,0.1)"},children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-status-failed, #C46555)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-[14px] font-semibold text-text-primary mb-1",children:"Installation Failed"}),e.jsx("p",{className:"text-[11px] text-status-failed",children:o.error})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{type:"button",onClick:n,className:"px-4 py-[7px] rounded-[var(--radius-lg)] border border-border bg-bg-card text-[12px] font-semibold text-text-secondary hover:text-text-primary transition-all cursor-pointer",children:"Try Again"}),e.jsx("button",{type:"button",onClick:()=>r(!1),className:"px-4 py-[7px] rounded-[var(--radius-lg)] border-none bg-text-primary text-white text-[12px] font-semibold cursor-pointer transition-all",children:"Close"})]})]}):null}function I({label:t,value:o,last:r}){return e.jsxs("div",{className:"flex items-center justify-between px-4 py-[8px]",style:{borderBottom:r?"none":"1px solid var(--color-border-divider)"},children:[e.jsx("span",{className:"text-[10px] font-semibold text-text-tertiary uppercase tracking-[0.04em]",children:t}),e.jsx("span",{className:"text-[11px] font-mono text-text-primary",children:o})]})}function ht(){const t=u(a=>a.open),o=u(a=>a.setOpen),r=u(a=>a.step),n=u(a=>a.installing);return e.jsx(ye,{open:t,onOpenChange:a=>{!a&&n||o(a)},children:e.jsxs(je,{children:[e.jsx(Ne,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),e.jsxs(we,{className:B("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-[640px] max-w-[95vw] max-h-[85vh]","rounded-[var(--radius-lg)] border border-border bg-bg-primary shadow-lg","flex flex-col overflow-hidden","focus:outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Ce,{className:"text-[14px] font-semibold text-text-primary",children:"Install Wizard"}),e.jsx(dt,{current:r})]}),!n&&e.jsx(ke,{className:B("w-7 h-7 flex items-center justify-center rounded-[var(--radius-sm)]","text-text-tertiary hover:text-text-primary hover:bg-bg-hover","transition-colors"),"aria-label":"Close",children:e.jsxs("svg",{className:"w-[14px] h-[14px]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-5",children:[r==="mode"&&e.jsx(xt,{}),r==="configure"&&e.jsx(mt,{}),r==="review"&&e.jsx(bt,{}),r==="progress"&&e.jsx(ut,{})]})]})]})})}const ft=[{label:"List",icon:e.jsx(Oe,{size:14,strokeWidth:1.8}),shortcut:"1"},{label:"Cards",icon:e.jsx(Le,{size:14,strokeWidth:1.8}),shortcut:"2"},{label:"Templates",icon:e.jsx($e,{size:14,strokeWidth:1.8}),shortcut:"3"}],fe=["list","cards","templates"],te={initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8}};function zt(){const t=f(l=>l.activeView),o=f(l=>l.setActiveView),r=f(l=>l.fetchConfig),n=f(l=>l.fetchTemplates),a=f(l=>l.loading),i=f(l=>l.error),{register:d,unregister:m}=y.useContext(Me),b=y.useCallback(l=>o(fe[l]),[o]);return y.useEffect(()=>{d({items:ft.map(l=>({label:l.label,icon:l.icon,shortcut:l.shortcut})),activeIndex:fe.indexOf(t),onSwitch:b})},[t,d,b]),y.useEffect(()=>()=>m(),[m]),y.useEffect(()=>{function l(x){x.target instanceof HTMLInputElement||x.target instanceof HTMLTextAreaElement||(x.key==="1"?o("list"):x.key==="2"?o("cards"):x.key==="3"&&o("templates"))}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[o]),y.useEffect(()=>{r(),n()},[r,n]),a?e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading MCP configuration..."}):i?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx("span",{className:"text-status-failed text-[length:var(--font-size-sm)]",children:"Failed to load MCP config"}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:i}),e.jsx("button",{type:"button",onClick:()=>void r(),className:"px-3 py-1 rounded-[var(--radius-md)] text-[11px] font-semibold text-text-secondary hover:text-text-primary transition-all",style:{border:"var(--style-btn-secondary-border)",background:"var(--style-btn-secondary-bg)"},children:"Retry"})]}):e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsx(ht,{}),e.jsx(lt,{}),e.jsxs(Be,{mode:"wait",children:[t==="list"&&e.jsx(M.div,{className:"flex-1 flex flex-col overflow-hidden",variants:te,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.34,1.56,.64,1]},children:e.jsx(Qe,{})},"list"),t==="cards"&&e.jsx(M.div,{className:"flex-1 flex flex-col overflow-hidden",variants:te,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.34,1.56,.64,1]},children:e.jsx(rt,{})},"cards"),t==="templates"&&e.jsx(M.div,{className:"flex-1 flex flex-col overflow-hidden",variants:te,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.34,1.56,.64,1]},children:e.jsx(at,{})},"templates")]})]})}export{zt as McpPage};
|
|
21
|
+
*/const Je=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Ye=K("wrench",Je);function He(t,o,r){return t==="project"&&r?`project:${o}@${r}`:`${t}:${o}`}function Ue(t){const o=[],r=t.globalServers??{},n=t.projects??{},a=t.enterpriseServers??{},i=t.codex;for(const[d,m]of Object.entries(r))o.push(Y(d,m,"global"));for(const[d,m]of Object.entries(n)){const b=m.mcpServers??{},l=m.disabledMcpServers??[];for(const[x,p]of Object.entries(b))o.push({...Y(x,p,"project",d),enabled:!l.includes(x)})}for(const[d,m]of Object.entries(a))o.push({...Y(d,m,"enterprise"),enabled:!0});if(i!=null&&i.servers)for(const[d,m]of Object.entries(i.servers)){const b=o.find(l=>l.name===d&&l.scope==="global");b?b.cli.codex=!0:o.push({...Y(d,m,"codex"),cli:{claude:!1,codex:!0}})}return o}function Y(t,o,r,n){const a=typeof o.url=="string";return{id:He(r,t,n),name:t,scope:r,projectPath:n,enabled:o.enabled!==!1,transport:a?"http":"stdio",command:typeof o.command=="string"?o.command:void 0,args:Array.isArray(o.args)?o.args:void 0,url:a?o.url:void 0,env:typeof o.env=="object"&&o.env!==null?o.env:void 0,cli:{claude:r!=="codex",codex:r==="codex"},raw:o}}const f=ge((t,o)=>({servers:[],templates:[],categories:[],loading:!1,error:null,activeView:"list",scopeFilter:"all",search:"",selectedServer:null,templateSearch:"",templateCategory:null,editingServer:null,setActiveView:r=>t({activeView:r}),setScopeFilter:r=>t({scopeFilter:r}),setSearch:r=>t({search:r}),setSelectedServer:r=>t({selectedServer:r}),setTemplateSearch:r=>t({templateSearch:r}),setTemplateCategory:r=>t({templateCategory:r}),setEditingServer:r=>t({editingServer:r}),fetchConfig:async()=>{t({loading:!0,error:null});try{const r=await fetch(E.CONFIG);if(!r.ok)throw new Error(`Failed: ${r.status}`);const n=await r.json();t({servers:Ue(n),loading:!1})}catch(r){t({loading:!1,error:String(r)})}},fetchTemplates:async()=>{try{const[r,n]=await Promise.all([fetch(E.TEMPLATES),fetch(E.TEMPLATES_CATEGORIES)]);if(!r.ok||!n.ok)return;const a=await r.json(),i=await n.json();t({templates:a.templates??[],categories:i.categories??[]})}catch{}},toggleServer:async(r,n,a)=>{t(i=>({servers:i.servers.map(d=>d.name===n?{...d,enabled:a}:d)}));try{await fetch(E.TOGGLE,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r,serverName:n,enable:a})})}catch{o().fetchConfig()}},removeServer:async(r,n)=>{const a=o().servers;t(i=>({servers:i.servers.filter(d=>d.name!==n)}));try{(await fetch(E.REMOVE_SERVER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r,serverName:n})})).ok||t({servers:a})}catch{t({servers:a})}},addGlobalServer:async(r,n)=>{try{await fetch(E.ADD_GLOBAL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverName:r,serverConfig:n})}),o().fetchConfig()}catch{}},removeGlobalServer:async r=>{const n=o().servers;t(a=>({servers:a.servers.filter(i=>i.name!==r)}));try{(await fetch(E.REMOVE_GLOBAL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverName:r})})).ok||t({servers:n})}catch{t({servers:n})}},updateServer:async(r,n)=>{try{await fetch(E.UPDATE_SERVER,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:r.scope,serverName:r.name,serverConfig:n,projectPath:r.projectPath})}),t({editingServer:null}),o().fetchConfig()}catch{}},installTemplate:async(r,n,a)=>{try{await fetch(E.TEMPLATES_INSTALL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({templateName:r,projectPath:n,scope:a})}),o().fetchConfig()}catch{}},filteredServers:()=>{const{servers:r,scopeFilter:n,search:a}=o();let i=r;if(n!=="all"&&(i=i.filter(d=>d.scope===n)),a){const d=a.toLowerCase();i=i.filter(m=>{var b,l;return m.name.toLowerCase().includes(d)||(((b=m.command)==null?void 0:b.toLowerCase().includes(d))??!1)||(((l=m.url)==null?void 0:l.toLowerCase().includes(d))??!1)})}return i},filteredTemplates:()=>{const{templates:r,templateSearch:n,templateCategory:a}=o();let i=r;if(a&&(i=i.filter(d=>d.category===a)),n){const d=n.toLowerCase();i=i.filter(m=>{var b;return m.name.toLowerCase().includes(d)||(((b=m.description)==null?void 0:b.toLowerCase().includes(d))??!1)})}return i},projectGroups:()=>{const{servers:r}=o(),n=new Map;for(const i of r){const d=i.projectPath??null,m=n.get(d)??[];m.push(i),n.set(d,m)}const a=[];for(const[i,d]of n)a.push({projectPath:i,servers:d});return a},selectedEntry:()=>{const{servers:r,selectedServer:n}=o();return n?r.find(a=>a.id===n)??null:null}}));function G({size:t=14,className:o,style:r}){return e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",className:o,style:r,children:e.jsx("path",{d:"M17.304 3.541l-5.15 16.918H9.29l5.15-16.918zm-9.757 10.3l-2.1 3.613H2.131l3.256-5.576zm2.74-7.354L6.41 13.49l-2.037-3.5L8.052 3.54z"})})}function V({size:t=14,className:o,style:r}){return e.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",className:o,style:r,children:e.jsx("path",{d:"M22.282 9.821a5.985 5.985 0 0 0-.516-4.91 6.046 6.046 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.985 5.985 0 0 0-3.998 2.9 6.046 6.046 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.051 6.051 0 0 0 6.515 2.9A5.985 5.985 0 0 0 13.26 24a6.056 6.056 0 0 0 5.772-4.206 5.99 5.99 0 0 0 3.997-2.9 6.056 6.056 0 0 0-.747-7.073zM13.26 22.43a4.476 4.476 0 0 1-2.876-1.04l.14-.08 4.779-2.759a.795.795 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494zM3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.771.771 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646zM2.34 7.896a4.485 4.485 0 0 1 2.366-1.973V11.6a.766.766 0 0 0 .388.677l5.815 3.354-2.02 1.168a.076.076 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.124 7.2a.076.076 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.41-.676zm2.01-3.023l-.141-.085-4.774-2.782a.776.776 0 0 0-.785 0L9.409 9.23V6.897a.066.066 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zM8.307 12.863l-2.02-1.164a.08.08 0 0 1-.038-.057V6.074a4.5 4.5 0 0 1 7.375-3.453l-.14.08-4.779 2.758a.795.795 0 0 0-.393.681zm1.097-2.361l2.602-1.506 2.607 1.506v3.012l-2.602 1.506-2.607-1.506z"})})}const ne={global:{bg:"rgba(91,141,184,0.12)",text:"var(--color-accent-blue, #5B8DB8)"},project:{bg:"rgba(145,120,181,0.12)",text:"var(--color-status-planning, #9178B5)"},enterprise:{bg:"rgba(200,134,58,0.12)",text:"var(--color-status-verifying, #C8863A)"},codex:{bg:"rgba(90,158,120,0.12)",text:"var(--color-status-completed, #5A9E78)"}},le={stdio:{bg:"rgba(91,141,184,0.08)",text:"var(--color-accent-blue, #5B8DB8)"},http:{bg:"rgba(145,120,181,0.08)",text:"var(--color-status-planning, #9178B5)"}};function Xe({server:t,onClose:o}){var x;const r=f(p=>p.removeServer),n=f(p=>p.removeGlobalServer),a=f(p=>p.setEditingServer),i=y.useMemo(()=>t.env?Object.entries(t.env):[],[t.env]),d=y.useMemo(()=>JSON.stringify(t.raw,null,2),[t.raw]),m=ne[t.scope]??ne.global,b=le[t.transport]??le.stdio;function l(){t.scope==="global"?n(t.name):r(t.projectPath??"",t.name),o()}return e.jsxs(M.aside,{initial:{width:0,opacity:0},animate:{width:380,opacity:1},exit:{width:0,opacity:0},transition:{type:"spring",stiffness:400,damping:30},className:"shrink-0 border-l border-border bg-bg-card overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-[10px] px-[18px] py-[14px] border-b border-border-divider shrink-0",children:[e.jsx("div",{className:"w-9 h-9 rounded-[var(--radius-lg)] shrink-0 flex items-center justify-center",style:{background:b.bg,color:b.text},children:t.transport==="stdio"?e.jsx(oe,{size:18,strokeWidth:1.8}):e.jsx(q,{size:18,strokeWidth:1.8})}),e.jsx("span",{className:"text-[15px] font-bold text-text-primary flex-1 min-w-0 truncate",children:t.name}),e.jsx("button",{type:"button",onClick:o,"aria-label":"Close detail panel",className:"flex items-center justify-center w-7 h-7 rounded-[var(--radius-md)] text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors",children:e.jsx(ve,{size:14,strokeWidth:2})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-[18px] py-[16px]",style:{width:380},children:[e.jsxs(_,{label:"Info",children:[e.jsx(H,{label:"Scope",children:e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase tracking-[0.03em] font-mono",style:{background:m.bg,color:m.text},children:t.scope})}),e.jsx(H,{label:"Transport",children:e.jsx("span",{className:"text-[9px] font-semibold px-[7px] py-[2px] rounded-[4px] uppercase",style:{background:b.bg,color:b.text},children:t.transport})}),e.jsx(H,{label:"Status",children:e.jsxs("span",{className:"text-[12px] font-semibold flex items-center gap-[4px]",style:{color:t.enabled?"var(--color-status-completed, #5A9E78)":"var(--color-text-tertiary)"},children:[e.jsx("span",{className:"w-[7px] h-[7px] rounded-full inline-block",style:{background:t.enabled?"var(--color-status-completed, #5A9E78)":"var(--color-text-tertiary)"}}),t.enabled?"Enabled":"Disabled"]})}),t.projectPath&&e.jsx(H,{label:"Source",children:e.jsx("span",{className:"font-mono text-[11px] text-text-primary break-all",children:t.projectPath})})]}),e.jsxs(_,{label:"CLI Presence",children:[e.jsx(ie,{icon:e.jsx(G,{size:12}),label:"Claude Code",present:t.cli.claude,tintBg:"rgba(200,134,58,0.08)",tintColor:"var(--color-status-verifying, #C8863A)"}),e.jsx(ie,{icon:e.jsx(V,{size:12}),label:"Codex CLI",present:t.cli.codex,tintBg:"rgba(90,158,120,0.08)",tintColor:"var(--color-status-completed, #5A9E78)"})]}),e.jsx(_,{label:"Command",children:e.jsx("div",{className:"bg-bg-secondary border border-border-divider rounded-[var(--radius-lg)] px-3 py-[10px] font-mono text-[11px] text-text-primary leading-[1.7] whitespace-pre-wrap break-all",children:t.command?`${t.command}${(x=t.args)!=null&&x.length?" "+t.args.join(" "):""}`:t.url??"(no command)"})}),i.length>0&&e.jsx(_,{label:"Environment",children:e.jsx("div",{className:"bg-bg-secondary border border-border-divider rounded-[var(--radius-lg)] overflow-hidden",children:e.jsx("table",{className:"w-full border-collapse",children:e.jsx("tbody",{children:i.map(([p,s])=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-2 py-1 text-[11px] font-mono font-medium whitespace-nowrap border-b border-border-divider",style:{color:"var(--color-accent-blue, #5B8DB8)"},children:p}),e.jsx("td",{className:"px-2 py-1 text-[11px] font-mono text-text-secondary break-all border-b border-border-divider",children:s})]},p))})})})}),e.jsx(_,{label:"Raw Config",children:e.jsx("div",{className:"rounded-[var(--radius-lg)] px-3 py-[10px] font-mono text-[11px] leading-[1.7] whitespace-pre-wrap break-all",style:{background:"var(--color-code-bg, #2C2723)",color:"var(--color-code-text, #D9D0C4)",border:"1px solid var(--color-code-border, #3D3731)"},children:d})})]}),e.jsxs("div",{className:"flex gap-[6px] px-[18px] py-3 border-t border-border-divider shrink-0",children:[e.jsxs("button",{type:"button",onClick:()=>a(t),className:"flex-1 flex items-center justify-center gap-[4px] px-[10px] py-[5px] rounded-[var(--radius-md)] border border-border bg-bg-card text-[10px] font-semibold text-text-secondary hover:border-text-tertiary hover:text-text-primary transition-all",children:[e.jsx(Pe,{size:11,strokeWidth:2}),"Edit"]}),e.jsxs("button",{type:"button",onClick:l,className:"flex-1 flex items-center justify-center gap-[4px] px-[10px] py-[5px] rounded-[var(--radius-md)] border border-border bg-bg-card text-[10px] font-semibold text-status-failed hover:border-status-failed hover:bg-red-50 transition-all",children:[e.jsx(Se,{size:11,strokeWidth:2}),"Remove"]})]})]})}function _({label:t,children:o}){return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-[0.05em] text-text-tertiary mb-[6px]",children:t}),o]})}function H({label:t,children:o}){return e.jsxs("div",{className:"flex items-center gap-2 py-[3px]",children:[e.jsx("span",{className:"text-[11px] font-semibold text-text-secondary min-w-[70px] shrink-0",children:t}),o]})}function ie({icon:t,label:o,present:r,tintBg:n,tintColor:a}){return e.jsxs("div",{className:"flex items-center gap-[10px] px-[10px] py-2 rounded-[var(--radius-md)] mb-1",style:{background:r?n:void 0},children:[e.jsx("div",{className:"w-6 h-[18px] rounded-[4px] flex items-center justify-center",style:{background:n,color:a},children:t}),e.jsx("span",{className:"text-[12px] font-semibold text-text-primary flex-1",children:o}),e.jsx("span",{className:"text-[10px] font-semibold",style:{color:r?"var(--color-status-completed, #5A9E78)":"var(--color-text-tertiary)"},children:r?"Installed":"Not found"})]})}const re=["write_file","edit_file","read_file","read_many_files","team_msg","core_memory"],u=ge((t,o)=>({open:!1,step:"mode",mode:"global",projectPath:"",detection:null,selectedComponents:new Set,backup:!0,mcpEnabled:!0,enabledTools:new Set(re),detecting:!1,installing:!1,result:null,error:null,manifests:[],setOpen:r=>{t(r?{open:r,step:"mode",result:null,error:null,detection:null}:{open:r})},setStep:r=>t({step:r}),setMode:r=>t({mode:r}),setProjectPath:r=>t({projectPath:r}),toggleComponent:r=>t(n=>{const a=new Set(n.selectedComponents);return a.has(r)?a.delete(r):a.add(r),{selectedComponents:a}}),selectAllComponents:()=>t(r=>{if(!r.detection)return{};const n=r.detection.components.filter(a=>a.available).map(a=>a.id);return r.selectedComponents.has("mcp")&&n.push("mcp"),{selectedComponents:new Set(n)}}),setBackup:r=>t({backup:r}),setMcpEnabled:r=>t({mcpEnabled:r}),toggleTool:r=>t(n=>{const a=new Set(n.enabledTools);return a.has(r)?a.delete(r):a.add(r),{enabledTools:a}}),detect:async()=>{const{mode:r,projectPath:n}=o();t({detecting:!0,error:null});try{const a=await fetch(Q.DETECT,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:r,projectPath:r==="project"?n:void 0})}),i=await a.json();if(!a.ok)throw new Error(i.error??`HTTP ${a.status}`);const d=i,m=d.components.filter(b=>b.available).map(b=>b.id);m.push("mcp"),t({detecting:!1,detection:d,selectedComponents:new Set(m),step:"configure"})}catch(a){t({detecting:!1,error:String(a)})}},install:async()=>{const{mode:r,projectPath:n,selectedComponents:a,backup:i,mcpEnabled:d,enabledTools:m}=o();t({installing:!0,error:null,step:"progress"});try{const l=await(await fetch(Q.EXECUTE,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:r,projectPath:r==="project"?n:void 0,components:Array.from(a),backup:i,mcpConfig:d&&a.has("mcp")?{enabled:!0,enabledTools:Array.from(m)}:void 0})})).json();t({installing:!1,result:l})}catch(b){t({installing:!1,result:{success:!1,filesInstalled:0,dirsCreated:0,manifestPath:"",disabledItemsRestored:0,mcpRegistered:!1,components:[],error:String(b)}})}},fetchManifests:async()=>{try{const r=await fetch(Q.MANIFESTS);if(!r.ok)return;const n=await r.json();t({manifests:n.manifests??[]})}catch{}},reset:()=>t({step:"mode",mode:"global",projectPath:"",detection:null,selectedComponents:new Set,backup:!0,mcpEnabled:!0,enabledTools:new Set(re),detecting:!1,installing:!1,result:null,error:null})}));function Ke(t){const o=t.includes("/")?"/":t.includes("\\")?"\\":"/",r=t.endsWith(o)?t.slice(0,-1):t,n=r.lastIndexOf(o);return n>=0?r.slice(n+1):r}const qe=[{id:"all",label:"All"},{id:"global",label:"Global",color:"var(--color-accent-blue, #5B8DB8)"},{id:"project",label:"Project",color:"var(--color-status-planning, #9178B5)"},{id:"enterprise",label:"Enterprise",color:"var(--color-status-verifying, #C8863A)"}],ce={global:{bg:"rgba(91,141,184,0.12)",text:"var(--color-accent-blue, #5B8DB8)"},project:{bg:"rgba(145,120,181,0.12)",text:"var(--color-status-planning, #9178B5)"},enterprise:{bg:"rgba(200,134,58,0.12)",text:"var(--color-status-verifying, #C8863A)"},codex:{bg:"rgba(90,158,120,0.12)",text:"var(--color-status-completed, #5A9E78)"}};function Qe(){const t=f(c=>c.servers),o=f(c=>c.scopeFilter),r=f(c=>c.search),n=y.useMemo(()=>{let c=t;if(o!=="all"&&(c=c.filter(C=>C.scope===o)),r){const C=r.toLowerCase();c=c.filter(z=>{var O,T;return z.name.toLowerCase().includes(C)||(((O=z.command)==null?void 0:O.toLowerCase().includes(C))??!1)||(((T=z.url)==null?void 0:T.toLowerCase().includes(C))??!1)})}return c},[t,o,r]),a=f(c=>c.selectedServer),i=f(c=>c.setScopeFilter),d=f(c=>c.setSearch),m=f(c=>c.setSelectedServer),b=f(c=>c.toggleServer),l=f(c=>c.removeServer),x=f(c=>c.removeGlobalServer),p=f(c=>c.setEditingServer),s=u(c=>c.setOpen),h=t.filter(c=>c.enabled).length,w=t.filter(c=>c.scope==="global").length,k=t.filter(c=>c.scope==="project").length,S=t.filter(c=>c.scope==="enterprise").length,A=t.filter(c=>c.transport==="stdio").length,L=t.filter(c=>c.transport==="http").length,$={all:t.length,global:w,project:k,enterprise:S},W=a?t.find(c=>c.id===a)??null:null;function g(c){b(c.projectPath??"",c.name,!c.enabled)}function j(c){c.scope==="global"?x(c.name):l(c.projectPath??"",c.name)}function N(c){p(c)}return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center gap-5 px-5 py-2 border-b border-border-divider bg-bg-primary shrink-0",children:[e.jsx(U,{color:"var(--color-status-completed, #5A9E78)",value:h,label:"Active"}),e.jsx(U,{color:"var(--color-accent-blue, #5B8DB8)",value:w,label:"Global"}),e.jsx(U,{color:"var(--color-status-planning, #9178B5)",value:k,label:"Project"}),e.jsx(U,{color:"var(--color-status-verifying, #C8863A)",value:S,label:"Enterprise"})]}),e.jsxs("div",{className:"flex items-center gap-[10px] px-5 py-2 border-b border-border-divider shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-[6px] px-3 py-[6px] rounded-[var(--radius-lg)] bg-bg-card border border-border w-[260px] focus-within:border-[var(--color-status-planning,#9178B5)] transition-colors",children:[e.jsx(ae,{size:13,strokeWidth:2,className:"text-text-tertiary shrink-0"}),e.jsx("input",{type:"text",placeholder:"Search servers...",value:r,onChange:c=>d(c.target.value),className:"border-none bg-transparent outline-none text-[12px] text-text-primary w-full placeholder:text-text-tertiary"})]}),e.jsx("div",{className:"flex gap-[6px]",children:qe.map(c=>{const C=o===c.id;return e.jsxs("button",{type:"button",onClick:()=>i(c.id),className:["flex items-center gap-1 px-[10px] py-1 rounded-full border text-[10px] font-semibold whitespace-nowrap transition-all cursor-pointer",C?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-tertiary border-border hover:border-text-tertiary hover:text-text-secondary"].join(" "),children:[c.color&&!C&&e.jsx("span",{className:"w-[6px] h-[6px] rounded-full",style:{background:c.color}}),c.label,e.jsx("span",{className:"font-mono text-[9px] opacity-60",children:$[c.id]})]},c.id)})}),e.jsx("div",{className:"w-px h-[18px] bg-border-divider"}),e.jsx("div",{className:"flex gap-[6px]",children:["stdio","http"].map(c=>e.jsxs("button",{type:"button",className:"flex items-center gap-1 px-[10px] py-1 rounded-full border border-border bg-bg-card text-[10px] font-semibold text-text-tertiary hover:border-text-tertiary hover:text-text-secondary transition-all cursor-pointer whitespace-nowrap",children:[c.toUpperCase(),e.jsx("span",{className:"font-mono text-[9px] opacity-60",children:c==="stdio"?A:L})]},c))}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button",onClick:()=>s(!0),className:"flex items-center gap-[6px] px-[14px] py-[6px] rounded-[var(--radius-lg)] border border-border bg-bg-card text-[11px] font-semibold text-text-secondary cursor-pointer transition-all hover:border-text-tertiary hover:text-text-primary whitespace-nowrap",children:[e.jsx(Te,{size:13,strokeWidth:2}),"Install Wizard"]}),e.jsxs("button",{type:"button",className:"flex items-center gap-[6px] px-[14px] py-[6px] rounded-[var(--radius-lg)] border-none bg-text-primary text-white text-[11px] font-semibold cursor-pointer transition-all hover:-translate-y-px hover:shadow-md whitespace-nowrap",children:[e.jsx(se,{size:13,strokeWidth:2}),"Add Server"]})]}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("div",{className:"flex-1 overflow-y-auto min-w-0",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap w-[36px]"}),e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap",children:"Name"}),e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap",children:"Command / URL"}),e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap",children:"Scope"}),e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap",children:"CLI"}),e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap w-[50px]",children:"On"}),e.jsx("th",{className:"sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-[14px] py-2 bg-bg-secondary border-b border-border whitespace-nowrap w-[140px]"})]})}),e.jsx("tbody",{children:(()=>{if(!(o==="all"||o==="project"))return n.map(v=>e.jsx(Z,{server:v,selected:a===v.id,onSelect:()=>m(a===v.id?null:v.id),onToggle:()=>g(v),onEdit:()=>N(v),onRemove:()=>j(v)},v.id));const C=n.filter(v=>v.scope==="project"),z=n.filter(v=>v.scope!=="project"),O=new Map;for(const v of C){const R=v.projectPath??"",J=O.get(R)??[];J.push(v),O.set(R,J)}const T=[];for(const v of z)T.push(e.jsx(Z,{server:v,selected:a===v.id,onSelect:()=>m(a===v.id?null:v.id),onToggle:()=>g(v),onEdit:()=>N(v),onRemove:()=>j(v)},v.id));for(const[v,R]of O){const J=Ke(v);T.push(e.jsx(Ze,{folderName:J,fullPath:v,count:R.length},`group:${v}`));for(const P of R)T.push(e.jsx(Z,{server:P,selected:a===P.id,onSelect:()=>m(a===P.id?null:P.id),onToggle:()=>g(P),onEdit:()=>N(P),onRemove:()=>j(P)},P.id))}return T.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"text-center py-8 text-text-tertiary text-[length:var(--font-size-sm)]",children:"No servers found"})}):T})()})]})}),e.jsx(Be,{children:W&&e.jsx(Xe,{server:W,onClose:()=>m(null)})})]})]})}function U({color:t,value:o,label:r}){return e.jsxs("div",{className:"flex items-center gap-[6px]",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:t}}),e.jsx("span",{className:"text-[16px] font-extrabold text-text-primary font-mono",children:o}),e.jsx("span",{className:"text-[10px] font-semibold text-text-tertiary uppercase tracking-[0.04em]",children:r})]})}function Ze({folderName:t,fullPath:o,count:r}){return e.jsx("tr",{className:"group-header-row",children:e.jsx("td",{colSpan:7,className:"px-[14px] py-[6px] bg-[rgba(145,120,181,0.04)] border-b border-border-divider",children:e.jsxs("div",{className:"flex items-center gap-[8px]",children:[e.jsx(Ae,{size:13,strokeWidth:1.8,style:{color:"var(--color-status-planning, #9178B5)",opacity:.7}}),e.jsx("span",{className:"text-[11px] font-bold text-text-secondary",title:o,children:t}),e.jsx("span",{className:"text-[9px] font-mono text-text-tertiary opacity-60",children:r})]})})})}function Z({server:t,selected:o,onSelect:r,onToggle:n,onEdit:a,onRemove:i}){var x;const d=ce[t.scope]??ce.global,m=t.command?`${t.command}${(x=t.args)!=null&&x.length?" "+t.args.join(" "):""}`:t.url??"",b=!t.cli.claude&&t.cli.codex,l=t.cli.claude&&!t.cli.codex;return e.jsxs("tr",{onClick:r,className:["cursor-pointer transition-colors group",o?"[&>td]:bg-[rgba(145,120,181,0.07)]":"hover:[&>td]:bg-bg-hover"].join(" "),children:[e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle",children:e.jsx("div",{className:"w-7 h-7 rounded-[var(--radius-md)] shrink-0 flex items-center justify-center",style:{background:t.transport==="stdio"?"rgba(91,141,184,0.08)":"rgba(145,120,181,0.08)",color:t.transport==="stdio"?"var(--color-accent-blue, #5B8DB8)":"var(--color-status-planning, #9178B5)"},children:t.transport==="stdio"?e.jsx(oe,{size:14,strokeWidth:1.8}):e.jsx(q,{size:14,strokeWidth:1.8})})}),e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle",children:e.jsx("span",{className:"text-[12px] font-semibold text-text-primary",children:t.name})}),e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle",children:e.jsx("span",{className:"font-mono text-[11px] text-text-tertiary max-w-[280px] whitespace-nowrap overflow-hidden text-ellipsis block",children:m})}),e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle whitespace-nowrap",children:e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase tracking-[0.03em] font-mono",style:{background:d.bg,color:d.text},children:t.scope})}),e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle",children:e.jsxs("div",{className:"flex gap-[3px]",children:[e.jsx("span",{className:["w-5 h-4 rounded-[3px] flex items-center justify-center",t.cli.claude?"":"opacity-25"].join(" "),style:{background:"rgba(200,134,58,0.08)",color:"var(--color-status-verifying, #C8863A)"},title:"Claude Code",children:e.jsx(G,{size:11})}),e.jsx("span",{className:["w-5 h-4 rounded-[3px] flex items-center justify-center",t.cli.codex?"":"opacity-25"].join(" "),style:{background:"rgba(90,158,120,0.08)",color:"var(--color-status-completed, #5A9E78)"},title:"Codex CLI",children:e.jsx(V,{size:11})})]})}),e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle text-center",children:e.jsxs("label",{className:"relative inline-block w-8 h-[18px] cursor-pointer",onClick:p=>p.stopPropagation(),children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:n,disabled:t.scope==="enterprise",className:"sr-only peer"}),e.jsx("div",{className:["w-8 h-[18px] rounded-full transition-colors duration-200",t.scope==="enterprise"?"opacity-50 cursor-default":""].join(" "),style:{background:t.enabled?"var(--color-status-completed, #5A9E78)":"var(--color-border, #E8E5DE)"},children:e.jsx("div",{className:"absolute top-[2px] left-[2px] w-[14px] h-[14px] rounded-full bg-white shadow-sm transition-transform duration-200",style:{transform:t.enabled?"translateX(14px)":"translateX(0)"}})})]})}),e.jsx("td",{className:"px-[14px] py-2 border-b border-border-divider align-middle",children:e.jsxs("div",{className:"flex gap-1 items-center opacity-0 group-hover:opacity-100 transition-opacity",onClick:p=>p.stopPropagation(),children:[(l||b)&&e.jsx("button",{type:"button",className:"flex items-center gap-[3px] px-2 py-1 rounded-[5px] border border-border bg-bg-card text-text-tertiary hover:border-[var(--color-accent-blue,#5B8DB8)] hover:text-[var(--color-accent-blue,#5B8DB8)] hover:bg-[rgba(91,141,184,0.04)] transition-all whitespace-nowrap",title:l?"Copy to Codex":"Copy to Claude",children:l?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{size:10,strokeWidth:2.5}),e.jsx("span",{className:"w-[14px] h-[11px] rounded-[2px] flex items-center justify-center",style:{background:"rgba(90,158,120,0.08)",color:"var(--color-status-completed, #5A9E78)"},children:e.jsx(V,{size:9})})]}):e.jsxs(e.Fragment,{children:[e.jsx(ze,{size:10,strokeWidth:2.5}),e.jsx("span",{className:"w-[14px] h-[11px] rounded-[2px] flex items-center justify-center",style:{background:"rgba(200,134,58,0.08)",color:"var(--color-status-verifying, #C8863A)"},children:e.jsx(G,{size:9})})]})}),e.jsx("button",{type:"button",onClick:a,className:"flex items-center gap-1 px-[10px] py-[5px] rounded-[var(--radius-md)] border border-border bg-bg-card text-[10px] font-semibold text-text-secondary hover:border-text-tertiary hover:text-text-primary transition-all",children:e.jsx(Pe,{size:11,strokeWidth:2})}),t.scope!=="enterprise"&&e.jsx("button",{type:"button",onClick:i,className:"flex items-center gap-1 px-[10px] py-[5px] rounded-[var(--radius-md)] border border-border bg-bg-card text-[10px] font-semibold text-status-failed hover:border-status-failed hover:bg-red-50 transition-all",children:e.jsx(Se,{size:11,strokeWidth:2})})]})})]})}function et(t){const o=t.includes("/")?"/":t.includes("\\")?"\\":"/",r=t.endsWith(o)?t.slice(0,-1):t,n=r.lastIndexOf(o);return n>=0?r.slice(n+1):r}const tt={global:{label:"Global Servers",color:"var(--color-accent-blue, #5B8DB8)"},project:{label:"Project Servers",color:"var(--color-status-planning, #9178B5)"},enterprise:{label:"Enterprise Managed",color:"var(--color-status-verifying, #C8863A)"},codex:{label:"Codex Servers",color:"var(--color-status-completed, #5A9E78)"}},de={global:{bg:"rgba(91,141,184,0.12)",text:"var(--color-accent-blue, #5B8DB8)"},project:{bg:"rgba(145,120,181,0.12)",text:"var(--color-status-planning, #9178B5)"},enterprise:{bg:"rgba(200,134,58,0.12)",text:"var(--color-status-verifying, #C8863A)"},codex:{bg:"rgba(90,158,120,0.12)",text:"var(--color-status-completed, #5A9E78)"}},xe={stdio:{bg:"rgba(91,141,184,0.08)",text:"var(--color-accent-blue, #5B8DB8)"},http:{bg:"rgba(145,120,181,0.08)",text:"var(--color-status-planning, #9178B5)"}};function rt(){const t=f(l=>l.servers),o=f(l=>l.scopeFilter),r=f(l=>l.search),n=f(l=>l.selectedServer),a=f(l=>l.setSelectedServer),i=f(l=>l.toggleServer),d=y.useMemo(()=>{let l=t;if(o!=="all"&&(l=l.filter(x=>x.scope===o)),r){const x=r.toLowerCase();l=l.filter(p=>{var s,h;return p.name.toLowerCase().includes(x)||(((s=p.command)==null?void 0:s.toLowerCase().includes(x))??!1)||(((h=p.url)==null?void 0:h.toLowerCase().includes(x))??!1)})}return l},[t,o,r]),m=y.useMemo(()=>{const l=new Map;for(const p of d){const s=l.get(p.scope)??[];s.push(p),l.set(p.scope,s)}const x=[];for(const p of["global","project","enterprise","codex"]){const s=l.get(p);if(s&&s.length>0){const h=tt[p]??{label:p,color:"var(--color-text-tertiary)"},w={scope:p,label:h.label,color:h.color,servers:s};if(p==="project"){const k=new Map;for(const S of s){const A=S.projectPath??"__unknown__",L=k.get(A)??[];L.push(S),k.set(A,L)}w.projectSubGroups=[];for(const[S,A]of k)w.projectSubGroups.push({projectPath:S,folderName:et(S),servers:A})}x.push(w)}}return x},[d]);function b(l){i(l.projectPath??"",l.name,!l.enabled)}return d.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[length:var(--font-size-sm)]",children:"No servers found"}):e.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:m.map((l,x)=>e.jsxs(M.div,{className:"mb-5",initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:x*.06},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-[10px] pb-[6px] border-b border-border-divider",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:l.color}}),e.jsx("span",{className:"text-[12px] font-bold text-text-primary",children:l.label}),e.jsxs("span",{className:"text-[10px] text-text-tertiary font-mono",children:[l.servers.length," server",l.servers.length!==1?"s":""]})]}),l.projectSubGroups?e.jsx("div",{className:"flex flex-col gap-[14px]",children:l.projectSubGroups.map(p=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-[8px] mb-[8px]",children:[e.jsx(Ae,{size:13,strokeWidth:1.8,style:{color:"var(--color-status-planning, #9178B5)",opacity:.7}}),e.jsx("span",{className:"text-[11px] font-bold text-text-secondary",title:p.projectPath,children:p.folderName}),e.jsx("span",{className:"text-[9px] font-mono text-text-tertiary opacity-60",children:p.servers.length})]}),e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-[10px]",children:p.servers.map((s,h)=>e.jsx(pe,{server:s,selected:n===s.id,isEnterprise:!1,delay:h*.04,onSelect:()=>a(n===s.id?null:s.id),onToggle:()=>b(s)},s.id))})]},p.projectPath))}):e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-[10px]",children:l.servers.map((p,s)=>e.jsx(pe,{server:p,selected:n===p.id,isEnterprise:l.scope==="enterprise",delay:s*.04,onSelect:()=>a(n===p.id?null:p.id),onToggle:()=>b(p)},p.id))})]},l.scope))})}function pe({server:t,selected:o,isEnterprise:r,delay:n,onSelect:a,onToggle:i}){var s;const d=de[t.scope]??de.global,m=xe[t.transport]??xe.stdio,b=t.command?`${t.command}${(s=t.args)!=null&&s.length?" "+t.args.join(" "):""}`:t.url??"",l=t.env?Object.keys(t.env):[],x=!t.cli.claude&&t.cli.codex,p=t.cli.claude&&!t.cli.codex;return e.jsxs(M.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,delay:n},onClick:a,className:["bg-bg-card border rounded-[10px] p-[14px] cursor-pointer transition-all duration-200 flex flex-col gap-2",o?"border-[var(--color-status-planning,#9178B5)] shadow-[0_0_0_2px_rgba(145,120,181,0.2)]":"border-border hover:border-text-tertiary hover:shadow-md hover:-translate-y-[2px]"].join(" "),style:r?{borderColor:"rgba(200,134,58,0.3)",background:"rgba(200,134,58,0.04)"}:void 0,children:[e.jsxs("div",{className:"flex items-center gap-[10px]",children:[e.jsx("div",{className:"w-9 h-9 rounded-[var(--radius-lg)] shrink-0 flex items-center justify-center",style:{background:t.transport==="stdio"?"rgba(91,141,184,0.08)":"rgba(145,120,181,0.08)",color:t.transport==="stdio"?"var(--color-accent-blue, #5B8DB8)":"var(--color-status-planning, #9178B5)"},children:t.transport==="stdio"?e.jsx(oe,{size:18,strokeWidth:1.8}):e.jsx(q,{size:18,strokeWidth:1.8})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[13px] font-bold text-text-primary truncate",children:t.name}),e.jsxs("div",{className:"flex gap-[5px] mt-[3px]",children:[e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase tracking-[0.03em] font-mono",style:{background:d.bg,color:d.text},children:t.scope}),e.jsx("span",{className:"text-[9px] font-semibold px-[7px] py-[2px] rounded-[4px] uppercase",style:{background:m.bg,color:m.text},children:t.transport})]})]}),e.jsxs("label",{className:"relative inline-block w-8 h-[18px] shrink-0 cursor-pointer",onClick:h=>h.stopPropagation(),children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:i,disabled:r,className:"sr-only"}),e.jsx("div",{className:["w-8 h-[18px] rounded-full transition-colors duration-200 relative",r?"opacity-50 cursor-default":""].join(" "),style:{background:t.enabled?"var(--color-status-completed, #5A9E78)":"var(--color-border, #E8E5DE)"},children:e.jsx("div",{className:"absolute top-[2px] left-[2px] w-[14px] h-[14px] rounded-full bg-white shadow-sm transition-transform duration-200",style:{transform:t.enabled?"translateX(14px)":"translateX(0)"}})})]})]}),b&&e.jsx("div",{className:"font-mono text-[10px] text-text-secondary bg-bg-secondary rounded-[var(--radius-md)] px-[10px] py-[6px] whitespace-nowrap overflow-hidden text-ellipsis",style:r?{background:"rgba(200,134,58,0.08)"}:void 0,children:r?"managed (read-only)":b}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"flex gap-1 flex-wrap flex-1 min-w-0",children:l.map(h=>e.jsx("span",{className:"text-[9px] font-mono px-[6px] py-[2px] rounded-[4px]",style:{background:"rgba(91,141,184,0.08)",color:"var(--color-accent-blue, #5B8DB8)"},children:h},h))}),e.jsxs("div",{className:"flex gap-[3px] shrink-0 items-center",children:[(p||x)&&e.jsx("button",{type:"button",onClick:h=>h.stopPropagation(),className:"flex items-center gap-[3px] px-[7px] py-[3px] rounded-[4px] border border-border bg-bg-card text-text-tertiary transition-all hover:border-[var(--color-accent-blue,#5B8DB8)] hover:text-[var(--color-accent-blue,#5B8DB8)] hover:bg-[rgba(91,141,184,0.04)]",title:p?"Copy to Codex":"Copy to Claude",children:p?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{size:9,strokeWidth:2.5}),e.jsx(V,{size:11,style:{color:"var(--color-status-completed, #5A9E78)"}})]}):e.jsxs(e.Fragment,{children:[e.jsx(ze,{size:9,strokeWidth:2.5}),e.jsx(G,{size:11,style:{color:"var(--color-status-verifying, #C8863A)"}})]})}),e.jsxs("div",{className:"flex gap-[3px]",children:[e.jsx("span",{className:["w-5 h-4 rounded-[3px] flex items-center justify-center",t.cli.claude?"":"opacity-25"].join(" "),style:{background:"rgba(200,134,58,0.08)",color:"var(--color-status-verifying, #C8863A)"},title:"Claude Code",children:e.jsx(G,{size:11})}),e.jsx("span",{className:["w-5 h-4 rounded-[3px] flex items-center justify-center",t.cli.codex?"":"opacity-25"].join(" "),style:{background:"rgba(90,158,120,0.08)",color:"var(--color-status-completed, #5A9E78)"},title:"Codex CLI",children:e.jsx(V,{size:11})})]})]})]})]})}const me={database:{icon:e.jsx(Ie,{size:18,strokeWidth:1.8}),bg:"rgba(91,141,184,0.08)",color:"var(--color-accent-blue, #5B8DB8)"},search:{icon:e.jsx(ae,{size:18,strokeWidth:1.8}),bg:"rgba(145,120,181,0.08)",color:"var(--color-status-planning, #9178B5)"},code:{icon:e.jsx(Re,{size:18,strokeWidth:1.8}),bg:"rgba(90,158,120,0.08)",color:"var(--color-status-completed, #5A9E78)"},filesystem:{icon:e.jsx(De,{size:18,strokeWidth:1.8}),bg:"rgba(184,149,64,0.08)",color:"var(--color-status-idle, #B89540)"},api:{icon:e.jsx(q,{size:18,strokeWidth:1.8}),bg:"rgba(200,134,58,0.08)",color:"var(--color-status-verifying, #C8863A)"},utility:{icon:e.jsx(Ye,{size:18,strokeWidth:1.8}),bg:"rgba(160,157,151,0.08)",color:"var(--color-text-tertiary, #A09D97)"}},st={database:{bg:"rgba(91,141,184,0.12)",color:"var(--color-accent-blue, #5B8DB8)"},sql:{bg:"rgba(90,158,120,0.12)",color:"var(--color-status-completed, #5A9E78)"},search:{bg:"rgba(145,120,181,0.12)",color:"var(--color-status-planning, #9178B5)"},code:{bg:"rgba(90,158,120,0.12)",color:"var(--color-status-completed, #5A9E78)"},tools:{bg:"rgba(90,158,120,0.12)",color:"var(--color-status-completed, #5A9E78)"},filesystem:{bg:"rgba(184,149,64,0.12)",color:"var(--color-status-idle, #B89540)"},files:{bg:"rgba(184,149,64,0.12)",color:"var(--color-status-idle, #B89540)"},api:{bg:"rgba(200,134,58,0.12)",color:"var(--color-status-verifying, #C8863A)"},web:{bg:"rgba(200,134,58,0.12)",color:"var(--color-status-verifying, #C8863A)"},docs:{bg:"rgba(145,120,181,0.12)",color:"var(--color-status-planning, #9178B5)"},research:{bg:"rgba(200,134,58,0.12)",color:"var(--color-status-verifying, #C8863A)"}},ot={database:"var(--color-accent-blue, #5B8DB8)",search:"var(--color-status-planning, #9178B5)",code:"var(--color-status-completed, #5A9E78)",filesystem:"var(--color-status-idle, #B89540)",api:"var(--color-status-verifying, #C8863A)",utility:"var(--color-text-tertiary, #A09D97)"};function at(){const t=f(s=>s.templates),o=f(s=>s.categories),r=f(s=>s.servers),n=f(s=>s.templateSearch),a=f(s=>s.templateCategory),i=y.useMemo(()=>{let s=t;if(a&&(s=s.filter(h=>h.category===a)),n){const h=n.toLowerCase();s=s.filter(w=>{var k;return w.name.toLowerCase().includes(h)||(((k=w.description)==null?void 0:k.toLowerCase().includes(h))??!1)})}return s},[t,n,a]),d=f(s=>s.setTemplateSearch),m=f(s=>s.setTemplateCategory),b=f(s=>s.installTemplate),l=y.useMemo(()=>new Set(r.map(s=>s.name.toLowerCase())),[r]),x=y.useMemo(()=>{const s={};for(const h of t)h.category&&(s[h.category]=(s[h.category]??0)+1);return s},[t]),p=y.useMemo(()=>t.filter(s=>l.has(s.name.toLowerCase())).length,[t,l]);return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center gap-5 px-5 py-2 border-b border-border-divider bg-bg-primary shrink-0",children:[e.jsx(ee,{color:"var(--color-status-planning, #9178B5)",value:t.length,label:"Templates"}),e.jsx(ee,{color:"var(--color-accent-blue, #5B8DB8)",value:o.length,label:"Categories"}),e.jsx(ee,{color:"var(--color-status-completed, #5A9E78)",value:p,label:"Installed"})]}),e.jsxs("div",{className:"flex items-center gap-[10px] px-5 py-2 border-b border-border-divider shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-[6px] px-3 py-[6px] rounded-[var(--radius-lg)] bg-bg-card border border-border w-[260px] focus-within:border-[var(--color-status-planning,#9178B5)] transition-colors",children:[e.jsx(ae,{size:13,strokeWidth:2,className:"text-text-tertiary shrink-0"}),e.jsx("input",{type:"text",placeholder:"Search templates...",value:n,onChange:s=>d(s.target.value),className:"border-none bg-transparent outline-none text-[12px] text-text-primary w-full placeholder:text-text-tertiary"})]}),e.jsxs("div",{className:"flex gap-[6px]",children:[e.jsxs("button",{type:"button",onClick:()=>m(null),className:["flex items-center gap-1 px-[10px] py-1 rounded-full border text-[10px] font-semibold whitespace-nowrap transition-all cursor-pointer",a===null?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-tertiary border-border hover:border-text-tertiary hover:text-text-secondary"].join(" "),children:["All",e.jsx("span",{className:"font-mono text-[9px] opacity-60",children:t.length})]}),o.map(s=>{const h=a===s,w=ot[s.toLowerCase()];return e.jsxs("button",{type:"button",onClick:()=>m(h?null:s),className:["flex items-center gap-1 px-[10px] py-1 rounded-full border text-[10px] font-semibold whitespace-nowrap transition-all cursor-pointer",h?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-tertiary border-border hover:border-text-tertiary hover:text-text-secondary"].join(" "),children:[w&&!h&&e.jsx("span",{className:"w-[6px] h-[6px] rounded-full",style:{background:w}}),s,e.jsx("span",{className:"font-mono text-[9px] opacity-60",children:x[s]??0})]},s)})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button",className:"flex items-center gap-[6px] px-[14px] py-[6px] rounded-[var(--radius-lg)] border-none bg-text-primary text-white text-[11px] font-semibold cursor-pointer transition-all hover:-translate-y-px hover:shadow-md whitespace-nowrap",children:[e.jsx(se,{size:13,strokeWidth:2}),"New Template"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:i.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-[length:var(--font-size-sm)]",children:"No templates found"}):e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(300px,1fr))] gap-3",children:i.map((s,h)=>e.jsx(nt,{template:s,installed:l.has(s.name.toLowerCase()),delay:h*.04,onInstall:()=>void b(s.name)},s.id))})})]})}function ee({color:t,value:o,label:r}){return e.jsxs("div",{className:"flex items-center gap-[6px]",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:t}}),e.jsx("span",{className:"text-[16px] font-extrabold text-text-primary font-mono",children:o}),e.jsx("span",{className:"text-[10px] font-semibold text-text-tertiary uppercase tracking-[0.04em]",children:r})]})}function nt({template:t,installed:o,delay:r,onInstall:n}){var m,b;const a=((m=t.category)==null?void 0:m.toLowerCase())??"",i=me[a]??me.utility,d=t.serverConfig.command?`${t.serverConfig.command}${(b=t.serverConfig.args)!=null&&b.length?" "+t.serverConfig.args.join(" "):""}`:"";return e.jsxs(M.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,delay:r},className:"bg-bg-card border border-border rounded-[10px] p-[14px] transition-all duration-200 cursor-pointer flex flex-col gap-[10px] hover:border-text-tertiary hover:shadow-md hover:-translate-y-[2px]",children:[e.jsxs("div",{className:"flex items-start gap-[10px]",children:[e.jsx("div",{className:"w-9 h-9 rounded-[var(--radius-lg)] shrink-0 flex items-center justify-center",style:{background:i.bg,color:i.color},children:i.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[13px] font-bold text-text-primary",children:t.name}),t.description&&e.jsx("div",{className:"text-[11px] text-text-secondary leading-[1.5] mt-[2px] line-clamp-2",children:t.description})]})]}),d&&e.jsx("div",{className:"font-mono text-[10px] text-text-secondary bg-bg-secondary rounded-[var(--radius-md)] px-[10px] py-[6px] whitespace-nowrap overflow-hidden text-ellipsis",children:d}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex gap-1 flex-wrap",children:(t.tags??[]).map(l=>{const x=st[l.toLowerCase()]??{bg:"rgba(160,157,151,0.12)",color:"var(--color-text-tertiary)"};return e.jsx("span",{className:"text-[9px] font-semibold px-[6px] py-[2px] rounded-[4px] uppercase tracking-[0.03em]",style:{background:x.bg,color:x.color},children:l},l)})}),o?e.jsxs("span",{className:"flex items-center gap-1 px-[10px] py-1 rounded-[var(--radius-md)] border text-[10px] font-semibold whitespace-nowrap",style:{borderColor:"var(--color-status-completed, #5A9E78)",color:"var(--color-status-completed, #5A9E78)",background:"rgba(90,158,120,0.06)"},children:[e.jsx(We,{size:10,strokeWidth:2.5}),"Installed"]}):e.jsxs("button",{type:"button",onClick:l=>{l.stopPropagation(),n()},className:"flex items-center gap-1 px-[10px] py-1 rounded-[var(--radius-md)] border border-border bg-bg-card text-[10px] font-semibold text-text-secondary transition-all hover:border-[var(--color-status-completed,#5A9E78)] hover:text-[var(--color-status-completed,#5A9E78)] hover:bg-[rgba(90,158,120,0.04)] whitespace-nowrap cursor-pointer",children:[e.jsx(Te,{size:10,strokeWidth:2.5}),"Install"]})]})]})}const be={global:{bg:"rgba(91,141,184,0.12)",text:"var(--color-accent-blue, #5B8DB8)"},project:{bg:"rgba(145,120,181,0.12)",text:"var(--color-status-planning, #9178B5)"},enterprise:{bg:"rgba(200,134,58,0.12)",text:"var(--color-status-verifying, #C8863A)"},codex:{bg:"rgba(90,158,120,0.12)",text:"var(--color-status-completed, #5A9E78)"}};function lt(){const t=f(n=>n.editingServer),o=f(n=>n.setEditingServer),r=f(n=>n.updateServer);return t?e.jsx(ye,{open:!!t,onOpenChange:n=>{n||o(null)},children:e.jsxs(je,{children:[e.jsx(Ne,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),e.jsxs(we,{className:B("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-[560px] max-w-[95vw] max-h-[85vh]","rounded-[var(--radius-lg)] border border-border bg-bg-primary shadow-lg","flex flex-col overflow-hidden","focus:outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ce,{className:"text-[14px] font-semibold text-text-primary",children:"Edit Server"}),e.jsx(ct,{scope:t.scope})]}),e.jsx(ke,{className:B("w-7 h-7 flex items-center justify-center rounded-[var(--radius-sm)]","text-text-tertiary hover:text-text-primary hover:bg-bg-hover","transition-colors"),"aria-label":"Close",children:e.jsx(ve,{size:14,strokeWidth:2})})]}),e.jsx(it,{server:t,onSave:n=>void r(t,n),onCancel:()=>o(null)})]})]})}):null}function it({server:t,onSave:o,onCancel:r}){var W;const n=t.transport==="stdio",a=t.scope==="enterprise",[i,d]=y.useState(t.command??""),[m,b]=y.useState(((W=t.args)==null?void 0:W.join(" "))??""),[l,x]=y.useState(t.url??""),[p,s]=y.useState(()=>t.env?Object.entries(t.env).map(([g,j])=>({key:g,value:j})):[]),[h,w]=y.useState(!1),k=y.useMemo(()=>()=>{const g={...t.raw};if(n){g.command=i;const N=m.trim().split(/\s+/).filter(Boolean);N.length>0?g.args=N:delete g.args,delete g.url}else g.url=l,delete g.command,delete g.args;delete g.env;const j={};for(const N of p)N.key.trim()&&(j[N.key.trim()]=N.value);return Object.keys(j).length>0&&(g.env=j),delete g.enabled,g},[t.raw,n,i,m,l,p]);function S(){w(!0),o(k())}function A(){s(g=>[...g,{key:"",value:""}])}function L(g){s(j=>j.filter((N,c)=>c!==g))}function $(g,j,N){s(c=>c.map((C,z)=>z===g?{...C,[j]:N}:C))}return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:[e.jsx(D,{label:"Server Name",children:e.jsx("input",{type:"text",value:t.name,readOnly:!0,className:"w-full px-3 py-2 rounded-[var(--radius-md)] border border-border bg-bg-secondary text-[12px] text-text-tertiary font-mono cursor-not-allowed"})}),e.jsx(D,{label:"Transport",children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase tracking-[0.03em] font-mono",style:{background:n?"rgba(91,141,184,0.08)":"rgba(145,120,181,0.08)",color:n?"var(--color-accent-blue, #5B8DB8)":"var(--color-status-planning, #9178B5)"},children:t.transport})})}),a&&e.jsx("div",{className:"mb-4 px-3 py-2 rounded-[var(--radius-md)] border border-[var(--color-status-verifying,#C8863A)] bg-[rgba(200,134,58,0.06)] text-[11px] text-[var(--color-status-verifying,#C8863A)]",children:"Enterprise-managed servers cannot be edited from the dashboard."}),n&&e.jsx(D,{label:"Command",children:e.jsx("input",{type:"text",value:i,onChange:g=>d(g.target.value),disabled:a,placeholder:"e.g. npx",className:F})}),n&&e.jsx(D,{label:"Arguments",children:e.jsx("input",{type:"text",value:m,onChange:g=>b(g.target.value),disabled:a,placeholder:"space-separated arguments",className:F})}),!n&&e.jsx(D,{label:"URL",children:e.jsx("input",{type:"text",value:l,onChange:g=>x(g.target.value),disabled:a,placeholder:"https://...",className:F})}),e.jsx(D,{label:"Environment Variables",children:e.jsxs("div",{className:"space-y-2",children:[p.map((g,j)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:g.key,onChange:N=>$(j,"key",N.target.value),disabled:a,placeholder:"KEY",className:B(F,"w-[160px] shrink-0 font-mono text-[11px]")}),e.jsx("input",{type:"text",value:g.value,onChange:N=>$(j,"value",N.target.value),disabled:a,placeholder:"value",className:B(F,"flex-1 font-mono text-[11px]")}),!a&&e.jsx("button",{type:"button",onClick:()=>L(j),className:"shrink-0 w-6 h-6 flex items-center justify-center rounded-[var(--radius-sm)] text-text-tertiary hover:text-status-failed hover:bg-red-50 transition-colors",children:e.jsx(_e,{size:12,strokeWidth:2})})]},j)),!a&&e.jsxs("button",{type:"button",onClick:A,className:"flex items-center gap-1 px-2 py-1 text-[10px] font-semibold text-text-tertiary hover:text-text-primary transition-colors",children:[e.jsx(se,{size:11,strokeWidth:2}),"Add variable"]})]})})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-border shrink-0",children:[e.jsx("button",{type:"button",onClick:r,className:"px-4 py-[6px] rounded-[var(--radius-md)] border border-border bg-bg-card text-[11px] font-semibold text-text-secondary hover:text-text-primary transition-colors",children:"Cancel"}),e.jsx("button",{type:"button",onClick:S,disabled:h||a,className:B("px-4 py-[6px] rounded-[var(--radius-md)] border-none bg-text-primary text-white text-[11px] font-semibold transition-all","hover:-translate-y-px hover:shadow-md",(h||a)&&"opacity-50 cursor-not-allowed hover:translate-y-0 hover:shadow-none"),children:h?"Saving...":"Save Changes"})]})]})}const F=B("w-full px-3 py-2 rounded-[var(--radius-md)] border border-border bg-bg-card","text-[12px] text-text-primary outline-none","focus:border-[var(--color-status-planning,#9178B5)] transition-colors","placeholder:text-text-tertiary","disabled:opacity-50 disabled:cursor-not-allowed");function D({label:t,children:o}){return e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-[0.05em] text-text-tertiary mb-[6px]",children:t}),o]})}function ct({scope:t}){const o=be[t]??be.global;return e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase tracking-[0.03em] font-mono",style:{background:o.bg,color:o.text},children:t})}const ue=[{id:"mode",label:"Mode"},{id:"configure",label:"Configure"},{id:"review",label:"Review"},{id:"progress",label:"Install"}];function dt({current:t}){const o=ue.findIndex(r=>r.id===t);return e.jsx("div",{className:"flex items-center gap-1 px-1",children:ue.map((r,n)=>{const a=n<o,i=n===o;return e.jsxs("div",{className:"flex items-center gap-1",children:[n>0&&e.jsx("div",{className:"w-8 h-px",style:{background:a?"var(--color-status-completed, #5A9E78)":"var(--color-border, #E8E5DE)"}}),e.jsxs("div",{className:"flex items-center gap-[6px]",children:[e.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-bold font-mono",style:{background:a?"var(--color-status-completed, #5A9E78)":i?"var(--color-text-primary, #1A1917)":"var(--color-bg-card, #F8F7F5)",color:a||i?"#fff":"var(--color-text-tertiary)",border:!a&&!i?"1px solid var(--color-border, #E8E5DE)":"none"},children:a?e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}):n+1}),e.jsx("span",{className:"text-[11px] font-semibold whitespace-nowrap",style:{color:i?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:r.label})]})]},r.id)})})}function xt(){const t=u(x=>x.mode),o=u(x=>x.setMode),r=u(x=>x.projectPath),n=u(x=>x.setProjectPath),a=u(x=>x.detecting),i=u(x=>x.error),d=u(x=>x.detect),m=u(x=>x.manifests),b=u(x=>x.fetchManifests);y.useEffect(()=>{b()},[b]);const l=t==="global"||t==="project"&&r.trim().length>0;return e.jsxs("div",{className:"flex flex-col gap-6 max-w-[520px] mx-auto py-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-[14px] font-semibold text-text-primary mb-1",children:"Installation Mode"}),e.jsx("p",{className:"text-[12px] text-text-tertiary",children:"Choose where to install maestro commands, agents, and workflows."})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(he,{selected:t==="global",onClick:()=>o("global"),title:"Global",description:"Install to home directory (~/.claude/, ~/.maestro/). Available across all projects.",recommended:!0}),e.jsx(he,{selected:t==="project",onClick:()=>o("project"),title:"Project",description:"Install to a specific project directory. Commands are project-scoped."})]}),t==="project"&&e.jsxs("div",{className:"flex flex-col gap-[6px]",children:[e.jsx("label",{className:"text-[11px] font-semibold text-text-secondary uppercase tracking-[0.04em]",children:"Project Path"}),e.jsx("input",{type:"text",value:r,onChange:x=>n(x.target.value),placeholder:"/path/to/your/project",className:"w-full px-3 py-2 rounded-[var(--radius-md)] border border-border bg-bg-card text-[12px] text-text-primary placeholder:text-text-tertiary focus:outline-none focus:border-[var(--color-status-planning,#9178B5)] transition-colors"})]}),m.length>0&&e.jsxs("div",{className:"rounded-[var(--radius-md)] border border-border bg-[rgba(184,149,64,0.04)] px-4 py-3",children:[e.jsx("p",{className:"text-[11px] font-semibold text-[var(--color-status-executing,#B89540)] mb-1",children:"Existing installations found"}),e.jsx("div",{className:"flex flex-col gap-1",children:m.slice(0,3).map(x=>e.jsxs("p",{className:"text-[10px] text-text-tertiary font-mono",children:[x.scope," — v",x.version," — ",new Date(x.installedAt).toLocaleDateString()]},x.id))})]}),i&&e.jsx("div",{className:"rounded-[var(--radius-md)] border border-[rgba(196,101,85,0.3)] bg-[rgba(196,101,85,0.04)] px-4 py-3",children:e.jsx("p",{className:"text-[11px] text-status-failed",children:i})}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsx("button",{type:"button",disabled:!l||a,onClick:()=>void d(),className:"flex items-center gap-[6px] px-5 py-[8px] rounded-[var(--radius-lg)] border-none bg-text-primary text-white text-[12px] font-semibold cursor-pointer transition-all hover:-translate-y-px hover:shadow-md disabled:opacity-40 disabled:cursor-default disabled:transform-none",children:a?e.jsxs(e.Fragment,{children:[e.jsx(pt,{}),"Scanning..."]}):"Next"})})]})}function he({selected:t,onClick:o,title:r,description:n,recommended:a}){return e.jsxs("button",{type:"button",onClick:o,className:"flex items-start gap-3 p-4 rounded-[var(--radius-lg)] border text-left transition-all cursor-pointer w-full",style:{borderColor:t?"var(--color-text-primary, #1A1917)":"var(--color-border, #E8E5DE)",background:t?"rgba(26,25,23,0.02)":"var(--color-bg-card, #F8F7F5)"},children:[e.jsx("div",{className:"w-[18px] h-[18px] rounded-full border-2 flex items-center justify-center shrink-0 mt-[1px]",style:{borderColor:t?"var(--color-text-primary, #1A1917)":"var(--color-border, #E8E5DE)"},children:t&&e.jsx("div",{className:"w-[10px] h-[10px] rounded-full",style:{background:"var(--color-text-primary, #1A1917)"}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[13px] font-semibold text-text-primary",children:r}),a&&e.jsx("span",{className:"text-[8px] font-bold px-[6px] py-[1px] rounded-full bg-[rgba(90,158,120,0.1)] text-[var(--color-status-completed,#5A9E78)] uppercase tracking-wider",children:"Recommended"})]}),e.jsx("p",{className:"text-[11px] text-text-tertiary mt-[2px] leading-[1.4]",children:n})]})]})}function pt(){return e.jsxs("svg",{className:"animate-spin w-[14px] h-[14px]",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",opacity:"0.3"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}function mt(){const t=u(s=>s.detection),o=u(s=>s.selectedComponents),r=u(s=>s.toggleComponent),n=u(s=>s.selectAllComponents),a=u(s=>s.backup),i=u(s=>s.setBackup),d=u(s=>s.mcpEnabled),m=u(s=>s.setMcpEnabled),b=u(s=>s.enabledTools),l=u(s=>s.toggleTool),x=u(s=>s.setStep);if(!t)return null;const p=t.components.filter(s=>s.available).every(s=>o.has(s.id));return e.jsxs("div",{className:"flex flex-col gap-5 max-w-[560px] mx-auto py-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-[13px] font-semibold text-text-primary",children:"Components"}),e.jsx("button",{type:"button",onClick:n,className:"text-[10px] font-semibold text-text-tertiary hover:text-text-primary transition-colors cursor-pointer",children:p?"All selected":"Select all"})]}),e.jsxs("div",{className:"flex flex-col gap-[6px]",children:[t.components.map(s=>e.jsxs("label",{className:"flex items-center gap-3 px-3 py-[10px] rounded-[var(--radius-md)] border border-border bg-bg-card cursor-pointer hover:bg-bg-hover transition-colors",style:{opacity:s.available?1:.4,pointerEvents:s.available?"auto":"none"},children:[e.jsx("input",{type:"checkbox",checked:o.has(s.id),onChange:()=>r(s.id),disabled:!s.available,className:"w-[14px] h-[14px] accent-[var(--color-text-primary,#1A1917)] cursor-pointer"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-[12px] font-semibold text-text-primary",children:s.label}),e.jsxs("span",{className:"text-[10px] text-text-tertiary ml-2 font-mono",children:[s.fileCount," files"]})]}),e.jsx("span",{className:"text-[9px] text-text-tertiary font-mono max-w-[200px] truncate",title:s.targetDir,children:s.targetDir.replace(/\\/g,"/").replace(/^.*\/\./,"~/.")})]},s.id)),e.jsxs("label",{className:"flex items-center gap-3 px-3 py-[10px] rounded-[var(--radius-md)] border border-border bg-bg-card cursor-pointer hover:bg-bg-hover transition-colors",children:[e.jsx("input",{type:"checkbox",checked:o.has("mcp"),onChange:()=>r("mcp"),className:"w-[14px] h-[14px] accent-[var(--color-text-primary,#1A1917)] cursor-pointer"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-[12px] font-semibold text-text-primary",children:"MCP Server"}),e.jsx("span",{className:"text-[10px] text-text-tertiary ml-2",children:"Register maestro-tools MCP"})]})]})]})]}),t.existingManifest&&e.jsxs("div",{className:"rounded-[var(--radius-md)] border border-[rgba(184,149,64,0.3)] bg-[rgba(184,149,64,0.04)] px-4 py-3",children:[e.jsxs("p",{className:"text-[11px] font-semibold text-[var(--color-status-executing,#B89540)] mb-2",children:["Existing installation (v",t.existingManifest.version,") will be overwritten"]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:a,onChange:s=>i(s.target.checked),className:"w-[14px] h-[14px] accent-[var(--color-status-executing,#B89540)] cursor-pointer"}),e.jsx("span",{className:"text-[11px] text-text-secondary",children:"Create backup before installing"})]})]}),o.has("mcp")&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-[13px] font-semibold text-text-primary",children:"MCP Tools"}),e.jsxs("label",{className:"flex items-center gap-[6px] cursor-pointer ml-auto",children:[e.jsx("input",{type:"checkbox",checked:d,onChange:s=>m(s.target.checked),className:"w-[13px] h-[13px] accent-[var(--color-text-primary,#1A1917)] cursor-pointer"}),e.jsx("span",{className:"text-[10px] text-text-secondary font-semibold",children:"Enable MCP"})]})]}),d&&e.jsx("div",{className:"flex flex-wrap gap-[6px]",children:re.map(s=>e.jsx("button",{type:"button",onClick:()=>l(s),className:"px-[10px] py-[5px] rounded-full border text-[10px] font-mono font-semibold transition-all cursor-pointer",style:{borderColor:b.has(s)?"var(--color-text-primary)":"var(--color-border)",background:b.has(s)?"var(--color-text-primary)":"var(--color-bg-card)",color:b.has(s)?"#fff":"var(--color-text-tertiary)"},children:s},s))})]}),t.disabledItems.length>0&&e.jsxs("div",{className:"rounded-[var(--radius-md)] border border-border bg-bg-card px-4 py-3",children:[e.jsxs("p",{className:"text-[11px] font-semibold text-text-secondary mb-1",children:[t.disabledItems.length," disabled item(s) will be preserved"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.disabledItems.map(s=>e.jsxs("span",{className:"text-[9px] font-mono text-text-tertiary px-[6px] py-[2px] rounded bg-bg-secondary",children:[s.name," (",s.type,")"]},s.relativePath))})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx("button",{type:"button",onClick:()=>x("mode"),className:"px-4 py-[7px] rounded-[var(--radius-lg)] border border-border bg-bg-card text-[12px] font-semibold text-text-secondary hover:text-text-primary hover:border-text-tertiary transition-all cursor-pointer",children:"Back"}),e.jsx("button",{type:"button",onClick:()=>x("review"),disabled:o.size===0,className:"px-5 py-[8px] rounded-[var(--radius-lg)] border-none bg-text-primary text-white text-[12px] font-semibold cursor-pointer transition-all hover:-translate-y-px hover:shadow-md disabled:opacity-40 disabled:cursor-default disabled:transform-none",children:"Review"})]})]})}function bt(){const t=u(s=>s.mode),o=u(s=>s.projectPath),r=u(s=>s.detection),n=u(s=>s.selectedComponents),a=u(s=>s.backup),i=u(s=>s.mcpEnabled),d=u(s=>s.enabledTools),m=u(s=>s.setStep),b=u(s=>s.install);if(!r)return null;const l=r.components.filter(s=>s.available&&n.has(s.id)),x=l.reduce((s,h)=>s+h.fileCount,0),p=n.has("mcp");return e.jsxs("div",{className:"flex flex-col gap-5 max-w-[560px] mx-auto py-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-[14px] font-semibold text-text-primary mb-1",children:"Review Installation"}),e.jsx("p",{className:"text-[12px] text-text-tertiary",children:"Confirm the following will be installed."})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(X,{label:"Mode",value:t}),e.jsx(X,{label:"Components",value:String(l.length+(p?1:0))}),e.jsx(X,{label:"Files",value:String(x)}),e.jsx(X,{label:"Backup",value:a&&r.existingManifest?"Yes":"No"})]}),t==="project"&&o&&e.jsxs("div",{className:"flex gap-2 items-center text-[11px]",children:[e.jsx("span",{className:"font-semibold text-text-secondary",children:"Project:"}),e.jsx("span",{className:"font-mono text-text-tertiary",children:o})]}),e.jsx("div",{className:"rounded-[var(--radius-md)] border border-border overflow-hidden",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left text-[9px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-3 py-[6px] bg-bg-secondary border-b border-border",children:"Component"}),e.jsx("th",{className:"text-left text-[9px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-3 py-[6px] bg-bg-secondary border-b border-border",children:"Target"}),e.jsx("th",{className:"text-right text-[9px] font-semibold uppercase tracking-[0.05em] text-text-tertiary px-3 py-[6px] bg-bg-secondary border-b border-border w-[60px]",children:"Files"})]})}),e.jsxs("tbody",{children:[l.map(s=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2 border-b border-border-divider text-[11px] font-semibold text-text-primary",children:s.label}),e.jsx("td",{className:"px-3 py-2 border-b border-border-divider text-[10px] font-mono text-text-tertiary max-w-[250px] truncate",title:s.targetDir,children:s.targetDir.replace(/\\/g,"/").replace(/^.*\/\./,"~/.")}),e.jsx("td",{className:"px-3 py-2 border-b border-border-divider text-[11px] font-mono text-text-secondary text-right",children:s.fileCount})]},s.id)),p&&e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2 border-b border-border-divider text-[11px] font-semibold text-text-primary",children:"MCP Server"}),e.jsx("td",{className:"px-3 py-2 border-b border-border-divider text-[10px] font-mono text-text-tertiary",children:t==="project"?".mcp.json":"~/.claude.json"}),e.jsx("td",{className:"px-3 py-2 border-b border-border-divider text-[11px] font-mono text-text-secondary text-right",children:"—"})]})]})]})}),p&&i&&e.jsxs("div",{className:"rounded-[var(--radius-md)] border border-border bg-bg-card px-4 py-3",children:[e.jsx("p",{className:"text-[10px] font-semibold text-text-secondary uppercase tracking-[0.04em] mb-1",children:"MCP Tools"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:Array.from(d).map(s=>e.jsx("span",{className:"text-[9px] font-mono font-semibold px-[7px] py-[2px] rounded-full bg-[rgba(90,158,120,0.08)] text-[var(--color-status-completed,#5A9E78)]",children:s},s))})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx("button",{type:"button",onClick:()=>m("configure"),className:"px-4 py-[7px] rounded-[var(--radius-lg)] border border-border bg-bg-card text-[12px] font-semibold text-text-secondary hover:text-text-primary hover:border-text-tertiary transition-all cursor-pointer",children:"Back"}),e.jsx("button",{type:"button",onClick:()=>void b(),className:"px-5 py-[8px] rounded-[var(--radius-lg)] border-none bg-[var(--color-status-completed,#5A9E78)] text-white text-[12px] font-semibold cursor-pointer transition-all hover:-translate-y-px hover:shadow-md",children:"Install"})]})]})}function X({label:t,value:o}){return e.jsxs("div",{className:"flex-1 rounded-[var(--radius-md)] border border-border bg-bg-card px-3 py-2 text-center",children:[e.jsx("div",{className:"text-[14px] font-extrabold text-text-primary font-mono capitalize",children:o}),e.jsx("div",{className:"text-[9px] font-semibold text-text-tertiary uppercase tracking-[0.04em]",children:t})]})}function ut(){const t=u(a=>a.installing),o=u(a=>a.result),r=u(a=>a.setOpen),n=u(a=>a.reset);return t?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-16",children:[e.jsxs("svg",{className:"animate-spin w-8 h-8 text-text-primary",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",opacity:"0.15"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]}),e.jsx("p",{className:"text-[13px] font-semibold text-text-primary",children:"Installing..."}),e.jsx("p",{className:"text-[11px] text-text-tertiary",children:"Copying files and registering configuration"})]}):o?o.success?e.jsxs("div",{className:"flex flex-col items-center gap-5 py-10 max-w-[440px] mx-auto",children:[e.jsx("div",{className:"w-12 h-12 rounded-full flex items-center justify-center",style:{background:"rgba(90,158,120,0.1)"},children:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-status-completed, #5A9E78)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-[14px] font-semibold text-text-primary mb-1",children:"Installation Complete"}),e.jsx("p",{className:"text-[11px] text-text-tertiary",children:"All components installed successfully."})]}),e.jsxs("div",{className:"w-full rounded-[var(--radius-md)] border border-border bg-bg-card overflow-hidden",children:[e.jsx(I,{label:"Files installed",value:String(o.filesInstalled)}),e.jsx(I,{label:"Directories created",value:String(o.dirsCreated)}),e.jsx(I,{label:"Components",value:o.components.join(", ")}),o.disabledItemsRestored>0&&e.jsx(I,{label:"Disabled items restored",value:String(o.disabledItemsRestored)}),e.jsx(I,{label:"MCP registered",value:o.mcpRegistered?"Yes":"No"}),e.jsx(I,{label:"Manifest",value:o.manifestPath.replace(/\\/g,"/").split("/").slice(-1)[0],last:!0})]}),e.jsx("button",{type:"button",onClick:()=>r(!1),className:"px-5 py-[8px] rounded-[var(--radius-lg)] border-none bg-text-primary text-white text-[12px] font-semibold cursor-pointer transition-all hover:-translate-y-px hover:shadow-md",children:"Done"})]}):e.jsxs("div",{className:"flex flex-col items-center gap-5 py-10 max-w-[440px] mx-auto",children:[e.jsx("div",{className:"w-12 h-12 rounded-full flex items-center justify-center",style:{background:"rgba(196,101,85,0.1)"},children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-status-failed, #C46555)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-[14px] font-semibold text-text-primary mb-1",children:"Installation Failed"}),e.jsx("p",{className:"text-[11px] text-status-failed",children:o.error})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{type:"button",onClick:n,className:"px-4 py-[7px] rounded-[var(--radius-lg)] border border-border bg-bg-card text-[12px] font-semibold text-text-secondary hover:text-text-primary transition-all cursor-pointer",children:"Try Again"}),e.jsx("button",{type:"button",onClick:()=>r(!1),className:"px-4 py-[7px] rounded-[var(--radius-lg)] border-none bg-text-primary text-white text-[12px] font-semibold cursor-pointer transition-all",children:"Close"})]})]}):null}function I({label:t,value:o,last:r}){return e.jsxs("div",{className:"flex items-center justify-between px-4 py-[8px]",style:{borderBottom:r?"none":"1px solid var(--color-border-divider)"},children:[e.jsx("span",{className:"text-[10px] font-semibold text-text-tertiary uppercase tracking-[0.04em]",children:t}),e.jsx("span",{className:"text-[11px] font-mono text-text-primary",children:o})]})}function ht(){const t=u(a=>a.open),o=u(a=>a.setOpen),r=u(a=>a.step),n=u(a=>a.installing);return e.jsx(ye,{open:t,onOpenChange:a=>{!a&&n||o(a)},children:e.jsxs(je,{children:[e.jsx(Ne,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),e.jsxs(we,{className:B("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-[640px] max-w-[95vw] max-h-[85vh]","rounded-[var(--radius-lg)] border border-border bg-bg-primary shadow-lg","flex flex-col overflow-hidden","focus:outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Ce,{className:"text-[14px] font-semibold text-text-primary",children:"Install Wizard"}),e.jsx(dt,{current:r})]}),!n&&e.jsx(ke,{className:B("w-7 h-7 flex items-center justify-center rounded-[var(--radius-sm)]","text-text-tertiary hover:text-text-primary hover:bg-bg-hover","transition-colors"),"aria-label":"Close",children:e.jsxs("svg",{className:"w-[14px] h-[14px]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-5",children:[r==="mode"&&e.jsx(xt,{}),r==="configure"&&e.jsx(mt,{}),r==="review"&&e.jsx(bt,{}),r==="progress"&&e.jsx(ut,{})]})]})]})})}const ft=[{label:"List",icon:e.jsx(Oe,{size:14,strokeWidth:1.8}),shortcut:"1"},{label:"Cards",icon:e.jsx(Le,{size:14,strokeWidth:1.8}),shortcut:"2"},{label:"Templates",icon:e.jsx($e,{size:14,strokeWidth:1.8}),shortcut:"3"}],fe=["list","cards","templates"],te={initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8}};function zt(){const t=f(l=>l.activeView),o=f(l=>l.setActiveView),r=f(l=>l.fetchConfig),n=f(l=>l.fetchTemplates),a=f(l=>l.loading),i=f(l=>l.error),{register:d,unregister:m}=y.useContext(Me),b=y.useCallback(l=>o(fe[l]),[o]);return y.useEffect(()=>{d({items:ft.map(l=>({label:l.label,icon:l.icon,shortcut:l.shortcut})),activeIndex:fe.indexOf(t),onSwitch:b})},[t,d,b]),y.useEffect(()=>()=>m(),[m]),y.useEffect(()=>{function l(x){x.target instanceof HTMLInputElement||x.target instanceof HTMLTextAreaElement||(x.key==="1"?o("list"):x.key==="2"?o("cards"):x.key==="3"&&o("templates"))}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[o]),y.useEffect(()=>{r(),n()},[r,n]),a?e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading MCP configuration..."}):i?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx("span",{className:"text-status-failed text-[length:var(--font-size-sm)]",children:"Failed to load MCP config"}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:i}),e.jsx("button",{type:"button",onClick:()=>void r(),className:"px-3 py-1 rounded-[var(--radius-md)] text-[11px] font-semibold text-text-secondary hover:text-text-primary transition-all",style:{border:"var(--style-btn-secondary-border)",background:"var(--style-btn-secondary-bg)"},children:"Retry"})]}):e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsx(ht,{}),e.jsx(lt,{}),e.jsxs(Be,{mode:"wait",children:[t==="list"&&e.jsx(M.div,{className:"flex-1 flex flex-col overflow-hidden",variants:te,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.34,1.56,.64,1]},children:e.jsx(Qe,{})},"list"),t==="cards"&&e.jsx(M.div,{className:"flex-1 flex flex-col overflow-hidden",variants:te,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.34,1.56,.64,1]},children:e.jsx(rt,{})},"cards"),t==="templates"&&e.jsx(M.div,{className:"flex-1 flex flex-col overflow-hidden",variants:te,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.34,1.56,.64,1]},children:e.jsx(at,{})},"templates")]})]})}export{zt as McpPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as i,j as a}from"./index-
|
|
1
|
+
import{k as i,j as a}from"./index-C2Mcb4TJ.js";function o(e){switch(e.type){case"assistant_message":case"user_message":case"thinking":return e.content;case"error":return e.message;case"command_exec":return`${e.command}${e.output?`: ${e.output}`:""}`;case"file_change":return`[${e.action}] ${e.path}`;case"tool_use":return`${e.name}(${JSON.stringify(e.input).slice(0,80)})`;case"status_change":return`Status: ${e.status}`;case"token_usage":return`Tokens: +${e.inputTokens}/${e.outputTokens}`;case"approval_request":return`Approval: ${e.toolName}`;case"approval_response":return`Approval ${e.allowed?"granted":"denied"}`;default:return""}}function l(){const e=i(t=>t.entries),s=Object.values(e).flat().sort((t,n)=>t.timestamp.localeCompare(n.timestamp)).slice(-1e3);return s.length===0?a.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-xs)]",children:"No output yet."}):a.jsx("div",{role:"log","aria-live":"polite",className:"h-full overflow-y-auto p-[var(--spacing-2)] font-mono text-[11px] leading-[1.5] text-text-secondary",children:s.map((t,n)=>{const r=o(t);return r?a.jsxs("div",{className:"flex gap-[var(--spacing-2)]",children:[a.jsx("span",{className:"text-text-secondary/50 shrink-0",children:u(t.timestamp)}),a.jsx("span",{className:"break-all",children:r})]},t.id??n):null})})}function u(e){const s=new Date(e);return isNaN(s.getTime())?"":s.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}export{l as OutputPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as a,j as e}from"./index-
|
|
1
|
+
import{k as a,j as e}from"./index-C2Mcb4TJ.js";function l(){const s=a(r=>r.entries),o=Object.entries(s).flatMap(([r,i])=>i.filter(t=>t.type==="error").map(t=>({id:t.id,severity:"error",message:t.message,source:r,timestamp:t.timestamp})));return o.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-xs)]",children:"No problems detected."}):e.jsx("div",{className:"h-full overflow-y-auto",children:e.jsxs("table",{className:"w-full text-[11px]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-text-secondary text-left",children:[e.jsx("th",{className:"p-[var(--spacing-1)] w-[24px]"}),e.jsx("th",{className:"p-[var(--spacing-1)]",children:"Message"}),e.jsx("th",{className:"p-[var(--spacing-1)] w-[140px]",children:"Source"})]})}),e.jsx("tbody",{children:o.map(r=>e.jsxs("tr",{className:"border-b border-border hover:bg-bg-hover cursor-pointer transition-colors duration-[var(--duration-fast)]",children:[e.jsx("td",{className:"p-[var(--spacing-1)] text-center",children:e.jsx(c,{severity:r.severity})}),e.jsx("td",{className:"p-[var(--spacing-1)] text-text-primary break-all",children:r.message}),e.jsx("td",{className:"p-[var(--spacing-1)] text-text-secondary truncate",children:r.source})]},r.id))})]})})}function c({severity:s}){return s==="error"?e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",className:"text-status-blocked",children:[e.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),e.jsx("line",{x1:"8",y1:"4.5",x2:"8",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("circle",{cx:"8",cy:"11.5",r:"1"})]}):e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",className:"text-status-exploring",children:[e.jsx("path",{d:"M8 1.5L14.5 13H1.5L8 1.5Z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),e.jsx("line",{x1:"8",y1:"6",x2:"8",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("circle",{cx:"8",cy:"11",r:"1"})]})}export{l as ProblemsPanel};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{d as b,af as z,ae as g,j as e,ag as S,c as w,r as d,ah as v}from"./index-C2Mcb4TJ.js";import{C as f}from"./circle-Qfgy4LB_.js";import{A as I,L as y}from"./loader-B5F6PzFT.js";import{M as h}from"./minus-Lp_BfctG.js";import{C as j}from"./circle-check-big-3JB8zRYj.js";/**
|
|
2
|
+
* @license lucide-react v0.577.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const k=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],C=b("circle-x",k),p={open:"var(--color-text-tertiary)",registered:"var(--color-accent-blue)",in_progress:"var(--color-accent-blue)",resolved:"var(--color-accent-green)",closed:"var(--color-accent-green)",deferred:"var(--color-text-tertiary)"};function q({status:s}){switch(s){case"resolved":case"closed":return e.jsx(j,{size:14,style:{color:p[s]}});case"in_progress":return e.jsx(y,{size:14,className:"animate-spin",style:{color:p[s]}});case"open":case"registered":return e.jsx(f,{size:14,style:{color:p[s]}});case"deferred":default:return e.jsx(h,{size:14,style:{color:"var(--color-text-tertiary)"}})}}function R({issue:s}){const t={low:"bg-green-500/15 text-green-400",medium:"bg-yellow-500/15 text-yellow-400",high:"bg-orange-500/15 text-orange-400",urgent:"bg-red-500/15 text-red-400"};return e.jsxs("div",{className:"p-[var(--spacing-3)] rounded-[var(--radius-sm)] flex flex-col gap-[var(--spacing-2)]",style:{background:"var(--color-bg-secondary)",border:"1px solid var(--color-border)"},children:[e.jsxs("div",{className:"flex items-start gap-[var(--spacing-2)]",children:[e.jsx(q,{status:s.status}),e.jsx("span",{className:"flex-1 text-[length:var(--font-size-sm)] font-medium",style:{color:"var(--color-text-primary)"},children:s.title}),e.jsx("span",{className:"shrink-0 text-[length:var(--font-size-xs)] text-text-tertiary",children:s.type})]}),s.description&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] line-clamp-2",style:{color:"var(--color-text-secondary)"},children:s.description}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)]",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-[length:var(--font-size-xs)] ${t[s.priority]??""}`,children:s.priority}),e.jsx("span",{className:"text-[length:var(--font-size-xs)]",style:{color:"var(--color-text-secondary)"},children:s.status})]})]})}function N({status:s}){switch(s){case"running":return e.jsx(y,{size:14,className:"animate-spin",style:{color:"var(--color-accent-blue)"}});case"completed":return e.jsx(j,{size:14,style:{color:"var(--color-accent-green)"}});case"failed":return e.jsx(C,{size:14,style:{color:"var(--color-accent-red)"}});case"skipped":return e.jsx(h,{size:14,style:{color:"var(--color-text-tertiary)"}});case"pending":default:return e.jsx(f,{size:14,style:{color:"var(--color-text-tertiary)"}})}}function M({step:s,isSelected:t,onSelect:n}){return e.jsxs("button",{type:"button",onClick:n,className:"w-full flex items-center gap-[var(--spacing-2)] px-[var(--spacing-3)] py-[var(--spacing-2)] rounded-[var(--radius-sm)] text-left transition-colors",style:{background:t?"var(--color-bg-tertiary)":"transparent"},children:[e.jsx(N,{status:s.status}),e.jsxs("span",{className:"flex-1 text-[length:var(--font-size-sm)] truncate",style:{color:"var(--color-text-primary)"},children:[s.cmd,s.args?` ${s.args}`:""]}),s.summary&&e.jsx("span",{className:"text-[length:var(--font-size-xs)] shrink-0",style:{color:"var(--color-text-secondary)"},children:s.summary})]})}function B({issueIds:s}){const{issues:t,fetchIssues:n,loading:c}=w();d.useEffect(()=>{n()},[n]);const l=d.useMemo(()=>t.filter(a=>s.includes(a.id)),[t,s]),i=d.useMemo(()=>{const a={};for(const o of l)a[o.status]=(a[o.status]??0)+1;return a},[l]);return c&&l.length===0?e.jsx("div",{className:"flex items-center justify-center py-[var(--spacing-8)]",style:{color:"var(--color-text-tertiary)"},children:"Loading issues..."}):e.jsxs("div",{className:"flex flex-col gap-[var(--spacing-4)] p-[var(--spacing-4)]",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-4)]",children:[e.jsxs("span",{className:"text-[length:var(--font-size-sm)] font-medium",style:{color:"var(--color-text-primary)"},children:[l.length," Issues"]}),Object.entries(i).map(([a,o])=>e.jsxs("span",{className:"text-[length:var(--font-size-xs)]",style:{color:"var(--color-text-secondary)"},children:[a,": ",o]},a))]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-[var(--spacing-3)]",children:l.map(a=>e.jsx(R,{issue:a},a.id))}),l.length===0&&e.jsx("div",{className:"text-[length:var(--font-size-sm)] text-center py-[var(--spacing-8)]",style:{color:"var(--color-text-tertiary)"},children:"No issues found for this requirement."})]})}function L({sessionId:s}){const t=v(r=>r.session),n=v(r=>r.selectStep);v(r=>r.selectedStepIndex);const[c,l]=d.useState(null),i=(t==null?void 0:t.sessionId)===s,a=i?t.steps:[],o=d.useMemo(()=>c!=null?a.find(r=>r.index===c)??null:null,[a,c]),u=d.useCallback(r=>{l(m=>m===r?null:r),i&&n(r)},[i,n]),x=d.useMemo(()=>{const r={completed:0,running:0,failed:0,pending:0,skipped:0};for(const m of a)r[m.status]=(r[m.status]??0)+1;return r},[a]);return i?e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"w-[280px] shrink-0 flex flex-col overflow-y-auto",style:{borderRight:"1px solid var(--color-border)"},children:[e.jsxs("div",{className:"px-[var(--spacing-4)] py-[var(--spacing-3)] shrink-0",style:{borderBottom:"1px solid var(--color-border)"},children:[e.jsx("div",{className:"text-[length:var(--font-size-sm)] font-medium",style:{color:"var(--color-text-primary)"},children:t.chainName??"Session Steps"}),e.jsxs("div",{className:"text-[length:var(--font-size-xs)] mt-[var(--spacing-1)]",style:{color:"var(--color-text-secondary)"},children:["Step ",t.currentStep+1," / ",a.length||"?"," | ",x.completed," done",x.failed>0&&`, ${x.failed} failed`,t.avgQuality!=null&&` | Quality: ${t.avgQuality}`]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-[var(--spacing-2)]",children:a.map(r=>e.jsx(M,{step:r,isSelected:c===r.index,onSelect:()=>u(r.index)},r.index))})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-[var(--spacing-4)]",children:o?e.jsxs("div",{className:"flex flex-col gap-[var(--spacing-3)]",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)]",children:[e.jsx(N,{status:o.status}),e.jsx("span",{className:"text-[length:var(--font-size-base)] font-medium",style:{color:"var(--color-text-primary)"},children:o.cmd}),o.args&&e.jsx("span",{className:"text-[length:var(--font-size-sm)]",style:{color:"var(--color-text-secondary)"},children:o.args})]}),o.summary&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[length:var(--font-size-xs)] font-medium mb-[var(--spacing-1)]",style:{color:"var(--color-text-secondary)"},children:"Summary"}),e.jsx("div",{className:"text-[length:var(--font-size-sm)] rounded-[var(--radius-sm)] p-[var(--spacing-3)]",style:{color:"var(--color-text-primary)",background:"var(--color-bg-secondary)"},children:o.summary})]}),o.analysis&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[length:var(--font-size-xs)] font-medium mb-[var(--spacing-1)]",style:{color:"var(--color-text-secondary)"},children:"Analysis"}),e.jsx("pre",{className:"text-[length:var(--font-size-xs)] rounded-[var(--radius-sm)] p-[var(--spacing-3)] overflow-x-auto whitespace-pre-wrap",style:{color:"var(--color-text-primary)",background:"var(--color-bg-secondary)"},children:o.analysis})]})]}):e.jsx("div",{className:"text-[length:var(--font-size-sm)] text-center py-[var(--spacing-6)]",style:{color:"var(--color-text-tertiary)"},children:"Select a step to view details"})})]}):e.jsx("div",{className:"flex items-center justify-center py-[var(--spacing-8)]",style:{color:"var(--color-text-tertiary)"},children:e.jsxs("span",{className:"text-[length:var(--font-size-sm)]",children:["Coordinate session not active. Session: ",s]})})}function Q(){const{id:s}=z(),t=g(r=>r.currentRequirement),n=g(r=>r.committedResult),c=n!=null&&n.requirementId===s,l=c?n.mode:null,i=c?n.issueIds??[]:[],a=c?n.coordinateSessionId??"":"",o=t!=null&&t.id===s,u=o?t.title:`Requirement ${s??""}`,x=o?t.summary:null;return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 flex items-center gap-[var(--spacing-3)] px-[var(--spacing-4)] py-[var(--spacing-3)]",style:{borderBottom:"1px solid var(--color-border)"},children:[e.jsx("a",{href:"/requirement",className:"flex items-center justify-center w-7 h-7 rounded-[var(--radius-sm)] transition-colors",style:{color:"var(--color-text-secondary)"},title:"Back to Requirements",children:e.jsx(I,{size:16})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-[length:var(--font-size-base)] font-semibold truncate",style:{color:"var(--color-text-primary)"},children:u}),x&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] truncate mt-[var(--spacing-0-5)]",style:{color:"var(--color-text-secondary)"},children:x})]}),l&&e.jsx("span",{className:"shrink-0 px-[var(--spacing-2)] py-[var(--spacing-1)] rounded-[var(--radius-sm)] text-[length:var(--font-size-xs)] font-medium",style:{background:l==="issues"?"var(--color-accent-blue)":"var(--color-accent-green)",color:"#fff"},children:l==="issues"?"Issues":"Coordinate"})]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[!l&&e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--color-text-tertiary)"},children:e.jsx("span",{className:"text-[length:var(--font-size-sm)]",children:"No board data available for this requirement."})}),l==="issues"&&e.jsx(B,{issueIds:i}),l==="coordinate"&&e.jsx(L,{sessionId:a})]}),e.jsx(S,{})]})}export{Q as RequirementBoardPage};
|