@kaitranntt/ccs 7.66.1 → 7.67.0-dev.10
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 +3 -1
- package/dist/api/services/index.d.ts +1 -0
- package/dist/api/services/index.d.ts.map +1 -1
- package/dist/api/services/index.js +3 -1
- package/dist/api/services/index.js.map +1 -1
- package/dist/api/services/local-runtime-readiness.d.ts +14 -0
- package/dist/api/services/local-runtime-readiness.d.ts.map +1 -0
- package/dist/api/services/local-runtime-readiness.js +89 -0
- package/dist/api/services/local-runtime-readiness.js.map +1 -0
- package/dist/ccs.js +68 -35
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/accounts/types.d.ts +1 -1
- package/dist/cliproxy/accounts/types.d.ts.map +1 -1
- package/dist/cliproxy/auth/auth-types.d.ts +29 -6
- package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
- package/dist/cliproxy/auth/auth-types.js +58 -10
- package/dist/cliproxy/auth/auth-types.js.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.d.ts +6 -1
- package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.js +165 -45
- package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
- package/dist/cliproxy/auth/oauth-process.d.ts +26 -1
- package/dist/cliproxy/auth/oauth-process.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-process.js +314 -49
- package/dist/cliproxy/auth/oauth-process.js.map +1 -1
- package/dist/cliproxy/auth/token-manager.d.ts +9 -0
- package/dist/cliproxy/auth/token-manager.d.ts.map +1 -1
- package/dist/cliproxy/auth/token-manager.js +104 -58
- package/dist/cliproxy/auth/token-manager.js.map +1 -1
- package/dist/cliproxy/auth-utils.d.ts +2 -1
- package/dist/cliproxy/auth-utils.d.ts.map +1 -1
- package/dist/cliproxy/auth-utils.js +32 -7
- package/dist/cliproxy/auth-utils.js.map +1 -1
- package/dist/cliproxy/catalog-cache.d.ts +9 -1
- package/dist/cliproxy/catalog-cache.d.ts.map +1 -1
- package/dist/cliproxy/catalog-cache.js +115 -29
- package/dist/cliproxy/catalog-cache.js.map +1 -1
- package/dist/cliproxy/catalog-routing.d.ts +12 -0
- package/dist/cliproxy/catalog-routing.d.ts.map +1 -0
- package/dist/cliproxy/catalog-routing.js +19 -0
- package/dist/cliproxy/catalog-routing.js.map +1 -0
- package/dist/cliproxy/codex-plan-compatibility.d.ts +0 -1
- package/dist/cliproxy/codex-plan-compatibility.d.ts.map +1 -1
- package/dist/cliproxy/codex-plan-compatibility.js +3 -7
- package/dist/cliproxy/codex-plan-compatibility.js.map +1 -1
- package/dist/cliproxy/config/generator.d.ts +2 -1
- package/dist/cliproxy/config/generator.d.ts.map +1 -1
- package/dist/cliproxy/config/generator.js +11 -1
- package/dist/cliproxy/config/generator.js.map +1 -1
- package/dist/cliproxy/executor/index.d.ts +5 -0
- package/dist/cliproxy/executor/index.d.ts.map +1 -1
- package/dist/cliproxy/executor/index.js +119 -16
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/gemini-cli-quota-normalizer.js +1 -1
- package/dist/cliproxy/gemini-cli-quota-normalizer.js.map +1 -1
- package/dist/cliproxy/index.d.ts +1 -1
- package/dist/cliproxy/index.d.ts.map +1 -1
- package/dist/cliproxy/index.js.map +1 -1
- package/dist/cliproxy/managed-model-prefixes.d.ts +7 -0
- package/dist/cliproxy/managed-model-prefixes.d.ts.map +1 -0
- package/dist/cliproxy/managed-model-prefixes.js +116 -0
- package/dist/cliproxy/managed-model-prefixes.js.map +1 -0
- 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 +14 -0
- package/dist/cliproxy/management-api-client.js.map +1 -1
- package/dist/cliproxy/model-catalog.d.ts.map +1 -1
- package/dist/cliproxy/model-catalog.js +19 -4
- package/dist/cliproxy/model-catalog.js.map +1 -1
- package/dist/cliproxy/provider-entitlement-evidence.d.ts +17 -0
- package/dist/cliproxy/provider-entitlement-evidence.d.ts.map +1 -0
- package/dist/cliproxy/provider-entitlement-evidence.js +55 -0
- package/dist/cliproxy/provider-entitlement-evidence.js.map +1 -0
- package/dist/cliproxy/provider-entitlement-types.d.ts +16 -0
- package/dist/cliproxy/provider-entitlement-types.d.ts.map +1 -0
- package/dist/cliproxy/provider-entitlement-types.js +3 -0
- package/dist/cliproxy/provider-entitlement-types.js.map +1 -0
- package/dist/cliproxy/proxy-detector.d.ts.map +1 -1
- package/dist/cliproxy/proxy-detector.js +6 -2
- package/dist/cliproxy/proxy-detector.js.map +1 -1
- package/dist/cliproxy/quota-fetcher-gemini-cli.d.ts.map +1 -1
- package/dist/cliproxy/quota-fetcher-gemini-cli.js +64 -19
- package/dist/cliproxy/quota-fetcher-gemini-cli.js.map +1 -1
- package/dist/cliproxy/quota-fetcher.d.ts +10 -0
- package/dist/cliproxy/quota-fetcher.d.ts.map +1 -1
- package/dist/cliproxy/quota-fetcher.js +116 -21
- package/dist/cliproxy/quota-fetcher.js.map +1 -1
- package/dist/cliproxy/quota-types.d.ts +3 -0
- package/dist/cliproxy/quota-types.d.ts.map +1 -1
- package/dist/cliproxy/routing-strategy-http.d.ts +6 -0
- package/dist/cliproxy/routing-strategy-http.d.ts.map +1 -0
- package/dist/cliproxy/routing-strategy-http.js +115 -0
- package/dist/cliproxy/routing-strategy-http.js.map +1 -0
- package/dist/cliproxy/routing-strategy.d.ts +18 -0
- package/dist/cliproxy/routing-strategy.d.ts.map +1 -0
- package/dist/cliproxy/routing-strategy.js +123 -0
- package/dist/cliproxy/routing-strategy.js.map +1 -0
- package/dist/cliproxy/services/variant-settings.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-settings.js +43 -30
- package/dist/cliproxy/services/variant-settings.js.map +1 -1
- package/dist/cliproxy/startup-lock.d.ts.map +1 -1
- package/dist/cliproxy/startup-lock.js +5 -1
- package/dist/cliproxy/startup-lock.js.map +1 -1
- package/dist/cliproxy/tool-sanitization-proxy.d.ts +1 -0
- package/dist/cliproxy/tool-sanitization-proxy.d.ts.map +1 -1
- package/dist/cliproxy/tool-sanitization-proxy.js +6 -0
- package/dist/cliproxy/tool-sanitization-proxy.js.map +1 -1
- package/dist/cliproxy/types.d.ts +7 -0
- package/dist/cliproxy/types.d.ts.map +1 -1
- package/dist/cliproxy/types.js.map +1 -1
- package/dist/commands/api-command/create-command.d.ts +3 -0
- package/dist/commands/api-command/create-command.d.ts.map +1 -1
- package/dist/commands/api-command/create-command.js +20 -6
- 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 +1 -0
- package/dist/commands/api-command/help.js.map +1 -1
- package/dist/commands/cleanup-command.d.ts +1 -1
- package/dist/commands/cleanup-command.d.ts.map +1 -1
- package/dist/commands/cleanup-command.js +57 -34
- package/dist/commands/cleanup-command.js.map +1 -1
- package/dist/commands/cliproxy/catalog-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/catalog-subcommand.js +72 -44
- package/dist/commands/cliproxy/catalog-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.js +6 -2
- package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/index.d.ts.map +1 -1
- package/dist/commands/cliproxy/index.js +14 -0
- package/dist/commands/cliproxy/index.js.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.d.ts +2 -0
- package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.js +8 -1
- package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/routing-subcommand.d.ts +4 -0
- package/dist/commands/cliproxy/routing-subcommand.d.ts.map +1 -0
- package/dist/commands/cliproxy/routing-subcommand.js +68 -0
- package/dist/commands/cliproxy/routing-subcommand.js.map +1 -0
- package/dist/commands/cliproxy/variant-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/variant-subcommand.js +44 -3
- package/dist/commands/cliproxy/variant-subcommand.js.map +1 -1
- package/dist/commands/command-catalog.d.ts +2 -2
- package/dist/commands/command-catalog.d.ts.map +1 -1
- package/dist/commands/command-catalog.js +3 -1
- package/dist/commands/command-catalog.js.map +1 -1
- package/dist/commands/completion-backend.d.ts.map +1 -1
- package/dist/commands/completion-backend.js +15 -1
- package/dist/commands/completion-backend.js.map +1 -1
- package/dist/commands/config-command.d.ts.map +1 -1
- package/dist/commands/config-command.js +23 -0
- package/dist/commands/config-command.js.map +1 -1
- package/dist/commands/docker/up-subcommand.js +1 -1
- package/dist/commands/docker/up-subcommand.js.map +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +62 -1
- package/dist/commands/help-command.js.map +1 -1
- package/dist/commands/update-command.d.ts +20 -5
- package/dist/commands/update-command.d.ts.map +1 -1
- package/dist/commands/update-command.js +169 -119
- package/dist/commands/update-command.js.map +1 -1
- package/dist/config/unified-config-loader.d.ts +2 -1
- package/dist/config/unified-config-loader.d.ts.map +1 -1
- package/dist/config/unified-config-loader.js +37 -1
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/config/unified-config-types.d.ts +29 -1
- package/dist/config/unified-config-types.d.ts.map +1 -1
- package/dist/config/unified-config-types.js +13 -1
- package/dist/config/unified-config-types.js.map +1 -1
- package/dist/copilot/copilot-executor.d.ts.map +1 -1
- package/dist/copilot/copilot-executor.js +5 -8
- package/dist/copilot/copilot-executor.js.map +1 -1
- package/dist/delegation/headless-executor.d.ts.map +1 -1
- package/dist/delegation/headless-executor.js +19 -16
- package/dist/delegation/headless-executor.js.map +1 -1
- package/dist/errors/error-handler.d.ts.map +1 -1
- package/dist/errors/error-handler.js +13 -0
- package/dist/errors/error-handler.js.map +1 -1
- package/dist/glmt/glmt-transformer.d.ts +1 -0
- package/dist/glmt/glmt-transformer.d.ts.map +1 -1
- package/dist/glmt/glmt-transformer.js +9 -0
- package/dist/glmt/glmt-transformer.js.map +1 -1
- package/dist/management/checks/image-analysis-check.d.ts.map +1 -1
- package/dist/management/checks/image-analysis-check.js +19 -1
- package/dist/management/checks/image-analysis-check.js.map +1 -1
- package/dist/management/recovery-manager.d.ts +6 -0
- package/dist/management/recovery-manager.d.ts.map +1 -1
- package/dist/management/recovery-manager.js +72 -2
- package/dist/management/recovery-manager.js.map +1 -1
- package/dist/services/logging/index.d.ts +7 -0
- package/dist/services/logging/index.d.ts.map +1 -0
- package/dist/services/logging/index.js +22 -0
- package/dist/services/logging/index.js.map +1 -0
- package/dist/services/logging/log-buffer.d.ts +5 -0
- package/dist/services/logging/log-buffer.d.ts.map +1 -0
- package/dist/services/logging/log-buffer.js +20 -0
- package/dist/services/logging/log-buffer.js.map +1 -0
- package/dist/services/logging/log-config.d.ts +4 -0
- package/dist/services/logging/log-config.d.ts.map +1 -0
- package/dist/services/logging/log-config.js +68 -0
- package/dist/services/logging/log-config.js.map +1 -0
- package/dist/services/logging/log-paths.d.ts +8 -0
- package/dist/services/logging/log-paths.d.ts.map +1 -0
- package/dist/services/logging/log-paths.js +66 -0
- package/dist/services/logging/log-paths.js.map +1 -0
- package/dist/services/logging/log-reader.d.ts +5 -0
- package/dist/services/logging/log-reader.d.ts.map +1 -0
- package/dist/services/logging/log-reader.js +124 -0
- package/dist/services/logging/log-reader.js.map +1 -0
- package/dist/services/logging/log-redaction.d.ts +2 -0
- package/dist/services/logging/log-redaction.d.ts.map +1 -0
- package/dist/services/logging/log-redaction.js +53 -0
- package/dist/services/logging/log-redaction.js.map +1 -0
- package/dist/services/logging/log-storage.d.ts +4 -0
- package/dist/services/logging/log-storage.d.ts.map +1 -0
- package/dist/services/logging/log-storage.js +109 -0
- package/dist/services/logging/log-storage.js.map +1 -0
- package/dist/services/logging/log-types.d.ts +30 -0
- package/dist/services/logging/log-types.d.ts.map +1 -0
- package/dist/services/logging/log-types.js +19 -0
- package/dist/services/logging/log-types.js.map +1 -0
- package/dist/services/logging/logger.d.ts +9 -0
- package/dist/services/logging/logger.d.ts.map +1 -0
- package/dist/services/logging/logger.js +46 -0
- package/dist/services/logging/logger.js.map +1 -0
- package/dist/shared/agy-gemini-pro-compatibility.d.ts +15 -0
- package/dist/shared/agy-gemini-pro-compatibility.d.ts.map +1 -0
- package/dist/shared/agy-gemini-pro-compatibility.js +18 -0
- package/dist/shared/agy-gemini-pro-compatibility.js.map +1 -0
- package/dist/shared/cliproxy-model-routing.d.ts +45 -0
- package/dist/shared/cliproxy-model-routing.d.ts.map +1 -0
- package/dist/shared/cliproxy-model-routing.js +144 -0
- package/dist/shared/cliproxy-model-routing.js.map +1 -0
- package/dist/shared/provider-preset-catalog.d.ts +3 -1
- package/dist/shared/provider-preset-catalog.d.ts.map +1 -1
- package/dist/shared/provider-preset-catalog.js +16 -0
- package/dist/shared/provider-preset-catalog.js.map +1 -1
- package/dist/ui/assets/{accounts-BjfPKR8m.js → accounts-DjL3iVZW.js} +1 -1
- package/dist/ui/assets/{alert-dialog-Dh2NUFdm.js → alert-dialog-Tc_D1a_B.js} +1 -1
- package/dist/ui/assets/api-CUtkvXmX.js +4 -0
- package/dist/ui/assets/{auth-section-Dp10_YyD.js → auth-section-CuKWQHC7.js} +1 -1
- package/dist/ui/assets/{backups-section-C0jF8MP1.js → backups-section-BKW2pbb9.js} +1 -1
- package/dist/ui/assets/{channels-CkXuK5i7.js → channels-DvWJMdaq.js} +1 -1
- package/dist/ui/assets/{checkbox-tA5FH8Ol.js → checkbox-B0hZxMK5.js} +1 -1
- package/dist/ui/assets/{claude-extension-Bg2ZkzMz.js → claude-extension-Dfqu-rev.js} +1 -1
- package/dist/ui/assets/cliproxy-C9RxW-I8.js +3 -0
- package/dist/ui/assets/cliproxy-ai-providers-BXLuuxNf.js +15 -0
- package/dist/ui/assets/{cliproxy-control-panel-Da-sGGyI.js → cliproxy-control-panel-aQ7cCc2U.js} +1 -1
- package/dist/ui/assets/{codex-ooWKOPa2.js → codex-aq4RI6_n.js} +9 -9
- package/dist/ui/assets/{confirm-dialog-CKjwhn9j.js → confirm-dialog-CpDk6eu4.js} +1 -1
- package/dist/ui/assets/{copilot-GA7EPiK1.js → copilot-CQRpGXvY.js} +2 -2
- package/dist/ui/assets/{cursor-B6c8CyHG.js → cursor-BpXPf6qi.js} +1 -1
- package/dist/ui/assets/{droid-CPRHOIX2.js → droid-Cgx-yLjy.js} +2 -2
- package/dist/ui/assets/{globalenv-section-Czgnw_GV.js → globalenv-section-DsNqG1yB.js} +1 -1
- package/dist/ui/assets/{health-CXLOMk8n.js → health-BY-O-JcA.js} +1 -1
- package/dist/ui/assets/icons-KVCk4_U8.js +1 -0
- package/dist/ui/assets/index-BmSzf0T9.js +72 -0
- package/dist/ui/assets/index-CLGiPB3A.js +1 -0
- package/dist/ui/assets/{index-CvfzKRSH.js → index-Cet36v1V.js} +1 -1
- package/dist/ui/assets/{index-Boa5e-GY.js → index-DH6L6ybH.js} +1 -1
- package/dist/ui/assets/{index-BceMcbCR.js → index-DsCjnpco.js} +1 -1
- package/dist/ui/assets/{index-D2v_-6AW.js → index-TQFuDZdB.js} +1 -1
- package/dist/ui/assets/index-teLjoh2T.css +1 -0
- package/dist/ui/assets/logs-D5ro-pc7.js +1 -0
- package/dist/ui/assets/{masked-input-B1_asiUI.js → masked-input-h0XkMSwB.js} +1 -1
- package/dist/ui/assets/proxy-status-widget-yBdrFeb7.js +1 -0
- package/dist/ui/assets/{raw-json-settings-editor-panel-DMbTkxWw.js → raw-json-settings-editor-panel-Cb7ZInQV.js} +1 -1
- package/dist/ui/assets/searchable-select-D4xr5xKS.js +1 -0
- package/dist/ui/assets/{separator-CdaalG0K.js → separator-gw5BjIpP.js} +1 -1
- package/dist/ui/assets/{shared-BiFB-et0.js → shared-C-VeA1Z9.js} +1 -1
- package/dist/ui/assets/{table-BPwgFXLQ.js → table-Bd4isC18.js} +1 -1
- package/dist/ui/assets/{tanstack-DWm6aJ-G.js → tanstack-CrmUhA7Z.js} +2 -2
- package/dist/ui/assets/updates-DiK8I67C.js +1 -0
- package/dist/ui/index.html +4 -4
- package/dist/utils/hooks/image-analysis-runtime-status.d.ts.map +1 -1
- package/dist/utils/hooks/image-analysis-runtime-status.js +5 -1
- package/dist/utils/hooks/image-analysis-runtime-status.js.map +1 -1
- package/dist/utils/hooks/image-analyzer-hook-utils.d.ts +21 -0
- package/dist/utils/hooks/image-analyzer-hook-utils.d.ts.map +1 -0
- package/dist/utils/hooks/image-analyzer-hook-utils.js +81 -0
- package/dist/utils/hooks/image-analyzer-hook-utils.js.map +1 -0
- package/dist/utils/hooks/image-analyzer-profile-hook-injector.d.ts +1 -0
- package/dist/utils/hooks/image-analyzer-profile-hook-injector.d.ts.map +1 -1
- package/dist/utils/hooks/image-analyzer-profile-hook-injector.js +33 -12
- package/dist/utils/hooks/image-analyzer-profile-hook-injector.js.map +1 -1
- package/dist/utils/hooks/index.d.ts +1 -0
- package/dist/utils/hooks/index.d.ts.map +1 -1
- package/dist/utils/hooks/index.js +3 -1
- package/dist/utils/hooks/index.js.map +1 -1
- package/dist/utils/image-analysis/index.d.ts +1 -0
- package/dist/utils/image-analysis/index.d.ts.map +1 -1
- package/dist/utils/image-analysis/index.js +6 -1
- package/dist/utils/image-analysis/index.js.map +1 -1
- package/dist/utils/image-analysis/repair.d.ts +12 -0
- package/dist/utils/image-analysis/repair.d.ts.map +1 -0
- package/dist/utils/image-analysis/repair.js +105 -0
- package/dist/utils/image-analysis/repair.js.map +1 -0
- package/dist/utils/package-manager-detector.d.ts +30 -4
- package/dist/utils/package-manager-detector.d.ts.map +1 -1
- package/dist/utils/package-manager-detector.js +247 -60
- package/dist/utils/package-manager-detector.js.map +1 -1
- package/dist/utils/update-checker.d.ts +1 -1
- package/dist/utils/update-checker.d.ts.map +1 -1
- package/dist/utils/websearch/trace.d.ts.map +1 -1
- package/dist/utils/websearch/trace.js +7 -0
- package/dist/utils/websearch/trace.js.map +1 -1
- package/dist/web-server/index.d.ts.map +1 -1
- package/dist/web-server/index.js +24 -0
- package/dist/web-server/index.js.map +1 -1
- package/dist/web-server/middleware/request-logging-middleware.d.ts +3 -0
- package/dist/web-server/middleware/request-logging-middleware.d.ts.map +1 -0
- package/dist/web-server/middleware/request-logging-middleware.js +30 -0
- package/dist/web-server/middleware/request-logging-middleware.js.map +1 -0
- package/dist/web-server/routes/auth-routes.d.ts +10 -0
- package/dist/web-server/routes/auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/auth-routes.js +33 -6
- package/dist/web-server/routes/auth-routes.js.map +1 -1
- package/dist/web-server/routes/catalog-routes.d.ts.map +1 -1
- package/dist/web-server/routes/catalog-routes.js +9 -8
- package/dist/web-server/routes/catalog-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts +8 -0
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +86 -76
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-routing-routes.d.ts +3 -0
- package/dist/web-server/routes/cliproxy-routing-routes.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-routing-routes.js +34 -0
- package/dist/web-server/routes/cliproxy-routing-routes.js.map +1 -0
- package/dist/web-server/routes/image-analysis-routes.d.ts.map +1 -1
- package/dist/web-server/routes/image-analysis-routes.js +1 -10
- package/dist/web-server/routes/image-analysis-routes.js.map +1 -1
- package/dist/web-server/routes/index.d.ts.map +1 -1
- package/dist/web-server/routes/index.js +22 -0
- package/dist/web-server/routes/index.js.map +1 -1
- package/dist/web-server/routes/logs-routes.d.ts +3 -0
- package/dist/web-server/routes/logs-routes.d.ts.map +1 -0
- package/dist/web-server/routes/logs-routes.js +75 -0
- package/dist/web-server/routes/logs-routes.js.map +1 -0
- package/dist/web-server/routes/profile-routes.d.ts.map +1 -1
- package/dist/web-server/routes/profile-routes.js +8 -0
- package/dist/web-server/routes/profile-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 +2 -0
- package/dist/web-server/routes/settings-routes.js.map +1 -1
- package/dist/web-server/services/logs-dashboard-service.d.ts +7 -0
- package/dist/web-server/services/logs-dashboard-service.d.ts.map +1 -0
- package/dist/web-server/services/logs-dashboard-service.js +33 -0
- package/dist/web-server/services/logs-dashboard-service.js.map +1 -0
- package/dist/web-server/usage/routes.d.ts.map +1 -1
- package/dist/web-server/usage/routes.js +11 -0
- package/dist/web-server/usage/routes.js.map +1 -1
- package/dist/web-server/websocket.d.ts.map +1 -1
- package/dist/web-server/websocket.js +23 -14
- package/dist/web-server/websocket.js.map +1 -1
- package/lib/hooks/image-analyzer-transformer.cjs +5 -0
- package/package.json +1 -1
- package/dist/ui/assets/api-C-3mQCFf.js +0 -4
- package/dist/ui/assets/cliproxy-1qRVSbVC.js +0 -3
- package/dist/ui/assets/cliproxy-ai-providers-DBSXTTyw.js +0 -21
- package/dist/ui/assets/icons-B9oTjo-t.js +0 -1
- package/dist/ui/assets/index-BMHPMj0j.js +0 -69
- package/dist/ui/assets/index-CknHGRYp.css +0 -1
- package/dist/ui/assets/index-v-DY6Zby.js +0 -1
- package/dist/ui/assets/proxy-status-widget-Ci1JpStj.js +0 -1
- package/dist/ui/assets/searchable-select-HbP2PXl3.js +0 -1
- package/dist/ui/assets/updates-l8Co9uve.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.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-BMHPMj0j.js";import{a1 as ve,af as re,ag as z,ah as ne,$ as le,a7 as ke,G as Ce,ai as Se,R as De,Y as Q,U as Le,Z as ie,u as $e,aa as G,aj as Te,Q as Fe,C as Re,ak as Me,al as Pe}from"./icons-B9oTjo-t.js";import{a as Be,u as P}from"./tanstack-DWm6aJ-G.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 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./radix-ui-Zb8sVEtn.js";import{g as Se,r as j}from"./react-vendor-CNOkPC89.js";import{bo as me,bp as pe,bq as xe,br as Ce,bs as _,bt as Y,bu as U,bv as Ae,bw as we,a as Ee,bn as ke,aR as Ve,bx as Te,by as Pe,bz as $e,bA as We,bB as Ie,c as q,B as oe,aE as De,M as Oe,O as Re,r as Fe,s as Le,t as Ue,v as qe,w as Me,d as ne,T as _e,p as Be,q as ze,Y as He}from"./index-BMHPMj0j.js";import{A as Ke,a as Ze,b as Qe,c as Xe,d as Ye,e as Je,f as Ge,g as et}from"./alert-dialog-Dh2NUFdm.js";import{u as fe,a as tt,b as st,h as nt}from"./tanstack-DWm6aJ-G.js";import{t as J}from"./notifications-B2HqRBj7.js";import{t as rt,A as at,R as z,b5 as it,b6 as ot,b7 as lt,X as ct,d as ut,b8 as dt,b9 as mt,U as pt,u as xt,l as ft,v as gt,aw as ht,T as G,aI as yt}from"./icons-B9oTjo-t.js";var ee,le;function bt(){return le||(le=1,ee={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),ee}var jt=bt();const vt=Se(jt);var Nt=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function ce(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(vt[n[1]]||e.charAt(e.length-2)==="/")&&(t.voidElement=!0),t.name.startsWith("!--"))){var r=e.indexOf("-->");return{type:"comment",comment:r!==-1?e.slice(4,r):""}}for(var a=new RegExp(Nt),i=null;(i=a.exec(e))!==null;)if(i[0].trim())if(i[1]){var o=i[1].trim(),c=[o,""];o.indexOf("=")>-1&&(c=o.split("=")),t.attrs[c[0]]=c[1],a.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return t}var St=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Ct=/^\s*$/,At=Object.create(null);function ge(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?(function(n){var r=[];for(var a in n)r.push(a+'="'+n[a]+'"');return r.length?" "+r.join(" "):""})(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(ge,"")+"</"+t.name+">";case"comment":return e+"<!--"+t.comment+"-->"}}var wt={parse:function(e,t){t||(t={}),t.components||(t.components=At);var n,r=[],a=[],i=-1,o=!1;if(e.indexOf("<")!==0){var c=e.indexOf("<");r.push({type:"text",content:c===-1?e:e.substring(0,c)})}return e.replace(St,function(d,u){if(o){if(d!=="</"+n.name+">")return;o=!1}var f,E=d.charAt(1)!=="/",V=d.startsWith("<!--"),p=u+d.length,m=e.charAt(p);if(V){var v=ce(d);return i<0?(r.push(v),r):((f=a[i]).children.push(v),r)}if(E&&(i++,(n=ce(d)).type==="tag"&&t.components[n.name]&&(n.type="component",o=!0),n.voidElement||o||!m||m==="<"||n.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),i===0&&r.push(n),(f=a[i-1])&&f.children.push(n),a[i]=n),(!E||n.voidElement)&&(i>-1&&(n.voidElement||n.name===d.slice(2,-1))&&(i--,n=i===-1?r:a[i]),!o&&m!=="<"&&m)){f=i===-1?r:a[i].children;var b=e.indexOf("<",p),P=e.slice(p,b===-1?void 0:b);Ct.test(P)&&(P=" "),(b>-1&&i+f.length>=0||P!==" ")&&f.push({type:"text",content:P})}}),r},stringify:function(e){return e.reduce(function(t,n){return t+ge("",n)},"")}};const K=(e,t)=>{if(!e)return!1;const n=e.props?.children??e.children;return t?n.length>0:!!n},Z=e=>{if(!e)return[];const t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?M(t):t},Et=e=>Array.isArray(e)&&e.every(j.isValidElement),M=e=>Array.isArray(e)?e:[e],kt=(e,t)=>{const n={...t};return n.props={...t.props,...e.props},n},Vt=e=>{const t={};if(!e)return t;const n=r=>{M(r).forEach(i=>{_(i)||(K(i)?n(Z(i)):U(i)&&!j.isValidElement(i)&&Object.assign(t,i))})};return n(e),t},he=(e,t,n,r)=>{if(!e)return"";let a="";const i=M(e),o=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return i.forEach((c,d)=>{if(_(c)){a+=`${c}`;return}if(j.isValidElement(c)){const{props:u,type:f}=c,E=Object.keys(u).length,V=o.indexOf(f)>-1,p=u.children;if(!p&&V&&!E){a+=`<${f}/>`;return}if(!p&&(!V||E)||u.i18nIsDynamicList){a+=`<${d}></${d}>`;return}if(V&&E===1&&_(p)){a+=`<${f}>${p}</${f}>`;return}const m=he(p,t,n,r);a+=`<${d}>${m}</${d}>`;return}if(c===null){Y(n,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:r});return}if(U(c)){const{format:u,...f}=c,E=Object.keys(f);if(E.length===1){const V=u?`${E[0]}, ${u}`:E[0];a+=`{{${V}}}`;return}Y(n,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:r,child:c});return}Y(n,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:r,child:c})}),a},Tt=(e,t=[],n={})=>{if(!e)return e;const r=Object.keys(n),a=[...t,...r];let i="",o=0;for(;o<e.length;)if(e[o]==="<"){let c=!1;const d=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(d){const u=d[1];(/^\d+$/.test(u)||a.includes(u))&&(c=!0,i+=d[0],o+=d[0].length)}if(!c){const u=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(u){const f=u[1];(/^\d+$/.test(f)||a.includes(f))&&(c=!0,i+=u[0],o+=u[0].length)}}c||(i+="<",o+=1)}else i+=e[o],o+=1;return i},Pt=(e,t,n,r,a,i,o)=>{if(n==="")return[];const c=a.transKeepBasicHtmlNodesFor||[],d=n&&new RegExp(c.map(x=>`<${x}`).join("|")).test(n);if(!e&&!t&&!d&&!o)return[n];const u=t??{},f=x=>{M(x).forEach(g=>{_(g)||(K(g)?f(Z(g)):U(g)&&!j.isValidElement(g)&&Object.assign(u,g))})};f(e);const E=Tt(n,c,u),V=wt.parse(`<0>${E}</0>`),p={...u,...i},m=(x,k,g)=>{const C=Z(x),I=b(C,k.children,g);return Et(C)&&I.length===0||x.props?.i18nIsDynamicList?C:I},v=(x,k,g,C,I)=>{x.dummy?(x.children=k,g.push(j.cloneElement(x,{key:C},I?void 0:k))):g.push(...j.Children.map([x],h=>{const l="data-i18n-is-dynamic-list",A={key:C,[l]:void 0};return h&&h.props&&Object.keys(h.props).forEach(T=>{T==="ref"||T==="children"||T==="i18nIsDynamicList"||T===l||(A[T]=h.props[T])}),j.cloneElement(h,A,I?null:k)}))},b=(x,k,g)=>{const C=M(x);return M(k).reduce((h,l,A)=>{const T=l.children?.[0]?.content&&r.services.interpolator.interpolate(l.children[0].content,p,r.language);if(l.type==="tag"){let N=C[parseInt(l.name,10)];!N&&t&&(N=t[l.name]),g.length===1&&!N&&(N=g[0][l.name]),N||(N={});const W={...l.attrs};o&&Object.keys(W).forEach(y=>{const F=W[y];_(F)&&(W[y]=Ae(F))});const S=Object.keys(W).length!==0?kt({props:W},N):N,$=j.isValidElement(S),R=$&&K(l,!0)&&!l.voidElement,D=d&&U(S)&&S.dummy&&!$,B=U(t)&&Object.hasOwnProperty.call(t,l.name);if(_(S)){const y=r.services.interpolator.interpolate(S,p,r.language);h.push(y)}else if(K(S)||R){const y=m(S,l,g);v(S,y,h,A)}else if(D){const y=b(C,l.children,g);v(S,y,h,A)}else if(Number.isNaN(parseFloat(l.name)))if(B){const y=m(S,l,g);v(S,y,h,A,l.voidElement)}else if(a.transSupportBasicHtmlNodes&&c.indexOf(l.name)>-1)if(l.voidElement)h.push(j.createElement(l.name,{key:`${l.name}-${A}`}));else{const y=b(C,l.children,g);h.push(j.createElement(l.name,{key:`${l.name}-${A}`},y))}else if(l.voidElement)h.push(`<${l.name} />`);else{const y=b(C,l.children,g);h.push(`<${l.name}>${y}</${l.name}>`)}else if(U(S)&&!$){const y=l.children[0]?T:null;y&&h.push(y)}else v(S,T,h,A,l.children.length!==1||!T)}else if(l.type==="text"){const N=a.transWrapTextNodes,W=typeof a.unescape=="function"?a.unescape:xe().unescape,S=o?W(r.services.interpolator.interpolate(l.content,p,r.language)):r.services.interpolator.interpolate(l.content,p,r.language);N?h.push(j.createElement(N,{key:`${l.name}-${A}`},S)):h.push(S)}return h},[])},P=b([{dummy:!0,children:e||[]}],V,M(e||[]));return Z(P[0])},ye=(e,t,n)=>{const r=e.key||t,a=j.cloneElement(e,{key:r});if(!a.props||!a.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return a;function i(){return j.createElement(j.Fragment,null,a)}return j.createElement(i,{key:r})},$t=(e,t)=>e.map((n,r)=>ye(n,r,t)),Wt=(e,t)=>{const n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:ye(e[r],r,t)})}),n},It=(e,t,n,r)=>e?Array.isArray(e)?$t(e,t):U(e)?Wt(e,t):(me(n,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:r}),null):null,Dt=e=>!U(e)||Array.isArray(e)?!1:Object.keys(e).reduce((t,n)=>t&&Number.isNaN(Number.parseFloat(n)),!0);function Ot({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:u,i18n:f,t:E,shouldUnescape:V,...p}){const m=f||pe();if(!m)return me(m,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:r}),e;const v=E||m.t.bind(m)||(L=>L),b={...xe(),...m.options?.react};let P=u||v.ns||m.options?.defaultNS;P=_(P)?[P]:P||["translation"];const{transDefaultProps:x}=b,k=x?.tOptions?{...x.tOptions,...i}:i,g=V??x?.shouldUnescape,C=x?.values?{...x.values,...o}:o,I=x?.components?{...x.components,...d}:d,h=he(e,b,m,r),l=c||k?.defaultValue||h||b.transEmptyNodeValue||(typeof r=="function"?Ce(r):r),{hashTransKey:A}=b,T=r||(A?A(h||l):h||l);m.options?.interpolation?.defaultVariables?o=C&&Object.keys(C).length>0?{...C,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables}:o=C;const N=Vt(e);N&&typeof N.count=="number"&&t===void 0&&(t=N.count);const W=o||t!==void 0&&!m.options?.interpolation?.alwaysFormat||!e?k.interpolation:{interpolation:{...k.interpolation,prefix:"#$?",suffix:"?$#"}},S={...k,context:a||k.context,count:t,...o,...W,defaultValue:l,ns:P};let $=T?v(T,S):l;$===T&&l&&($=l);const R=It(I,$,m,r);let D=R||e,B=null;Dt(R)&&(B=R,D=e);const y=Pt(D,B,$,m,b,S,g),F=n??b.defaultTransParent;return F?j.createElement(F,p,y):y}function ue({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i={},values:o,defaults:c,components:d,ns:u,i18n:f,t:E,shouldUnescape:V,...p}){const{i18n:m,defaultNS:v}=j.useContext(we)||{},b=f||m||pe(),P=E||b?.t.bind(b);return Ot({children:e,count:t,parent:n,i18nKey:r,context:a,tOptions:i,values:o,defaults:c,components:d,ns:u||P?.ns||v||b?.options?.defaultNS,i18n:b,t:E,shouldUnescape:V,...p})}async function Rt(){const e=await fetch("/api/cliproxy/sync/status");if(!e.ok){let t="Failed to fetch sync status";try{const n=await e.json();t=n.error||n.message||t}catch{}throw new Error(t)}return e.json()}async function Ft(){const e=new AbortController,t=setTimeout(()=>e.abort(),3e4);try{const n=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:e.signal});if(!n.ok){let r="Sync failed";try{const a=await n.json();r=a.error||a.message||r}catch{}throw new Error(r)}return n.json()}catch(n){throw n instanceof Error&&n.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):n}finally{clearTimeout(t)}}function Lt(){return fe({queryKey:["cliproxy-sync-status"],queryFn:Rt,refetchInterval:3e4,retry:1,staleTime:1e4})}function Ut(){const e=tt();return st({mutationFn:Ft,onSuccess:t=>{e.invalidateQueries({queryKey:["cliproxy-sync-status"]}),e.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),t.syncedCount===0?J.info("No profiles to sync"):J.success(`Synced ${t.syncedCount} profile${t.syncedCount===1?"":"s"} to CLIProxy`)},onError:t=>{J.error(`Sync failed: ${t.message}`)}})}function de(e){return e.replace(/-\d+$/,"").split(".").map(Number)}function re(e,t){const n=de(e),r=de(t);for(let a=0;a<3;a+=1){const i=n[a]||0,o=r[a]||0;if(i>o)return 1;if(i<o)return-1}return 0}function te(e,t){return re(e,t)>0}function se(e,t,n){return re(e,t)>=0&&re(e,n)<=0}function qt(e){if(!e)return"";const t=new Date(e).getTime(),r=Date.now()-t,a=Math.floor(r/(1e3*60*60)),i=Math.floor(r%(1e3*60*60)/(1e3*60));return a>0?`${a}h ${i}m`:`${i}m`}function Mt(e,t){if(!e)return"";const n=Date.now()-e,r=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return r<1?t("proxyStatusWidget.justNow"):r<60?t("proxyStatusWidget.minutesAgo",{count:r}):t("proxyStatusWidget.hoursAgo",{count:a})}function H({icon:e,tooltip:t,onClick:n,disabled:r,isPending:a,className:i,variant:o="ghost"}){return s.jsxs(_e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx(ne,{variant:o==="destructive-ghost"?"ghost":o,size:"sm",className:q("h-7 w-7 p-0",o==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",i),onClick:n,disabled:r,children:a?s.jsx(z,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(e,{className:"w-3.5 h-3.5"})})}),s.jsx(ze,{side:"bottom",className:"text-xs",children:t})]})}function Xt(){const{t:e}=Ee(),{data:t,isLoading:n}=ke(),{data:r}=Ve(),{data:a,isLoading:i}=Te(),o=Pe(),c=$e(),d=We(),u=Ie(),{data:f}=Lt(),{mutate:E,isPending:V}=Ut(),[p,m]=j.useState(!1),[v,b]=j.useState(""),[P,x]=j.useState(!1),[k,g]=j.useState(null),[C,I]=j.useState(null),{data:h}=fe({queryKey:["cliproxy-server-config"],queryFn:()=>He.cliproxyServer.get(),staleTime:3e4}),l=nt({mutationKey:["update-backend"]})>0,A=h?.remote,T=A?.enabled&&A?.host,N=t?.running??!1,W=o.isPending||c.isPending||d.isPending||u.isPending||l||V,S=r?.hasUpdate??!1,$=r?.isStable===!1,R=r?.currentVersion,D=f?.configured??!1,B=e(D?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),y=$?r?.maxStableVersion||a?.latestStable:r?.latestVersion,F=a?.maxStableVersion||r?.maxStableVersion||"6.6.80",L=a?.faultyRange,be=L&&`${L.min.replace(/-\d+$/,"")}-${L.max.replace(/-\d+$/,"")}`,Q=(w,O)=>{g(w),I(O),x(!0)},ae=async w=>{if(!w)return;const O=te(w,F);if(L!==void 0&&se(w,L.min,L.max)){Q(w,"faulty");return}if(O){Q(w,"experimental");return}try{const ie=await u.mutateAsync({version:w});ie.requiresConfirmation&&Q(w,ie.isFaulty?"faulty":"experimental")}catch{}},je=()=>{k&&u.mutate({version:k,force:!0}),x(!1),g(null),I(null)},ve=()=>{x(!1),g(null),I(null)},Ne=T?(()=>{const w=A.protocol||"http",O=A.port||(w==="https"?443:80);return w==="https"&&O===443||w==="http"&&O===80?A.host:`${A.host}:${O}`})():null;return T?s.jsxs("div",{className:q("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(rt,{className:"w-4 h-4 text-blue-500"}),s.jsx("span",{className:"text-sm font-medium",children:e("proxyStatusWidget.remoteProxy")}),s.jsx(oe,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:e("proxyStatusWidget.active")})]}),s.jsx(at,{className:"w-3 h-3 text-blue-600"})]}),s.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[s.jsx("div",{className:"flex items-center gap-1 mb-1",children:s.jsx("span",{className:"font-mono",children:Ne})}),s.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:e("proxyStatusWidget.trafficAutoRouted")})]})]}):s.jsx(De,{delayDuration:300,children:s.jsxs("div",{className:q("rounded-lg border p-3 transition-colors",N?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:q("w-2 h-2 rounded-full",N?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),s.jsx("span",{className:"text-sm font-medium",children:r?.backendLabel??"CLIProxy"})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[n?s.jsx(z,{className:"w-3 h-3 animate-spin text-muted-foreground"}):N?s.jsxs(s.Fragment,{children:[s.jsx(H,{icon:V?z:it,tooltip:e("proxyStatusWidget.tooltipSync"),onClick:()=>E(),disabled:!D||W,isPending:V}),s.jsx(H,{icon:ot,tooltip:e("proxyStatusWidget.tooltipRestart"),onClick:()=>d.mutate(),disabled:W,isPending:d.isPending}),s.jsx(H,{icon:lt,tooltip:e("proxyStatusWidget.tooltipStop"),onClick:()=>c.mutate(),disabled:W,isPending:c.isPending,variant:"destructive-ghost"})]}):null,s.jsx(H,{icon:p?ct:ut,tooltip:e(p?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:()=>m(!p),className:p?"bg-muted":void 0})]})]}),R&&s.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[s.jsxs("span",{className:q("text-xs font-mono text-muted-foreground",$&&"text-amber-600 dark:text-amber-400"),children:["v",R]}),(S||$)&&y&&s.jsxs(oe,{variant:"secondary",className:q("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",$?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>void ae(y),title:e($?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[$?s.jsx(dt,{className:"w-2.5 h-2.5"}):s.jsx(mt,{className:"w-2.5 h-2.5"}),y]})]}),N&&t&&s.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[s.jsx("span",{className:"flex items-center gap-1",children:e("proxyStatusWidget.port",{port:t.port})}),t.sessionCount!==void 0&&t.sessionCount>0&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(pt,{className:"w-3 h-3"}),e("proxyStatusWidget.sessionCount",{count:t.sessionCount})]}),t.startedAt&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(xt,{className:"w-3 h-3"}),qt(t.startedAt)]})]}),s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[D?s.jsx(ft,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):s.jsx(gt,{className:"w-3 h-3 text-muted-foreground"}),s.jsx("span",{className:q("text-xs",D?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:B})]}),s.jsx(Oe,{open:p,onOpenChange:m,children:s.jsxs(Re,{className:"mt-3 pt-3 border-t border-muted",children:[s.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:e("proxyStatusWidget.versionManagement")}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Fe,{value:v,onValueChange:b,disabled:i,children:[s.jsx(Le,{className:"h-8 text-xs flex-1",children:s.jsx(Ue,{placeholder:e("proxyStatusWidget.selectVersionPlaceholder")})}),s.jsx(qe,{children:a?.versions.slice(0,20).map(w=>{const O=a?.maxStableVersion&&te(w,a.maxStableVersion),X=a?.faultyRange&&se(w,a.faultyRange.min,a.faultyRange.max);return s.jsx(Me,{value:w,className:"text-xs",children:s.jsxs("span",{className:"flex items-center gap-2",children:["v",w,w===a.latestStable&&s.jsx("span",{className:"text-green-600 dark:text-green-400",children:e("proxyStatusWidget.stable")}),(X||O)&&s.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},w)})})]}),s.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void ae(v),disabled:u.isPending||!v,children:[u.isPending?s.jsx(z,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(ht,{className:"w-3.5 h-3.5"}),e("proxyStatusWidget.install")]})]}),v&&a?.maxStableVersion&&te(v,a.maxStableVersion)&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[s.jsx(G,{className:"w-3.5 h-3.5 flex-shrink-0"}),s.jsx("span",{children:e("proxyStatusWidget.versionsAboveUnstable",{version:a.maxStableVersion})})]}),v&&a?.faultyRange&&se(v,a.faultyRange.min,a.faultyRange.max)&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[s.jsx(G,{className:"w-3.5 h-3.5 flex-shrink-0"}),s.jsx("span",{children:e("proxyStatusWidget.versionsKnownIssues",{version:v})})]}),r?.checkedAt&&s.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:e("proxyStatusWidget.lastChecked",{time:Mt(r.checkedAt,e)})})]})}),!N&&s.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:e("proxyStatusWidget.notRunning")}),s.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>o.mutate(),disabled:o.isPending,children:[o.isPending?s.jsx(z,{className:"w-3 h-3 animate-spin"}):s.jsx(yt,{className:"w-3 h-3"}),e("proxyStatusWidget.start")]})]}),s.jsx(Ke,{open:P,onOpenChange:x,children:s.jsxs(Ze,{children:[s.jsxs(Qe,{children:[s.jsxs(Xe,{className:"flex items-center gap-2",children:[s.jsx(G,{className:"w-5 h-5 text-amber-500"}),e(C==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),s.jsxs(Ye,{className:"space-y-2",children:[C==="faulty"?s.jsx("p",{children:s.jsx(ue,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:k??"",range:be||""},components:{strong:s.jsx("strong",{})}})}):s.jsx("p",{children:s.jsx(ue,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:k??"",maxStable:F},components:{strong:s.jsx("strong",{})}})}),s.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:e(C==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),s.jsx("p",{children:e("proxyStatusWidget.installUnstableConfirm")})]})]}),s.jsxs(Je,{children:[s.jsx(Ge,{onClick:ve,children:e("proxyStatusWidget.cancel")}),s.jsx(et,{onClick:je,className:"bg-amber-500 hover:bg-amber-600 text-white",children:e("proxyStatusWidget.installAnyway")})]})]})})]})})}export{Xt as P};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as n}from"./radix-ui-Zb8sVEtn.js";import{r as a}from"./react-vendor-CNOkPC89.js";import{e as P,f as Q,d as $,c as w,g as B,I as G,n as H}from"./index-BMHPMj0j.js";import{aK as L,ao as V,l as J}from"./icons-B9oTjo-t.js";function S(o){return o.trim().toLowerCase()}function M(o,h){return`${o}-option-${h.replace(/[^a-z0-9_-]+/gi,"-")}`}function ee({value:o,onChange:h,options:d,groups:g,placeholder:j,searchPlaceholder:k,emptyText:E,disabled:F,className:K,triggerClassName:q,contentClassName:R}){const[l,T]=a.useState(!1),[y,A]=a.useState(""),[i,u]=a.useState(),m=a.useId(),I=a.useRef(null),N=a.useRef({}),O=a.useMemo(()=>d.find(e=>e.value===o),[d,o]),f=a.useMemo(()=>{const e=S(y);return e?d.filter(t=>[t.searchText,...t.keywords??[]].some(c=>S(c).includes(e))):d},[d,y]),z=a.useMemo(()=>{const e=new Map((g??[]).map(r=>[r.key,r])),t=f.filter(r=>!r.groupKey||!e.has(r.groupKey)),c=(g??[]).map(r=>({...r,options:f.filter(x=>x.groupKey===r.key)})).filter(r=>r.options.length>0);return t.length===0?c:[{key:"__default",options:t},...c]},[f,g]),s=a.useMemo(()=>f.filter(e=>!e.disabled),[f]),D=O?.triggerContent??O?.itemContent,v=e=>{T(e),e||(A(""),u(void 0))},b=()=>I.current?.focus();a.useEffect(()=>{if(l){if(s.length===0){u(void 0);return}u(e=>e&&s.some(t=>t.value===e)?e:s.find(t=>t.value===o)?.value??s[0]?.value)}},[s,l,o]),a.useEffect(()=>{!l||!i||N.current[i]?.scrollIntoView({block:"nearest"})},[i,l]);const p=e=>{if(s.length===0)return;if(e==="first"){u(s[0]?.value);return}if(e==="last"){u(s.at(-1)?.value);return}const t=s.findIndex(_=>_.value===i),c=e==="next"?-1:s.length,r=t>=0?t:c,x=e==="next"?Math.min(r+1,s.length-1):Math.max(r-1,0);u(s[x]?.value)},C=e=>{h(e),v(!1)},U=()=>{if(!i)return;const e=s.find(t=>t.value===i);e&&C(e.value)};return n.jsxs(P,{open:l,onOpenChange:v,children:[n.jsx(Q,{asChild:!0,children:n.jsxs($,{type:"button",variant:"outline","aria-expanded":l,"aria-controls":l?m:void 0,"aria-haspopup":"dialog",disabled:F,onKeyDown:e=>{if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault(),v(!0);const t=()=>{b(),p(e.key==="ArrowDown"?"first":"last")};if(typeof requestAnimationFrame=="function"){requestAnimationFrame(t);return}setTimeout(t,0)},className:w("w-full justify-between font-normal",K,q,!D&&"text-muted-foreground"),children:[n.jsx("div",{className:"min-w-0 flex-1 text-left",children:D??n.jsx("span",{children:j})}),n.jsx(L,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),n.jsxs(B,{align:"start",className:w("w-[var(--radix-popover-trigger-width)] p-0",R),onOpenAutoFocus:e=>{if(e.preventDefault(),typeof requestAnimationFrame=="function"){requestAnimationFrame(b);return}setTimeout(b,0)},children:[n.jsx("div",{className:"border-b p-2",children:n.jsxs("div",{className:"relative",children:[n.jsx(V,{className:"text-muted-foreground absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2"}),n.jsx(G,{ref:I,value:y,onChange:e=>A(e.target.value),role:"combobox","aria-label":k,"aria-autocomplete":"list","aria-expanded":l,"aria-controls":m,"aria-activedescendant":i?M(m,i):void 0,onKeyDown:e=>{if(e.key==="ArrowDown"){e.preventDefault(),p("next");return}if(e.key==="ArrowUp"){e.preventDefault(),p("previous");return}if(e.key==="Home"){e.preventDefault(),p("first");return}if(e.key==="End"){e.preventDefault(),p("last");return}if(e.key==="Enter"){e.preventDefault(),U();return}e.key==="Escape"&&(e.preventDefault(),v(!1))},placeholder:k,className:"pl-8"})]})}),n.jsx(H,{className:"max-h-72",children:f.length===0?n.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:E}):n.jsx("div",{id:m,role:"listbox","aria-label":j,className:"p-1",children:z.map(e=>n.jsxs("div",{children:[e.label&&n.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:e.label}),e.options.map(t=>{const c=t.value===i,r=t.value===o;return n.jsxs("button",{id:M(m,t.value),type:"button",role:"option","aria-selected":r,disabled:t.disabled,tabIndex:-1,ref:x=>{N.current[t.value]=x},onMouseMove:()=>{t.disabled||u(t.value)},onFocus:()=>{t.disabled||u(t.value)},onClick:()=>C(t.value),className:w("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none","focus-visible:ring-ring focus-visible:ring-1",c&&"bg-accent text-accent-foreground",r&&"bg-accent text-accent-foreground",t.disabled&&"pointer-events-none opacity-50"),children:[n.jsx("div",{className:"min-w-0 flex-1",children:t.itemContent}),r&&n.jsx(J,{className:"h-4 w-4 shrink-0"})]},t.value)})]},e.key))})})]})]})}export{ee as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{L as P,r as o}from"./react-vendor-CNOkPC89.js";import{a as p,B as y,c as k,d as x,x as E,bf as M,C as g,j,k as N,_ as w,b as v,n as b,bg as $,bh as U,I as z,bi as B}from"./index-BMHPMj0j.js";import{$ as L,Y as Q,a$ as Y,w as q,E as G,N as J,a7 as V,C as F,b0 as H,ao as K}from"./icons-B9oTjo-t.js";import"./tanstack-DWm6aJ-G.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const W={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function X({status:s,className:a}){const{t}=p(),d={new:t("updates.statusNew"),stable:t("updates.statusStable"),planned:t("updates.statusPlanned")};return e.jsx(y,{variant:"outline",className:k("font-medium",W[s],a),children:d[s]})}const I="ccs:updates:notice-progress:v1";function Z(s){return s==="new"?"new":"seen"}function u(s,a){return a[s.id]??Z(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function ee(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(I);if(!s)return{};const a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[d,l]of Object.entries(a))typeof d=="string"&&(l==="new"||l==="seen"||l==="done"||l==="dismissed")&&(t[d]=l);return t}catch{return{}}}function se(s){typeof window>"u"||window.localStorage.setItem(I,JSON.stringify(s))}function R({state:s,className:a}){const{t}=p(),d={new:{label:t("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:t("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:t("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:t("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(y,{variant:"outline",className:k("gap-1.5 border text-[10px] font-medium",d.className,a),children:[d.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),d.label]})}function ae({action:s}){const{t:a}=p();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(x,{size:"sm",asChild:!0,children:e.jsxs(P,{to:s.path,children:[a("updates.open"),e.jsx(L,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(Q,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(E,{value:s.command})]})]})}function re({notice:s,progress:a,relatedEntries:t,onUpdateProgress:d}){const{t:l}=p();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a&&e.jsx(R,{state:a}),e.jsx(X,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:l("updates.published",{date:M(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>d("done"),children:[e.jsx(q,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(G,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(J,{className:"h-4 w-4"}),l("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(g,{className:"h-full overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:l("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(n=>e.jsx(ae,{action:n},`${s.id}-${n.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.impactedIntegrations")}),e.jsx(w,{children:l("updates.impactedDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:n.name}),e.jsx(y,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:$[n.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.routes[0]&&e.jsx(x,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(P,{to:n.routes[0].path,children:n.routes[0].label})}),n.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:n.commands[0]}),e.jsx(E,{value:n.commands[0]})]})]})]},n.id))})})})]}),e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.whyMatters")}),e.jsx(w,{children:l("updates.whyMattersDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(n=>e.jsxs("li",{children:["- ",n]},`${s.id}-${n}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:l("updates.noUpdates")})})}function te({notice:s,progress:a,selected:t,onSelect:d}){return e.jsxs("button",{type:"button",onClick:d,className:k("w-full rounded-lg border px-3 py-3 text-left transition-colors",t?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(F,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:M(s.publishedAt)}),e.jsx(R,{state:a})]})]})}function de(s,a){return a?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(d=>`${d.label} ${d.description} ${d.command||""}`),...s.routes.map(d=>d.label)].join(" ").toLowerCase().includes(a):!0}function be(){const{t:s}=p(),a=o.useMemo(()=>[...U].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,T]=o.useState(null);o.useEffect(()=>{se(c)},[c]);const h=o.useMemo(()=>{const r=l.trim().toLowerCase();return a.filter(i=>{const f=u(i,c);return de(i,r)?t==="done"?f==="done":t==="inbox"?A(f):!0:!1})},[a,c,l,t]),m=o.useMemo(()=>{const r=t==="all"?a:h;return r.find(i=>i.id===S)??r[0]??null},[a,S,t,h]),D=r=>{T(r.id),C(i=>u(r,i)!=="new"?i:{...i,[r.id]:"seen"})},O=o.useMemo(()=>a.filter(r=>A(u(r,c))).length,[a,c]),_=o.useMemo(()=>a.filter(r=>u(r,c)==="done").length,[a,c]);return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:O})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(K,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(z,{value:l,onChange:r=>n(r.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(r=>e.jsx(x,{size:"sm",variant:t===r.id?"default":"outline",onClick:()=>d(r.id),children:r.label},r.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(r=>e.jsx(te,{notice:r,progress:u(r,c),selected:m?.id===r.id,onSelect:()=>D(r)},r.id))})})]}),e.jsx(re,{notice:m,progress:m?u(m,c):null,relatedEntries:m?B(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
|