claude-code-workflow 7.2.27 → 7.2.28
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/.ccw/specs/architecture-constraints.md +5 -0
- package/.claude/skills/_shared/SKILL-DESIGN-SPEC.md +140 -0
- package/.claude/skills/investigate/SKILL.md +110 -0
- package/.claude/skills/investigate/phases/01-root-cause-investigation.md +132 -0
- package/.claude/skills/investigate/phases/02-pattern-analysis.md +126 -0
- package/.claude/skills/investigate/phases/03-hypothesis-testing.md +177 -0
- package/.claude/skills/investigate/phases/04-implementation.md +139 -0
- package/.claude/skills/investigate/phases/05-verification-report.md +153 -0
- package/.claude/skills/investigate/specs/debug-report-format.md +226 -0
- package/.claude/skills/investigate/specs/iron-law.md +101 -0
- package/.claude/skills/security-audit/SKILL.md +125 -0
- package/.claude/skills/security-audit/phases/01-supply-chain-scan.md +139 -0
- package/.claude/skills/security-audit/phases/02-owasp-review.md +156 -0
- package/.claude/skills/security-audit/phases/03-threat-modeling.md +180 -0
- package/.claude/skills/security-audit/phases/04-report-tracking.md +177 -0
- package/.claude/skills/security-audit/specs/owasp-checklist.md +442 -0
- package/.claude/skills/security-audit/specs/scoring-gates.md +141 -0
- package/.claude/skills/ship/SKILL.md +105 -0
- package/.claude/skills/ship/phases/01-preflight-checks.md +121 -0
- package/.claude/skills/ship/phases/02-code-review.md +137 -0
- package/.claude/skills/ship/phases/03-version-bump.md +171 -0
- package/.claude/skills/ship/phases/04-changelog-commit.md +167 -0
- package/.claude/skills/ship/phases/05-pr-creation.md +163 -0
- package/.claude/skills/skill-generator/templates/sequential-phase.md +10 -0
- package/.claude/skills/skill-generator/templates/skill-md.md +4 -0
- package/.claude/skills/team-interactive-craft/SKILL.md +127 -0
- package/.claude/skills/team-interactive-craft/roles/a11y-tester/role.md +159 -0
- package/.claude/skills/team-interactive-craft/roles/builder/role.md +216 -0
- package/.claude/skills/team-interactive-craft/roles/coordinator/commands/analyze.md +71 -0
- package/.claude/skills/team-interactive-craft/roles/coordinator/commands/dispatch.md +192 -0
- package/.claude/skills/team-interactive-craft/roles/coordinator/commands/monitor.md +183 -0
- package/.claude/skills/team-interactive-craft/roles/coordinator/role.md +166 -0
- package/.claude/skills/team-interactive-craft/roles/interaction-designer/role.md +144 -0
- package/.claude/skills/team-interactive-craft/roles/researcher/role.md +131 -0
- package/.claude/skills/team-interactive-craft/specs/interaction-patterns.md +362 -0
- package/.claude/skills/team-interactive-craft/specs/pipelines.md +85 -0
- package/.claude/skills/team-interactive-craft/specs/team-config.json +105 -0
- package/.claude/skills/team-interactive-craft/specs/vanilla-constraints.md +83 -0
- package/.claude/skills/team-motion-design/SKILL.md +129 -0
- package/.claude/skills/team-motion-design/roles/animator/role.md +194 -0
- package/.claude/skills/team-motion-design/roles/choreographer/role.md +164 -0
- package/.claude/skills/team-motion-design/roles/coordinator/commands/analyze.md +64 -0
- package/.claude/skills/team-motion-design/roles/coordinator/commands/dispatch.md +203 -0
- package/.claude/skills/team-motion-design/roles/coordinator/commands/monitor.md +184 -0
- package/.claude/skills/team-motion-design/roles/coordinator/role.md +167 -0
- package/.claude/skills/team-motion-design/roles/motion-researcher/role.md +115 -0
- package/.claude/skills/team-motion-design/roles/motion-tester/role.md +175 -0
- package/.claude/skills/team-motion-design/specs/gpu-constraints.md +114 -0
- package/.claude/skills/team-motion-design/specs/motion-tokens.md +128 -0
- package/.claude/skills/team-motion-design/specs/pipelines.md +74 -0
- package/.claude/skills/team-motion-design/specs/reduced-motion.md +129 -0
- package/.claude/skills/team-motion-design/specs/team-config.json +99 -0
- package/.claude/skills/team-ui-polish/SKILL.md +127 -0
- package/.claude/skills/team-ui-polish/roles/coordinator/commands/analyze.md +77 -0
- package/.claude/skills/team-ui-polish/roles/coordinator/commands/dispatch.md +194 -0
- package/.claude/skills/team-ui-polish/roles/coordinator/commands/monitor.md +180 -0
- package/.claude/skills/team-ui-polish/roles/coordinator/role.md +170 -0
- package/.claude/skills/team-ui-polish/roles/diagnostician/role.md +160 -0
- package/.claude/skills/team-ui-polish/roles/optimizer/role.md +225 -0
- package/.claude/skills/team-ui-polish/roles/scanner/role.md +356 -0
- package/.claude/skills/team-ui-polish/roles/verifier/role.md +142 -0
- package/.claude/skills/team-ui-polish/specs/anti-patterns.md +141 -0
- package/.claude/skills/team-ui-polish/specs/design-standards.md +356 -0
- package/.claude/skills/team-ui-polish/specs/fix-strategies.md +235 -0
- package/.claude/skills/team-ui-polish/specs/pipelines.md +81 -0
- package/.claude/skills/team-ui-polish/specs/scoring-guide.md +162 -0
- package/.claude/skills/team-ui-polish/specs/team-config.json +73 -0
- package/.claude/skills/team-uidesign/SKILL.md +6 -1
- package/.claude/skills/team-uidesign/roles/designer/role.md +28 -4
- package/.claude/skills/team-uidesign/roles/implementer/role.md +25 -3
- package/.claude/skills/team-uidesign/roles/researcher/role.md +21 -2
- package/.claude/skills/team-uidesign/roles/reviewer/role.md +19 -17
- package/.claude/skills/team-uidesign/specs/anti-patterns.md +211 -0
- package/.claude/skills/team-uidesign/specs/design-standards.md +329 -0
- package/.claude/skills/team-uidesign/specs/scoring-guide.md +114 -0
- package/.claude/skills/team-uidesign/specs/team-config.json +1 -1
- package/.claude/skills/team-uidesign/specs/ux-writing.md +86 -0
- package/.claude/skills/team-ux-improve/SKILL.md +3 -0
- package/.claude/skills/team-ux-improve/roles/designer/role.md +30 -0
- package/.claude/skills/team-ux-improve/roles/diagnoser/role.md +16 -1
- package/.claude/skills/team-ux-improve/roles/scanner/role.md +43 -1
- package/.claude/skills/team-ux-improve/specs/anti-patterns.md +103 -0
- package/.claude/skills/team-ux-improve/specs/design-standards.md +54 -0
- package/.claude/skills/team-ux-improve/specs/heuristics.md +88 -0
- package/.claude/skills/team-ux-improve/wisdom/anti-patterns/common-ux-pitfalls.md +40 -8
- package/.claude/skills/team-ux-improve/wisdom/patterns/state-management.md +32 -12
- package/.claude/skills/team-ux-improve/wisdom/patterns/ui-feedback.md +35 -11
- package/.claude/skills/team-ux-improve/wisdom/principles/general-ux.md +36 -9
- package/.claude/skills/team-visual-a11y/SKILL.md +143 -0
- package/.claude/skills/team-visual-a11y/roles/color-auditor/role.md +178 -0
- package/.claude/skills/team-visual-a11y/roles/coordinator/commands/analyze.md +72 -0
- package/.claude/skills/team-visual-a11y/roles/coordinator/commands/dispatch.md +250 -0
- package/.claude/skills/team-visual-a11y/roles/coordinator/commands/monitor.md +204 -0
- package/.claude/skills/team-visual-a11y/roles/coordinator/role.md +169 -0
- package/.claude/skills/team-visual-a11y/roles/fix-implementer/role.md +246 -0
- package/.claude/skills/team-visual-a11y/roles/focus-auditor/role.md +222 -0
- package/.claude/skills/team-visual-a11y/roles/remediation-planner/role.md +206 -0
- package/.claude/skills/team-visual-a11y/roles/typo-auditor/role.md +185 -0
- package/.claude/skills/team-visual-a11y/specs/focus-patterns.md +325 -0
- package/.claude/skills/team-visual-a11y/specs/oklch-standards.md +130 -0
- package/.claude/skills/team-visual-a11y/specs/pipelines.md +98 -0
- package/.claude/skills/team-visual-a11y/specs/team-config.json +109 -0
- package/.claude/skills/team-visual-a11y/specs/typography-scale.md +165 -0
- package/.claude/skills/team-visual-a11y/specs/wcag-matrix.md +133 -0
- package/.codex/skills/investigate/agents/investigator.md +392 -0
- package/.codex/skills/investigate/orchestrator.md +362 -0
- package/.codex/skills/investigate/phases/01-root-cause-investigation.md +212 -0
- package/.codex/skills/investigate/phases/02-pattern-analysis.md +181 -0
- package/.codex/skills/investigate/phases/03-hypothesis-testing.md +214 -0
- package/.codex/skills/investigate/phases/04-implementation.md +195 -0
- package/.codex/skills/investigate/phases/05-verification-report.md +240 -0
- package/.codex/skills/security-audit/agents/security-auditor.md +341 -0
- package/.codex/skills/security-audit/orchestrator.md +384 -0
- package/.codex/skills/security-audit/phases/01-supply-chain-scan.md +226 -0
- package/.codex/skills/security-audit/phases/02-owasp-review.md +232 -0
- package/.codex/skills/security-audit/phases/03-threat-modeling.md +249 -0
- package/.codex/skills/security-audit/phases/04-report-tracking.md +300 -0
- package/.codex/skills/ship/agents/ship-operator.md +318 -0
- package/.codex/skills/ship/orchestrator.md +426 -0
- package/.codex/skills/ship/phases/01-preflight-checks.md +198 -0
- package/.codex/skills/ship/phases/02-code-review.md +228 -0
- package/.codex/skills/ship/phases/03-version-bump.md +259 -0
- package/.codex/skills/ship/phases/04-changelog-commit.md +263 -0
- package/.codex/skills/ship/phases/05-pr-creation.md +280 -0
- package/.codex/skills/team-interactive-craft/SKILL.md +220 -0
- package/.codex/skills/team-interactive-craft/roles/a11y-tester/role.md +159 -0
- package/.codex/skills/team-interactive-craft/roles/builder/role.md +216 -0
- package/.codex/skills/team-interactive-craft/roles/coordinator/commands/analyze.md +71 -0
- package/.codex/skills/team-interactive-craft/roles/coordinator/commands/dispatch.md +162 -0
- package/.codex/skills/team-interactive-craft/roles/coordinator/commands/monitor.md +233 -0
- package/.codex/skills/team-interactive-craft/roles/coordinator/role.md +209 -0
- package/.codex/skills/team-interactive-craft/roles/interaction-designer/role.md +144 -0
- package/.codex/skills/team-interactive-craft/roles/researcher/role.md +131 -0
- package/.codex/skills/team-interactive-craft/specs/interaction-patterns.md +362 -0
- package/.codex/skills/team-interactive-craft/specs/pipelines.md +85 -0
- package/.codex/skills/team-interactive-craft/specs/team-config.json +105 -0
- package/.codex/skills/team-interactive-craft/specs/vanilla-constraints.md +83 -0
- package/.codex/skills/team-motion-design/SKILL.md +222 -0
- package/.codex/skills/team-motion-design/roles/animator/role.md +194 -0
- package/.codex/skills/team-motion-design/roles/choreographer/role.md +164 -0
- package/.codex/skills/team-motion-design/roles/coordinator/commands/analyze.md +64 -0
- package/.codex/skills/team-motion-design/roles/coordinator/commands/dispatch.md +168 -0
- package/.codex/skills/team-motion-design/roles/coordinator/commands/monitor.md +242 -0
- package/.codex/skills/team-motion-design/roles/coordinator/role.md +210 -0
- package/.codex/skills/team-motion-design/roles/motion-researcher/role.md +115 -0
- package/.codex/skills/team-motion-design/roles/motion-tester/role.md +175 -0
- package/.codex/skills/team-motion-design/specs/gpu-constraints.md +114 -0
- package/.codex/skills/team-motion-design/specs/motion-tokens.md +128 -0
- package/.codex/skills/team-motion-design/specs/pipelines.md +74 -0
- package/.codex/skills/team-motion-design/specs/reduced-motion.md +129 -0
- package/.codex/skills/team-motion-design/specs/team-config.json +99 -0
- package/.codex/skills/team-ui-polish/SKILL.md +218 -0
- package/.codex/skills/team-ui-polish/roles/coordinator/commands/analyze.md +77 -0
- package/.codex/skills/team-ui-polish/roles/coordinator/commands/dispatch.md +167 -0
- package/.codex/skills/team-ui-polish/roles/coordinator/commands/monitor.md +230 -0
- package/.codex/skills/team-ui-polish/roles/coordinator/role.md +213 -0
- package/.codex/skills/team-ui-polish/roles/diagnostician/role.md +164 -0
- package/.codex/skills/team-ui-polish/roles/optimizer/role.md +229 -0
- package/.codex/skills/team-ui-polish/roles/scanner/role.md +360 -0
- package/.codex/skills/team-ui-polish/roles/verifier/role.md +142 -0
- package/.codex/skills/team-ui-polish/specs/anti-patterns.md +141 -0
- package/.codex/skills/team-ui-polish/specs/design-standards.md +356 -0
- package/.codex/skills/team-ui-polish/specs/fix-strategies.md +235 -0
- package/.codex/skills/team-ui-polish/specs/pipelines.md +81 -0
- package/.codex/skills/team-ui-polish/specs/scoring-guide.md +162 -0
- package/.codex/skills/team-ui-polish/specs/team-config.json +73 -0
- package/.codex/skills/team-visual-a11y/SKILL.md +319 -0
- package/.codex/skills/team-visual-a11y/roles/color-auditor/role.md +178 -0
- package/.codex/skills/team-visual-a11y/roles/coordinator/commands/analyze.md +72 -0
- package/.codex/skills/team-visual-a11y/roles/coordinator/commands/dispatch.md +188 -0
- package/.codex/skills/team-visual-a11y/roles/coordinator/commands/monitor.md +281 -0
- package/.codex/skills/team-visual-a11y/roles/coordinator/role.md +213 -0
- package/.codex/skills/team-visual-a11y/roles/fix-implementer/role.md +246 -0
- package/.codex/skills/team-visual-a11y/roles/focus-auditor/role.md +222 -0
- package/.codex/skills/team-visual-a11y/roles/remediation-planner/role.md +206 -0
- package/.codex/skills/team-visual-a11y/roles/typo-auditor/role.md +185 -0
- package/.codex/skills/team-visual-a11y/specs/focus-patterns.md +325 -0
- package/.codex/skills/team-visual-a11y/specs/oklch-standards.md +130 -0
- package/.codex/skills/team-visual-a11y/specs/pipelines.md +98 -0
- package/.codex/skills/team-visual-a11y/specs/team-config.json +109 -0
- package/.codex/skills/team-visual-a11y/specs/typography-scale.md +165 -0
- package/.codex/skills/team-visual-a11y/specs/wcag-matrix.md +133 -0
- package/README.md +8 -0
- package/ccw/dist/core/hooks/hook-templates.d.ts.map +1 -1
- package/ccw/dist/core/hooks/hook-templates.js +114 -1
- package/ccw/dist/core/hooks/hook-templates.js.map +1 -1
- package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/cli-routes.js +34 -0
- package/ccw/dist/core/routes/cli-routes.js.map +1 -1
- package/ccw/dist/core/routes/system-routes.js +2 -2
- package/ccw/dist/core/routes/system-routes.js.map +1 -1
- package/ccw/frontend/dist/assets/{AlertDialog-Bf1jdqax.js → AlertDialog-BjP1ydDR.js} +2 -2
- package/ccw/frontend/dist/assets/{AlertDialog-Bf1jdqax.js.map → AlertDialog-BjP1ydDR.js.map} +1 -1
- package/ccw/frontend/dist/assets/{AnalysisPage-C8niKdp4.js → AnalysisPage-CAX3xqMf.js} +2 -2
- package/ccw/frontend/dist/assets/{AnalysisPage-C8niKdp4.js.map → AnalysisPage-CAX3xqMf.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ApiSettingsPage-BL2c3UNS.js → ApiSettingsPage-CtWlmztq.js} +2 -2
- package/ccw/frontend/dist/assets/{ApiSettingsPage-BL2c3UNS.js.map → ApiSettingsPage-CtWlmztq.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CliModeToggle-BePBFynD.js → CliModeToggle-hR4a-eLX.js} +2 -2
- package/ccw/frontend/dist/assets/{CliModeToggle-BePBFynD.js.map → CliModeToggle-hR4a-eLX.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CliSessionSharePage-7cYtX6FT.js → CliSessionSharePage-DzNPkFN9.js} +2 -2
- package/ccw/frontend/dist/assets/{CliSessionSharePage-7cYtX6FT.js.map → CliSessionSharePage-DzNPkFN9.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CliViewerPage-CBwg1mPL.js → CliViewerPage-BPEGN4TT.js} +2 -2
- package/ccw/frontend/dist/assets/{CliViewerPage-CBwg1mPL.js.map → CliViewerPage-BPEGN4TT.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CodexLensPage-Bt74xORP.js → CodexLensPage-Cf0r2RHY.js} +2 -2
- package/ccw/frontend/dist/assets/{CodexLensPage-Bt74xORP.js.map → CodexLensPage-Cf0r2RHY.js.map} +1 -1
- package/ccw/frontend/dist/assets/{Collapsible-Wrs87QT7.js → Collapsible-DEm1rJ4h.js} +2 -2
- package/ccw/frontend/dist/assets/{Collapsible-Wrs87QT7.js.map → Collapsible-DEm1rJ4h.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CommandsManagerPage-ChQjmPWZ.js → CommandsManagerPage-BpeWw8HO.js} +2 -2
- package/ccw/frontend/dist/assets/{CommandsManagerPage-ChQjmPWZ.js.map → CommandsManagerPage-BpeWw8HO.js.map} +1 -1
- package/ccw/frontend/dist/assets/{DeepWikiPage-dEO5wi6X.js → DeepWikiPage-BEsmh2vF.js} +2 -2
- package/ccw/frontend/dist/assets/{DeepWikiPage-dEO5wi6X.js.map → DeepWikiPage-BEsmh2vF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{EndpointsPage-4zq269xY.js → EndpointsPage-B30SFdtU.js} +2 -2
- package/ccw/frontend/dist/assets/{EndpointsPage-4zq269xY.js.map → EndpointsPage-B30SFdtU.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ExplorerPage-B0YTENhA.js → ExplorerPage-BVvMpg1O.js} +2 -2
- package/ccw/frontend/dist/assets/{ExplorerPage-B0YTENhA.js.map → ExplorerPage-BVvMpg1O.js.map} +1 -1
- package/ccw/frontend/dist/assets/{FixSessionPage-CwGs6dhz.js → FixSessionPage-CL73dHbh.js} +2 -2
- package/ccw/frontend/dist/assets/{FixSessionPage-CwGs6dhz.js.map → FixSessionPage-CL73dHbh.js.map} +1 -1
- package/ccw/frontend/dist/assets/{FloatingFileBrowser-COZRBslc.js → FloatingFileBrowser-BL-28lMZ.js} +2 -2
- package/ccw/frontend/dist/assets/{FloatingFileBrowser-COZRBslc.js.map → FloatingFileBrowser-BL-28lMZ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{FloatingPanel-DYvgQZRD.js → FloatingPanel-BzZDciHZ.js} +2 -2
- package/ccw/frontend/dist/assets/{FloatingPanel-DYvgQZRD.js.map → FloatingPanel-BzZDciHZ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{GraphExplorerPage-ewMHQGem.js → GraphExplorerPage-CDp6-d8P.js} +2 -2
- package/ccw/frontend/dist/assets/{GraphExplorerPage-ewMHQGem.js.map → GraphExplorerPage-CDp6-d8P.js.map} +1 -1
- package/ccw/frontend/dist/assets/{HistoryPage-BMeR0PrK.js → HistoryPage-fZY_7O9n.js} +2 -2
- package/ccw/frontend/dist/assets/{HistoryPage-BMeR0PrK.js.map → HistoryPage-fZY_7O9n.js.map} +1 -1
- package/ccw/frontend/dist/assets/{HookManagerPage-DBW2LnRm.js → HookManagerPage-4LJeC9bq.js} +2 -2
- package/ccw/frontend/dist/assets/{HookManagerPage-DBW2LnRm.js.map → HookManagerPage-4LJeC9bq.js.map} +1 -1
- package/ccw/frontend/dist/assets/{InstallationsPage--pMj0QEH.js → InstallationsPage-Bpigrbhw.js} +2 -2
- package/ccw/frontend/dist/assets/{InstallationsPage--pMj0QEH.js.map → InstallationsPage-Bpigrbhw.js.map} +1 -1
- package/ccw/frontend/dist/assets/{IssueHubPage-C_QMpQSR.js → IssueHubPage-BP0zJc1R.js} +2 -2
- package/ccw/frontend/dist/assets/{IssueHubPage-C_QMpQSR.js.map → IssueHubPage-BP0zJc1R.js.map} +1 -1
- package/ccw/frontend/dist/assets/{LiteTasksPage-CSWFdQ2-.js → LiteTasksPage-CSt2oVKQ.js} +2 -2
- package/ccw/frontend/dist/assets/{LiteTasksPage-CSWFdQ2-.js.map → LiteTasksPage-CSt2oVKQ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{McpManagerPage-Dvv8NtGy.js → McpManagerPage-B-xaMA0w.js} +2 -2
- package/ccw/frontend/dist/assets/{McpManagerPage-Dvv8NtGy.js.map → McpManagerPage-B-xaMA0w.js.map} +1 -1
- package/ccw/frontend/dist/assets/{MemoryPage-YO8WZzZO.js → MemoryPage-CJqo_7DY.js} +2 -2
- package/ccw/frontend/dist/assets/{MemoryPage-YO8WZzZO.js.map → MemoryPage-CJqo_7DY.js.map} +1 -1
- package/ccw/frontend/dist/assets/{NotFoundPage-quUJw0CD.js → NotFoundPage-ibZeQA-Y.js} +2 -2
- package/ccw/frontend/dist/assets/{NotFoundPage-quUJw0CD.js.map → NotFoundPage-ibZeQA-Y.js.map} +1 -1
- package/ccw/frontend/dist/assets/{OrchestratorPage-tuThWPID.js → OrchestratorPage-DgJ4ctPQ.js} +2 -2
- package/ccw/frontend/dist/assets/{OrchestratorPage-tuThWPID.js.map → OrchestratorPage-DgJ4ctPQ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ProjectOverviewPage-shTilwiT.js → ProjectOverviewPage-Cit0Yq0D.js} +2 -2
- package/ccw/frontend/dist/assets/{ProjectOverviewPage-shTilwiT.js.map → ProjectOverviewPage-Cit0Yq0D.js.map} +1 -1
- package/ccw/frontend/dist/assets/{PromptHistoryPage-6rQnsI8l.js → PromptHistoryPage-Ce1HDIK0.js} +2 -2
- package/ccw/frontend/dist/assets/{PromptHistoryPage-6rQnsI8l.js.map → PromptHistoryPage-Ce1HDIK0.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ReviewSessionPage-JOmzjVbT.js → ReviewSessionPage-J1KikNrk.js} +2 -2
- package/ccw/frontend/dist/assets/{ReviewSessionPage-JOmzjVbT.js.map → ReviewSessionPage-J1KikNrk.js.map} +1 -1
- package/ccw/frontend/dist/assets/{RulesManagerPage-Cayfywqi.js → RulesManagerPage-CdBjTmth.js} +2 -2
- package/ccw/frontend/dist/assets/{RulesManagerPage-Cayfywqi.js.map → RulesManagerPage-CdBjTmth.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SessionDetailPage-iMn0k84i.js → SessionDetailPage-B9ZK7LvX.js} +2 -2
- package/ccw/frontend/dist/assets/{SessionDetailPage-iMn0k84i.js.map → SessionDetailPage-B9ZK7LvX.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SessionsPage-Ciqjy9kz.js → SessionsPage-CW_nS5UR.js} +2 -2
- package/ccw/frontend/dist/assets/{SessionsPage-Ciqjy9kz.js.map → SessionsPage-CW_nS5UR.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SettingsPage-BPDbXPSM.js → SettingsPage-B2PYzSoO.js} +35 -35
- package/ccw/frontend/dist/assets/SettingsPage-B2PYzSoO.js.map +1 -0
- package/ccw/frontend/dist/assets/{SkillsManagerPage-D3LzbpJY.js → SkillsManagerPage-CTnWrrwp.js} +2 -2
- package/ccw/frontend/dist/assets/{SkillsManagerPage-D3LzbpJY.js.map → SkillsManagerPage-CTnWrrwp.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SpecsSettingsPage-BpkJctzo.js → SpecsSettingsPage-DJpi9XQL.js} +2 -2
- package/ccw/frontend/dist/assets/{SpecsSettingsPage-BpkJctzo.js.map → SpecsSettingsPage-DJpi9XQL.js.map} +1 -1
- package/ccw/frontend/dist/assets/{Switch-BpB9h__9.js → Switch-Ac6Ov7uy.js} +2 -2
- package/ccw/frontend/dist/assets/{Switch-BpB9h__9.js.map → Switch-Ac6Ov7uy.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TabsNavigation-BGsKy7DO.js → TabsNavigation-DZAAspqR.js} +2 -2
- package/ccw/frontend/dist/assets/{TabsNavigation-BGsKy7DO.js.map → TabsNavigation-DZAAspqR.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TaskDrawer-bYIlbM0Q.js → TaskDrawer-BJkwfhIZ.js} +2 -2
- package/ccw/frontend/dist/assets/{TaskDrawer-bYIlbM0Q.js.map → TaskDrawer-BJkwfhIZ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TeamPage-CihtQ6LQ.js → TeamPage-BJgjxBgb.js} +2 -2
- package/ccw/frontend/dist/assets/{TeamPage-CihtQ6LQ.js.map → TeamPage-BJgjxBgb.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TerminalDashboardPage-BDnNF_ud.js → TerminalDashboardPage-D1WekoOy.js} +2 -2
- package/ccw/frontend/dist/assets/{TerminalDashboardPage-BDnNF_ud.js.map → TerminalDashboardPage-D1WekoOy.js.map} +1 -1
- package/ccw/frontend/dist/assets/{archive-CQJ86bQp.js → archive-DxemgIhF.js} +2 -2
- package/ccw/frontend/dist/assets/{archive-CQJ86bQp.js.map → archive-DxemgIhF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{archive-restore-BhTfDbPU.js → archive-restore-CjS83f1V.js} +2 -2
- package/ccw/frontend/dist/assets/{archive-restore-BhTfDbPU.js.map → archive-restore-CjS83f1V.js.map} +1 -1
- package/ccw/frontend/dist/assets/{arrow-right-eUAZnT9C.js → arrow-right-B5PUcn8I.js} +2 -2
- package/ccw/frontend/dist/assets/{arrow-right-eUAZnT9C.js.map → arrow-right-B5PUcn8I.js.map} +1 -1
- package/ccw/frontend/dist/assets/{bookmark-plus-ilF5-V-k.js → bookmark-plus-DCc9aPbb.js} +2 -2
- package/ccw/frontend/dist/assets/{bookmark-plus-ilF5-V-k.js.map → bookmark-plus-DCc9aPbb.js.map} +1 -1
- package/ccw/frontend/dist/assets/{bot-BLkaQscs.js → bot-DOwFtzak.js} +2 -2
- package/ccw/frontend/dist/assets/{bot-BLkaQscs.js.map → bot-DOwFtzak.js.map} +1 -1
- package/ccw/frontend/dist/assets/{braces-D9HdgsO6.js → braces-96qH3aFh.js} +2 -2
- package/ccw/frontend/dist/assets/{braces-D9HdgsO6.js.map → braces-96qH3aFh.js.map} +1 -1
- package/ccw/frontend/dist/assets/{circle-stop-C3ZF1okQ.js → circle-stop-CCxSuil1.js} +2 -2
- package/ccw/frontend/dist/assets/{circle-stop-C3ZF1okQ.js.map → circle-stop-CCxSuil1.js.map} +1 -1
- package/ccw/frontend/dist/assets/{cpu-B-QjaSjm.js → cpu-CZNSJFdq.js} +2 -2
- package/ccw/frontend/dist/assets/{cpu-B-QjaSjm.js.map → cpu-CZNSJFdq.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ellipsis-vertical-CbNlw2gS.js → ellipsis-vertical-h8xtvw2_.js} +2 -2
- package/ccw/frontend/dist/assets/{ellipsis-vertical-CbNlw2gS.js.map → ellipsis-vertical-h8xtvw2_.js.map} +1 -1
- package/ccw/frontend/dist/assets/{eye-yAy69Cnn.js → eye-D3NY0bm6.js} +2 -2
- package/ccw/frontend/dist/assets/{eye-yAy69Cnn.js.map → eye-D3NY0bm6.js.map} +1 -1
- package/ccw/frontend/dist/assets/{eye-off-D5uzLZyP.js → eye-off-Cy2vkc8p.js} +2 -2
- package/ccw/frontend/dist/assets/{eye-off-D5uzLZyP.js.map → eye-off-Cy2vkc8p.js.map} +1 -1
- package/ccw/frontend/dist/assets/{file-json-rwo1NowL.js → file-json-Bzq3U1Mx.js} +2 -2
- package/ccw/frontend/dist/assets/{file-json-rwo1NowL.js.map → file-json-Bzq3U1Mx.js.map} +1 -1
- package/ccw/frontend/dist/assets/{file-text-DRkrjie9.js → file-text-DwuwPDPi.js} +2 -2
- package/ccw/frontend/dist/assets/{file-text-DRkrjie9.js.map → file-text-DwuwPDPi.js.map} +1 -1
- package/ccw/frontend/dist/assets/{filter-BOe-OTu1.js → filter-q9g-bknU.js} +2 -2
- package/ccw/frontend/dist/assets/{filter-BOe-OTu1.js.map → filter-q9g-bknU.js.map} +1 -1
- package/ccw/frontend/dist/assets/{folder-BaWZWn_r.js → folder-CL6vb42J.js} +2 -2
- package/ccw/frontend/dist/assets/{folder-BaWZWn_r.js.map → folder-CL6vb42J.js.map} +1 -1
- package/ccw/frontend/dist/assets/{gauge-kazFexTr.js → gauge-BkrcQBly.js} +2 -2
- package/ccw/frontend/dist/assets/{gauge-kazFexTr.js.map → gauge-BkrcQBly.js.map} +1 -1
- package/ccw/frontend/dist/assets/{globe-BuHeEjxd.js → globe-BQbwyNeV.js} +2 -2
- package/ccw/frontend/dist/assets/{globe-BuHeEjxd.js.map → globe-BQbwyNeV.js.map} +1 -1
- package/ccw/frontend/dist/assets/{grid-3x3-DbhuUu4V.js → grid-3x3-x5_7DrN7.js} +2 -2
- package/ccw/frontend/dist/assets/{grid-3x3-DbhuUu4V.js.map → grid-3x3-x5_7DrN7.js.map} +1 -1
- package/ccw/frontend/dist/assets/{hard-drive-AoLGL0z4.js → hard-drive-DTyWXwzf.js} +2 -2
- package/ccw/frontend/dist/assets/{hard-drive-AoLGL0z4.js.map → hard-drive-DTyWXwzf.js.map} +1 -1
- package/ccw/frontend/dist/assets/{hash-Dpo1exMB.js → hash-80O0kJO7.js} +2 -2
- package/ccw/frontend/dist/assets/{hash-Dpo1exMB.js.map → hash-80O0kJO7.js.map} +1 -1
- package/ccw/frontend/dist/assets/{history-ujQnmMC9.js → history-DDlN2Bwa.js} +2 -2
- package/ccw/frontend/dist/assets/{history-ujQnmMC9.js.map → history-DDlN2Bwa.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-CxzXz6o1.js → index-B9A3Hnrk.js} +2 -2
- package/ccw/frontend/dist/assets/{index-CxzXz6o1.js.map → index-B9A3Hnrk.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-B76AGix5.js → index-Bs80iCX0.js} +2 -2
- package/ccw/frontend/dist/assets/{index-B76AGix5.js.map → index-Bs80iCX0.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-C_Yf5fZ4.js → index-mbeo62f8.js} +2 -2
- package/ccw/frontend/dist/assets/{index-C_Yf5fZ4.js.map → index-mbeo62f8.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-Dff4bg3u.js → index-rLgoBCfV.js} +3 -3
- package/ccw/frontend/dist/assets/{index-Dff4bg3u.js.map → index-rLgoBCfV.js.map} +1 -1
- package/ccw/frontend/dist/assets/{layout-grid-CBdE4K8h.js → layout-grid-C1niOWJx.js} +2 -2
- package/ccw/frontend/dist/assets/{layout-grid-CBdE4K8h.js.map → layout-grid-C1niOWJx.js.map} +1 -1
- package/ccw/frontend/dist/assets/{lightbulb-B9K6ZgRp.js → lightbulb-BTmI7SUg.js} +2 -2
- package/ccw/frontend/dist/assets/{lightbulb-B9K6ZgRp.js.map → lightbulb-BTmI7SUg.js.map} +1 -1
- package/ccw/frontend/dist/assets/{link-2-Oea4xHJl.js → link-2-CB9HKeuZ.js} +2 -2
- package/ccw/frontend/dist/assets/{link-2-Oea4xHJl.js.map → link-2-CB9HKeuZ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{link-5yXdZBch.js → link-koEYiemK.js} +2 -2
- package/ccw/frontend/dist/assets/{link-5yXdZBch.js.map → link-koEYiemK.js.map} +1 -1
- package/ccw/frontend/dist/assets/{list-9lHhC_U_.js → list-v2_GaLdC.js} +2 -2
- package/ccw/frontend/dist/assets/{list-9lHhC_U_.js.map → list-v2_GaLdC.js.map} +1 -1
- package/ccw/frontend/dist/assets/{map-pin-B6Io5kmB.js → map-pin-BQNfAqG_.js} +2 -2
- package/ccw/frontend/dist/assets/{map-pin-B6Io5kmB.js.map → map-pin-BQNfAqG_.js.map} +1 -1
- package/ccw/frontend/dist/assets/{messages-square-BT000aD3.js → messages-square-Dzq5LGg9.js} +2 -2
- package/ccw/frontend/dist/assets/{messages-square-BT000aD3.js.map → messages-square-Dzq5LGg9.js.map} +1 -1
- package/ccw/frontend/dist/assets/{minimize-2-DO-zbT3a.js → minimize-2-CtkoJXcz.js} +2 -2
- package/ccw/frontend/dist/assets/{minimize-2-DO-zbT3a.js.map → minimize-2-CtkoJXcz.js.map} +1 -1
- package/ccw/frontend/dist/assets/{package-BjOw1ldU.js → package-CH3smL37.js} +2 -2
- package/ccw/frontend/dist/assets/{package-BjOw1ldU.js.map → package-CH3smL37.js.map} +1 -1
- package/ccw/frontend/dist/assets/{plug-9dAARpE1.js → plug-CZ0aL_yF.js} +2 -2
- package/ccw/frontend/dist/assets/{plug-9dAARpE1.js.map → plug-CZ0aL_yF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{power-K2S39x7f.js → power-F2A_J4l6.js} +2 -2
- package/ccw/frontend/dist/assets/{power-K2S39x7f.js.map → power-F2A_J4l6.js.map} +1 -1
- package/ccw/frontend/dist/assets/{save-D9-CoT3x.js → save-Byxot0YU.js} +2 -2
- package/ccw/frontend/dist/assets/{save-D9-CoT3x.js.map → save-Byxot0YU.js.map} +1 -1
- package/ccw/frontend/dist/assets/{send-Bunw9NtC.js → send-JjqhUkpw.js} +2 -2
- package/ccw/frontend/dist/assets/{send-Bunw9NtC.js.map → send-JjqhUkpw.js.map} +1 -1
- package/ccw/frontend/dist/assets/{settings-2-osl4EXFf.js → settings-2--SuN9rAt.js} +2 -2
- package/ccw/frontend/dist/assets/{settings-2-osl4EXFf.js.map → settings-2--SuN9rAt.js.map} +1 -1
- package/ccw/frontend/dist/assets/{square-check-big-Dl5gYkjR.js → square-check-big-BbngGB2h.js} +2 -2
- package/ccw/frontend/dist/assets/{square-check-big-Dl5gYkjR.js.map → square-check-big-BbngGB2h.js.map} +1 -1
- package/ccw/frontend/dist/assets/{square-pen-Bue1chJR.js → square-pen-CgrHgZSl.js} +2 -2
- package/ccw/frontend/dist/assets/{square-pen-Bue1chJR.js.map → square-pen-CgrHgZSl.js.map} +1 -1
- package/ccw/frontend/dist/assets/{star-Bk7EC7FB.js → star-BU3TQr7Z.js} +2 -2
- package/ccw/frontend/dist/assets/{star-Bk7EC7FB.js.map → star-BU3TQr7Z.js.map} +1 -1
- package/ccw/frontend/dist/assets/{style-BbREPmRj.js → style-CKs7nnn3.js} +2 -2
- package/ccw/frontend/dist/assets/{style-BbREPmRj.js.map → style-CKs7nnn3.js.map} +1 -1
- package/ccw/frontend/dist/assets/{target-CElrCVhR.js → target-DW5tsDW6.js} +2 -2
- package/ccw/frontend/dist/assets/{target-CElrCVhR.js.map → target-DW5tsDW6.js.map} +1 -1
- package/ccw/frontend/dist/assets/{test-tube-wciJaoas.js → test-tube-BHm7w3ON.js} +2 -2
- package/ccw/frontend/dist/assets/{test-tube-wciJaoas.js.map → test-tube-BHm7w3ON.js.map} +1 -1
- package/ccw/frontend/dist/assets/{upload-BD1F07wG.js → upload-DYR7PWwt.js} +2 -2
- package/ccw/frontend/dist/assets/{upload-BD1F07wG.js.map → upload-DYR7PWwt.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useApiSettings-D23HVEt8.js → useApiSettings-D0TVgQD_.js} +2 -2
- package/ccw/frontend/dist/assets/{useApiSettings-D23HVEt8.js.map → useApiSettings-D0TVgQD_.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useCli-BGDd_lXD.js → useCli-DfY8mAP8.js} +2 -2
- package/ccw/frontend/dist/assets/{useCli-BGDd_lXD.js.map → useCli-DfY8mAP8.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useCommands-B-m_HxPB.js → useCommands-CGusDp0F.js} +2 -2
- package/ccw/frontend/dist/assets/{useCommands-B-m_HxPB.js.map → useCommands-CGusDp0F.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useDebounce-Z18-PHZr.js → useDebounce-CIwh0fF1.js} +2 -2
- package/ccw/frontend/dist/assets/{useDebounce-Z18-PHZr.js.map → useDebounce-CIwh0fF1.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useFileExplorer-D4gPp-LB.js → useFileExplorer-FMyFv39K.js} +2 -2
- package/ccw/frontend/dist/assets/{useFileExplorer-D4gPp-LB.js.map → useFileExplorer-FMyFv39K.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useLocale-DJ62jjFa.js → useLocale-B2qhsoTb.js} +2 -2
- package/ccw/frontend/dist/assets/{useLocale-DJ62jjFa.js.map → useLocale-B2qhsoTb.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useSkills-B8NPs9__.js → useSkills-cxKXMBm3.js} +3 -3
- package/ccw/frontend/dist/assets/{useSkills-B8NPs9__.js.map → useSkills-cxKXMBm3.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useSystemSettings-CVi7nKGJ.js → useSystemSettings-B-xUT_z-.js} +2 -2
- package/ccw/frontend/dist/assets/{useSystemSettings-CVi7nKGJ.js.map → useSystemSettings-B-xUT_z-.js.map} +1 -1
- package/ccw/frontend/dist/assets/{wand-sparkles-CLjPiU5w.js → wand-sparkles-DZV_3lPr.js} +2 -2
- package/ccw/frontend/dist/assets/{wand-sparkles-CLjPiU5w.js.map → wand-sparkles-DZV_3lPr.js.map} +1 -1
- package/ccw/frontend/dist/index.html +1 -1
- package/package.json +105 -105
- package/ccw/frontend/dist/assets/SettingsPage-BPDbXPSM.js.map +0 -1
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{O as ge,r as i,ab as
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-rLgoBCfV.js","assets/index-BoqylFO4.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{O as ge,r as i,ab as Rs,u as X,co as Re,j as e,al as Hs,cp as $s,cq as Se,cr as Ke,cs as Bs,ct as ce,cu as zs,cv as _s,cw as Vs,cx as qs,aq as Ws,ar as Gs,as as Je,c as z,at as Ks,au as Js,C as Q,B as Z,bq as le,e as j,X as ne,cy as He,ap as Ee,cz as Xs,cA as Ys,cB as $e,aV as as,cC as Qs,I as D,_ as H,R as ue,a7 as Ne,cD as Zs,bu as Xe,U as et,l as st,cE as tt,cF as at,cG as Be,ao as nt,cH as rt,bf as Ie,cI as Te,cJ as it,cK as lt,cL as ot,S as ct,cM as dt,cN as Ye,aw as ze,cO as mt,aP as ut,an as xt,cP as ht,i as gt,F as ft,N as pt,aU as bt,bX as jt}from"./index-rLgoBCfV.js";import{A as Nt,a as vt,b as yt,c as wt,d as kt,e as Ct,f as St,g as Tt}from"./AlertDialog-BjP1ydDR.js";import{u as Mt,a as Et,b as Ft,c as Pt,d as Dt,e as Ut,f as Lt,g as It,h as At,i as Ot,j as Rt,k as Ht,l as $t}from"./useSystemSettings-B-xUT_z-.js";import{u as Bt}from"./useLocale-B2qhsoTb.js";import{T as zt}from"./test-tube-BHm7w3ON.js";import{L as _t}from"./link-koEYiemK.js";import{S as Vt}from"./send-JjqhUkpw.js";import{E as fe}from"./eye-off-Cy2vkc8p.js";import{E as pe}from"./eye-D3NY0bm6.js";import{S as Fe}from"./save-Byxot0YU.js";import{B as qt}from"./bot-DOwFtzak.js";import{S as ns}from"./settings-2--SuN9rAt.js";import{u as Wt}from"./useDebounce-CIwh0fF1.js";import{C as rs}from"./cpu-CZNSJFdq.js";import{U as Gt}from"./upload-DYR7PWwt.js";import{P as Kt}from"./package-CH3smL37.js";import{F as Jt}from"./folder-CL6vb42J.js";/**
|
|
3
3
|
* @license lucide-react v0.460.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
6
6
|
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const
|
|
7
|
+
*/const Xt=ge("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
8
8
|
* @license lucide-react v0.460.0 - ISC
|
|
9
9
|
*
|
|
10
10
|
* This source code is licensed under the ISC license.
|
|
11
11
|
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/const
|
|
12
|
+
*/const is=ge("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/**
|
|
13
13
|
* @license lucide-react v0.460.0 - ISC
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the ISC license.
|
|
16
16
|
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/const
|
|
17
|
+
*/const ls=ge("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/**
|
|
18
18
|
* @license lucide-react v0.460.0 - ISC
|
|
19
19
|
*
|
|
20
20
|
* This source code is licensed under the ISC license.
|
|
21
21
|
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/const
|
|
22
|
+
*/const Yt=ge("LayoutPanelLeft",[["rect",{width:"7",height:"18",x:"3",y:"3",rx:"1",key:"2obqm"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/**
|
|
23
23
|
* @license lucide-react v0.460.0 - ISC
|
|
24
24
|
*
|
|
25
25
|
* This source code is licensed under the ISC license.
|
|
26
26
|
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/const
|
|
27
|
+
*/const Qt=ge("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/**
|
|
28
28
|
* @license lucide-react v0.460.0 - ISC
|
|
29
29
|
*
|
|
30
30
|
* This source code is licensed under the ISC license.
|
|
31
31
|
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
-
*/const
|
|
32
|
+
*/const Zt=ge("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);function os(){const s=document.cookie.match(/XSRF-TOKEN=([^;]+)/);return s?decodeURIComponent(s[1]):null}async function ea(s,t=1,n=20){const r=new URLSearchParams({query:s,page:String(t),per_page:String(n)}),c=await fetch(`/api/unsplash/search?${r}`,{credentials:"same-origin"});if(!c.ok){const d=await c.json().catch(()=>({}));throw new Error(d.error||`Unsplash search failed: ${c.status}`)}return c.json()}async function sa(s){const t={"Content-Type":s.type,"X-Filename":encodeURIComponent(s.name)},n=os();n&&(t["X-CSRF-Token"]=n);const r=await fetch("/api/background/upload",{method:"POST",headers:t,credentials:"same-origin",body:s});if(!r.ok){const c=await r.json().catch(()=>({}));throw new Error(c.error||`Upload failed: ${r.status}`)}return r.json()}async function ta(s){const t={"Content-Type":"application/json"},n=os();n&&(t["X-CSRF-Token"]=n),await fetch("/api/unsplash/download",{method:"POST",headers:t,credentials:"same-origin",body:JSON.stringify({downloadLocation:s})})}function aa(s,t=1,n=20){const[r,c]=i.useState(s);return i.useEffect(()=>{const d=setTimeout(()=>{c(s)},500);return()=>clearTimeout(d)},[s]),Rs({queryKey:["unsplash-search",r,t,n],queryFn:()=>ea(r,t,n),enabled:r.trim().length>0,staleTime:300*1e3,retry:1})}const na=[{value:"gradient-only",labelId:"theme.background.mode.gradientOnly"},{value:"image-only",labelId:"theme.background.mode.imageOnly"},{value:"image-gradient",labelId:"theme.background.mode.imageGradient"}];function ra(){const{formatMessage:s}=X(),{backgroundConfig:t,setBackgroundMode:n,setBackgroundImage:r,updateBackgroundEffect:c}=Re(),[d,x]=i.useState(""),[p,N]=i.useState(1),[f,F]=i.useState(""),[w,P]=i.useState(!1),[u,v]=i.useState(null),k=i.useRef(null),{data:h,isLoading:$,isError:C,error:M}=aa(d,p),O=t.mode!=="gradient-only",K=i.useCallback(async l=>{r(l.regularUrl,{photographerName:l.photographer,photographerUrl:l.photographerUrl,photoUrl:l.photoUrl}),ta(l.downloadLocation).catch(()=>{})},[r]),A=i.useCallback(()=>{f.trim()&&(r(f.trim(),null),F(""))},[f,r]),b=i.useCallback(()=>{r(null,null)},[r]),y=i.useCallback(async l=>{var m;const g=(m=l.target.files)==null?void 0:m[0];if(g){if(l.target.value="",v(null),g.size>10*1024*1024){v(s({id:"theme.background.fileTooLarge"}));return}if(!g.type.startsWith("image/")||!["image/jpeg","image/png","image/webp","image/gif"].includes(g.type)){v(s({id:"theme.background.invalidType"}));return}P(!0);try{const E=await sa(g);r(E.url,null)}catch(E){v(E.message||s({id:"theme.background.uploadError"}))}finally{P(!1)}}},[s,r]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:s({id:"theme.background.title"})}),e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":s({id:"theme.background.title"}),children:na.map(({value:l,labelId:g})=>e.jsx("button",{onClick:()=>n(l),role:"radio","aria-checked":t.mode===l,className:`
|
|
33
33
|
flex-1 px-3 py-2 rounded-lg text-xs font-medium
|
|
34
34
|
transition-all duration-200 border-2
|
|
35
35
|
${t.mode===l?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
|
|
36
36
|
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
|
|
37
37
|
`,children:s({id:g})},l))}),O&&e.jsxs("div",{className:"space-y-3",children:[t.imageUrl&&e.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-border",children:[e.jsx("img",{src:t.imageUrl,alt:"Current background",className:"w-full h-32 object-cover"}),e.jsx("button",{onClick:b,className:"absolute top-2 right-2 px-2 py-1 text-xs bg-black/60 text-white rounded hover:bg-black/80 transition-colors",children:s({id:"theme.background.removeImage"})}),t.attribution&&e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 px-2 py-1 bg-black/50 text-white text-xs",children:["Photo by"," ",e.jsx("a",{href:`${t.attribution.photographerUrl}?utm_source=ccw&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"underline",children:t.attribution.photographerName})," ","on"," ",e.jsx("a",{href:"https://unsplash.com/?utm_source=ccw&utm_medium=referral",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Unsplash"})]})]}),e.jsx("input",{type:"text",value:d,onChange:l=>{x(l.target.value),N(1)},placeholder:s({id:"theme.background.searchPlaceholder"}),className:`w-full px-3 py-2 text-sm rounded-lg border border-border bg-bg text-text
|
|
38
|
-
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-1`})
|
|
38
|
+
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-1`}),$&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx("div",{className:"w-5 h-5 border-2 border-border border-t-accent rounded-full animate-spin"})}),C&&e.jsx("p",{className:"text-xs text-destructive py-2",children:(M==null?void 0:M.message)||s({id:"theme.background.searchError"})}),h&&h.photos.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-3 gap-2 max-h-60 overflow-y-auto",children:h.photos.map(l=>e.jsx("button",{onClick:()=>K(l),className:`
|
|
39
39
|
relative rounded overflow-hidden border-2 transition-all
|
|
40
40
|
hover:border-accent focus:outline-none focus:ring-2 focus:ring-accent
|
|
41
41
|
${t.imageUrl===l.regularUrl?"border-accent ring-2 ring-accent":"border-transparent"}
|
|
42
|
-
`,children:e.jsx("img",{src:l.thumbUrl,alt:`Photo by ${l.photographer}`,className:"w-full h-20 object-cover",loading:"lazy"})},l.id))}),h.totalPages>1&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("button",{onClick:()=>N(l=>Math.max(1,l-1)),disabled:p<=1,className:"px-2 py-1 text-xs rounded border border-border disabled:opacity-50 hover:bg-surface",children:s({id:"theme.background.prev"})}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[p," / ",h.totalPages]}),e.jsx("button",{onClick:()=>N(l=>Math.min(h.totalPages,l+1)),disabled:p>=h.totalPages,className:"px-2 py-1 text-xs rounded border border-border disabled:opacity-50 hover:bg-surface",children:s({id:"theme.background.next"})})]})]}),h&&h.photos.length===0&&d.trim()&&e.jsx("p",{className:"text-xs text-text-secondary py-2 text-center",children:s({id:"theme.background.noResults"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"url",value:f,onChange:l=>
|
|
42
|
+
`,children:e.jsx("img",{src:l.thumbUrl,alt:`Photo by ${l.photographer}`,className:"w-full h-20 object-cover",loading:"lazy"})},l.id))}),h.totalPages>1&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("button",{onClick:()=>N(l=>Math.max(1,l-1)),disabled:p<=1,className:"px-2 py-1 text-xs rounded border border-border disabled:opacity-50 hover:bg-surface",children:s({id:"theme.background.prev"})}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[p," / ",h.totalPages]}),e.jsx("button",{onClick:()=>N(l=>Math.min(h.totalPages,l+1)),disabled:p>=h.totalPages,className:"px-2 py-1 text-xs rounded border border-border disabled:opacity-50 hover:bg-surface",children:s({id:"theme.background.next"})})]})]}),h&&h.photos.length===0&&d.trim()&&e.jsx("p",{className:"text-xs text-text-secondary py-2 text-center",children:s({id:"theme.background.noResults"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"url",value:f,onChange:l=>F(l.target.value),placeholder:s({id:"theme.background.customUrlPlaceholder"}),className:`flex-1 px-3 py-2 text-xs rounded-lg border border-border bg-bg text-text
|
|
43
43
|
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-1`}),e.jsx("button",{onClick:A,disabled:!f.trim(),className:"px-3 py-2 text-xs rounded-lg bg-accent text-white disabled:opacity-50 hover:opacity-90 transition-opacity",children:s({id:"theme.background.apply"})})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("input",{ref:k,type:"file",accept:"image/jpeg,image/png,image/webp,image/gif",onChange:y,className:"hidden"}),e.jsx("button",{onClick:()=>{var l;return(l=k.current)==null?void 0:l.click()},disabled:w,className:`w-full px-3 py-2 text-xs rounded-lg border border-dashed border-border
|
|
44
44
|
bg-bg text-text hover:bg-surface hover:border-accent
|
|
45
|
-
disabled:opacity-50 transition-all flex items-center justify-center gap-2`,children:w?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3.5 h-3.5 border-2 border-border border-t-accent rounded-full animate-spin"}),s({id:"theme.background.uploading"})]}):s({id:"theme.background.upload"})}),u&&e.jsx("p",{className:"text-xs text-destructive",children:u})]})]}),O&&e.jsxs("div",{className:"space-y-3 pt-2 border-t border-border",children:[e.jsx("h4",{className:"text-xs font-medium text-text-secondary",children:s({id:"theme.background.effects"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("label",{className:"text-xs text-text",children:s({id:"theme.background.blur"})}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[t.effects.blur,"px"]})]}),e.jsx("input",{type:"range",min:"0",max:"20",step:"1",value:t.effects.blur,onChange:l=>c("blur",Number(l.target.value)),className:"w-full accent-[hsl(var(--accent))]"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("label",{className:"text-xs text-text",children:s({id:"theme.background.darken"})}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[t.effects.darkenOpacity,"%"]})]}),e.jsx("input",{type:"range",min:"0",max:"80",step:"1",value:t.effects.darkenOpacity,onChange:l=>c("darkenOpacity",Number(l.target.value)),className:"w-full accent-[hsl(var(--accent))]"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("label",{className:"text-xs text-text",children:s({id:"theme.background.saturation"})}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[t.effects.saturation,"%"]})]}),e.jsx("input",{type:"range",min:"0",max:"200",step:"5",value:t.effects.saturation,onChange:l=>c("saturation",Number(l.target.value)),className:"w-full accent-[hsl(var(--accent))]"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.effects.enableFrostedGlass,onChange:l=>c("enableFrostedGlass",l.target.checked),className:"w-4 h-4 rounded border-border text-accent focus:ring-2 focus:ring-accent focus:ring-offset-2"}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.background.frostedGlass"})})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.effects.enableGrain,onChange:l=>c("enableGrain",l.target.checked),className:"w-4 h-4 rounded border-border text-accent focus:ring-2 focus:ring-accent focus:ring-offset-2"}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.background.grain"})})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.effects.enableVignette,onChange:l=>c("enableVignette",l.target.checked),className:"w-4 h-4 rounded border-border text-accent focus:ring-2 focus:ring-accent focus:ring-offset-2"}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.background.vignette"})})]})]})]})}function
|
|
45
|
+
disabled:opacity-50 transition-all flex items-center justify-center gap-2`,children:w?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3.5 h-3.5 border-2 border-border border-t-accent rounded-full animate-spin"}),s({id:"theme.background.uploading"})]}):s({id:"theme.background.upload"})}),u&&e.jsx("p",{className:"text-xs text-destructive",children:u})]})]}),O&&e.jsxs("div",{className:"space-y-3 pt-2 border-t border-border",children:[e.jsx("h4",{className:"text-xs font-medium text-text-secondary",children:s({id:"theme.background.effects"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("label",{className:"text-xs text-text",children:s({id:"theme.background.blur"})}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[t.effects.blur,"px"]})]}),e.jsx("input",{type:"range",min:"0",max:"20",step:"1",value:t.effects.blur,onChange:l=>c("blur",Number(l.target.value)),className:"w-full accent-[hsl(var(--accent))]"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("label",{className:"text-xs text-text",children:s({id:"theme.background.darken"})}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[t.effects.darkenOpacity,"%"]})]}),e.jsx("input",{type:"range",min:"0",max:"80",step:"1",value:t.effects.darkenOpacity,onChange:l=>c("darkenOpacity",Number(l.target.value)),className:"w-full accent-[hsl(var(--accent))]"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("label",{className:"text-xs text-text",children:s({id:"theme.background.saturation"})}),e.jsxs("span",{className:"text-xs text-text-secondary",children:[t.effects.saturation,"%"]})]}),e.jsx("input",{type:"range",min:"0",max:"200",step:"5",value:t.effects.saturation,onChange:l=>c("saturation",Number(l.target.value)),className:"w-full accent-[hsl(var(--accent))]"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.effects.enableFrostedGlass,onChange:l=>c("enableFrostedGlass",l.target.checked),className:"w-4 h-4 rounded border-border text-accent focus:ring-2 focus:ring-accent focus:ring-offset-2"}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.background.frostedGlass"})})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.effects.enableGrain,onChange:l=>c("enableGrain",l.target.checked),className:"w-4 h-4 rounded border-border text-accent focus:ring-2 focus:ring-accent focus:ring-offset-2"}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.background.grain"})})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.effects.enableVignette,onChange:l=>c("enableVignette",l.target.checked),className:"w-4 h-4 rounded border-border text-accent focus:ring-2 focus:ring-accent focus:ring-offset-2"}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.background.vignette"})})]})]})]})}function ia(){const{formatMessage:s}=X(),{colorScheme:t,resolvedTheme:n,customHue:r,isCustomTheme:c,gradientLevel:d,enableHoverGlow:x,enableBackgroundAnimation:p,motionPreference:N,setColorScheme:f,setTheme:F,setCustomHue:w,setGradientLevel:P,setEnableHoverGlow:u,setEnableBackgroundAnimation:v,setMotionPreference:k,styleTier:h,setStyleTier:$,themeSlots:C,activeSlotId:M,canAddSlot:O,setActiveSlot:K,copySlot:A,renameSlot:b,deleteSlot:y,undoDeleteSlot:l,exportThemeCode:g,importThemeCode:m,setBackgroundConfig:E}=Re(),{addToast:B,removeToast:G}=Hs(),[q,_]=i.useState(r),[ee,te]=i.useState([]),[de,me]=i.useState({}),[Y,re]=i.useState(!1),[ae,a]=i.useState(null),[S,I]=i.useState(""),[U,J]=i.useState(null),ie=i.useRef(null),xe=i.useRef(null),[Pe,_e]=i.useState(!1),[ps,De]=i.useState(""),[L,ve]=i.useState(null),[bs,ye]=i.useState(null),[we,ke]=i.useState(null),[js,Ve]=i.useState(!1);i.useEffect(()=>{_(r)},[r]);const oe=n,be=o=>{const T=Se(q??180,oe)[o];return T?`hsl(${T})`:"#888"},Ns=[{id:"soft",nameKey:"theme.styleTier.soft",descKey:"theme.styleTier.softDesc"},{id:"standard",nameKey:"theme.styleTier.standard",descKey:"theme.styleTier.standardDesc"},{id:"high-contrast",nameKey:"theme.styleTier.highContrast",descKey:"theme.styleTier.highContrastDesc"}],vs=o=>{const V=Se(r??220,oe),T=o==="standard"?V:Ke(V,o,oe);return{bg:T["--bg"]?`hsl(${T["--bg"]})`:"#888",surface:T["--surface"]?`hsl(${T["--surface"]})`:"#888",accent:T["--accent"]?`hsl(${T["--accent"]})`:"#888"}},Ue=o=>{c&&w(null),f(o)},ys=()=>{r===null&&w(180)},ws=()=>{if(q!==null){w(q);const R=Se(q,n),T=Vs(R).filter(he=>!he.passed);if(T.length>0){te(T);const he={};for(const je of T){const Os=`${je.fgVar}|${je.bgVar}`;he[Os]=qs(je.fgVar,je.bgVar,R,je.required)}me(he),re(!0)}else te([]),me({}),re(!1)}},ks=()=>{w(null),_(null)},Cs=o=>{F(o)},Ss=o=>{if(o.key==="ArrowRight"||o.key==="ArrowDown"){o.preventDefault();const V=(ce.findIndex(T=>T.id===t)+1)%ce.length;Ue(ce[V].id)}else if(o.key==="ArrowLeft"||o.key==="ArrowUp"){o.preventDefault();const V=(ce.findIndex(T=>T.id===t)-1+ce.length)%ce.length;Ue(ce[V].id)}},Ts=i.useCallback(o=>{o!==M&&K(o)},[M,K]),Ms=i.useCallback(()=>{O&&A()},[O,A]),qe=i.useCallback((o,R)=>{a(o),I(R),setTimeout(()=>{var V;return(V=ie.current)==null?void 0:V.focus()},0)},[]),Le=i.useCallback(()=>{ae&&S.trim()&&b(ae,S.trim()),a(null),I("")},[ae,S,b]),We=i.useCallback(()=>{a(null),I("")},[]),Es=i.useCallback(o=>{o.key==="Enter"?(o.preventDefault(),Le()):o.key==="Escape"&&(o.preventDefault(),We())},[Le,We]),Fs=i.useCallback(()=>{if(!U)return;y(U),J(null),xe.current&&G(xe.current);const o=B("info",s({id:"theme.slot.undoDelete"}),void 0,{duration:1e4,dismissible:!0,action:{label:s({id:"theme.slot.undo"}),onClick:()=>{l(),G(o),xe.current=null}}});xe.current=o},[U,y,B,G,l,s]),Ge=i.useCallback(()=>{J(null)},[]),Ps=i.useCallback(async()=>{try{const o=g();await navigator.clipboard.writeText(o),Ve(!0),setTimeout(()=>Ve(!1),2e3)}catch{B("error","Failed to copy to clipboard")}},[g,B]),Ds=i.useCallback(()=>{_e(!0),De(""),ve(null),ye(null),ke(null)},[]),Ce=i.useCallback(()=>{_e(!1),De(""),ve(null),ye(null),ke(null)},[]),Us=i.useCallback(o=>{if(De(o),ke(null),ye(null),ve(null),!o.trim())return;const R=m(o);R.ok?(ve(R.payload),R.warning&&ye(R.warning)):ke(R.error)},[m]),Ls=i.useCallback(()=>{L&&(!O&&M==="default"?(L.customHue!==null?w(L.customHue):(w(null),f(L.colorScheme)),P(L.gradientLevel),u(L.enableHoverGlow),v(L.enableBackgroundAnimation),$(L.styleTier)):O?(A(),L.customHue!==null?w(L.customHue):(w(null),f(L.colorScheme)),P(L.gradientLevel),u(L.enableHoverGlow),v(L.enableBackgroundAnimation),$(L.styleTier)):(L.customHue!==null?w(L.customHue):(w(null),f(L.colorScheme)),P(L.gradientLevel),u(L.enableHoverGlow),v(L.enableBackgroundAnimation),$(L.styleTier)),E(L.backgroundConfig??$s),B("success",s({id:"theme.share.importSuccess"})),Ce())},[L,O,M,A,w,f,P,u,v,$,E,B,s,Ce]),Is=i.useCallback(o=>{const R=o.customHue??220,V=Se(R,oe),T=o.styleTier==="standard"?V:Ke(V,o.styleTier,oe);return{bg:T["--bg"]?`hsl(${T["--bg"]})`:"#888",surface:T["--surface"]?`hsl(${T["--surface"]})`:"#888",accent:T["--accent"]?`hsl(${T["--accent"]})`:"#888",text:T["--text"]?`hsl(${T["--text"]})`:"#888"}},[oe]),As=o=>{switch(o){case"incompatible_version":return"theme.share.incompatibleVersion";default:return"theme.share.invalidCode"}};return i.useEffect(()=>{ae&&ie.current&&(ie.current.focus(),ie.current.select())},[ae]),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-medium text-text",children:s({id:"theme.slot.title"})}),e.jsxs("button",{onClick:Ms,disabled:!O,title:O?s({id:"theme.slot.copy"}):s({id:"theme.slot.limitReached"},{limit:Bs}),className:`
|
|
46
46
|
px-2 py-1 rounded text-xs font-medium
|
|
47
47
|
transition-all duration-200
|
|
48
48
|
${O?"bg-accent text-white hover:bg-accent-hover focus:ring-2 focus:ring-accent focus:ring-offset-1":"bg-muted text-muted-text cursor-not-allowed"}
|
|
49
49
|
focus:outline-none
|
|
50
|
-
`,children:["+ ",s({id:"theme.slot.copy"})]})]}),e.jsx("div",{className:"flex gap-2",role:"tablist","aria-label":s({id:"theme.slot.title"}),children:C.map(o=>{const R=o.id===M,
|
|
50
|
+
`,children:["+ ",s({id:"theme.slot.copy"})]})]}),e.jsx("div",{className:"flex gap-2",role:"tablist","aria-label":s({id:"theme.slot.title"}),children:C.map(o=>{const R=o.id===M,V=o.id===ae;return e.jsxs("div",{role:"tab","aria-selected":R,tabIndex:R?0:-1,onClick:()=>Ts(o.id),className:`
|
|
51
51
|
relative flex-1 min-w-0 p-2.5 rounded-lg cursor-pointer
|
|
52
52
|
transition-all duration-200 border-2 group
|
|
53
53
|
${R?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
|
|
54
54
|
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-1
|
|
55
|
-
`,children:[R&&e.jsx("span",{className:"absolute -top-1 -right-1 w-2.5 h-2.5 rounded-full bg-accent border-2 border-bg"}),e.jsx("div",{className:"flex items-center gap-1 min-w-0",children:
|
|
55
|
+
`,children:[R&&e.jsx("span",{className:"absolute -top-1 -right-1 w-2.5 h-2.5 rounded-full bg-accent border-2 border-bg"}),e.jsx("div",{className:"flex items-center gap-1 min-w-0",children:V?e.jsx("input",{ref:ie,type:"text",value:S,onChange:T=>I(T.target.value),onKeyDown:Es,onBlur:Le,onClick:T=>T.stopPropagation(),className:`\r
|
|
56
56
|
w-full px-1 py-0.5 text-xs font-medium text-text\r
|
|
57
57
|
bg-bg border border-accent rounded\r
|
|
58
58
|
focus:outline-none focus:ring-1 focus:ring-accent\r
|
|
59
|
-
`,maxLength:20}):e.jsx("span",{className:"text-xs font-medium text-text truncate",title:o.name,onDoubleClick:T=>{T.stopPropagation(),o.isDefault||qe(o.id,o.name)},children:o.name})}),R&&!
|
|
59
|
+
`,maxLength:20}):e.jsx("span",{className:"text-xs font-medium text-text truncate",title:o.name,onDoubleClick:T=>{T.stopPropagation(),o.isDefault||qe(o.id,o.name)},children:o.name})}),R&&!V&&e.jsx("span",{className:"text-[10px] text-accent font-medium mt-0.5 block",children:s({id:"theme.slot.active"})}),!o.isDefault&&!V&&e.jsxs("div",{className:`\r
|
|
60
60
|
absolute top-1 right-1 flex gap-0.5\r
|
|
61
61
|
opacity-0 group-hover:opacity-100 transition-opacity duration-150\r
|
|
62
62
|
`,children:[e.jsx("button",{onClick:T=>{T.stopPropagation(),qe(o.id,o.name)},title:s({id:"theme.slot.rename"}),className:`\r
|
|
63
63
|
p-0.5 rounded text-text-tertiary hover:text-text hover:bg-surface-hover\r
|
|
64
64
|
transition-colors duration-150 focus:outline-none\r
|
|
65
|
-
`,children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsx("button",{onClick:T=>{T.stopPropagation(),
|
|
65
|
+
`,children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsx("button",{onClick:T=>{T.stopPropagation(),J(o.id)},title:s({id:"theme.slot.delete"}),className:`\r
|
|
66
66
|
p-0.5 rounded text-text-tertiary hover:text-error hover:bg-error-light\r
|
|
67
67
|
transition-colors duration-150 focus:outline-none\r
|
|
68
68
|
`,children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),o.isDefault&&e.jsx("div",{className:`\r
|
|
69
69
|
absolute top-1 right-1 flex gap-0.5\r
|
|
70
70
|
opacity-0 group-hover:opacity-100 transition-opacity duration-150\r
|
|
71
|
-
`,children:e.jsx("button",{disabled:!0,title:s({id:"theme.slot.cannotDeleteDefault"}),className:"p-0.5 rounded text-muted-text cursor-not-allowed",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})})]},o.id)})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.title.colorScheme"})}),e.jsxs("div",{className:"grid grid-cols-5 gap-3",role:"group","aria-label":"Color scheme selection",onKeyDown:
|
|
71
|
+
`,children:e.jsx("button",{disabled:!0,title:s({id:"theme.slot.cannotDeleteDefault"}),className:"p-0.5 rounded text-muted-text cursor-not-allowed",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})})]},o.id)})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.title.colorScheme"})}),e.jsxs("div",{className:"grid grid-cols-5 gap-3",role:"group","aria-label":"Color scheme selection",onKeyDown:Ss,children:[ce.map(o=>e.jsxs("button",{onClick:()=>Ue(o.id),"aria-label":s({id:"theme.select.colorScheme"},{name:s({id:`theme.colorScheme.${o.id}`})}),"aria-selected":t===o.id&&!c,role:"radio",className:`
|
|
72
72
|
flex flex-col items-center gap-2 p-3 rounded-lg
|
|
73
73
|
transition-all duration-200 border-2
|
|
74
74
|
${t===o.id&&!c?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
|
|
75
75
|
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
|
|
76
|
-
`,children:[e.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-border shadow-sm",style:{backgroundColor:o.accentColor},"aria-hidden":"true"}),e.jsx("span",{className:"text-xs font-medium text-text text-center",children:s({id:`theme.colorScheme.${o.id}`})})]},o.id)),e.jsxs("button",{onClick:
|
|
76
|
+
`,children:[e.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-border shadow-sm",style:{backgroundColor:o.accentColor},"aria-hidden":"true"}),e.jsx("span",{className:"text-xs font-medium text-text text-center",children:s({id:`theme.colorScheme.${o.id}`})})]},o.id)),e.jsxs("button",{onClick:ys,"aria-label":s({id:"theme.select.colorScheme"},{name:s({id:"theme.colorScheme.custom"})}),"aria-selected":c,role:"radio",className:`
|
|
77
77
|
flex flex-col items-center gap-2 p-3 rounded-lg
|
|
78
78
|
transition-all duration-200 border-2
|
|
79
79
|
${c?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
|
|
80
80
|
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
|
|
81
|
-
`,children:[e.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-border shadow-sm",style:{background:`linear-gradient(135deg, ${be("--accent")}, ${be("--primary")})`},"aria-hidden":"true"}),e.jsx("span",{className:"text-xs font-medium text-text text-center",children:s({id:"theme.colorScheme.custom"})})]})]})]}),c&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.title.customHue"})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("label",{htmlFor:"hue-slider",className:"text-xs text-text-secondary",children:s({id:"theme.hueValue"},{value:q??180})})}),e.jsx("input",{id:"hue-slider",type:"range",min:"0",max:"360",step:"1",value:q??180,onChange:o=>
|
|
81
|
+
`,children:[e.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-border shadow-sm",style:{background:`linear-gradient(135deg, ${be("--accent")}, ${be("--primary")})`},"aria-hidden":"true"}),e.jsx("span",{className:"text-xs font-medium text-text text-center",children:s({id:"theme.colorScheme.custom"})})]})]})]}),c&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.title.customHue"})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("label",{htmlFor:"hue-slider",className:"text-xs text-text-secondary",children:s({id:"theme.hueValue"},{value:q??180})})}),e.jsx("input",{id:"hue-slider",type:"range",min:"0",max:"360",step:"1",value:q??180,onChange:o=>_(Number(o.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{background:`linear-gradient(to right,
|
|
82
82
|
hsl(0, 70%, 60%), hsl(60, 70%, 60%), hsl(120, 70%, 60%),
|
|
83
|
-
hsl(180, 70%, 60%), hsl(240, 70%, 60%), hsl(300, 70%, 60%), hsl(360, 70%, 60%))`},"aria-label":s({id:"theme.title.customHue"})}),e.jsxs("div",{className:"flex gap-3 items-end",children:[e.jsxs("span",{className:"text-xs text-text-secondary pb-1",children:[s({id:"theme.preview"}),":"]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:be("--bg")}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.background"})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:be("--surface")}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.surface"})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:be("--accent")}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.accent"})})]})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx("button",{onClick:
|
|
83
|
+
hsl(180, 70%, 60%), hsl(240, 70%, 60%), hsl(300, 70%, 60%), hsl(360, 70%, 60%))`},"aria-label":s({id:"theme.title.customHue"})}),e.jsxs("div",{className:"flex gap-3 items-end",children:[e.jsxs("span",{className:"text-xs text-text-secondary pb-1",children:[s({id:"theme.preview"}),":"]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:be("--bg")}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.background"})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:be("--surface")}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.surface"})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:be("--accent")}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.accent"})})]})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx("button",{onClick:ws,disabled:q===r,className:`
|
|
84
84
|
flex-1 px-4 py-2 rounded-lg text-sm font-medium
|
|
85
85
|
transition-all duration-200
|
|
86
86
|
${q===r?"bg-muted text-muted-text cursor-not-allowed":"bg-accent text-white hover:bg-accent-hover focus:ring-2 focus:ring-accent focus:ring-offset-2"}
|
|
87
|
-
`,children:s({id:"theme.save"})}),e.jsx("button",{onClick:
|
|
87
|
+
`,children:s({id:"theme.save"})}),e.jsx("button",{onClick:ks,className:`\r
|
|
88
88
|
px-4 py-2 rounded-lg text-sm font-medium\r
|
|
89
89
|
border-2 border-border bg-bg text-text\r
|
|
90
90
|
hover:bg-surface transition-all duration-200\r
|
|
91
91
|
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2\r
|
|
92
|
-
`,children:s({id:"theme.reset"})})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.styleTier.label"})}),e.jsx("div",{className:"grid grid-cols-3 gap-3",role:"radiogroup","aria-label":s({id:"theme.styleTier.label"}),children:
|
|
92
|
+
`,children:s({id:"theme.reset"})})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.styleTier.label"})}),e.jsx("div",{className:"grid grid-cols-3 gap-3",role:"radiogroup","aria-label":s({id:"theme.styleTier.label"}),children:Ns.map(o=>{const R=vs(o.id),V=h===o.id;return e.jsxs("button",{onClick:()=>$(o.id),role:"radio","aria-checked":V,className:`
|
|
93
93
|
flex flex-col items-center gap-2 p-3 rounded-lg
|
|
94
94
|
transition-all duration-200 border-2
|
|
95
|
-
${
|
|
95
|
+
${V?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
|
|
96
96
|
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
|
|
97
|
-
`,children:[e.jsxs("div",{className:"flex gap-1","aria-hidden":"true",children:[e.jsx("div",{className:"w-5 h-5 rounded-sm border border-border",style:{backgroundColor:R.bg}}),e.jsx("div",{className:"w-5 h-5 rounded-sm border border-border",style:{backgroundColor:R.surface}}),e.jsx("div",{className:"w-5 h-5 rounded-sm border border-border",style:{backgroundColor:R.accent}})]}),e.jsx("span",{className:"text-xs font-medium text-text text-center",children:s({id:o.nameKey})}),e.jsx("span",{className:"text-[10px] text-text-tertiary text-center leading-tight",children:s({id:o.descKey})})]},o.id)})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.gradient.title"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":s({id:"theme.gradient.title"}),children:["off","standard","enhanced"].map(o=>e.jsx("button",{onClick:()=>
|
|
97
|
+
`,children:[e.jsxs("div",{className:"flex gap-1","aria-hidden":"true",children:[e.jsx("div",{className:"w-5 h-5 rounded-sm border border-border",style:{backgroundColor:R.bg}}),e.jsx("div",{className:"w-5 h-5 rounded-sm border border-border",style:{backgroundColor:R.surface}}),e.jsx("div",{className:"w-5 h-5 rounded-sm border border-border",style:{backgroundColor:R.accent}})]}),e.jsx("span",{className:"text-xs font-medium text-text text-center",children:s({id:o.nameKey})}),e.jsx("span",{className:"text-[10px] text-text-tertiary text-center leading-tight",children:s({id:o.descKey})})]},o.id)})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.gradient.title"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":s({id:"theme.gradient.title"}),children:["off","standard","enhanced"].map(o=>e.jsx("button",{onClick:()=>P(o),role:"radio","aria-checked":d===o,className:`
|
|
98
98
|
flex-1 px-3 py-2 rounded-lg text-sm font-medium
|
|
99
99
|
transition-all duration-200 border-2
|
|
100
100
|
${d===o?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
|
|
@@ -105,32 +105,32 @@ import{O as ge,r as i,ab as As,u as J,co as Re,j as e,al as Os,cp as Rs,cq as Se
|
|
|
105
105
|
`}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.gradient.hoverGlow"})})]}),e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p,onChange:o=>v(o.target.checked),className:`\r
|
|
106
106
|
w-4 h-4 rounded border-border text-accent\r
|
|
107
107
|
focus:ring-2 focus:ring-accent focus:ring-offset-2\r
|
|
108
|
-
`}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.gradient.bgAnimation"})})]})]})]}),e.jsx(
|
|
108
|
+
`}),e.jsx("span",{className:"text-sm text-text",children:s({id:"theme.gradient.bgAnimation"})})]})]})]}),e.jsx(ra,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.motion.label"})}),e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":s({id:"theme.motion.label"}),children:["system","reduce","enable"].map(o=>e.jsx("button",{onClick:()=>k(o),role:"radio","aria-checked":N===o,className:`
|
|
109
109
|
flex-1 px-3 py-2 rounded-lg text-sm font-medium
|
|
110
110
|
transition-all duration-200 border-2
|
|
111
111
|
${N===o?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
|
|
112
112
|
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
|
|
113
|
-
`,children:s({id:`theme.motion.${o}`})},o))})]}),
|
|
113
|
+
`,children:s({id:`theme.motion.${o}`})},o))})]}),Y&&ee.length>0&&e.jsxs("div",{className:"p-3 rounded-lg bg-warning-light border border-warning text-warning-text space-y-2",children:[e.jsx("p",{className:"text-xs font-medium",children:s({id:"theme.accessibility.contrastWarning"})}),e.jsx("ul",{className:"text-xs space-y-1",children:ee.map(o=>{const R=`${o.fgVar}|${o.bgVar}`,V=de[R]||[];return e.jsxs("li",{className:"space-y-1",children:[e.jsxs("span",{children:[o.fgVar," / ",o.bgVar,": ",o.ratio,":1 (min ",o.required,":1)"]}),V.length>0&&e.jsx("div",{className:"ml-2 text-[10px]",children:V.slice(0,1).map((T,he)=>e.jsx("span",{className:"block",children:s({id:"theme.accessibility.fixSuggestion"},{target:T.target==="fg"?o.fgVar:o.bgVar,original:T.original,suggested:T.suggested,ratio:T.resultRatio})},he))})]},R)})}),e.jsx("button",{onClick:()=>re(!1),className:"text-xs font-medium underline",children:s({id:"theme.accessibility.dismiss"})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.title.themeMode"})}),e.jsx("div",{className:"grid grid-cols-2 gap-3",role:"group","aria-label":"Theme mode selection",children:zs.map(o=>e.jsxs("button",{onClick:()=>Cs(o.id),"aria-label":s({id:"theme.select.themeMode"},{name:s({id:`theme.themeMode.${o.id}`})}),"aria-selected":oe===o.id,role:"radio",className:`
|
|
114
114
|
flex items-center justify-center gap-2 p-3 rounded-lg
|
|
115
115
|
transition-all duration-200 border-2
|
|
116
|
-
${
|
|
116
|
+
${oe===o.id?"border-accent bg-surface shadow-md":"border-border bg-bg hover:bg-surface"}
|
|
117
117
|
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
|
|
118
|
-
`,children:[e.jsx("span",{className:"text-lg","aria-hidden":"true",children:o.id==="light"?"☀️":"🌙"}),e.jsx("span",{className:"text-sm font-medium text-text",children:s({id:`theme.themeMode.${o.id}`})})]},o.id))})]}),e.jsx("div",{className:"p-3 rounded-lg bg-surface border border-border",children:e.jsx("p",{className:"text-xs text-text-secondary",children:s({id:"theme.current"},{name
|
|
118
|
+
`,children:[e.jsx("span",{className:"text-lg","aria-hidden":"true",children:o.id==="light"?"☀️":"🌙"}),e.jsx("span",{className:"text-sm font-medium text-text",children:s({id:`theme.themeMode.${o.id}`})})]},o.id))})]}),e.jsx("div",{className:"p-3 rounded-lg bg-surface border border-border",children:e.jsx("p",{className:"text-xs text-text-secondary",children:s({id:"theme.current"},{name:_s(t,oe)})})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-text mb-3",children:s({id:"theme.share.label"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:Ps,className:`\r
|
|
119
119
|
flex-1 px-3 py-2 rounded-lg text-sm font-medium\r
|
|
120
120
|
border-2 border-border bg-bg text-text\r
|
|
121
121
|
hover:bg-surface transition-all duration-200\r
|
|
122
122
|
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2\r
|
|
123
|
-
`,children:s(
|
|
123
|
+
`,children:s(js?{id:"theme.share.copied"}:{id:"theme.share.copyCode"})}),e.jsx("button",{onClick:Pe?Ce:Ds,className:`
|
|
124
124
|
flex-1 px-3 py-2 rounded-lg text-sm font-medium
|
|
125
125
|
transition-all duration-200 border-2
|
|
126
126
|
${Pe?"border-accent bg-surface shadow-md":"border-border bg-bg text-text hover:bg-surface"}
|
|
127
127
|
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2
|
|
128
|
-
`,children:s({id:"theme.share.import"})})]}),Pe&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("textarea",{value:
|
|
128
|
+
`,children:s({id:"theme.share.import"})})]}),Pe&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("textarea",{value:ps,onChange:o=>Us(o.target.value),placeholder:s({id:"theme.share.paste"}),rows:3,className:`\r
|
|
129
129
|
w-full px-3 py-2 rounded-lg text-sm font-mono\r
|
|
130
130
|
bg-bg border-2 border-border text-text\r
|
|
131
131
|
placeholder-text-tertiary resize-none\r
|
|
132
132
|
focus:outline-none focus:ring-2 focus:ring-accent focus:border-accent\r
|
|
133
|
-
`}),we&&e.jsx("div",{className:"p-2 rounded-lg bg-error-light border border-error text-error-text text-xs",children:s({id:
|
|
133
|
+
`}),we&&e.jsx("div",{className:"p-2 rounded-lg bg-error-light border border-error text-error-text text-xs",children:s({id:As(we)})}),bs&&!we&&e.jsx("div",{className:"p-2 rounded-lg bg-warning-light border border-warning text-warning-text text-xs",children:s({id:"theme.share.versionWarning"})}),L&&!we&&e.jsxs("div",{className:"p-3 rounded-lg bg-surface border border-border space-y-3",children:[e.jsx("p",{className:"text-xs font-medium text-text",children:s({id:"theme.share.preview"})}),e.jsx("div",{className:"flex gap-3 items-end",children:(()=>{const o=Is(L);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:o.bg}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.background"})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:o.surface}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.surface"})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-10 h-10 rounded border-2 border-border shadow-sm",style:{backgroundColor:o.accent}}),e.jsx("span",{className:"text-[10px] text-text-tertiary",children:s({id:"theme.preview.accent"})})]})]})})()}),e.jsxs("div",{className:"text-xs text-text-secondary space-y-1",children:[e.jsxs("p",{children:[s({id:"theme.styleTier.label"}),": ",s({id:`theme.styleTier.${L.styleTier==="high-contrast"?"highContrast":L.styleTier}`})]}),e.jsxs("p",{children:[s({id:"theme.gradient.title"}),": ",s({id:`theme.gradient.${L.gradientLevel}`})]}),L.customHue!==null&&e.jsx("p",{children:s({id:"theme.hueValue"},{value:L.customHue})}),L.customHue===null&&e.jsxs("p",{children:[s({id:"theme.title.colorScheme"}),": ",s({id:`theme.colorScheme.${L.colorScheme}`})]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx("button",{onClick:Ls,className:`\r
|
|
134
134
|
flex-1 px-4 py-2 rounded-lg text-sm font-medium\r
|
|
135
135
|
bg-accent text-white hover:bg-accent-hover\r
|
|
136
136
|
transition-all duration-200\r
|
|
@@ -140,11 +140,11 @@ import{O as ge,r as i,ab as As,u as J,co as Re,j as e,al as Os,cp as Rs,cq as Se
|
|
|
140
140
|
border-2 border-border bg-bg text-text\r
|
|
141
141
|
hover:bg-surface transition-all duration-200\r
|
|
142
142
|
focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2\r
|
|
143
|
-
`,children:s({id:"theme.share.cancel"})})]})]})]}),e.jsx(bt,{open:U!==null,onOpenChange:Ge,children:e.jsxs(jt,{children:[e.jsxs(Nt,{children:[e.jsx(vt,{children:"Delete Theme Slot?"}),e.jsx(yt,{children:"This action cannot be undone. The theme slot will be permanently deleted."})]}),e.jsxs(wt,{children:[e.jsx(kt,{onClick:Ge,children:"Cancel"}),e.jsx(Ct,{onClick:Ms,children:"Delete"})]})]})})]})]})}const ra=[{value:"en",label:"English",flag:"🇺🇸"},{value:"zh",label:"中文",flag:"🇨🇳"}];function ia({compact:s=!1,className:t}){const{locale:n,setLocale:r}=Ht();return e.jsxs(Vs,{value:n,onValueChange:r,children:[e.jsx(qs,{className:$(s?"w-[110px]":"w-[160px]","gap-2",t),"aria-label":"Select language",children:s?e.jsxs(e.Fragment,{children:[e.jsx(is,{className:"w-4 h-4"}),e.jsx(Je,{})]}):e.jsx(Je,{})}),e.jsx(Ws,{children:ra.map(c=>e.jsx(Gs,{value:c.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-base",children:c.flag}),e.jsx("span",{children:c.label})]})},c.value))})]})}const Ae={discord:{id:"discord",name:"Discord",icon:"message-circle",description:"Send notifications to Discord channels via webhook",requiredFields:["webhookUrl"]},telegram:{id:"telegram",name:"Telegram",icon:"send",description:"Send notifications to Telegram chats via bot",requiredFields:["botToken","chatId"]},feishu:{id:"feishu",name:"Feishu",icon:"message-square",description:"Send notifications to Feishu (Lark) via webhook with rich card support",requiredFields:["webhookUrl"]},dingtalk:{id:"dingtalk",name:"DingTalk",icon:"bell",description:"Send notifications to DingTalk via webhook",requiredFields:["webhookUrl"]},wecom:{id:"wecom",name:"WeCom",icon:"users",description:"Send notifications to WeCom (WeChat Work) via webhook",requiredFields:["webhookUrl"]},email:{id:"email",name:"Email",icon:"mail",description:"Send notifications via SMTP email",requiredFields:["host","username","password","from","to"]},webhook:{id:"webhook",name:"Custom Webhook",icon:"link",description:"Send notifications to a custom HTTP endpoint",requiredFields:["url"]}},la={"ask-user-question":{id:"ask-user-question",name:"Ask User Question",description:"Notification when Claude asks a question via AskUserQuestion",icon:"help-circle"},"session-start":{id:"session-start",name:"Session Start",description:"Notification when a CLI session starts",icon:"play"},"session-end":{id:"session-end",name:"Session End",description:"Notification when a CLI session ends",icon:"square"},"task-completed":{id:"task-completed",name:"Task Completed",description:"Notification when a task completes successfully",icon:"check-circle"},"task-failed":{id:"task-failed",name:"Task Failed",description:"Notification when a task fails",icon:"alert-circle"}};function Qe(){return{enabled:!1,platforms:{},events:[{event:"ask-user-question",platforms:["discord","telegram"],enabled:!0},{event:"session-start",platforms:[],enabled:!1},{event:"session-end",platforms:[],enabled:!1},{event:"task-completed",platforms:[],enabled:!1},{event:"task-failed",platforms:["discord","telegram"],enabled:!0}],timeout:1e4}}function oa({config:s,expandedPlatform:t,testing:n,onToggleExpand:r,onUpdateConfig:c,onTest:d,onSave:x,saving:p}){const{formatMessage:N}=J(),f=["discord","telegram","feishu","dingtalk","wecom","email","webhook"],E=u=>{switch(u){case"discord":return e.jsx(Xs,{className:"w-4 h-4"});case"telegram":return e.jsx(zt,{className:"w-4 h-4"});case"feishu":return e.jsx(ts,{className:"w-4 h-4"});case"dingtalk":return e.jsx(Be,{className:"w-4 h-4"});case"wecom":return e.jsx(Js,{className:"w-4 h-4"});case"email":return e.jsx(Ks,{className:"w-4 h-4"});case"webhook":return e.jsx($t,{className:"w-4 h-4"})}},w=u=>{switch(u){case"discord":return s.platforms.discord||{enabled:!1,webhookUrl:""};case"telegram":return s.platforms.telegram||{enabled:!1,botToken:"",chatId:""};case"feishu":return s.platforms.feishu||{enabled:!1,webhookUrl:""};case"dingtalk":return s.platforms.dingtalk||{enabled:!1,webhookUrl:""};case"wecom":return s.platforms.wecom||{enabled:!1,webhookUrl:""};case"email":return s.platforms.email||{enabled:!1,host:"",port:587,username:"",password:"",from:"",to:[]};case"webhook":return s.platforms.webhook||{enabled:!1,url:"",method:"POST"}}},F=u=>{var k;const v=w(u);switch(u){case"discord":return!!v.webhookUrl;case"telegram":return!!v.botToken&&!!v.chatId;case"feishu":return!!v.webhookUrl;case"dingtalk":return!!v.webhookUrl;case"wecom":return!!v.webhookUrl;case"email":const h=v;return!!(h.host&&h.username&&h.password&&h.from&&((k=h.to)==null?void 0:k.length)>0);case"webhook":return!!v.url}};return e.jsx("div",{className:"grid gap-3",children:f.map(u=>{const v=Ae[u],k=w(u),h=F(u),H=t===u;return e.jsxs(Y,{className:"overflow-hidden",children:[e.jsx("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>r(H?null:u),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:$("p-2 rounded-lg",k.enabled&&h?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:E(u)}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:v.name}),h&&e.jsxs(Q,{variant:"outline",className:"text-xs text-green-600 border-green-500/30",children:[e.jsx(ie,{className:"w-3 h-3 mr-1"}),N({id:"settings.remoteNotifications.configured"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:v.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{variant:k.enabled?"default":"outline",size:"sm",className:"h-7",onClick:C=>{C.stopPropagation(),c(u,{enabled:!k.enabled})},children:k.enabled?e.jsx(ie,{className:"w-3.5 h-3.5"}):e.jsx(ae,{className:"w-3.5 h-3.5"})}),H?e.jsx(He,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Ee,{className:"w-4 h-4 text-muted-foreground"})]})]})}),H&&e.jsxs("div",{className:"border-t border-border p-4 space-y-4 bg-muted/30",children:[u==="discord"&&e.jsx(ca,{config:k,onUpdate:C=>c("discord",C)}),u==="telegram"&&e.jsx(da,{config:k,onUpdate:C=>c("telegram",C)}),u==="feishu"&&e.jsx(ua,{config:k,onUpdate:C=>c("feishu",C)}),u==="dingtalk"&&e.jsx(xa,{config:k,onUpdate:C=>c("dingtalk",C)}),u==="wecom"&&e.jsx(ha,{config:k,onUpdate:C=>c("wecom",C)}),u==="email"&&e.jsx(ga,{config:k,onUpdate:C=>c("email",C)}),u==="webhook"&&e.jsx(ma,{config:k,onUpdate:C=>c("webhook",C)}),e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>d(u,k),disabled:n===u||!h,children:[e.jsx(Bt,{className:$("w-3.5 h-3.5 mr-1",n===u&&"animate-pulse")}),N({id:"settings.remoteNotifications.testConnection"})]}),e.jsx(j,{variant:"default",size:"sm",onClick:x,disabled:p,children:N({id:"settings.remoteNotifications.save"})})]})]})]},u)})})}function ca({config:s,onUpdate:t}){const{formatMessage:n}=J(),[r,c]=i.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.discord.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(P,{type:r?"text":"password",value:s.webhookUrl||"",onChange:d=>t({webhookUrl:d.target.value}),placeholder:"https://discord.com/api/webhooks/...",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!r),children:r?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.discord.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.discord.username"})}),e.jsx(P,{value:s.username||"",onChange:d=>t({username:d.target.value}),placeholder:"CCW Notification",className:"mt-1"})]})]})}function da({config:s,onUpdate:t}){const{formatMessage:n}=J(),[r,c]=i.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.telegram.botToken"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(P,{type:r?"text":"password",value:s.botToken||"",onChange:d=>t({botToken:d.target.value}),placeholder:"1234567890:ABCdefGHIjklMNOpqrsTUVwxyz",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!r),children:r?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.telegram.botTokenHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.telegram.chatId"})}),e.jsx(P,{value:s.chatId||"",onChange:d=>t({chatId:d.target.value}),placeholder:"-1001234567890",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.telegram.chatIdHint"})})]})]})}function ma({config:s,onUpdate:t}){const{formatMessage:n}=J();return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.webhook.url"})}),e.jsx(P,{value:s.url||"",onChange:r=>t({url:r.target.value}),placeholder:"https://your-server.com/webhook",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.webhook.method"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(j,{variant:s.method==="POST"?"default":"outline",size:"sm",onClick:()=>t({method:"POST"}),children:"POST"}),e.jsx(j,{variant:s.method==="PUT"?"default":"outline",size:"sm",onClick:()=>t({method:"PUT"}),children:"PUT"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.webhook.headers"})}),e.jsx(P,{value:s.headers?JSON.stringify(s.headers):"",onChange:r=>{try{const c=r.target.value?JSON.parse(r.target.value):void 0;t({headers:c})}catch{}},placeholder:'{"Authorization": "Bearer token"}',className:"mt-1 font-mono text-xs"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.webhook.headersHint"})})]})]})}function ua({config:s,onUpdate:t}){const{formatMessage:n}=J(),[r,c]=i.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.feishu.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(P,{type:r?"text":"password",value:s.webhookUrl||"",onChange:d=>t({webhookUrl:d.target.value}),placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!r),children:r?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.feishu.webhookUrlHint"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"feishu-useCard",checked:s.useCard||!1,onChange:d=>t({useCard:d.target.checked}),className:"rounded border-border"}),e.jsx("label",{htmlFor:"feishu-useCard",className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.feishu.useCard"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:n({id:"settings.remoteNotifications.feishu.useCardHint"})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.feishu.title"})}),e.jsx(P,{value:s.title||"",onChange:d=>t({title:d.target.value}),placeholder:"CCW Notification",className:"mt-1"})]})]})}function xa({config:s,onUpdate:t}){var d;const{formatMessage:n}=J(),[r,c]=i.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.dingtalk.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(P,{type:r?"text":"password",value:s.webhookUrl||"",onChange:x=>t({webhookUrl:x.target.value}),placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!r),children:r?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.dingtalk.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.dingtalk.keywords"})}),e.jsx(P,{value:((d=s.keywords)==null?void 0:d.join(", "))||"",onChange:x=>t({keywords:x.target.value.split(",").map(p=>p.trim()).filter(Boolean)}),placeholder:"keyword1, keyword2",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.dingtalk.keywordsHint"})})]})]})}function ha({config:s,onUpdate:t}){var d;const{formatMessage:n}=J(),[r,c]=i.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.wecom.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(P,{type:r?"text":"password",value:s.webhookUrl||"",onChange:x=>t({webhookUrl:x.target.value}),placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!r),children:r?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.wecom.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.wecom.mentionedList"})}),e.jsx(P,{value:((d=s.mentionedList)==null?void 0:d.join(", "))||"",onChange:x=>t({mentionedList:x.target.value.split(",").map(p=>p.trim()).filter(Boolean)}),placeholder:"userid1, userid2, @all",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.wecom.mentionedListHint"})})]})]})}function ga({config:s,onUpdate:t}){var d;const{formatMessage:n}=J(),[r,c]=i.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.host"})}),e.jsx(P,{value:s.host||"",onChange:x=>t({host:x.target.value}),placeholder:"smtp.gmail.com",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.email.hostHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.port"})}),e.jsx(P,{type:"number",value:s.port||587,onChange:x=>t({port:parseInt(x.target.value,10)||587}),placeholder:"587",className:"mt-1"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"email-secure",checked:s.secure||!1,onChange:x=>t({secure:x.target.checked}),className:"rounded border-border"}),e.jsx("label",{htmlFor:"email-secure",className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.secure"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.username"})}),e.jsx(P,{value:s.username||"",onChange:x=>t({username:x.target.value}),placeholder:"your-email@gmail.com",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.password"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(P,{type:r?"text":"password",value:s.password||"",onChange:x=>t({password:x.target.value}),placeholder:"********",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!r),children:r?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.from"})}),e.jsx(P,{value:s.from||"",onChange:x=>t({from:x.target.value}),placeholder:"noreply@example.com",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.to"})}),e.jsx(P,{value:((d=s.to)==null?void 0:d.join(", "))||"",onChange:x=>t({to:x.target.value.split(",").map(p=>p.trim()).filter(Boolean)}),placeholder:"user1@example.com, user2@example.com",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.email.toHint"})})]})]})}function fa({className:s}){const{formatMessage:t}=J(),[n,r]=i.useState(null),[c,d]=i.useState(!0),[x,p]=i.useState(!1),[N,f]=i.useState(null),[E,w]=i.useState(null),[F,u]=i.useState(null),v=i.useCallback(async()=>{d(!0);try{const b=await fetch("/api/notifications/remote/config");if(b.ok){const y=await b.json();r(y)}else r(Qe())}catch(b){console.error("Failed to load remote notification config:",b),r(Qe())}finally{d(!1)}},[]);i.useEffect(()=>{v()},[v]);const k=i.useCallback(async b=>{p(!0);try{const y=await fetch("/api/notifications/remote/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(y.ok){const l=await y.json();r(l.config),B.success(t({id:"settings.remoteNotifications.saved"}))}else throw new Error(`HTTP ${y.status}`)}catch{B.error(t({id:"settings.remoteNotifications.saveError"}))}finally{p(!1)}},[t]),h=i.useCallback(async(b,y)=>{f(b);try{const g=await(await fetch("/api/notifications/remote/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({platform:b,config:y})})).json();g.success?B.success(t({id:"settings.remoteNotifications.testSuccess"}),{description:`${g.responseTime}ms`}):B.error(t({id:"settings.remoteNotifications.testFailed"}),{description:g.error})}catch{B.error(t({id:"settings.remoteNotifications.testError"}))}finally{f(null)}},[t]),H=()=>{n&&k({...n,enabled:!n.enabled})},C=(b,y)=>{if(!n)return;const l={...n,platforms:{...n.platforms,[b]:{...n.platforms[b],...y}}};r(l)},M=(b,y)=>{if(!n)return;const l=[...n.events];l[b]={...l[b],...y},r({...n,events:l})},O=(b,y)=>{if(!n)return;const l=n.events[b],g=l.platforms.includes(y)?l.platforms.filter(m=>m!==y):[...l.platforms,y];M(b,{platforms:g})},W=["discord","telegram","feishu","dingtalk","wecom","email","webhook"],A=async()=>{if(confirm(t({id:"settings.remoteNotifications.resetConfirm"})))try{const b=await fetch("/api/notifications/remote/reset",{method:"POST"});if(b.ok){const y=await b.json();r(y.config),B.success(t({id:"settings.remoteNotifications.resetSuccess"}))}}catch{B.error(t({id:"settings.remoteNotifications.resetError"}))}};return c?e.jsx(Y,{className:$("p-6",s),children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(ue,{className:"w-5 h-5 animate-spin text-muted-foreground"})})}):n?e.jsxs(Y,{className:$("p-6",s),children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[n.enabled?e.jsx(Be,{className:"w-5 h-5 text-primary"}):e.jsx(Kt,{className:"w-5 h-5 text-muted-foreground"}),t({id:"settings.remoteNotifications.title"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{variant:"outline",size:"sm",onClick:()=>v(),disabled:c,children:e.jsx(ue,{className:$("w-3.5 h-3.5",c&&"animate-spin")})}),e.jsx(j,{variant:n.enabled?"default":"outline",size:"sm",onClick:H,children:n.enabled?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),t({id:"settings.remoteNotifications.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 mr-1"}),t({id:"settings.remoteNotifications.disabled"})]})})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:t({id:"settings.remoteNotifications.description"})}),n.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4 mb-6",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:t({id:"settings.remoteNotifications.platforms"})}),e.jsx(oa,{config:n,expandedPlatform:E,testing:N,onToggleExpand:w,onUpdateConfig:C,onTest:h,onSave:()=>k(n),saving:x})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:t({id:"settings.remoteNotifications.events"})}),e.jsx("div",{className:"grid gap-3",children:n.events.map((b,y)=>{const l=la[b.event],g=F===y;return e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>u(g?null:y),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:$("p-2 rounded-lg",b.enabled?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:e.jsx("span",{className:"text-sm",children:l.icon})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:l.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1 flex-wrap max-w-xs",children:[b.platforms.slice(0,3).map(m=>e.jsx(Q,{variant:"secondary",className:"text-xs",children:Ae[m].name},m)),b.platforms.length>3&&e.jsxs(Q,{variant:"secondary",className:"text-xs",children:["+",b.platforms.length-3]}),b.platforms.length===0&&e.jsx(Q,{variant:"outline",className:"text-xs text-muted-foreground",children:t({id:"settings.remoteNotifications.noPlatforms"})})]}),e.jsx(j,{variant:b.enabled?"default":"outline",size:"sm",className:"h-7",onClick:m=>{m.stopPropagation(),M(y,{enabled:!b.enabled})},children:b.enabled?e.jsx(ie,{className:"w-3.5 h-3.5"}):e.jsx(ae,{className:"w-3.5 h-3.5"})}),g?e.jsx(He,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Ee,{className:"w-4 h-4 text-muted-foreground"})]})]}),g&&e.jsxs("div",{className:"border-t border-border p-4 space-y-3 bg-muted/20",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:t({id:"settings.remoteNotifications.selectPlatforms"})}),e.jsx("div",{className:"flex flex-wrap gap-2",children:W.map(m=>{const D=b.platforms.includes(m),_=Ae[m],G=n.platforms[m],q=G==null?void 0:G.enabled;return e.jsxs(j,{variant:D?"default":"outline",size:"sm",className:$("h-8",!q&&!D&&"opacity-50"),onClick:()=>O(y,m),children:[D&&e.jsx(ie,{className:"w-3 h-3 mr-1"}),_.name,!q&&!D&&e.jsx(Ne,{className:"w-3 h-3 ml-1 opacity-50"})]},m)})})]})]},b.event)})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-6 pt-4 border-t border-border",children:[e.jsx(j,{variant:"outline",size:"sm",onClick:A,children:t({id:"settings.remoteNotifications.reset"})}),e.jsxs(j,{variant:"default",size:"sm",onClick:()=>k(n),disabled:x,children:[e.jsx(Fe,{className:"w-4 h-4 mr-1"}),t(x?{id:"settings.remoteNotifications.saving"}:{id:"settings.remoteNotifications.save"})]})]})]})]}):null}function pa({value:s,label:t,description:n,selected:r,onClick:c}){const d={modal:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-center justify-center",children:e.jsx("div",{className:"w-4 h-3 border border-current rounded-sm"})}),drawer:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-end justify-end p-0.5",children:e.jsx("div",{className:"w-2 h-6 border border-current rounded-sm"})}),sheet:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-end justify-center p-0.5",children:e.jsx("div",{className:"w-6 h-2 border border-current rounded-sm"})}),fullscreen:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-center justify-center",children:e.jsx("div",{className:"w-5 h-4 border border-current rounded-sm"})})};return e.jsxs("button",{type:"button",onClick:c,className:$("flex flex-col items-center gap-2 p-3 rounded-lg border-2 transition-all","hover:bg-accent/50",r?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground"),children:[d[s],e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:$("text-sm font-medium",r&&"text-primary"),children:t}),e.jsx("div",{className:"text-xs text-muted-foreground",children:n})]})]})}function ba({value:s,onChange:t,disabled:n}){const r=[10,20,30,45,60,90,120];return e.jsx("div",{className:"flex flex-wrap gap-2",children:r.map(c=>e.jsxs(j,{type:"button",variant:s===c?"default":"outline",size:"sm",disabled:n,onClick:()=>t(c),children:[c,"s"]},c))})}function ja(){const{formatMessage:s}=J(),{preferences:t,updatePreference:n,resetPreferences:r}=Ys(),c=[{value:"modal",label:s({id:"settings.a2ui.styleModal",defaultMessage:"Modal"}),description:s({id:"settings.a2ui.styleModalDesc",defaultMessage:"Centered"})},{value:"drawer",label:s({id:"settings.a2ui.styleDrawer",defaultMessage:"Drawer"}),description:s({id:"settings.a2ui.styleDrawerDesc",defaultMessage:"Side panel"})},{value:"sheet",label:s({id:"settings.a2ui.styleSheet",defaultMessage:"Sheet"}),description:s({id:"settings.a2ui.styleSheetDesc",defaultMessage:"Bottom"})},{value:"fullscreen",label:s({id:"settings.a2ui.styleFullscreen",defaultMessage:"Fullscreen"}),description:s({id:"settings.a2ui.styleFullscreenDesc",defaultMessage:"Full screen"})}];return e.jsxs(Y,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(ts,{className:"w-5 h-5"}),s({id:"settings.sections.a2ui",defaultMessage:"A2UI Preferences"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs(Xe,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Jt,{className:"w-4 h-4"}),s({id:"settings.a2ui.dialogStyle",defaultMessage:"Dialog Style"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.dialogStyleDesc",defaultMessage:"Choose how A2UI dialogs are displayed"})}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:c.map(d=>e.jsx(pa,{value:d.value,label:d.label,description:d.description,selected:t.dialogStyle===d.value,onClick:()=>n("dialogStyle",d.value)},d.value))})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qs,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.smartMode",defaultMessage:"Smart Mode"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.smartModeDesc",defaultMessage:"Auto-select style based on question type"})})]})]}),e.jsx(j,{variant:t.smartModeEnabled?"default":"outline",size:"sm",onClick:()=>n("smartModeEnabled",!t.smartModeEnabled),children:t.smartModeEnabled?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsxs("div",{className:"space-y-3 py-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Zs,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(Xe,{className:"text-sm font-medium",children:s({id:"settings.a2ui.autoSelectionDuration",defaultMessage:"Auto-Selection Duration"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.autoSelectionDurationDesc",defaultMessage:"Countdown before auto-selecting default option"})}),e.jsx(ba,{value:t.autoSelectionDuration,onChange:d=>n("autoSelectionDuration",d)})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.pauseOnInteraction",defaultMessage:"Pause on Interaction"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.pauseOnInteractionDesc",defaultMessage:"Pause countdown when you interact with the dialog"})})]}),e.jsx(j,{variant:t.pauseOnInteraction?"default":"outline",size:"sm",onClick:()=>n("pauseOnInteraction",!t.pauseOnInteraction),children:t.pauseOnInteraction?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Yt,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.soundNotification",defaultMessage:"Sound Notification"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.soundNotificationDesc",defaultMessage:"Play sound before auto-submit (3 seconds before)"})})]})]}),e.jsx(j,{variant:t.autoSelectionSoundEnabled?"default":"outline",size:"sm",onClick:()=>n("autoSelectionSoundEnabled",!t.autoSelectionSoundEnabled),children:t.autoSelectionSoundEnabled?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.showToolbarButton",defaultMessage:"Show Toolbar Button"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.showToolbarButtonDesc",defaultMessage:"Show A2UI quick action button in the toolbar"})})]}),e.jsx(j,{variant:t.showA2UIButtonInToolbar?"default":"outline",size:"sm",onClick:()=>n("showA2UIButtonInToolbar",!t.showA2UIButtonInToolbar),children:t.showA2UIButtonInToolbar?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t border-border",children:e.jsx(j,{variant:"outline",size:"sm",onClick:r,children:s({id:"common.resetToDefaults",defaultMessage:"Reset to Defaults"})})})]})]})}const os=["","low","medium","high"],cs=["","low","medium","high","max"],Me=["sonnet","opus","haiku","inherit"],ds=["","default","acceptEdits","dontAsk","bypassPermissions","plan"],ms=["","user","project","local"],us=["","worktree"],xs=["","purple","blue","yellow","green","red"],Oe=["PreToolUse","PostToolUse","Stop"],ee="h-7 text-xs rounded border border-input bg-background px-2",V="text-xs text-muted-foreground shrink-0";function Ze(s){if(!s)return[];const t=[],n=s.split(`
|
|
144
|
-
`);for(const r of n){const c=r.match(/^\s+-\s+(.+)$/);c&&t.push(c[1].trim())}return t}function
|
|
143
|
+
`,children:s({id:"theme.share.cancel"})})]})]})]}),e.jsx(Nt,{open:U!==null,onOpenChange:Ge,children:e.jsxs(vt,{children:[e.jsxs(yt,{children:[e.jsx(wt,{children:"Delete Theme Slot?"}),e.jsx(kt,{children:"This action cannot be undone. The theme slot will be permanently deleted."})]}),e.jsxs(Ct,{children:[e.jsx(St,{onClick:Ge,children:"Cancel"}),e.jsx(Tt,{onClick:Fs,children:"Delete"})]})]})})]})]})}const la=[{value:"en",label:"English",flag:"🇺🇸"},{value:"zh",label:"中文",flag:"🇨🇳"}];function oa({compact:s=!1,className:t}){const{locale:n,setLocale:r}=Bt();return e.jsxs(Ws,{value:n,onValueChange:r,children:[e.jsx(Gs,{className:z(s?"w-[110px]":"w-[160px]","gap-2",t),"aria-label":"Select language",children:s?e.jsxs(e.Fragment,{children:[e.jsx(ls,{className:"w-4 h-4"}),e.jsx(Je,{})]}):e.jsx(Je,{})}),e.jsx(Ks,{children:la.map(c=>e.jsx(Js,{value:c.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-base",children:c.flag}),e.jsx("span",{children:c.label})]})},c.value))})]})}const Ae={discord:{id:"discord",name:"Discord",icon:"message-circle",description:"Send notifications to Discord channels via webhook",requiredFields:["webhookUrl"]},telegram:{id:"telegram",name:"Telegram",icon:"send",description:"Send notifications to Telegram chats via bot",requiredFields:["botToken","chatId"]},feishu:{id:"feishu",name:"Feishu",icon:"message-square",description:"Send notifications to Feishu (Lark) via webhook with rich card support",requiredFields:["webhookUrl"]},dingtalk:{id:"dingtalk",name:"DingTalk",icon:"bell",description:"Send notifications to DingTalk via webhook",requiredFields:["webhookUrl"]},wecom:{id:"wecom",name:"WeCom",icon:"users",description:"Send notifications to WeCom (WeChat Work) via webhook",requiredFields:["webhookUrl"]},email:{id:"email",name:"Email",icon:"mail",description:"Send notifications via SMTP email",requiredFields:["host","username","password","from","to"]},webhook:{id:"webhook",name:"Custom Webhook",icon:"link",description:"Send notifications to a custom HTTP endpoint",requiredFields:["url"]}},ca={"ask-user-question":{id:"ask-user-question",name:"Ask User Question",description:"Notification when Claude asks a question via AskUserQuestion",icon:"help-circle"},"session-start":{id:"session-start",name:"Session Start",description:"Notification when a CLI session starts",icon:"play"},"session-end":{id:"session-end",name:"Session End",description:"Notification when a CLI session ends",icon:"square"},"task-completed":{id:"task-completed",name:"Task Completed",description:"Notification when a task completes successfully",icon:"check-circle"},"task-failed":{id:"task-failed",name:"Task Failed",description:"Notification when a task fails",icon:"alert-circle"}};function Qe(){return{enabled:!1,platforms:{},events:[{event:"ask-user-question",platforms:["discord","telegram"],enabled:!0},{event:"session-start",platforms:[],enabled:!1},{event:"session-end",platforms:[],enabled:!1},{event:"task-completed",platforms:[],enabled:!1},{event:"task-failed",platforms:["discord","telegram"],enabled:!0}],timeout:1e4}}function da({config:s,expandedPlatform:t,testing:n,onToggleExpand:r,onUpdateConfig:c,onTest:d,onSave:x,saving:p}){const{formatMessage:N}=X(),f=["discord","telegram","feishu","dingtalk","wecom","email","webhook"],F=u=>{switch(u){case"discord":return e.jsx(Qs,{className:"w-4 h-4"});case"telegram":return e.jsx(Vt,{className:"w-4 h-4"});case"feishu":return e.jsx(as,{className:"w-4 h-4"});case"dingtalk":return e.jsx($e,{className:"w-4 h-4"});case"wecom":return e.jsx(Ys,{className:"w-4 h-4"});case"email":return e.jsx(Xs,{className:"w-4 h-4"});case"webhook":return e.jsx(_t,{className:"w-4 h-4"})}},w=u=>{switch(u){case"discord":return s.platforms.discord||{enabled:!1,webhookUrl:""};case"telegram":return s.platforms.telegram||{enabled:!1,botToken:"",chatId:""};case"feishu":return s.platforms.feishu||{enabled:!1,webhookUrl:""};case"dingtalk":return s.platforms.dingtalk||{enabled:!1,webhookUrl:""};case"wecom":return s.platforms.wecom||{enabled:!1,webhookUrl:""};case"email":return s.platforms.email||{enabled:!1,host:"",port:587,username:"",password:"",from:"",to:[]};case"webhook":return s.platforms.webhook||{enabled:!1,url:"",method:"POST"}}},P=u=>{var k;const v=w(u);switch(u){case"discord":return!!v.webhookUrl;case"telegram":return!!v.botToken&&!!v.chatId;case"feishu":return!!v.webhookUrl;case"dingtalk":return!!v.webhookUrl;case"wecom":return!!v.webhookUrl;case"email":const h=v;return!!(h.host&&h.username&&h.password&&h.from&&((k=h.to)==null?void 0:k.length)>0);case"webhook":return!!v.url}};return e.jsx("div",{className:"grid gap-3",children:f.map(u=>{const v=Ae[u],k=w(u),h=P(u),$=t===u;return e.jsxs(Q,{className:"overflow-hidden",children:[e.jsx("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>r($?null:u),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:z("p-2 rounded-lg",k.enabled&&h?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:F(u)}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:v.name}),h&&e.jsxs(Z,{variant:"outline",className:"text-xs text-green-600 border-green-500/30",children:[e.jsx(le,{className:"w-3 h-3 mr-1"}),N({id:"settings.remoteNotifications.configured"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:v.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{variant:k.enabled?"default":"outline",size:"sm",className:"h-7",onClick:C=>{C.stopPropagation(),c(u,{enabled:!k.enabled})},children:k.enabled?e.jsx(le,{className:"w-3.5 h-3.5"}):e.jsx(ne,{className:"w-3.5 h-3.5"})}),$?e.jsx(He,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Ee,{className:"w-4 h-4 text-muted-foreground"})]})]})}),$&&e.jsxs("div",{className:"border-t border-border p-4 space-y-4 bg-muted/30",children:[u==="discord"&&e.jsx(ma,{config:k,onUpdate:C=>c("discord",C)}),u==="telegram"&&e.jsx(ua,{config:k,onUpdate:C=>c("telegram",C)}),u==="feishu"&&e.jsx(ha,{config:k,onUpdate:C=>c("feishu",C)}),u==="dingtalk"&&e.jsx(ga,{config:k,onUpdate:C=>c("dingtalk",C)}),u==="wecom"&&e.jsx(fa,{config:k,onUpdate:C=>c("wecom",C)}),u==="email"&&e.jsx(pa,{config:k,onUpdate:C=>c("email",C)}),u==="webhook"&&e.jsx(xa,{config:k,onUpdate:C=>c("webhook",C)}),e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>d(u,k),disabled:n===u||!h,children:[e.jsx(zt,{className:z("w-3.5 h-3.5 mr-1",n===u&&"animate-pulse")}),N({id:"settings.remoteNotifications.testConnection"})]}),e.jsx(j,{variant:"default",size:"sm",onClick:x,disabled:p,children:N({id:"settings.remoteNotifications.save"})})]})]})]},u)})})}function ma({config:s,onUpdate:t}){const{formatMessage:n}=X(),[r,c]=i.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.discord.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(D,{type:r?"text":"password",value:s.webhookUrl||"",onChange:d=>t({webhookUrl:d.target.value}),placeholder:"https://discord.com/api/webhooks/...",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!r),children:r?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.discord.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.discord.username"})}),e.jsx(D,{value:s.username||"",onChange:d=>t({username:d.target.value}),placeholder:"CCW Notification",className:"mt-1"})]})]})}function ua({config:s,onUpdate:t}){const{formatMessage:n}=X(),[r,c]=i.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.telegram.botToken"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(D,{type:r?"text":"password",value:s.botToken||"",onChange:d=>t({botToken:d.target.value}),placeholder:"1234567890:ABCdefGHIjklMNOpqrsTUVwxyz",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!r),children:r?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.telegram.botTokenHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.telegram.chatId"})}),e.jsx(D,{value:s.chatId||"",onChange:d=>t({chatId:d.target.value}),placeholder:"-1001234567890",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.telegram.chatIdHint"})})]})]})}function xa({config:s,onUpdate:t}){const{formatMessage:n}=X();return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.webhook.url"})}),e.jsx(D,{value:s.url||"",onChange:r=>t({url:r.target.value}),placeholder:"https://your-server.com/webhook",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.webhook.method"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(j,{variant:s.method==="POST"?"default":"outline",size:"sm",onClick:()=>t({method:"POST"}),children:"POST"}),e.jsx(j,{variant:s.method==="PUT"?"default":"outline",size:"sm",onClick:()=>t({method:"PUT"}),children:"PUT"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.webhook.headers"})}),e.jsx(D,{value:s.headers?JSON.stringify(s.headers):"",onChange:r=>{try{const c=r.target.value?JSON.parse(r.target.value):void 0;t({headers:c})}catch{}},placeholder:'{"Authorization": "Bearer token"}',className:"mt-1 font-mono text-xs"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.webhook.headersHint"})})]})]})}function ha({config:s,onUpdate:t}){const{formatMessage:n}=X(),[r,c]=i.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.feishu.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(D,{type:r?"text":"password",value:s.webhookUrl||"",onChange:d=>t({webhookUrl:d.target.value}),placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!r),children:r?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.feishu.webhookUrlHint"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"feishu-useCard",checked:s.useCard||!1,onChange:d=>t({useCard:d.target.checked}),className:"rounded border-border"}),e.jsx("label",{htmlFor:"feishu-useCard",className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.feishu.useCard"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:n({id:"settings.remoteNotifications.feishu.useCardHint"})}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.feishu.title"})}),e.jsx(D,{value:s.title||"",onChange:d=>t({title:d.target.value}),placeholder:"CCW Notification",className:"mt-1"})]})]})}function ga({config:s,onUpdate:t}){var d;const{formatMessage:n}=X(),[r,c]=i.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.dingtalk.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(D,{type:r?"text":"password",value:s.webhookUrl||"",onChange:x=>t({webhookUrl:x.target.value}),placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!r),children:r?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.dingtalk.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.dingtalk.keywords"})}),e.jsx(D,{value:((d=s.keywords)==null?void 0:d.join(", "))||"",onChange:x=>t({keywords:x.target.value.split(",").map(p=>p.trim()).filter(Boolean)}),placeholder:"keyword1, keyword2",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.dingtalk.keywordsHint"})})]})]})}function fa({config:s,onUpdate:t}){var d;const{formatMessage:n}=X(),[r,c]=i.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.wecom.webhookUrl"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(D,{type:r?"text":"password",value:s.webhookUrl||"",onChange:x=>t({webhookUrl:x.target.value}),placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!r),children:r?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.wecom.webhookUrlHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.wecom.mentionedList"})}),e.jsx(D,{value:((d=s.mentionedList)==null?void 0:d.join(", "))||"",onChange:x=>t({mentionedList:x.target.value.split(",").map(p=>p.trim()).filter(Boolean)}),placeholder:"userid1, userid2, @all",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.wecom.mentionedListHint"})})]})]})}function pa({config:s,onUpdate:t}){var d;const{formatMessage:n}=X(),[r,c]=i.useState(!1);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.host"})}),e.jsx(D,{value:s.host||"",onChange:x=>t({host:x.target.value}),placeholder:"smtp.gmail.com",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.email.hostHint"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.port"})}),e.jsx(D,{type:"number",value:s.port||587,onChange:x=>t({port:parseInt(x.target.value,10)||587}),placeholder:"587",className:"mt-1"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"email-secure",checked:s.secure||!1,onChange:x=>t({secure:x.target.checked}),className:"rounded border-border"}),e.jsx("label",{htmlFor:"email-secure",className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.secure"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.username"})}),e.jsx(D,{value:s.username||"",onChange:x=>t({username:x.target.value}),placeholder:"your-email@gmail.com",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.password"})}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(D,{type:r?"text":"password",value:s.password||"",onChange:x=>t({password:x.target.value}),placeholder:"********",className:"flex-1"}),e.jsx(j,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>c(!r),children:r?e.jsx(fe,{className:"w-4 h-4"}):e.jsx(pe,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.from"})}),e.jsx(D,{value:s.from||"",onChange:x=>t({from:x.target.value}),placeholder:"noreply@example.com",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:n({id:"settings.remoteNotifications.email.to"})}),e.jsx(D,{value:((d=s.to)==null?void 0:d.join(", "))||"",onChange:x=>t({to:x.target.value.split(",").map(p=>p.trim()).filter(Boolean)}),placeholder:"user1@example.com, user2@example.com",className:"mt-1"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n({id:"settings.remoteNotifications.email.toHint"})})]})]})}function ba({className:s}){const{formatMessage:t}=X(),[n,r]=i.useState(null),[c,d]=i.useState(!0),[x,p]=i.useState(!1),[N,f]=i.useState(null),[F,w]=i.useState(null),[P,u]=i.useState(null),v=i.useCallback(async()=>{d(!0);try{const b=await fetch("/api/notifications/remote/config");if(b.ok){const y=await b.json();r(y)}else r(Qe())}catch(b){console.error("Failed to load remote notification config:",b),r(Qe())}finally{d(!1)}},[]);i.useEffect(()=>{v()},[v]);const k=i.useCallback(async b=>{p(!0);try{const y=await fetch("/api/notifications/remote/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(y.ok){const l=await y.json();r(l.config),H.success(t({id:"settings.remoteNotifications.saved"}))}else throw new Error(`HTTP ${y.status}`)}catch{H.error(t({id:"settings.remoteNotifications.saveError"}))}finally{p(!1)}},[t]),h=i.useCallback(async(b,y)=>{f(b);try{const g=await(await fetch("/api/notifications/remote/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({platform:b,config:y})})).json();g.success?H.success(t({id:"settings.remoteNotifications.testSuccess"}),{description:`${g.responseTime}ms`}):H.error(t({id:"settings.remoteNotifications.testFailed"}),{description:g.error})}catch{H.error(t({id:"settings.remoteNotifications.testError"}))}finally{f(null)}},[t]),$=()=>{n&&k({...n,enabled:!n.enabled})},C=(b,y)=>{if(!n)return;const l={...n,platforms:{...n.platforms,[b]:{...n.platforms[b],...y}}};r(l)},M=(b,y)=>{if(!n)return;const l=[...n.events];l[b]={...l[b],...y},r({...n,events:l})},O=(b,y)=>{if(!n)return;const l=n.events[b],g=l.platforms.includes(y)?l.platforms.filter(m=>m!==y):[...l.platforms,y];M(b,{platforms:g})},K=["discord","telegram","feishu","dingtalk","wecom","email","webhook"],A=async()=>{if(confirm(t({id:"settings.remoteNotifications.resetConfirm"})))try{const b=await fetch("/api/notifications/remote/reset",{method:"POST"});if(b.ok){const y=await b.json();r(y.config),H.success(t({id:"settings.remoteNotifications.resetSuccess"}))}}catch{H.error(t({id:"settings.remoteNotifications.resetError"}))}};return c?e.jsx(Q,{className:z("p-6",s),children:e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(ue,{className:"w-5 h-5 animate-spin text-muted-foreground"})})}):n?e.jsxs(Q,{className:z("p-6",s),children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[n.enabled?e.jsx($e,{className:"w-5 h-5 text-primary"}):e.jsx(Xt,{className:"w-5 h-5 text-muted-foreground"}),t({id:"settings.remoteNotifications.title"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{variant:"outline",size:"sm",onClick:()=>v(),disabled:c,children:e.jsx(ue,{className:z("w-3.5 h-3.5",c&&"animate-spin")})}),e.jsx(j,{variant:n.enabled?"default":"outline",size:"sm",onClick:$,children:n.enabled?e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-4 h-4 mr-1"}),t({id:"settings.remoteNotifications.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-4 h-4 mr-1"}),t({id:"settings.remoteNotifications.disabled"})]})})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:t({id:"settings.remoteNotifications.description"})}),n.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4 mb-6",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:t({id:"settings.remoteNotifications.platforms"})}),e.jsx(da,{config:n,expandedPlatform:F,testing:N,onToggleExpand:w,onUpdateConfig:C,onTest:h,onSave:()=>k(n),saving:x})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:t({id:"settings.remoteNotifications.events"})}),e.jsx("div",{className:"grid gap-3",children:n.events.map((b,y)=>{const l=ca[b.event],g=P===y;return e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>u(g?null:y),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:z("p-2 rounded-lg",b.enabled?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:e.jsx("span",{className:"text-sm",children:l.icon})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:l.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex gap-1 flex-wrap max-w-xs",children:[b.platforms.slice(0,3).map(m=>e.jsx(Z,{variant:"secondary",className:"text-xs",children:Ae[m].name},m)),b.platforms.length>3&&e.jsxs(Z,{variant:"secondary",className:"text-xs",children:["+",b.platforms.length-3]}),b.platforms.length===0&&e.jsx(Z,{variant:"outline",className:"text-xs text-muted-foreground",children:t({id:"settings.remoteNotifications.noPlatforms"})})]}),e.jsx(j,{variant:b.enabled?"default":"outline",size:"sm",className:"h-7",onClick:m=>{m.stopPropagation(),M(y,{enabled:!b.enabled})},children:b.enabled?e.jsx(le,{className:"w-3.5 h-3.5"}):e.jsx(ne,{className:"w-3.5 h-3.5"})}),g?e.jsx(He,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Ee,{className:"w-4 h-4 text-muted-foreground"})]})]}),g&&e.jsxs("div",{className:"border-t border-border p-4 space-y-3 bg-muted/20",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:t({id:"settings.remoteNotifications.selectPlatforms"})}),e.jsx("div",{className:"flex flex-wrap gap-2",children:K.map(m=>{const E=b.platforms.includes(m),B=Ae[m],G=n.platforms[m],q=G==null?void 0:G.enabled;return e.jsxs(j,{variant:E?"default":"outline",size:"sm",className:z("h-8",!q&&!E&&"opacity-50"),onClick:()=>O(y,m),children:[E&&e.jsx(le,{className:"w-3 h-3 mr-1"}),B.name,!q&&!E&&e.jsx(Ne,{className:"w-3 h-3 ml-1 opacity-50"})]},m)})})]})]},b.event)})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-6 pt-4 border-t border-border",children:[e.jsx(j,{variant:"outline",size:"sm",onClick:A,children:t({id:"settings.remoteNotifications.reset"})}),e.jsxs(j,{variant:"default",size:"sm",onClick:()=>k(n),disabled:x,children:[e.jsx(Fe,{className:"w-4 h-4 mr-1"}),t(x?{id:"settings.remoteNotifications.saving"}:{id:"settings.remoteNotifications.save"})]})]})]})]}):null}function ja({value:s,label:t,description:n,selected:r,onClick:c}){const d={modal:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-center justify-center",children:e.jsx("div",{className:"w-4 h-3 border border-current rounded-sm"})}),drawer:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-end justify-end p-0.5",children:e.jsx("div",{className:"w-2 h-6 border border-current rounded-sm"})}),sheet:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-end justify-center p-0.5",children:e.jsx("div",{className:"w-6 h-2 border border-current rounded-sm"})}),fullscreen:e.jsx("div",{className:"w-8 h-8 border-2 border-current rounded-lg flex items-center justify-center",children:e.jsx("div",{className:"w-5 h-4 border border-current rounded-sm"})})};return e.jsxs("button",{type:"button",onClick:c,className:z("flex flex-col items-center gap-2 p-3 rounded-lg border-2 transition-all","hover:bg-accent/50",r?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground"),children:[d[s],e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:z("text-sm font-medium",r&&"text-primary"),children:t}),e.jsx("div",{className:"text-xs text-muted-foreground",children:n})]})]})}function Na({value:s,onChange:t,disabled:n}){const r=[10,20,30,45,60,90,120];return e.jsx("div",{className:"flex flex-wrap gap-2",children:r.map(c=>e.jsxs(j,{type:"button",variant:s===c?"default":"outline",size:"sm",disabled:n,onClick:()=>t(c),children:[c,"s"]},c))})}function va(){const{formatMessage:s}=X(),{preferences:t,updatePreference:n,resetPreferences:r}=Zs(),c=[{value:"modal",label:s({id:"settings.a2ui.styleModal",defaultMessage:"Modal"}),description:s({id:"settings.a2ui.styleModalDesc",defaultMessage:"Centered"})},{value:"drawer",label:s({id:"settings.a2ui.styleDrawer",defaultMessage:"Drawer"}),description:s({id:"settings.a2ui.styleDrawerDesc",defaultMessage:"Side panel"})},{value:"sheet",label:s({id:"settings.a2ui.styleSheet",defaultMessage:"Sheet"}),description:s({id:"settings.a2ui.styleSheetDesc",defaultMessage:"Bottom"})},{value:"fullscreen",label:s({id:"settings.a2ui.styleFullscreen",defaultMessage:"Fullscreen"}),description:s({id:"settings.a2ui.styleFullscreenDesc",defaultMessage:"Full screen"})}];return e.jsxs(Q,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(as,{className:"w-5 h-5"}),s({id:"settings.sections.a2ui",defaultMessage:"A2UI Preferences"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs(Xe,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Yt,{className:"w-4 h-4"}),s({id:"settings.a2ui.dialogStyle",defaultMessage:"Dialog Style"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.dialogStyleDesc",defaultMessage:"Choose how A2UI dialogs are displayed"})}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:c.map(d=>e.jsx(ja,{value:d.value,label:d.label,description:d.description,selected:t.dialogStyle===d.value,onClick:()=>n("dialogStyle",d.value)},d.value))})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(et,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.smartMode",defaultMessage:"Smart Mode"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.smartModeDesc",defaultMessage:"Auto-select style based on question type"})})]})]}),e.jsx(j,{variant:t.smartModeEnabled?"default":"outline",size:"sm",onClick:()=>n("smartModeEnabled",!t.smartModeEnabled),children:t.smartModeEnabled?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsxs("div",{className:"space-y-3 py-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(st,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(Xe,{className:"text-sm font-medium",children:s({id:"settings.a2ui.autoSelectionDuration",defaultMessage:"Auto-Selection Duration"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.autoSelectionDurationDesc",defaultMessage:"Countdown before auto-selecting default option"})}),e.jsx(Na,{value:t.autoSelectionDuration,onChange:d=>n("autoSelectionDuration",d)})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.pauseOnInteraction",defaultMessage:"Pause on Interaction"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.pauseOnInteractionDesc",defaultMessage:"Pause countdown when you interact with the dialog"})})]}),e.jsx(j,{variant:t.pauseOnInteraction?"default":"outline",size:"sm",onClick:()=>n("pauseOnInteraction",!t.pauseOnInteraction),children:t.pauseOnInteraction?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Zt,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.soundNotification",defaultMessage:"Sound Notification"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.soundNotificationDesc",defaultMessage:"Play sound before auto-submit (3 seconds before)"})})]})]}),e.jsx(j,{variant:t.autoSelectionSoundEnabled?"default":"outline",size:"sm",onClick:()=>n("autoSelectionSoundEnabled",!t.autoSelectionSoundEnabled),children:t.autoSelectionSoundEnabled?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s({id:"settings.a2ui.showToolbarButton",defaultMessage:"Show Toolbar Button"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.a2ui.showToolbarButtonDesc",defaultMessage:"Show A2UI quick action button in the toolbar"})})]}),e.jsx(j,{variant:t.showA2UIButtonInToolbar?"default":"outline",size:"sm",onClick:()=>n("showA2UIButtonInToolbar",!t.showA2UIButtonInToolbar),children:t.showA2UIButtonInToolbar?s({id:"common.enabled",defaultMessage:"Enabled"}):s({id:"common.disabled",defaultMessage:"Disabled"})})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t border-border",children:e.jsx(j,{variant:"outline",size:"sm",onClick:r,children:s({id:"common.resetToDefaults",defaultMessage:"Reset to Defaults"})})})]})]})}const cs=["","low","medium","high"],ds=["","low","medium","high","max"],Me=["sonnet","opus","haiku","inherit"],ms=["","default","acceptEdits","dontAsk","bypassPermissions","plan"],us=["","user","project","local"],xs=["","worktree"],hs=["","purple","blue","yellow","green","red"],Oe=["PreToolUse","PostToolUse","Stop"],se="h-7 text-xs rounded border border-input bg-background px-2",W="text-xs text-muted-foreground shrink-0";function Ze(s){if(!s)return[];const t=[],n=s.split(`
|
|
144
|
+
`);for(const r of n){const c=r.match(/^\s+-\s+(.+)$/);c&&t.push(c[1].trim())}return t}function ya(s){return s.length===0?"":`mcpServers:
|
|
145
145
|
${s.map(t=>` - ${t}`).join(`
|
|
146
146
|
`)}`}function es(s){const t={PreToolUse:[],PostToolUse:[],Stop:[]};if(!s)return t;let n=null,r=null;const c=s.split(`
|
|
147
|
-
`);for(const d of c){const x=d.match(/^\s{2,4}(\w+):$/);if(x&&x[1]in t){n=x[1],r=null;continue}const p=d.match(/^\s+-\s+matcher:\s*["']?([^"'\n]+)["']?$/);if(p&&n){r=p[1].trim();continue}const N=d.match(/^\s+command:\s*["']?([^"'\n]+)["']?$/);if(N&&n&&r!==null){t[n].push({matcher:r,command:N[1].trim()}),r=null;continue}}return t}function
|
|
147
|
+
`);for(const d of c){const x=d.match(/^\s{2,4}(\w+):$/);if(x&&x[1]in t){n=x[1],r=null;continue}const p=d.match(/^\s+-\s+matcher:\s*["']?([^"'\n]+)["']?$/);if(p&&n){r=p[1].trim();continue}const N=d.match(/^\s+command:\s*["']?([^"'\n]+)["']?$/);if(N&&n&&r!==null){t[n].push({matcher:r,command:N[1].trim()}),r=null;continue}}return t}function wa(s){const t=[];for(const n of Oe){const r=s[n];if(r.length!==0){t.push(` ${n}:`);for(const c of r)t.push(` - matcher: "${c.matcher}"`),t.push(" hooks:"),t.push(" - type: command"),t.push(` command: "${c.command}"`)}}return t.length===0?"":`hooks:
|
|
148
148
|
${t.join(`
|
|
149
|
-
`)}`}function ya({agent:s,onSaved:t}){const[n,r]=i.useState(s.color),[c,d]=i.useState(s.permissionMode),[x,p]=i.useState(s.memory),[N,f]=i.useState(s.maxTurns),[E,w]=i.useState(s.background==="true"),[F,u]=i.useState(s.isolation),[v,k]=i.useState(s.tools),[h,H]=i.useState(s.disallowedTools),[C,M]=i.useState(s.skills),[O,W]=i.useState([]),[A,b]=i.useState(()=>Ze(s.mcpServers)),[y,l]=i.useState(!1),[g,m]=i.useState(""),[D,_]=i.useState(()=>es(s.hooks)),[G,q]=i.useState("PreToolUse"),[Z,ce]=i.useState(!1);i.useEffect(()=>{let a=!1;return l(!0),at().then(S=>{if(a)return;const I=new Set;S.userServers&&Object.keys(S.userServers).forEach(U=>I.add(U)),S.globalServers&&Object.keys(S.globalServers).forEach(U=>I.add(U)),S.projects&&Object.values(S.projects).forEach(U=>{U!=null&&U.mcpServers&&Object.keys(U.mcpServers).forEach(K=>I.add(K))}),W(Array.from(I).sort())}).catch(()=>{}).finally(()=>{a||l(!1)}),()=>{a=!0}},[]),i.useEffect(()=>{r(s.color),d(s.permissionMode),p(s.memory),f(s.maxTurns),w(s.background==="true"),u(s.isolation),k(s.tools),H(s.disallowedTools),M(s.skills),b(Ze(s.mcpServers)),_(es(s.hooks))},[s]);const se=i.useCallback(async()=>{ce(!0);try{const a={filePath:s.filePath};n!==s.color&&(a.color=n),c!==s.permissionMode&&(a.permissionMode=c),x!==s.memory&&(a.memory=x),N!==s.maxTurns&&(a.maxTurns=N);const S=E?"true":"";S!==s.background&&(a.background=S),F!==s.isolation&&(a.isolation=F),v!==s.tools&&(a.tools=v),h!==s.disallowedTools&&(a.disallowedTools=h),C!==s.skills&&(a.skills=C);const I=Na(A);I!==s.mcpServers&&(a.mcpServers=I);const U=va(D);if(U!==s.hooks&&(a.hooks=U),Object.keys(a).filter(re=>re!=="filePath").length===0){B.info("No changes to save");return}await $e(s.type,s.name,a),B.success(`Updated ${s.name} advanced settings`),t()}catch(a){B.error(`Failed: ${a.message}`)}finally{ce(!1)}},[s,n,c,x,N,E,F,v,h,C,A,D,t]),de=a=>{b(S=>S.includes(a)?S.filter(I=>I!==a):[...S,a])},me=()=>{const a=g.trim();a&&!A.includes(a)&&(b(S=>[...S,a]),m(""))},X=()=>{_(a=>({...a,[G]:[...a[G],{matcher:"",command:""}]}))},ne=(a,S)=>{_(I=>({...I,[a]:I[a].filter((U,K)=>K!==S)}))},te=(a,S,I,U)=>{_(K=>({...K,[a]:K[a].map((re,xe)=>xe===S?{...re,[I]:U}:re)}))};return e.jsxs("div",{className:"mt-2 ml-6 p-3 rounded-md border border-border bg-muted/20 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Color:"}),e.jsx("select",{className:ee,value:n,onChange:a=>r(a.target.value),children:xs.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Permission:"}),e.jsx("select",{className:ee,value:c,onChange:a=>d(a.target.value),children:ds.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Memory:"}),e.jsx("select",{className:ee,value:x,onChange:a=>p(a.target.value),children:ms.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"MaxTurns:"}),e.jsx(P,{className:"h-7 text-xs w-[60px]",type:"number",value:N,onChange:a=>f(a.target.value),placeholder:"—"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Ie,{checked:E,onCheckedChange:a=>w(a===!0)}),e.jsx("span",{className:V,children:"Background"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Isolation:"}),e.jsx("select",{className:ee,value:F,onChange:a=>u(a.target.value),children:us.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:V,children:"Tools:"}),e.jsx(P,{className:"h-7 text-xs flex-1",value:v,onChange:a=>k(a.target.value),placeholder:"Read, Write, Bash, Glob, Grep"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:V,children:"Disallowed:"}),e.jsx(P,{className:"h-7 text-xs flex-1",value:h,onChange:a=>H(a.target.value),placeholder:"e.g. Edit"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:V,children:"Skills:"}),e.jsx(P,{className:"h-7 text-xs flex-1",value:C,onChange:a=>M(a.target.value),placeholder:"e.g. api-conventions, error-handling"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"MCP Servers:"}),y?e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:"Loading..."}):e.jsxs("div",{className:"flex flex-wrap gap-3 ml-1",children:[O.map(a=>e.jsxs("label",{className:"flex items-center gap-1.5 text-xs cursor-pointer",children:[e.jsx(Ie,{checked:A.includes(a),onCheckedChange:()=>de(a)}),e.jsx("span",{className:"text-foreground",children:a})]},a)),A.filter(a=>!O.includes(a)).map(a=>e.jsxs("label",{className:"flex items-center gap-1.5 text-xs cursor-pointer",children:[e.jsx(Ie,{checked:!0,onCheckedChange:()=>de(a)}),e.jsx("span",{className:"text-foreground italic",children:a})]},a)),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(P,{className:"h-6 text-xs w-[120px]",value:g,onChange:a=>m(a.target.value),placeholder:"+ Custom",onKeyDown:a=>{a.key==="Enter"&&me()}}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-6 px-1",onClick:me,disabled:!g.trim(),children:e.jsx(Ne,{className:"w-3 h-3"})})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Hooks:"}),Oe.map(a=>{const S=D[a];return S.length===0?null:e.jsxs("div",{className:"ml-1 space-y-1",children:[e.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[a,":"]}),S.map((I,U)=>e.jsxs("div",{className:"flex items-center gap-2 ml-3",children:[e.jsx(P,{className:"h-6 text-xs w-[100px]",value:I.matcher,onChange:K=>te(a,U,"matcher",K.target.value),placeholder:"matcher (e.g. Bash)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"→"}),e.jsx(P,{className:"h-6 text-xs flex-1",value:I.command,onChange:K=>te(a,U,"command",K.target.value),placeholder:"command"}),e.jsx("button",{type:"button",className:"text-muted-foreground hover:text-destructive transition-colors",onClick:()=>ne(a,U),children:e.jsx(ae,{className:"w-3 h-3"})})]},U))]},a)}),e.jsxs("div",{className:"flex items-center gap-2 ml-1",children:[e.jsx("select",{className:ee,value:G,onChange:a=>q(a.target.value),children:Oe.map(a=>e.jsx("option",{value:a,children:a},a))}),e.jsxs(j,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:X,children:[e.jsx(Ne,{className:"w-3 h-3 mr-1"}),"Add Hook"]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(j,{variant:"default",size:"sm",className:"h-7",disabled:Z,onClick:se,children:[e.jsx(Fe,{className:"w-3 h-3 mr-1"}),Z?"Saving...":"Save Advanced"]})})]})}function wa({agent:s,onSaved:t}){const[n,r]=i.useState(s.model),[c,d]=i.useState(s.effort),[x,p]=i.useState(!1),[N,f]=i.useState(!1),E=n!==s.model||c!==s.effort,w=s.type==="codex"?os:cs,F=i.useCallback(async()=>{p(!0);try{const u={filePath:s.filePath};n!==s.model&&(u.model=n),c!==s.effort&&(u.effort=c),await $e(s.type,s.name,u),B.success(`Updated ${s.name}`),t()}catch(u){B.error(`Failed to update ${s.name}: ${u.message}`)}finally{p(!1)}},[s,n,c,t]);return i.useEffect(()=>{r(s.model),d(s.effort)},[s.model,s.effort]),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-md border border-border bg-card hover:bg-accent/30 transition-colors",children:[e.jsx(Q,{variant:s.type==="codex"?"default":"secondary",className:"text-xs shrink-0",children:s.type}),e.jsx("span",{className:"text-sm font-medium text-foreground min-w-[140px] truncate",title:s.name,children:s.name}),e.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0",children:[e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Model:"}),s.type==="claude"?e.jsxs("div",{className:"flex gap-1 flex-1 min-w-0",children:[e.jsxs("select",{className:"h-7 text-xs rounded border border-input bg-background px-2 shrink-0",value:Me.includes(n)?n:"__custom__",onChange:u=>{u.target.value!=="__custom__"&&r(u.target.value)},children:[Me.map(u=>e.jsx("option",{value:u,children:u||"(none)"},u)),!Me.includes(n)&&e.jsx("option",{value:"__custom__",children:"custom"})]}),!Me.includes(n)&&e.jsx(P,{className:"h-7 text-xs flex-1 min-w-[100px]",value:n,onChange:u=>r(u.target.value),placeholder:"model id"})]}):e.jsx(P,{className:"h-7 text-xs flex-1 min-w-[100px]",value:n,onChange:u=>r(u.target.value),placeholder:"model id"})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Effort:"}),e.jsx("select",{className:"h-7 text-xs rounded border border-input bg-background px-2",value:c,onChange:u=>d(u.target.value),children:w.map(u=>e.jsx("option",{value:u,children:u||"—"},u))})]}),e.jsxs(j,{variant:"outline",size:"sm",className:"h-7 px-2 shrink-0",disabled:!E||x,onClick:F,children:[e.jsx(Fe,{className:"w-3 h-3 mr-1"}),x?"...":"Save"]}),s.type==="claude"&&e.jsx("button",{type:"button",className:$("p-1 rounded hover:bg-accent transition-colors",N&&"text-primary"),onClick:()=>f(!N),title:"Advanced Settings",children:e.jsx(as,{className:"w-4 h-4"})})]}),N&&s.type==="claude"&&e.jsx(ya,{agent:s,onSaved:t})]})}function ka({installationPath:s,agents:t,onSaved:n}){const[r,c]=i.useState(!0);return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full text-left py-1 hover:text-primary transition-colors",onClick:()=>c(!r),children:[r?e.jsx(Ee,{className:"w-4 h-4"}):e.jsx(tt,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm font-medium text-foreground truncate",title:s,children:s}),e.jsxs(Q,{variant:"outline",className:"text-xs ml-auto shrink-0",children:[t.length," agents"]})]}),r&&e.jsx("div",{className:"space-y-1 ml-6",children:t.map(d=>e.jsx(wa,{agent:d,onSaved:n},d.filePath))})]})}function Ca(){const[s,t]=i.useState([]),[n,r]=i.useState(!0),[c,d]=i.useState(""),[x,p]=i.useState(""),[N,f]=i.useState("all"),[E,w]=i.useState(""),[F,u]=i.useState(""),[v,k]=i.useState(""),[h,H]=i.useState(""),[C,M]=i.useState(""),[O,W]=i.useState(""),[A,b]=i.useState(""),[y,l]=i.useState(""),[g,m]=i.useState(""),[D,_]=i.useState(!1),[G,q]=i.useState(!1),Z=i.useCallback(async()=>{try{r(!0);const a=await et();t(a.agents)}catch(a){B.error(`Failed to load agents: ${a.message}`)}finally{r(!1)}},[]);i.useEffect(()=>{Z()},[Z]);const ce=s.reduce((a,S)=>{const I=S.installationPath;return a[I]||(a[I]=[]),a[I].push(S),a},{}),se=s.filter(a=>N==="all"||a.type===N),de=se.some(a=>a.type==="claude"),me=N==="codex"?os:N==="claude"?cs:["","low","medium","high","max (claude only)"],X={};E&&(X.color=E),F&&(X.permissionMode=F),v&&(X.memory=v),h&&(X.maxTurns=h),C&&(X.background=C),O&&(X.isolation=O),A&&(X.tools=A),y&&(X.disallowedTools=y),g&&(X.skills=g);const ne=Object.keys(X).length>0,te=i.useCallback(async()=>{if(!(c||x||ne)){B.error("Set at least one value first");return}if(se.length===0){B.error("No agents match the selected type");return}q(!0);try{if(c||x){const S=se.map(U=>({filePath:U.filePath,type:U.type})),I=await st({targets:S,model:c||void 0,effort:x||void 0});B.success(`Updated model/effort: ${I.updated}/${I.total} agents`)}if(ne&&de){const S=se.filter(U=>U.type==="claude");let I=0;for(const U of S)try{const K={filePath:U.filePath,...X};await $e(U.type,U.name,K),I++}catch{}B.success(`Updated claude fields: ${I}/${S.length} agents`)}Z()}catch(S){B.error(`Batch update failed: ${S.message}`)}finally{q(!1)}},[se,de,c,x,ne,X,Z]);return e.jsxs(Y,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx(_t,{className:"w-5 h-5"}),"Agent Definitions"]}),e.jsxs(j,{variant:"ghost",size:"sm",onClick:Z,disabled:n,children:[e.jsx(ue,{className:$("w-4 h-4 mr-1",n&&"animate-spin")}),"Refresh"]})]}),e.jsxs("div",{className:"p-3 mb-4 rounded-md border border-border bg-muted/30 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:"Batch:"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Target:"}),e.jsxs("select",{className:ee,value:N,onChange:a=>f(a.target.value),children:[e.jsxs("option",{value:"all",children:["All (",s.length,")"]}),e.jsxs("option",{value:"codex",children:["Codex (",s.filter(a=>a.type==="codex").length,")"]}),e.jsxs("option",{value:"claude",children:["Claude (",s.filter(a=>a.type==="claude").length,")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Model:"}),e.jsx(P,{className:"h-7 text-xs w-[140px]",value:c,onChange:a=>d(a.target.value),placeholder:"model"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Effort:"}),e.jsx("select",{className:ee,value:x,onChange:a=>p(a.target.value),children:me.map(a=>{const S=a.startsWith("max")?"max":a;return e.jsx("option",{value:S,children:a||"—"},a)})})]}),N!=="codex"&&e.jsx("button",{type:"button",className:$("p-1 rounded hover:bg-accent transition-colors",D&&"text-primary"),onClick:()=>_(!D),title:"Claude Advanced Batch Settings",children:e.jsx(as,{className:"w-4 h-4"})}),e.jsx(j,{variant:"default",size:"sm",className:"h-7",disabled:G||!c&&!x&&!ne,onClick:te,children:G?"Applying...":`Apply to ${N==="all"?"All":N} (${se.length})`})]}),D&&N!=="codex"&&e.jsxs("div",{className:"pt-2 border-t border-border space-y-2",children:[e.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:["Claude-only fields ",N==="all"&&"(applied to claude agents only)",":"]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Color:"}),e.jsx("select",{className:ee,value:E,onChange:a=>w(a.target.value),children:xs.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Permission:"}),e.jsx("select",{className:ee,value:F,onChange:a=>u(a.target.value),children:ds.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Memory:"}),e.jsx("select",{className:ee,value:v,onChange:a=>k(a.target.value),children:ms.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"MaxTurns:"}),e.jsx(P,{className:"h-7 text-xs w-[60px]",type:"number",value:h,onChange:a=>H(a.target.value),placeholder:"—"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Background:"}),e.jsxs("select",{className:ee,value:C,onChange:a=>M(a.target.value),children:[e.jsx("option",{value:"",children:"—"}),e.jsx("option",{value:"true",children:"true"}),e.jsx("option",{value:"false",children:"false"})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:V,children:"Isolation:"}),e.jsx("select",{className:ee,value:O,onChange:a=>W(a.target.value),children:us.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[200px]",children:[e.jsx("span",{className:V,children:"Tools:"}),e.jsx(P,{className:"h-7 text-xs flex-1",value:A,onChange:a=>b(a.target.value),placeholder:"Read, Write, Bash, Glob, Grep"})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[200px]",children:[e.jsx("span",{className:V,children:"Disallowed:"}),e.jsx(P,{className:"h-7 text-xs flex-1",value:y,onChange:a=>l(a.target.value),placeholder:"e.g. Edit"})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[200px]",children:[e.jsx("span",{className:V,children:"Skills:"}),e.jsx(P,{className:"h-7 text-xs flex-1",value:g,onChange:a=>m(a.target.value),placeholder:"e.g. api-conventions"})]})]})]})]}),n?e.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"Loading agents..."}):s.length===0?e.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"No agent definitions found. Install CCW to a project first."}):e.jsx("div",{className:"space-y-4",children:Object.entries(ce).map(([a,S])=>e.jsx(ka,{installationPath:a,agents:S,onSaved:Z},a))})]})}function Sa(){const s=document.cookie.match(/XSRF-TOKEN=([^;]+)/);return s?decodeURIComponent(s[1]):null}function ss({value:s,onChange:t,placeholder:n}){const[r,c]=i.useState(!1),[d,x]=i.useState(null),p=Vt(s,500);i.useEffect(()=>{if(p){c(!0),x(null);const f=setTimeout(()=>{p.trim().length>0?x(null):x("Path cannot be empty."),c(!1)},1e3);return()=>clearTimeout(f)}else x(null),c(!1)},[p]);const N=async()=>{const{selectFile:f}=await pt(async()=>{const{selectFile:F}=await import("./index-Dff4bg3u.js").then(u=>u.gf);return{selectFile:F}},__vite__mapDeps([0,1])),E=s?s.replace(/[/\\][^/\\]*$/,""):void 0,w=await f(E);w.path&&!w.cancelled&&!w.error&&t(w.path)};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(P,{value:s,onChange:f=>t(f.target.value),placeholder:n,className:$("flex-1",d&&"border-destructive")}),r&&e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(gt,{className:"h-4 w-4 animate-spin text-muted-foreground"})})]}),e.jsx(j,{type:"button",variant:"outline",size:"sm",className:"shrink-0 h-9",onClick:N,title:"Browse",children:e.jsx(ft,{className:"w-4 h-4"})})]}),d&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:d})]})}const Ta=new Set(["gemini","qwen","opencode"]),Ma=new Set(["claude"]);function hs(s){return Ta.has(s)?"envFile":Ma.has(s)?"settingsFile":"none"}function Ea({toolId:s,config:t,isDefault:n,isExpanded:r,toolAvailable:c,isSaving:d,onToggleExpand:x,onToggleEnabled:p,onSetDefault:N,onUpdateModel:f,onUpdateTags:E,onUpdateAvailableModels:w,onUpdateEnvFile:F,onUpdateSettingsFile:u,onUpdateEffort:v,onSaveToBackend:k}){const{formatMessage:h}=J(),[H,C]=i.useState(""),[M,O]=i.useState(""),W=()=>{const m=H.trim();m&&!t.tags.includes(m)&&(E([...t.tags,m]),C(""))},A=m=>{E(t.tags.filter(D=>D!==m))},b=()=>{const m=M.trim(),D=t.availableModels||[];m&&!D.includes(m)&&(w([...D,m]),O(""))},y=m=>{const D=t.availableModels||[];w(D.filter(_=>_!==m))},l=["分析","Debug","implementation","refactoring","testing"],g=hs(s);return e.jsxs(Y,{className:$("overflow-hidden",!t.enabled&&"opacity-60"),children:[e.jsxs("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:x,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:$("p-2 rounded-lg",t.enabled?"bg-primary/10":"bg-muted"),children:e.jsx(ns,{className:$("w-5 h-5",t.enabled?"text-primary":"text-muted-foreground")})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground capitalize",children:s}),n&&e.jsx(Q,{variant:"default",className:"text-xs",children:h({id:"settings.cliTools.default"})}),e.jsx(Q,{variant:"outline",className:"text-xs",children:t.type}),c!==void 0&&e.jsx("span",{className:$("inline-block w-2 h-2 rounded-full",c?"bg-green-500":"bg-red-400"),title:c?"Available":"Unavailable"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.primaryModel})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{variant:t.enabled?"default":"outline",size:"sm",className:"h-8",onClick:m=>{m.stopPropagation(),p()},children:t.enabled?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),h({id:"settings.cliTools.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 mr-1"}),h({id:"settings.cliTools.disabled"})]})}),r?e.jsx(He,{className:"w-5 h-5 text-muted-foreground"}):e.jsx(Ee,{className:"w-5 h-5 text-muted-foreground"})]})]}),t.tags&&t.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:t.tags.map(m=>e.jsx(Q,{variant:"secondary",className:"text-xs",children:m},m))})]}),r&&e.jsxs("div",{className:"border-t border-border p-4 space-y-4 bg-muted/30",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"settings.cliTools.primaryModel"})}),e.jsx(P,{value:t.primaryModel,onChange:m=>f("primaryModel",m.target.value),className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"settings.cliTools.secondaryModel"})}),e.jsx(P,{value:t.secondaryModel,onChange:m=>f("secondaryModel",m.target.value),className:"mt-1"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"apiSettings.cliSettings.tags"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"apiSettings.cliSettings.tagsDescription"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 flex flex-wrap gap-1.5 p-2 border border-input bg-background rounded-md min-h-[38px] focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",children:[t.tags.map(m=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-primary/10 text-primary rounded text-xs h-6",children:[m,e.jsx("button",{type:"button",onClick:()=>A(m),className:"hover:text-destructive transition-colors","aria-label":h({id:"apiSettings.cliSettings.removeTag"}),children:e.jsx(ae,{className:"w-3 h-3"})})]},m)),e.jsx("input",{type:"text",value:H,onChange:m=>C(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),W())},placeholder:t.tags.length===0?h({id:"apiSettings.cliSettings.tagInputPlaceholder"}):"",className:"flex-1 min-w-[120px] bg-transparent border-0 outline-none text-sm placeholder:text-muted-foreground"})]}),e.jsx(j,{type:"button",size:"sm",onClick:W,variant:"outline",className:"shrink-0",children:e.jsx(Ne,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[h({id:"apiSettings.cliSettings.predefinedTags"}),":"]}),l.map(m=>e.jsx("button",{type:"button",onClick:()=>{t.tags.includes(m)||E([...t.tags,m])},disabled:t.tags.includes(m),className:"text-xs px-2 py-0.5 rounded border border-border hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:m},m))]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"apiSettings.cliSettings.availableModels"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 flex flex-wrap gap-1.5 p-2 border border-input bg-background rounded-md min-h-[38px] focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",children:[(t.availableModels||[]).map(m=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-primary/10 text-primary rounded text-xs h-6",children:[m,e.jsx("button",{type:"button",onClick:()=>y(m),className:"hover:text-destructive transition-colors",children:e.jsx(ae,{className:"w-3 h-3"})})]},m)),e.jsx("input",{type:"text",value:M,onChange:m=>O(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),b())},placeholder:(t.availableModels||[]).length===0?h({id:"apiSettings.cliSettings.availableModelsPlaceholder"}):"",className:"flex-1 min-w-[120px] bg-transparent border-0 outline-none text-sm placeholder:text-muted-foreground"})]}),e.jsx(j,{type:"button",size:"sm",onClick:b,variant:"outline",className:"shrink-0",children:e.jsx(Ne,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"apiSettings.cliSettings.availableModelsHint"})})]}),g==="envFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"settings.cliTools.envFile"})}),e.jsx(ss,{value:t.envFile||"",onChange:m=>F(m||void 0),placeholder:h({id:"settings.cliTools.envFilePlaceholder"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"settings.cliTools.envFileHint"})})]}),g==="settingsFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"apiSettings.cliSettings.settingsFile"})}),e.jsx(ss,{value:t.settingsFile||"",onChange:m=>u(m||void 0),placeholder:h({id:"apiSettings.cliSettings.settingsFilePlaceholder"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"apiSettings.cliSettings.settingsFileHint"})})]}),g==="settingsFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"settings.cliTools.effort"})}),e.jsx("div",{className:"flex gap-2",children:["low","medium","high"].map(m=>{const D=t.effort||"high",_=`settings.cliTools.effort${m.charAt(0).toUpperCase()+m.slice(1)}`;return e.jsx("button",{type:"button",onClick:()=>v(m==="high"&&!t.effort?void 0:m),className:$("px-3 py-1.5 rounded-md text-sm border transition-colors",D===m?"bg-primary text-primary-foreground border-primary":"border-border hover:bg-muted"),children:h({id:_})},m)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"settings.cliTools.effortHint"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!n&&t.enabled&&e.jsx(j,{variant:"outline",size:"sm",onClick:N,children:h({id:"settings.cliTools.setDefault"})}),e.jsxs(j,{variant:"default",size:"sm",onClick:k,disabled:d,children:[e.jsx(Fe,{className:"w-4 h-4 mr-1"}),h(d?{id:"settings.cliTools.saving"}:{id:"settings.cliTools.saveToConfig"})]})]})]})]})}function Fa(){const{formatMessage:s}=J(),{data:t,isLoading:n}=St(),{toggle:r,isPending:c}=Tt(),{data:d,isLoading:x}=Mt(),{toggle:p,isPending:N}=Et(),{data:f,isLoading:E}=Ft(),{toggle:w,isPending:F}=Pt(),{refresh:u,isPending:v}=Dt(),{exportSettings:k,isPending:h}=Ut(),{importSettings:H,isPending:C}=Lt(),M=i.useRef(null),O=i.useCallback(async()=>{try{const A=await k(),b=new Blob([JSON.stringify(A,null,2)],{type:"application/json"}),y=URL.createObjectURL(b),l=document.createElement("a"),g=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19);l.href=y,l.download=`ccw-settings-${g}.json`,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(y),B.success(s({id:"settings.responseLanguage.exportSuccess"}))}catch{B.error(s({id:"settings.responseLanguage.exportError"}))}},[k,s]),W=i.useCallback(async A=>{var y;const b=(y=A.target.files)==null?void 0:y[0];if(b){if(A.target.value="",!b.name.endsWith(".json")&&b.type!=="application/json"){B.error(s({id:"settings.responseLanguage.importInvalidFile"}));return}try{const l=await b.text(),g=JSON.parse(l);if(!g.version||!g.endpoints){B.error(s({id:"settings.responseLanguage.importInvalidStructure"}));return}const m=await H(g);m.success?B.success(s({id:"settings.responseLanguage.importSuccess"},{imported:m.imported,skipped:m.skipped})):B.error(s({id:"settings.responseLanguage.importError"}))}catch(l){l instanceof SyntaxError?B.error(s({id:"settings.responseLanguage.importInvalidJson"})):B.error(s({id:"settings.responseLanguage.importError"}))}}},[H,s]);return e.jsxs(Y,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Xt,{className:"w-5 h-5"}),s({id:"settings.sections.responseLanguage"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.chineseClaude"})}),e.jsx(Q,{variant:"default",className:"text-xs",children:"Claude"})]}),e.jsx(j,{variant:t!=null&&t.claudeEnabled?"default":"outline",size:"sm",className:"h-7",disabled:n||c,onClick:()=>r(!(t!=null&&t.claudeEnabled),"claude"),children:t!=null&&t.claudeEnabled?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.chineseClaudeDesc"})})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.chineseCodex"})}),e.jsx(Q,{variant:"secondary",className:"text-xs",children:"Codex"})]}),e.jsx(j,{variant:t!=null&&t.codexEnabled?"default":"outline",size:"sm",className:"h-7",disabled:n||c,onClick:()=>r(!(t!=null&&t.codexEnabled),"codex"),children:t!=null&&t.codexEnabled?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.chineseCodexDesc"})}),(t==null?void 0:t.codexNeedsMigration)&&e.jsxs("p",{className:"text-xs text-yellow-500",children:[e.jsx(ze,{className:"w-3 h-3 inline mr-1"}),s({id:"settings.responseLanguage.migrationWarning"})]})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ct,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.windowsPlatform"})})]}),e.jsx(j,{variant:d!=null&&d.enabled?"default":"outline",size:"sm",className:"h-7",disabled:x||N,onClick:()=>p(!(d!=null&&d.enabled)),children:d!=null&&d.enabled?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.windowsPlatformDesc"})})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(dt,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.cliEnhancement"})}),e.jsx(Q,{variant:"secondary",className:"text-xs",children:"Codex"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[(f==null?void 0:f.enabled)&&e.jsx(j,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",disabled:E||v,onClick:()=>u(),title:s({id:"settings.responseLanguage.refreshConfig"}),children:e.jsx(ue,{className:$("w-3.5 h-3.5",v&&"animate-spin")})}),e.jsx(j,{variant:f!=null&&f.enabled?"default":"outline",size:"sm",className:"h-7",disabled:E||F,onClick:()=>w(!(f!=null&&f.enabled)),children:f!=null&&f.enabled?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.cliEnhancementDesc"})}),(f==null?void 0:f.enabled)&&e.jsx("p",{className:"text-xs text-muted-foreground/70",children:s({id:"settings.responseLanguage.cliEnhancementHint"})})]})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-border",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.exportImportHint"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{ref:M,type:"file",accept:".json,application/json",onChange:W,className:"hidden"}),e.jsx(j,{variant:"outline",size:"sm",className:"h-7",disabled:C,onClick:()=>{var A;return(A=M.current)==null?void 0:A.click()},children:C?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3.5 h-3.5 border-2 border-border border-t-accent rounded-full animate-spin mr-1"}),s({id:"settings.responseLanguage.importing"})]}):e.jsxs(e.Fragment,{children:[e.jsx(qt,{className:"w-3.5 h-3.5 mr-1"}),s({id:"settings.responseLanguage.import"})]})}),e.jsx(j,{variant:"outline",size:"sm",className:"h-7",disabled:h,onClick:O,children:h?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3.5 h-3.5 border-2 border-border border-t-accent rounded-full animate-spin mr-1"}),s({id:"settings.responseLanguage.exporting"})]}):e.jsxs(e.Fragment,{children:[e.jsx(mt,{className:"w-3.5 h-3.5 mr-1"}),s({id:"settings.responseLanguage.export"})]})})]})]})})]})}function Pa(){const{formatMessage:s}=J(),[t,n]=i.useState(null),[r,c]=i.useState(!1),[d,x]=i.useState(null),[p,N]=i.useState(null),[f,E]=i.useState(()=>{try{const u=localStorage.getItem("ccw.autoUpdate");return u===null?!0:JSON.parse(u)}catch{return!0}}),w=async(u=!1)=>{u||c(!0),x(null);try{const v=await fetch("/api/version-check");if(!v.ok)throw new Error(`HTTP ${v.status}`);const k=await v.json();if(!k.currentVersion)throw new Error("Invalid response");n(k),N(new Date)}catch(v){u||x(v instanceof Error?v.message:"Unknown error")}finally{c(!1)}};i.useEffect(()=>{if(w(!0),!f)return;const u=setInterval(()=>w(!0),3600*1e3);return()=>clearInterval(u)},[f]);const F=u=>{E(u),localStorage.setItem("ccw.autoUpdate",JSON.stringify(u))};return e.jsxs(Y,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx(rs,{className:"w-5 h-5"}),s({id:"settings.versionCheck.title"})]}),e.jsxs(j,{variant:"outline",size:"sm",disabled:r,onClick:()=>w(),children:[e.jsx(ue,{className:$("w-3.5 h-3.5 mr-1.5",r&&"animate-spin")}),s(r?{id:"settings.versionCheck.checking"}:{id:"settings.versionCheck.checkNow"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:s({id:"settings.versionCheck.currentVersion"})}),e.jsx(Q,{variant:"secondary",className:"font-mono text-xs",children:(t==null?void 0:t.currentVersion)??"..."})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:s({id:"settings.versionCheck.latestVersion"})}),e.jsx(Q,{variant:t!=null&&t.hasUpdate?"default":"secondary",className:"font-mono text-xs",children:(t==null?void 0:t.latestVersion)??"..."})]}),t&&e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border",children:[e.jsx("span",{className:"text-sm font-medium",children:t.hasUpdate?s({id:"settings.versionCheck.updateAvailable"}):s({id:"settings.versionCheck.upToDate"})}),e.jsx("span",{className:$("inline-block w-2.5 h-2.5 rounded-full",t.hasUpdate?"bg-orange-500":"bg-green-500")})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[e.jsx(ze,{className:"w-4 h-4 text-destructive flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-destructive",children:[s({id:"settings.versionCheck.checkFailed"}),": ",d]})]})]}),(t==null?void 0:t.hasUpdate)&&e.jsxs("div",{className:"rounded-lg border border-orange-500/30 bg-orange-500/5 p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground mb-1",children:s({id:"settings.versionCheck.updateCommand"})}),e.jsx("code",{className:"text-xs font-mono bg-muted px-3 py-1.5 rounded block",children:t.updateCommand})]}),e.jsx(j,{variant:"outline",size:"sm",asChild:!0,children:e.jsx("a",{href:"https://github.com/dyw0830/ccw/releases",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5",children:s({id:"settings.versionCheck.viewRelease"})})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:f,onChange:u=>F(u.target.checked),className:"rounded border-input"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.versionCheck.autoCheck"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.versionCheck.autoCheckDesc"})})]})]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s({id:"settings.versionCheck.lastChecked"}),":"," ",p?p.toLocaleTimeString():s({id:"settings.versionCheck.never"})]})]})]})]})}function Da(){const{formatMessage:s}=J(),{installations:t,isLoading:n,refetch:r}=It(),{upgrade:c,isPending:d}=At(),{data:x}=Ot();return e.jsxs(Y,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx(Wt,{className:"w-5 h-5"}),s({id:"settings.systemStatus.title"}),!n&&e.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[t.length," ",s({id:"settings.systemStatus.installations"})]})]}),e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(j,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>r(),title:s({id:"settings.systemStatus.refresh"}),children:e.jsx(ue,{className:$("w-3.5 h-3.5",n&&"animate-spin")})})})]}),n?e.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:s({id:"settings.systemStatus.checking"})}):t.length===0?e.jsxs("div",{className:"text-center py-6 space-y-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.systemStatus.noInstallations"})}),e.jsx("div",{className:"bg-muted/50 rounded-md p-3 inline-block",children:e.jsx("code",{className:"text-xs font-mono",children:"ccw install"})})]}):e.jsxs("div",{className:"space-y-3",children:[t.map(p=>{const N=p.installation_mode==="Global",f=new Date(p.installation_date).toLocaleDateString(),E=p.application_version!=="unknown"?p.application_version:p.installer_version;return e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:$("inline-flex items-center justify-center w-8 h-8 rounded-lg",N?"bg-primary/10 text-primary":"bg-orange-500/10 text-orange-500"),children:N?e.jsx(ut,{className:"w-4 h-4"}):e.jsx(Gt,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-sm font-medium",children:s(N?{id:"settings.systemStatus.global"}:{id:"settings.systemStatus.path"})}),e.jsxs(Q,{variant:"secondary",className:"text-xs font-mono",children:["v",E]})]}),e.jsxs(j,{variant:"ghost",size:"sm",className:"h-7",disabled:d,onClick:()=>c(p.installation_path),children:[e.jsx(rs,{className:$("w-3.5 h-3.5 mr-1",d&&"animate-spin")}),s(d?{id:"settings.systemStatus.upgrading"}:{id:"settings.systemStatus.upgrade"})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded px-2 py-1 font-mono truncate",title:p.installation_path,children:p.installation_path}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(xt,{className:"w-3 h-3"}),f]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ht,{className:"w-3 h-3"}),p.files_count," ",s({id:"settings.systemStatus.files"})]})]})]},p.manifest_id)}),x&&!x.installed&&x.missingFiles.length>0&&e.jsxs("div",{className:"rounded-lg border border-yellow-500/50 bg-yellow-500/5 p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-yellow-600 dark:text-yellow-500",children:[e.jsx(ze,{className:"w-4 h-4"}),s({id:"settings.systemStatus.incomplete"})," — ",x.missingFiles.length," ",s({id:"settings.systemStatus.missingFiles"}).toLowerCase()]}),e.jsxs("ul",{className:"text-xs text-muted-foreground list-disc list-inside",children:[x.missingFiles.slice(0,4).map(p=>e.jsx("li",{children:p},p)),x.missingFiles.length>4&&e.jsxs("li",{children:["+",x.missingFiles.length-4," more..."]})]}),e.jsxs("div",{className:"bg-muted/50 rounded-md p-2",children:[e.jsxs("p",{className:"text-xs font-medium mb-1",children:[s({id:"settings.systemStatus.runToFix"}),":"]}),e.jsx("code",{className:"text-xs font-mono bg-background px-2 py-1 rounded block",children:"ccw install"})]})]})]})]})}function Ua({cliTools:s,defaultCliTool:t,expandedTools:n,savingTools:r,onToggleExpand:c,onToggleEnabled:d,onSetDefault:x,onUpdateModel:p,onUpdateTags:N,onUpdateAvailableModels:f,onUpdateEnvFile:E,onUpdateSettingsFile:w,onUpdateEffort:F,onSaveToBackend:u,formatMessage:v}){const{data:k}=Rt();return e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[v({id:"settings.cliTools.description"})," ",e.jsx("strong",{className:"text-foreground",children:t})]}),e.jsx("div",{className:"space-y-3",children:Object.entries(s).map(([h,H])=>{const C=k==null?void 0:k[h];return e.jsx(Ea,{toolId:h,config:H,isDefault:h===t,isExpanded:n.has(h),toolAvailable:C==null?void 0:C.available,isSaving:r.has(h),onToggleExpand:()=>c(h),onToggleEnabled:()=>d(h),onSetDefault:()=>x(h),onUpdateModel:(M,O)=>p(h,M,O),onUpdateTags:M=>N(h,M),onUpdateAvailableModels:M=>f(h,M),onUpdateEnvFile:M=>E(h,M),onUpdateSettingsFile:M=>w(h,M),onUpdateEffort:M=>F(h,M),onSaveToBackend:()=>u(h)},h)})})]})}function Ya(){const{formatMessage:s}=J(),{theme:t,setTheme:n}=Re(),r=Te(nt),c=Te(rt),d=Te(it),{updateCliTool:x,setDefaultCliTool:p,setUserPreferences:N,resetUserPreferences:f}=Te(),[E,w]=i.useState(new Set),[F,u]=i.useState(new Set),v=l=>{w(g=>{const m=new Set(g);return m.has(l)?m.delete(l):m.add(l),m})},k=l=>{x(l,{enabled:!r[l].enabled})},h=l=>{p(l)},H=(l,g,m)=>{x(l,{[g]:m})},C=(l,g)=>{x(l,{tags:g})},M=(l,g)=>{x(l,{availableModels:g})},O=(l,g)=>{x(l,{envFile:g})},W=(l,g)=>{x(l,{settingsFile:g})},A=(l,g)=>{x(l,{effort:g})},b=i.useCallback(async l=>{const g=r[l];if(g){u(m=>new Set(m).add(l));try{const m={enabled:g.enabled,primaryModel:g.primaryModel,secondaryModel:g.secondaryModel,tags:g.tags,availableModels:g.availableModels},D=hs(l);D==="envFile"?m.envFile=g.envFile||null:D==="settingsFile"&&(m.settingsFile=g.settingsFile||null,m.effort=g.effort||null);const _=Sa(),G={"Content-Type":"application/json"};_&&(G["X-CSRF-Token"]=_);const q=await fetch(`/api/cli/config/${l}`,{method:"PUT",headers:G,body:JSON.stringify(m),credentials:"same-origin"});if(!q.ok)throw new Error(`HTTP ${q.status}`);B.success(s({id:"settings.cliTools.configSaved"}),{description:l})}catch{B.error(s({id:"settings.cliTools.configSaveError"}),{description:l})}finally{u(m=>{const D=new Set(m);return D.delete(l),D})}}},[r,s]),y=(l,g)=>{N({[l]:g})};return e.jsxs("div",{className:"max-w-4xl mx-auto space-y-8",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(lt,{className:"w-6 h-6 text-primary"}),s({id:"settings.title"})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:s({id:"settings.description"})})]}),e.jsxs(Y,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(ot,{className:"w-5 h-5"}),s({id:"settings.sections.appearance"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground mb-1",children:s({id:"settings.appearance.theme"})}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s({id:"settings.appearance.description"})}),e.jsx(na,{})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.appearance.systemFollow"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.appearance.systemFollowDesc"})})]}),e.jsx(j,{variant:t==="system"?"default":"outline",size:"sm",onClick:()=>n("system"),children:s({id:"settings.appearance.themeOptions.system"})})]})]})]}),e.jsxs(Y,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(is,{className:"w-5 h-5"}),s({id:"settings.sections.language"})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.language.displayLanguage"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.language.chooseLanguage"})})]}),e.jsx(ia,{})]})})]}),e.jsx(Fa,{}),e.jsx(ja,{}),e.jsx(Da,{}),e.jsx(Pa,{}),e.jsxs(Y,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(ns,{className:"w-5 h-5"}),s({id:"settings.sections.cliTools"})]}),e.jsx(Ua,{cliTools:r,defaultCliTool:c,expandedTools:E,savingTools:F,onToggleExpand:v,onToggleEnabled:k,onSetDefault:h,onUpdateModel:H,onUpdateTags:C,onUpdateAvailableModels:M,onUpdateEnvFile:O,onUpdateSettingsFile:W,onUpdateEffort:A,onSaveToBackend:b,formatMessage:s})]}),e.jsx(Ca,{}),e.jsxs(Y,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(ue,{className:"w-5 h-5"}),s({id:"settings.dataRefresh.title"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.dataRefresh.autoRefresh"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.dataRefresh.autoRefreshDesc"})})]}),e.jsx(j,{variant:d.autoRefresh?"default":"outline",size:"sm",onClick:()=>y("autoRefresh",!d.autoRefresh),children:d.autoRefresh?s({id:"settings.dataRefresh.enabled"}):s({id:"settings.dataRefresh.disabled"})})]}),d.autoRefresh&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.dataRefresh.refreshInterval"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.dataRefresh.refreshIntervalDesc"})})]}),e.jsx("div",{className:"flex gap-2",children:[15e3,3e4,6e4,12e4].map(l=>e.jsxs(j,{variant:d.refreshInterval===l?"default":"outline",size:"sm",onClick:()=>y("refreshInterval",l),children:[l/1e3,"s"]},l))})]})]})]}),e.jsxs(Y,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Be,{className:"w-5 h-5"}),s({id:"settings.notifications.title"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.notifications.enableNotifications"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.notifications.enableNotificationsDesc"})})]}),e.jsx(j,{variant:d.notificationsEnabled?"default":"outline",size:"sm",onClick:()=>y("notificationsEnabled",!d.notificationsEnabled),children:d.notificationsEnabled?s({id:"settings.dataRefresh.enabled"}):s({id:"settings.dataRefresh.disabled"})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.notifications.soundEffects"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.notifications.soundEffectsDesc"})})]}),e.jsx(j,{variant:d.soundEnabled?"default":"outline",size:"sm",onClick:()=>y("soundEnabled",!d.soundEnabled),children:d.soundEnabled?s({id:"settings.notifications.on"}):s({id:"settings.notifications.off"})})]})]})]}),e.jsx(fa,{}),e.jsxs(Y,{className:"p-6 border-destructive/50",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Ye,{className:"w-5 h-5"}),s({id:"common.actions.reset"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s({id:"settings.reset.description"})}),e.jsxs(j,{variant:"destructive",onClick:()=>{confirm(s({id:"settings.reset.confirm"}))&&f()},children:[e.jsx(Ye,{className:"w-4 h-4 mr-2"}),s({id:"common.actions.resetToDefaults"})]})]})]})}export{Ya as SettingsPage,Ya as default};
|
|
150
|
-
//# sourceMappingURL=SettingsPage-
|
|
149
|
+
`)}`}function ka({agent:s,onSaved:t}){const[n,r]=i.useState(s.color),[c,d]=i.useState(s.permissionMode),[x,p]=i.useState(s.memory),[N,f]=i.useState(s.maxTurns),[F,w]=i.useState(s.background==="true"),[P,u]=i.useState(s.isolation),[v,k]=i.useState(s.tools),[h,$]=i.useState(s.disallowedTools),[C,M]=i.useState(s.skills),[O,K]=i.useState([]),[A,b]=i.useState(()=>Ze(s.mcpServers)),[y,l]=i.useState(!1),[g,m]=i.useState(""),[E,B]=i.useState(()=>es(s.hooks)),[G,q]=i.useState("PreToolUse"),[_,ee]=i.useState(!1);i.useEffect(()=>{let a=!1;return l(!0),rt().then(S=>{if(a)return;const I=new Set;S.userServers&&Object.keys(S.userServers).forEach(U=>I.add(U)),S.globalServers&&Object.keys(S.globalServers).forEach(U=>I.add(U)),S.projects&&Object.values(S.projects).forEach(U=>{U!=null&&U.mcpServers&&Object.keys(U.mcpServers).forEach(J=>I.add(J))}),K(Array.from(I).sort())}).catch(()=>{}).finally(()=>{a||l(!1)}),()=>{a=!0}},[]),i.useEffect(()=>{r(s.color),d(s.permissionMode),p(s.memory),f(s.maxTurns),w(s.background==="true"),u(s.isolation),k(s.tools),$(s.disallowedTools),M(s.skills),b(Ze(s.mcpServers)),B(es(s.hooks))},[s]);const te=i.useCallback(async()=>{ee(!0);try{const a={filePath:s.filePath};n!==s.color&&(a.color=n),c!==s.permissionMode&&(a.permissionMode=c),x!==s.memory&&(a.memory=x),N!==s.maxTurns&&(a.maxTurns=N);const S=F?"true":"";S!==s.background&&(a.background=S),P!==s.isolation&&(a.isolation=P),v!==s.tools&&(a.tools=v),h!==s.disallowedTools&&(a.disallowedTools=h),C!==s.skills&&(a.skills=C);const I=ya(A);I!==s.mcpServers&&(a.mcpServers=I);const U=wa(E);if(U!==s.hooks&&(a.hooks=U),Object.keys(a).filter(ie=>ie!=="filePath").length===0){H.info("No changes to save");return}await Be(s.type,s.name,a),H.success(`Updated ${s.name} advanced settings`),t()}catch(a){H.error(`Failed: ${a.message}`)}finally{ee(!1)}},[s,n,c,x,N,F,P,v,h,C,A,E,t]),de=a=>{b(S=>S.includes(a)?S.filter(I=>I!==a):[...S,a])},me=()=>{const a=g.trim();a&&!A.includes(a)&&(b(S=>[...S,a]),m(""))},Y=()=>{B(a=>({...a,[G]:[...a[G],{matcher:"",command:""}]}))},re=(a,S)=>{B(I=>({...I,[a]:I[a].filter((U,J)=>J!==S)}))},ae=(a,S,I,U)=>{B(J=>({...J,[a]:J[a].map((ie,xe)=>xe===S?{...ie,[I]:U}:ie)}))};return e.jsxs("div",{className:"mt-2 ml-6 p-3 rounded-md border border-border bg-muted/20 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"Color:"}),e.jsx("select",{className:se,value:n,onChange:a=>r(a.target.value),children:hs.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"Permission:"}),e.jsx("select",{className:se,value:c,onChange:a=>d(a.target.value),children:ms.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"Memory:"}),e.jsx("select",{className:se,value:x,onChange:a=>p(a.target.value),children:us.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"MaxTurns:"}),e.jsx(D,{className:"h-7 text-xs w-[60px]",type:"number",value:N,onChange:a=>f(a.target.value),placeholder:"—"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Ie,{checked:F,onCheckedChange:a=>w(a===!0)}),e.jsx("span",{className:W,children:"Background"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"Isolation:"}),e.jsx("select",{className:se,value:P,onChange:a=>u(a.target.value),children:xs.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:W,children:"Tools:"}),e.jsx(D,{className:"h-7 text-xs flex-1",value:v,onChange:a=>k(a.target.value),placeholder:"Read, Write, Bash, Glob, Grep"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:W,children:"Disallowed:"}),e.jsx(D,{className:"h-7 text-xs flex-1",value:h,onChange:a=>$(a.target.value),placeholder:"e.g. Edit"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:W,children:"Skills:"}),e.jsx(D,{className:"h-7 text-xs flex-1",value:C,onChange:a=>M(a.target.value),placeholder:"e.g. api-conventions, error-handling"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"MCP Servers:"}),y?e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:"Loading..."}):e.jsxs("div",{className:"flex flex-wrap gap-3 ml-1",children:[O.map(a=>e.jsxs("label",{className:"flex items-center gap-1.5 text-xs cursor-pointer",children:[e.jsx(Ie,{checked:A.includes(a),onCheckedChange:()=>de(a)}),e.jsx("span",{className:"text-foreground",children:a})]},a)),A.filter(a=>!O.includes(a)).map(a=>e.jsxs("label",{className:"flex items-center gap-1.5 text-xs cursor-pointer",children:[e.jsx(Ie,{checked:!0,onCheckedChange:()=>de(a)}),e.jsx("span",{className:"text-foreground italic",children:a})]},a)),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(D,{className:"h-6 text-xs w-[120px]",value:g,onChange:a=>m(a.target.value),placeholder:"+ Custom",onKeyDown:a=>{a.key==="Enter"&&me()}}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-6 px-1",onClick:me,disabled:!g.trim(),children:e.jsx(Ne,{className:"w-3 h-3"})})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Hooks:"}),Oe.map(a=>{const S=E[a];return S.length===0?null:e.jsxs("div",{className:"ml-1 space-y-1",children:[e.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[a,":"]}),S.map((I,U)=>e.jsxs("div",{className:"flex items-center gap-2 ml-3",children:[e.jsx(D,{className:"h-6 text-xs w-[100px]",value:I.matcher,onChange:J=>ae(a,U,"matcher",J.target.value),placeholder:"matcher (e.g. Bash)"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"→"}),e.jsx(D,{className:"h-6 text-xs flex-1",value:I.command,onChange:J=>ae(a,U,"command",J.target.value),placeholder:"command"}),e.jsx("button",{type:"button",className:"text-muted-foreground hover:text-destructive transition-colors",onClick:()=>re(a,U),children:e.jsx(ne,{className:"w-3 h-3"})})]},U))]},a)}),e.jsxs("div",{className:"flex items-center gap-2 ml-1",children:[e.jsx("select",{className:se,value:G,onChange:a=>q(a.target.value),children:Oe.map(a=>e.jsx("option",{value:a,children:a},a))}),e.jsxs(j,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:Y,children:[e.jsx(Ne,{className:"w-3 h-3 mr-1"}),"Add Hook"]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(j,{variant:"default",size:"sm",className:"h-7",disabled:_,onClick:te,children:[e.jsx(Fe,{className:"w-3 h-3 mr-1"}),_?"Saving...":"Save Advanced"]})})]})}function Ca({agent:s,onSaved:t}){const[n,r]=i.useState(s.model),[c,d]=i.useState(s.effort),[x,p]=i.useState(!1),[N,f]=i.useState(!1),F=n!==s.model||c!==s.effort,w=s.type==="codex"?cs:ds,P=i.useCallback(async()=>{p(!0);try{const u={filePath:s.filePath};n!==s.model&&(u.model=n),c!==s.effort&&(u.effort=c),await Be(s.type,s.name,u),H.success(`Updated ${s.name}`),t()}catch(u){H.error(`Failed to update ${s.name}: ${u.message}`)}finally{p(!1)}},[s,n,c,t]);return i.useEffect(()=>{r(s.model),d(s.effort)},[s.model,s.effort]),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-md border border-border bg-card hover:bg-accent/30 transition-colors",children:[e.jsx(Z,{variant:s.type==="codex"?"default":"secondary",className:"text-xs shrink-0",children:s.type}),e.jsx("span",{className:"text-sm font-medium text-foreground min-w-[140px] truncate",title:s.name,children:s.name}),e.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0",children:[e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Model:"}),s.type==="claude"?e.jsxs("div",{className:"flex gap-1 flex-1 min-w-0",children:[e.jsxs("select",{className:"h-7 text-xs rounded border border-input bg-background px-2 shrink-0",value:Me.includes(n)?n:"__custom__",onChange:u=>{u.target.value!=="__custom__"&&r(u.target.value)},children:[Me.map(u=>e.jsx("option",{value:u,children:u||"(none)"},u)),!Me.includes(n)&&e.jsx("option",{value:"__custom__",children:"custom"})]}),!Me.includes(n)&&e.jsx(D,{className:"h-7 text-xs flex-1 min-w-[100px]",value:n,onChange:u=>r(u.target.value),placeholder:"model id"})]}):e.jsx(D,{className:"h-7 text-xs flex-1 min-w-[100px]",value:n,onChange:u=>r(u.target.value),placeholder:"model id"})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Effort:"}),e.jsx("select",{className:"h-7 text-xs rounded border border-input bg-background px-2",value:c,onChange:u=>d(u.target.value),children:w.map(u=>e.jsx("option",{value:u,children:u||"—"},u))})]}),e.jsxs(j,{variant:"outline",size:"sm",className:"h-7 px-2 shrink-0",disabled:!F||x,onClick:P,children:[e.jsx(Fe,{className:"w-3 h-3 mr-1"}),x?"...":"Save"]}),s.type==="claude"&&e.jsx("button",{type:"button",className:z("p-1 rounded hover:bg-accent transition-colors",N&&"text-primary"),onClick:()=>f(!N),title:"Advanced Settings",children:e.jsx(ns,{className:"w-4 h-4"})})]}),N&&s.type==="claude"&&e.jsx(ka,{agent:s,onSaved:t})]})}function Sa({installationPath:s,agents:t,onSaved:n}){const[r,c]=i.useState(!0);return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full text-left py-1 hover:text-primary transition-colors",onClick:()=>c(!r),children:[r?e.jsx(Ee,{className:"w-4 h-4"}):e.jsx(nt,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm font-medium text-foreground truncate",title:s,children:s}),e.jsxs(Z,{variant:"outline",className:"text-xs ml-auto shrink-0",children:[t.length," agents"]})]}),r&&e.jsx("div",{className:"space-y-1 ml-6",children:t.map(d=>e.jsx(Ca,{agent:d,onSaved:n},d.filePath))})]})}function Ta(){const[s,t]=i.useState([]),[n,r]=i.useState(!0),[c,d]=i.useState(""),[x,p]=i.useState(""),[N,f]=i.useState("all"),[F,w]=i.useState(""),[P,u]=i.useState(""),[v,k]=i.useState(""),[h,$]=i.useState(""),[C,M]=i.useState(""),[O,K]=i.useState(""),[A,b]=i.useState(""),[y,l]=i.useState(""),[g,m]=i.useState(""),[E,B]=i.useState(!1),[G,q]=i.useState(!1),_=i.useCallback(async()=>{try{r(!0);const a=await tt();t(a.agents)}catch(a){H.error(`Failed to load agents: ${a.message}`)}finally{r(!1)}},[]);i.useEffect(()=>{_()},[_]);const ee=s.reduce((a,S)=>{const I=S.installationPath;return a[I]||(a[I]=[]),a[I].push(S),a},{}),te=s.filter(a=>N==="all"||a.type===N),de=te.some(a=>a.type==="claude"),me=N==="codex"?cs:N==="claude"?ds:["","low","medium","high","max (claude only)"],Y={};F&&(Y.color=F),P&&(Y.permissionMode=P),v&&(Y.memory=v),h&&(Y.maxTurns=h),C&&(Y.background=C),O&&(Y.isolation=O),A&&(Y.tools=A),y&&(Y.disallowedTools=y),g&&(Y.skills=g);const re=Object.keys(Y).length>0,ae=i.useCallback(async()=>{if(!(c||x||re)){H.error("Set at least one value first");return}if(te.length===0){H.error("No agents match the selected type");return}q(!0);try{if(c||x){const S=te.map(U=>({filePath:U.filePath,type:U.type})),I=await at({targets:S,model:c||void 0,effort:x||void 0});H.success(`Updated model/effort: ${I.updated}/${I.total} agents`)}if(re&&de){const S=te.filter(U=>U.type==="claude");let I=0;for(const U of S)try{const J={filePath:U.filePath,...Y};await Be(U.type,U.name,J),I++}catch{}H.success(`Updated claude fields: ${I}/${S.length} agents`)}_()}catch(S){H.error(`Batch update failed: ${S.message}`)}finally{q(!1)}},[te,de,c,x,re,Y,_]);return e.jsxs(Q,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx(qt,{className:"w-5 h-5"}),"Agent Definitions"]}),e.jsxs(j,{variant:"ghost",size:"sm",onClick:_,disabled:n,children:[e.jsx(ue,{className:z("w-4 h-4 mr-1",n&&"animate-spin")}),"Refresh"]})]}),e.jsxs("div",{className:"p-3 mb-4 rounded-md border border-border bg-muted/30 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:"Batch:"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"Target:"}),e.jsxs("select",{className:se,value:N,onChange:a=>f(a.target.value),children:[e.jsxs("option",{value:"all",children:["All (",s.length,")"]}),e.jsxs("option",{value:"codex",children:["Codex (",s.filter(a=>a.type==="codex").length,")"]}),e.jsxs("option",{value:"claude",children:["Claude (",s.filter(a=>a.type==="claude").length,")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"Model:"}),e.jsx(D,{className:"h-7 text-xs w-[140px]",value:c,onChange:a=>d(a.target.value),placeholder:"model"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"Effort:"}),e.jsx("select",{className:se,value:x,onChange:a=>p(a.target.value),children:me.map(a=>{const S=a.startsWith("max")?"max":a;return e.jsx("option",{value:S,children:a||"—"},a)})})]}),N!=="codex"&&e.jsx("button",{type:"button",className:z("p-1 rounded hover:bg-accent transition-colors",E&&"text-primary"),onClick:()=>B(!E),title:"Claude Advanced Batch Settings",children:e.jsx(ns,{className:"w-4 h-4"})}),e.jsx(j,{variant:"default",size:"sm",className:"h-7",disabled:G||!c&&!x&&!re,onClick:ae,children:G?"Applying...":`Apply to ${N==="all"?"All":N} (${te.length})`})]}),E&&N!=="codex"&&e.jsxs("div",{className:"pt-2 border-t border-border space-y-2",children:[e.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:["Claude-only fields ",N==="all"&&"(applied to claude agents only)",":"]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"Color:"}),e.jsx("select",{className:se,value:F,onChange:a=>w(a.target.value),children:hs.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"Permission:"}),e.jsx("select",{className:se,value:P,onChange:a=>u(a.target.value),children:ms.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"Memory:"}),e.jsx("select",{className:se,value:v,onChange:a=>k(a.target.value),children:us.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"MaxTurns:"}),e.jsx(D,{className:"h-7 text-xs w-[60px]",type:"number",value:h,onChange:a=>$(a.target.value),placeholder:"—"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"Background:"}),e.jsxs("select",{className:se,value:C,onChange:a=>M(a.target.value),children:[e.jsx("option",{value:"",children:"—"}),e.jsx("option",{value:"true",children:"true"}),e.jsx("option",{value:"false",children:"false"})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:W,children:"Isolation:"}),e.jsx("select",{className:se,value:O,onChange:a=>K(a.target.value),children:xs.map(a=>e.jsx("option",{value:a,children:a||"—"},a))})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[200px]",children:[e.jsx("span",{className:W,children:"Tools:"}),e.jsx(D,{className:"h-7 text-xs flex-1",value:A,onChange:a=>b(a.target.value),placeholder:"Read, Write, Bash, Glob, Grep"})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[200px]",children:[e.jsx("span",{className:W,children:"Disallowed:"}),e.jsx(D,{className:"h-7 text-xs flex-1",value:y,onChange:a=>l(a.target.value),placeholder:"e.g. Edit"})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-[200px]",children:[e.jsx("span",{className:W,children:"Skills:"}),e.jsx(D,{className:"h-7 text-xs flex-1",value:g,onChange:a=>m(a.target.value),placeholder:"e.g. api-conventions"})]})]})]})]}),n?e.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"Loading agents..."}):s.length===0?e.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"No agent definitions found. Install CCW to a project first."}):e.jsx("div",{className:"space-y-4",children:Object.entries(ee).map(([a,S])=>e.jsx(Sa,{installationPath:a,agents:S,onSaved:_},a))})]})}function ss(){const s=document.cookie.match(/XSRF-TOKEN=([^;]+)/);return s?decodeURIComponent(s[1]):null}function ts({value:s,onChange:t,placeholder:n}){const[r,c]=i.useState(!1),[d,x]=i.useState(null),p=Wt(s,500);i.useEffect(()=>{if(p){c(!0),x(null);const f=setTimeout(()=>{p.trim().length>0?x(null):x("Path cannot be empty."),c(!1)},1e3);return()=>clearTimeout(f)}else x(null),c(!1)},[p]);const N=async()=>{const{selectFile:f}=await jt(async()=>{const{selectFile:P}=await import("./index-rLgoBCfV.js").then(u=>u.gf);return{selectFile:P}},__vite__mapDeps([0,1])),F=s?s.replace(/[/\\][^/\\]*$/,""):void 0,w=await f(F);w.path&&!w.cancelled&&!w.error&&t(w.path)};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(D,{value:s,onChange:f=>t(f.target.value),placeholder:n,className:z("flex-1",d&&"border-destructive")}),r&&e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(pt,{className:"h-4 w-4 animate-spin text-muted-foreground"})})]}),e.jsx(j,{type:"button",variant:"outline",size:"sm",className:"shrink-0 h-9",onClick:N,title:"Browse",children:e.jsx(bt,{className:"w-4 h-4"})})]}),d&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:d})]})}const Ma=new Set(["gemini","qwen","opencode"]),gs=new Set(["claude"]);function fs(s){return Ma.has(s)?"envFile":gs.has(s)?"settingsFile":"none"}function Ea({toolId:s,config:t,isDefault:n,isExpanded:r,toolAvailable:c,isSaving:d,onToggleExpand:x,onToggleEnabled:p,onSetDefault:N,onUpdateModel:f,onUpdateTags:F,onUpdateAvailableModels:w,onUpdateEnvFile:P,onUpdateSettingsFile:u,onUpdateEffort:v,onSaveToBackend:k}){const{formatMessage:h}=X(),[$,C]=i.useState(""),[M,O]=i.useState(""),K=()=>{const m=$.trim();m&&!t.tags.includes(m)&&(F([...t.tags,m]),C(""))},A=m=>{F(t.tags.filter(E=>E!==m))},b=()=>{const m=M.trim(),E=t.availableModels||[];m&&!E.includes(m)&&(w([...E,m]),O(""))},y=m=>{const E=t.availableModels||[];w(E.filter(B=>B!==m))},l=["分析","Debug","implementation","refactoring","testing"],g=fs(s);return e.jsxs(Q,{className:z("overflow-hidden",!t.enabled&&"opacity-60"),children:[e.jsxs("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:x,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:z("p-2 rounded-lg",t.enabled?"bg-primary/10":"bg-muted"),children:e.jsx(rs,{className:z("w-5 h-5",t.enabled?"text-primary":"text-muted-foreground")})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground capitalize",children:s}),n&&e.jsx(Z,{variant:"default",className:"text-xs",children:h({id:"settings.cliTools.default"})}),e.jsx(Z,{variant:"outline",className:"text-xs",children:t.type}),c!==void 0&&e.jsx("span",{className:z("inline-block w-2 h-2 rounded-full",c?"bg-green-500":"bg-red-400"),title:c?"Available":"Unavailable"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.primaryModel})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{variant:t.enabled?"default":"outline",size:"sm",className:"h-8",onClick:m=>{m.stopPropagation(),p()},children:t.enabled?e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-4 h-4 mr-1"}),h({id:"settings.cliTools.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-4 h-4 mr-1"}),h({id:"settings.cliTools.disabled"})]})}),r?e.jsx(He,{className:"w-5 h-5 text-muted-foreground"}):e.jsx(Ee,{className:"w-5 h-5 text-muted-foreground"})]})]}),t.tags&&t.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:t.tags.map(m=>e.jsx(Z,{variant:"secondary",className:"text-xs",children:m},m))})]}),r&&e.jsxs("div",{className:"border-t border-border p-4 space-y-4 bg-muted/30",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"settings.cliTools.primaryModel"})}),e.jsx(D,{value:t.primaryModel,onChange:m=>f("primaryModel",m.target.value),className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"settings.cliTools.secondaryModel"})}),e.jsx(D,{value:t.secondaryModel,onChange:m=>f("secondaryModel",m.target.value),className:"mt-1"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"apiSettings.cliSettings.tags"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"apiSettings.cliSettings.tagsDescription"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 flex flex-wrap gap-1.5 p-2 border border-input bg-background rounded-md min-h-[38px] focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",children:[t.tags.map(m=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-primary/10 text-primary rounded text-xs h-6",children:[m,e.jsx("button",{type:"button",onClick:()=>A(m),className:"hover:text-destructive transition-colors","aria-label":h({id:"apiSettings.cliSettings.removeTag"}),children:e.jsx(ne,{className:"w-3 h-3"})})]},m)),e.jsx("input",{type:"text",value:$,onChange:m=>C(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),K())},placeholder:t.tags.length===0?h({id:"apiSettings.cliSettings.tagInputPlaceholder"}):"",className:"flex-1 min-w-[120px] bg-transparent border-0 outline-none text-sm placeholder:text-muted-foreground"})]}),e.jsx(j,{type:"button",size:"sm",onClick:K,variant:"outline",className:"shrink-0",children:e.jsx(Ne,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[h({id:"apiSettings.cliSettings.predefinedTags"}),":"]}),l.map(m=>e.jsx("button",{type:"button",onClick:()=>{t.tags.includes(m)||F([...t.tags,m])},disabled:t.tags.includes(m),className:"text-xs px-2 py-0.5 rounded border border-border hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:m},m))]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"apiSettings.cliSettings.availableModels"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1 flex flex-wrap gap-1.5 p-2 border border-input bg-background rounded-md min-h-[38px] focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",children:[(t.availableModels||[]).map(m=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-primary/10 text-primary rounded text-xs h-6",children:[m,e.jsx("button",{type:"button",onClick:()=>y(m),className:"hover:text-destructive transition-colors",children:e.jsx(ne,{className:"w-3 h-3"})})]},m)),e.jsx("input",{type:"text",value:M,onChange:m=>O(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),b())},placeholder:(t.availableModels||[]).length===0?h({id:"apiSettings.cliSettings.availableModelsPlaceholder"}):"",className:"flex-1 min-w-[120px] bg-transparent border-0 outline-none text-sm placeholder:text-muted-foreground"})]}),e.jsx(j,{type:"button",size:"sm",onClick:b,variant:"outline",className:"shrink-0",children:e.jsx(Ne,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"apiSettings.cliSettings.availableModelsHint"})})]}),g==="envFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"settings.cliTools.envFile"})}),e.jsx(ts,{value:t.envFile||"",onChange:m=>P(m||void 0),placeholder:h({id:"settings.cliTools.envFilePlaceholder"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"settings.cliTools.envFileHint"})})]}),g==="settingsFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"apiSettings.cliSettings.settingsFile"})}),e.jsx(ts,{value:t.settingsFile||"",onChange:m=>u(m||void 0),placeholder:h({id:"apiSettings.cliSettings.settingsFilePlaceholder"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"apiSettings.cliSettings.settingsFileHint"})})]}),g==="settingsFile"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:h({id:"settings.cliTools.effort"})}),e.jsx("div",{className:"flex gap-2",children:["low","medium","high"].map(m=>{const E=t.effort||"high",B=`settings.cliTools.effort${m.charAt(0).toUpperCase()+m.slice(1)}`;return e.jsx("button",{type:"button",onClick:()=>v(m==="high"&&!t.effort?void 0:m),className:z("px-3 py-1.5 rounded-md text-sm border transition-colors",E===m?"bg-primary text-primary-foreground border-primary":"border-border hover:bg-muted"),children:h({id:B})},m)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h({id:"settings.cliTools.effortHint"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!n&&t.enabled&&e.jsx(j,{variant:"outline",size:"sm",onClick:N,children:h({id:"settings.cliTools.setDefault"})}),e.jsxs(j,{variant:"default",size:"sm",onClick:k,disabled:d,children:[e.jsx(Fe,{className:"w-4 h-4 mr-1"}),h(d?{id:"settings.cliTools.saving"}:{id:"settings.cliTools.saveToConfig"})]})]})]})]})}function Fa(){const{formatMessage:s}=X(),{data:t,isLoading:n}=Mt(),{toggle:r,isPending:c}=Et(),{data:d,isLoading:x}=Ft(),{toggle:p,isPending:N}=Pt(),{data:f,isLoading:F}=Dt(),{toggle:w,isPending:P}=Ut(),{refresh:u,isPending:v}=Lt(),{exportSettings:k,isPending:h}=It(),{importSettings:$,isPending:C}=At(),M=i.useRef(null),O=i.useCallback(async()=>{try{const A=await k(),b=new Blob([JSON.stringify(A,null,2)],{type:"application/json"}),y=URL.createObjectURL(b),l=document.createElement("a"),g=new Date().toISOString().replace(/[:.]/g,"-").slice(0,19);l.href=y,l.download=`ccw-settings-${g}.json`,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(y),H.success(s({id:"settings.responseLanguage.exportSuccess"}))}catch{H.error(s({id:"settings.responseLanguage.exportError"}))}},[k,s]),K=i.useCallback(async A=>{var y;const b=(y=A.target.files)==null?void 0:y[0];if(b){if(A.target.value="",!b.name.endsWith(".json")&&b.type!=="application/json"){H.error(s({id:"settings.responseLanguage.importInvalidFile"}));return}try{const l=await b.text(),g=JSON.parse(l);if(!g.version||!g.endpoints){H.error(s({id:"settings.responseLanguage.importInvalidStructure"}));return}const m=await $(g);m.success?H.success(s({id:"settings.responseLanguage.importSuccess"},{imported:m.imported,skipped:m.skipped})):H.error(s({id:"settings.responseLanguage.importError"}))}catch(l){l instanceof SyntaxError?H.error(s({id:"settings.responseLanguage.importInvalidJson"})):H.error(s({id:"settings.responseLanguage.importError"}))}}},[$,s]);return e.jsxs(Q,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Qt,{className:"w-5 h-5"}),s({id:"settings.sections.responseLanguage"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.chineseClaude"})}),e.jsx(Z,{variant:"default",className:"text-xs",children:"Claude"})]}),e.jsx(j,{variant:t!=null&&t.claudeEnabled?"default":"outline",size:"sm",className:"h-7",disabled:n||c,onClick:()=>r(!(t!=null&&t.claudeEnabled),"claude"),children:t!=null&&t.claudeEnabled?e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.chineseClaudeDesc"})})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.chineseCodex"})}),e.jsx(Z,{variant:"secondary",className:"text-xs",children:"Codex"})]}),e.jsx(j,{variant:t!=null&&t.codexEnabled?"default":"outline",size:"sm",className:"h-7",disabled:n||c,onClick:()=>r(!(t!=null&&t.codexEnabled),"codex"),children:t!=null&&t.codexEnabled?e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.chineseCodexDesc"})}),(t==null?void 0:t.codexNeedsMigration)&&e.jsxs("p",{className:"text-xs text-yellow-500",children:[e.jsx(ze,{className:"w-3 h-3 inline mr-1"}),s({id:"settings.responseLanguage.migrationWarning"})]})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(mt,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.windowsPlatform"})})]}),e.jsx(j,{variant:d!=null&&d.enabled?"default":"outline",size:"sm",className:"h-7",disabled:x||N,onClick:()=>p(!(d!=null&&d.enabled)),children:d!=null&&d.enabled?e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.windowsPlatformDesc"})})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ut,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.responseLanguage.cliEnhancement"})}),e.jsx(Z,{variant:"secondary",className:"text-xs",children:"Codex"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[(f==null?void 0:f.enabled)&&e.jsx(j,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",disabled:F||v,onClick:()=>u(),title:s({id:"settings.responseLanguage.refreshConfig"}),children:e.jsx(ue,{className:z("w-3.5 h-3.5",v&&"animate-spin")})}),e.jsx(j,{variant:f!=null&&f.enabled?"default":"outline",size:"sm",className:"h-7",disabled:F||P,onClick:()=>w(!(f!=null&&f.enabled)),children:f!=null&&f.enabled?e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.enabled"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-4 h-4 mr-1"}),s({id:"settings.responseLanguage.disabled"})]})})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.cliEnhancementDesc"})}),(f==null?void 0:f.enabled)&&e.jsx("p",{className:"text-xs text-muted-foreground/70",children:s({id:"settings.responseLanguage.cliEnhancementHint"})})]})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-border",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.responseLanguage.exportImportHint"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{ref:M,type:"file",accept:".json,application/json",onChange:K,className:"hidden"}),e.jsx(j,{variant:"outline",size:"sm",className:"h-7",disabled:C,onClick:()=>{var A;return(A=M.current)==null?void 0:A.click()},children:C?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3.5 h-3.5 border-2 border-border border-t-accent rounded-full animate-spin mr-1"}),s({id:"settings.responseLanguage.importing"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Gt,{className:"w-3.5 h-3.5 mr-1"}),s({id:"settings.responseLanguage.import"})]})}),e.jsx(j,{variant:"outline",size:"sm",className:"h-7",disabled:h,onClick:O,children:h?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3.5 h-3.5 border-2 border-border border-t-accent rounded-full animate-spin mr-1"}),s({id:"settings.responseLanguage.exporting"})]}):e.jsxs(e.Fragment,{children:[e.jsx(xt,{className:"w-3.5 h-3.5 mr-1"}),s({id:"settings.responseLanguage.export"})]})})]})]})})]})}function Pa(){const{formatMessage:s}=X(),[t,n]=i.useState(null),[r,c]=i.useState(!1),[d,x]=i.useState(null),[p,N]=i.useState(null),[f,F]=i.useState(()=>{try{const u=localStorage.getItem("ccw.autoUpdate");return u===null?!0:JSON.parse(u)}catch{return!0}}),w=async(u=!1)=>{u||c(!0),x(null);try{const v=await fetch("/api/version-check");if(!v.ok)throw new Error(`HTTP ${v.status}`);const k=await v.json();if(!k.currentVersion)throw new Error("Invalid response");n(k),N(new Date)}catch(v){u||x(v instanceof Error?v.message:"Unknown error")}finally{c(!1)}};i.useEffect(()=>{if(w(!0),!f)return;const u=setInterval(()=>w(!0),3600*1e3);return()=>clearInterval(u)},[f]);const P=u=>{F(u),localStorage.setItem("ccw.autoUpdate",JSON.stringify(u))};return e.jsxs(Q,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx(is,{className:"w-5 h-5"}),s({id:"settings.versionCheck.title"})]}),e.jsxs(j,{variant:"outline",size:"sm",disabled:r,onClick:()=>w(),children:[e.jsx(ue,{className:z("w-3.5 h-3.5 mr-1.5",r&&"animate-spin")}),s(r?{id:"settings.versionCheck.checking"}:{id:"settings.versionCheck.checkNow"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:s({id:"settings.versionCheck.currentVersion"})}),e.jsx(Z,{variant:"secondary",className:"font-mono text-xs",children:(t==null?void 0:t.currentVersion)??"..."})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:s({id:"settings.versionCheck.latestVersion"})}),e.jsx(Z,{variant:t!=null&&t.hasUpdate?"default":"secondary",className:"font-mono text-xs",children:(t==null?void 0:t.latestVersion)??"..."})]}),t&&e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border",children:[e.jsx("span",{className:"text-sm font-medium",children:t.hasUpdate?s({id:"settings.versionCheck.updateAvailable"}):s({id:"settings.versionCheck.upToDate"})}),e.jsx("span",{className:z("inline-block w-2.5 h-2.5 rounded-full",t.hasUpdate?"bg-orange-500":"bg-green-500")})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-border",children:[e.jsx(ze,{className:"w-4 h-4 text-destructive flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-destructive",children:[s({id:"settings.versionCheck.checkFailed"}),": ",d]})]})]}),(t==null?void 0:t.hasUpdate)&&e.jsxs("div",{className:"rounded-lg border border-orange-500/30 bg-orange-500/5 p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground mb-1",children:s({id:"settings.versionCheck.updateCommand"})}),e.jsx("code",{className:"text-xs font-mono bg-muted px-3 py-1.5 rounded block",children:t.updateCommand})]}),e.jsx(j,{variant:"outline",size:"sm",asChild:!0,children:e.jsx("a",{href:"https://github.com/dyw0830/ccw/releases",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5",children:s({id:"settings.versionCheck.viewRelease"})})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:f,onChange:u=>P(u.target.checked),className:"rounded border-input"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium",children:s({id:"settings.versionCheck.autoCheck"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"settings.versionCheck.autoCheckDesc"})})]})]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s({id:"settings.versionCheck.lastChecked"}),":"," ",p?p.toLocaleTimeString():s({id:"settings.versionCheck.never"})]})]})]})]})}function Da(){const{formatMessage:s}=X(),{installations:t,isLoading:n,refetch:r}=Ot(),{upgrade:c,isPending:d}=Rt(),{data:x}=Ht();return e.jsxs(Q,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx(Kt,{className:"w-5 h-5"}),s({id:"settings.systemStatus.title"}),!n&&e.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[t.length," ",s({id:"settings.systemStatus.installations"})]})]}),e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(j,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>r(),title:s({id:"settings.systemStatus.refresh"}),children:e.jsx(ue,{className:z("w-3.5 h-3.5",n&&"animate-spin")})})})]}),n?e.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:s({id:"settings.systemStatus.checking"})}):t.length===0?e.jsxs("div",{className:"text-center py-6 space-y-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.systemStatus.noInstallations"})}),e.jsx("div",{className:"bg-muted/50 rounded-md p-3 inline-block",children:e.jsx("code",{className:"text-xs font-mono",children:"ccw install"})})]}):e.jsxs("div",{className:"space-y-3",children:[t.map(p=>{const N=p.installation_mode==="Global",f=new Date(p.installation_date).toLocaleDateString(),F=p.application_version!=="unknown"?p.application_version:p.installer_version;return e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:z("inline-flex items-center justify-center w-8 h-8 rounded-lg",N?"bg-primary/10 text-primary":"bg-orange-500/10 text-orange-500"),children:N?e.jsx(ht,{className:"w-4 h-4"}):e.jsx(Jt,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-sm font-medium",children:s(N?{id:"settings.systemStatus.global"}:{id:"settings.systemStatus.path"})}),e.jsxs(Z,{variant:"secondary",className:"text-xs font-mono",children:["v",F]})]}),e.jsxs(j,{variant:"ghost",size:"sm",className:"h-7",disabled:d,onClick:()=>c(p.installation_path),children:[e.jsx(is,{className:z("w-3.5 h-3.5 mr-1",d&&"animate-spin")}),s(d?{id:"settings.systemStatus.upgrading"}:{id:"settings.systemStatus.upgrade"})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded px-2 py-1 font-mono truncate",title:p.installation_path,children:p.installation_path}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(gt,{className:"w-3 h-3"}),f]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ft,{className:"w-3 h-3"}),p.files_count," ",s({id:"settings.systemStatus.files"})]})]})]},p.manifest_id)}),x&&!x.installed&&x.missingFiles.length>0&&e.jsxs("div",{className:"rounded-lg border border-yellow-500/50 bg-yellow-500/5 p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-yellow-600 dark:text-yellow-500",children:[e.jsx(ze,{className:"w-4 h-4"}),s({id:"settings.systemStatus.incomplete"})," — ",x.missingFiles.length," ",s({id:"settings.systemStatus.missingFiles"}).toLowerCase()]}),e.jsxs("ul",{className:"text-xs text-muted-foreground list-disc list-inside",children:[x.missingFiles.slice(0,4).map(p=>e.jsx("li",{children:p},p)),x.missingFiles.length>4&&e.jsxs("li",{children:["+",x.missingFiles.length-4," more..."]})]}),e.jsxs("div",{className:"bg-muted/50 rounded-md p-2",children:[e.jsxs("p",{className:"text-xs font-medium mb-1",children:[s({id:"settings.systemStatus.runToFix"}),":"]}),e.jsx("code",{className:"text-xs font-mono bg-background px-2 py-1 rounded block",children:"ccw install"})]})]})]})]})}function Ua({cliTools:s,defaultCliTool:t,expandedTools:n,savingTools:r,onToggleExpand:c,onToggleEnabled:d,onSetDefault:x,onUpdateModel:p,onUpdateTags:N,onUpdateAvailableModels:f,onUpdateEnvFile:F,onUpdateSettingsFile:w,onUpdateEffort:P,onSaveToBackend:u,formatMessage:v}){const{data:k}=$t();return e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[v({id:"settings.cliTools.description"})," ",e.jsx("strong",{className:"text-foreground",children:t})]}),e.jsx("div",{className:"space-y-3",children:Object.entries(s).map(([h,$])=>{const C=k==null?void 0:k[h];return e.jsx(Ea,{toolId:h,config:$,isDefault:h===t,isExpanded:n.has(h),toolAvailable:C==null?void 0:C.available,isSaving:r.has(h),onToggleExpand:()=>c(h),onToggleEnabled:()=>d(h),onSetDefault:()=>x(h),onUpdateModel:(M,O)=>p(h,M,O),onUpdateTags:M=>N(h,M),onUpdateAvailableModels:M=>f(h,M),onUpdateEnvFile:M=>F(h,M),onUpdateSettingsFile:M=>w(h,M),onUpdateEffort:M=>P(h,M),onSaveToBackend:()=>u(h)},h)})})]})}function Ya(){const{formatMessage:s}=X(),{theme:t,setTheme:n}=Re(),r=Te(it),c=Te(lt),d=Te(ot),{updateCliTool:x,setDefaultCliTool:p,setUserPreferences:N,resetUserPreferences:f}=Te(),[F,w]=i.useState(new Set),[P,u]=i.useState(new Set),v=l=>{w(g=>{const m=new Set(g);return m.has(l)?m.delete(l):m.add(l),m})},k=l=>{x(l,{enabled:!r[l].enabled})},h=l=>{p(l)},$=(l,g,m)=>{x(l,{[g]:m})},C=(l,g)=>{x(l,{tags:g})},M=(l,g)=>{x(l,{availableModels:g})},O=(l,g)=>{x(l,{envFile:g})},K=i.useCallback(async(l,g)=>{var m,E;if(x(l,{settingsFile:g}),g&&gs.has(l))try{const B=ss(),G={"Content-Type":"application/json"};B&&(G["X-CSRF-Token"]=B);const q=await fetch("/api/cli/parse-settings",{method:"POST",headers:G,body:JSON.stringify({path:g}),credentials:"same-origin"});if(q.ok){const _=await q.json();if(_.primaryModel||_.secondaryModel||(m=_.availableModels)!=null&&m.length){const ee={};_.primaryModel&&(ee.primaryModel=_.primaryModel),_.secondaryModel&&(ee.secondaryModel=_.secondaryModel),(E=_.availableModels)!=null&&E.length&&(ee.availableModels=_.availableModels),x(l,ee),H.success(`Models loaded from settings: ${_.primaryModel||"default"}`,{duration:3e3})}}}catch{}},[x]),A=(l,g)=>{x(l,{effort:g})},b=i.useCallback(async l=>{const g=r[l];if(g){u(m=>new Set(m).add(l));try{const m={enabled:g.enabled,primaryModel:g.primaryModel,secondaryModel:g.secondaryModel,tags:g.tags,availableModels:g.availableModels},E=fs(l);E==="envFile"?m.envFile=g.envFile||null:E==="settingsFile"&&(m.settingsFile=g.settingsFile||null,m.effort=g.effort||null);const B=ss(),G={"Content-Type":"application/json"};B&&(G["X-CSRF-Token"]=B);const q=await fetch(`/api/cli/config/${l}`,{method:"PUT",headers:G,body:JSON.stringify(m),credentials:"same-origin"});if(!q.ok)throw new Error(`HTTP ${q.status}`);H.success(s({id:"settings.cliTools.configSaved"}),{description:l})}catch{H.error(s({id:"settings.cliTools.configSaveError"}),{description:l})}finally{u(m=>{const E=new Set(m);return E.delete(l),E})}}},[r,s]),y=(l,g)=>{N({[l]:g})};return e.jsxs("div",{className:"max-w-4xl mx-auto space-y-8",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(ct,{className:"w-6 h-6 text-primary"}),s({id:"settings.title"})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:s({id:"settings.description"})})]}),e.jsxs(Q,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(dt,{className:"w-5 h-5"}),s({id:"settings.sections.appearance"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground mb-1",children:s({id:"settings.appearance.theme"})}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s({id:"settings.appearance.description"})}),e.jsx(ia,{})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.appearance.systemFollow"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.appearance.systemFollowDesc"})})]}),e.jsx(j,{variant:t==="system"?"default":"outline",size:"sm",onClick:()=>n("system"),children:s({id:"settings.appearance.themeOptions.system"})})]})]})]}),e.jsxs(Q,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(ls,{className:"w-5 h-5"}),s({id:"settings.sections.language"})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.language.displayLanguage"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.language.chooseLanguage"})})]}),e.jsx(oa,{})]})})]}),e.jsx(Fa,{}),e.jsx(va,{}),e.jsx(Da,{}),e.jsx(Pa,{}),e.jsxs(Q,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(rs,{className:"w-5 h-5"}),s({id:"settings.sections.cliTools"})]}),e.jsx(Ua,{cliTools:r,defaultCliTool:c,expandedTools:F,savingTools:P,onToggleExpand:v,onToggleEnabled:k,onSetDefault:h,onUpdateModel:$,onUpdateTags:C,onUpdateAvailableModels:M,onUpdateEnvFile:O,onUpdateSettingsFile:K,onUpdateEffort:A,onSaveToBackend:b,formatMessage:s})]}),e.jsx(Ta,{}),e.jsxs(Q,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(ue,{className:"w-5 h-5"}),s({id:"settings.dataRefresh.title"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.dataRefresh.autoRefresh"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.dataRefresh.autoRefreshDesc"})})]}),e.jsx(j,{variant:d.autoRefresh?"default":"outline",size:"sm",onClick:()=>y("autoRefresh",!d.autoRefresh),children:d.autoRefresh?s({id:"settings.dataRefresh.enabled"}):s({id:"settings.dataRefresh.disabled"})})]}),d.autoRefresh&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.dataRefresh.refreshInterval"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.dataRefresh.refreshIntervalDesc"})})]}),e.jsx("div",{className:"flex gap-2",children:[15e3,3e4,6e4,12e4].map(l=>e.jsxs(j,{variant:d.refreshInterval===l?"default":"outline",size:"sm",onClick:()=>y("refreshInterval",l),children:[l/1e3,"s"]},l))})]})]})]}),e.jsxs(Q,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx($e,{className:"w-5 h-5"}),s({id:"settings.notifications.title"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.notifications.enableNotifications"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.notifications.enableNotificationsDesc"})})]}),e.jsx(j,{variant:d.notificationsEnabled?"default":"outline",size:"sm",onClick:()=>y("notificationsEnabled",!d.notificationsEnabled),children:d.notificationsEnabled?s({id:"settings.dataRefresh.enabled"}):s({id:"settings.dataRefresh.disabled"})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s({id:"settings.notifications.soundEffects"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s({id:"settings.notifications.soundEffectsDesc"})})]}),e.jsx(j,{variant:d.soundEnabled?"default":"outline",size:"sm",onClick:()=>y("soundEnabled",!d.soundEnabled),children:d.soundEnabled?s({id:"settings.notifications.on"}):s({id:"settings.notifications.off"})})]})]})]}),e.jsx(ba,{}),e.jsxs(Q,{className:"p-6 border-destructive/50",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(Ye,{className:"w-5 h-5"}),s({id:"common.actions.reset"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s({id:"settings.reset.description"})}),e.jsxs(j,{variant:"destructive",onClick:()=>{confirm(s({id:"settings.reset.confirm"}))&&f()},children:[e.jsx(Ye,{className:"w-4 h-4 mr-2"}),s({id:"common.actions.resetToDefaults"})]})]})]})}export{Ya as SettingsPage,Ya as default};
|
|
150
|
+
//# sourceMappingURL=SettingsPage-B2PYzSoO.js.map
|