@kaitranntt/ccs 7.55.0 → 7.56.0-dev.2
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/README.md +15 -3
- package/dist/api/services/cliproxy-profile-bridge.d.ts +13 -0
- package/dist/api/services/cliproxy-profile-bridge.d.ts.map +1 -0
- package/dist/api/services/cliproxy-profile-bridge.js +147 -0
- package/dist/api/services/cliproxy-profile-bridge.js.map +1 -0
- package/dist/api/services/index.d.ts +3 -1
- package/dist/api/services/index.d.ts.map +1 -1
- package/dist/api/services/index.js +9 -1
- package/dist/api/services/index.js.map +1 -1
- package/dist/api/services/profile-lifecycle-service.d.ts.map +1 -1
- package/dist/api/services/profile-lifecycle-service.js +10 -10
- package/dist/api/services/profile-lifecycle-service.js.map +1 -1
- package/dist/api/services/profile-reader.d.ts.map +1 -1
- package/dist/api/services/profile-reader.js +37 -14
- package/dist/api/services/profile-reader.js.map +1 -1
- package/dist/api/services/profile-types.d.ts +35 -0
- package/dist/api/services/profile-types.d.ts.map +1 -1
- package/dist/api/services/profile-writer.d.ts +7 -1
- package/dist/api/services/profile-writer.d.ts.map +1 -1
- package/dist/api/services/profile-writer.js +77 -37
- package/dist/api/services/profile-writer.js.map +1 -1
- package/dist/auth/commands/create-command.js +1 -1
- package/dist/auth/commands/create-command.js.map +1 -1
- package/dist/auth/commands/remove-command.js +1 -1
- package/dist/auth/commands/remove-command.js.map +1 -1
- package/dist/auth/profile-registry.d.ts.map +1 -1
- package/dist/auth/profile-registry.js +46 -48
- package/dist/auth/profile-registry.js.map +1 -1
- package/dist/cliproxy/account-manager.d.ts +1 -1
- package/dist/cliproxy/account-manager.d.ts.map +1 -1
- package/dist/cliproxy/account-manager.js +4 -1
- package/dist/cliproxy/account-manager.js.map +1 -1
- package/dist/cliproxy/accounts/index.d.ts +1 -1
- package/dist/cliproxy/accounts/index.d.ts.map +1 -1
- package/dist/cliproxy/accounts/index.js +4 -1
- package/dist/cliproxy/accounts/index.js.map +1 -1
- package/dist/cliproxy/accounts/query.d.ts.map +1 -1
- package/dist/cliproxy/accounts/query.js +4 -6
- package/dist/cliproxy/accounts/query.js.map +1 -1
- package/dist/cliproxy/accounts/registry.d.ts +2 -2
- package/dist/cliproxy/accounts/registry.d.ts.map +1 -1
- package/dist/cliproxy/accounts/registry.js +292 -320
- package/dist/cliproxy/accounts/registry.js.map +1 -1
- package/dist/cliproxy/accounts/token-file-ops.d.ts +16 -1
- package/dist/cliproxy/accounts/token-file-ops.d.ts.map +1 -1
- package/dist/cliproxy/accounts/token-file-ops.js +55 -3
- package/dist/cliproxy/accounts/token-file-ops.js.map +1 -1
- package/dist/cliproxy/ai-providers/config-store.d.ts +19 -0
- package/dist/cliproxy/ai-providers/config-store.d.ts.map +1 -0
- package/dist/cliproxy/ai-providers/config-store.js +150 -0
- package/dist/cliproxy/ai-providers/config-store.js.map +1 -0
- package/dist/cliproxy/ai-providers/config-yaml-sections.d.ts +2 -0
- package/dist/cliproxy/ai-providers/config-yaml-sections.d.ts.map +1 -0
- package/dist/cliproxy/ai-providers/config-yaml-sections.js +43 -0
- package/dist/cliproxy/ai-providers/config-yaml-sections.js.map +1 -0
- package/dist/cliproxy/ai-providers/index.d.ts +4 -0
- package/dist/cliproxy/ai-providers/index.d.ts.map +1 -0
- package/dist/cliproxy/ai-providers/index.js +12 -0
- package/dist/cliproxy/ai-providers/index.js.map +1 -0
- package/dist/cliproxy/ai-providers/service.d.ts +6 -0
- package/dist/cliproxy/ai-providers/service.d.ts.map +1 -0
- package/dist/cliproxy/ai-providers/service.js +220 -0
- package/dist/cliproxy/ai-providers/service.js.map +1 -0
- package/dist/cliproxy/ai-providers/types.d.ts +99 -0
- package/dist/cliproxy/ai-providers/types.d.ts.map +1 -0
- package/dist/cliproxy/ai-providers/types.js +53 -0
- package/dist/cliproxy/ai-providers/types.js.map +1 -0
- package/dist/cliproxy/auth/oauth-handler.d.ts +1 -0
- package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.js +31 -69
- package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
- package/dist/cliproxy/auth/oauth-process.d.ts +1 -0
- package/dist/cliproxy/auth/oauth-process.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-process.js +5 -5
- package/dist/cliproxy/auth/oauth-process.js.map +1 -1
- package/dist/cliproxy/auth/token-manager.d.ts +1 -1
- package/dist/cliproxy/auth/token-manager.d.ts.map +1 -1
- package/dist/cliproxy/auth/token-manager.js +53 -20
- package/dist/cliproxy/auth/token-manager.js.map +1 -1
- package/dist/cliproxy/auth-token-manager.d.ts.map +1 -1
- package/dist/cliproxy/auth-token-manager.js +47 -50
- package/dist/cliproxy/auth-token-manager.js.map +1 -1
- package/dist/cliproxy/base-config-loader.d.ts +1 -1
- package/dist/cliproxy/base-config-loader.d.ts.map +1 -1
- package/dist/cliproxy/codex-plan-compatibility.d.ts +19 -0
- package/dist/cliproxy/codex-plan-compatibility.d.ts.map +1 -1
- package/dist/cliproxy/codex-plan-compatibility.js +62 -1
- package/dist/cliproxy/codex-plan-compatibility.js.map +1 -1
- package/dist/cliproxy/codex-reasoning-proxy.d.ts +5 -0
- package/dist/cliproxy/codex-reasoning-proxy.d.ts.map +1 -1
- package/dist/cliproxy/codex-reasoning-proxy.js +103 -20
- package/dist/cliproxy/codex-reasoning-proxy.js.map +1 -1
- package/dist/cliproxy/composite-validator.d.ts.map +1 -1
- package/dist/cliproxy/composite-validator.js.map +1 -1
- package/dist/cliproxy/config/env-builder.d.ts +2 -2
- package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
- package/dist/cliproxy/config/extended-context-config.d.ts +1 -1
- package/dist/cliproxy/config/extended-context-config.d.ts.map +1 -1
- package/dist/cliproxy/config/generator.d.ts +1 -1
- package/dist/cliproxy/config/generator.d.ts.map +1 -1
- package/dist/cliproxy/config/path-resolver.d.ts +1 -1
- package/dist/cliproxy/config/path-resolver.d.ts.map +1 -1
- package/dist/cliproxy/config/thinking-config.d.ts +2 -2
- package/dist/cliproxy/config/thinking-config.d.ts.map +1 -1
- package/dist/cliproxy/config/thinking-config.js.map +1 -1
- package/dist/cliproxy/executor/index.js +1 -1
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/index.d.ts +2 -0
- package/dist/cliproxy/index.d.ts.map +1 -1
- package/dist/cliproxy/index.js +9 -2
- package/dist/cliproxy/index.js.map +1 -1
- package/dist/cliproxy/management-api-client.d.ts +9 -0
- package/dist/cliproxy/management-api-client.d.ts.map +1 -1
- package/dist/cliproxy/management-api-client.js +16 -3
- package/dist/cliproxy/management-api-client.js.map +1 -1
- package/dist/cliproxy/model-catalog.d.ts +1 -1
- package/dist/cliproxy/model-catalog.d.ts.map +1 -1
- package/dist/cliproxy/model-id-normalizer.d.ts +1 -1
- package/dist/cliproxy/model-id-normalizer.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-config-adapter.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-config-adapter.js +43 -39
- package/dist/cliproxy/services/variant-config-adapter.js.map +1 -1
- package/dist/cliproxy/thinking-validator.d.ts +1 -1
- package/dist/cliproxy/thinking-validator.d.ts.map +1 -1
- package/dist/cliproxy/thinking-validator.js.map +1 -1
- package/dist/cliproxy/types.d.ts +22 -0
- package/dist/cliproxy/types.d.ts.map +1 -1
- package/dist/commands/api-command/create-command.d.ts.map +1 -1
- package/dist/commands/api-command/create-command.js +89 -0
- package/dist/commands/api-command/create-command.js.map +1 -1
- package/dist/commands/api-command/help.d.ts.map +1 -1
- package/dist/commands/api-command/help.js +6 -0
- package/dist/commands/api-command/help.js.map +1 -1
- package/dist/commands/api-command/shared.d.ts +2 -1
- package/dist/commands/api-command/shared.d.ts.map +1 -1
- package/dist/commands/api-command/shared.js +6 -0
- package/dist/commands/api-command/shared.js.map +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts +0 -5
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js +6 -16
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/resolve-lifecycle-port.d.ts +6 -0
- package/dist/commands/cliproxy/resolve-lifecycle-port.d.ts.map +1 -0
- package/dist/commands/cliproxy/resolve-lifecycle-port.js +15 -0
- package/dist/commands/cliproxy/resolve-lifecycle-port.js.map +1 -0
- package/dist/commands/config-auth/disable-command.d.ts.map +1 -1
- package/dist/commands/config-auth/disable-command.js +8 -8
- package/dist/commands/config-auth/disable-command.js.map +1 -1
- package/dist/commands/config-auth/setup-command.d.ts.map +1 -1
- package/dist/commands/config-auth/setup-command.js +9 -11
- package/dist/commands/config-auth/setup-command.js.map +1 -1
- package/dist/commands/config-dashboard-host.js +2 -2
- package/dist/commands/config-dashboard-host.js.map +1 -1
- package/dist/commands/copilot-command.js +11 -11
- package/dist/commands/copilot-command.js.map +1 -1
- package/dist/commands/cursor-command.d.ts.map +1 -1
- package/dist/commands/cursor-command.js +11 -11
- package/dist/commands/cursor-command.js.map +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +5 -1
- package/dist/commands/help-command.js.map +1 -1
- package/dist/commands/setup-command.d.ts.map +1 -1
- package/dist/commands/setup-command.js +4 -3
- package/dist/commands/setup-command.js.map +1 -1
- package/dist/config/unified-config-loader.d.ts +2 -2
- package/dist/config/unified-config-loader.d.ts.map +1 -1
- package/dist/config/unified-config-loader.js +39 -32
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/management/instance-manager.d.ts +2 -1
- package/dist/management/instance-manager.d.ts.map +1 -1
- package/dist/management/instance-manager.js +23 -9
- package/dist/management/instance-manager.js.map +1 -1
- package/dist/management/profile-context-sync-lock.d.ts +3 -0
- package/dist/management/profile-context-sync-lock.d.ts.map +1 -1
- package/dist/management/profile-context-sync-lock.js +75 -3
- package/dist/management/profile-context-sync-lock.js.map +1 -1
- package/dist/management/shared-manager.d.ts +21 -8
- package/dist/management/shared-manager.d.ts.map +1 -1
- package/dist/management/shared-manager.js +353 -24
- package/dist/management/shared-manager.js.map +1 -1
- package/dist/shared/claude-extension-setup.js +2 -2
- package/dist/shared/claude-extension-setup.js.map +1 -1
- package/dist/types/cli.d.ts +10 -9
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/cli.js +8 -9
- package/dist/types/cli.js.map +1 -1
- package/dist/types/utils.d.ts +7 -6
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/utils.js +6 -7
- package/dist/types/utils.js.map +1 -1
- package/dist/ui/assets/{accounts-CjGyCl_8.js → accounts-BikRyqcT.js} +1 -1
- package/dist/ui/assets/{alert-dialog-cy99V8EM.js → alert-dialog-CwEJfEUX.js} +1 -1
- package/dist/ui/assets/antigravity-responsibility-constants-Bvh4Ybz0.js +1 -0
- package/dist/ui/assets/api-BYSEdQYh.js +4 -0
- package/dist/ui/assets/{auth-section-DsDyGmzl.js → auth-section-CrFrby6w.js} +1 -1
- package/dist/ui/assets/{backups-section-B63xrUmB.js → backups-section-CdMvSnSm.js} +1 -1
- package/dist/ui/assets/{checkbox-AxZFvatO.js → checkbox-CC0rU-9-.js} +1 -1
- package/dist/ui/assets/{claude-extension-N0lxo7BY.js → claude-extension-CzGeZYz8.js} +1 -1
- package/dist/ui/assets/cliproxy-BSNSGNOv.js +3 -0
- package/dist/ui/assets/cliproxy-ai-providers-D-U6NKfV.js +21 -0
- package/dist/ui/assets/cliproxy-control-panel-BCexyz40.js +1 -0
- package/dist/ui/assets/{confirm-dialog-D2bDFGvT.js → confirm-dialog-Bee0kh6i.js} +1 -1
- package/dist/ui/assets/{copilot-INm6uOZF.js → copilot-BZRAvPLD.js} +1 -1
- package/dist/ui/assets/{cursor-C8rDHKEp.js → cursor-CO2rCNKC.js} +1 -1
- package/dist/ui/assets/{droid-OZDvbiwC.js → droid-CcKqoQtO.js} +2 -2
- package/dist/ui/assets/{globalenv-section-ClTBgKg5.js → globalenv-section-CBRvmZbS.js} +1 -1
- package/dist/ui/assets/{health-CGaRANip.js → health-DgrTQESI.js} +1 -1
- package/dist/ui/assets/icons-DR-ORtNe.js +1 -0
- package/dist/ui/assets/{index-DS1QEaxk.js → index-BOhcsuQK.js} +1 -1
- package/dist/ui/assets/{index-CGOZU3jq.js → index-CursmDny.js} +1 -1
- package/dist/ui/assets/{index-CCSdUs7x.js → index-D90gSn57.js} +1 -1
- package/dist/ui/assets/{index-DQ4jn6yA.js → index-DJCPwAoe.js} +1 -1
- package/dist/ui/assets/index-kGiBvBM-.css +1 -0
- package/dist/ui/assets/index-sCtK1kDn.js +47 -0
- package/dist/ui/assets/providers/codex-color.svg +24 -0
- package/dist/ui/assets/providers/vertex.svg +25 -0
- package/dist/ui/assets/proxy-status-widget-C8cOlsqE.js +1 -0
- package/dist/ui/assets/{searchable-select-D6dcPTiL.js → searchable-select-CF22qEzz.js} +1 -1
- package/dist/ui/assets/{separator-Czy9IRpl.js → separator-CAoIlNuN.js} +1 -1
- package/dist/ui/assets/{shared-BUJNJgAr.js → shared-zeFjETE6.js} +1 -1
- package/dist/ui/assets/{switch-Bog43RUy.js → switch-BeqpDfK5.js} +1 -1
- package/dist/ui/assets/{updates-jcWPnn9L.js → updates-By9S46EJ.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/utils/claude-config-path.d.ts.map +1 -1
- package/dist/utils/claude-config-path.js +2 -5
- package/dist/utils/claude-config-path.js.map +1 -1
- package/dist/utils/config-manager.d.ts +7 -1
- package/dist/utils/config-manager.d.ts.map +1 -1
- package/dist/utils/config-manager.js +30 -1
- package/dist/utils/config-manager.js.map +1 -1
- package/dist/utils/shell-executor.js +1 -1
- package/dist/utils/shell-executor.js.map +1 -1
- package/dist/web-server/health-service.d.ts.map +1 -1
- package/dist/web-server/health-service.js +2 -3
- package/dist/web-server/health-service.js.map +1 -1
- package/dist/web-server/middleware/auth-middleware.d.ts +2 -0
- package/dist/web-server/middleware/auth-middleware.d.ts.map +1 -1
- package/dist/web-server/middleware/auth-middleware.js +23 -1
- package/dist/web-server/middleware/auth-middleware.js.map +1 -1
- package/dist/web-server/routes/account-routes.d.ts.map +1 -1
- package/dist/web-server/routes/account-routes.js +26 -6
- package/dist/web-server/routes/account-routes.js.map +1 -1
- package/dist/web-server/routes/ai-provider-routes.d.ts +3 -0
- package/dist/web-server/routes/ai-provider-routes.d.ts.map +1 -0
- package/dist/web-server/routes/ai-provider-routes.js +118 -0
- package/dist/web-server/routes/ai-provider-routes.js.map +1 -0
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts +7 -0
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +119 -32
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.js +6 -0
- package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-sync-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-sync-routes.js +6 -11
- package/dist/web-server/routes/cliproxy-sync-routes.js.map +1 -1
- package/dist/web-server/routes/cursor-settings-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cursor-settings-routes.js +36 -33
- package/dist/web-server/routes/cursor-settings-routes.js.map +1 -1
- package/dist/web-server/routes/index.d.ts.map +1 -1
- package/dist/web-server/routes/index.js +2 -0
- package/dist/web-server/routes/index.js.map +1 -1
- package/dist/web-server/routes/misc-routes.d.ts.map +1 -1
- package/dist/web-server/routes/misc-routes.js +26 -19
- package/dist/web-server/routes/misc-routes.js.map +1 -1
- package/dist/web-server/routes/profile-routes.d.ts.map +1 -1
- package/dist/web-server/routes/profile-routes.js +45 -0
- package/dist/web-server/routes/profile-routes.js.map +1 -1
- package/dist/web-server/routes/proxy-routes.d.ts.map +1 -1
- package/dist/web-server/routes/proxy-routes.js +6 -0
- package/dist/web-server/routes/proxy-routes.js.map +1 -1
- package/dist/web-server/routes/settings-routes.d.ts.map +1 -1
- package/dist/web-server/routes/settings-routes.js +146 -109
- package/dist/web-server/routes/settings-routes.js.map +1 -1
- package/dist/web-server/routes/websearch-routes.d.ts.map +1 -1
- package/dist/web-server/routes/websearch-routes.js +31 -43
- package/dist/web-server/routes/websearch-routes.js.map +1 -1
- package/dist/web-server/shared-routes.d.ts.map +1 -1
- package/dist/web-server/shared-routes.js +6 -0
- package/dist/web-server/shared-routes.js.map +1 -1
- package/package.json +2 -2
- package/scripts/dev-release.sh +103 -51
- package/dist/ui/assets/api-DKrhDjiy.js +0 -4
- package/dist/ui/assets/cliproxy-D2ozaUJ3.js +0 -3
- package/dist/ui/assets/cliproxy-control-panel-5fYLcZKs.js +0 -1
- package/dist/ui/assets/icons-DtwH984l.js +0 -1
- package/dist/ui/assets/index-ClEn7Y7g.css +0 -1
- package/dist/ui/assets/index-tMnuUCFi.js +0 -47
- package/dist/ui/assets/proxy-status-widget-PESjh9-t.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as d}from"./react-vendor-CNOkPC89.js";const M=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,c,o)=>o?o.toUpperCase():c.toLowerCase()),s=t=>{const e=_(t);return e.charAt(0).toUpperCase()+e.slice(1)},k=(...t)=>t.filter((e,c,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===c).join(" ").trim(),v=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var x={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const m=d.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:y="",children:h,iconNode:r,...n},p)=>d.createElement("svg",{ref:p,...x,width:e,height:e,stroke:t,strokeWidth:o?Number(c)*24/Number(e):c,className:k("lucide",y),...!h&&!v(n)&&{"aria-hidden":"true"},...n},[...r.map(([i,l])=>d.createElement(i,l)),...Array.isArray(h)?h:[h]]));const a=(t,e)=>{const c=d.forwardRef(({className:o,...y},h)=>d.createElement(m,{ref:h,iconNode:e,className:k(`lucide-${M(s(t))}`,`lucide-${t}`,o),...y}));return c.displayName=s(t),c};const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],R0=a("activity",g);const f=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],B0=a("archive",f);const w=[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]],F0=a("arrow-down-left",w);const N=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],U0=a("arrow-down-right",N);const $=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],D0=a("arrow-down",$);const u=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],E0=a("arrow-left",u);const z=[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]],W0=a("arrow-right-left",z);const b=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],O0=a("arrow-right",b);const q=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],G0=a("arrow-up-right",q);const C=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],T0=a("arrow-up",C);const A=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Z0=a("book-open",A);const j=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],I0=a("bot",j);const H=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],K0=a("box",H);const V=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]],X0=a("brain-circuit",V);const L=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Q0=a("brain",L);const S=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],J0=a("bug",S);const P=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],Y0=a("calendar-clock",P);const R=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],a2=a("calendar",R);const B=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],e2=a("chart-column",B);const F=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],t2=a("chart-pie",F);const U=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],c2=a("check-check",U);const D=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],o2=a("check",D);const E=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],h2=a("chevron-down",E);const W=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],d2=a("chevron-left",W);const O=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],y2=a("chevron-right",O);const G=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],n2=a("chevron-up",G);const T=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],s2=a("chevrons-up-down",T);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],k2=a("circle-alert",Z);const I=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],r2=a("circle-check-big",I);const K=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],p2=a("circle-check",K);const X=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],i2=a("circle-question-mark",X);const Q=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],l2=a("circle-x",Q);const J=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],M2=a("circle",J);const Y=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],_2=a("clock",Y);const a1=[["path",{d:"m10.852 19.772-.383.924",key:"r7sl7d"}],["path",{d:"m13.148 14.228.383-.923",key:"1d5zpm"}],["path",{d:"M13.148 19.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1ydik7"}],["path",{d:"m13.53 20.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1m1vsf"}],["path",{d:"m14.772 15.852.923-.383",key:"660p6e"}],["path",{d:"m14.772 18.148.923.383",key:"hrcpis"}],["path",{d:"M4.2 15.1a7 7 0 1 1 9.93-9.858A7 7 0 0 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2",key:"j2q98n"}],["path",{d:"m9.228 15.852-.923-.383",key:"1p9ong"}],["path",{d:"m9.228 18.148-.923.383",key:"6558rz"}]],v2=a("cloud-cog",a1);const e1=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],x2=a("cloud",e1);const t1=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],m2=a("code-xml",t1);const c1=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],g2=a("code",c1);const o1=[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]],f2=a("coins",o1);const h1=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],w2=a("copy",h1);const d1=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],N2=a("cpu",d1);const y1=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],$2=a("database",y1);const n1=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],u2=a("dollar-sign",n1);const s1=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],z2=a("download",s1);const k1=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],b2=a("ellipsis",k1);const r1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],q2=a("external-link",r1);const p1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],C2=a("eye-off",p1);const i1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],A2=a("eye",i1);const l1=[["path",{d:"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"14cnrg"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1",key:"sr0ebq"}],["path",{d:"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1",key:"w793db"}]],j2=a("file-braces-corner",l1);const M1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],H2=a("file-braces",M1);const _1=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],V2=a("file-code-corner",_1);const v1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],L2=a("file-code",v1);const x1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],S2=a("file-down",x1);const m1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],P2=a("file-exclamation-point",m1);const g1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],R2=a("file-text",g1);const f1=[["path",{d:"M10 10.5 8 13l2 2.5",key:"m4t9c1"}],["path",{d:"m14 10.5 2 2.5-2 2.5",key:"14w2eb"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z",key:"1u1bxd"}]],B2=a("folder-code",f1);const w1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],F2=a("folder-open",w1);const N1=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],U2=a("folder",N1);const $1=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],D2=a("gauge",$1);const u1=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],E2=a("git-branch",u1);const z1=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],W2=a("github",z1);const b1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],O2=a("globe",b1);const q1=[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]],G2=a("grip-horizontal",q1);const C1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],T2=a("grip-vertical",C1);const A1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Z2=a("heart",A1);const j1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],I2=a("house",j1);const H1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],K2=a("info",H1);const V1=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],X2=a("key-round",V1);const L1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Q2=a("key",L1);const S1=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],J2=a("laptop",S1);const P1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Y2=a("layers",P1);const R1=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],aa=a("link-2",R1);const B1=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],ea=a("list-filter",B1);const F1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ta=a("loader-circle",F1);const U1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],ca=a("lock",U1);const D1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],oa=a("log-out",D1);const E1=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],ha=a("megaphone",E1);const W1=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],da=a("monitor",W1);const O1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],ya=a("moon",O1);const G1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],na=a("network",G1);const T1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],sa=a("package",T1);const Z1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],ka=a("panel-left",Z1);const I1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],ra=a("pause",I1);const K1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],pa=a("pencil",K1);const X1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],ia=a("play",X1);const Q1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],la=a("plus",Q1);const J1=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Ma=a("power-off",J1);const Y1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],_a=a("power",Y1);const a0=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],va=a("puzzle",a0);const e0=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],xa=a("radio",e0);const t0=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ma=a("refresh-cw",t0);const c0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],ga=a("rotate-ccw",c0);const o0=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],fa=a("rotate-cw",o0);const h0=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],wa=a("route",h0);const d0=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Na=a("save",d0);const y0=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],$a=a("search",y0);const n0=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],ua=a("server",n0);const s0=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],za=a("settings-2",s0);const k0=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ba=a("settings",k0);const r0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],qa=a("shield-alert",r0);const p0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ca=a("shield-check",p0);const i0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Aa=a("shield",i0);const l0=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],ja=a("sliders-horizontal",l0);const M0=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Ha=a("sparkles",M0);const _0=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],Va=a("square-terminal",_0);const v0=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],La=a("square",v0);const x0=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Sa=a("star",x0);const m0=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Pa=a("sun",m0);const g0=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ra=a("terminal",g0);const f0=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Ba=a("trash-2",f0);const w0=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Fa=a("trending-up",w0);const N0=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ua=a("triangle-alert",N0);const $0=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],Da=a("unlink",$0);const u0=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Ea=a("upload",u0);const z0=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Wa=a("user",z0);const b0=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Oa=a("users",b0);const q0=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],Ga=a("wand-sparkles",q0);const C0=[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]],Ta=a("waves",C0);const A0=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Za=a("wifi-off",A0);const j0=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Ia=a("wifi",j0);const H0=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Ka=a("workflow",H0);const V0=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Xa=a("wrench",V0);const L0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Qa=a("x",L0);const S0=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ja=a("zap",S0);export{R2 as $,R0 as A,Z0 as B,y2 as C,T2 as D,C2 as E,F2 as F,D2 as G,I2 as H,ga as I,xa as J,Q2 as K,ta as L,ya as M,N2 as N,K2 as O,ka as P,Ra as Q,ma as R,Va as S,Ua as T,Oa as U,g2 as V,Za as W,Qa as X,G0 as Y,Ja as Z,F0 as _,e2 as a,K0 as a$,P2 as a0,G2 as a1,za as a2,la as a3,Ha as a4,Q0 as a5,ua as a6,B0 as a7,L2 as a8,d2 as a9,E2 as aA,ea as aB,Ka as aC,wa as aD,Ca as aE,j2 as aF,_a as aG,Ma as aH,s2 as aI,V2 as aJ,X0 as aK,U2 as aL,pa as aM,c2 as aN,Da as aO,aa as aP,Ta as aQ,W0 as aR,Y2 as aS,Xa as aT,da as aU,I0 as aV,Y0 as aW,ha as aX,sa as aY,x2 as aZ,J2 as a_,ca as aa,u2 as ab,$2 as ac,U0 as ad,a2 as ae,f2 as af,Fa as ag,t2 as ah,Ba as ai,Na as aj,$a as ak,Ga as al,m2 as am,ja as an,v2 as ao,O0 as ap,Ea as aq,H2 as ar,z2 as as,E0 as at,qa as au,Sa as av,na as aw,B2 as ax,b2 as ay,i2 as az,W2 as b,J0 as b0,S2 as b1,fa as b2,La as b3,D0 as b4,T0 as b5,va as c,ba as d,Pa as e,A2 as f,Ia as g,Aa as h,Z2 as i,r2 as j,M2 as k,o2 as l,X2 as m,w2 as n,q2 as o,Wa as p,oa as q,h2 as r,n2 as s,O2 as t,_2 as u,p2 as v,l2 as w,k2 as x,ia as y,ra as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as f,c as pe}from"./react-vendor-CNOkPC89.js";import{u as M,a as ee,C as p,b as g,S as h,c,P as N,B as I,d as H,e as se,f as ge,g as te,h as je,i as ae,j as y,k as D,l as ye,m as Ne,n as we,o as be}from"./index-tMnuUCFi.js";import{$ as ve,ab as re,ac as z,ad as ne,Y as le,a4 as ke,G as Ce,ae as Se,R as De,Q,U as Le,Z as ie,u as $e,a6 as G,af as Te,N as Fe,C as Re,ag as Me,ah as Pe}from"./icons-DtwH984l.js";import{a as Be,u as P}from"./tanstack-B8i0evp-.js";import{K as $,L as Y,f as k,H as Ae}from"./utils-CzKF5WmX.js";import{R as oe,A as Ue,C as qe,X as Ie,Y as V,T as ce,a as Z,P as Oe,b as Ke,c as Ee}from"./charts-BBPXh0Ar.js";import"./notifications-B2HqRBj7.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Ge({data:s,isLoading:t}){const{privacyMode:r}=M(),{t:n}=ee();if(t)return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:[1,2,3,4,5].map(a=>e.jsx(p,{children:e.jsx(g,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:"h-4 w-[100px]"}),e.jsx(h,{className:"h-8 w-[80px]"})]}),e.jsx(h,{className:"h-8 w-8 rounded-lg"})]})})},a))});const l=(s?.tokenBreakdown?.cacheCreation?.cost??0)+(s?.tokenBreakdown?.cacheRead?.cost??0),i=s?.totalCost?Math.round(l/s.totalCost*100):0,x=[{title:n("analyticsSummary.totalTokens"),value:s?.totalTokens??0,icon:ve,format:a=>R(a),color:"text-blue-600",bgColor:"bg-blue-100 dark:bg-blue-900/20",subtitle:n("analyticsSummary.totalTokensSubtitle",{input:R(s?.totalInputTokens??0),output:R(s?.totalOutputTokens??0)})},{title:n("analyticsSummary.totalCost"),value:s?.totalCost??0,icon:re,format:a=>`$${a.toFixed(2)}`,color:"text-green-600",bgColor:"bg-green-100 dark:bg-green-900/20",subtitle:n("analyticsSummary.totalCostSubtitle",{value:s?.averageCostPerDay?.toFixed(2)??"0.00"})},{title:n("analyticsSummary.cacheTokens"),value:s?.totalCacheTokens??0,icon:z,format:a=>R(a),color:"text-cyan-600",bgColor:"bg-cyan-100 dark:bg-cyan-900/20",subtitle:n("analyticsSummary.cacheTokensSubtitle",{cost:l.toFixed(2),percent:i})},{title:n("analyticsSummary.inputCost"),value:s?.tokenBreakdown?.input?.cost??0,icon:ne,format:a=>`$${a.toFixed(2)}`,color:"text-purple-600",bgColor:"bg-purple-100 dark:bg-purple-900/20",subtitle:n("analyticsSummary.tokensSubtitle",{value:R(s?.tokenBreakdown?.input?.tokens??0)})},{title:n("analyticsSummary.outputCost"),value:s?.tokenBreakdown?.output?.cost??0,icon:le,format:a=>`$${a.toFixed(2)}`,color:"text-orange-600",bgColor:"bg-orange-100 dark:bg-orange-900/20",subtitle:n("analyticsSummary.tokensSubtitle",{value:R(s?.tokenBreakdown?.output?.tokens??0)})}];return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:x.map((a,o)=>{const d=a.icon;return e.jsx(p,{className:"hover:shadow-md transition-shadow",children:e.jsx(g,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between space-x-2",children:[e.jsxs("div",{className:"space-y-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground truncate",children:a.title}),e.jsx("p",{className:c("text-xl font-bold truncate",r&&N),children:a.format(a.value)}),a.subtitle&&e.jsx("p",{className:c("text-[10px] text-muted-foreground truncate",r&&N),children:a.subtitle})]}),e.jsx("div",{className:c("p-2 rounded-lg shrink-0",a.bgColor),children:e.jsx(d,{className:c("h-4 w-4",a.color)})})]})})},o)})})}function R(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function We({model:s}){const{privacyMode:t}=M(),r=He(s.ioRatio);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"h-4 w-4 text-primary shrink-0"}),e.jsx("h4",{className:"font-semibold leading-none truncate",title:s.model,children:s.model})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(I,{variant:"secondary",className:"text-[10px] h-5 px-1.5",children:[s.percentage.toFixed(1),"% usage"]}),e.jsxs(I,{variant:r.variant,className:"text-[10px] h-5 px-1.5",children:[s.ioRatio.toFixed(0),":1 I/O"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("p",{className:c("text-lg font-bold",t&&N),children:["$",s.cost.toFixed(2)]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Total Cost"})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsx("p",{className:c("text-lg font-bold",t&&N),children:ze(s.tokens)}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Total Tokens"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:"Token Breakdown"}),e.jsxs("div",{className:c("space-y-1",t&&N),children:[e.jsx(W,{label:"Input",tokens:s.inputTokens,cost:s.costBreakdown.input.cost,color:"#335c67",icon:ne}),e.jsx(W,{label:"Output",tokens:s.outputTokens,cost:s.costBreakdown.output.cost,color:"#fff3b0",icon:le}),e.jsx(W,{label:"Cache Write",tokens:s.cacheCreationTokens,cost:s.costBreakdown.cacheCreation.cost,color:"#e09f3e",icon:z}),e.jsx(W,{label:"Cache Read",tokens:s.cacheReadTokens,cost:s.costBreakdown.cacheRead.cost,color:"#9e2a2b",icon:z})]})]}),e.jsxs("div",{className:"p-2.5 rounded-md border bg-muted/20 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs font-medium",children:"Input/Output Ratio"})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-snug",children:r.description})]})]})}function W({label:s,tokens:t,cost:r,color:n,icon:l}){return t===0?null:e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:"w-1 h-6 rounded-full shrink-0",style:{backgroundColor:n}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium truncate",children:s}),e.jsxs("span",{className:"font-mono text-muted-foreground",children:["$",r.toFixed(3)]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(l,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:_e(t)})]})]})]})}function He(s){return s>=200?{variant:"destructive",description:"Extended thinking or large context loading. Expected for reasoning models."}:s>=50?{variant:"secondary",description:"More input than output. Typical for analysis tasks."}:s>=5?{variant:"outline",description:"Balanced input/output ratio for typical coding tasks."}:{variant:"default",description:"More output than input. Generation-heavy workload."}}function _e(s){return s.toLocaleString()}function ze(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}const Ye="/api";function b(s){const t=s.getFullYear(),r=String(s.getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0");return`${t}${r}${n}`}const T={summary:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/summary?${t}`)},trends:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/daily?${t}`)},hourly:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),L(`/usage/hourly?${t}`)},models:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/models?${t}`)},sessions:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),s?.limit&&t.append("limit",s.limit.toString()),s?.offset&&t.append("offset",s.offset.toString()),L(`/usage/sessions?${t}`)},monthly:(s,t)=>{const r=new URLSearchParams;return s&&r.append("months",s.toString()),t&&r.append("profile",t),L(`/usage/monthly?${r}`)},refresh:async()=>{if(!(await fetch(`${Ye}/usage/refresh`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to refresh usage cache")},status:()=>L("/usage/status"),insights:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/insights?${t}`)}};async function L(s){const r=await fetch(`/api${s}`,{headers:{"Content-Type":"application/json"}});if(!r.ok){const l=await r.json().catch(()=>({error:"Unknown error"}));throw new Error(l.error||r.statusText)}const n=await r.json();return n.data||n}function Qe(s){return P({queryKey:["usage","summary",s],queryFn:()=>T.summary(s),staleTime:60*1e3})}function Ve(s){return P({queryKey:["usage","trends",s],queryFn:()=>T.trends(s),staleTime:60*1e3})}function Ze(s){return P({queryKey:["usage","hourly",s],queryFn:()=>T.hourly(s),staleTime:60*1e3})}function Xe(s){return P({queryKey:["usage","models",s],queryFn:()=>T.models(s),staleTime:60*1e3})}function Je(){const s=Be();return f.useCallback(async()=>{await T.refresh(),await s.invalidateQueries({queryKey:["usage"]})},[s])}function es(){return P({queryKey:["usage","status"],queryFn:()=>T.status(),staleTime:10*1e3,refetchInterval:30*1e3})}function ss(s){return P({queryKey:["usage","sessions",s],queryFn:()=>T.sessions(s),staleTime:60*1e3})}function ts(){const[s,t]=f.useState({from:$(new Date,30),to:new Date}),[r,n]=f.useState(!1),[l,i]=f.useState(null),[x,a]=f.useState(null),[o,d]=f.useState("daily"),u=Je(),m=f.useCallback(async()=>{n(!0);try{await u()}finally{n(!1)}},[u]),j=f.useMemo(()=>({startDate:s?.from,endDate:s?.to}),[s?.from,s?.to]),{data:w,isLoading:v}=Qe(j),{data:C,isLoading:S}=Ve(j),{data:B,isLoading:A}=Ze(j),{data:U,isLoading:q}=Xe(j),{data:_,isLoading:O}=ss({...j,limit:3}),{data:K}=es(),de=f.useCallback(()=>{const F=new Date;t({from:$(F,1),to:F}),d("hourly")},[]),xe=f.useCallback(F=>{t(F),d("daily")},[]),ue=f.useMemo(()=>K?.lastFetch?Y(new Date(K.lastFetch),{addSuffix:!0}):null,[K?.lastFetch]),me=f.useCallback((F,fe)=>{const E=fe.currentTarget.getBoundingClientRect();a({x:E.left+E.width/2,y:E.top+E.height/2}),i(F)},[]),he=f.useCallback(()=>{i(null),a(null)},[]);return{dateRange:s,isRefreshing:r,viewMode:o,selectedModel:l,popoverPosition:x,summary:w,trends:C,hourlyData:B,models:U,sessions:_,status:K,isSummaryLoading:v,isTrendsLoading:S,isHourlyLoading:A,isModelsLoading:q,isSessionsLoading:O,isLoading:v||S||q||O,handleRefresh:m,handleTodayClick:de,handleDateRangeChange:xe,handleModelClick:me,handlePopoverClose:he,lastUpdatedText:ue}}function as({value:s,onChange:t,presets:r=[{label:"Last 7 days",range:{from:$(new Date,7),to:new Date}},{label:"Last 30 days",range:{from:$(new Date,30),to:new Date}},{label:"Last 90 days",range:{from:$(new Date,90),to:new Date}}],className:n}){const[l,i]=pe.useState(!1),x=a=>!s||!s.from||!s.to||!a.from||!a.to?!1:k(s.from,"yyyy-MM-dd")===k(a.from,"yyyy-MM-dd")&&k(s.to,"yyyy-MM-dd")===k(a.to,"yyyy-MM-dd");return e.jsxs("div",{className:c("flex flex-wrap items-center gap-2",n),children:[r.map(a=>e.jsx(H,{variant:x(a.range)?"default":"outline",size:"sm",onClick:()=>t(a.range),children:a.label},a.label)),e.jsxs(se,{open:l,onOpenChange:i,children:[e.jsx(ge,{asChild:!0,children:e.jsxs(H,{id:"date",variant:"outline",className:c("w-auto min-w-[200px] sm:min-w-[240px] justify-start text-left font-normal",!s&&"text-muted-foreground"),children:[e.jsx(Se,{className:"mr-2 h-4 w-4"}),s?.from?s.to?e.jsxs(e.Fragment,{children:[k(s.from,"LLL dd, y")," - ",k(s.to,"LLL dd, y")]}):k(s.from,"LLL dd, y"):e.jsx("span",{children:"Pick a date"})]})}),e.jsx(te,{className:"w-auto p-0",align:"end",children:e.jsx(je,{initialFocus:!0,mode:"range",defaultMonth:s?.from,selected:s,onSelect:t,numberOfMonths:2})})]})]})}function rs({dateRange:s,onDateRangeChange:t,onTodayClick:r,onRefresh:n,isRefreshing:l,lastUpdatedText:i,viewMode:x}){const{t:a}=ee();return e.jsxs("div",{className:"flex flex-col gap-3 shrink-0 xl:flex-row xl:items-center xl:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold",children:a("analytics.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("analytics.subtitle")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 xl:justify-end",children:[e.jsx(H,{variant:x==="hourly"?"default":"outline",size:"sm",className:"h-8",onClick:r,children:"24H"}),e.jsx(as,{className:"flex-wrap",value:s,onChange:t,presets:[{label:"7D",range:{from:$(new Date,7),to:new Date}},{label:"30D",range:{from:$(new Date,30),to:new Date}},{label:a("analytics.month"),range:{from:Ae(new Date),to:new Date}},{label:a("analytics.allTime"),range:{from:void 0,to:new Date}}]}),i&&e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:a("analytics.updated",{value:i})}),e.jsx(H,{variant:"outline",size:"sm",className:"gap-2 h-8",onClick:n,disabled:l,children:e.jsx(De,{className:`w-3.5 h-3.5 ${l?"animate-spin":""}`})})]})]})}function ns({data:s,isLoading:t,granularity:r="daily",className:n}){const{privacyMode:l}=M(),i=f.useMemo(()=>!s||s.length===0?[]:(r==="hourly"?s:[...s].reverse()).map(o=>{const d="hour"in o?o.hour:o.date;return{...o,dateFormatted:ls(d,r),costRounded:Number(o.cost.toFixed(4))}}),[s,r]);if(t)return e.jsx(h,{className:c("h-full w-full",n)});if(!s||s.length===0)return e.jsx("div",{className:c("h-full flex items-center justify-center",n),children:e.jsx("p",{className:"text-muted-foreground",children:r==="hourly"?"No usage data for today":"No usage data available"})});const x=({x:a,y:o,payload:d,isRight:u})=>{const m=u?`$${d.value}`:X(Number(d.value));return e.jsx("text",{x:a,y:o,dy:4,textAnchor:u?"start":"end",fontSize:12,fill:"currentColor",className:c("fill-muted-foreground",l&&"blur-[4px]"),children:m})};return e.jsx("div",{className:c("w-full h-full",n),children:e.jsx(oe,{width:"100%",height:"100%",children:e.jsxs(Ue,{data:i,margin:{top:5,right:30,left:20,bottom:5},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"tokenGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#0080FF",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#0080FF",stopOpacity:.1})]}),e.jsxs("linearGradient",{id:"costGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#00C49F",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#00C49F",stopOpacity:.1})]})]}),e.jsx(qe,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(Ie,{dataKey:"dateFormatted",tick:{fontSize:12},tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(V,{yAxisId:"left",orientation:"left",tick:a=>e.jsx(x,{...a,isRight:!1}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(V,{yAxisId:"right",orientation:"right",tick:a=>e.jsx(x,{...a,isRight:!0}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(ce,{content:({active:a,payload:o,label:d})=>{if(!a||!o||!o.length)return null;const u=o[0].payload;return e.jsxs("div",{className:"rounded-lg border bg-background p-3 shadow-lg",children:[e.jsx("p",{className:"font-medium mb-2",children:d}),o.map((m,j)=>e.jsxs("p",{className:c("text-sm",l&&N),style:{color:m.color},children:[m.name,":"," ",m.name==="Tokens"?X(Number(m.value)||0):`$${m.value}`]},j)),"requests"in u&&e.jsxs("p",{className:c("text-sm text-muted-foreground mt-1",l&&N),children:["Requests: ",u.requests]})]})}}),e.jsx(Z,{yAxisId:"left",type:"monotone",dataKey:"tokens",stroke:"#0080FF",strokeWidth:2,fillOpacity:1,fill:"url(#tokenGradient)",name:"Tokens"}),e.jsx(Z,{yAxisId:"right",type:"monotone",dataKey:"costRounded",stroke:"#00C49F",strokeWidth:2,fillOpacity:1,fill:"url(#costGradient)",name:"Cost"})]})})})}function ls(s,t){if(t==="hourly"){const[n,l]=s.split(" ");if(n&&l){const i=new Date(`${n}T${l}:00Z`);return k(i,"HH:mm")}return s}const r=new Date(s);return t==="monthly"?k(r,"MMM yyyy"):k(r,"MMM dd")}function X(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function is({data:s,isLoading:t,className:r}){const{privacyMode:n}=M(),l=f.useMemo(()=>!s||s.length===0?[]:s.map(a=>({name:a.model,value:a.tokens,cost:a.cost,percentage:a.percentage,fill:ae(a.model)})),[s]);if(t)return e.jsx(h,{className:c("h-full min-h-[100px] w-full",r)});if(!s||s.length===0)return e.jsx("div",{className:c("h-full min-h-[100px] flex items-center justify-center",r),children:e.jsx("p",{className:"text-muted-foreground",children:"No model data available"})});const i=({active:a,payload:o})=>{if(!a||!o)return null;const d=o;if(!d.length)return null;const u=d[0].payload;return e.jsxs("div",{className:"rounded-lg border bg-background p-2 shadow-lg text-xs",children:[e.jsx("p",{className:"font-medium mb-1",children:u.name}),e.jsxs("p",{className:c("text-muted-foreground",n&&N),children:[os(u.value)," (",u.percentage.toFixed(1),"%)"]}),e.jsxs("p",{className:c("text-muted-foreground",n&&N),children:["$",u.cost.toFixed(4)]})]})},x=a=>a.percentage>5?`${a.percentage.toFixed(1)}%`:"";return e.jsx("div",{className:c("w-full h-full min-h-[100px]",r),children:e.jsx(oe,{width:"100%",height:"100%",children:e.jsxs(Oe,{children:[e.jsx(Ke,{data:l,cx:"50%",cy:"50%",labelLine:!1,label:x,innerRadius:50,outerRadius:70,paddingAngle:2,dataKey:"value",children:l.map((a,o)=>e.jsx(Ee,{fill:a.fill,strokeWidth:1},`cell-${o}`))}),e.jsx(ce,{content:i})]})})})}function os(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function cs(s){if(!s)return"";const r=s.replace(/^\/|\/$/g,"").split("/").filter(n=>n.length>0);return r[r.length-1]||""}function ds({data:s,isLoading:t,className:r}){const{privacyMode:n}=M(),l=f.useMemo(()=>{if(!s?.sessions||s.sessions.length===0)return null;const i=s.sessions,x=s.total,a=i.reduce((w,v)=>w+(v.inputTokens+v.outputTokens),0),o=Math.round(a/i.length),u=i.reduce((w,v)=>w+v.cost,0)/i.length,m=i[0],j=m?Y(new Date(m.lastActivity),{addSuffix:!0}):"N/A";return{totalSessions:x,avgTokens:o,avgCost:u,lastActive:j,recentSessions:i.slice(0,3)}},[s]);return t?e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",r),children:[e.jsx(y,{className:"px-3 py-2",children:e.jsx(h,{className:"h-5 w-32"})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx(h,{className:"h-full w-full"})})]}):l?e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 shadow-sm",r),children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Q,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsxs(g,{className:"px-3 pb-3 pt-0 flex-1 min-h-0 flex flex-col gap-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-blue-600 dark:text-blue-400",children:[e.jsx(Le,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xl font-bold",children:l.totalSessions})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:"Total Sessions"})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-green-600 dark:text-green-400",children:[e.jsx(ie,{className:"w-4 h-4"}),e.jsxs("span",{className:c("text-xl font-bold",n&&N),children:["$",l.avgCost.toFixed(2)]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:"Avg Cost/Session"})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground font-medium mb-1",children:[e.jsx($e,{className:"w-3 h-3"}),"Recent Activity"]}),e.jsx("div",{className:"space-y-1.5 max-h-full overflow-y-auto pr-1",children:l.recentSessions.map(i=>e.jsxs("div",{className:"flex items-center justify-between text-xs p-1.5 rounded bg-muted/30 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium truncate",title:i.projectPath,children:cs(i.projectPath)}),(i.target??"claude")!=="claude"&&e.jsx("span",{className:"shrink-0 px-1 py-0 text-[9px] font-medium rounded bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-300 uppercase",children:i.target})]}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:Y(new Date(i.lastActivity),{addSuffix:!0})})]}),e.jsxs("div",{className:c("text-right shrink-0 ml-2",n&&N),children:[e.jsxs("div",{className:"font-mono",children:["$",i.cost.toFixed(2)]}),e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[xs(i.inputTokens+i.outputTokens)," toks"]})]})]},i.sessionId))})]})]})]}):e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",r),children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Q,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"No session data available"})})]})}function xs(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}function us({className:s,isLoading:t}){const{data:r,isLoading:n}=ye(),{data:l,isLoading:i,error:x}=Ne(r?.running);if(t||n||r?.running&&i)return e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",s),children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"CLIProxy Stats"]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(h,{className:"h-4 w-[100px]"}),e.jsx(h,{className:"h-16 w-full"})]})})]});if(!r?.running)return e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 border-dashed",s),children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4 text-muted-foreground"}),"CLIProxy Stats"]}),e.jsx(I,{variant:"secondary",className:"text-[10px] h-5",children:"Offline"})]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Start a CLIProxy session (gemini, codex, agy) to collect stats."})})]});if(x)return e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 border-destructive/50",s),children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsx(I,{variant:"destructive",className:"text-[10px] h-5",children:"Error"})]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx("p",{className:"text-xs text-destructive",children:x.message})})]});const o=l?.totalRequests??0,d=l?.quotaExceededCount??0,u=o-d,m=o>0?Math.round(u/o*100):100,j=l?.tokens?.total??0,w=Object.entries(l?.requestsByModel??{}).sort((C,S)=>S[1]-C[1]).slice(0,4),v=w.length>0?w[0][1]:1;return e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",s),children:[e.jsx(y,{className:"px-3 py-2 border-b bg-muted/5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsxs(I,{variant:"outline",className:"text-[10px] h-5 text-green-600 border-green-200 bg-green-50 dark:bg-green-900/10 dark:border-green-800",children:[e.jsx(ie,{className:"h-3 w-3 mr-0.5"}),"Running"]})]})}),e.jsx(g,{className:"p-0 flex-1 min-h-0",children:e.jsx(we,{className:"h-full",children:e.jsxs("div",{className:"p-3 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"w-10 h-10 -rotate-90",viewBox:"0 0 36 36",children:[e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",className:"text-muted/30"}),e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeDasharray:`${m*.88} 88`,strokeLinecap:"round",className:m>=90?"text-green-500":"text-amber-500"})]}),e.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-[8px] font-bold",children:[m,"%"]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:J(o)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:d>0?`${d} failed`:"All success"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsx("div",{className:"p-1.5 rounded-md bg-purple-100 dark:bg-purple-900/20",children:e.jsx(Te,{className:"h-4 w-4 text-purple-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:J(j)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:"Total tokens"})]})]})]}),w.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-medium text-muted-foreground",children:[e.jsx(Fe,{className:"h-3 w-3"}),"Models Used"]}),e.jsx("div",{className:"space-y-1",children:w.map(([C,S])=>{const B=Math.round(S/v*100),A=ms(C);return e.jsxs("div",{className:"group",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] mb-0.5",children:[e.jsx("span",{className:"truncate font-medium",title:C,children:A}),e.jsx("span",{className:"text-muted-foreground shrink-0 ml-2",children:S})]}),e.jsx("div",{className:"h-1 bg-muted/50 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-accent/70 rounded-full transition-all",style:{width:`${B}%`}})})]},C)})})]})]})})})]})}function J(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function ms(s){let t=s.replace(/^gemini-claude-/,"").replace(/^gemini-/,"").replace(/^claude-/,"").replace(/^anthropic\./,"").replace(/-thinking$/," Thinking");return t=t.split(/[-_]/).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" "),t.length>20&&(t=t.slice(0,18)+"..."),t}function hs(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(0)}K`:s.toString()}function fs({models:s,isLoading:t,onModelClick:r,privacyMode:n}){return e.jsxs(p,{className:"flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 shadow-sm lg:col-span-4",children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(re,{className:"w-4 h-4"}),"Cost by Model"]})}),e.jsx(g,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 overflow-y-auto",children:t?e.jsx(h,{className:"h-full w-full"}):e.jsxs("div",{className:"space-y-0.5",children:[[...s||[]].sort((l,i)=>i.cost-l.cost).map(l=>e.jsxs("button",{className:"group flex items-center text-xs w-full hover:bg-muted/50 rounded px-2 py-1.5 transition-colors cursor-pointer gap-3",onClick:i=>r(l,i),title:"Click for details",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-[180px] shrink-0",children:[e.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:ae(l.model)}}),e.jsx("span",{className:"font-medium truncate group-hover:underline underline-offset-2",children:l.model})]}),e.jsx(ps,{model:l}),e.jsx("span",{className:c("text-[10px] text-muted-foreground w-14 text-right shrink-0",n&&N),children:hs(l.tokens)}),e.jsxs("span",{className:c("font-mono font-medium w-16 text-right shrink-0",n&&N),children:["$",l.cost.toFixed(2)]}),e.jsx(Re,{className:"w-3 h-3 opacity-0 group-hover:opacity-50 transition-opacity shrink-0"})]},l.model)),e.jsx(gs,{})]})})]})}function ps({model:s}){const t={input:"#335c67",output:"#fff3b0",cacheWrite:"#e09f3e",cacheRead:"#9e2a2b"},r=n=>s.cost>0?n/s.cost*100:0;return e.jsx("div",{className:"flex-1 flex items-center gap-1 min-w-0",children:e.jsxs("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden flex",children:[e.jsx("div",{className:"h-full",style:{backgroundColor:t.input,width:`${r(s.costBreakdown.input.cost)}%`},title:`Input: $${s.costBreakdown.input.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.output,width:`${r(s.costBreakdown.output.cost)}%`},title:`Output: $${s.costBreakdown.output.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.cacheWrite,width:`${r(s.costBreakdown.cacheCreation.cost)}%`},title:`Cache Write: $${s.costBreakdown.cacheCreation.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.cacheRead,width:`${r(s.costBreakdown.cacheRead.cost)}%`},title:`Cache Read: $${s.costBreakdown.cacheRead.cost.toFixed(2)}`})]})})}function gs(){const s=[{color:"#335c67",label:"Input"},{color:"#fff3b0",label:"Output",hasBorder:!0},{color:"#e09f3e",label:"Cache Write"},{color:"#9e2a2b",label:"Cache Read"}];return e.jsx("div",{className:"flex items-center gap-3 pt-2 px-2 text-[10px] text-muted-foreground border-t mt-2",children:s.map(({color:t,label:r,hasBorder:n})=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("div",{className:c("w-2 h-2 rounded-full",n&&"border border-muted-foreground/30"),style:{backgroundColor:t}}),r]},r))})}function js({viewMode:s,trends:t,hourlyData:r,models:n,sessions:l,isTrendsLoading:i,isHourlyLoading:x,isModelsLoading:a,isSessionsLoading:o,isSummaryLoading:d,onModelClick:u}){const{privacyMode:m}=M();return e.jsxs("div",{className:"min-h-0 grid gap-4 lg:grid-rows-[minmax(260px,1.2fr)_minmax(220px,0.9fr)]",children:[e.jsxs(p,{className:"flex flex-col h-full min-h-[220px] lg:min-h-[240px] overflow-hidden gap-0 py-0 shadow-sm",children:[e.jsx(y,{className:"px-3 py-2 shrink-0",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Me,{className:"w-4 h-4"}),s==="hourly"?"Last 24 Hours":"Usage Trends"]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1 min-h-0",children:e.jsx(ns,{data:s==="hourly"?r||[]:t||[],isLoading:s==="hourly"?x:i,granularity:s==="hourly"?"hourly":"daily"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-10 gap-4 h-auto min-h-[220px] lg:h-full lg:min-h-[220px] lg:grid-rows-[minmax(0,1fr)] lg:[&>*]:min-h-0",children:[e.jsx(fs,{models:n,isLoading:a,onModelClick:u,privacyMode:m}),e.jsxs(p,{className:"flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 shadow-sm lg:col-span-2",children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Pe,{className:"w-4 h-4"}),"Model Usage"]})}),e.jsx(g,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 flex items-center justify-center",children:e.jsx(is,{data:n||[],isLoading:a,className:"h-full w-full"})})]}),e.jsx(ds,{data:l,isLoading:o,className:"lg:col-span-2"}),e.jsx(us,{isLoading:d,className:"lg:col-span-2"})]})]})}function $s(){return e.jsxs("div",{className:"space-y-4 h-full overflow-hidden",children:[e.jsxs(p,{className:"flex flex-col min-h-[300px]",children:[e.jsx(y,{className:"p-4 pb-2",children:e.jsx(h,{className:"h-4 w-32"})}),e.jsx(g,{className:"p-4 pt-0 flex-1",children:e.jsx(h,{className:"h-full w-full"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs(p,{className:"flex flex-col min-h-[250px]",children:[e.jsx(y,{className:"p-4 pb-2",children:e.jsx(h,{className:"h-4 w-28"})}),e.jsx(g,{className:"p-4 pt-2",children:e.jsx("div",{className:"space-y-3",children:[1,2,3,4,5].map(s=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:"w-2.5 h-2.5 rounded-full"}),e.jsx(h,{className:"h-3 w-24"})]}),e.jsx(h,{className:"h-3 w-16"})]},s))})})]}),e.jsxs(p,{className:"flex flex-col min-h-[250px]",children:[e.jsx(y,{className:"p-4 pb-2",children:e.jsx(h,{className:"h-4 w-28"})}),e.jsx(g,{className:"p-4 pt-0 flex-1",children:e.jsxs("div",{className:"flex w-full h-full items-center",children:[e.jsx("div",{className:"flex-1 flex justify-center",children:e.jsx(h,{className:"h-[180px] w-[180px] rounded-full"})}),e.jsx("div",{className:"w-[140px] shrink-0 pl-2 space-y-2",children:[1,2,3,4].map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:"w-2 h-2 rounded-full"}),e.jsx(h,{className:"h-3 w-20"})]},s))})]})})]})]})]})}function Ts(){const s=f.useRef(null),{dateRange:t,handleDateRangeChange:r,handleTodayClick:n,handleRefresh:l,isRefreshing:i,lastUpdatedText:x,viewMode:a,summary:o,isSummaryLoading:d,trends:u,hourlyData:m,models:j,sessions:w,isTrendsLoading:v,isHourlyLoading:C,isModelsLoading:S,isSessionsLoading:B,handleModelClick:A,selectedModel:U,popoverPosition:q,handlePopoverClose:_}=ts();return e.jsxs("div",{className:"grid h-full min-h-0 grid-rows-[auto_auto_minmax(0,1fr)] gap-4 overflow-y-auto px-4 py-4",children:[e.jsx(rs,{dateRange:t,onDateRangeChange:r,onTodayClick:n,onRefresh:l,isRefreshing:i,lastUpdatedText:x,viewMode:a}),e.jsx(Ge,{data:o,isLoading:d}),e.jsx(js,{viewMode:a,trends:u,hourlyData:m,models:j,sessions:w,isTrendsLoading:v,isHourlyLoading:C,isModelsLoading:S,isSessionsLoading:B,isSummaryLoading:d,onModelClick:A}),e.jsxs(se,{open:!!U,onOpenChange:O=>!O&&_(),children:[e.jsx(be,{asChild:!0,children:e.jsx("div",{ref:s,className:"fixed pointer-events-none",style:{left:q?.x??0,top:q?.y??0,width:1,height:1}})}),e.jsx(te,{className:"w-80 p-3",side:"top",align:"center",children:U&&e.jsx(We,{model:U})})]})]})}export{Ts as AnalyticsPage,$s as AnalyticsSkeleton};
|
|
1
|
+
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as f,c as pe}from"./react-vendor-CNOkPC89.js";import{u as M,a as ee,C as p,b as g,S as h,c,P as N,B as I,d as H,e as se,f as ge,g as te,h as je,i as ae,j as y,k as D,l as ye,m as Ne,n as we,o as be}from"./index-sCtK1kDn.js";import{$ as ve,ab as re,ac as z,ad as ne,Y as le,a4 as ke,G as Ce,ae as Se,R as De,Q,U as Le,Z as ie,u as $e,a6 as G,af as Te,N as Fe,C as Re,ag as Me,ah as Pe}from"./icons-DR-ORtNe.js";import{a as Be,u as P}from"./tanstack-B8i0evp-.js";import{K as $,L as Y,f as k,H as Ae}from"./utils-CzKF5WmX.js";import{R as oe,A as Ue,C as qe,X as Ie,Y as V,T as ce,a as Z,P as Oe,b as Ke,c as Ee}from"./charts-BBPXh0Ar.js";import"./notifications-B2HqRBj7.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Ge({data:s,isLoading:t}){const{privacyMode:r}=M(),{t:n}=ee();if(t)return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:[1,2,3,4,5].map(a=>e.jsx(p,{children:e.jsx(g,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:"h-4 w-[100px]"}),e.jsx(h,{className:"h-8 w-[80px]"})]}),e.jsx(h,{className:"h-8 w-8 rounded-lg"})]})})},a))});const l=(s?.tokenBreakdown?.cacheCreation?.cost??0)+(s?.tokenBreakdown?.cacheRead?.cost??0),i=s?.totalCost?Math.round(l/s.totalCost*100):0,x=[{title:n("analyticsSummary.totalTokens"),value:s?.totalTokens??0,icon:ve,format:a=>R(a),color:"text-blue-600",bgColor:"bg-blue-100 dark:bg-blue-900/20",subtitle:n("analyticsSummary.totalTokensSubtitle",{input:R(s?.totalInputTokens??0),output:R(s?.totalOutputTokens??0)})},{title:n("analyticsSummary.totalCost"),value:s?.totalCost??0,icon:re,format:a=>`$${a.toFixed(2)}`,color:"text-green-600",bgColor:"bg-green-100 dark:bg-green-900/20",subtitle:n("analyticsSummary.totalCostSubtitle",{value:s?.averageCostPerDay?.toFixed(2)??"0.00"})},{title:n("analyticsSummary.cacheTokens"),value:s?.totalCacheTokens??0,icon:z,format:a=>R(a),color:"text-cyan-600",bgColor:"bg-cyan-100 dark:bg-cyan-900/20",subtitle:n("analyticsSummary.cacheTokensSubtitle",{cost:l.toFixed(2),percent:i})},{title:n("analyticsSummary.inputCost"),value:s?.tokenBreakdown?.input?.cost??0,icon:ne,format:a=>`$${a.toFixed(2)}`,color:"text-purple-600",bgColor:"bg-purple-100 dark:bg-purple-900/20",subtitle:n("analyticsSummary.tokensSubtitle",{value:R(s?.tokenBreakdown?.input?.tokens??0)})},{title:n("analyticsSummary.outputCost"),value:s?.tokenBreakdown?.output?.cost??0,icon:le,format:a=>`$${a.toFixed(2)}`,color:"text-orange-600",bgColor:"bg-orange-100 dark:bg-orange-900/20",subtitle:n("analyticsSummary.tokensSubtitle",{value:R(s?.tokenBreakdown?.output?.tokens??0)})}];return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:x.map((a,o)=>{const d=a.icon;return e.jsx(p,{className:"hover:shadow-md transition-shadow",children:e.jsx(g,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between space-x-2",children:[e.jsxs("div",{className:"space-y-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground truncate",children:a.title}),e.jsx("p",{className:c("text-xl font-bold truncate",r&&N),children:a.format(a.value)}),a.subtitle&&e.jsx("p",{className:c("text-[10px] text-muted-foreground truncate",r&&N),children:a.subtitle})]}),e.jsx("div",{className:c("p-2 rounded-lg shrink-0",a.bgColor),children:e.jsx(d,{className:c("h-4 w-4",a.color)})})]})})},o)})})}function R(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function We({model:s}){const{privacyMode:t}=M(),r=He(s.ioRatio);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"h-4 w-4 text-primary shrink-0"}),e.jsx("h4",{className:"font-semibold leading-none truncate",title:s.model,children:s.model})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(I,{variant:"secondary",className:"text-[10px] h-5 px-1.5",children:[s.percentage.toFixed(1),"% usage"]}),e.jsxs(I,{variant:r.variant,className:"text-[10px] h-5 px-1.5",children:[s.ioRatio.toFixed(0),":1 I/O"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("p",{className:c("text-lg font-bold",t&&N),children:["$",s.cost.toFixed(2)]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Total Cost"})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsx("p",{className:c("text-lg font-bold",t&&N),children:ze(s.tokens)}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Total Tokens"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:"Token Breakdown"}),e.jsxs("div",{className:c("space-y-1",t&&N),children:[e.jsx(W,{label:"Input",tokens:s.inputTokens,cost:s.costBreakdown.input.cost,color:"#335c67",icon:ne}),e.jsx(W,{label:"Output",tokens:s.outputTokens,cost:s.costBreakdown.output.cost,color:"#fff3b0",icon:le}),e.jsx(W,{label:"Cache Write",tokens:s.cacheCreationTokens,cost:s.costBreakdown.cacheCreation.cost,color:"#e09f3e",icon:z}),e.jsx(W,{label:"Cache Read",tokens:s.cacheReadTokens,cost:s.costBreakdown.cacheRead.cost,color:"#9e2a2b",icon:z})]})]}),e.jsxs("div",{className:"p-2.5 rounded-md border bg-muted/20 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs font-medium",children:"Input/Output Ratio"})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-snug",children:r.description})]})]})}function W({label:s,tokens:t,cost:r,color:n,icon:l}){return t===0?null:e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:"w-1 h-6 rounded-full shrink-0",style:{backgroundColor:n}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium truncate",children:s}),e.jsxs("span",{className:"font-mono text-muted-foreground",children:["$",r.toFixed(3)]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(l,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:_e(t)})]})]})]})}function He(s){return s>=200?{variant:"destructive",description:"Extended thinking or large context loading. Expected for reasoning models."}:s>=50?{variant:"secondary",description:"More input than output. Typical for analysis tasks."}:s>=5?{variant:"outline",description:"Balanced input/output ratio for typical coding tasks."}:{variant:"default",description:"More output than input. Generation-heavy workload."}}function _e(s){return s.toLocaleString()}function ze(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}const Ye="/api";function b(s){const t=s.getFullYear(),r=String(s.getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0");return`${t}${r}${n}`}const T={summary:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/summary?${t}`)},trends:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/daily?${t}`)},hourly:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),L(`/usage/hourly?${t}`)},models:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/models?${t}`)},sessions:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),s?.limit&&t.append("limit",s.limit.toString()),s?.offset&&t.append("offset",s.offset.toString()),L(`/usage/sessions?${t}`)},monthly:(s,t)=>{const r=new URLSearchParams;return s&&r.append("months",s.toString()),t&&r.append("profile",t),L(`/usage/monthly?${r}`)},refresh:async()=>{if(!(await fetch(`${Ye}/usage/refresh`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to refresh usage cache")},status:()=>L("/usage/status"),insights:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",b(s.startDate)),s?.endDate&&t.append("until",b(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/insights?${t}`)}};async function L(s){const r=await fetch(`/api${s}`,{headers:{"Content-Type":"application/json"}});if(!r.ok){const l=await r.json().catch(()=>({error:"Unknown error"}));throw new Error(l.error||r.statusText)}const n=await r.json();return n.data||n}function Qe(s){return P({queryKey:["usage","summary",s],queryFn:()=>T.summary(s),staleTime:60*1e3})}function Ve(s){return P({queryKey:["usage","trends",s],queryFn:()=>T.trends(s),staleTime:60*1e3})}function Ze(s){return P({queryKey:["usage","hourly",s],queryFn:()=>T.hourly(s),staleTime:60*1e3})}function Xe(s){return P({queryKey:["usage","models",s],queryFn:()=>T.models(s),staleTime:60*1e3})}function Je(){const s=Be();return f.useCallback(async()=>{await T.refresh(),await s.invalidateQueries({queryKey:["usage"]})},[s])}function es(){return P({queryKey:["usage","status"],queryFn:()=>T.status(),staleTime:10*1e3,refetchInterval:30*1e3})}function ss(s){return P({queryKey:["usage","sessions",s],queryFn:()=>T.sessions(s),staleTime:60*1e3})}function ts(){const[s,t]=f.useState({from:$(new Date,30),to:new Date}),[r,n]=f.useState(!1),[l,i]=f.useState(null),[x,a]=f.useState(null),[o,d]=f.useState("daily"),u=Je(),m=f.useCallback(async()=>{n(!0);try{await u()}finally{n(!1)}},[u]),j=f.useMemo(()=>({startDate:s?.from,endDate:s?.to}),[s?.from,s?.to]),{data:w,isLoading:v}=Qe(j),{data:C,isLoading:S}=Ve(j),{data:B,isLoading:A}=Ze(j),{data:U,isLoading:q}=Xe(j),{data:_,isLoading:O}=ss({...j,limit:3}),{data:K}=es(),de=f.useCallback(()=>{const F=new Date;t({from:$(F,1),to:F}),d("hourly")},[]),xe=f.useCallback(F=>{t(F),d("daily")},[]),ue=f.useMemo(()=>K?.lastFetch?Y(new Date(K.lastFetch),{addSuffix:!0}):null,[K?.lastFetch]),me=f.useCallback((F,fe)=>{const E=fe.currentTarget.getBoundingClientRect();a({x:E.left+E.width/2,y:E.top+E.height/2}),i(F)},[]),he=f.useCallback(()=>{i(null),a(null)},[]);return{dateRange:s,isRefreshing:r,viewMode:o,selectedModel:l,popoverPosition:x,summary:w,trends:C,hourlyData:B,models:U,sessions:_,status:K,isSummaryLoading:v,isTrendsLoading:S,isHourlyLoading:A,isModelsLoading:q,isSessionsLoading:O,isLoading:v||S||q||O,handleRefresh:m,handleTodayClick:de,handleDateRangeChange:xe,handleModelClick:me,handlePopoverClose:he,lastUpdatedText:ue}}function as({value:s,onChange:t,presets:r=[{label:"Last 7 days",range:{from:$(new Date,7),to:new Date}},{label:"Last 30 days",range:{from:$(new Date,30),to:new Date}},{label:"Last 90 days",range:{from:$(new Date,90),to:new Date}}],className:n}){const[l,i]=pe.useState(!1),x=a=>!s||!s.from||!s.to||!a.from||!a.to?!1:k(s.from,"yyyy-MM-dd")===k(a.from,"yyyy-MM-dd")&&k(s.to,"yyyy-MM-dd")===k(a.to,"yyyy-MM-dd");return e.jsxs("div",{className:c("flex flex-wrap items-center gap-2",n),children:[r.map(a=>e.jsx(H,{variant:x(a.range)?"default":"outline",size:"sm",onClick:()=>t(a.range),children:a.label},a.label)),e.jsxs(se,{open:l,onOpenChange:i,children:[e.jsx(ge,{asChild:!0,children:e.jsxs(H,{id:"date",variant:"outline",className:c("w-auto min-w-[200px] sm:min-w-[240px] justify-start text-left font-normal",!s&&"text-muted-foreground"),children:[e.jsx(Se,{className:"mr-2 h-4 w-4"}),s?.from?s.to?e.jsxs(e.Fragment,{children:[k(s.from,"LLL dd, y")," - ",k(s.to,"LLL dd, y")]}):k(s.from,"LLL dd, y"):e.jsx("span",{children:"Pick a date"})]})}),e.jsx(te,{className:"w-auto p-0",align:"end",children:e.jsx(je,{initialFocus:!0,mode:"range",defaultMonth:s?.from,selected:s,onSelect:t,numberOfMonths:2})})]})]})}function rs({dateRange:s,onDateRangeChange:t,onTodayClick:r,onRefresh:n,isRefreshing:l,lastUpdatedText:i,viewMode:x}){const{t:a}=ee();return e.jsxs("div",{className:"flex flex-col gap-3 shrink-0 xl:flex-row xl:items-center xl:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold",children:a("analytics.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("analytics.subtitle")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 xl:justify-end",children:[e.jsx(H,{variant:x==="hourly"?"default":"outline",size:"sm",className:"h-8",onClick:r,children:"24H"}),e.jsx(as,{className:"flex-wrap",value:s,onChange:t,presets:[{label:"7D",range:{from:$(new Date,7),to:new Date}},{label:"30D",range:{from:$(new Date,30),to:new Date}},{label:a("analytics.month"),range:{from:Ae(new Date),to:new Date}},{label:a("analytics.allTime"),range:{from:void 0,to:new Date}}]}),i&&e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:a("analytics.updated",{value:i})}),e.jsx(H,{variant:"outline",size:"sm",className:"gap-2 h-8",onClick:n,disabled:l,children:e.jsx(De,{className:`w-3.5 h-3.5 ${l?"animate-spin":""}`})})]})]})}function ns({data:s,isLoading:t,granularity:r="daily",className:n}){const{privacyMode:l}=M(),i=f.useMemo(()=>!s||s.length===0?[]:(r==="hourly"?s:[...s].reverse()).map(o=>{const d="hour"in o?o.hour:o.date;return{...o,dateFormatted:ls(d,r),costRounded:Number(o.cost.toFixed(4))}}),[s,r]);if(t)return e.jsx(h,{className:c("h-full w-full",n)});if(!s||s.length===0)return e.jsx("div",{className:c("h-full flex items-center justify-center",n),children:e.jsx("p",{className:"text-muted-foreground",children:r==="hourly"?"No usage data for today":"No usage data available"})});const x=({x:a,y:o,payload:d,isRight:u})=>{const m=u?`$${d.value}`:X(Number(d.value));return e.jsx("text",{x:a,y:o,dy:4,textAnchor:u?"start":"end",fontSize:12,fill:"currentColor",className:c("fill-muted-foreground",l&&"blur-[4px]"),children:m})};return e.jsx("div",{className:c("w-full h-full",n),children:e.jsx(oe,{width:"100%",height:"100%",children:e.jsxs(Ue,{data:i,margin:{top:5,right:30,left:20,bottom:5},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"tokenGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#0080FF",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#0080FF",stopOpacity:.1})]}),e.jsxs("linearGradient",{id:"costGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#00C49F",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#00C49F",stopOpacity:.1})]})]}),e.jsx(qe,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(Ie,{dataKey:"dateFormatted",tick:{fontSize:12},tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(V,{yAxisId:"left",orientation:"left",tick:a=>e.jsx(x,{...a,isRight:!1}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(V,{yAxisId:"right",orientation:"right",tick:a=>e.jsx(x,{...a,isRight:!0}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(ce,{content:({active:a,payload:o,label:d})=>{if(!a||!o||!o.length)return null;const u=o[0].payload;return e.jsxs("div",{className:"rounded-lg border bg-background p-3 shadow-lg",children:[e.jsx("p",{className:"font-medium mb-2",children:d}),o.map((m,j)=>e.jsxs("p",{className:c("text-sm",l&&N),style:{color:m.color},children:[m.name,":"," ",m.name==="Tokens"?X(Number(m.value)||0):`$${m.value}`]},j)),"requests"in u&&e.jsxs("p",{className:c("text-sm text-muted-foreground mt-1",l&&N),children:["Requests: ",u.requests]})]})}}),e.jsx(Z,{yAxisId:"left",type:"monotone",dataKey:"tokens",stroke:"#0080FF",strokeWidth:2,fillOpacity:1,fill:"url(#tokenGradient)",name:"Tokens"}),e.jsx(Z,{yAxisId:"right",type:"monotone",dataKey:"costRounded",stroke:"#00C49F",strokeWidth:2,fillOpacity:1,fill:"url(#costGradient)",name:"Cost"})]})})})}function ls(s,t){if(t==="hourly"){const[n,l]=s.split(" ");if(n&&l){const i=new Date(`${n}T${l}:00Z`);return k(i,"HH:mm")}return s}const r=new Date(s);return t==="monthly"?k(r,"MMM yyyy"):k(r,"MMM dd")}function X(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function is({data:s,isLoading:t,className:r}){const{privacyMode:n}=M(),l=f.useMemo(()=>!s||s.length===0?[]:s.map(a=>({name:a.model,value:a.tokens,cost:a.cost,percentage:a.percentage,fill:ae(a.model)})),[s]);if(t)return e.jsx(h,{className:c("h-full min-h-[100px] w-full",r)});if(!s||s.length===0)return e.jsx("div",{className:c("h-full min-h-[100px] flex items-center justify-center",r),children:e.jsx("p",{className:"text-muted-foreground",children:"No model data available"})});const i=({active:a,payload:o})=>{if(!a||!o)return null;const d=o;if(!d.length)return null;const u=d[0].payload;return e.jsxs("div",{className:"rounded-lg border bg-background p-2 shadow-lg text-xs",children:[e.jsx("p",{className:"font-medium mb-1",children:u.name}),e.jsxs("p",{className:c("text-muted-foreground",n&&N),children:[os(u.value)," (",u.percentage.toFixed(1),"%)"]}),e.jsxs("p",{className:c("text-muted-foreground",n&&N),children:["$",u.cost.toFixed(4)]})]})},x=a=>a.percentage>5?`${a.percentage.toFixed(1)}%`:"";return e.jsx("div",{className:c("w-full h-full min-h-[100px]",r),children:e.jsx(oe,{width:"100%",height:"100%",children:e.jsxs(Oe,{children:[e.jsx(Ke,{data:l,cx:"50%",cy:"50%",labelLine:!1,label:x,innerRadius:50,outerRadius:70,paddingAngle:2,dataKey:"value",children:l.map((a,o)=>e.jsx(Ee,{fill:a.fill,strokeWidth:1},`cell-${o}`))}),e.jsx(ce,{content:i})]})})})}function os(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function cs(s){if(!s)return"";const r=s.replace(/^\/|\/$/g,"").split("/").filter(n=>n.length>0);return r[r.length-1]||""}function ds({data:s,isLoading:t,className:r}){const{privacyMode:n}=M(),l=f.useMemo(()=>{if(!s?.sessions||s.sessions.length===0)return null;const i=s.sessions,x=s.total,a=i.reduce((w,v)=>w+(v.inputTokens+v.outputTokens),0),o=Math.round(a/i.length),u=i.reduce((w,v)=>w+v.cost,0)/i.length,m=i[0],j=m?Y(new Date(m.lastActivity),{addSuffix:!0}):"N/A";return{totalSessions:x,avgTokens:o,avgCost:u,lastActive:j,recentSessions:i.slice(0,3)}},[s]);return t?e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",r),children:[e.jsx(y,{className:"px-3 py-2",children:e.jsx(h,{className:"h-5 w-32"})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx(h,{className:"h-full w-full"})})]}):l?e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 shadow-sm",r),children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Q,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsxs(g,{className:"px-3 pb-3 pt-0 flex-1 min-h-0 flex flex-col gap-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-blue-600 dark:text-blue-400",children:[e.jsx(Le,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xl font-bold",children:l.totalSessions})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:"Total Sessions"})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-green-600 dark:text-green-400",children:[e.jsx(ie,{className:"w-4 h-4"}),e.jsxs("span",{className:c("text-xl font-bold",n&&N),children:["$",l.avgCost.toFixed(2)]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:"Avg Cost/Session"})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground font-medium mb-1",children:[e.jsx($e,{className:"w-3 h-3"}),"Recent Activity"]}),e.jsx("div",{className:"space-y-1.5 max-h-full overflow-y-auto pr-1",children:l.recentSessions.map(i=>e.jsxs("div",{className:"flex items-center justify-between text-xs p-1.5 rounded bg-muted/30 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-medium truncate",title:i.projectPath,children:cs(i.projectPath)}),(i.target??"claude")!=="claude"&&e.jsx("span",{className:"shrink-0 px-1 py-0 text-[9px] font-medium rounded bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-300 uppercase",children:i.target})]}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:Y(new Date(i.lastActivity),{addSuffix:!0})})]}),e.jsxs("div",{className:c("text-right shrink-0 ml-2",n&&N),children:[e.jsxs("div",{className:"font-mono",children:["$",i.cost.toFixed(2)]}),e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[xs(i.inputTokens+i.outputTokens)," toks"]})]})]},i.sessionId))})]})]})]}):e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",r),children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Q,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"No session data available"})})]})}function xs(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}function us({className:s,isLoading:t}){const{data:r,isLoading:n}=ye(),{data:l,isLoading:i,error:x}=Ne(r?.running);if(t||n||r?.running&&i)return e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",s),children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"CLIProxy Stats"]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(h,{className:"h-4 w-[100px]"}),e.jsx(h,{className:"h-16 w-full"})]})})]});if(!r?.running)return e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 border-dashed",s),children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4 text-muted-foreground"}),"CLIProxy Stats"]}),e.jsx(I,{variant:"secondary",className:"text-[10px] h-5",children:"Offline"})]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Start a CLIProxy session (gemini, codex, agy) to collect stats."})})]});if(x)return e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 border-destructive/50",s),children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsx(I,{variant:"destructive",className:"text-[10px] h-5",children:"Error"})]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx("p",{className:"text-xs text-destructive",children:x.message})})]});const o=l?.totalRequests??0,d=l?.quotaExceededCount??0,u=o-d,m=o>0?Math.round(u/o*100):100,j=l?.tokens?.total??0,w=Object.entries(l?.requestsByModel??{}).sort((C,S)=>S[1]-C[1]).slice(0,4),v=w.length>0?w[0][1]:1;return e.jsxs(p,{className:c("flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0",s),children:[e.jsx(y,{className:"px-3 py-2 border-b bg-muted/5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsxs(I,{variant:"outline",className:"text-[10px] h-5 text-green-600 border-green-200 bg-green-50 dark:bg-green-900/10 dark:border-green-800",children:[e.jsx(ie,{className:"h-3 w-3 mr-0.5"}),"Running"]})]})}),e.jsx(g,{className:"p-0 flex-1 min-h-0",children:e.jsx(we,{className:"h-full",children:e.jsxs("div",{className:"p-3 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"w-10 h-10 -rotate-90",viewBox:"0 0 36 36",children:[e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",className:"text-muted/30"}),e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeDasharray:`${m*.88} 88`,strokeLinecap:"round",className:m>=90?"text-green-500":"text-amber-500"})]}),e.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-[8px] font-bold",children:[m,"%"]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:J(o)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:d>0?`${d} failed`:"All success"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsx("div",{className:"p-1.5 rounded-md bg-purple-100 dark:bg-purple-900/20",children:e.jsx(Te,{className:"h-4 w-4 text-purple-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:J(j)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:"Total tokens"})]})]})]}),w.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-medium text-muted-foreground",children:[e.jsx(Fe,{className:"h-3 w-3"}),"Models Used"]}),e.jsx("div",{className:"space-y-1",children:w.map(([C,S])=>{const B=Math.round(S/v*100),A=ms(C);return e.jsxs("div",{className:"group",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] mb-0.5",children:[e.jsx("span",{className:"truncate font-medium",title:C,children:A}),e.jsx("span",{className:"text-muted-foreground shrink-0 ml-2",children:S})]}),e.jsx("div",{className:"h-1 bg-muted/50 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-accent/70 rounded-full transition-all",style:{width:`${B}%`}})})]},C)})})]})]})})})]})}function J(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function ms(s){let t=s.replace(/^gemini-claude-/,"").replace(/^gemini-/,"").replace(/^claude-/,"").replace(/^anthropic\./,"").replace(/-thinking$/," Thinking");return t=t.split(/[-_]/).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" "),t.length>20&&(t=t.slice(0,18)+"..."),t}function hs(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(0)}K`:s.toString()}function fs({models:s,isLoading:t,onModelClick:r,privacyMode:n}){return e.jsxs(p,{className:"flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 shadow-sm lg:col-span-4",children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(re,{className:"w-4 h-4"}),"Cost by Model"]})}),e.jsx(g,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 overflow-y-auto",children:t?e.jsx(h,{className:"h-full w-full"}):e.jsxs("div",{className:"space-y-0.5",children:[[...s||[]].sort((l,i)=>i.cost-l.cost).map(l=>e.jsxs("button",{className:"group flex items-center text-xs w-full hover:bg-muted/50 rounded px-2 py-1.5 transition-colors cursor-pointer gap-3",onClick:i=>r(l,i),title:"Click for details",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-[180px] shrink-0",children:[e.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:ae(l.model)}}),e.jsx("span",{className:"font-medium truncate group-hover:underline underline-offset-2",children:l.model})]}),e.jsx(ps,{model:l}),e.jsx("span",{className:c("text-[10px] text-muted-foreground w-14 text-right shrink-0",n&&N),children:hs(l.tokens)}),e.jsxs("span",{className:c("font-mono font-medium w-16 text-right shrink-0",n&&N),children:["$",l.cost.toFixed(2)]}),e.jsx(Re,{className:"w-3 h-3 opacity-0 group-hover:opacity-50 transition-opacity shrink-0"})]},l.model)),e.jsx(gs,{})]})})]})}function ps({model:s}){const t={input:"#335c67",output:"#fff3b0",cacheWrite:"#e09f3e",cacheRead:"#9e2a2b"},r=n=>s.cost>0?n/s.cost*100:0;return e.jsx("div",{className:"flex-1 flex items-center gap-1 min-w-0",children:e.jsxs("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden flex",children:[e.jsx("div",{className:"h-full",style:{backgroundColor:t.input,width:`${r(s.costBreakdown.input.cost)}%`},title:`Input: $${s.costBreakdown.input.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.output,width:`${r(s.costBreakdown.output.cost)}%`},title:`Output: $${s.costBreakdown.output.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.cacheWrite,width:`${r(s.costBreakdown.cacheCreation.cost)}%`},title:`Cache Write: $${s.costBreakdown.cacheCreation.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.cacheRead,width:`${r(s.costBreakdown.cacheRead.cost)}%`},title:`Cache Read: $${s.costBreakdown.cacheRead.cost.toFixed(2)}`})]})})}function gs(){const s=[{color:"#335c67",label:"Input"},{color:"#fff3b0",label:"Output",hasBorder:!0},{color:"#e09f3e",label:"Cache Write"},{color:"#9e2a2b",label:"Cache Read"}];return e.jsx("div",{className:"flex items-center gap-3 pt-2 px-2 text-[10px] text-muted-foreground border-t mt-2",children:s.map(({color:t,label:r,hasBorder:n})=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("div",{className:c("w-2 h-2 rounded-full",n&&"border border-muted-foreground/30"),style:{backgroundColor:t}}),r]},r))})}function js({viewMode:s,trends:t,hourlyData:r,models:n,sessions:l,isTrendsLoading:i,isHourlyLoading:x,isModelsLoading:a,isSessionsLoading:o,isSummaryLoading:d,onModelClick:u}){const{privacyMode:m}=M();return e.jsxs("div",{className:"min-h-0 grid gap-4 lg:grid-rows-[minmax(260px,1.2fr)_minmax(220px,0.9fr)]",children:[e.jsxs(p,{className:"flex flex-col h-full min-h-[220px] lg:min-h-[240px] overflow-hidden gap-0 py-0 shadow-sm",children:[e.jsx(y,{className:"px-3 py-2 shrink-0",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Me,{className:"w-4 h-4"}),s==="hourly"?"Last 24 Hours":"Usage Trends"]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1 min-h-0",children:e.jsx(ns,{data:s==="hourly"?r||[]:t||[],isLoading:s==="hourly"?x:i,granularity:s==="hourly"?"hourly":"daily"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-10 gap-4 h-auto min-h-[220px] lg:h-full lg:min-h-[220px] lg:grid-rows-[minmax(0,1fr)] lg:[&>*]:min-h-0",children:[e.jsx(fs,{models:n,isLoading:a,onModelClick:u,privacyMode:m}),e.jsxs(p,{className:"flex flex-col h-full min-h-0 overflow-hidden gap-0 py-0 shadow-sm lg:col-span-2",children:[e.jsx(y,{className:"px-3 py-2",children:e.jsxs(D,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Pe,{className:"w-4 h-4"}),"Model Usage"]})}),e.jsx(g,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 flex items-center justify-center",children:e.jsx(is,{data:n||[],isLoading:a,className:"h-full w-full"})})]}),e.jsx(ds,{data:l,isLoading:o,className:"lg:col-span-2"}),e.jsx(us,{isLoading:d,className:"lg:col-span-2"})]})]})}function $s(){return e.jsxs("div",{className:"space-y-4 h-full overflow-hidden",children:[e.jsxs(p,{className:"flex flex-col min-h-[300px]",children:[e.jsx(y,{className:"p-4 pb-2",children:e.jsx(h,{className:"h-4 w-32"})}),e.jsx(g,{className:"p-4 pt-0 flex-1",children:e.jsx(h,{className:"h-full w-full"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs(p,{className:"flex flex-col min-h-[250px]",children:[e.jsx(y,{className:"p-4 pb-2",children:e.jsx(h,{className:"h-4 w-28"})}),e.jsx(g,{className:"p-4 pt-2",children:e.jsx("div",{className:"space-y-3",children:[1,2,3,4,5].map(s=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:"w-2.5 h-2.5 rounded-full"}),e.jsx(h,{className:"h-3 w-24"})]}),e.jsx(h,{className:"h-3 w-16"})]},s))})})]}),e.jsxs(p,{className:"flex flex-col min-h-[250px]",children:[e.jsx(y,{className:"p-4 pb-2",children:e.jsx(h,{className:"h-4 w-28"})}),e.jsx(g,{className:"p-4 pt-0 flex-1",children:e.jsxs("div",{className:"flex w-full h-full items-center",children:[e.jsx("div",{className:"flex-1 flex justify-center",children:e.jsx(h,{className:"h-[180px] w-[180px] rounded-full"})}),e.jsx("div",{className:"w-[140px] shrink-0 pl-2 space-y-2",children:[1,2,3,4].map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:"w-2 h-2 rounded-full"}),e.jsx(h,{className:"h-3 w-20"})]},s))})]})})]})]})]})}function Ts(){const s=f.useRef(null),{dateRange:t,handleDateRangeChange:r,handleTodayClick:n,handleRefresh:l,isRefreshing:i,lastUpdatedText:x,viewMode:a,summary:o,isSummaryLoading:d,trends:u,hourlyData:m,models:j,sessions:w,isTrendsLoading:v,isHourlyLoading:C,isModelsLoading:S,isSessionsLoading:B,handleModelClick:A,selectedModel:U,popoverPosition:q,handlePopoverClose:_}=ts();return e.jsxs("div",{className:"grid h-full min-h-0 grid-rows-[auto_auto_minmax(0,1fr)] gap-4 overflow-y-auto px-4 py-4",children:[e.jsx(rs,{dateRange:t,onDateRangeChange:r,onTodayClick:n,onRefresh:l,isRefreshing:i,lastUpdatedText:x,viewMode:a}),e.jsx(Ge,{data:o,isLoading:d}),e.jsx(js,{viewMode:a,trends:u,hourlyData:m,models:j,sessions:w,isTrendsLoading:v,isHourlyLoading:C,isModelsLoading:S,isSessionsLoading:B,isSummaryLoading:d,onModelClick:A}),e.jsxs(se,{open:!!U,onOpenChange:O=>!O&&_(),children:[e.jsx(be,{asChild:!0,children:e.jsx("div",{ref:s,className:"fixed pointer-events-none",style:{left:q?.x??0,top:q?.y??0,width:1,height:1}})}),e.jsx(te,{className:"w-80 p-3",side:"top",align:"center",children:U&&e.jsx(We,{model:U})})]})]})}export{Ts as AnalyticsPage,$s as AnalyticsSkeleton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as c}from"./react-vendor-CNOkPC89.js";import{bg as U,bh as F,a as A,I as K,bi as _,b1 as z,b3 as B,n as D,d as T}from"./index-tMnuUCFi.js";import{S as q}from"./switch-Bog43RUy.js";import{Q as Y,l as J,s as Q,r as X,o as Z,R as y,x as V,v as ee,aU as se}from"./icons-DtwH984l.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function te(){const{state:s}=U(),t=F(),[o,g]=c.useState(""),[n,d]=c.useState(""),[x,p]=c.useState(!1),[j,f]=c.useState(!1),S=c.useCallback(async()=>{try{t.setWebSearchLoading(!0),t.setWebSearchError(null);const a=await fetch("/api/websearch");if(!a.ok)throw new Error("Failed to load WebSearch config");const r=await a.json();t.setWebSearchConfig(r)}catch(a){t.setWebSearchError(a.message)}finally{t.setWebSearchLoading(!1)}},[t]),v=c.useCallback(async()=>{try{t.setWebSearchStatusLoading(!0);const a=await fetch("/api/websearch/status");if(!a.ok)throw new Error("Failed to load status");const r=await a.json();t.setWebSearchStatus(r)}catch{}finally{t.setWebSearchStatusLoading(!1)}},[t]),b=c.useCallback(async a=>{const r=s.webSearchConfig;if(!r)return;const w={...r,...a};t.setWebSearchConfig(w);try{t.setWebSearchSaving(!0),t.setWebSearchError(null);const l=await fetch("/api/websearch",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!l.ok){const k=await l.json();throw new Error(k.error||"Failed to save")}const i=await l.json();t.setWebSearchConfig(i.websearch),t.setWebSearchSuccess(!0),setTimeout(()=>t.setWebSearchSuccess(!1),1500)}catch(l){t.setWebSearchConfig(r),t.setWebSearchError(l.message)}finally{t.setWebSearchSaving(!1)}},[s.webSearchConfig,t]);c.useEffect(()=>{s.webSearchConfig&&(g(s.webSearchConfig.providers?.gemini?.model??"gemini-2.5-flash"),d(s.webSearchConfig.providers?.opencode?.model??"opencode/grok-code"))},[s.webSearchConfig]);const C=c.useCallback(async()=>{const a=s.webSearchConfig?.providers?.gemini?.model??"gemini-2.5-flash";if(o!==a){const r=s.webSearchConfig?.providers||{};await b({providers:{...r,gemini:{...r.gemini,model:o}}}),p(!0),setTimeout(()=>p(!1),2e3)}},[o,s.webSearchConfig,b]),h=c.useCallback(async()=>{const a=s.webSearchConfig?.providers?.opencode?.model??"opencode/grok-code";if(n!==a){const r=s.webSearchConfig?.providers||{};await b({providers:{...r,opencode:{...r.opencode,model:n}}}),f(!0),setTimeout(()=>f(!1),2e3)}},[n,s.webSearchConfig,b]);return{config:s.webSearchConfig,status:s.webSearchStatus,loading:s.webSearchLoading,statusLoading:s.webSearchStatusLoading,saving:s.webSearchSaving,error:s.webSearchError,success:s.webSearchSuccess,geminiModelInput:o,setGeminiModelInput:g,opencodeModelInput:n,setOpencodeModelInput:d,geminiModelSaved:x,opencodeModelSaved:j,fetchConfig:S,fetchStatus:v,saveConfig:b,saveGeminiModel:C,saveOpencodeModel:h}}function H({name:s,label:t,badge:o,badgeColor:g,enabled:n,installed:d,statusLoading:x,saving:p,onToggle:j,modelInput:f,setModelInput:S,onModelBlur:v,modelSaved:b,modelPlaceholder:C,showHint:h,setShowHint:a,installCmd:r,docsUrl:w,hintColor:l}){const{t:i}=A(),k=g==="green"?"bg-green-500/10 text-green-600":g==="blue"?"bg-blue-500/10 text-blue-600":"bg-purple-500/10 text-purple-600",W=l==="amber"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300":l==="blue"?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300",E=l==="amber"?"bg-amber-100 dark:bg-amber-900/40":l==="blue"?"bg-blue-100 dark:bg-blue-900/40":"bg-purple-100 dark:bg-purple-900/40",M=l==="amber"?"text-amber-600 dark:text-amber-400":l==="blue"?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400",G=s==="opencode"?"OpenCode":s.charAt(0).toUpperCase()+s.slice(1);return e.jsxs("div",{className:`rounded-lg border transition-colors ${n?"border-primary border-l-4":"border-border"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{className:`w-5 h-5 ${n?"text-primary":"text-muted-foreground"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-mono font-medium",children:s}),e.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded font-medium ${k}`,children:o}),d?e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 font-medium",children:i("settingsWebsearch.installed")}):e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-600 font-medium",children:i("settingsWebsearch.notInstalled")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t})]})]}),e.jsx(q,{checked:n,onCheckedChange:j,disabled:p||!d})]}),n&&f!==void 0&&S&&v&&e.jsx("div",{className:"px-4 pb-4 pt-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground whitespace-nowrap",children:i("settingsWebsearch.model")}),e.jsx(K,{value:f,onChange:I=>S(I.target.value),onBlur:v,placeholder:C,className:"h-8 text-sm font-mono",disabled:p}),b&&e.jsxs("span",{className:"flex items-center gap-1 text-green-600 dark:text-green-400 text-xs animate-in fade-in duration-200",children:[e.jsx(J,{className:"w-3.5 h-3.5"}),i("settings.saved")]})]})}),!d&&!x&&e.jsxs("div",{className:"px-4 pb-4 pt-0 border-t border-border/50",children:[e.jsxs("button",{onClick:()=>a(!h),className:`flex items-center gap-2 text-sm hover:underline w-full py-2 ${M}`,children:[h?e.jsx(Q,{className:"w-4 h-4"}):e.jsx(X,{className:"w-4 h-4"}),i("settingsWebsearch.howInstall",{name:G})]}),h&&e.jsxs("div",{className:`mt-2 p-3 rounded-md text-sm ${W}`,children:[e.jsxs("p",{className:"mb-2",children:[i("settingsWebsearch.installGlobally")," ",i(o==="GROK_API_KEY"?"settingsWebsearch.requiresKey":"settingsWebsearch.freeTier"),":"]}),e.jsx("code",{className:`text-sm px-2 py-1 rounded font-mono block mb-2 ${E}`,children:r}),e.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"hover:underline inline-flex items-center gap-1",children:[e.jsx(Z,{className:"w-3 h-3"}),i("settingsWebsearch.viewDocs")]})]})]})]})}function be(){const{t:s}=A(),{config:t,status:o,loading:g,statusLoading:n,saving:d,error:x,success:p,geminiModelInput:j,setGeminiModelInput:f,opencodeModelInput:S,setOpencodeModelInput:v,geminiModelSaved:b,opencodeModelSaved:C,fetchConfig:h,fetchStatus:a,saveConfig:r,saveGeminiModel:w,saveOpencodeModel:l}=te(),{fetchRawConfig:i}=_(),[k,W]=c.useState(!1),[E,M]=c.useState(!1),[G,I]=c.useState(!1);c.useEffect(()=>{h(),a(),i()},[h,a,i]);const N=t?.providers?.gemini?.enabled??!1,O=t?.providers?.grok?.enabled??!1,L=t?.providers?.opencode?.enabled??!1,R=()=>{const m=t?.providers||{},u=m.gemini?.enabled??!1;r({enabled:!u||O||L,providers:{...m,gemini:{...m.gemini,enabled:!u}}})},$=()=>{const m=t?.providers||{},u=m.grok?.enabled??!1;r({enabled:N||!u||L,providers:{...m,grok:{...m.grok,enabled:!u}}})},P=()=>{const m=t?.providers||{},u=m.opencode?.enabled??!1;r({enabled:N||O||!u,providers:{...m,opencode:{...m.opencode,enabled:!u}}})};return g?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(y,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:s("settings.loading")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${x||p?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[x&&e.jsxs(z,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(V,{className:"h-4 w-4"}),e.jsx(B,{children:x})]}),p&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:s("settings.saved")})]})]}),e.jsx(D,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsWebsearch.description")}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s(N?"settingsWebsearch.enabled":"settingsWebsearch.disabled")}),n?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsWebsearch.checking")}):o?.readiness?e.jsx("p",{className:"text-sm text-muted-foreground",children:o.readiness.message}):null]}),e.jsx(T,{variant:"ghost",size:"sm",onClick:a,disabled:n,children:e.jsx(y,{className:`w-4 h-4 ${n?"animate-spin":""}`})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsWebsearch.providers")}),!o?.geminiCli&&!o?.opencodeCli&&!o?.grokCli&&!n&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 border-2 border-dashed rounded-lg text-center bg-muted/30",children:[e.jsx(se,{className:"w-12 h-12 text-muted-foreground mb-3 opacity-30"}),e.jsx("p",{className:"font-medium text-foreground mb-1",children:s("settingsWebsearch.noneConfigured")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s("settingsWebsearch.noneConfiguredHint")}),e.jsxs(T,{variant:"outline",size:"sm",onClick:a,children:[e.jsx(y,{className:"w-4 h-4 mr-2"}),s("settingsWebsearch.checkProviders")]})]}),e.jsx(H,{name:"gemini",label:"Google Gemini CLI (1000 req/day free)",badge:"FREE",badgeColor:"green",enabled:N,installed:o?.geminiCli?.installed??!1,statusLoading:n,saving:d,onToggle:R,modelInput:j,setModelInput:f,onModelBlur:w,modelSaved:b,modelPlaceholder:"gemini-2.5-flash",showHint:k,setShowHint:W,installCmd:"npm install -g @google/gemini-cli",docsUrl:"https://github.com/google-gemini/gemini-cli",hintColor:"amber"}),e.jsx(H,{name:"opencode",label:"OpenCode (web search via Zen)",badge:"FREE",badgeColor:"green",enabled:L,installed:o?.opencodeCli?.installed??!1,statusLoading:n,saving:d,onToggle:P,modelInput:S,setModelInput:v,onModelBlur:l,modelSaved:C,modelPlaceholder:"opencode/grok-code",showHint:E,setShowHint:M,installCmd:"curl -fsSL https://opencode.ai/install | bash",docsUrl:"https://github.com/sst/opencode",hintColor:"purple"}),e.jsx(H,{name:"grok",label:"xAI Grok CLI (web + X search)",badge:"GROK_API_KEY",badgeColor:"blue",enabled:O,installed:o?.grokCli?.installed??!1,statusLoading:n,saving:d,onToggle:$,showHint:G,setShowHint:I,installCmd:"npm install -g @vibe-kit/grok-cli",docsUrl:"https://github.com/superagent-ai/grok-cli",hintColor:"blue"})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(T,{variant:"outline",size:"sm",onClick:()=>{h(),i()},disabled:g||d,className:"w-full",children:[e.jsx(y,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),s("settings.refresh")]})})]})}export{be as default};
|
|
1
|
+
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as c}from"./react-vendor-CNOkPC89.js";import{bh as F,bi as U,a as A,I as K,bj as _,b3 as z,b5 as B,n as D,d as T}from"./index-sCtK1kDn.js";import{S as Y}from"./switch-BeqpDfK5.js";import{Q as q,l as J,s as Q,r as X,o as Z,R as y,x as V,v as ee,aY as se}from"./icons-DR-ORtNe.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function te(){const{state:s}=F(),t=U(),[o,g]=c.useState(""),[n,d]=c.useState(""),[x,p]=c.useState(!1),[j,f]=c.useState(!1),S=c.useCallback(async()=>{try{t.setWebSearchLoading(!0),t.setWebSearchError(null);const a=await fetch("/api/websearch");if(!a.ok)throw new Error("Failed to load WebSearch config");const r=await a.json();t.setWebSearchConfig(r)}catch(a){t.setWebSearchError(a.message)}finally{t.setWebSearchLoading(!1)}},[t]),v=c.useCallback(async()=>{try{t.setWebSearchStatusLoading(!0);const a=await fetch("/api/websearch/status");if(!a.ok)throw new Error("Failed to load status");const r=await a.json();t.setWebSearchStatus(r)}catch{}finally{t.setWebSearchStatusLoading(!1)}},[t]),b=c.useCallback(async a=>{const r=s.webSearchConfig;if(!r)return;const w={...r,...a};t.setWebSearchConfig(w);try{t.setWebSearchSaving(!0),t.setWebSearchError(null);const l=await fetch("/api/websearch",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!l.ok){const k=await l.json();throw new Error(k.error||"Failed to save")}const i=await l.json();t.setWebSearchConfig(i.websearch),t.setWebSearchSuccess(!0),setTimeout(()=>t.setWebSearchSuccess(!1),1500)}catch(l){t.setWebSearchConfig(r),t.setWebSearchError(l.message)}finally{t.setWebSearchSaving(!1)}},[s.webSearchConfig,t]);c.useEffect(()=>{s.webSearchConfig&&(g(s.webSearchConfig.providers?.gemini?.model??"gemini-2.5-flash"),d(s.webSearchConfig.providers?.opencode?.model??"opencode/grok-code"))},[s.webSearchConfig]);const C=c.useCallback(async()=>{const a=s.webSearchConfig?.providers?.gemini?.model??"gemini-2.5-flash";if(o!==a){const r=s.webSearchConfig?.providers||{};await b({providers:{...r,gemini:{...r.gemini,model:o}}}),p(!0),setTimeout(()=>p(!1),2e3)}},[o,s.webSearchConfig,b]),h=c.useCallback(async()=>{const a=s.webSearchConfig?.providers?.opencode?.model??"opencode/grok-code";if(n!==a){const r=s.webSearchConfig?.providers||{};await b({providers:{...r,opencode:{...r.opencode,model:n}}}),f(!0),setTimeout(()=>f(!1),2e3)}},[n,s.webSearchConfig,b]);return{config:s.webSearchConfig,status:s.webSearchStatus,loading:s.webSearchLoading,statusLoading:s.webSearchStatusLoading,saving:s.webSearchSaving,error:s.webSearchError,success:s.webSearchSuccess,geminiModelInput:o,setGeminiModelInput:g,opencodeModelInput:n,setOpencodeModelInput:d,geminiModelSaved:x,opencodeModelSaved:j,fetchConfig:S,fetchStatus:v,saveConfig:b,saveGeminiModel:C,saveOpencodeModel:h}}function H({name:s,label:t,badge:o,badgeColor:g,enabled:n,installed:d,statusLoading:x,saving:p,onToggle:j,modelInput:f,setModelInput:S,onModelBlur:v,modelSaved:b,modelPlaceholder:C,showHint:h,setShowHint:a,installCmd:r,docsUrl:w,hintColor:l}){const{t:i}=A(),k=g==="green"?"bg-green-500/10 text-green-600":g==="blue"?"bg-blue-500/10 text-blue-600":"bg-purple-500/10 text-purple-600",W=l==="amber"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300":l==="blue"?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300",E=l==="amber"?"bg-amber-100 dark:bg-amber-900/40":l==="blue"?"bg-blue-100 dark:bg-blue-900/40":"bg-purple-100 dark:bg-purple-900/40",M=l==="amber"?"text-amber-600 dark:text-amber-400":l==="blue"?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400",G=s==="opencode"?"OpenCode":s.charAt(0).toUpperCase()+s.slice(1);return e.jsxs("div",{className:`rounded-lg border transition-colors ${n?"border-primary border-l-4":"border-border"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(q,{className:`w-5 h-5 ${n?"text-primary":"text-muted-foreground"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-mono font-medium",children:s}),e.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded font-medium ${k}`,children:o}),d?e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 font-medium",children:i("settingsWebsearch.installed")}):e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-600 font-medium",children:i("settingsWebsearch.notInstalled")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t})]})]}),e.jsx(Y,{checked:n,onCheckedChange:j,disabled:p||!d})]}),n&&f!==void 0&&S&&v&&e.jsx("div",{className:"px-4 pb-4 pt-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground whitespace-nowrap",children:i("settingsWebsearch.model")}),e.jsx(K,{value:f,onChange:I=>S(I.target.value),onBlur:v,placeholder:C,className:"h-8 text-sm font-mono",disabled:p}),b&&e.jsxs("span",{className:"flex items-center gap-1 text-green-600 dark:text-green-400 text-xs animate-in fade-in duration-200",children:[e.jsx(J,{className:"w-3.5 h-3.5"}),i("settings.saved")]})]})}),!d&&!x&&e.jsxs("div",{className:"px-4 pb-4 pt-0 border-t border-border/50",children:[e.jsxs("button",{onClick:()=>a(!h),className:`flex items-center gap-2 text-sm hover:underline w-full py-2 ${M}`,children:[h?e.jsx(Q,{className:"w-4 h-4"}):e.jsx(X,{className:"w-4 h-4"}),i("settingsWebsearch.howInstall",{name:G})]}),h&&e.jsxs("div",{className:`mt-2 p-3 rounded-md text-sm ${W}`,children:[e.jsxs("p",{className:"mb-2",children:[i("settingsWebsearch.installGlobally")," ",i(o==="GROK_API_KEY"?"settingsWebsearch.requiresKey":"settingsWebsearch.freeTier"),":"]}),e.jsx("code",{className:`text-sm px-2 py-1 rounded font-mono block mb-2 ${E}`,children:r}),e.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"hover:underline inline-flex items-center gap-1",children:[e.jsx(Z,{className:"w-3 h-3"}),i("settingsWebsearch.viewDocs")]})]})]})]})}function be(){const{t:s}=A(),{config:t,status:o,loading:g,statusLoading:n,saving:d,error:x,success:p,geminiModelInput:j,setGeminiModelInput:f,opencodeModelInput:S,setOpencodeModelInput:v,geminiModelSaved:b,opencodeModelSaved:C,fetchConfig:h,fetchStatus:a,saveConfig:r,saveGeminiModel:w,saveOpencodeModel:l}=te(),{fetchRawConfig:i}=_(),[k,W]=c.useState(!1),[E,M]=c.useState(!1),[G,I]=c.useState(!1);c.useEffect(()=>{h(),a(),i()},[h,a,i]);const N=t?.providers?.gemini?.enabled??!1,O=t?.providers?.grok?.enabled??!1,L=t?.providers?.opencode?.enabled??!1,R=()=>{const m=t?.providers||{},u=m.gemini?.enabled??!1;r({enabled:!u||O||L,providers:{...m,gemini:{...m.gemini,enabled:!u}}})},$=()=>{const m=t?.providers||{},u=m.grok?.enabled??!1;r({enabled:N||!u||L,providers:{...m,grok:{...m.grok,enabled:!u}}})},P=()=>{const m=t?.providers||{},u=m.opencode?.enabled??!1;r({enabled:N||O||!u,providers:{...m,opencode:{...m.opencode,enabled:!u}}})};return g?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(y,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:s("settings.loading")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${x||p?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[x&&e.jsxs(z,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(V,{className:"h-4 w-4"}),e.jsx(B,{children:x})]}),p&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:s("settings.saved")})]})]}),e.jsx(D,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsWebsearch.description")}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s(N?"settingsWebsearch.enabled":"settingsWebsearch.disabled")}),n?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsWebsearch.checking")}):o?.readiness?e.jsx("p",{className:"text-sm text-muted-foreground",children:o.readiness.message}):null]}),e.jsx(T,{variant:"ghost",size:"sm",onClick:a,disabled:n,children:e.jsx(y,{className:`w-4 h-4 ${n?"animate-spin":""}`})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsWebsearch.providers")}),!o?.geminiCli&&!o?.opencodeCli&&!o?.grokCli&&!n&&e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 border-2 border-dashed rounded-lg text-center bg-muted/30",children:[e.jsx(se,{className:"w-12 h-12 text-muted-foreground mb-3 opacity-30"}),e.jsx("p",{className:"font-medium text-foreground mb-1",children:s("settingsWebsearch.noneConfigured")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s("settingsWebsearch.noneConfiguredHint")}),e.jsxs(T,{variant:"outline",size:"sm",onClick:a,children:[e.jsx(y,{className:"w-4 h-4 mr-2"}),s("settingsWebsearch.checkProviders")]})]}),e.jsx(H,{name:"gemini",label:"Google Gemini CLI (1000 req/day free)",badge:"FREE",badgeColor:"green",enabled:N,installed:o?.geminiCli?.installed??!1,statusLoading:n,saving:d,onToggle:R,modelInput:j,setModelInput:f,onModelBlur:w,modelSaved:b,modelPlaceholder:"gemini-2.5-flash",showHint:k,setShowHint:W,installCmd:"npm install -g @google/gemini-cli",docsUrl:"https://github.com/google-gemini/gemini-cli",hintColor:"amber"}),e.jsx(H,{name:"opencode",label:"OpenCode (web search via Zen)",badge:"FREE",badgeColor:"green",enabled:L,installed:o?.opencodeCli?.installed??!1,statusLoading:n,saving:d,onToggle:P,modelInput:S,setModelInput:v,onModelBlur:l,modelSaved:C,modelPlaceholder:"opencode/grok-code",showHint:E,setShowHint:M,installCmd:"curl -fsSL https://opencode.ai/install | bash",docsUrl:"https://github.com/sst/opencode",hintColor:"purple"}),e.jsx(H,{name:"grok",label:"xAI Grok CLI (web + X search)",badge:"GROK_API_KEY",badgeColor:"blue",enabled:O,installed:o?.grokCli?.installed??!1,statusLoading:n,saving:d,onToggle:$,showHint:G,setShowHint:I,installCmd:"npm install -g @vibe-kit/grok-cli",docsUrl:"https://github.com/superagent-ai/grok-cli",hintColor:"blue"})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(T,{variant:"outline",size:"sm",onClick:()=>{h(),i()},disabled:g||d,className:"w-full",children:[e.jsx(y,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),s("settings.refresh")]})})]})}export{be as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as n}from"./react-vendor-CNOkPC89.js";import{bg as Oe,bh as Ve,Y as L,a as ae,I as B,r as He,s as Ue,t as ze,v as We,w as ue,d as H,bi as Ye,bj as Ge,bk as Xe,b1 as se,b3 as te,n as qe}from"./index-tMnuUCFi.js";import{S as D}from"./switch-Bog43RUy.js";import{C as U}from"./default-ports-1QQSffYX.js";import{aV as he,R as re,g as Je,v as fe,W as Qe,x as Ze,aW as es,aX as ss,T as ye,at as ts,o as rs,aY as as}from"./icons-DtwH984l.js";import{R as V,P as os}from"./proxy-status-widget-PESjh9-t.js";import{t as T}from"./notifications-B2HqRBj7.js";import"./tanstack-B8i0evp-.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-cy99V8EM.js";function ns(){const{state:s}=Oe(),t=Ve(),[g,o]=n.useState(null),[u,b]=n.useState(null),[y,j]=n.useState(null),[p,C]=n.useState(null),[S,P]=n.useState(null),w=n.useCallback(async()=>{try{t.setProxyLoading(!0),t.setProxyError(null);const d=await L.cliproxyServer.get();t.setProxyConfig(d)}catch(d){t.setProxyError(d.message)}finally{t.setProxyLoading(!1)}},[t]),A=n.useCallback(async d=>{const x=s.proxyConfig;if(!x)return;const h={remote:{...x.remote,...d.remote},fallback:{...x.fallback,...d.fallback},local:{...x.local,...d.local}};t.setProxyConfig(h),t.setProxyTestResult(null);try{t.setProxySaving(!0),t.setProxyError(null);const a=await L.cliproxyServer.update(d);t.setProxyConfig(a),t.setProxySuccess(!0),setTimeout(()=>t.setProxySuccess(!1),1500)}catch(a){t.setProxyConfig(x),t.setProxyError(a.message)}finally{t.setProxySaving(!1)}},[s.proxyConfig,t]),E=n.useCallback(async d=>{const{host:x,port:h,protocol:a,authToken:c}=d;if(!x){t.setProxyError("Host is required");return}try{t.setProxyTesting(!0),t.setProxyError(null),t.setProxyTestResult(null);const k=h?parseInt(h,10):void 0,l=await L.cliproxyServer.test({host:x,port:k||void 0,protocol:a,authToken:c||void 0});t.setProxyTestResult(l)}catch(k){t.setProxyError(k.message)}finally{t.setProxyTesting(!1)}},[t]);return{config:s.proxyConfig,loading:s.proxyLoading,saving:s.proxySaving,error:s.proxyError,success:s.proxySuccess,testResult:s.proxyTestResult,testing:s.proxyTesting,editedHost:g,setEditedHost:o,editedPort:u,setEditedPort:b,editedAuthToken:y,setEditedAuthToken:j,editedManagementKey:p,setEditedManagementKey:C,editedLocalPort:S,setEditedLocalPort:P,fetchConfig:w,saveConfig:A,testConnection:E}}function is({config:s,saving:t,displayLocalPort:g,setEditedLocalPort:o,onSaveLocalPort:u,onSaveConfig:b}){const{t:y}=ae(),j=s.local;return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:y("settingsProxy.localProxy")}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:y("settingsProxy.port")}),e.jsx(B,{type:"text",inputMode:"numeric",value:g,onChange:p=>o(p.target.value.replace(/\D/g,"")),onBlur:u,placeholder:`${U}`,className:"font-mono max-w-32",disabled:t})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:y("settingsProxy.autoStart")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:y("settingsProxy.localAutoStartDesc")})]}),e.jsx(D,{checked:j.auto_start??!0,onCheckedChange:p=>b({local:{...j,auto_start:p}}),disabled:t})]})]})]})}function ls({config:s,saving:t,testing:g,testResult:o,displayHost:u,displayPort:b,displayAuthToken:y,displayManagementKey:j,setEditedHost:p,setEditedPort:C,setEditedAuthToken:S,setEditedManagementKey:P,onSaveHost:w,onSavePort:A,onSaveAuthToken:E,onSaveManagementKey:d,onSaveConfig:x,onTestConnection:h}){const{t:a}=ae(),c=s.remote,k=l=>l==="https"?443:U;return e.jsxs("div",{className:"space-y-4 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("h4",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(he,{className:"w-4 h-4"}),a("settingsProxy.remoteConfigTitle")]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.host")}),e.jsx(B,{value:u,onChange:l=>p(l.target.value),onBlur:w,placeholder:a("settingsProxy.hostPlaceholder"),className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"text-sm text-muted-foreground",children:[a("settingsProxy.port")," ",e.jsxs("span",{className:"text-xs opacity-70",children:["(",a("settingsProxy.defaultPort",{value:k(s.remote.protocol||"http")}),")"]})]}),e.jsx(B,{type:"text",inputMode:"numeric",value:b,onChange:l=>C(l.target.value.replace(/\D/g,"")),onBlur:A,placeholder:a("settingsProxy.portPlaceholder",{value:k(s.remote.protocol||"http")}),className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.protocol")}),e.jsxs(He,{value:s.remote.protocol||"http",onValueChange:l=>x({remote:{...c,protocol:l}}),disabled:t,children:[e.jsx(Ue,{children:e.jsx(ze,{})}),e.jsxs(We,{children:[e.jsx(ue,{value:"http",children:a("settingsProxy.http")}),e.jsx(ue,{value:"https",children:a("settingsProxy.https")})]})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.apiKeyOptional")}),e.jsx(B,{type:"password",value:y,onChange:l=>S(l.target.value),onBlur:E,placeholder:a("settingsProxy.apiKeyPlaceholder"),className:"font-mono",disabled:t}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("settingsProxy.apiKeyDesc")})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.managementKeyOptional")}),e.jsx(B,{type:"password",value:j,onChange:l=>P(l.target.value),onBlur:d,placeholder:a("settingsProxy.managementKeyPlaceholder"),className:"font-mono",disabled:t}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("settingsProxy.managementKeyDesc")})]}),e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx(H,{onClick:h,disabled:g||!u,variant:"outline",className:"w-full",children:g?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-4 h-4 mr-2 animate-spin"}),a("settingsProxy.testing")]}):e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"w-4 h-4 mr-2"}),a("settingsProxy.testConnection")]})}),o&&e.jsx("div",{className:`p-3 rounded-md ${o.reachable?"bg-green-50 border border-green-200 dark:bg-green-900/20 dark:border-green-900/50":"bg-red-50 border border-red-200 dark:bg-red-900/20 dark:border-red-900/50"}`,children:e.jsx("div",{className:"flex items-center gap-2",children:o.reachable?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),e.jsx("span",{className:"text-sm font-medium text-green-700 dark:text-green-300",children:a("settingsProxy.connectedLatency",{value:o.latencyMs})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Qe,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),e.jsx("span",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:o.error||a("settingsProxy.connectionFailed")})]})})})]})]})}const pe="ccs_debug_mode",cs=["kiro","ghcp"];function ds(s){return s.trim().replace(/\s+/g," ").toUpperCase()}function Cs(){const{t:s}=ae(),{config:t,loading:g,saving:o,error:u,success:b,testResult:y,testing:j,editedHost:p,setEditedHost:C,editedPort:S,setEditedPort:P,editedAuthToken:w,setEditedAuthToken:A,editedManagementKey:E,setEditedManagementKey:d,editedLocalPort:x,setEditedLocalPort:h,fetchConfig:a,saveConfig:c,testConnection:k}=ns(),{fetchRawConfig:l}=Ye(),[_,be]=n.useState(()=>{try{return localStorage.getItem(pe)==="true"}catch{return!1}}),[je,z]=n.useState(!1),[Pe,oe]=n.useState(!0),[f,ne]=n.useState(!1),[ke,R]=n.useState(!1),[ie,I]=n.useState(""),K=n.useRef(!1),W=ds(ie)===V,ve=r=>{be(r);try{localStorage.setItem(pe,String(r))}catch{}},Y=n.useCallback(async()=>{try{oe(!0);const r=await fetch("/api/settings/auth/antigravity-risk");if(!r.ok)throw new Error(s("settingsProxy.failedLoadAgyMode"));const i=await r.json();z(i.antigravityAckBypass===!0)}catch(r){T.error(r instanceof Error?r.message:s("settingsProxy.failedLoadAgyMode")),z(!1)}finally{oe(!1)}},[s]),$=n.useCallback(async r=>{if(!(K.current||f||o))try{K.current=!0,ne(!0);const i=await fetch("/api/settings/auth/antigravity-risk",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({antigravityAckBypass:r})}),O=await i.json();if(!i.ok)throw new Error(O.error||s("settingsProxy.failedUpdateAgyMode"));const Fe=O.antigravityAckBypass===!0,me=await fetch("/api/settings/auth/antigravity-risk",{cache:"no-store"});if(!me.ok)throw new Error(s("settingsProxy.failedVerifyAgyMode"));const ge=(await me.json()).antigravityAckBypass===!0;if(ge!==r)throw new Error(s("settingsProxy.notPersistedAgyMode"));z(ge&&Fe),R(!1),I(""),T.success(s(r?"settingsProxy.agyModeEnabled":"settingsProxy.agyModeDisabled")),await l()}catch(i){T.error(i instanceof Error?i.message:s("settingsProxy.failedUpdateAgyMode"))}finally{K.current=!1,ne(!1)}},[f,l,o,s]),Ne=n.useCallback(r=>{if(!(K.current||f||o)){if(r){R(!0);return}R(!1),I(""),$(!1)}},[f,$,o]),Ce=n.useCallback(()=>{if(!W){T.error(s("settingsProxy.typePhraseToContinue",{value:V}));return}$(!0)},[W,$,s]),[v,G]=n.useState("plus"),[Se,we]=n.useState(!1),X=Ge(),{data:Ae}=Xe(),le=Ae?.running??!1,q=n.useCallback(async()=>{try{const r=await L.cliproxyServer.getBackend();G(r.backend)}catch(r){console.error("[Proxy] Failed to fetch backend:",r)}},[]),J=n.useCallback(async()=>{try{const i=(await L.cliproxy.list()).variants.some(O=>cs.includes(O.provider));we(i)}catch(r){console.error("[Proxy] Failed to check variants:",r)}},[]),ce=r=>{const i=v;G(r),X.mutate({backend:r},{onError:()=>{G(i)}})};if(n.useEffect(()=>{if(_&&t){const r={...t,remote:{...t.remote,auth_token:t.remote.auth_token?"[REDACTED]":void 0,management_key:t.remote.management_key?"[REDACTED]":void 0}};console.log("[CCS Debug] Debug mode enabled - proxy config:",r)}},[_,t]),n.useEffect(()=>{a(),Y(),l(),q(),J()},[a,Y,l,q,J]),g||!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(re,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:s("settings.loading")})]})});const m=t.remote.enabled??!1,F=!m&&le,N=t.remote,M=t.fallback,Ee=t.remote.host??"",Te=t.remote.port!==void 0?t.remote.port.toString():"",Be=t.remote.auth_token??"",Me=t.remote.management_key??"",De=(t.local.port??U).toString(),Q=p??Ee,Z=S??Te,ee=w??Be,de=E??Me,xe=x??De,Le=()=>{const r=p??Q;r!==t.remote.host&&c({remote:{...N,host:r}}),C(null)},_e=()=>{const r=(S??Z).trim();if(r===""){t.remote.port!==void 0&&c({remote:{...N,port:void 0}}),P(null);return}const i=Number(r);if(!Number.isInteger(i)||i<1||i>65535){T.error(s("settingsProxy.invalidPortOrEmpty")),P(null);return}i!==t.remote.port&&c({remote:{...N,port:i}}),P(null)},Re=()=>{const r=w??ee;r!==t.remote.auth_token&&c({remote:{...N,auth_token:r}}),A(null)},Ie=()=>{const r=E??de;r!==t.remote.management_key&&c({remote:{...N,management_key:r||void 0}}),d(null)},Ke=()=>{const r=(x??xe).trim(),i=r===""?U:Number(r);if(!Number.isInteger(i)||i<1||i>65535){T.error(s("settingsProxy.invalidLocalPort")),h(null);return}i!==t.local.port&&c({local:{...t.local,port:i}}),h(null)},$e=()=>{k({host:Q,port:Z,protocol:t.remote.protocol||"http",authToken:ee})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${u||b?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[u&&e.jsxs(se,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(Ze,{className:"h-4 w-4"}),e.jsx(te,{children:u})]}),b&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(fe,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:s("settings.saved")})]})]}),e.jsx(qe,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsProxy.description",{backend:s(v==="plus"?"settingsProxy.backendPlus":"settingsProxy.backend")})}),!m&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsProxy.instanceStatus")}),e.jsx(os,{})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsProxy.connectionMode")}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>c({remote:{...N,enabled:!1}}),disabled:o,className:`p-4 rounded-lg border-2 text-left transition-all ${m?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(es,{className:`w-5 h-5 ${m?"text-muted-foreground":"text-primary"}`}),e.jsx("span",{className:"font-medium",children:s("settingsProxy.local")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.localDesc",{backend:s(v==="plus"?"settingsProxy.backendPlus":"settingsProxy.backend")})})]}),e.jsxs("button",{onClick:()=>c({remote:{...N,enabled:!0}}),disabled:o,className:`p-4 rounded-lg border-2 text-left transition-all ${m?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(he,{className:`w-5 h-5 ${m?"text-primary":"text-muted-foreground"}`}),e.jsx("span",{className:"font-medium",children:s("settingsProxy.remote")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.remoteDesc",{backend:s(v==="plus"?"settingsProxy.backendPlus":"settingsProxy.backend")})})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(ss,{className:"w-4 h-4"}),s("settingsProxy.backendBinary")]}),!m&&le&&e.jsxs(se,{className:"py-2 border-amber-200 bg-amber-50 dark:border-amber-900/50 dark:bg-amber-900/20 [&>svg]:top-2.5",children:[e.jsx(ye,{className:"h-4 w-4 text-amber-600"}),e.jsx(te,{className:"text-amber-700 dark:text-amber-400",children:s("settingsProxy.stopProxyToSwitch")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>ce("plus"),disabled:X.isPending||F,className:`p-4 rounded-lg border-2 text-left transition-all ${v==="plus"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${F?"opacity-60 cursor-not-allowed":""}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("span",{className:"font-medium",children:s("settingsProxy.backendPlusApi")}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-400",children:s("settingsProxy.default")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.plusDesc")})]}),e.jsxs("button",{onClick:()=>ce("original"),disabled:X.isPending||F,className:`p-4 rounded-lg border-2 text-left transition-all ${v==="original"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${F?"opacity-60 cursor-not-allowed":""}`,children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsx("span",{className:"font-medium",children:s("settingsProxy.backendApi")})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.originalDesc")})]})]}),v==="original"&&Se&&e.jsxs(se,{variant:"destructive",className:"py-2",children:[e.jsx(ye,{className:"h-4 w-4"}),e.jsx(te,{children:s("settingsProxy.variantsIncompatible")})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(ts,{className:"w-4 h-4 text-amber-700 dark:text-amber-300"}),s("settingsProxy.safety")]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-amber-400/35 bg-amber-50/70 p-4 dark:border-amber-800/60 dark:bg-amber-950/25",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.agyModeTitle")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.agyModeDesc")})]}),e.jsx(D,{"aria-labelledby":"agy-power-user-mode-label","aria-describedby":"agy-power-user-mode-description",checked:je,disabled:Pe||f||o,onCheckedChange:Ne})]}),e.jsx("p",{id:"agy-power-user-mode-description",className:"text-xs text-amber-800/90 dark:text-amber-200/90",children:s("settingsProxy.agyWarning")}),ke&&e.jsxs("div",{className:"space-y-3 rounded-lg border border-rose-500/40 bg-rose-500/[0.08] p-3.5",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs font-semibold tracking-wide text-rose-900 dark:text-rose-200",children:s("settingsProxy.finalConfirm")}),e.jsx("p",{className:"text-xs leading-relaxed text-rose-800/95 dark:text-rose-200/90",children:s("settingsProxy.finalConfirmDesc")})]}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border border-rose-400/30 bg-rose-500/10 p-2.5",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-rose-900 dark:text-rose-200",children:s("settingsProxy.step1")}),e.jsxs("a",{href:"https://github.com/kaitranntt/ccs/issues/509",target:"_blank",rel:"noreferrer",className:"mt-1 inline-flex items-center gap-1.5 text-xs font-medium text-rose-800 underline decoration-rose-500/60 underline-offset-2 transition-colors hover:text-rose-700 dark:text-rose-200",children:[s("settingsProxy.readIssue"),e.jsx(rs,{className:"h-3.5 w-3.5"})]})]}),e.jsxs("div",{className:"rounded-md border border-rose-400/30 bg-rose-500/10 p-2.5",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-rose-900 dark:text-rose-200",children:s("settingsProxy.step2")}),e.jsxs("p",{className:"mt-1 text-xs text-rose-800/95 dark:text-rose-200/90",children:[s("settingsProxy.typePrefix")," ",e.jsx("code",{className:"rounded bg-background/80 px-1 py-0.5 font-mono",children:V})," ",s("settingsProxy.typeSuffix")]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{value:ie,onChange:r=>I(r.target.value),placeholder:V,disabled:f||o,className:"font-mono text-xs","aria-label":s("settingsProxy.typePhraseAria")}),e.jsx("p",{className:"text-[11px] text-rose-800/90 dark:text-rose-200/80",children:s("settingsProxy.exactPhrase")})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(H,{variant:"outline",size:"sm",onClick:()=>{R(!1),I("")},disabled:f||o,children:s("settingsBackups.cancel")}),e.jsx(H,{size:"sm",variant:"destructive",onClick:Ce,disabled:!W||f||o,children:s("settingsProxy.enableAgyMode")})]})]}),e.jsx("span",{id:"agy-power-user-mode-label",className:"sr-only",children:s("settingsProxy.toggleAgyMode")})]})]}),m&&e.jsx(ls,{config:t,saving:o,testing:j,testResult:y,displayHost:Q,displayPort:Z,displayAuthToken:ee,displayManagementKey:de,setEditedHost:C,setEditedPort:P,setEditedAuthToken:A,setEditedManagementKey:d,onSaveHost:Le,onSavePort:_e,onSaveAuthToken:Re,onSaveManagementKey:Ie,onSaveConfig:c,onTestConnection:$e}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsProxy.fallbackSettings")}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.enableFallback")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.enableFallbackDesc")})]}),e.jsx(D,{checked:M.enabled??!0,onCheckedChange:r=>c({fallback:{...M,enabled:r}}),disabled:o||!m})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.autoStartLocal")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.autoStartLocalDesc")})]}),e.jsx(D,{checked:M.auto_start??!1,onCheckedChange:r=>c({fallback:{...M,auto_start:r}}),disabled:o||!m||!M.enabled})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(as,{className:"w-4 h-4"}),s("settingsProxy.advanced")]}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.debugMode")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.debugModeDesc")})]}),e.jsx(D,{checked:_,onCheckedChange:ve,disabled:o})]}),_&&e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 pl-0.5",children:s("settingsProxy.debugModeEnabled")})]})]}),!m&&e.jsx(is,{config:t,saving:o,displayLocalPort:xe,setEditedLocalPort:h,onSaveLocalPort:Ke,onSaveConfig:c})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(H,{variant:"outline",size:"sm",onClick:()=>{a(),Y(),l(),q(),J()},disabled:g||o||f,className:"w-full",children:[e.jsx(re,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),s("settings.refresh")]})})]})}export{Cs as default};
|
|
1
|
+
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as n}from"./react-vendor-CNOkPC89.js";import{bh as Oe,bi as He,Y as _,a as ae,I as B,r as Ve,s as Ue,t as ze,v as We,w as ue,d as V,bj as Ye,bk as Ge,bl as qe,b3 as se,b5 as te,n as Je}from"./index-sCtK1kDn.js";import{S as D}from"./switch-BeqpDfK5.js";import{C as U}from"./default-ports-1QQSffYX.js";import{aZ as he,R as re,g as Xe,v as fe,W as Ze,x as Qe,a_ as es,a$ as ss,T as ye,au as ts,o as rs,b0 as as}from"./icons-DR-ORtNe.js";import{P as os}from"./proxy-status-widget-C8cOlsqE.js";import{R as H}from"./antigravity-responsibility-constants-Bvh4Ybz0.js";import{t as T}from"./notifications-B2HqRBj7.js";import"./tanstack-B8i0evp-.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-CwEJfEUX.js";function ns(){const{state:s}=Oe(),t=He(),[g,o]=n.useState(null),[u,b]=n.useState(null),[y,j]=n.useState(null),[p,C]=n.useState(null),[S,P]=n.useState(null),w=n.useCallback(async()=>{try{t.setProxyLoading(!0),t.setProxyError(null);const d=await _.cliproxyServer.get();t.setProxyConfig(d)}catch(d){t.setProxyError(d.message)}finally{t.setProxyLoading(!1)}},[t]),A=n.useCallback(async d=>{const x=s.proxyConfig;if(!x)return;const h={remote:{...x.remote,...d.remote},fallback:{...x.fallback,...d.fallback},local:{...x.local,...d.local}};t.setProxyConfig(h),t.setProxyTestResult(null);try{t.setProxySaving(!0),t.setProxyError(null);const a=await _.cliproxyServer.update(d);t.setProxyConfig(a),t.setProxySuccess(!0),setTimeout(()=>t.setProxySuccess(!1),1500)}catch(a){t.setProxyConfig(x),t.setProxyError(a.message)}finally{t.setProxySaving(!1)}},[s.proxyConfig,t]),E=n.useCallback(async d=>{const{host:x,port:h,protocol:a,authToken:c}=d;if(!x){t.setProxyError("Host is required");return}try{t.setProxyTesting(!0),t.setProxyError(null),t.setProxyTestResult(null);const k=h?parseInt(h,10):void 0,l=await _.cliproxyServer.test({host:x,port:k||void 0,protocol:a,authToken:c||void 0});t.setProxyTestResult(l)}catch(k){t.setProxyError(k.message)}finally{t.setProxyTesting(!1)}},[t]);return{config:s.proxyConfig,loading:s.proxyLoading,saving:s.proxySaving,error:s.proxyError,success:s.proxySuccess,testResult:s.proxyTestResult,testing:s.proxyTesting,editedHost:g,setEditedHost:o,editedPort:u,setEditedPort:b,editedAuthToken:y,setEditedAuthToken:j,editedManagementKey:p,setEditedManagementKey:C,editedLocalPort:S,setEditedLocalPort:P,fetchConfig:w,saveConfig:A,testConnection:E}}function is({config:s,saving:t,displayLocalPort:g,setEditedLocalPort:o,onSaveLocalPort:u,onSaveConfig:b}){const{t:y}=ae(),j=s.local;return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:y("settingsProxy.localProxy")}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:y("settingsProxy.port")}),e.jsx(B,{type:"text",inputMode:"numeric",value:g,onChange:p=>o(p.target.value.replace(/\D/g,"")),onBlur:u,placeholder:`${U}`,className:"font-mono max-w-32",disabled:t})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:y("settingsProxy.autoStart")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:y("settingsProxy.localAutoStartDesc")})]}),e.jsx(D,{checked:j.auto_start??!0,onCheckedChange:p=>b({local:{...j,auto_start:p}}),disabled:t})]})]})]})}function ls({config:s,saving:t,testing:g,testResult:o,displayHost:u,displayPort:b,displayAuthToken:y,displayManagementKey:j,setEditedHost:p,setEditedPort:C,setEditedAuthToken:S,setEditedManagementKey:P,onSaveHost:w,onSavePort:A,onSaveAuthToken:E,onSaveManagementKey:d,onSaveConfig:x,onTestConnection:h}){const{t:a}=ae(),c=s.remote,k=l=>l==="https"?443:U;return e.jsxs("div",{className:"space-y-4 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("h4",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(he,{className:"w-4 h-4"}),a("settingsProxy.remoteConfigTitle")]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.host")}),e.jsx(B,{value:u,onChange:l=>p(l.target.value),onBlur:w,placeholder:a("settingsProxy.hostPlaceholder"),className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"text-sm text-muted-foreground",children:[a("settingsProxy.port")," ",e.jsxs("span",{className:"text-xs opacity-70",children:["(",a("settingsProxy.defaultPort",{value:k(s.remote.protocol||"http")}),")"]})]}),e.jsx(B,{type:"text",inputMode:"numeric",value:b,onChange:l=>C(l.target.value.replace(/\D/g,"")),onBlur:A,placeholder:a("settingsProxy.portPlaceholder",{value:k(s.remote.protocol||"http")}),className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.protocol")}),e.jsxs(Ve,{value:s.remote.protocol||"http",onValueChange:l=>x({remote:{...c,protocol:l}}),disabled:t,children:[e.jsx(Ue,{children:e.jsx(ze,{})}),e.jsxs(We,{children:[e.jsx(ue,{value:"http",children:a("settingsProxy.http")}),e.jsx(ue,{value:"https",children:a("settingsProxy.https")})]})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.apiKeyOptional")}),e.jsx(B,{type:"password",value:y,onChange:l=>S(l.target.value),onBlur:E,placeholder:a("settingsProxy.apiKeyPlaceholder"),className:"font-mono",disabled:t}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("settingsProxy.apiKeyDesc")})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:a("settingsProxy.managementKeyOptional")}),e.jsx(B,{type:"password",value:j,onChange:l=>P(l.target.value),onBlur:d,placeholder:a("settingsProxy.managementKeyPlaceholder"),className:"font-mono",disabled:t}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("settingsProxy.managementKeyDesc")})]}),e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx(V,{onClick:h,disabled:g||!u,variant:"outline",className:"w-full",children:g?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-4 h-4 mr-2 animate-spin"}),a("settingsProxy.testing")]}):e.jsxs(e.Fragment,{children:[e.jsx(Xe,{className:"w-4 h-4 mr-2"}),a("settingsProxy.testConnection")]})}),o&&e.jsx("div",{className:`p-3 rounded-md ${o.reachable?"bg-green-50 border border-green-200 dark:bg-green-900/20 dark:border-green-900/50":"bg-red-50 border border-red-200 dark:bg-red-900/20 dark:border-red-900/50"}`,children:e.jsx("div",{className:"flex items-center gap-2",children:o.reachable?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),e.jsx("span",{className:"text-sm font-medium text-green-700 dark:text-green-300",children:a("settingsProxy.connectedLatency",{value:o.latencyMs})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ze,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),e.jsx("span",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:o.error||a("settingsProxy.connectionFailed")})]})})})]})]})}const pe="ccs_debug_mode",cs=["kiro","ghcp"];function ds(s){return s.trim().replace(/\s+/g," ").toUpperCase()}function Ss(){const{t:s}=ae(),{config:t,loading:g,saving:o,error:u,success:b,testResult:y,testing:j,editedHost:p,setEditedHost:C,editedPort:S,setEditedPort:P,editedAuthToken:w,setEditedAuthToken:A,editedManagementKey:E,setEditedManagementKey:d,editedLocalPort:x,setEditedLocalPort:h,fetchConfig:a,saveConfig:c,testConnection:k}=ns(),{fetchRawConfig:l}=Ye(),[L,be]=n.useState(()=>{try{return localStorage.getItem(pe)==="true"}catch{return!1}}),[je,z]=n.useState(!1),[Pe,oe]=n.useState(!0),[f,ne]=n.useState(!1),[ke,R]=n.useState(!1),[ie,I]=n.useState(""),K=n.useRef(!1),W=ds(ie)===H,ve=r=>{be(r);try{localStorage.setItem(pe,String(r))}catch{}},Y=n.useCallback(async()=>{try{oe(!0);const r=await fetch("/api/settings/auth/antigravity-risk");if(!r.ok)throw new Error(s("settingsProxy.failedLoadAgyMode"));const i=await r.json();z(i.antigravityAckBypass===!0)}catch(r){T.error(r instanceof Error?r.message:s("settingsProxy.failedLoadAgyMode")),z(!1)}finally{oe(!1)}},[s]),$=n.useCallback(async r=>{if(!(K.current||f||o))try{K.current=!0,ne(!0);const i=await fetch("/api/settings/auth/antigravity-risk",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({antigravityAckBypass:r})}),O=await i.json();if(!i.ok)throw new Error(O.error||s("settingsProxy.failedUpdateAgyMode"));const Fe=O.antigravityAckBypass===!0,me=await fetch("/api/settings/auth/antigravity-risk",{cache:"no-store"});if(!me.ok)throw new Error(s("settingsProxy.failedVerifyAgyMode"));const ge=(await me.json()).antigravityAckBypass===!0;if(ge!==r)throw new Error(s("settingsProxy.notPersistedAgyMode"));z(ge&&Fe),R(!1),I(""),T.success(s(r?"settingsProxy.agyModeEnabled":"settingsProxy.agyModeDisabled")),await l()}catch(i){T.error(i instanceof Error?i.message:s("settingsProxy.failedUpdateAgyMode"))}finally{K.current=!1,ne(!1)}},[f,l,o,s]),Ne=n.useCallback(r=>{if(!(K.current||f||o)){if(r){R(!0);return}R(!1),I(""),$(!1)}},[f,$,o]),Ce=n.useCallback(()=>{if(!W){T.error(s("settingsProxy.typePhraseToContinue",{value:H}));return}$(!0)},[W,$,s]),[v,G]=n.useState("plus"),[Se,we]=n.useState(!1),q=Ge(),{data:Ae}=qe(),le=Ae?.running??!1,J=n.useCallback(async()=>{try{const r=await _.cliproxyServer.getBackend();G(r.backend)}catch(r){console.error("[Proxy] Failed to fetch backend:",r)}},[]),X=n.useCallback(async()=>{try{const i=(await _.cliproxy.list()).variants.some(O=>cs.includes(O.provider));we(i)}catch(r){console.error("[Proxy] Failed to check variants:",r)}},[]),ce=r=>{const i=v;G(r),q.mutate({backend:r},{onError:()=>{G(i)}})};if(n.useEffect(()=>{if(L&&t){const r={...t,remote:{...t.remote,auth_token:t.remote.auth_token?"[REDACTED]":void 0,management_key:t.remote.management_key?"[REDACTED]":void 0}};console.log("[CCS Debug] Debug mode enabled - proxy config:",r)}},[L,t]),n.useEffect(()=>{a(),Y(),l(),J(),X()},[a,Y,l,J,X]),g||!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(re,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:s("settings.loading")})]})});const m=t.remote.enabled??!1,F=!m&&le,N=t.remote,M=t.fallback,Ee=t.remote.host??"",Te=t.remote.port!==void 0?t.remote.port.toString():"",Be=t.remote.auth_token??"",Me=t.remote.management_key??"",De=(t.local.port??U).toString(),Z=p??Ee,Q=S??Te,ee=w??Be,de=E??Me,xe=x??De,_e=()=>{const r=p??Z;r!==t.remote.host&&c({remote:{...N,host:r}}),C(null)},Le=()=>{const r=(S??Q).trim();if(r===""){t.remote.port!==void 0&&c({remote:{...N,port:void 0}}),P(null);return}const i=Number(r);if(!Number.isInteger(i)||i<1||i>65535){T.error(s("settingsProxy.invalidPortOrEmpty")),P(null);return}i!==t.remote.port&&c({remote:{...N,port:i}}),P(null)},Re=()=>{const r=w??ee;r!==t.remote.auth_token&&c({remote:{...N,auth_token:r}}),A(null)},Ie=()=>{const r=E??de;r!==t.remote.management_key&&c({remote:{...N,management_key:r||void 0}}),d(null)},Ke=()=>{const r=(x??xe).trim(),i=r===""?U:Number(r);if(!Number.isInteger(i)||i<1||i>65535){T.error(s("settingsProxy.invalidLocalPort")),h(null);return}i!==t.local.port&&c({local:{...t.local,port:i}}),h(null)},$e=()=>{k({host:Z,port:Q,protocol:t.remote.protocol||"http",authToken:ee})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${u||b?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[u&&e.jsxs(se,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(Qe,{className:"h-4 w-4"}),e.jsx(te,{children:u})]}),b&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(fe,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:s("settings.saved")})]})]}),e.jsx(Je,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("settingsProxy.description",{backend:s(v==="plus"?"settingsProxy.backendPlus":"settingsProxy.backend")})}),!m&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsProxy.instanceStatus")}),e.jsx(os,{})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsProxy.connectionMode")}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>c({remote:{...N,enabled:!1}}),disabled:o,className:`p-4 rounded-lg border-2 text-left transition-all ${m?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(es,{className:`w-5 h-5 ${m?"text-muted-foreground":"text-primary"}`}),e.jsx("span",{className:"font-medium",children:s("settingsProxy.local")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.localDesc",{backend:s(v==="plus"?"settingsProxy.backendPlus":"settingsProxy.backend")})})]}),e.jsxs("button",{onClick:()=>c({remote:{...N,enabled:!0}}),disabled:o,className:`p-4 rounded-lg border-2 text-left transition-all ${m?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(he,{className:`w-5 h-5 ${m?"text-primary":"text-muted-foreground"}`}),e.jsx("span",{className:"font-medium",children:s("settingsProxy.remote")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.remoteDesc",{backend:s(v==="plus"?"settingsProxy.backendPlus":"settingsProxy.backend")})})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(ss,{className:"w-4 h-4"}),s("settingsProxy.backendBinary")]}),!m&&le&&e.jsxs(se,{className:"py-2 border-amber-200 bg-amber-50 dark:border-amber-900/50 dark:bg-amber-900/20 [&>svg]:top-2.5",children:[e.jsx(ye,{className:"h-4 w-4 text-amber-600"}),e.jsx(te,{className:"text-amber-700 dark:text-amber-400",children:s("settingsProxy.stopProxyToSwitch")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>ce("plus"),disabled:q.isPending||F,className:`p-4 rounded-lg border-2 text-left transition-all ${v==="plus"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${F?"opacity-60 cursor-not-allowed":""}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("span",{className:"font-medium",children:s("settingsProxy.backendPlusApi")}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-400",children:s("settingsProxy.default")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.plusDesc")})]}),e.jsxs("button",{onClick:()=>ce("original"),disabled:q.isPending||F,className:`p-4 rounded-lg border-2 text-left transition-all ${v==="original"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${F?"opacity-60 cursor-not-allowed":""}`,children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsx("span",{className:"font-medium",children:s("settingsProxy.backendApi")})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.originalDesc")})]})]}),v==="original"&&Se&&e.jsxs(se,{variant:"destructive",className:"py-2",children:[e.jsx(ye,{className:"h-4 w-4"}),e.jsx(te,{children:s("settingsProxy.variantsIncompatible")})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(ts,{className:"w-4 h-4 text-amber-700 dark:text-amber-300"}),s("settingsProxy.safety")]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-amber-400/35 bg-amber-50/70 p-4 dark:border-amber-800/60 dark:bg-amber-950/25",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.agyModeTitle")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.agyModeDesc")})]}),e.jsx(D,{"aria-labelledby":"agy-power-user-mode-label","aria-describedby":"agy-power-user-mode-description",checked:je,disabled:Pe||f||o,onCheckedChange:Ne})]}),e.jsx("p",{id:"agy-power-user-mode-description",className:"text-xs text-amber-800/90 dark:text-amber-200/90",children:s("settingsProxy.agyWarning")}),ke&&e.jsxs("div",{className:"space-y-3 rounded-lg border border-rose-500/40 bg-rose-500/[0.08] p-3.5",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs font-semibold tracking-wide text-rose-900 dark:text-rose-200",children:s("settingsProxy.finalConfirm")}),e.jsx("p",{className:"text-xs leading-relaxed text-rose-800/95 dark:text-rose-200/90",children:s("settingsProxy.finalConfirmDesc")})]}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border border-rose-400/30 bg-rose-500/10 p-2.5",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-rose-900 dark:text-rose-200",children:s("settingsProxy.step1")}),e.jsxs("a",{href:"https://github.com/kaitranntt/ccs/issues/509",target:"_blank",rel:"noreferrer",className:"mt-1 inline-flex items-center gap-1.5 text-xs font-medium text-rose-800 underline decoration-rose-500/60 underline-offset-2 transition-colors hover:text-rose-700 dark:text-rose-200",children:[s("settingsProxy.readIssue"),e.jsx(rs,{className:"h-3.5 w-3.5"})]})]}),e.jsxs("div",{className:"rounded-md border border-rose-400/30 bg-rose-500/10 p-2.5",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-rose-900 dark:text-rose-200",children:s("settingsProxy.step2")}),e.jsxs("p",{className:"mt-1 text-xs text-rose-800/95 dark:text-rose-200/90",children:[s("settingsProxy.typePrefix")," ",e.jsx("code",{className:"rounded bg-background/80 px-1 py-0.5 font-mono",children:H})," ",s("settingsProxy.typeSuffix")]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{value:ie,onChange:r=>I(r.target.value),placeholder:H,disabled:f||o,className:"font-mono text-xs","aria-label":s("settingsProxy.typePhraseAria")}),e.jsx("p",{className:"text-[11px] text-rose-800/90 dark:text-rose-200/80",children:s("settingsProxy.exactPhrase")})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(V,{variant:"outline",size:"sm",onClick:()=>{R(!1),I("")},disabled:f||o,children:s("settingsBackups.cancel")}),e.jsx(V,{size:"sm",variant:"destructive",onClick:Ce,disabled:!W||f||o,children:s("settingsProxy.enableAgyMode")})]})]}),e.jsx("span",{id:"agy-power-user-mode-label",className:"sr-only",children:s("settingsProxy.toggleAgyMode")})]})]}),m&&e.jsx(ls,{config:t,saving:o,testing:j,testResult:y,displayHost:Z,displayPort:Q,displayAuthToken:ee,displayManagementKey:de,setEditedHost:C,setEditedPort:P,setEditedAuthToken:A,setEditedManagementKey:d,onSaveHost:_e,onSavePort:Le,onSaveAuthToken:Re,onSaveManagementKey:Ie,onSaveConfig:c,onTestConnection:$e}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:s("settingsProxy.fallbackSettings")}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.enableFallback")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.enableFallbackDesc")})]}),e.jsx(D,{checked:M.enabled??!0,onCheckedChange:r=>c({fallback:{...M,enabled:r}}),disabled:o||!m})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.autoStartLocal")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.autoStartLocalDesc")})]}),e.jsx(D,{checked:M.auto_start??!1,onCheckedChange:r=>c({fallback:{...M,auto_start:r}}),disabled:o||!m||!M.enabled})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(as,{className:"w-4 h-4"}),s("settingsProxy.advanced")]}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:s("settingsProxy.debugMode")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("settingsProxy.debugModeDesc")})]}),e.jsx(D,{checked:L,onCheckedChange:ve,disabled:o})]}),L&&e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 pl-0.5",children:s("settingsProxy.debugModeEnabled")})]})]}),!m&&e.jsx(is,{config:t,saving:o,displayLocalPort:xe,setEditedLocalPort:h,onSaveLocalPort:Ke,onSaveConfig:c})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(V,{variant:"outline",size:"sm",onClick:()=>{a(),Y(),l(),J(),X()},disabled:g||o||f,className:"w-full",children:[e.jsx(re,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),s("settings.refresh")]})})]})}export{Ss as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as o}from"./react-vendor-CNOkPC89.js";import{a as q,b1 as J,b3 as X,d as I,n as Y,L as A,r as R,s as M,t as K,v as B,w as E,I as F}from"./index-tMnuUCFi.js";import{S as Q}from"./switch-Bog43RUy.js";import{R as $,x as Z,v as ee,a5 as se,O as te,r as re}from"./icons-DtwH984l.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const z={mode:"auto",tier_defaults:{opus:"high",sonnet:"medium",haiku:"low"},show_warnings:!0},U=1e4;function ie(){const[t,i]=o.useState(null),[b,d]=o.useState(!0),[_,N]=o.useState(!1),[p,g]=o.useState(null),[P,y]=o.useState(!1),f=o.useRef(void 0),w=o.useRef(!1),k=o.useCallback(async()=>{const r=new AbortController,c=setTimeout(()=>r.abort(),U);try{d(!0),g(null);const n=await fetch("/api/thinking",{signal:r.signal});if(clearTimeout(c),!n.ok)throw n.headers.get("content-type")?.includes("text/html")?new Error(`Server error (${n.status})`):new Error("Failed to load Thinking config");const m=await n.json();i(m.config||z),f.current=m.lastModified,w.current=!0}catch(n){clearTimeout(c),n.name==="AbortError"?g("Request timeout - please try again"):g(n.message)}finally{d(!1)}return()=>r.abort()},[]),l=o.useCallback(async r=>{if(!w.current||t===null){g("Cannot save settings before they load. Click Refresh and try again.");return}const c=t,n={...c,...r.mode!==void 0?{mode:r.mode}:{},...r.tier_defaults!==void 0?{tier_defaults:r.tier_defaults}:{},...r.show_warnings!==void 0?{show_warnings:r.show_warnings}:{}};r.clear_override||r.override===null?delete n.override:r.override!==void 0&&(n.override=r.override),r.clear_provider_overrides||r.provider_overrides===null?delete n.provider_overrides:r.provider_overrides!==void 0&&(n.provider_overrides=r.provider_overrides),i(n);const m=new AbortController,h=setTimeout(()=>m.abort(),U);try{N(!0),g(null);const x={...n,lastModified:f.current},u=await fetch("/api/thinking",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x),signal:m.signal});if(clearTimeout(h),!u.ok){if(u.headers.get("content-type")?.includes("text/html"))throw new Error(`Server error (${u.status})`);const s=await u.json();throw u.status===409?new Error("Config changed by another session. Refreshing..."):new Error(s.error||"Failed to save")}const v=await u.json();i(v.config),f.current=v.lastModified,y(!0),setTimeout(()=>y(!1),1500)}catch(x){clearTimeout(h),i(c),x.name==="AbortError"?g("Request timeout - please try again"):(g(x.message),x.message.includes("another session")&&setTimeout(()=>k(),1e3))}finally{N(!1)}},[t,k]),T=o.useCallback(r=>{l({mode:r})},[l]),C=o.useCallback((r,c)=>{const n=t?.tier_defaults||z.tier_defaults;l({tier_defaults:{...n,[r]:c}})},[t,l]),O=o.useCallback(r=>{l({show_warnings:r})},[l]),D=o.useCallback(r=>{if(r===void 0){l({override:null,clear_override:!0});return}l({override:r,clear_override:!1})},[l]),L=o.useCallback((r,c,n)=>{const m=t?.provider_overrides||{},h=m[r]||{};if(n===void 0){const{[c]:x,...u}=h,v=Object.keys(u).length>0?u:void 0,{[r]:S,...s}=m,a=v?{...s,[r]:v}:s;l({provider_overrides:Object.keys(a).length>0?a:null,clear_provider_overrides:Object.keys(a).length===0})}else l({provider_overrides:{...m,[r]:{...h,[c]:n}},clear_provider_overrides:!1})},[t,l]);return{config:t||z,loading:b,saving:_,error:p,success:P,fetchConfig:k,saveConfig:l,setMode:T,setTierDefault:C,setShowWarnings:O,setOverride:D,setProviderOverride:L}}const H=[{value:"minimal",label:"Minimal (512 tokens)"},{value:"low",label:"Low (1K tokens)"},{value:"medium",label:"Medium (8K tokens)"},{value:"high",label:"High (24K tokens)"},{value:"xhigh",label:"Extra High (32K tokens)"},{value:"auto",label:"Auto (dynamic)"}],ne=[{value:"__none__",label:"None (use CLI flags only)"},...H,{value:"__custom__",label:"Custom budget (number)"},{value:"off",label:"Off (disable thinking)"}],ae=["agy","gemini","codex"],G=0,V=1e5;function ve(){const{t}=q(),{config:i,loading:b,saving:d,error:_,success:N,fetchConfig:p,setMode:g,setTierDefault:P,setShowWarnings:y,setOverride:f,setProviderOverride:w}=ie(),[k,l]=o.useState(null),[T,C]=o.useState(""),[O,D]=o.useState([]),[L,r]=o.useState(null),c=o.useMemo(()=>Array.from(new Set([...ae,...Object.keys(i.provider_overrides??{}),...O])),[O,i.provider_overrides]),n=i.override===void 0?"__none__":typeof i.override=="number"||/^\d+$/.test(String(i.override))?"__custom__":String(i.override),m=typeof i.override=="number"||/^\d+$/.test(String(i.override??""))?String(i.override):"",h=L??m,x=Object.keys(i.provider_overrides??{}).length>0,u=k??x;o.useEffect(()=>{p()},[p]);const v=()=>{const s=T.trim().toLowerCase();s&&(c.includes(s)||D(a=>[...a,s]),C(""),l(!0))},S=()=>{const s=h.trim();if(!s){f(void 0);return}const a=Number.parseInt(s,10);Number.isNaN(a)||a<G||a>V||!/^\d+$/.test(s)||f(a)};return b?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx($,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:t("settings.loading")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${_||N?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[_&&e.jsx(J,{variant:"destructive",className:"py-2 shadow-lg",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-4 w-4"}),e.jsx(X,{children:_})]}),e.jsxs(I,{variant:"outline",size:"sm",onClick:p,className:"h-7 px-2 text-xs border-destructive/50 hover:bg-destructive/10",children:[e.jsx($,{className:"w-3 h-3 mr-1"}),t("sharedPage.retry")]})]})}),N&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:t("settings.saved")})]})]}),e.jsx(Y,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"w-5 h-5 text-primary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.description")})]}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800",children:[e.jsx(te,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsx("p",{className:"font-medium",children:t("settingsThinking.supportedProviders")}),e.jsxs("ul",{className:"mt-1 space-y-0.5 text-blue-600 dark:text-blue-400",children:[e.jsxs("li",{children:[t("settingsThinking.supportLine1Prefix")," ",e.jsx("strong",{children:"agy"}),","," ",e.jsx("strong",{children:"gemini"})," ",t("settingsThinking.supportLine1Suffix")]}),e.jsxs("li",{children:[t("settingsThinking.supportLine2Prefix")," ",e.jsx("strong",{children:"codex"})," ",t("settingsThinking.supportLine2SuffixPrefix"),e.jsx("code",{children:"--effort"}),t("settingsThinking.supportLine2SuffixPostfix")]}),e.jsxs("li",{children:[t("settingsThinking.supportLine3Prefix")," ",e.jsx("code",{children:"-high"}),t("settingsThinking.supportLine3Suffix")]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.modeTitle")}),e.jsx("div",{className:"space-y-2",children:["auto","off","manual"].map(s=>e.jsxs("div",{className:`flex items-center justify-between p-4 rounded-lg cursor-pointer transition-colors ${i.mode===s?"bg-primary/10 border border-primary/30":"bg-muted/50 hover:bg-muted/80"} ${d?"opacity-70 pointer-events-none":""}`,onClick:()=>{d||g(s)},children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium capitalize",children:s}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="auto"&&t("settingsThinking.modeAutoDesc"),s==="off"&&t("settingsThinking.modeOffDesc"),s==="manual"&&t("settingsThinking.modeManualDesc")]})]}),e.jsx("div",{className:`w-4 h-4 rounded-full border-2 ${i.mode===s?"bg-primary border-primary":"border-muted-foreground/50"}`})]},s))})]}),i.mode==="auto"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.tierDefaults")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.tierDefaultsDesc")}),e.jsx("div",{className:"space-y-3",children:["opus","sonnet","haiku"].map(s=>e.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-muted/30",children:[e.jsx(A,{className:"w-20 capitalize font-medium",children:s}),e.jsxs(R,{value:i.tier_defaults[s],onValueChange:a=>P(s,a),disabled:d,children:[e.jsx(M,{className:"flex-1",children:e.jsx(K,{})}),e.jsx(B,{children:H.map(a=>e.jsx(E,{value:a.value,children:a.label},a.value))})]})]},s))})]}),i.mode==="manual"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.persistentOverride")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.persistentOverrideDesc")}),e.jsxs(R,{value:n,onValueChange:s=>{if(s==="__none__"){f(void 0);return}if(s==="__custom__"){h||r("8192");return}r(null),f(s)},disabled:d,children:[e.jsx(M,{children:e.jsx(K,{})}),e.jsx(B,{children:ne.map(s=>e.jsx(E,{value:s.value,children:s.label},s.value))})]}),n==="__custom__"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{type:"number",min:G,max:V,value:h,onChange:s=>r(s.target.value),onBlur:S,disabled:d,placeholder:t("settingsThinking.enterCustomBudget")}),e.jsx(I,{type:"button",size:"sm",variant:"outline",onClick:S,disabled:d,children:t("settingsThinking.apply")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Range: ",G," to ",V]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 text-base font-medium w-full text-left",onClick:()=>l(s=>!(s??x)),disabled:d,children:[e.jsx(re,{className:`w-4 h-4 transition-transform ${u?"rotate-0":"-rotate-90"}`}),t("settingsThinking.providerOverrides",{count:Object.keys(i.provider_overrides??{}).length})]}),u&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.providerOverridesDesc")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{value:T,onChange:s=>C(s.target.value),disabled:d,placeholder:t("settingsThinking.addProviderPlaceholder")}),e.jsx(I,{type:"button",size:"sm",variant:"outline",onClick:v,disabled:d,children:t("settingsGlobalEnv.add")})]}),c.map(s=>e.jsxs("div",{className:"space-y-2 p-3 rounded-lg bg-muted/30",children:[e.jsx(A,{className:"capitalize font-medium text-sm",children:s}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:["opus","sonnet","haiku"].map(a=>{const W=i.provider_overrides?.[s]?.[a]||"__default__";return e.jsxs("div",{className:"space-y-1",children:[e.jsx(A,{className:"text-xs text-muted-foreground capitalize",children:a}),e.jsxs(R,{value:W,onValueChange:j=>w(s,a,j==="__default__"?void 0:j),disabled:d,children:[e.jsx(M,{className:"h-8 text-xs",children:e.jsx(K,{})}),e.jsxs(B,{children:[e.jsx(E,{value:"__default__",children:t("cursorPage.default")}),H.map(j=>e.jsx(E,{value:j.value,children:j.label},j.value))]})]})]},a)})})]},s))]})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:t("settingsThinking.showWarnings")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.showWarningsDesc")})]}),e.jsx(Q,{checked:i.show_warnings??!0,onCheckedChange:y,disabled:d})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:t("settingsThinking.cliEnvOverride")}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:["Override per session with flags or"," ",e.jsx("code",{className:"px-1.5 py-0.5 rounded bg-muted",children:"CCS_THINKING"})," env var. Priority: flag > env > config."]}),e.jsxs("div",{className:"space-y-1 text-sm font-mono text-muted-foreground",children:[e.jsx("p",{children:"ccs gemini --thinking high"}),e.jsx("p",{children:"ccs codex --effort xhigh"}),e.jsx("p",{children:'CCS_THINKING=high ccs codex "debug this"'}),e.jsx("p",{children:"ccs config thinking --mode auto"})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(I,{variant:"outline",size:"sm",onClick:p,disabled:b||d,className:"w-full",children:[e.jsx($,{className:`w-4 h-4 mr-2 ${b?"animate-spin":""}`}),t("settings.refresh")]})})]})}export{ve as default};
|
|
1
|
+
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as o}from"./react-vendor-CNOkPC89.js";import{a as q,b3 as J,b5 as X,d as I,n as Y,L as A,r as R,s as M,t as K,v as B,w as E,I as F}from"./index-sCtK1kDn.js";import{S as Q}from"./switch-BeqpDfK5.js";import{R as $,x as Z,v as ee,a5 as se,O as te,r as re}from"./icons-DR-ORtNe.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const z={mode:"auto",tier_defaults:{opus:"high",sonnet:"medium",haiku:"low"},show_warnings:!0},U=1e4;function ie(){const[t,i]=o.useState(null),[b,d]=o.useState(!0),[_,N]=o.useState(!1),[p,g]=o.useState(null),[P,y]=o.useState(!1),f=o.useRef(void 0),w=o.useRef(!1),k=o.useCallback(async()=>{const r=new AbortController,c=setTimeout(()=>r.abort(),U);try{d(!0),g(null);const n=await fetch("/api/thinking",{signal:r.signal});if(clearTimeout(c),!n.ok)throw n.headers.get("content-type")?.includes("text/html")?new Error(`Server error (${n.status})`):new Error("Failed to load Thinking config");const m=await n.json();i(m.config||z),f.current=m.lastModified,w.current=!0}catch(n){clearTimeout(c),n.name==="AbortError"?g("Request timeout - please try again"):g(n.message)}finally{d(!1)}return()=>r.abort()},[]),l=o.useCallback(async r=>{if(!w.current||t===null){g("Cannot save settings before they load. Click Refresh and try again.");return}const c=t,n={...c,...r.mode!==void 0?{mode:r.mode}:{},...r.tier_defaults!==void 0?{tier_defaults:r.tier_defaults}:{},...r.show_warnings!==void 0?{show_warnings:r.show_warnings}:{}};r.clear_override||r.override===null?delete n.override:r.override!==void 0&&(n.override=r.override),r.clear_provider_overrides||r.provider_overrides===null?delete n.provider_overrides:r.provider_overrides!==void 0&&(n.provider_overrides=r.provider_overrides),i(n);const m=new AbortController,h=setTimeout(()=>m.abort(),U);try{N(!0),g(null);const x={...n,lastModified:f.current},u=await fetch("/api/thinking",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x),signal:m.signal});if(clearTimeout(h),!u.ok){if(u.headers.get("content-type")?.includes("text/html"))throw new Error(`Server error (${u.status})`);const s=await u.json();throw u.status===409?new Error("Config changed by another session. Refreshing..."):new Error(s.error||"Failed to save")}const v=await u.json();i(v.config),f.current=v.lastModified,y(!0),setTimeout(()=>y(!1),1500)}catch(x){clearTimeout(h),i(c),x.name==="AbortError"?g("Request timeout - please try again"):(g(x.message),x.message.includes("another session")&&setTimeout(()=>k(),1e3))}finally{N(!1)}},[t,k]),T=o.useCallback(r=>{l({mode:r})},[l]),C=o.useCallback((r,c)=>{const n=t?.tier_defaults||z.tier_defaults;l({tier_defaults:{...n,[r]:c}})},[t,l]),O=o.useCallback(r=>{l({show_warnings:r})},[l]),D=o.useCallback(r=>{if(r===void 0){l({override:null,clear_override:!0});return}l({override:r,clear_override:!1})},[l]),L=o.useCallback((r,c,n)=>{const m=t?.provider_overrides||{},h=m[r]||{};if(n===void 0){const{[c]:x,...u}=h,v=Object.keys(u).length>0?u:void 0,{[r]:S,...s}=m,a=v?{...s,[r]:v}:s;l({provider_overrides:Object.keys(a).length>0?a:null,clear_provider_overrides:Object.keys(a).length===0})}else l({provider_overrides:{...m,[r]:{...h,[c]:n}},clear_provider_overrides:!1})},[t,l]);return{config:t||z,loading:b,saving:_,error:p,success:P,fetchConfig:k,saveConfig:l,setMode:T,setTierDefault:C,setShowWarnings:O,setOverride:D,setProviderOverride:L}}const H=[{value:"minimal",label:"Minimal (512 tokens)"},{value:"low",label:"Low (1K tokens)"},{value:"medium",label:"Medium (8K tokens)"},{value:"high",label:"High (24K tokens)"},{value:"xhigh",label:"Extra High (32K tokens)"},{value:"auto",label:"Auto (dynamic)"}],ne=[{value:"__none__",label:"None (use CLI flags only)"},...H,{value:"__custom__",label:"Custom budget (number)"},{value:"off",label:"Off (disable thinking)"}],ae=["agy","gemini","codex"],G=0,V=1e5;function ve(){const{t}=q(),{config:i,loading:b,saving:d,error:_,success:N,fetchConfig:p,setMode:g,setTierDefault:P,setShowWarnings:y,setOverride:f,setProviderOverride:w}=ie(),[k,l]=o.useState(null),[T,C]=o.useState(""),[O,D]=o.useState([]),[L,r]=o.useState(null),c=o.useMemo(()=>Array.from(new Set([...ae,...Object.keys(i.provider_overrides??{}),...O])),[O,i.provider_overrides]),n=i.override===void 0?"__none__":typeof i.override=="number"||/^\d+$/.test(String(i.override))?"__custom__":String(i.override),m=typeof i.override=="number"||/^\d+$/.test(String(i.override??""))?String(i.override):"",h=L??m,x=Object.keys(i.provider_overrides??{}).length>0,u=k??x;o.useEffect(()=>{p()},[p]);const v=()=>{const s=T.trim().toLowerCase();s&&(c.includes(s)||D(a=>[...a,s]),C(""),l(!0))},S=()=>{const s=h.trim();if(!s){f(void 0);return}const a=Number.parseInt(s,10);Number.isNaN(a)||a<G||a>V||!/^\d+$/.test(s)||f(a)};return b?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx($,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:t("settings.loading")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${_||N?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[_&&e.jsx(J,{variant:"destructive",className:"py-2 shadow-lg",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-4 w-4"}),e.jsx(X,{children:_})]}),e.jsxs(I,{variant:"outline",size:"sm",onClick:p,className:"h-7 px-2 text-xs border-destructive/50 hover:bg-destructive/10",children:[e.jsx($,{className:"w-3 h-3 mr-1"}),t("sharedPage.retry")]})]})}),N&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:t("settings.saved")})]})]}),e.jsx(Y,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"w-5 h-5 text-primary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.description")})]}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800",children:[e.jsx(te,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsx("p",{className:"font-medium",children:t("settingsThinking.supportedProviders")}),e.jsxs("ul",{className:"mt-1 space-y-0.5 text-blue-600 dark:text-blue-400",children:[e.jsxs("li",{children:[t("settingsThinking.supportLine1Prefix")," ",e.jsx("strong",{children:"agy"}),","," ",e.jsx("strong",{children:"gemini"})," ",t("settingsThinking.supportLine1Suffix")]}),e.jsxs("li",{children:[t("settingsThinking.supportLine2Prefix")," ",e.jsx("strong",{children:"codex"})," ",t("settingsThinking.supportLine2SuffixPrefix"),e.jsx("code",{children:"--effort"}),t("settingsThinking.supportLine2SuffixPostfix")]}),e.jsxs("li",{children:[t("settingsThinking.supportLine3Prefix")," ",e.jsx("code",{children:"-high"}),t("settingsThinking.supportLine3Suffix")]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.modeTitle")}),e.jsx("div",{className:"space-y-2",children:["auto","off","manual"].map(s=>e.jsxs("div",{className:`flex items-center justify-between p-4 rounded-lg cursor-pointer transition-colors ${i.mode===s?"bg-primary/10 border border-primary/30":"bg-muted/50 hover:bg-muted/80"} ${d?"opacity-70 pointer-events-none":""}`,onClick:()=>{d||g(s)},children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium capitalize",children:s}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="auto"&&t("settingsThinking.modeAutoDesc"),s==="off"&&t("settingsThinking.modeOffDesc"),s==="manual"&&t("settingsThinking.modeManualDesc")]})]}),e.jsx("div",{className:`w-4 h-4 rounded-full border-2 ${i.mode===s?"bg-primary border-primary":"border-muted-foreground/50"}`})]},s))})]}),i.mode==="auto"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.tierDefaults")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.tierDefaultsDesc")}),e.jsx("div",{className:"space-y-3",children:["opus","sonnet","haiku"].map(s=>e.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-muted/30",children:[e.jsx(A,{className:"w-20 capitalize font-medium",children:s}),e.jsxs(R,{value:i.tier_defaults[s],onValueChange:a=>P(s,a),disabled:d,children:[e.jsx(M,{className:"flex-1",children:e.jsx(K,{})}),e.jsx(B,{children:H.map(a=>e.jsx(E,{value:a.value,children:a.label},a.value))})]})]},s))})]}),i.mode==="manual"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.persistentOverride")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.persistentOverrideDesc")}),e.jsxs(R,{value:n,onValueChange:s=>{if(s==="__none__"){f(void 0);return}if(s==="__custom__"){h||r("8192");return}r(null),f(s)},disabled:d,children:[e.jsx(M,{children:e.jsx(K,{})}),e.jsx(B,{children:ne.map(s=>e.jsx(E,{value:s.value,children:s.label},s.value))})]}),n==="__custom__"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{type:"number",min:G,max:V,value:h,onChange:s=>r(s.target.value),onBlur:S,disabled:d,placeholder:t("settingsThinking.enterCustomBudget")}),e.jsx(I,{type:"button",size:"sm",variant:"outline",onClick:S,disabled:d,children:t("settingsThinking.apply")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Range: ",G," to ",V]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 text-base font-medium w-full text-left",onClick:()=>l(s=>!(s??x)),disabled:d,children:[e.jsx(re,{className:`w-4 h-4 transition-transform ${u?"rotate-0":"-rotate-90"}`}),t("settingsThinking.providerOverrides",{count:Object.keys(i.provider_overrides??{}).length})]}),u&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.providerOverridesDesc")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{value:T,onChange:s=>C(s.target.value),disabled:d,placeholder:t("settingsThinking.addProviderPlaceholder")}),e.jsx(I,{type:"button",size:"sm",variant:"outline",onClick:v,disabled:d,children:t("settingsGlobalEnv.add")})]}),c.map(s=>e.jsxs("div",{className:"space-y-2 p-3 rounded-lg bg-muted/30",children:[e.jsx(A,{className:"capitalize font-medium text-sm",children:s}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:["opus","sonnet","haiku"].map(a=>{const W=i.provider_overrides?.[s]?.[a]||"__default__";return e.jsxs("div",{className:"space-y-1",children:[e.jsx(A,{className:"text-xs text-muted-foreground capitalize",children:a}),e.jsxs(R,{value:W,onValueChange:j=>w(s,a,j==="__default__"?void 0:j),disabled:d,children:[e.jsx(M,{className:"h-8 text-xs",children:e.jsx(K,{})}),e.jsxs(B,{children:[e.jsx(E,{value:"__default__",children:t("cursorPage.default")}),H.map(j=>e.jsx(E,{value:j.value,children:j.label},j.value))]})]})]},a)})})]},s))]})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:t("settingsThinking.showWarnings")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.showWarningsDesc")})]}),e.jsx(Q,{checked:i.show_warnings??!0,onCheckedChange:y,disabled:d})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:t("settingsThinking.cliEnvOverride")}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:["Override per session with flags or"," ",e.jsx("code",{className:"px-1.5 py-0.5 rounded bg-muted",children:"CCS_THINKING"})," env var. Priority: flag > env > config."]}),e.jsxs("div",{className:"space-y-1 text-sm font-mono text-muted-foreground",children:[e.jsx("p",{children:"ccs gemini --thinking high"}),e.jsx("p",{children:"ccs codex --effort xhigh"}),e.jsx("p",{children:'CCS_THINKING=high ccs codex "debug this"'}),e.jsx("p",{children:"ccs config thinking --mode auto"})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(I,{variant:"outline",size:"sm",onClick:p,disabled:b||d,className:"w-full",children:[e.jsx($,{className:`w-4 h-4 mr-2 ${b?"animate-spin":""}`}),t("settings.refresh")]})})]})}export{ve as default};
|