@kaitranntt/ccs 6.7.0-dev.5 → 6.7.1-dev.1
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 +45 -23
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +24 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/services/index.d.ts +10 -0
- package/dist/api/services/index.d.ts.map +1 -0
- package/dist/api/services/index.js +26 -0
- package/dist/api/services/index.js.map +1 -0
- package/dist/api/services/profile-reader.d.ts +28 -0
- package/dist/api/services/profile-reader.d.ts.map +1 -0
- package/dist/api/services/profile-reader.js +148 -0
- package/dist/api/services/profile-reader.js.map +1 -0
- package/dist/api/services/profile-types.d.ts +42 -0
- package/dist/api/services/profile-types.d.ts.map +1 -0
- package/dist/api/services/profile-types.js +8 -0
- package/dist/api/services/profile-types.js.map +1 -0
- package/dist/api/services/profile-writer.d.ts +6 -0
- package/dist/api/services/profile-writer.d.ts.map +1 -0
- package/dist/api/services/profile-writer.js +176 -0
- package/dist/api/services/profile-writer.js.map +1 -0
- package/dist/api/services/validation-service.d.ts +26 -0
- package/dist/api/services/validation-service.d.ts.map +1 -0
- package/dist/api/services/validation-service.js +77 -0
- package/dist/api/services/validation-service.js.map +1 -0
- package/dist/auth/auth-commands.d.ts +16 -22
- package/dist/auth/auth-commands.d.ts.map +1 -1
- package/dist/auth/auth-commands.js +29 -467
- package/dist/auth/auth-commands.js.map +1 -1
- package/dist/auth/commands/create-command.d.ts +11 -0
- package/dist/auth/commands/create-command.d.ts.map +1 -0
- package/dist/auth/commands/create-command.js +137 -0
- package/dist/auth/commands/create-command.js.map +1 -0
- package/dist/auth/commands/default-command.d.ts +15 -0
- package/dist/auth/commands/default-command.d.ts.map +1 -0
- package/dist/auth/commands/default-command.js +71 -0
- package/dist/auth/commands/default-command.js.map +1 -0
- package/dist/auth/commands/index.d.ts +12 -0
- package/dist/auth/commands/index.d.ts.map +1 -0
- package/dist/auth/commands/index.js +25 -0
- package/dist/auth/commands/index.js.map +1 -0
- package/dist/auth/commands/list-command.d.ts +11 -0
- package/dist/auth/commands/list-command.d.ts.map +1 -0
- package/dist/auth/commands/list-command.js +124 -0
- package/dist/auth/commands/list-command.js.map +1 -0
- package/dist/auth/commands/remove-command.d.ts +11 -0
- package/dist/auth/commands/remove-command.d.ts.map +1 -0
- package/dist/auth/commands/remove-command.js +102 -0
- package/dist/auth/commands/remove-command.js.map +1 -0
- package/dist/auth/commands/show-command.d.ts +11 -0
- package/dist/auth/commands/show-command.d.ts.map +1 -0
- package/dist/auth/commands/show-command.js +103 -0
- package/dist/auth/commands/show-command.js.map +1 -0
- package/dist/auth/commands/types.d.ts +50 -0
- package/dist/auth/commands/types.d.ts.map +1 -0
- package/dist/auth/commands/types.js +26 -0
- package/dist/auth/commands/types.js.map +1 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +16 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/profile-detector.d.ts +0 -5
- package/dist/auth/profile-detector.d.ts.map +1 -1
- package/dist/auth/profile-detector.js +1 -9
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/auth/profile-registry.d.ts +0 -4
- package/dist/auth/profile-registry.d.ts.map +1 -1
- package/dist/auth/profile-registry.js +3 -10
- package/dist/auth/profile-registry.js.map +1 -1
- package/dist/ccs.js +21 -4
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/auth/auth-types.d.ts +85 -0
- package/dist/cliproxy/auth/auth-types.d.ts.map +1 -0
- package/dist/cliproxy/auth/auth-types.js +100 -0
- package/dist/cliproxy/auth/auth-types.js.map +1 -0
- package/dist/cliproxy/auth/environment-detector.d.ts +30 -0
- package/dist/cliproxy/auth/environment-detector.d.ts.map +1 -0
- package/dist/cliproxy/auth/environment-detector.js +124 -0
- package/dist/cliproxy/auth/environment-detector.js.map +1 -0
- package/dist/cliproxy/auth/index.d.ts +11 -0
- package/dist/cliproxy/auth/index.d.ts.map +1 -0
- package/dist/cliproxy/auth/index.js +35 -0
- package/dist/cliproxy/auth/index.js.map +1 -0
- package/dist/cliproxy/auth/oauth-handler.d.ts +29 -0
- package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -0
- package/dist/cliproxy/auth/oauth-handler.js +205 -0
- package/dist/cliproxy/auth/oauth-handler.js.map +1 -0
- package/dist/cliproxy/auth/oauth-process.d.ts +27 -0
- package/dist/cliproxy/auth/oauth-process.d.ts.map +1 -0
- package/dist/cliproxy/auth/oauth-process.js +209 -0
- package/dist/cliproxy/auth/oauth-process.js.map +1 -0
- package/dist/cliproxy/auth/token-manager.d.ts +53 -0
- package/dist/cliproxy/auth/token-manager.d.ts.map +1 -0
- package/dist/cliproxy/auth/token-manager.js +250 -0
- package/dist/cliproxy/auth/token-manager.js.map +1 -0
- package/dist/cliproxy/auth-handler.d.ts +13 -103
- package/dist/cliproxy/auth-handler.d.ts.map +1 -1
- package/dist/cliproxy/auth-handler.js +35 -766
- package/dist/cliproxy/auth-handler.js.map +1 -1
- package/dist/cliproxy/binary/downloader.d.ts +29 -0
- package/dist/cliproxy/binary/downloader.d.ts.map +1 -0
- package/dist/cliproxy/binary/downloader.js +218 -0
- package/dist/cliproxy/binary/downloader.js.map +1 -0
- package/dist/cliproxy/binary/extractor.d.ts +12 -0
- package/dist/cliproxy/binary/extractor.d.ts.map +1 -0
- package/dist/cliproxy/binary/extractor.js +27 -0
- package/dist/cliproxy/binary/extractor.js.map +1 -0
- package/dist/cliproxy/binary/index.d.ts +13 -0
- package/dist/cliproxy/binary/index.d.ts.map +1 -0
- package/dist/cliproxy/binary/index.js +53 -0
- package/dist/cliproxy/binary/index.js.map +1 -0
- package/dist/cliproxy/binary/installer.d.ts +24 -0
- package/dist/cliproxy/binary/installer.d.ts.map +1 -0
- package/dist/cliproxy/binary/installer.js +117 -0
- package/dist/cliproxy/binary/installer.js.map +1 -0
- package/dist/cliproxy/binary/lifecycle.d.ts +11 -0
- package/dist/cliproxy/binary/lifecycle.d.ts.map +1 -0
- package/dist/cliproxy/binary/lifecycle.js +106 -0
- package/dist/cliproxy/binary/lifecycle.js.map +1 -0
- package/dist/cliproxy/binary/tar-extractor.d.ts +9 -0
- package/dist/cliproxy/binary/tar-extractor.d.ts.map +1 -0
- package/dist/cliproxy/binary/tar-extractor.js +118 -0
- package/dist/cliproxy/binary/tar-extractor.js.map +1 -0
- package/dist/cliproxy/binary/types.d.ts +24 -0
- package/dist/cliproxy/binary/types.d.ts.map +1 -0
- package/dist/cliproxy/binary/types.js +14 -0
- package/dist/cliproxy/binary/types.js.map +1 -0
- package/dist/cliproxy/binary/updater.d.ts +7 -0
- package/dist/cliproxy/binary/updater.d.ts.map +1 -0
- package/dist/cliproxy/binary/updater.js +18 -0
- package/dist/cliproxy/binary/updater.js.map +1 -0
- package/dist/cliproxy/binary/verifier.d.ts +18 -0
- package/dist/cliproxy/binary/verifier.d.ts.map +1 -0
- package/dist/cliproxy/binary/verifier.js +82 -0
- package/dist/cliproxy/binary/verifier.js.map +1 -0
- package/dist/cliproxy/binary/version-cache.d.ts +46 -0
- package/dist/cliproxy/binary/version-cache.d.ts.map +1 -0
- package/dist/cliproxy/binary/version-cache.js +171 -0
- package/dist/cliproxy/binary/version-cache.js.map +1 -0
- package/dist/cliproxy/binary/version-checker.d.ts +19 -0
- package/dist/cliproxy/binary/version-checker.d.ts.map +1 -0
- package/dist/cliproxy/binary/version-checker.js +77 -0
- package/dist/cliproxy/binary/version-checker.js.map +1 -0
- package/dist/cliproxy/binary/zip-extractor.d.ts +9 -0
- package/dist/cliproxy/binary/zip-extractor.d.ts.map +1 -0
- package/dist/cliproxy/binary/zip-extractor.js +110 -0
- package/dist/cliproxy/binary/zip-extractor.js.map +1 -0
- package/dist/cliproxy/binary-manager.d.ts +16 -170
- package/dist/cliproxy/binary-manager.d.ts.map +1 -1
- package/dist/cliproxy/binary-manager.js +38 -865
- package/dist/cliproxy/binary-manager.js.map +1 -1
- package/dist/cliproxy/services/binary-service.d.ts +65 -0
- package/dist/cliproxy/services/binary-service.d.ts.map +1 -0
- package/dist/cliproxy/services/binary-service.js +140 -0
- package/dist/cliproxy/services/binary-service.js.map +1 -0
- package/dist/cliproxy/services/index.d.ts +8 -0
- package/dist/cliproxy/services/index.d.ts.map +1 -0
- package/dist/cliproxy/services/index.js +31 -0
- package/dist/cliproxy/services/index.js.map +1 -0
- package/dist/cliproxy/services/proxy-lifecycle-service.d.ts +38 -0
- package/dist/cliproxy/services/proxy-lifecycle-service.d.ts.map +1 -0
- package/dist/cliproxy/services/proxy-lifecycle-service.js +41 -0
- package/dist/cliproxy/services/proxy-lifecycle-service.js.map +1 -0
- package/dist/cliproxy/services/variant-config-adapter.d.ts +38 -0
- package/dist/cliproxy/services/variant-config-adapter.d.ts.map +1 -0
- package/dist/cliproxy/services/variant-config-adapter.js +172 -0
- package/dist/cliproxy/services/variant-config-adapter.js.map +1 -0
- package/dist/cliproxy/services/variant-service.d.ts +37 -0
- package/dist/cliproxy/services/variant-service.d.ts.map +1 -0
- package/dist/cliproxy/services/variant-service.js +128 -0
- package/dist/cliproxy/services/variant-service.js.map +1 -0
- package/dist/cliproxy/services/variant-settings.d.ts +32 -0
- package/dist/cliproxy/services/variant-settings.d.ts.map +1 -0
- package/dist/cliproxy/services/variant-settings.js +128 -0
- package/dist/cliproxy/services/variant-settings.js.map +1 -0
- package/dist/commands/api-command.d.ts +3 -6
- package/dist/commands/api-command.d.ts.map +1 -1
- package/dist/commands/api-command.js +84 -445
- package/dist/commands/api-command.js.map +1 -1
- package/dist/commands/cliproxy-command.d.ts +0 -3
- package/dist/commands/cliproxy-command.d.ts.map +1 -1
- package/dist/commands/cliproxy-command.js +182 -621
- package/dist/commands/cliproxy-command.js.map +1 -1
- package/dist/commands/index.d.ts +17 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +33 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/config/unified-config-loader.d.ts +7 -0
- package/dist/config/unified-config-loader.d.ts.map +1 -1
- package/dist/config/unified-config-loader.js +11 -1
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/delegation/executor/index.d.ts +7 -0
- package/dist/delegation/executor/index.d.ts.map +1 -0
- package/dist/delegation/executor/index.js +28 -0
- package/dist/delegation/executor/index.js.map +1 -0
- package/dist/delegation/executor/result-aggregator.d.ts +30 -0
- package/dist/delegation/executor/result-aggregator.d.ts.map +1 -0
- package/dist/delegation/executor/result-aggregator.js +66 -0
- package/dist/delegation/executor/result-aggregator.js.map +1 -0
- package/dist/delegation/executor/stream-parser.d.ts +28 -0
- package/dist/delegation/executor/stream-parser.d.ts.map +1 -0
- package/dist/delegation/executor/stream-parser.js +140 -0
- package/dist/delegation/executor/stream-parser.js.map +1 -0
- package/dist/delegation/executor/types.d.ts +121 -0
- package/dist/delegation/executor/types.d.ts.map +1 -0
- package/dist/delegation/executor/types.js +6 -0
- package/dist/delegation/executor/types.js.map +1 -0
- package/dist/delegation/headless-executor.d.ts +13 -91
- package/dist/delegation/headless-executor.d.ts.map +1 -1
- package/dist/delegation/headless-executor.js +84 -291
- package/dist/delegation/headless-executor.js.map +1 -1
- package/dist/delegation/index.d.ts +11 -0
- package/dist/delegation/index.d.ts.map +1 -0
- package/dist/delegation/index.js +33 -0
- package/dist/delegation/index.js.map +1 -0
- package/dist/delegation/result-formatter.d.ts +1 -30
- package/dist/delegation/result-formatter.d.ts.map +1 -1
- package/dist/delegation/result-formatter.js.map +1 -1
- package/dist/errors/cleanup-registry.d.ts +64 -0
- package/dist/errors/cleanup-registry.d.ts.map +1 -0
- package/dist/errors/cleanup-registry.js +141 -0
- package/dist/errors/cleanup-registry.js.map +1 -0
- package/dist/errors/error-handler.d.ts +45 -0
- package/dist/errors/error-handler.d.ts.map +1 -0
- package/dist/errors/error-handler.js +150 -0
- package/dist/errors/error-handler.js.map +1 -0
- package/dist/errors/error-types.d.ts +102 -0
- package/dist/errors/error-types.d.ts.map +1 -0
- package/dist/errors/error-types.js +158 -0
- package/dist/errors/error-types.js.map +1 -0
- package/dist/errors/exit-codes.d.ts +49 -0
- package/dist/errors/exit-codes.d.ts.map +1 -0
- package/dist/errors/exit-codes.js +72 -0
- package/dist/errors/exit-codes.js.map +1 -0
- package/dist/errors/index.d.ts +29 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +62 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/glmt/glmt-transformer.d.ts +29 -248
- package/dist/glmt/glmt-transformer.d.ts.map +1 -1
- package/dist/glmt/glmt-transformer.js +63 -718
- package/dist/glmt/glmt-transformer.js.map +1 -1
- package/dist/glmt/index.d.ts +14 -0
- package/dist/glmt/index.d.ts.map +1 -0
- package/dist/glmt/index.js +41 -0
- package/dist/glmt/index.js.map +1 -0
- package/dist/glmt/pipeline/content-transformer.d.ts +39 -0
- package/dist/glmt/pipeline/content-transformer.d.ts.map +1 -0
- package/dist/glmt/pipeline/content-transformer.js +162 -0
- package/dist/glmt/pipeline/content-transformer.js.map +1 -0
- package/dist/glmt/pipeline/index.d.ts +12 -0
- package/dist/glmt/pipeline/index.d.ts.map +1 -0
- package/dist/glmt/pipeline/index.js +20 -0
- package/dist/glmt/pipeline/index.js.map +1 -0
- package/dist/glmt/pipeline/request-transformer.d.ts +31 -0
- package/dist/glmt/pipeline/request-transformer.d.ts.map +1 -0
- package/dist/glmt/pipeline/request-transformer.js +116 -0
- package/dist/glmt/pipeline/request-transformer.js.map +1 -0
- package/dist/glmt/pipeline/response-builder.d.ts +52 -0
- package/dist/glmt/pipeline/response-builder.d.ts.map +1 -0
- package/dist/glmt/pipeline/response-builder.js +205 -0
- package/dist/glmt/pipeline/response-builder.js.map +1 -0
- package/dist/glmt/pipeline/stream-parser.d.ts +59 -0
- package/dist/glmt/pipeline/stream-parser.d.ts.map +1 -0
- package/dist/glmt/pipeline/stream-parser.js +241 -0
- package/dist/glmt/pipeline/stream-parser.js.map +1 -0
- package/dist/glmt/pipeline/tool-call-handler.d.ts +22 -0
- package/dist/glmt/pipeline/tool-call-handler.d.ts.map +1 -0
- package/dist/glmt/pipeline/tool-call-handler.js +87 -0
- package/dist/glmt/pipeline/tool-call-handler.js.map +1 -0
- package/dist/glmt/pipeline/types.d.ts +159 -0
- package/dist/glmt/pipeline/types.d.ts.map +1 -0
- package/dist/glmt/pipeline/types.js +6 -0
- package/dist/glmt/pipeline/types.js.map +1 -0
- package/dist/management/checks/cliproxy-check.d.ts +37 -0
- package/dist/management/checks/cliproxy-check.d.ts.map +1 -0
- package/dist/management/checks/cliproxy-check.js +187 -0
- package/dist/management/checks/cliproxy-check.js.map +1 -0
- package/dist/management/checks/config-check.d.ts +27 -0
- package/dist/management/checks/config-check.d.ts.map +1 -0
- package/dist/management/checks/config-check.js +158 -0
- package/dist/management/checks/config-check.js.map +1 -0
- package/dist/management/checks/env-check.d.ts +17 -0
- package/dist/management/checks/env-check.d.ts.map +1 -0
- package/dist/management/checks/env-check.js +71 -0
- package/dist/management/checks/env-check.js.map +1 -0
- package/dist/management/checks/index.d.ts +12 -0
- package/dist/management/checks/index.d.ts.map +1 -0
- package/dist/management/checks/index.js +48 -0
- package/dist/management/checks/index.js.map +1 -0
- package/dist/management/checks/oauth-check.d.ts +16 -0
- package/dist/management/checks/oauth-check.d.ts.map +1 -0
- package/dist/management/checks/oauth-check.js +68 -0
- package/dist/management/checks/oauth-check.js.map +1 -0
- package/dist/management/checks/profile-check.d.ts +36 -0
- package/dist/management/checks/profile-check.d.ts.map +1 -0
- package/dist/management/checks/profile-check.js +165 -0
- package/dist/management/checks/profile-check.js.map +1 -0
- package/dist/management/checks/symlink-check.d.ts +30 -0
- package/dist/management/checks/symlink-check.d.ts.map +1 -0
- package/dist/management/checks/symlink-check.js +204 -0
- package/dist/management/checks/symlink-check.js.map +1 -0
- package/dist/management/checks/system-check.d.ts +25 -0
- package/dist/management/checks/system-check.d.ts.map +1 -0
- package/dist/management/checks/system-check.js +136 -0
- package/dist/management/checks/system-check.js.map +1 -0
- package/dist/management/checks/types.d.ts +64 -0
- package/dist/management/checks/types.d.ts.map +1 -0
- package/dist/management/checks/types.js +63 -0
- package/dist/management/checks/types.js.map +1 -0
- package/dist/management/doctor.d.ts +3 -92
- package/dist/management/doctor.d.ts.map +1 -1
- package/dist/management/doctor.js +15 -831
- package/dist/management/doctor.js.map +1 -1
- package/dist/management/index.d.ts +15 -0
- package/dist/management/index.d.ts.map +1 -0
- package/dist/management/index.js +56 -0
- package/dist/management/index.js.map +1 -0
- package/dist/management/repair/auto-repair.d.ts +13 -0
- package/dist/management/repair/auto-repair.d.ts.map +1 -0
- package/dist/management/repair/auto-repair.js +170 -0
- package/dist/management/repair/auto-repair.js.map +1 -0
- package/dist/management/repair/index.d.ts +5 -0
- package/dist/management/repair/index.d.ts.map +1 -0
- package/dist/management/repair/index.js +9 -0
- package/dist/management/repair/index.js.map +1 -0
- package/dist/types/delegation.d.ts +1 -13
- package/dist/types/delegation.d.ts.map +1 -1
- package/dist/types/utils.d.ts +27 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/ui/assets/{accounts-p1_nf0Jy.js → accounts-BqDNXZu4.js} +1 -1
- package/dist/ui/assets/analytics-DQMyOsqI.js +1 -0
- package/dist/ui/assets/api-Bzyq4XP7.js +1 -0
- package/dist/ui/assets/{card-CCDc-Mx9.js → card-CIN0KDsX.js} +1 -1
- package/dist/ui/assets/cliproxy-5iKdPrEG.js +3 -0
- package/dist/ui/assets/cliproxy-control-panel-CJ2CfYod.js +1 -0
- package/dist/ui/assets/{code-editor-Br9x-r-E.js → code-editor-CDmNFLQ6.js} +1 -1
- package/dist/ui/assets/confirm-dialog-CaiDQikc.js +1 -0
- package/dist/ui/assets/copilot-nS6iAyk2.js +4 -0
- package/dist/ui/assets/form-utils-DP6ILe7Z.js +20 -0
- package/dist/ui/assets/health-DYOQfC7u.js +1 -0
- package/dist/ui/assets/{icons-BOsxPbiD.js → icons-ZmwVoUeR.js} +1 -1
- package/dist/ui/assets/index-C6Dah-xh.js +46 -0
- package/dist/ui/assets/index-It66SkKf.css +1 -0
- package/dist/ui/assets/{radix-ui-DFHQr9A5.js → radix-ui-CV3R9pD6.js} +3 -3
- package/dist/ui/assets/settings-DABC9b5G.js +1 -0
- package/dist/ui/assets/{shared-BfYhSN4-.js → shared-BwU4OKQc.js} +1 -1
- package/dist/ui/assets/{switch-CMk95lwf.js → switch-BQ6sBBUv.js} +1 -1
- package/dist/ui/assets/{tanstack-C4gT2P7V.js → tanstack-Df9bCj5R.js} +1 -1
- package/dist/ui/index.html +6 -6
- package/dist/utils/claude-spawner.d.ts +54 -0
- package/dist/utils/claude-spawner.d.ts.map +1 -0
- package/dist/utils/claude-spawner.js +118 -0
- package/dist/utils/claude-spawner.js.map +1 -0
- package/dist/utils/delegation-validator.d.ts +8 -4
- package/dist/utils/delegation-validator.d.ts.map +1 -1
- package/dist/utils/delegation-validator.js.map +1 -1
- package/dist/utils/helpers.d.ts +0 -11
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/utils/helpers.js +1 -57
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +50 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/time.d.ts +10 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +27 -0
- package/dist/utils/time.js.map +1 -0
- package/dist/utils/ui/boxes.d.ts +24 -0
- package/dist/utils/ui/boxes.d.ts.map +1 -0
- package/dist/utils/ui/boxes.js +108 -0
- package/dist/utils/ui/boxes.js.map +1 -0
- package/dist/utils/ui/colors.d.ts +25 -0
- package/dist/utils/ui/colors.d.ts.map +1 -0
- package/dist/utils/ui/colors.js +70 -0
- package/dist/utils/ui/colors.js.map +1 -0
- package/dist/utils/ui/index.d.ts +51 -0
- package/dist/utils/ui/index.d.ts.map +1 -0
- package/dist/utils/ui/index.js +96 -0
- package/dist/utils/ui/index.js.map +1 -0
- package/dist/utils/ui/indicators.d.ts +23 -0
- package/dist/utils/ui/indicators.d.ts.map +1 -0
- package/dist/utils/ui/indicators.js +39 -0
- package/dist/utils/ui/indicators.js.map +1 -0
- package/dist/utils/ui/init.d.ts +30 -0
- package/dist/utils/ui/init.d.ts.map +1 -0
- package/dist/utils/ui/init.js +102 -0
- package/dist/utils/ui/init.js.map +1 -0
- package/dist/utils/ui/spinner.d.ts +13 -0
- package/dist/utils/ui/spinner.d.ts.map +1 -0
- package/dist/utils/ui/spinner.js +89 -0
- package/dist/utils/ui/spinner.js.map +1 -0
- package/dist/utils/ui/tables.d.ts +12 -0
- package/dist/utils/ui/tables.d.ts.map +1 -0
- package/dist/utils/ui/tables.js +69 -0
- package/dist/utils/ui/tables.js.map +1 -0
- package/dist/utils/ui/tasks.d.ts +26 -0
- package/dist/utils/ui/tasks.d.ts.map +1 -0
- package/dist/utils/ui/tasks.js +102 -0
- package/dist/utils/ui/tasks.js.map +1 -0
- package/dist/utils/ui/text.d.ts +24 -0
- package/dist/utils/ui/text.d.ts.map +1 -0
- package/dist/utils/ui/text.js +60 -0
- package/dist/utils/ui/text.js.map +1 -0
- package/dist/utils/ui/types.d.ts +36 -0
- package/dist/utils/ui/types.d.ts.map +1 -0
- package/dist/utils/ui/types.js +33 -0
- package/dist/utils/ui/types.js.map +1 -0
- package/dist/utils/ui.d.ts +3 -138
- package/dist/utils/ui.d.ts.map +1 -1
- package/dist/utils/ui.js +40 -567
- package/dist/utils/ui.js.map +1 -1
- package/dist/utils/websearch/gemini-cli.d.ts +36 -0
- package/dist/utils/websearch/gemini-cli.d.ts.map +1 -0
- package/dist/utils/websearch/gemini-cli.js +132 -0
- package/dist/utils/websearch/gemini-cli.js.map +1 -0
- package/dist/utils/websearch/grok-cli.d.ts +26 -0
- package/dist/utils/websearch/grok-cli.d.ts.map +1 -0
- package/dist/utils/websearch/grok-cli.js +81 -0
- package/dist/utils/websearch/grok-cli.js.map +1 -0
- package/dist/utils/websearch/hook-config.d.ts +21 -0
- package/dist/utils/websearch/hook-config.d.ts.map +1 -0
- package/dist/utils/websearch/hook-config.js +183 -0
- package/dist/utils/websearch/hook-config.js.map +1 -0
- package/dist/utils/websearch/hook-env.d.ts +16 -0
- package/dist/utils/websearch/hook-env.d.ts.map +1 -0
- package/dist/utils/websearch/hook-env.js +62 -0
- package/dist/utils/websearch/hook-env.js.map +1 -0
- package/dist/utils/websearch/hook-installer.d.ts +27 -0
- package/dist/utils/websearch/hook-installer.d.ts.map +1 -0
- package/dist/utils/websearch/hook-installer.js +141 -0
- package/dist/utils/websearch/hook-installer.js.map +1 -0
- package/dist/utils/websearch/index.d.ts +15 -0
- package/dist/utils/websearch/index.d.ts.map +1 -0
- package/dist/utils/websearch/index.js +44 -0
- package/dist/utils/websearch/index.js.map +1 -0
- package/dist/utils/websearch/opencode-cli.d.ts +26 -0
- package/dist/utils/websearch/opencode-cli.d.ts.map +1 -0
- package/dist/utils/websearch/opencode-cli.js +81 -0
- package/dist/utils/websearch/opencode-cli.js.map +1 -0
- package/dist/utils/websearch/status.d.ts +35 -0
- package/dist/utils/websearch/status.d.ts.map +1 -0
- package/dist/utils/websearch/status.js +185 -0
- package/dist/utils/websearch/status.js.map +1 -0
- package/dist/utils/websearch/types.d.ts +85 -0
- package/dist/utils/websearch/types.d.ts.map +1 -0
- package/dist/utils/websearch/types.js +10 -0
- package/dist/utils/websearch/types.js.map +1 -0
- package/dist/utils/websearch-manager.d.ts +7 -186
- package/dist/utils/websearch-manager.d.ts.map +1 -1
- package/dist/utils/websearch-manager.js +37 -710
- package/dist/utils/websearch-manager.js.map +1 -1
- package/dist/web-server/data-aggregator.d.ts +3 -51
- package/dist/web-server/data-aggregator.d.ts.map +1 -1
- package/dist/web-server/data-aggregator.js +18 -386
- package/dist/web-server/data-aggregator.js.map +1 -1
- package/dist/web-server/health/cliproxy-checks.d.ts +23 -0
- package/dist/web-server/health/cliproxy-checks.d.ts.map +1 -0
- package/dist/web-server/health/cliproxy-checks.js +145 -0
- package/dist/web-server/health/cliproxy-checks.js.map +1 -0
- package/dist/web-server/health/config-checks.d.ts +19 -0
- package/dist/web-server/health/config-checks.d.ts.map +1 -0
- package/dist/web-server/health/config-checks.js +174 -0
- package/dist/web-server/health/config-checks.js.map +1 -0
- package/dist/web-server/health/environment-checks.d.ts +11 -0
- package/dist/web-server/health/environment-checks.d.ts.map +1 -0
- package/dist/web-server/health/environment-checks.js +40 -0
- package/dist/web-server/health/environment-checks.js.map +1 -0
- package/dist/web-server/health/index.d.ts +13 -0
- package/dist/web-server/health/index.d.ts.map +1 -0
- package/dist/web-server/health/index.js +41 -0
- package/dist/web-server/health/index.js.map +1 -0
- package/dist/web-server/health/oauth-checks.d.ts +11 -0
- package/dist/web-server/health/oauth-checks.d.ts.map +1 -0
- package/dist/web-server/health/oauth-checks.js +34 -0
- package/dist/web-server/health/oauth-checks.js.map +1 -0
- package/dist/web-server/health/profile-checks.d.ts +19 -0
- package/dist/web-server/health/profile-checks.d.ts.map +1 -0
- package/dist/web-server/health/profile-checks.js +152 -0
- package/dist/web-server/health/profile-checks.js.map +1 -0
- package/dist/web-server/health/symlink-checks.d.ts +15 -0
- package/dist/web-server/health/symlink-checks.d.ts.map +1 -0
- package/dist/web-server/health/symlink-checks.js +173 -0
- package/dist/web-server/health/symlink-checks.js.map +1 -0
- package/dist/web-server/health/system-checks.d.ts +19 -0
- package/dist/web-server/health/system-checks.d.ts.map +1 -0
- package/dist/web-server/health/system-checks.js +127 -0
- package/dist/web-server/health/system-checks.js.map +1 -0
- package/dist/web-server/health/types.d.ts +34 -0
- package/dist/web-server/health/types.d.ts.map +1 -0
- package/dist/web-server/health/types.js +8 -0
- package/dist/web-server/health/types.js.map +1 -0
- package/dist/web-server/health/websearch-checks.d.ts +11 -0
- package/dist/web-server/health/websearch-checks.d.ts.map +1 -0
- package/dist/web-server/health/websearch-checks.js +53 -0
- package/dist/web-server/health/websearch-checks.js.map +1 -0
- package/dist/web-server/health-service.d.ts +4 -30
- package/dist/web-server/health-service.d.ts.map +1 -1
- package/dist/web-server/health-service.js +28 -695
- package/dist/web-server/health-service.js.map +1 -1
- package/dist/web-server/index.d.ts.map +1 -1
- package/dist/web-server/index.js +2 -5
- package/dist/web-server/index.js.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts +6 -0
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-auth-routes.js +202 -0
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts +6 -0
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes.js +253 -0
- package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -0
- package/dist/web-server/routes/config-routes.d.ts +6 -0
- package/dist/web-server/routes/config-routes.d.ts.map +1 -0
- package/dist/web-server/routes/config-routes.js +145 -0
- package/dist/web-server/routes/config-routes.js.map +1 -0
- package/dist/web-server/routes/copilot-routes.d.ts +6 -0
- package/dist/web-server/routes/copilot-routes.d.ts.map +1 -0
- package/dist/web-server/routes/copilot-routes.js +195 -0
- package/dist/web-server/routes/copilot-routes.js.map +1 -0
- package/dist/web-server/routes/copilot-settings-routes.d.ts +6 -0
- package/dist/web-server/routes/copilot-settings-routes.d.ts.map +1 -0
- package/dist/web-server/routes/copilot-settings-routes.js +122 -0
- package/dist/web-server/routes/copilot-settings-routes.js.map +1 -0
- package/dist/web-server/routes/health-routes.d.ts +6 -0
- package/dist/web-server/routes/health-routes.d.ts.map +1 -0
- package/dist/web-server/routes/health-routes.js +30 -0
- package/dist/web-server/routes/health-routes.js.map +1 -0
- package/dist/web-server/routes/index.d.ts +8 -0
- package/dist/web-server/routes/index.d.ts.map +1 -0
- package/dist/web-server/routes/index.js +54 -0
- package/dist/web-server/routes/index.js.map +1 -0
- package/dist/web-server/routes/misc-routes.d.ts +6 -0
- package/dist/web-server/routes/misc-routes.d.ts.map +1 -0
- package/dist/web-server/routes/misc-routes.js +219 -0
- package/dist/web-server/routes/misc-routes.js.map +1 -0
- package/dist/web-server/routes/profile-routes.d.ts +6 -0
- package/dist/web-server/routes/profile-routes.d.ts.map +1 -0
- package/dist/web-server/routes/profile-routes.js +164 -0
- package/dist/web-server/routes/profile-routes.js.map +1 -0
- package/dist/web-server/routes/provider-routes.d.ts +6 -0
- package/dist/web-server/routes/provider-routes.d.ts.map +1 -0
- package/dist/web-server/routes/provider-routes.js +146 -0
- package/dist/web-server/routes/provider-routes.js.map +1 -0
- package/dist/web-server/routes/route-helpers.d.ts +55 -0
- package/dist/web-server/routes/route-helpers.d.ts.map +1 -0
- package/dist/web-server/routes/route-helpers.js +201 -0
- package/dist/web-server/routes/route-helpers.js.map +1 -0
- package/dist/web-server/routes/settings-routes.d.ts +6 -0
- package/dist/web-server/routes/settings-routes.d.ts.map +1 -0
- package/dist/web-server/routes/settings-routes.js +207 -0
- package/dist/web-server/routes/settings-routes.js.map +1 -0
- package/dist/web-server/routes/variant-routes.d.ts +6 -0
- package/dist/web-server/routes/variant-routes.d.ts.map +1 -0
- package/dist/web-server/routes/variant-routes.js +158 -0
- package/dist/web-server/routes/variant-routes.js.map +1 -0
- package/dist/web-server/routes/websearch-routes.d.ts +6 -0
- package/dist/web-server/routes/websearch-routes.d.ts.map +1 -0
- package/dist/web-server/routes/websearch-routes.js +130 -0
- package/dist/web-server/routes/websearch-routes.js.map +1 -0
- package/dist/web-server/services/index.d.ts +7 -0
- package/dist/web-server/services/index.d.ts.map +1 -0
- package/dist/web-server/services/index.js +21 -0
- package/dist/web-server/services/index.js.map +1 -0
- package/dist/web-server/services/usage-aggregator.d.ts +7 -0
- package/dist/web-server/services/usage-aggregator.d.ts.map +1 -0
- package/dist/web-server/services/usage-aggregator.js +23 -0
- package/dist/web-server/services/usage-aggregator.js.map +1 -0
- package/dist/web-server/usage/aggregator.d.ts +54 -0
- package/dist/web-server/usage/aggregator.d.ts.map +1 -0
- package/dist/web-server/usage/aggregator.js +470 -0
- package/dist/web-server/usage/aggregator.js.map +1 -0
- package/dist/web-server/usage/data-aggregator.d.ts +55 -0
- package/dist/web-server/usage/data-aggregator.d.ts.map +1 -0
- package/dist/web-server/usage/data-aggregator.js +391 -0
- package/dist/web-server/usage/data-aggregator.js.map +1 -0
- package/dist/web-server/usage/disk-cache.d.ts +46 -0
- package/dist/web-server/usage/disk-cache.d.ts.map +1 -0
- package/dist/web-server/usage/disk-cache.js +162 -0
- package/dist/web-server/usage/disk-cache.js.map +1 -0
- package/dist/web-server/usage/handlers.d.ts +50 -0
- package/dist/web-server/usage/handlers.d.ts.map +1 -0
- package/dist/web-server/usage/handlers.js +524 -0
- package/dist/web-server/usage/handlers.js.map +1 -0
- package/dist/web-server/usage/index.d.ts +12 -0
- package/dist/web-server/usage/index.d.ts.map +1 -0
- package/dist/web-server/usage/index.js +54 -0
- package/dist/web-server/usage/index.js.map +1 -0
- package/dist/web-server/usage/routes.d.ts +11 -0
- package/dist/web-server/usage/routes.d.ts.map +1 -0
- package/dist/web-server/usage/routes.js +37 -0
- package/dist/web-server/usage/routes.js.map +1 -0
- package/dist/web-server/usage/types.d.ts +119 -0
- package/dist/web-server/usage/types.d.ts.map +1 -0
- package/dist/web-server/usage/types.js +9 -0
- package/dist/web-server/usage/types.js.map +1 -0
- package/dist/web-server/usage-disk-cache.d.ts +3 -42
- package/dist/web-server/usage-disk-cache.d.ts.map +1 -1
- package/dist/web-server/usage-disk-cache.js +5 -144
- package/dist/web-server/usage-disk-cache.js.map +1 -1
- package/dist/web-server/usage-routes.d.ts +3 -31
- package/dist/web-server/usage-routes.d.ts.map +1 -1
- package/dist/web-server/usage-routes.js +8 -1139
- package/dist/web-server/usage-routes.js.map +1 -1
- package/dist/web-server/usage-types.d.ts +3 -115
- package/dist/web-server/usage-types.d.ts.map +1 -1
- package/dist/web-server/usage-types.js +17 -3
- package/dist/web-server/usage-types.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/analytics-D1k2nYcF.js +0 -1
- package/dist/ui/assets/api-D9VVmZ1j.js +0 -1
- package/dist/ui/assets/cliproxy-CTt_Nsft.js +0 -1
- package/dist/ui/assets/cliproxy-control-panel-DKMAi4_4.js +0 -1
- package/dist/ui/assets/copilot-C6F8PT_L.js +0 -4
- package/dist/ui/assets/form-utils-BuXDJb0w.js +0 -20
- package/dist/ui/assets/health-DiAvJaSn.js +0 -1
- package/dist/ui/assets/index-Brq6EBKZ.css +0 -1
- package/dist/ui/assets/index-ByU8ZhED.js +0 -48
- package/dist/ui/assets/settings-CEomZLGl.js +0 -1
- package/dist/web-server/routes.d.ts +0 -7
- package/dist/web-server/routes.d.ts.map +0 -1
- package/dist/web-server/routes.js +0 -1891
- package/dist/web-server/routes.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./radix-ui-CV3R9pD6.js";import{r as d}from"./react-vendor-FspHSO0w.js";import{e as C,B as f,I as E,i as L,L as P,k,T as B,l as Y,m as F,n as M,R as W,o as X,p as G,q as Z,c as ee}from"./index-C6Dah-xh.js";import{C as _,S as se}from"./confirm-dialog-CaiDQikc.js";import{u as te,a as ae,b as ne}from"./tanstack-Df9bCj5R.js";import{t as D}from"./notifications-B2Pz7lik.js";import{a2 as T,a5 as $,L as K,a6 as re,E as ie,d as le,J as I,I as ce,a7 as oe,$ as de,a8 as me,a9 as U,aa as xe,k as V,z as ue,D as he}from"./icons-ZmwVoUeR.js";import"./utils-CzKF5WmX.js";import"./form-utils-DP6ILe7Z.js";import"./code-highlight-BoHWVYut.js";function fe({profileName:s,data:t,isLoading:n,isSaving:c,hasChanges:u,isRawJsonValid:a,onRefresh:i,onDelete:o,onSave:g}){return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s}),t?.path&&e.jsx(C,{variant:"outline",className:"text-xs",children:t.path.replace(/^.*\//,"")})]}),t&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified: ",new Date(t.mtime).toLocaleString()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"ghost",size:"sm",onClick:i,disabled:n,children:e.jsx(T,{className:`w-4 h-4 ${n?"animate-spin":""}`})}),o&&e.jsx(f,{variant:"ghost",size:"sm",onClick:o,children:e.jsx($,{className:"w-4 h-4 text-destructive"})}),e.jsx(f,{size:"sm",onClick:g,disabled:c||!u||!a,children:c?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function pe({label:s,...t}){const[n,c]=d.useState(!1);return e.jsxs("div",{className:"space-y-1",children:[s&&e.jsx("label",{className:"text-sm font-medium",children:s}),e.jsxs("div",{className:"relative",children:[e.jsx(E,{type:n?"text":"password",className:"pr-10 font-mono",...t}),e.jsx(f,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>c(!n),tabIndex:-1,children:n?e.jsx(ie,{className:"w-4 h-4"}):e.jsx(le,{className:"w-4 h-4"})})]})]})}function z(s){return[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/^API_KEY$/,/^AUTH_TOKEN$/,/_SECRET$/,/^SECRET$/].some(n=>n.test(s))}function je({currentSettings:s,newEnvKey:t,onNewEnvKeyChange:n,onEnvValueChange:c,onAddEnvVar:u}){return e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"flex-1",children:e.jsx("div",{className:"p-4 space-y-4",children:s?.env&&Object.keys(s.env).length>0?e.jsx(e.Fragment,{children:Object.entries(s.env).map(([a,i])=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(P,{className:"text-xs font-medium flex items-center gap-2 text-muted-foreground",children:[a,z(a)&&e.jsx(C,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4",children:"sensitive"})]}),z(a)?e.jsx(pe,{value:i,onChange:o=>c(a,o.target.value),className:"font-mono text-sm h-8"}):e.jsx(E,{value:i,onChange:o=>c(a,o.target.value),className:"font-mono text-sm h-8"})]},a))}):e.jsxs("div",{className:"py-8 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed text-sm",children:[e.jsx("p",{children:"No environment variables configured."}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:"Add variables using the input below or edit the JSON directly."})]})})}),e.jsxs("div",{className:"p-4 border-t bg-background shrink-0",children:[e.jsx(P,{className:"text-xs font-medium text-muted-foreground",children:"Add Environment Variable"}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(E,{placeholder:"VARIABLE_NAME",value:t,onChange:a=>n(a.target.value.toUpperCase()),className:"font-mono text-sm h-8",onKeyDown:a=>a.key==="Enter"&&u()}),e.jsx(f,{variant:"outline",size:"sm",className:"h-8",onClick:u,disabled:!t.trim(),children:e.jsx(I,{className:"w-4 h-4"})})]})]})]})}function ge({profileName:s,data:t}){return e.jsx(L,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(ce,{className:"w-4 h-4"}),"Profile Information"]}),e.jsx("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Profile Name"}),e.jsx("span",{className:"font-mono",children:t.profile})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:t.path}),e.jsx(k,{value:t.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Last Modified"}),e.jsx("span",{className:"text-xs",children:new Date(t.mtime).toLocaleString()})]})]})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{children:[e.jsx(P,{className:"text-xs text-muted-foreground",children:"Run with profile"}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs ",s,' "prompt"']}),e.jsx(k,{value:`ccs ${s} "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),e.jsxs("div",{children:[e.jsx(P,{className:"text-xs text-muted-foreground",children:"Set as default"}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs default ",s]}),e.jsx(k,{value:`ccs default ${s}`,size:"icon",className:"h-6 w-6"})]})]})]})]})]})})}function Ne({profileName:s,data:t,currentSettings:n,newEnvKey:c,onNewEnvKeyChange:u,onEnvValueChange:a,onAddEnvVar:i}){return e.jsx("div",{className:"h-full flex flex-col",children:e.jsxs(B,{defaultValue:"env",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(Y,{className:"w-full",children:[e.jsx(F,{value:"env",className:"flex-1",children:"Environment Variables"}),e.jsx(F,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(M,{value:"env",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(je,{currentSettings:n,newEnvKey:c,onNewEnvKeyChange:u,onEnvValueChange:a,onAddEnvVar:i})}),e.jsx(M,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(ge,{profileName:s,data:t})})]})]})})}function ve({profileName:s,onDelete:t}){const[n,c]=d.useState({}),[u,a]=d.useState(!1),[i,o]=d.useState(null),[g,S]=d.useState(""),p=te(),{data:h,isLoading:N,isError:m,refetch:w}=ae({queryKey:["settings",s],queryFn:async()=>{const l=await fetch(`/api/settings/${s}/raw`);if(!l.ok)throw new Error(`Failed to load settings: ${l.status}`);return l.json()}}),x=h?.settings,v=d.useMemo(()=>{if(i!==null)try{return JSON.parse(i)}catch{}if(x)return{...x,env:{...x.env,...n}}},[x,n,i]),y=d.useMemo(()=>i!==null?i:x?JSON.stringify(x,null,2):"",[i,x]),b=d.useCallback(l=>{o(l)},[]),r=(l,j)=>{const A={...v?.env||{},[l]:j};c(q=>({...q,[l]:j})),o(JSON.stringify({...v,env:A},null,2))},H=()=>{if(!g.trim())return;const l=g.trim(),j={...v?.env||{},[l]:""};c(A=>({...A,[l]:""})),o(JSON.stringify({...v,env:j},null,2)),S("")},R=d.useMemo(()=>{try{return JSON.parse(y),!0}catch{return!1}},[y]),Q=d.useMemo(()=>i!==null?i!==JSON.stringify(x,null,2):Object.keys(n).length>0,[i,n,x]),O=ne({mutationFn:async()=>{let l;try{l=JSON.parse(y)}catch{l={...h?.settings,env:{...h?.settings?.env,...n}}}const j=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:l,expectedMtime:h?.mtime})});if(j.status===409)throw new Error("CONFLICT");if(!j.ok)throw new Error("Failed to save");return j.json()},onSuccess:()=>{p.invalidateQueries({queryKey:["settings",s]}),p.invalidateQueries({queryKey:["profiles"]}),c({}),o(null),D.success("Settings saved")},onError:l=>{l.message==="CONFLICT"?a(!0):D.error(l.message)}}),J=async l=>{a(!1),l?(await w(),O.mutate()):(c({}),o(null))};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(fe,{profileName:s,data:h,isLoading:N,isSaving:O.isPending,hasChanges:Q,isRawJsonValid:R,onRefresh:()=>w(),onDelete:t,onSave:()=>O.mutate()}),N?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(K,{className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading settings..."})]}):m?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load settings."}),e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>w(),children:[e.jsx(T,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):e.jsxs("div",{className:"flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[e.jsx("div",{className:"flex flex-col overflow-hidden bg-muted/5",children:e.jsx(Ne,{profileName:s,data:h,currentSettings:v,newEnvKey:g,onNewEnvKeyChange:S,onEnvValueChange:r,onAddEnvVar:H})}),e.jsxs("div",{className:"flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(oe,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),e.jsx(W,{rawJsonContent:y,isRawJsonValid:R,rawJsonEdits:i,settings:x,onChange:b})]})]}),e.jsx(_,{open:u,title:"File Modified Externally",description:"Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>J(!0),onCancel:()=>J(!1)})]},s)}function Te(){const{data:s,isLoading:t,isError:n,refetch:c}=X(),u=G(),[a,i]=d.useState(null),[o,g]=d.useState(""),[S,p]=d.useState(!1),[h,N]=d.useState(null),m=d.useMemo(()=>s?.profiles||[],[s?.profiles]),w=d.useMemo(()=>m.filter(r=>r.name.toLowerCase().includes(o.toLowerCase())),[m,o]),x=d.useMemo(()=>a&&m.some(r=>r.name===a)?a:m.length>0?m[0].name:null,[a,m]),v=r=>{u.mutate(r,{onSuccess:()=>{a===r&&i(null),N(null)}})},y=r=>{p(!1),i(r)},b=m.find(r=>r.name===x);return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(de,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"API Profiles"})]}),e.jsxs(f,{size:"sm",onClick:()=>{p(!0)},children:[e.jsx(I,{className:"w-4 h-4 mr-1"}),"New"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(me,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(E,{placeholder:"Search profiles...",className:"pl-8 h-9",value:o,onChange:r=>g(r.target.value)})]})]}),e.jsx(L,{className:"flex-1",children:t?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading profiles..."}):n?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(U,{className:"w-12 h-12 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Failed to load profiles"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Unable to fetch API profiles. Please try again."})]}),e.jsxs(f,{size:"sm",variant:"outline",onClick:()=>c(),children:[e.jsx(T,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):w.length===0?e.jsx("div",{className:"p-4 text-center",children:m.length===0?e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xe,{className:"w-12 h-12 mx-auto text-muted-foreground/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"No API profiles yet"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Create your first profile to connect to custom API endpoints"})]}),e.jsxs(f,{size:"sm",variant:"outline",onClick:()=>{p(!0)},children:[e.jsx(I,{className:"w-4 h-4 mr-1"}),"Create Profile"]})]}):e.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:['No profiles match "',o,'"']})}):e.jsx("div",{className:"p-2 space-y-1",children:w.map(r=>e.jsx(we,{profile:r,isSelected:x===r.name,onSelect:()=>{i(r.name)},onDelete:()=>N(r.name)},r.name))})}),m.length>0&&e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[m.length," profile",m.length!==1?"s":""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(V,{className:"w-3 h-3 text-green-600"}),m.filter(r=>r.configured).length," configured"]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:b?e.jsx(ve,{profileName:b.name,onDelete:()=>N(b.name)}):e.jsx(ye,{onCreateClick:()=>{p(!0)}})}),e.jsx(Z,{open:S,onOpenChange:p,onSuccess:y}),e.jsx(_,{open:!!h,title:"Delete Profile",description:`Are you sure you want to delete "${h}"? This will remove the settings file and cannot be undone.`,confirmText:"Delete",variant:"destructive",onConfirm:()=>h&&v(h),onCancel:()=>N(null)})]})}function we({profile:s,isSelected:t,onSelect:n,onDelete:c}){return e.jsxs("div",{className:ee("group flex items-center gap-2 px-3 py-2.5 rounded-md cursor-pointer transition-colors",t?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:n,children:[s.configured?e.jsx(V,{className:"w-4 h-4 text-green-600 shrink-0"}):e.jsx(U,{className:"w-4 h-4 text-yellow-600 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:s.name}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("div",{className:"text-xs text-muted-foreground truncate flex-1",children:s.settingsPath}),e.jsx(k,{value:s.settingsPath,size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity"})]})]}),e.jsx(f,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:u=>{u.stopPropagation(),c()},children:e.jsx($,{className:"w-3.5 h-3.5 text-destructive"})})]})}function ye({onCreateClick:s}){return e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx(ue,{className:"w-16 h-16 mx-auto text-muted-foreground/30 mb-6"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"API Profile Manager"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Configure custom API endpoints for Claude CLI. Connect to proxy services like copilot-api, OpenRouter, or your own API backend."}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs(f,{onClick:s,className:"w-full",children:[e.jsx(I,{className:"w-4 h-4 mr-2"}),"Create Your First Profile"]}),e.jsx(se,{className:"my-4"}),e.jsxs("div",{className:"text-left space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"What you can configure:"}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1.5",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(C,{variant:"outline",className:"text-xs shrink-0 mt-0.5",children:"URL"}),e.jsx("span",{children:"Custom API base URL endpoint"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(C,{variant:"outline",className:"text-xs shrink-0 mt-0.5",children:"Auth"}),e.jsx("span",{children:"API key or authentication token"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(C,{variant:"outline",className:"text-xs shrink-0 mt-0.5",children:"Models"}),e.jsx("span",{children:"Model mapping for Opus/Sonnet/Haiku"})]})]})]}),e.jsx("div",{className:"pt-4",children:e.jsxs("a",{href:"https://github.com/kaitranntt/ccs#api-profiles",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-xs text-primary hover:underline",children:["Learn more about API profiles",e.jsx(he,{className:"w-3 h-3 ml-1"})]})})]})]})})}export{Te as ApiPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./radix-ui-
|
|
1
|
+
import{j as t}from"./radix-ui-CV3R9pD6.js";import"./react-vendor-FspHSO0w.js";import{c as o}from"./index-C6Dah-xh.js";function n({className:a,...r}){return t.jsx("div",{"data-slot":"card",className:o("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...r})}function c({className:a,...r}){return t.jsx("div",{"data-slot":"card-header",className:o("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...r})}function i({className:a,...r}){return t.jsx("div",{"data-slot":"card-title",className:o("leading-none font-semibold",a),...r})}function l({className:a,...r}){return t.jsx("div",{"data-slot":"card-content",className:o("px-6",a),...r})}export{n as C,l as a,c as b,i as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{j as e,W as Qe,X as Ke,Y as We,Z as Xe,_ as Ye}from"./radix-ui-CV3R9pD6.js";import{r as h}from"./react-vendor-FspHSO0w.js";import{u as ye,a as Ze,b as es}from"./tanstack-Df9bCj5R.js";import{B as p,c as C,d as te,L as K,I as ae,r as Ce,s as Ae,t as Se,v as Pe,w as ee,x as ke,y as ss,z as Oe,u as Me,D as ne,A as ie,E as re,F as ce,G as De,H as he,J as pe,e as _,K as ts,k as Te,i as le,M as as,N as ns,O as is,Q as rs,T as cs,l as ls,m as ge,n as fe,U as os,V as ds,W as ms,X as us,Y as xs,Z as hs,_ as ps,$ as gs,a0 as fs,S as js}from"./index-C6Dah-xh.js";import{t as T}from"./notifications-B2Pz7lik.js";import{b as _e,L as z,D as oe,T as vs,j as U,q as Ns,ab as de,a2 as F,ac as V,_ as q,ad as W,Z as X,I as ws,f as bs,a6 as ys,X as me,J as Le,o as Ee,ae as Cs,a5 as Re,a7 as As,af as je,A as Ss,ag as ve,U as Ps,ah as ks,ai as Os,aj as Ie}from"./icons-ZmwVoUeR.js";import{C as Fe,a as Ue}from"./card-CIN0KDsX.js";import{S as ue,C as Ms}from"./confirm-dialog-CaiDQikc.js";import"./utils-CzKF5WmX.js";import"./form-utils-DP6ILe7Z.js";import"./code-highlight-BoHWVYut.js";const $={agy:{provider:"agy",displayName:"Antigravity",defaultModel:"gemini-claude-opus-4-5-thinking",models:[{id:"gemini-claude-opus-4-5-thinking",name:"Claude Opus 4.5 Thinking",description:"Most capable, extended thinking",presetMapping:{default:"gemini-claude-opus-4-5-thinking",opus:"gemini-claude-opus-4-5-thinking",sonnet:"gemini-claude-sonnet-4-5-thinking",haiku:"gemini-claude-sonnet-4-5"}},{id:"gemini-claude-sonnet-4-5-thinking",name:"Claude Sonnet 4.5 Thinking",description:"Balanced with extended thinking",presetMapping:{default:"gemini-claude-sonnet-4-5-thinking",opus:"gemini-claude-opus-4-5-thinking",sonnet:"gemini-claude-sonnet-4-5-thinking",haiku:"gemini-claude-sonnet-4-5"}},{id:"gemini-claude-sonnet-4-5",name:"Claude Sonnet 4.5",description:"Fast and capable",presetMapping:{default:"gemini-claude-sonnet-4-5",opus:"gemini-claude-opus-4-5-thinking",sonnet:"gemini-claude-sonnet-4-5",haiku:"gemini-claude-sonnet-4-5"}},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",description:"Google latest model via Antigravity",presetMapping:{default:"gemini-3-pro-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-2.5-flash"}}]},gemini:{provider:"gemini",displayName:"Gemini",defaultModel:"gemini-2.5-pro",models:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",tier:"paid",description:"Latest model, requires paid Google account",presetMapping:{default:"gemini-3-pro-preview",opus:"gemini-3-pro-preview",sonnet:"gemini-3-pro-preview",haiku:"gemini-2.5-flash"}},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",description:"Stable, works with free Google account",presetMapping:{default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-2.5-flash"}}]},codex:{provider:"codex",displayName:"Codex",defaultModel:"gpt-5.1-codex-max",models:[{id:"gpt-5.1-codex-max",name:"Codex Max (5.1)",description:"Most capable Codex model",presetMapping:{default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max-high",sonnet:"gpt-5.1-codex-max",haiku:"gpt-5.1-codex-mini-high"}},{id:"gpt-5.2",name:"GPT 5.2",description:"Latest GPT model",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.2",haiku:"gpt-5.2"}},{id:"gpt-5.1-codex-mini",name:"Codex Mini",description:"Fast and efficient Codex model"}]},qwen:{provider:"qwen",displayName:"Qwen",defaultModel:"qwen-coder-plus",models:[{id:"qwen-coder-plus",name:"Qwen Coder Plus",description:"Alibaba code-focused model"},{id:"qwen-max",name:"Qwen Max",description:"Most capable Qwen model"}]},iflow:{provider:"iflow",displayName:"iFlow",defaultModel:"iflow-default",models:[{id:"iflow-default",name:"iFlow Default",description:"Default iFlow model"}]}},se=8317;async function He(s){const a=$[s];if(!a)return{success:!1};const t=a.models[0],n=t?.presetMapping||{default:a.defaultModel,opus:a.defaultModel,sonnet:a.defaultModel,haiku:a.defaultModel},i={env:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${se}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:"ccs-internal-managed",ANTHROPIC_MODEL:n.default,ANTHROPIC_DEFAULT_OPUS_MODEL:n.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:n.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:n.haiku}};try{return{success:(await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:i})})).ok,presetName:t?.name||a.defaultModel}}catch{return{success:!1}}}const Ne=[{id:"gemini",name:"Google Gemini",description:"Gemini Pro/Flash models"},{id:"codex",name:"OpenAI Codex",description:"GPT-4 and codex models"},{id:"agy",name:"Antigravity",description:"Antigravity AI models"},{id:"qwen",name:"Alibaba Qwen",description:"Qwen Code models"},{id:"iflow",name:"iFlow",description:"iFlow AI models"}],Ve=["provider","auth","variant","success"];function Ds(s){return s==="account"?1:Ve.indexOf(s)}function Ts({currentProgress:s,allSteps:a}){return e.jsx("div",{className:"flex justify-center gap-1 pt-2",children:a.map((t,n)=>e.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${s>=n?"bg-primary":"bg-muted"}`},t))})}function _s({providers:s,onSelect:a}){return e.jsx("div",{className:"grid gap-2",children:s.map(t=>e.jsxs("button",{onClick:()=>a(t.id),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:t.description})]}),e.jsx(_e,{className:"w-4 h-4 text-muted-foreground"})]},t.id))})}function Ls({selectedProvider:s,providers:a,authCommand:t,isRefreshing:n,isPending:i,onBack:c,onStartAuth:l,onRefresh:d}){const[r,x]=h.useState(!1),u=async g=>{await navigator.clipboard.writeText(g),x(!0),setTimeout(()=>x(!1),2e3)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Authenticate with ",a.find(g=>g.id===s)?.name," to add an account"]}),e.jsx(p,{onClick:l,disabled:i,className:"w-full gap-2",size:"lg",children:i?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-4 h-4 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-4 h-4"}),"Authenticate in Browser"]})}),i&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Complete the OAuth flow in your browser..."})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or use terminal"})})]}),e.jsx(Fe,{children:e.jsxs(Ue,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(vs,{className:"w-4 h-4"}),"Run this command in your terminal:"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2 bg-muted rounded-md font-mono text-sm",children:t}),e.jsx(p,{variant:"outline",size:"icon",onClick:()=>u(t),children:r?e.jsx(U,{className:"w-4 h-4 text-green-500"}):e.jsx(Ns,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(p,{variant:"ghost",onClick:c,disabled:i,children:[e.jsx(de,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs(p,{variant:"outline",onClick:d,disabled:n||i,children:[e.jsx(F,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),n?"Checking...":"Refresh Status"]})]})]})}function Es({accounts:s,privacyMode:a,onSelect:t,onAddNew:n,onBack:i}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Select an account (",s.length,")"]}),e.jsx("div",{className:"grid gap-2",children:s.map(c=>e.jsxs("button",{type:"button",onClick:()=>t(c),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center",children:e.jsx(V,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:C("font-medium",a&&te),children:c.email||c.id}),c.isDefault&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Default account"})]})]}),e.jsx(_e,{className:"w-4 h-4 text-muted-foreground"})]},c.id))}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or"})})]}),e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 p-3 border-2 border-dashed border-primary/50 rounded-lg hover:border-primary hover:bg-primary/5 transition-colors text-left",onClick:n,children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(oe,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-primary",children:"Add new account"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Authenticate with a different account"})]})]}),e.jsx("div",{className:"flex items-center justify-between pt-2",children:e.jsxs(p,{variant:"ghost",onClick:i,children:[e.jsx(de,{className:"w-4 h-4 mr-2"}),"Back"]})})]})}function Rs({selectedProvider:s,selectedAccount:a,variantName:t,modelName:n,isPending:i,privacyMode:c,onVariantNameChange:l,onModelChange:d,onBack:r,onSkip:x,onCreate:u}){return e.jsxs("div",{className:"space-y-4",children:[a&&e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 rounded-md text-sm",children:[e.jsx(V,{className:"w-4 h-4"}),e.jsxs("span",{children:["Using:"," ",e.jsx("span",{className:C(c&&te),children:a.email||a.id})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(K,{htmlFor:"variant-name",children:"Variant Name *"}),e.jsx(ae,{id:"variant-name",value:t,onChange:g=>l(g.target.value),placeholder:"e.g., my-gemini, g3, flash"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Use this name to invoke: ccs ",t||"<name>",' "prompt"']})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(K,{children:"Model"}),e.jsxs(Ce,{value:n,onValueChange:d,children:[e.jsx(Ae,{children:e.jsx(Se,{placeholder:"Select a model"})}),e.jsx(Pe,{children:$[s]?.models.map(g=>e.jsx(ee,{value:g.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:g.name}),g.description&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",g.description]})]})},g.id))})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Default: ",$[s]?.defaultModel||"provider default"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(p,{variant:"ghost",onClick:r,children:[e.jsx(de,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{variant:"ghost",onClick:x,children:"Skip"}),e.jsx(p,{onClick:u,disabled:!t||i,children:i?"Creating...":"Create Variant"})]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Skip if you just wanted to add an account without creating a variant"})]})}function Is({variantName:s,onClose:a}){return e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center",children:e.jsx(U,{className:"w-8 h-8 text-green-600 dark:text-green-400"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-lg",children:"Variant Created!"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Your custom variant is ready to use"})]}),e.jsx(Fe,{children:e.jsxs(Ue,{className:"p-4 space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Usage:"}),e.jsxs("code",{className:"block px-3 py-2 bg-muted rounded-md font-mono text-sm",children:["ccs ",s,' "your prompt here"']})]})}),e.jsx(p,{onClick:a,className:"w-full",children:"Done"})]})}function Fs({open:s,onClose:a}){const[t,n]=h.useState("provider"),[i,c]=h.useState(""),[l,d]=h.useState(null),[r,x]=h.useState(""),[u,g]=h.useState(""),[f,o]=h.useState(!1),[N,S]=h.useState(!1),{data:w,refetch:P}=ke(),O=ss(),b=Oe(),{privacyMode:y}=Me(),A=w?.authStatus.find(j=>j.provider===i),D=h.useMemo(()=>A?.accounts||[],[A?.accounts]);h.useEffect(()=>{if(!s){const j=setTimeout(()=>{n("provider"),c(""),d(null),x(""),g(""),S(!1)},0);return()=>clearTimeout(j)}},[s]),h.useEffect(()=>{if(t==="auth"&&D.length>0&&!N){const j=setTimeout(()=>{n("account")},0);return()=>clearTimeout(j)}},[t,D,N]);const v=async()=>{o(!0),await P(),o(!1)},k=()=>{const j=(A?.accounts?.length||0)===0;b.mutate({provider:i},{onSuccess:async H=>{if(j){const R=await He(i);R.success&&R.presetName?T.success(`Applied "${R.presetName}" preset`):R.success||T.warning("Account added, but failed to apply default preset")}H.account&&(d(H.account),n("variant")),P()}})},m=j=>{c(j),(w?.authStatus.find(G=>G.provider===j)?.accounts||[]).length===0?n("auth"):n("account")},L=j=>{d(j),n("variant")},J=async()=>{if(!(!r||!i))try{await O.mutateAsync({name:r,provider:i,model:u||void 0,account:l?.id}),n("success")}catch(j){console.error("Failed to create variant:",j)}},B=`ccs ${i} --auth --add`,Y=Ds(t),Z=j=>{if(!j&&(t==="success"||t==="provider")){a();return}};return e.jsx(ne,{open:s,onOpenChange:Z,children:e.jsxs(ie,{className:"sm:max-w-lg",onPointerDownOutside:j=>{t!=="success"&&t!=="provider"&&j.preventDefault()},onEscapeKeyDown:j=>{(b.isPending||O.isPending)&&j.preventDefault()},children:[e.jsxs(re,{children:[e.jsxs(ce,{className:"flex items-center gap-2",children:[e.jsx(q,{className:"w-5 h-5 text-primary"}),"Quick Setup Wizard"]}),e.jsxs(De,{children:[t==="provider"&&"Select a provider to get started",t==="auth"&&"Authenticate with your provider",t==="account"&&"Select which account to use",t==="variant"&&"Create your custom variant",t==="success"&&"Setup complete!"]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[t==="provider"&&e.jsx(_s,{providers:Ne,onSelect:m}),t==="auth"&&e.jsx(Ls,{selectedProvider:i,providers:Ne,authCommand:B,isRefreshing:f,isPending:b.isPending,onBack:()=>n("provider"),onStartAuth:k,onRefresh:v}),t==="account"&&e.jsx(Es,{accounts:D,privacyMode:y,onSelect:L,onAddNew:()=>{S(!0),n("auth")},onBack:()=>n("provider")}),t==="variant"&&e.jsx(Rs,{selectedProvider:i,selectedAccount:l,variantName:r,modelName:u,isPending:O.isPending,privacyMode:y,onVariantNameChange:x,onModelChange:g,onBack:()=>D.length>0?n("account"):n("provider"),onSkip:a,onCreate:J}),t==="success"&&e.jsx(Is,{variantName:r,onClose:a})]}),e.jsx(Ts,{currentProgress:Y,allSteps:Ve})]})})}function Us({open:s,onClose:a,provider:t,displayName:n,isFirstAccount:i=!1}){const[c,l]=h.useState(""),d=Oe(),r=()=>{d.mutate({provider:t,nickname:c.trim()||void 0},{onSuccess:async()=>{if(i){const u=await He(t);u.success&&u.presetName?T.success(`Applied "${u.presetName}" preset`):u.success||T.warning("Account added, but failed to apply default preset")}l(""),a()}})},x=u=>{!u&&!d.isPending&&(l(""),a())};return e.jsx(ne,{open:s,onOpenChange:x,children:e.jsxs(ie,{className:"sm:max-w-md",children:[e.jsxs(re,{children:[e.jsxs(ce,{children:["Add ",n," Account"]}),e.jsx(De,{children:"Click the button below to authenticate a new account. A browser window will open for OAuth."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(K,{htmlFor:"nickname",children:"Nickname (optional)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(ae,{id:"nickname",value:c,onChange:u=>l(u.target.value),placeholder:"e.g., work, personal",disabled:d.isPending,className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"A friendly name to identify this account. Auto-generated from email if left empty."})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx(p,{variant:"ghost",onClick:a,disabled:d.isPending,children:"Cancel"}),e.jsx(p,{onClick:r,disabled:d.isPending,children:d.isPending?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-4 h-4 mr-2 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-4 h-4 mr-2"}),"Authenticate"]})})]}),d.isPending&&e.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Complete the OAuth flow in your browser..."})]})]})})}function Hs(s){const[a,t]=h.useState(null),[n,i]=h.useState(!1),c=ye(),{data:l,isLoading:d,refetch:r}=Ze({queryKey:["settings",s],queryFn:async()=>{const v=await fetch(`/api/settings/${s}/raw`);return v.ok?v.json():{profile:s,settings:{env:{}},mtime:Date.now(),path:`~/.ccs/profiles/${s}/settings.json`}}}),x=l?.settings,u=h.useMemo(()=>a!==null?a:x?JSON.stringify(x,null,2):`{
|
|
2
|
+
"env": {}
|
|
3
|
+
}`,[a,x]),g=h.useCallback(v=>{t(v)},[]),f=h.useMemo(()=>{try{return JSON.parse(u)}catch{return x||{env:{}}}},[u,x]),o=f?.env?.ANTHROPIC_MODEL,N=f?.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,S=f?.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,w=f?.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,P=h.useCallback((v,k)=>{const m={...f?.env||{},[v]:k},L={...f,env:m};t(JSON.stringify(L,null,2))},[f]),O=h.useCallback(v=>{const k={...f?.env||{},...v},m={...f,env:k};t(JSON.stringify(m,null,2))},[f]),b=h.useMemo(()=>{try{return JSON.parse(u),!0}catch{return!1}},[u]),y=h.useMemo(()=>a===null?!1:a!==JSON.stringify(x,null,2),[a,x]),A=es({mutationFn:async()=>{const v=JSON.parse(u),k=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:v,expectedMtime:l?.mtime})});if(k.status===409)throw new Error("CONFLICT");if(!k.ok)throw new Error("Failed to save");return k.json()},onSuccess:()=>{c.invalidateQueries({queryKey:["settings",s]}),t(null),T.success("Settings saved")},onError:v=>{v.message==="CONFLICT"?i(!0):T.error(v.message)}}),D=async v=>{i(!1),v?(await r(),A.mutate()):t(null)};return{data:l,isLoading:d,refetch:r,rawJsonContent:u,rawJsonEdits:a,isRawJsonValid:b,hasChanges:y,currentSettings:f,currentModel:o,opusModel:N,sonnetModel:S,haikuModel:w,handleRawJsonChange:g,updateEnvValue:P,updateEnvValues:O,saveMutation:{mutate:()=>A.mutate(),isPending:A.isPending},conflictDialog:n,setConflictDialog:i,handleConflictResolve:D}}function E({label:s,description:a,value:t,onChange:n,catalog:i,allModels:c,disabled:l}){const d=new Set(i?.models.map(r=>r.id)||[]);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:s}),a&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a})]}),e.jsxs(Ce,{value:t||"",onValueChange:n,disabled:l,children:[e.jsx(Ae,{className:"h-9",children:e.jsx(Se,{placeholder:"Select model",children:t&&e.jsx("span",{className:"truncate font-mono text-xs",children:t})})}),e.jsxs(Pe,{className:"max-h-[300px]",children:[i&&i.models.length>0&&e.jsxs(he,{children:[e.jsx(pe,{className:"text-xs text-primary",children:"Recommended"}),i.models.map(r=>e.jsx(ee,{value:r.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:r.id}),r.tier==="paid"&&e.jsx(_,{variant:"outline",className:"text-[9px] h-4 px-1",children:"PAID"}),t===r.id&&e.jsx(U,{className:"w-3 h-3 text-primary ml-auto"})]})},r.id))]}),c.length>0&&e.jsxs(he,{children:[e.jsxs(pe,{className:"text-xs text-muted-foreground",children:["All Models (",c.length,")"]}),c.filter(r=>!d.has(r.id)).map(r=>e.jsx(ee,{value:r.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:r.id}),t===r.id&&e.jsx(U,{className:"w-3 h-3 text-primary ml-auto"})]})},r.id))]}),(!i||i.models.length===0)&&c.length===0&&e.jsx("div",{className:"py-2 px-3 text-xs text-muted-foreground",children:"No models available"})]})]})]})}function Vs({open:s,onClose:a,currentValues:t,onApply:n,onSave:i,isSaving:c,catalog:l,allModels:d}){const[r,x]=h.useState(t),[u,g]=h.useState(""),f=o=>{o?(x(t),g("")):a()};return e.jsx(ne,{open:s,onOpenChange:f,children:e.jsxs(ie,{className:"sm:max-w-md",children:[e.jsx(re,{children:e.jsxs(ce,{className:"flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4"}),"Custom Preset"]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(K,{htmlFor:"preset-name",children:"Preset Name (optional)"}),e.jsx(ae,{id:"preset-name",value:u,onChange:o=>g(o.target.value),placeholder:"e.g., My Custom Config",className:"text-sm"})]}),e.jsx(ue,{}),e.jsx(E,{label:"Default Model",description:"Used when no specific tier is requested",value:r.default,onChange:o=>x({...r,default:o}),catalog:l,allModels:d}),e.jsx(E,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:r.opus,onChange:o=>x({...r,opus:o}),catalog:l,allModels:d}),e.jsx(E,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:r.sonnet,onChange:o=>x({...r,sonnet:o}),catalog:l,allModels:d}),e.jsx(E,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:r.haiku,onChange:o=>x({...r,haiku:o}),catalog:l,allModels:d})]}),e.jsxs(ts,{className:"gap-2 sm:gap-0",children:[e.jsx(p,{variant:"outline",onClick:a,children:"Cancel"}),i&&e.jsxs(p,{variant:"secondary",onClick:()=>i(r,u||void 0),disabled:c||!u.trim(),children:[c?e.jsx(z,{className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(W,{className:"w-4 h-4 mr-1"}),"Save Preset"]}),e.jsxs(p,{onClick:()=>n(r,u||void 0),children:[e.jsx(X,{className:"w-4 h-4 mr-1"}),"Apply Preset"]})]})]})})}function Q({label:s,command:a}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:s}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:a}),e.jsx(Te,{value:a,size:"icon",className:"h-6 w-6"})]})]})}function $s({provider:s,displayName:a,data:t,authStatus:n}){return e.jsx(le,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(ws,{className:"w-4 h-4"}),"Provider Information"]}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Provider"}),e.jsx("span",{className:"font-mono",children:a})]}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:t.path}),e.jsx(Te,{value:t.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Last Modified"}),e.jsx("span",{className:"text-xs",children:new Date(t.mtime).toLocaleString()})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Status"}),n.authenticated?e.jsxs(_,{variant:"outline",className:"w-fit text-green-600 border-green-200 bg-green-50",children:[e.jsx(bs,{className:"w-3 h-3 mr-1"}),"Authenticated"]}):e.jsx(_,{variant:"outline",className:"w-fit text-muted-foreground",children:"Not connected"})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsx(Q,{label:"Run with prompt",command:`ccs ${s} "your prompt"`}),e.jsx(Q,{label:"Change model",command:`ccs ${s} --config`}),e.jsx(Q,{label:"Add account",command:`ccs ${s} --add`}),e.jsx(Q,{label:"List accounts",command:`ccs ${s} --accounts`})]})]})]})})}const zs={gemini:"/assets/providers/gemini-color.svg",codex:"/assets/providers/openai.svg",agy:"/assets/providers/agy.png",qwen:"/assets/providers/qwen-color.svg",iflow:"/assets/providers/iflow.png"},qs={gemini:{text:"text-blue-600",letter:"G"},claude:{text:"text-orange-600",letter:"C"},codex:{text:"text-emerald-600",letter:"X"},agy:{text:"text-violet-600",letter:"A"},qwen:{text:"text-cyan-600",letter:"Q"},iflow:{text:"text-indigo-600",letter:"i"}},Js={sm:{container:"w-6 h-6",icon:"w-4 h-4",text:"text-xs"},md:{container:"w-8 h-8",icon:"w-5 h-5",text:"text-sm"},lg:{container:"w-12 h-12",icon:"w-8 h-8",text:"text-lg"}};function xe({provider:s,className:a,size:t="md"}){const n=s.toLowerCase(),i=qs[n]||{text:"text-gray-600",letter:s[0]?.toUpperCase()||"?"},c=Js[t],l=zs[n];return e.jsx("div",{className:C("flex items-center justify-center rounded-md",l&&"bg-white p-1",c.container,a),children:l?e.jsx("img",{src:l,alt:`${s} logo`,className:C(c.icon,"object-contain")}):e.jsx("span",{className:C("font-semibold",i.text,c.text),children:i.letter})})}function Bs({displayName:s,logoProvider:a,provider:t,data:n,isLoading:i,hasChanges:c,isRawJsonValid:l,isSaving:d,onRefetch:r,onSave:x}){return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(xe,{provider:a||t,size:"lg"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s}),n?.path&&e.jsx(_,{variant:"outline",className:"text-xs",children:n.path.replace(/^.*\//,"")})]}),n&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified: ",new Date(n.mtime).toLocaleString()]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{variant:"ghost",size:"sm",onClick:r,disabled:i,children:e.jsx(F,{className:`w-4 h-4 ${i?"animate-spin":""}`})}),e.jsx(p,{size:"sm",onClick:x,disabled:d||!c||!l,children:d?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ys,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function Gs({catalog:s,savedPresets:a,currentModel:t,opusModel:n,sonnetModel:i,haikuModel:c,providerModels:l,onApplyPreset:d,onUpdateEnvValue:r,onOpenCustomPreset:x,onDeletePreset:u,isDeletePending:g}){const f=s&&s.models.length>0||a.length>0;return e.jsxs(e.Fragment,{children:[f&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4"}),"Presets"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Apply pre-configured model mappings"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[s?.models.slice(0,3).map(o=>e.jsxs(p,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>{const N=o.presetMapping||{default:o.id,opus:o.id,sonnet:o.id,haiku:o.id};d({ANTHROPIC_MODEL:N.default,ANTHROPIC_DEFAULT_OPUS_MODEL:N.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:N.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:N.haiku})},children:[e.jsx(X,{className:"w-3 h-3"}),o.name]},o.id)),a.map(o=>e.jsxs("div",{className:"group relative",children:[e.jsxs(p,{variant:"secondary",size:"sm",className:"text-xs h-7 gap-1 pr-6",onClick:()=>{d({ANTHROPIC_MODEL:o.default,ANTHROPIC_DEFAULT_OPUS_MODEL:o.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:o.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:o.haiku})},children:[e.jsx(W,{className:"w-3 h-3 fill-current"}),o.name]}),e.jsx(p,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-7 w-5 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:N=>{N.stopPropagation(),u(o.name)},disabled:g,children:e.jsx(me,{className:"w-3 h-3"})})]},o.name)),e.jsxs(p,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1 border-primary/50 text-primary hover:bg-primary/10 hover:border-primary",onClick:x,children:[e.jsx(Le,{className:"w-3 h-3"}),"Custom"]})]})]}),e.jsx(ue,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:"Model Mapping"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(E,{label:"Default Model",description:"Used when no specific tier is requested",value:t,onChange:o=>r("ANTHROPIC_MODEL",o),catalog:s,allModels:l}),e.jsx(E,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:n,onChange:o=>r("ANTHROPIC_DEFAULT_OPUS_MODEL",o),catalog:s,allModels:l}),e.jsx(E,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:i,onChange:o=>r("ANTHROPIC_DEFAULT_SONNET_MODEL",o),catalog:s,allModels:l}),e.jsx(E,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:c,onChange:o=>r("ANTHROPIC_DEFAULT_HAIKU_MODEL",o),catalog:s,allModels:l})]})]})]})}function Qs({...s}){return e.jsx(Qe,{"data-slot":"dropdown-menu",...s})}function Ks({...s}){return e.jsx(Ke,{"data-slot":"dropdown-menu-trigger",...s})}function Ws({className:s,sideOffset:a=4,...t}){return e.jsx(We,{children:e.jsx(Xe,{"data-slot":"dropdown-menu-content",sideOffset:a,className:C("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md bg-white dark:bg-zinc-950",s),...t})})}function we({className:s,inset:a,variant:t="default",...n}){return e.jsx(Ye,{"data-slot":"dropdown-menu-item","data-inset":a,"data-variant":t,className:C("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground focus:[&_svg:not([class*='text-'])]:text-current relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",s),...n})}function Xs({account:s,onSetDefault:a,onRemove:t,isRemoving:n,privacyMode:i}){return e.jsxs("div",{className:C("flex items-center justify-between p-3 rounded-lg border transition-colors",s.isDefault?"border-primary/30 bg-primary/5":"border-border hover:bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:C("flex items-center justify-center w-8 h-8 rounded-full",s.isDefault?"bg-primary/10":"bg-muted"),children:e.jsx(V,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:C("font-medium text-sm",i&&te),children:s.email||s.id}),s.isDefault&&e.jsxs(_,{variant:"secondary",className:"text-[10px] h-4 px-1.5 gap-0.5",children:[e.jsx(W,{className:"w-2.5 h-2.5 fill-current"}),"Default"]})]}),s.lastUsedAt&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mt-0.5",children:[e.jsx(Ee,{className:"w-3 h-3"}),"Last used: ",new Date(s.lastUsedAt).toLocaleDateString()]})]})]}),e.jsxs(Qs,{children:[e.jsx(Ks,{asChild:!0,children:e.jsx(p,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(Cs,{className:"w-4 h-4"})})}),e.jsxs(Ws,{align:"end",children:[!s.isDefault&&e.jsxs(we,{onClick:a,children:[e.jsx(W,{className:"w-4 h-4 mr-2"}),"Set as default"]}),e.jsxs(we,{className:"text-destructive focus:text-destructive",onClick:t,disabled:n,children:[e.jsx(Re,{className:"w-4 h-4 mr-2"}),n?"Removing...":"Remove account"]})]})]})]})}function Ys({accounts:s,onAddAccount:a,onSetDefault:t,onRemoveAccount:n,isRemovingAccount:i,privacyMode:c}){return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(V,{className:"w-4 h-4"}),"Accounts",s.length>0&&e.jsx(_,{variant:"secondary",className:"text-xs",children:s.length})]}),e.jsxs(p,{variant:"default",size:"sm",className:"h-7 text-xs gap-1",onClick:a,children:[e.jsx(Le,{className:"w-3 h-3"}),"Add"]})]}),s.length>0?e.jsx("div",{className:"space-y-2",children:s.map(l=>e.jsx(Xs,{account:l,onSetDefault:()=>t(l.id),onRemove:()=>n(l.id),isRemoving:i,privacyMode:c},l.id))}):e.jsxs("div",{className:"py-6 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed",children:[e.jsx(V,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No accounts connected"}),e.jsx("p",{className:"text-xs opacity-70",children:"Add an account to get started"})]})]})}function Zs({catalog:s,savedPresets:a,currentModel:t,opusModel:n,sonnetModel:i,haikuModel:c,providerModels:l,onApplyPreset:d,onUpdateEnvValue:r,onOpenCustomPreset:x,onDeletePreset:u,isDeletePending:g,accounts:f,onAddAccount:o,onSetDefault:N,onRemoveAccount:S,isRemovingAccount:w,privacyMode:P}){return e.jsx(le,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsx(Gs,{catalog:s,savedPresets:a,currentModel:t,opusModel:n,sonnetModel:i,haikuModel:c,providerModels:l,onApplyPreset:d,onUpdateEnvValue:r,onOpenCustomPreset:x,onDeletePreset:u,isDeletePending:g}),e.jsx(ue,{}),e.jsx(Ys,{accounts:f,onAddAccount:o,onSetDefault:N,onRemoveAccount:S,isRemovingAccount:w,privacyMode:P})]})})}function be({provider:s,displayName:a,authStatus:t,catalog:n,logoProvider:i,onAddAccount:c,onSetDefault:l,onRemoveAccount:d,isRemovingAccount:r}){const[x,u]=h.useState(!1),{privacyMode:g}=Me(),{data:f}=as(),{data:o}=ns(s),N=is(),S=rs(),w=o?.presets||[],P=h.useMemo(()=>{if(!f?.models)return[];const I={gemini:["google"],agy:["antigravity"],codex:["openai"],qwen:["alibaba","qwen"],iflow:["iflow"]}[s.toLowerCase()]||[s.toLowerCase()];return f.models.filter(Be=>I.some(Ge=>Be.owned_by.toLowerCase().includes(Ge)))},[f,s]),{data:O,isLoading:b,refetch:y,rawJsonContent:A,rawJsonEdits:D,isRawJsonValid:v,hasChanges:k,currentModel:m,opusModel:L,sonnetModel:J,haikuModel:B,handleRawJsonChange:Y,updateEnvValue:Z,updateEnvValues:j,saveMutation:H,conflictDialog:R,handleConflictResolve:G}=Hs(s),$e=t.accounts||[],ze=M=>{j({ANTHROPIC_BASE_URL:`http://127.0.0.1:${se}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:"ccs-internal-managed",...M}),T.success(`Applied "${M.ANTHROPIC_MODEL?.split("/").pop()||"preset"}" preset`)},qe=(M,I)=>{j({ANTHROPIC_BASE_URL:`http://127.0.0.1:${se}/api/provider/${s}`,ANTHROPIC_AUTH_TOKEN:"ccs-internal-managed",ANTHROPIC_MODEL:M.default,ANTHROPIC_DEFAULT_OPUS_MODEL:M.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:M.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:M.haiku}),T.success(`Applied ${I?`"${I}"`:"custom"} preset`),u(!1)},Je=(M,I)=>{if(!I){T.error("Please enter a preset name to save");return}N.mutate({profile:s,data:{name:I,...M}}),u(!1)};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(Bs,{provider:s,displayName:a,logoProvider:i,data:O,isLoading:b,hasChanges:k,isRawJsonValid:v,isSaving:H.isPending,onRefetch:y,onSave:()=>H.mutate()}),b?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(z,{className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading settings..."})]}):e.jsxs("div",{className:"flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[e.jsx("div",{className:"flex flex-col overflow-hidden bg-muted/5",children:e.jsxs(cs,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(ls,{className:"w-full",children:[e.jsx(ge,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(ge,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(fe,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(Zs,{catalog:n,savedPresets:w,currentModel:m,opusModel:L,sonnetModel:J,haikuModel:B,providerModels:P,onApplyPreset:ze,onUpdateEnvValue:Z,onOpenCustomPreset:()=>u(!0),onDeletePreset:M=>S.mutate({profile:s,name:M}),isDeletePending:S.isPending,accounts:$e,onAddAccount:c,onSetDefault:l,onRemoveAccount:d,isRemovingAccount:r,privacyMode:g})}),e.jsx(fe,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx($s,{provider:s,displayName:a,data:O,authStatus:t})})]})]})}),e.jsxs("div",{className:"flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(As,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),e.jsx(os,{rawJsonContent:A,isRawJsonValid:v,rawJsonEdits:D,onRawJsonChange:Y,profileEnv:O?.settings?.env})]})]}),e.jsx(Ms,{open:R,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>G(!0),onCancel:()=>G(!1)}),e.jsx(Vs,{open:x,onClose:()=>u(!1),currentValues:{default:m||"",opus:L||"",sonnet:J||"",haiku:B||""},onApply:qe,onSave:Je,isSaving:N.isPending,catalog:n,allModels:P})]})}function et(s){if(!s)return"";const a=new Date(s).getTime(),n=Date.now()-a,i=Math.floor(n/(1e3*60*60)),c=Math.floor(n%(1e3*60*60)/(1e3*60));return i>0?`${i}h ${c}m`:`${c}m`}function st(s){if(!s)return"";const a=Date.now()-s,t=Math.floor(a/(1e3*60)),n=Math.floor(a/(1e3*60*60));return t<1?"just now":t<60?`${t}m ago`:`${n}h ago`}function tt(){const{data:s,isLoading:a}=ds(),{data:t}=ms(),n=us(),i=xs(),c=s?.running??!1,l=n.isPending||i.isPending,d=t?.hasUpdate??!1,r=async()=>{await i.mutateAsync(),await new Promise(x=>setTimeout(x,500)),n.mutate()};return e.jsxs("div",{className:C("rounded-lg border p-3 transition-colors",c?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:C("w-2 h-2 rounded-full",c?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),e.jsx("span",{className:"text-sm font-medium",children:"CLIProxy Service"}),d&&e.jsxs(_,{variant:"secondary",className:"text-[10px] h-4 px-1.5 gap-0.5 bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",title:`Update: v${t?.currentVersion} -> v${t?.latestVersion}`,children:[e.jsx(je,{className:"w-2.5 h-2.5"}),"Update"]})]}),e.jsx("div",{className:"flex items-center gap-1",children:a?e.jsx(F,{className:"w-3 h-3 animate-spin text-muted-foreground"}):c?e.jsx(Ss,{className:"w-3 h-3 text-green-600"}):e.jsx(ve,{className:"w-3 h-3 text-muted-foreground"})})]}),c&&s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:["Port ",s.port]}),s.sessionCount!==void 0&&s.sessionCount>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ps,{className:"w-3 h-3"}),s.sessionCount," session",s.sessionCount!==1?"s":""]}),s.startedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ee,{className:"w-3 h-3"}),et(s.startedAt)]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsxs(p,{variant:d?"default":"outline",size:"sm",className:C("h-7 text-xs gap-1 flex-1",d&&"bg-sidebar-accent hover:bg-sidebar-accent/90 text-sidebar-accent-foreground"),onClick:r,disabled:l,title:d?`Restart to update: v${t?.currentVersion} -> v${t?.latestVersion}`:"Restart CLIProxy service",children:[l?e.jsx(F,{className:"w-3 h-3 animate-spin"}):d?e.jsx(je,{className:"w-3 h-3"}):e.jsx(ks,{className:"w-3 h-3"}),d?"Update":"Restart"]}),e.jsxs(p,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1 hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",onClick:()=>i.mutate(),disabled:l,title:"Stop CLIProxy service",children:[i.isPending?e.jsx(F,{className:"w-3 h-3 animate-spin"}):e.jsx(Os,{className:"w-3 h-3"}),"Stop"]})]})]}):e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not running"}),e.jsxs(p,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>n.mutate(),disabled:n.isPending,children:[n.isPending?e.jsx(F,{className:"w-3 h-3 animate-spin"}):e.jsx(ve,{className:"w-3 h-3"}),"Start"]})]}),t?.currentVersion&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-muted flex items-center justify-between text-[10px] text-muted-foreground/70",children:[e.jsxs("span",{children:["v",t.currentVersion]}),t.checkedAt&&e.jsxs("span",{title:new Date(t.checkedAt).toLocaleString(),children:["Synced ",st(t.checkedAt)]})]})]})}function at({status:s,isSelected:a,onSelect:t}){const n=s.accounts?.length||0;return e.jsxs("button",{className:C("w-full flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors cursor-pointer text-left",a?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:t,children:[e.jsx(xe,{provider:s.provider,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:s.displayName}),n>0&&e.jsx(_,{variant:"secondary",className:"text-[10px] h-4 px-1",children:n})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:s.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-green-600",children:"Connected"})]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not connected"})]})})]})]})}function nt({variant:s,parentAuth:a,isSelected:t,onSelect:n,onDelete:i,isDeleting:c}){return e.jsxs("button",{className:C("group w-full flex items-center gap-3 px-3 py-2 rounded-lg transition-colors cursor-pointer text-left pl-6",t?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:n,children:[e.jsxs("div",{className:"relative",children:[e.jsx(xe,{provider:s.provider,size:"sm"}),e.jsx(Ie,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-muted-foreground"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:s.name}),e.jsx(_,{variant:"outline",className:"text-[9px] h-4 px-1",children:"variant"})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:a?.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"w-3 h-3 text-green-600"}),e.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["via ",s.provider]})]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Parent not connected"})]})})]}),e.jsx(p,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:l=>{l.stopPropagation(),i()},disabled:c,children:e.jsx(Re,{className:"w-3 h-3"})})]})}function it({onSetup:s}){return e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-6",children:e.jsx(X,{className:"w-8 h-8 text-muted-foreground"})}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"CCS Profile Manager"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Manage OAuth authentication, account preferences, and model selection for CLIProxy providers. Configure how CCS routes requests to different AI backends."}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6",children:["For live usage stats and real-time monitoring, visit the"," ",e.jsx("a",{href:"/cliproxy/control-panel",className:"text-primary hover:underline",children:"Control Panel"}),"."]}),e.jsxs(p,{onClick:s,className:"gap-2",children:[e.jsx(q,{className:"w-4 h-4"}),"Quick Setup"]})]})})}function ft(){const s=ye(),{data:a,isLoading:t}=ke(),{data:n,isFetching:i}=hs(),c=ps(),l=gs(),d=fs(),[r,x]=h.useState(null),[u,g]=h.useState(null),[f,o]=h.useState(!1),[N,S]=h.useState(null),w=h.useMemo(()=>a?.authStatus||[],[a?.authStatus]),P=h.useMemo(()=>n?.variants||[],[n?.variants]),O=h.useMemo(()=>u?null:r&&w.some(m=>m.provider===r)?r:w.length>0?w[0].provider:null,[r,u,w]),b=w.find(m=>m.provider===O),y=P.find(m=>m.name===u),A=y?w.find(m=>m.provider===y.provider):void 0,D=()=>{s.invalidateQueries({queryKey:["cliproxy"]}),s.invalidateQueries({queryKey:["cliproxy-auth"]})},v=m=>{x(m),g(null)},k=m=>{g(m),x(null)};return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(X,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"CLIProxy"})]}),e.jsx(p,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:D,disabled:i,children:e.jsx(F,{className:C("w-4 h-4",i&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"CCS-level account management"}),e.jsxs(p,{variant:"default",size:"sm",className:"w-full gap-2",onClick:()=>o(!0),children:[e.jsx(q,{className:"w-4 h-4"}),"Quick Setup"]})]}),e.jsx(le,{className:"flex-1",children:e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2",children:"Providers"}),t?e.jsx("div",{className:"space-y-2 px-2",children:[1,2,3,4].map(m=>e.jsx(js,{className:"h-14 w-full rounded-lg"},m))}):e.jsx("div",{className:"space-y-1",children:w.map(m=>e.jsx(at,{status:m,isSelected:O===m.provider,onSelect:()=>v(m.provider)},m.provider))}),P.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2 mt-4 flex items-center gap-1.5",children:[e.jsx(Ie,{className:"w-3 h-3"}),"Variants"]}),e.jsx("div",{className:"space-y-1",children:P.map(m=>e.jsx(nt,{variant:m,parentAuth:w.find(L=>L.provider===m.provider),isSelected:u===m.name,onSelect:()=>k(m.name),onDelete:()=>d.mutate(m.name),isDeleting:d.isPending},m.name))})]})]})}),e.jsx("div",{className:"p-3 border-t",children:e.jsx(tt,{})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[w.length," provider",w.length!==1?"s":""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(U,{className:"w-3 h-3 text-green-600"}),w.filter(m=>m.authenticated).length," connected"]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background",children:y&&A?e.jsx(be,{provider:y.name,displayName:`${y.name} (${y.provider} variant)`,authStatus:A,catalog:$[y.provider],logoProvider:y.provider,onAddAccount:()=>S({provider:y.provider,displayName:A.displayName,isFirstAccount:(A.accounts?.length||0)===0}),onSetDefault:m=>c.mutate({provider:y.provider,accountId:m}),onRemoveAccount:m=>l.mutate({provider:y.provider,accountId:m}),isRemovingAccount:l.isPending}):b?e.jsx(be,{provider:b.provider,displayName:b.displayName,authStatus:b,catalog:$[b.provider],onAddAccount:()=>S({provider:b.provider,displayName:b.displayName,isFirstAccount:(b.accounts?.length||0)===0}),onSetDefault:m=>c.mutate({provider:b.provider,accountId:m}),onRemoveAccount:m=>l.mutate({provider:b.provider,accountId:m}),isRemovingAccount:l.isPending}):e.jsx(it,{onSetup:()=>o(!0)})}),e.jsx(Fs,{open:f,onClose:()=>o(!1)}),e.jsx(Us,{open:N!==null,onClose:()=>S(null),provider:N?.provider||"",displayName:N?.displayName||"",isFirstAccount:N?.isFirstAccount||!1})]})}export{ft as CliproxyPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./radix-ui-CV3R9pD6.js";import{r as s}from"./react-vendor-FspHSO0w.js";import{G as b,a2 as d,a9 as g,K as j,X as p}from"./icons-ZmwVoUeR.js";const N=8317,C="ccs";function y({port:t=N}){const n=s.useRef(null),[r,c]=s.useState(!0),[o,a]=s.useState(null),[x,l]=s.useState(!1),[m,u]=s.useState(!0),i=`http://localhost:${t}/management.html`;s.useEffect(()=>{(async()=>{try{(await fetch(`http://localhost:${t}/`,{signal:AbortSignal.timeout(2e3)})).ok?(l(!0),a(null)):(l(!1),a("CLIProxy returned an error"))}catch{l(!1),a("CLIProxy is not running")}})()},[t]);const h=s.useCallback(()=>{if(c(!1),n.current?.contentWindow)try{n.current.contentWindow.postMessage({type:"ccs-auto-login",apiBase:`http://localhost:${t}`,managementKey:C},`http://localhost:${t}`)}catch{console.debug("[ControlPanelEmbed] postMessage failed - cross-origin")}},[t]),f=()=>{c(!0),n.current&&(n.current.src=i)};return!x&&o?e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{className:"w-5 h-5 text-primary"}),e.jsx("h2",{className:"font-semibold",children:"CLIProxy Control Panel"})]}),e.jsxs("button",{className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm border rounded-md hover:bg-muted",onClick:f,children:[e.jsx(d,{className:"w-4 h-4"}),"Retry"]})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-destructive/10 flex items-center justify-center mx-auto mb-6",children:e.jsx(g,{className:"w-8 h-8 text-destructive"})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"CLIProxy Not Available"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:o}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Start a CLIProxy session with"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"ccs gemini"})," or run"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"ccs config"})," which auto-starts it."]})]})})]}):e.jsxs("div",{className:"flex-1 flex flex-col relative",children:[m&&!r&&e.jsx("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20",children:e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-md text-sm",children:[e.jsx(j,{className:"h-3.5 w-3.5 text-blue-600"}),e.jsxs("span",{children:["Key:"," ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded font-mono font-semibold",children:"ccs"})]}),e.jsx("button",{className:"text-blue-600 hover:text-blue-800 dark:hover:text-blue-400",onClick:()=>u(!1),children:e.jsx(p,{className:"h-3.5 w-3.5"})})]})}),r&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 z-10",children:e.jsxs("div",{className:"text-center",children:[e.jsx(d,{className:"w-8 h-8 animate-spin text-primary mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading Control Panel..."})]})}),e.jsx("iframe",{ref:n,src:i,className:"flex-1 w-full border-0",title:"CLIProxy Management Panel",onLoad:h})]})}function E(){return e.jsx("div",{className:"h-[calc(100vh-100px)] flex flex-col",children:e.jsx(y,{})})}export{E as CliproxyControlPanelPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-
|
|
1
|
+
import{j as e}from"./radix-ui-CV3R9pD6.js";import{r as p}from"./react-vendor-FspHSO0w.js";import{ag as $,c as d,ah as A,B as I}from"./index-C6Dah-xh.js";import{H as w,t as E}from"./code-highlight-BoHWVYut.js";import{d as K,E as O,k as M,a9 as P}from"./icons-ZmwVoUeR.js";import"./tanstack-Df9bCj5R.js";import"./notifications-B2Pz7lik.js";import"./utils-CzKF5WmX.js";import"./form-utils-DP6ILe7Z.js";const F=[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/_SECRET$/,/_SECRET_KEY$/,/^API_KEY$/,/^AUTH_TOKEN$/,/^SECRET$/,/_PASSWORD$/,/^PASSWORD$/,/_CREDENTIAL$/,/_PRIVATE_KEY$/];function H(t){return F.some(n=>n.test(t))}function V(t){if(!t.trim())return{valid:!0};try{return JSON.parse(t),{valid:!0}}catch(n){const r=n.message,u=r.match(/position (\d+)/);if(u){const m=parseInt(u[1],10),o=t.substring(0,m).split(`
|
|
2
2
|
`);return{valid:!1,error:r,line:o.length}}return{valid:!1,error:r}}}function q({value:t,onChange:n,language:a="json",readonly:r=!1,className:u,minHeight:m="300px"}){const{isDark:o}=$(),[N,h]=p.useState(!1),[l,j]=p.useState(!0),i=p.useMemo(()=>a==="json"?V(t):{valid:!0},[t,a]),b=p.useCallback(S=>e.jsx(w,{theme:o?E.nightOwl:E.github,code:S,language:a,children:({tokens:_,getLineProps:C,getTokenProps:T})=>{let c=!1;return e.jsx(e.Fragment,{children:_.map((x,g)=>e.jsx("div",{...C({line:x}),className:d(i.line===g+1&&"bg-destructive/20"),children:x.map((s,y)=>{let v=!1;if(s.types.includes("property")){const R=s.content.replace(/['"]/g,"");H(R)?c=!0:c=!1}else(s.types.includes("string")||s.types.includes("number")||s.types.includes("boolean"))&&c?(v=!0,c=!1):s.types.includes("punctuation")&&s.content!==":"&&s.content!=="["&&s.content!=="{"&&(c=!1);const f=T({token:s});return v&&l&&(f.className=d(f.className,"blur-[3px] select-none opacity-70 transition-all duration-200")),e.jsx("span",{...f},y)})},g))})}}),[o,a,i.line,l]);return e.jsxs("div",{className:d("flex flex-col",u),children:[e.jsxs("div",{className:d("relative rounded-md border overflow-hidden","bg-muted/30",N&&"ring-2 ring-ring ring-offset-2 ring-offset-background",r&&"opacity-70 cursor-not-allowed",!i.valid&&"border-destructive"),style:{minHeight:m},children:[e.jsx(A,{value:t,onValueChange:r?()=>{}:n,highlight:b,padding:12,disabled:r,onFocus:()=>h(!0),onBlur:()=>h(!1),textareaClassName:d("focus:outline-none font-mono text-sm",r&&"cursor-not-allowed"),preClassName:"font-mono text-sm",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"0.875rem",minHeight:m}},o?"dark-editor":"light-editor"),e.jsx("div",{className:"absolute top-2 right-2 z-10 opacity-50 hover:opacity-100 transition-opacity",children:e.jsx(I,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>j(!l),title:l?"Reveal sensitive values":"Mask sensitive values",children:l?e.jsx(K,{className:"h-3 w-3"}):e.jsx(O,{className:"h-3 w-3"})})})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[i.valid?e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(M,{className:"w-3 h-3 text-green-500"}),"Valid ",a.toUpperCase()]}):e.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[e.jsx(P,{className:"w-3 h-3"}),i.error,i.line&&` (line ${i.line})`]}),r&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:"(Read-only)"})]})]})}export{q as CodeEditor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,$ as u,a0 as x,a1 as f,a2 as g,a3 as m,a4 as j,a5 as p,a6 as h,a7 as D}from"./radix-ui-CV3R9pD6.js";import"./react-vendor-FspHSO0w.js";import{c as o,a3 as n}from"./index-C6Dah-xh.js";function T({className:a,orientation:e="horizontal",decorative:l=!0,...r}){return t.jsx(u,{"data-slot":"separator",decorative:l,orientation:e,className:o("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",a),...r})}function A({...a}){return t.jsx(x,{"data-slot":"alert-dialog",...a})}function b({...a}){return t.jsx(h,{"data-slot":"alert-dialog-portal",...a})}function v({className:a,...e}){return t.jsx(D,{"data-slot":"alert-dialog-overlay",className:o("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",a),...e})}function C({className:a,...e}){return t.jsxs(b,{children:[t.jsx(v,{}),t.jsx(f,{"data-slot":"alert-dialog-content",className:o("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",a),...e})]})}function N({className:a,...e}){return t.jsx("div",{"data-slot":"alert-dialog-header",className:o("flex flex-col gap-2 text-center sm:text-left",a),...e})}function w({className:a,...e}){return t.jsx("div",{"data-slot":"alert-dialog-footer",className:o("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),...e})}function z({className:a,...e}){return t.jsx(g,{"data-slot":"alert-dialog-title",className:o("text-lg font-semibold",a),...e})}function k({className:a,...e}){return t.jsx(m,{"data-slot":"alert-dialog-description",className:o("text-muted-foreground text-sm",a),...e})}function y({className:a,...e}){return t.jsx(p,{className:o(n(),a),...e})}function O({className:a,...e}){return t.jsx(j,{className:o(n({variant:"outline"}),a),...e})}function E({open:a,onConfirm:e,onCancel:l,title:r,description:s,confirmText:i="Confirm",variant:d="default"}){return t.jsx(A,{open:a,onOpenChange:c=>!c&&l(),children:t.jsxs(C,{children:[t.jsxs(N,{children:[t.jsx(z,{children:r}),t.jsx(k,{children:s})]}),t.jsxs(w,{children:[t.jsx(O,{onClick:l,children:"Cancel"}),t.jsx(y,{onClick:e,className:d==="destructive"?"bg-red-600 hover:bg-red-700":"",children:i})]})]})})}export{E as C,T as S};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/code-editor-CDmNFLQ6.js","assets/radix-ui-CV3R9pD6.js","assets/react-vendor-FspHSO0w.js","assets/index-C6Dah-xh.js","assets/tanstack-Df9bCj5R.js","assets/notifications-B2Pz7lik.js","assets/utils-CzKF5WmX.js","assets/icons-ZmwVoUeR.js","assets/form-utils-DP6ILe7Z.js","assets/code-highlight-BoHWVYut.js","assets/index-It66SkKf.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as e}from"./radix-ui-CV3R9pD6.js";import{e as y,B as N,r as le,s as oe,t as re,v as ce,H as je,J as ve,w as Q,n as Y,i as $,L as b,I as te,k as de,a1 as Ne,a2 as we,S as w,T as ye,l as be,m as z,c as W}from"./index-C6Dah-xh.js";import{u as Ce,a as M,b as C}from"./tanstack-Df9bCj5R.js";import{S as X,C as Se}from"./confirm-dialog-CaiDQikc.js";import{a2 as me,L as Z,a6 as ke,j as Fe,_ as Pe,Z as ae,I as Me,X as Le,a7 as Te,a as Ae,u as Ee,$ as Re,ak as _e,ag as ne,K as Oe,a1 as Ie,al as qe,k as ue,l as xe}from"./icons-ZmwVoUeR.js";import{S as B}from"./switch-BQ6sBBUv.js";import{r as v}from"./react-vendor-FspHSO0w.js";import{t as H}from"./notifications-B2Pz7lik.js";import"./utils-CzKF5WmX.js";import"./form-utils-DP6ILe7Z.js";import"./code-highlight-BoHWVYut.js";const f="/api";async function De(){const s=await fetch(`${f}/copilot/status`);if(!s.ok)throw new Error("Failed to fetch copilot status");return s.json()}async function Ue(){const s=await fetch(`${f}/copilot/config`);if(!s.ok)throw new Error("Failed to fetch copilot config");return s.json()}async function Je(){const s=await fetch(`${f}/copilot/models`);if(!s.ok)throw new Error("Failed to fetch copilot models");return s.json()}async function Qe(){const s=await fetch(`${f}/copilot/settings/raw`);if(!s.ok)throw new Error("Failed to fetch copilot raw settings");return s.json()}async function $e(s){const t=await fetch(`${f}/copilot/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!t.ok)throw new Error("Failed to update copilot config");return t.json()}async function Ke(s){const t=await fetch(`${f}/copilot/settings/raw`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.status===409)throw new Error("CONFLICT");if(!t.ok)throw new Error("Failed to save copilot raw settings");return t.json()}async function Ge(){const s=await fetch(`${f}/copilot/auth/start`,{method:"POST"});if(!s.ok)throw new Error("Failed to start auth");return s.json()}async function ze(){const s=await fetch(`${f}/copilot/daemon/start`,{method:"POST"});if(!s.ok)throw new Error("Failed to start daemon");return s.json()}async function Be(){const s=await fetch(`${f}/copilot/daemon/stop`,{method:"POST"});if(!s.ok)throw new Error("Failed to stop daemon");return s.json()}async function He(){const s=await fetch(`${f}/copilot/info`);if(!s.ok)throw new Error("Failed to fetch copilot info");return s.json()}async function Ve(s){const t=await fetch(`${f}/copilot/install`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s?{version:s}:{})});if(!t.ok)throw new Error("Failed to install copilot-api");return t.json()}function he(){const s=Ce(),t=M({queryKey:["copilot-status"],queryFn:De,refetchInterval:5e3}),l=M({queryKey:["copilot-config"],queryFn:Ue}),o=M({queryKey:["copilot-models"],queryFn:Je}),a=M({queryKey:["copilot-raw-settings"],queryFn:Qe}),d=M({queryKey:["copilot-info"],queryFn:He}),r=C({mutationFn:$e,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-config"]}),s.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),i=C({mutationFn:Ke,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-config"]}),s.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),u=C({mutationFn:Ge,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),p=C({mutationFn:ze,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),x=C({mutationFn:Be,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),n=C({mutationFn:Ve,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-info"]})}});return{status:t.data,statusLoading:t.isLoading,statusError:t.error,refetchStatus:t.refetch,config:l.data,configLoading:l.isLoading,models:o.data?.models??[],currentModel:o.data?.current,modelsLoading:o.isLoading,rawSettings:a.data,rawSettingsLoading:a.isLoading,refetchRawSettings:a.refetch,updateConfig:r.mutate,updateConfigAsync:r.mutateAsync,isUpdating:r.isPending,saveRawSettings:i.mutate,saveRawSettingsAsync:i.mutateAsync,isSavingRawSettings:i.isPending,startAuth:u.mutate,startAuthAsync:u.mutateAsync,isAuthenticating:u.isPending,authResult:u.data,startDaemon:p.mutate,isStartingDaemon:p.isPending,stopDaemon:x.mutate,isStoppingDaemon:x.isPending,info:d.data,infoLoading:d.isLoading,refetchInfo:d.refetch,install:n.mutate,installAsync:n.mutateAsync,isInstalling:n.isPending}}function We({rawSettings:s,rawSettingsLoading:t,isUpdating:l,isSavingRawSettings:o,hasChanges:a,isRawJsonValid:d,onRefresh:r,onSave:i}){return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Copilot Configuration"}),s&&e.jsx(y,{variant:"outline",className:"text-xs",children:"copilot.settings.json"})]}),s&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified:"," ",s.exists?new Date(s.mtime).toLocaleString():"Never saved"]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{variant:"ghost",size:"sm",onClick:r,disabled:t,children:e.jsx(me,{className:`w-4 h-4 ${t?"animate-spin":""}`})}),e.jsx(N,{size:"sm",onClick:i,disabled:l||o||!a||!d,children:l||o?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ke,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}const Xe=[{name:"GPT-4.1 (Free)",description:"Free tier - no premium usage",default:"gpt-4.1",opus:"gpt-4.1",sonnet:"gpt-4.1",haiku:"gpt-4.1"},{name:"GPT-5 Mini (Free)",description:"Free tier - lightweight model",default:"gpt-5-mini",opus:"gpt-5-mini",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"},{name:"Raptor Mini (Free)",description:"Free tier - fine-tuned for coding",default:"raptor-mini",opus:"raptor-mini",sonnet:"raptor-mini",haiku:"raptor-mini"}],Ye=[{name:"Claude Opus 4.5",description:"Pro+ (3x) - Most capable reasoning",default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"Claude Sonnet 4.5",description:"Pro+ (1x) - Balanced performance",default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"GPT-5.2",description:"Pro+ (1x) - Latest OpenAI (Preview)",default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"},{name:"GPT-5.1 Codex Max",description:"Pro+ (1x) - Best for coding",default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex",haiku:"gpt-5.1-codex-mini"},{name:"Gemini 2.5 Pro",description:"Pro+ (1x) - Google latest",default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-3-flash"}];function ie(s){switch(s){case"free":return"bg-green-100 text-green-700 border-green-200";case"pro":return"bg-blue-100 text-blue-700 border-blue-200";case"pro+":return"bg-purple-100 text-purple-700 border-purple-200";case"business":return"bg-orange-100 text-orange-700 border-orange-200";case"enterprise":return"bg-red-100 text-red-700 border-red-200";default:return"bg-muted text-muted-foreground"}}function Ze(s){return s==null?null:s===0?"Free":s<1?`${s}x`:s===1?"1x":`${s}x`}function D({label:s,description:t,value:l,onChange:o,models:a,disabled:d}){const r=a.find(i=>i.id===l);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:s}),t&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:t})]}),e.jsxs(le,{value:l||"",onValueChange:o,disabled:d,children:[e.jsx(oe,{className:"h-9",children:e.jsx(re,{placeholder:"Select model",children:l&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:l}),r?.minPlan&&e.jsx(y,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ie(r.minPlan)}`,children:r.minPlan})]})})}),e.jsx(ce,{className:"max-h-[300px]",children:e.jsxs(je,{children:[e.jsxs(ve,{className:"text-xs text-muted-foreground",children:["Available Models (",a.length,")"]}),a.map(i=>e.jsx(Q,{value:i.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:i.name||i.id}),i.minPlan&&e.jsx(y,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ie(i.minPlan)}`,children:i.minPlan}),i.multiplier!==void 0&&e.jsx("span",{className:"text-[9px] text-muted-foreground",children:Ze(i.multiplier)}),i.preview&&e.jsx(y,{variant:"secondary",className:"text-[9px] px-1 py-0 h-4",children:"Preview"}),l===i.id&&e.jsx(Fe,{className:"w-3 h-3 text-primary ml-auto"})]})},i.id))]})})]})]})}function es({currentModel:s,opusModel:t,sonnetModel:l,haikuModel:o,models:a,modelsLoading:d,onApplyPreset:r,onUpdateModel:i,onUpdateOpusModel:u,onUpdateSonnetModel:p,onUpdateHaikuModel:x}){return e.jsx(Y,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx($,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(Pe,{className:"w-4 h-4"}),"Presets"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Apply pre-configured model mappings"}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(y,{variant:"outline",className:"text-[10px] bg-green-100 text-green-700 border-green-200",children:"Free Tier"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No premium usage count"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Xe.map(n=>e.jsxs(N,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>r(n),title:n.description,children:[e.jsx(ae,{className:"w-3 h-3 text-green-600"}),n.name]},n.name))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(y,{variant:"outline",className:"text-[10px] bg-blue-100 text-blue-700 border-blue-200",children:"Pro+ Required"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Uses premium request quota"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Ye.map(n=>e.jsxs(N,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>r(n),title:n.description,children:[e.jsx(ae,{className:"w-3 h-3"}),n.name]},n.name))})]})]}),e.jsx(X,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:"Model Mapping"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(D,{label:"Default Model",description:"Used when no specific tier is requested",value:s,onChange:i,models:a,disabled:d}),e.jsx(D,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:t||s,onChange:u,models:a,disabled:d}),e.jsx(D,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:l||s,onChange:p,models:a,disabled:d}),e.jsx(D,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:o||s,onChange:x,models:a,disabled:d})]})]})]})})})}function ss({enabled:s,autoStart:t,port:l,accountType:o,rateLimit:a,waitOnLimit:d,onUpdateEnabled:r,onUpdateAutoStart:i,onUpdatePort:u,onUpdateAccountType:p,onUpdateRateLimit:x,onUpdateWaitOnLimit:n}){return e.jsx(Y,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx($,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{htmlFor:"enabled",className:"text-sm font-medium",children:"Enable Copilot"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow using GitHub Copilot subscription"})]}),e.jsx(B,{id:"enabled",checked:s,onCheckedChange:r})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Basic Settings"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"port",className:"text-xs",children:"Port"}),e.jsx(te,{id:"port",type:"number",value:l,onChange:j=>u(parseInt(j.target.value,10)),min:1024,max:65535,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"account-type",className:"text-xs",children:"Account Type"}),e.jsxs(le,{value:o,onValueChange:p,children:[e.jsx(oe,{id:"account-type",className:"max-w-[150px] h-8",children:e.jsx(re,{})}),e.jsxs(ce,{children:[e.jsx(Q,{value:"individual",children:"Individual"}),e.jsx(Q,{value:"business",children:"Business"}),e.jsx(Q,{value:"enterprise",children:"Enterprise"})]})]})]})]}),e.jsx(X,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Rate Limiting"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"rate-limit",className:"text-xs",children:"Rate Limit (seconds)"}),e.jsx(te,{id:"rate-limit",type:"number",value:a,onChange:j=>x(j.target.value),placeholder:"No limit",min:0,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{htmlFor:"wait-on-limit",className:"text-xs",children:"Wait on Rate Limit"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Wait instead of error when limit hit"})]}),e.jsx(B,{id:"wait-on-limit",checked:d,onCheckedChange:n})]})]}),e.jsx(X,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Daemon Settings"}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{htmlFor:"auto-start",className:"text-xs",children:"Auto-start Daemon"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Start copilot-api when using profile"})]}),e.jsx(B,{id:"auto-start",checked:t,onCheckedChange:i})]})]})]})})})}function U({label:s,command:t}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:s}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:t}),e.jsx(de,{value:t,size:"icon",className:"h-6 w-6"})]})]})}function ts({rawSettings:s}){return e.jsx(Y,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx($,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(Me,{className:"w-4 h-4"}),"Configuration Info"]}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Provider"}),e.jsx("span",{className:"font-mono",children:"GitHub Copilot"})]}),s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:s.path}),e.jsx(de,{value:s.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Status"}),e.jsx(y,{variant:"outline",className:s.exists?"w-fit text-green-600 border-green-200 bg-green-50":"w-fit text-muted-foreground",children:s.exists?"File exists":"Using defaults"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsx(U,{label:"Run with Copilot",command:"ccs copilot"}),e.jsx(U,{label:"Authenticate",command:"ccs copilot auth"}),e.jsx(U,{label:"Start daemon",command:"ccs copilot --start"}),e.jsx(U,{label:"Stop daemon",command:"ccs copilot --stop"})]})]})]})})})}const as=v.lazy(()=>we(()=>import("./code-editor-CDmNFLQ6.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(s=>({default:s.CodeEditor})));function ns({rawJsonContent:s,isRawJsonValid:t,rawJsonEdits:l,rawSettingsEnv:o,onChange:a}){return e.jsx(v.Suspense,{fallback:e.jsxs("div",{className:"flex items-center justify-center h-full",children:[e.jsx(Z,{className:"w-6 h-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:e.jsxs("div",{className:"h-full flex flex-col",children:[!t&&l!==null&&e.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[e.jsx(Le,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),e.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:e.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:e.jsx(as,{value:s,onChange:a,language:"json",minHeight:"100%"})})}),e.jsx("div",{className:"mx-6 mb-4",children:e.jsx("div",{className:"border rounded-md overflow-hidden",children:e.jsx(Ne,{profileEnv:o})})})]})})}function is(){const{config:s,configLoading:t,models:l,modelsLoading:o,rawSettings:a,rawSettingsLoading:d,updateConfigAsync:r,isUpdating:i,saveRawSettingsAsync:u,isSavingRawSettings:p,refetchRawSettings:x}=he(),[n,j]=v.useState({}),[g,S]=v.useState(null),[K,L]=v.useState(!1),T=n.enabled??s?.enabled??!1,A=n.autoStart??s?.auto_start??!1,k=n.port??s?.port??4141,E=n.accountType??s?.account_type??"individual",R=n.model??s?.model??"claude-opus-4-5-20250514",h=n.rateLimit??s?.rate_limit?.toString()??"",_=n.waitOnLimit??s?.wait_on_limit??!0,O=n.opusModel??s?.opus_model??"",I=n.sonnetModel??s?.sonnet_model??"",F=n.haikuModel??s?.haiku_model??"",G=(m,P)=>{j(ge=>({...ge,[m]:P}))},c=m=>{j(P=>({...P,model:m.default,opusModel:m.opus,sonnetModel:m.sonnet,haikuModel:m.haiku})),H.success(`Applied "${m.name}" preset`)},q=v.useMemo(()=>g!==null?g:a?.settings?JSON.stringify(a.settings,null,2):`{
|
|
3
|
+
"env": {}
|
|
4
|
+
}`,[g,a]),pe=v.useCallback(m=>{S(m)},[]),ee=v.useMemo(()=>{try{return JSON.parse(q),!0}catch{return!1}},[q]),fe=v.useMemo(()=>{const m=Object.keys(n).length>0,P=g!==null&&g!==JSON.stringify(a?.settings,null,2);return m||P},[n,g,a]),se=async()=>{try{if(Object.keys(n).length>0&&await r({enabled:T,auto_start:A,port:k,account_type:E,model:R,rate_limit:h?parseInt(h,10):null,wait_on_limit:_,opus_model:O||void 0,sonnet_model:I||void 0,haiku_model:F||void 0}),g!==null&&ee){const m=JSON.parse(q);await u({settings:m,expectedMtime:a?.mtime})}j({}),S(null),H.success("Copilot configuration saved")}catch(m){m.message==="CONFLICT"?L(!0):H.error("Failed to save settings")}};return{configLoading:t,rawSettingsLoading:d,modelsLoading:o,isUpdating:i,isSavingRawSettings:p,models:l,rawSettings:a,rawJsonContent:q,rawJsonEdits:g,enabled:T,autoStart:A,port:k,accountType:E,currentModel:R,rateLimit:h,waitOnLimit:_,opusModel:O,sonnetModel:I,haikuModel:F,isRawJsonValid:ee,hasChanges:fe,conflictDialog:K,updateField:G,applyPreset:c,handleRawJsonChange:pe,handleSave:se,handleConflictResolve:async m=>{L(!1),m?(await x(),se()):S(null)},refetchRawSettings:x}}function ls(){const{configLoading:s,rawSettingsLoading:t,modelsLoading:l,isUpdating:o,isSavingRawSettings:a,models:d,rawSettings:r,rawJsonContent:i,rawJsonEdits:u,enabled:p,autoStart:x,port:n,accountType:j,currentModel:g,rateLimit:S,waitOnLimit:K,opusModel:L,sonnetModel:T,haikuModel:A,isRawJsonValid:k,hasChanges:E,conflictDialog:R,updateField:h,applyPreset:_,handleRawJsonChange:O,handleSave:I,handleConflictResolve:F,refetchRawSettings:G}=is();return s||t?e.jsxs("div",{className:"space-y-6",children:[e.jsx(w,{className:"h-10 w-full"}),e.jsx(w,{className:"h-10 w-full"}),e.jsx(w,{className:"h-10 w-full"}),e.jsx(w,{className:"h-10 w-full"})]}):e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(We,{rawSettings:r,rawSettingsLoading:t,isUpdating:o,isSavingRawSettings:a,hasChanges:E,isRawJsonValid:k,onRefresh:()=>G(),onSave:I}),e.jsxs("div",{className:"flex-1 flex divide-x overflow-hidden",children:[e.jsx("div",{className:"w-[540px] shrink-0 flex flex-col overflow-hidden bg-muted/5",children:e.jsx("div",{className:"h-full flex flex-col",children:e.jsxs(ye,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(be,{className:"w-full",children:[e.jsx(z,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(z,{value:"settings",className:"flex-1",children:"Settings"}),e.jsx(z,{value:"info",className:"flex-1",children:"Info"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(es,{currentModel:g,opusModel:L,sonnetModel:T,haikuModel:A,models:d,modelsLoading:l,onApplyPreset:_,onUpdateModel:c=>h("model",c),onUpdateOpusModel:c=>h("opusModel",c),onUpdateSonnetModel:c=>h("sonnetModel",c),onUpdateHaikuModel:c=>h("haikuModel",c)}),e.jsx(ss,{enabled:p,autoStart:x,port:n,accountType:j,rateLimit:S,waitOnLimit:K,onUpdateEnabled:c=>h("enabled",c),onUpdateAutoStart:c=>h("autoStart",c),onUpdatePort:c=>h("port",c),onUpdateAccountType:c=>h("accountType",c),onUpdateRateLimit:c=>h("rateLimit",c),onUpdateWaitOnLimit:c=>h("waitOnLimit",c)}),e.jsx(ts,{rawSettings:r})]})]})})}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(Te,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),e.jsx(ns,{rawJsonContent:i,isRawJsonValid:k,rawJsonEdits:u,rawSettingsEnv:r?.settings?.env,onChange:O})]})]}),e.jsx(Se,{open:R,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>F(!0),onCancel:()=>F(!1)})]})}function V({title:s,children:t}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3",children:s}),e.jsx("div",{className:"space-y-1",children:t})]})}function J({icon:s,label:t,status:l,statusText:o,variant:a="default"}){return e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-muted/50",children:[e.jsx(s,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("span",{className:"text-sm",children:t})}),e.jsx("div",{className:"flex items-center gap-1.5",children:l?e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:W("w-4 h-4",a==="warning"?"text-yellow-500":"text-green-500")}),e.jsx("span",{className:W("text-xs",a==="warning"?"text-yellow-500":"text-green-500"),children:o||"Yes"})]}):e.jsxs(e.Fragment,{children:[e.jsx(xe,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:o||"No"})]})})]})}function os(){return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(w,{className:"h-8 w-full"}),e.jsx(w,{className:"h-12 w-full"}),e.jsx(w,{className:"h-12 w-full"}),e.jsx(w,{className:"h-12 w-full"})]})}function Ns(){const{status:s,statusLoading:t,refetchStatus:l,startAuth:o,isAuthenticating:a,startDaemon:d,isStartingDaemon:r,stopDaemon:i,isStoppingDaemon:u,install:p,isInstalling:x}=he();return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ae,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"Copilot"})]}),e.jsx(N,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>l(),disabled:t,children:e.jsx(me,{className:W("w-4 h-4",t&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"GitHub Copilot proxy"})]}),e.jsx($,{className:"flex-1",children:t?e.jsx(os,{}):e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-500/15 p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-400 shrink-0"}),e.jsx("span",{className:"text-xs font-semibold text-yellow-800 dark:text-yellow-200",children:"Unofficial API - Use at Your Own Risk"})]}),e.jsxs("ul",{className:"text-[11px] text-yellow-700 dark:text-yellow-300 space-y-0.5 pl-6 list-disc",children:[e.jsx("li",{children:"Reverse-engineered API - may break anytime"}),e.jsx("li",{children:"Excessive use may trigger account restrictions"}),e.jsx("li",{children:"No warranty, no responsibility from CCS"})]})]}),e.jsxs(V,{title:"Setup",children:[e.jsx(J,{icon:Re,label:"copilot-api",status:s?.installed??!1,statusText:s?.installed?s.version?`v${s.version}`:"Installed":"Missing"}),!s?.installed&&e.jsx(N,{size:"sm",className:"w-full mt-2",onClick:()=>p(void 0),disabled:x,children:x?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),"Installing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(_e,{className:"w-3.5 h-3.5 mr-1.5"}),"Install copilot-api"]})}),s?.installed&&e.jsx(J,{icon:ne,label:"Integration",status:s?.enabled??!1,statusText:s?.enabled?"Enabled":"Disabled"})]}),s?.installed&&e.jsxs(V,{title:"Auth",children:[e.jsx(J,{icon:Oe,label:"GitHub",status:s?.authenticated??!1,statusText:s?.authenticated?"Connected":"Not Connected"}),!s?.authenticated&&e.jsx(N,{size:"sm",className:"w-full mt-2",onClick:()=>o(),disabled:a,children:a?"Authenticating...":"Authenticate"})]}),s?.authenticated&&e.jsxs(V,{title:"Daemon",children:[e.jsx(J,{icon:Ie,label:"Status",status:s?.daemon_running??!1,statusText:s?.daemon_running?"Running":"Stopped"}),e.jsxs("div",{className:"px-3 py-1 text-xs text-muted-foreground",children:["Port: ",s?.port??4141]}),e.jsx("div",{className:"px-1",children:s?.daemon_running?e.jsxs(N,{size:"sm",variant:"outline",className:"w-full",onClick:()=>i(),disabled:u,children:[e.jsx(qe,{className:"w-3.5 h-3.5 mr-1.5"}),u?"Stopping...":"Stop"]}):e.jsxs(N,{size:"sm",variant:"outline",className:"w-full",onClick:()=>d(),disabled:r,children:[e.jsx(ne,{className:"w-3.5 h-3.5 mr-1.5"}),r?"Starting...":"Start"]})})]})]})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Proxy"}),s?.daemon_running?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ue,{className:"w-3 h-3 text-green-500"}),"Active"]}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(xe,{className:"w-3 h-3 text-muted-foreground"}),"Inactive"]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:e.jsx(ls,{})})]})}export{Ns as CopilotPage};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{c as P}from"./react-vendor-FspHSO0w.js";var xe=e=>e.type==="checkbox",_e=e=>e instanceof Date,G=e=>e==null;const ar=e=>typeof e=="object";var N=e=>!G(e)&&!Array.isArray(e)&&ar(e)&&!_e(e),qr=e=>N(e)&&e.target?xe(e.target)?e.target.checked:e.target.value:e,Jr=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Kr=(e,t)=>e.has(Jr(t)),Hr=e=>{const t=e.constructor&&e.constructor.prototype;return N(t)&&t.hasOwnProperty("isPrototypeOf")},ft=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function B(e){let t;const r=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(ft&&(e instanceof Blob||n))&&(r||N(e)))if(t=r?[]:Object.create(Object.getPrototypeOf(e)),!r&&!Hr(e))t=e;else for(const o in e)e.hasOwnProperty(o)&&(t[o]=B(e[o]));else return e;return t}var Be=e=>/^\w*$/.test(e),j=e=>e===void 0,dt=e=>Array.isArray(e)?e.filter(Boolean):[],ht=e=>dt(e.replace(/["|']|\]/g,"").split(/\.|\[/)),v=(e,t,r)=>{if(!t||!N(e))return r;const n=(Be(t)?[t]:ht(t)).reduce((o,s)=>G(o)?o:o[s],e);return j(n)||n===e?j(e[t])?r:e[t]:n},ie=e=>typeof e=="boolean",D=(e,t,r)=>{let n=-1;const o=Be(t)?[t]:ht(t),s=o.length,i=s-1;for(;++n<s;){const a=o[n];let p=r;if(n!==i){const _=e[a];p=N(_)||Array.isArray(_)?_:isNaN(+o[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=p,e=e[a]}};const Vt={BLUR:"blur",FOCUS_OUT:"focusout"},te={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ae={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},lr=P.createContext(null);lr.displayName="HookFormContext";const Gr=()=>P.useContext(lr);var Xr=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==te.all&&(t._proxyFormState[i]=!n||te.all),e[i]}});return o};const fr=typeof window<"u"?P.useLayoutEffect:P.useEffect;var X=e=>typeof e=="string",st=(e,t,r,n,o)=>X(e)?(n&&t.watch.add(e),v(r,e,o)):Array.isArray(e)?e.map(s=>(n&&t.watch.add(s),v(r,s))):(n&&(t.watchAll=!0),r),it=e=>G(e)||!ar(e);function re(e,t,r=new WeakSet){if(it(e)||it(t))return Object.is(e,t);if(_e(e)&&_e(t))return e.getTime()===t.getTime();const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const i=e[s];if(!o.includes(s))return!1;if(s!=="ref"){const a=t[s];if(_e(i)&&_e(a)||N(i)&&N(a)||Array.isArray(i)&&Array.isArray(a)?!re(i,a,r):!Object.is(i,a))return!1}}return!0}function gu(e){const t=Gr(),{control:r=t.control,name:n,defaultValue:o,disabled:s,exact:i,compute:a}=e||{},p=P.useRef(o),_=P.useRef(a),y=P.useRef(void 0),k=P.useRef(r),m=P.useRef(n);_.current=a;const[O,I]=P.useState(()=>{const Z=r._getWatch(n,p.current);return _.current?_.current(Z):Z}),V=P.useCallback(Z=>{const $=st(n,r._names,Z||r._formValues,!1,p.current);return _.current?_.current($):$},[r._formValues,r._names,n]),q=P.useCallback(Z=>{if(!s){const $=st(n,r._names,Z||r._formValues,!1,p.current);if(_.current){const le=_.current($);re(le,y.current)||(I(le),y.current=le)}else I($)}},[r._formValues,r._names,s,n]);fr(()=>((k.current!==r||!re(m.current,n))&&(k.current=r,m.current=n,q()),r._subscribe({name:n,formState:{values:!0},exact:i,callback:Z=>{q(Z.values)}})),[r,i,n,q]),P.useEffect(()=>r._removeUnmounted());const ce=k.current!==r,z=m.current,R=P.useMemo(()=>{if(s)return null;const Z=!ce&&!re(z,n);return ce||Z?V():null},[s,ce,n,z,V]);return R!==null?R:O}var Yr=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},Fe=e=>Array.isArray(e)?e:[e],xt=()=>{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}};function dr(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const o=e[n],s=t[n];if(o&&N(o)&&s){const i=dr(o,s);N(i)&&(r[n]=i)}else e[n]&&(r[n]=s)}return r}var K=e=>N(e)&&!Object.keys(e).length,pt=e=>e.type==="file",ne=e=>typeof e=="function",Ue=e=>{if(!ft)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},hr=e=>e.type==="select-multiple",_t=e=>e.type==="radio",Qr=e=>_t(e)||xe(e),ot=e=>Ue(e)&&e.isConnected;function en(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=j(e)?n++:e[t[n++]];return e}function tn(e){for(const t in e)if(e.hasOwnProperty(t)&&!j(e[t]))return!1;return!0}function L(e,t){const r=Array.isArray(t)?t:Be(t)?[t]:ht(t),n=r.length===1?e:en(e,r),o=r.length-1,s=r[o];return n&&delete n[s],o!==0&&(N(n)&&K(n)||Array.isArray(n)&&tn(n))&&L(e,r.slice(0,-1)),e}var rn=e=>{for(const t in e)if(ne(e[t]))return!0;return!1};function pr(e){return Array.isArray(e)||N(e)&&!rn(e)}function ut(e,t={}){for(const r in e){const n=e[r];pr(n)?(t[r]=Array.isArray(n)?[]:{},ut(n,t[r])):j(n)||(t[r]=!0)}return t}function ke(e,t,r){r||(r=ut(t));for(const n in e){const o=e[n];if(pr(o))j(t)||it(r[n])?r[n]=ut(o,Array.isArray(o)?[]:{}):ke(o,G(t)?{}:t[n],r[n]);else{const s=t[n];r[n]=!re(o,s)}}return r}const St={value:!1,isValid:!1},It={value:!0,isValid:!0};var _r=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!j(e[0].attributes.value)?j(e[0].value)||e[0].value===""?It:{value:e[0].value,isValid:!0}:It:St}return St},gr=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>j(e)?e:t?e===""?NaN:e&&+e:r&&X(e)?new Date(e):n?n(e):e;const Pt={isValid:!1,value:null};var mr=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Pt):Pt;function Tt(e){const t=e.ref;return pt(t)?t.files:_t(t)?mr(e.refs).value:hr(t)?[...t.selectedOptions].map(({value:r})=>r):xe(t)?_r(e.refs).value:gr(j(t.value)?e.ref.value:t.value,e)}var nn=(e,t,r,n)=>{const o={};for(const s of e){const i=v(t,s);i&&D(o,s,i._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},je=e=>e instanceof RegExp,Ee=e=>j(e)?e:je(e)?e.source:N(e)?je(e.value)?e.value.source:e.value:e,Ct=e=>({isOnSubmit:!e||e===te.onSubmit,isOnBlur:e===te.onBlur,isOnChange:e===te.onChange,isOnAll:e===te.all,isOnTouch:e===te.onTouched});const Rt="AsyncFunction";var on=e=>!!e&&!!e.validate&&!!(ne(e.validate)&&e.validate.constructor.name===Rt||N(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Rt)),sn=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ut=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const De=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const s=v(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!n)return!0;if(i.ref&&t(i.ref,i.name)&&!n)return!0;if(De(a,t))break}else if(N(a)&&De(a,t))break}}};function jt(e,t,r){const n=v(e,r);if(n||Be(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const s=o.join("."),i=v(t,s),a=v(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(a&&a.type)return{name:s,error:a};if(a&&a.root&&a.root.type)return{name:`${s}.root`,error:a.root};o.pop()}return{name:r}}var un=(e,t,r,n)=>{r(e);const{name:o,...s}=e;return K(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!n||te.all))},cn=(e,t,r)=>!e||!t||e===t||Fe(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),an=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,ln=(e,t)=>!dt(v(e,t)).length&&L(e,t),fn=(e,t,r)=>{const n=Fe(v(e,r));return D(n,"root",t[r]),D(e,r,n),e};function Lt(e,t,r="validate"){if(X(e)||Array.isArray(e)&&e.every(X)||ie(e)&&!e)return{type:r,message:X(e)?e:"",ref:t}}var be=e=>N(e)&&!je(e)?e:{value:e,message:""},Nt=async(e,t,r,n,o,s)=>{const{ref:i,refs:a,required:p,maxLength:_,minLength:y,min:k,max:m,pattern:O,validate:I,name:V,valueAsNumber:q,mount:ce}=e._f,z=v(r,V);if(!ce||t.has(V))return{};const R=a?a[0]:i,Z=A=>{o&&R.reportValidity&&(R.setCustomValidity(ie(A)?"":A||""),R.reportValidity())},$={},le=_t(i),fe=xe(i),Ye=le||fe,ee=(q||pt(i))&&j(i.value)&&j(z)||Ue(i)&&i.value===""||z===""||Array.isArray(z)&&!z.length,pe=Yr.bind(null,V,n,$),oe=(A,F,U,J=ae.maxLength,H=ae.minLength)=>{const se=A?F:U;$[V]={type:A?J:H,message:se,ref:i,...pe(A?J:H,se)}};if(s?!Array.isArray(z)||!z.length:p&&(!Ye&&(ee||G(z))||ie(z)&&!z||fe&&!_r(a).isValid||le&&!mr(a).isValid)){const{value:A,message:F}=X(p)?{value:!!p,message:p}:be(p);if(A&&($[V]={type:ae.required,message:F,ref:R,...pe(ae.required,F)},!n))return Z(F),$}if(!ee&&(!G(k)||!G(m))){let A,F;const U=be(m),J=be(k);if(!G(z)&&!isNaN(z)){const H=i.valueAsNumber||z&&+z;G(U.value)||(A=H>U.value),G(J.value)||(F=H<J.value)}else{const H=i.valueAsDate||new Date(z),se=Se=>new Date(new Date().toDateString()+" "+Se),Ae=i.type=="time",we=i.type=="week";X(U.value)&&z&&(A=Ae?se(z)>se(U.value):we?z>U.value:H>new Date(U.value)),X(J.value)&&z&&(F=Ae?se(z)<se(J.value):we?z<J.value:H<new Date(J.value))}if((A||F)&&(oe(!!A,U.message,J.message,ae.max,ae.min),!n))return Z($[V].message),$}if((_||y)&&!ee&&(X(z)||s&&Array.isArray(z))){const A=be(_),F=be(y),U=!G(A.value)&&z.length>+A.value,J=!G(F.value)&&z.length<+F.value;if((U||J)&&(oe(U,A.message,F.message),!n))return Z($[V].message),$}if(O&&!ee&&X(z)){const{value:A,message:F}=be(O);if(je(A)&&!z.match(A)&&($[V]={type:ae.pattern,message:F,ref:i,...pe(ae.pattern,F)},!n))return Z(F),$}if(I){if(ne(I)){const A=await I(z,r),F=Lt(A,R);if(F&&($[V]={...F,...pe(ae.validate,F.message)},!n))return Z(F.message),$}else if(N(I)){let A={};for(const F in I){if(!K(A)&&!n)break;const U=Lt(await I[F](z,r),R,F);U&&(A={...U,...pe(F,U.message)},Z(U.message),n&&($[V]=A))}if(!K(A)&&($[V]={ref:R,...A},!n))return $}}return Z(!0),$};const dn={mode:te.onSubmit,reValidateMode:te.onChange,shouldFocusError:!0};function hn(e={}){let t={...dn,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:ne(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},o=N(t.defaultValues)||N(t.values)?B(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:B(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},p,_=0;const y={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let k={...y};const m={array:xt(),state:xt()},O=t.criteriaMode===te.all,I=u=>c=>{clearTimeout(_),_=setTimeout(u,c)},V=async u=>{if(!t.disabled&&(y.isValid||k.isValid||u)){const c=t.resolver?K((await fe()).errors):await ee(n,!0);c!==r.isValid&&m.state.next({isValid:c})}},q=(u,c)=>{!t.disabled&&(y.isValidating||y.validatingFields||k.isValidating||k.validatingFields)&&((u||Array.from(a.mount)).forEach(l=>{l&&(c?D(r.validatingFields,l,c):L(r.validatingFields,l))}),m.state.next({validatingFields:r.validatingFields,isValidating:!K(r.validatingFields)}))},ce=(u,c=[],l,g,h=!0,d=!0)=>{if(g&&l&&!t.disabled){if(i.action=!0,d&&Array.isArray(v(n,u))){const w=l(v(n,u),g.argA,g.argB);h&&D(n,u,w)}if(d&&Array.isArray(v(r.errors,u))){const w=l(v(r.errors,u),g.argA,g.argB);h&&D(r.errors,u,w),ln(r.errors,u)}if((y.touchedFields||k.touchedFields)&&d&&Array.isArray(v(r.touchedFields,u))){const w=l(v(r.touchedFields,u),g.argA,g.argB);h&&D(r.touchedFields,u,w)}(y.dirtyFields||k.dirtyFields)&&(r.dirtyFields=ke(o,s)),m.state.next({name:u,isDirty:oe(u,c),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else D(s,u,c)},z=(u,c)=>{D(r.errors,u,c),m.state.next({errors:r.errors})},R=u=>{r.errors=u,m.state.next({errors:r.errors,isValid:!1})},Z=(u,c,l,g)=>{const h=v(n,u);if(h){const d=v(s,u,j(l)?v(o,u):l);j(d)||g&&g.defaultChecked||c?D(s,u,c?d:Tt(h._f)):U(u,d),i.mount&&!i.action&&V()}},$=(u,c,l,g,h)=>{let d=!1,w=!1;const E={name:u};if(!t.disabled){if(!l||g){(y.isDirty||k.isDirty)&&(w=r.isDirty,r.isDirty=E.isDirty=oe(),d=w!==E.isDirty);const x=re(v(o,u),c);w=!!v(r.dirtyFields,u),x?L(r.dirtyFields,u):D(r.dirtyFields,u,!0),E.dirtyFields=r.dirtyFields,d=d||(y.dirtyFields||k.dirtyFields)&&w!==!x}if(l){const x=v(r.touchedFields,u);x||(D(r.touchedFields,u,l),E.touchedFields=r.touchedFields,d=d||(y.touchedFields||k.touchedFields)&&x!==l)}d&&h&&m.state.next(E)}return d?E:{}},le=(u,c,l,g)=>{const h=v(r.errors,u),d=(y.isValid||k.isValid)&&ie(c)&&r.isValid!==c;if(t.delayError&&l?(p=I(()=>z(u,l)),p(t.delayError)):(clearTimeout(_),p=null,l?D(r.errors,u,l):L(r.errors,u)),(l?!re(h,l):h)||!K(g)||d){const w={...g,...d&&ie(c)?{isValid:c}:{},errors:r.errors,name:u};r={...r,...w},m.state.next(w)}},fe=async u=>{q(u,!0);const c=await t.resolver(s,t.context,nn(u||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return q(u),c},Ye=async u=>{const{errors:c}=await fe(u);if(u)for(const l of u){const g=v(c,l);g?D(r.errors,l,g):L(r.errors,l)}else r.errors=c;return c},ee=async(u,c,l={valid:!0})=>{for(const g in u){const h=u[g];if(h){const{_f:d,...w}=h;if(d){const E=a.array.has(d.name),x=h._f&&on(h._f);x&&y.validatingFields&&q([d.name],!0);const Y=await Nt(h,a.disabled,s,O,t.shouldUseNativeValidation&&!c,E);if(x&&y.validatingFields&&q([d.name]),Y[d.name]&&(l.valid=!1,c))break;!c&&(v(Y,d.name)?E?fn(r.errors,Y,d.name):D(r.errors,d.name,Y[d.name]):L(r.errors,d.name))}!K(w)&&await ee(w,c,l)}}return l.valid},pe=()=>{for(const u of a.unMount){const c=v(n,u);c&&(c._f.refs?c._f.refs.every(l=>!ot(l)):!ot(c._f.ref))&&Qe(u)}a.unMount=new Set},oe=(u,c)=>!t.disabled&&(u&&c&&D(s,u,c),!re(Se(),o)),A=(u,c,l)=>st(u,a,{...i.mount?s:j(c)?o:X(u)?{[u]:c}:c},l,c),F=u=>dt(v(i.mount?s:o,u,t.shouldUnregister?v(o,u,[]):[])),U=(u,c,l={})=>{const g=v(n,u);let h=c;if(g){const d=g._f;d&&(!d.disabled&&D(s,u,gr(c,d)),h=Ue(d.ref)&&G(c)?"":c,hr(d.ref)?[...d.ref.options].forEach(w=>w.selected=h.includes(w.value)):d.refs?xe(d.ref)?d.refs.forEach(w=>{(!w.defaultChecked||!w.disabled)&&(Array.isArray(h)?w.checked=!!h.find(E=>E===w.value):w.checked=h===w.value||!!h)}):d.refs.forEach(w=>w.checked=w.value===h):pt(d.ref)?d.ref.value="":(d.ref.value=h,d.ref.type||m.state.next({name:u,values:B(s)})))}(l.shouldDirty||l.shouldTouch)&&$(u,h,l.shouldTouch,l.shouldDirty,!0),l.shouldValidate&&we(u)},J=(u,c,l)=>{for(const g in c){if(!c.hasOwnProperty(g))return;const h=c[g],d=u+"."+g,w=v(n,d);(a.array.has(u)||N(h)||w&&!w._f)&&!_e(h)?J(d,h,l):U(d,h,l)}},H=(u,c,l={})=>{const g=v(n,u),h=a.array.has(u),d=B(c);D(s,u,d),h?(m.array.next({name:u,values:B(s)}),(y.isDirty||y.dirtyFields||k.isDirty||k.dirtyFields)&&l.shouldDirty&&m.state.next({name:u,dirtyFields:ke(o,s),isDirty:oe(u,d)})):g&&!g._f&&!G(d)?J(u,d,l):U(u,d,l),Ut(u,a)&&m.state.next({...r,name:u}),m.state.next({name:i.mount?u:void 0,values:B(s)})},se=async u=>{i.mount=!0;const c=u.target;let l=c.name,g=!0;const h=v(n,l),d=x=>{g=Number.isNaN(x)||_e(x)&&isNaN(x.getTime())||re(x,v(s,l,x))},w=Ct(t.mode),E=Ct(t.reValidateMode);if(h){let x,Y;const Ie=c.type?Tt(h._f):qr(u),de=u.type===Vt.BLUR||u.type===Vt.FOCUS_OUT,Mr=!sn(h._f)&&!t.resolver&&!v(r.errors,l)&&!h._f.deps||an(de,v(r.touchedFields,l),r.isSubmitted,E,w),rt=Ut(l,a,de);D(s,l,Ie),de?(!c||!c.readOnly)&&(h._f.onBlur&&h._f.onBlur(u),p&&p(0)):h._f.onChange&&h._f.onChange(u);const nt=$(l,Ie,de),Br=!K(nt)||rt;if(!de&&m.state.next({name:l,type:u.type,values:B(s)}),Mr)return(y.isValid||k.isValid)&&(t.mode==="onBlur"?de&&V():de||V()),Br&&m.state.next({name:l,...rt?{}:nt});if(!de&&rt&&m.state.next({...r}),t.resolver){const{errors:Dt}=await fe([l]);if(d(Ie),g){const Wr=jt(r.errors,n,l),Ot=jt(Dt,n,Wr.name||l);x=Ot.error,l=Ot.name,Y=K(Dt)}}else q([l],!0),x=(await Nt(h,a.disabled,s,O,t.shouldUseNativeValidation))[l],q([l]),d(Ie),g&&(x?Y=!1:(y.isValid||k.isValid)&&(Y=await ee(n,!0)));g&&(h._f.deps&&(!Array.isArray(h._f.deps)||h._f.deps.length>0)&&we(h._f.deps),le(l,Y,x,nt))}},Ae=(u,c)=>{if(v(r.errors,c)&&u.focus)return u.focus(),1},we=async(u,c={})=>{let l,g;const h=Fe(u);if(t.resolver){const d=await Ye(j(u)?u:h);l=K(d),g=u?!h.some(w=>v(d,w)):l}else u?(g=(await Promise.all(h.map(async d=>{const w=v(n,d);return await ee(w&&w._f?{[d]:w}:w)}))).every(Boolean),!(!g&&!r.isValid)&&V()):g=l=await ee(n);return m.state.next({...!X(u)||(y.isValid||k.isValid)&&l!==r.isValid?{}:{name:u},...t.resolver||!u?{isValid:l}:{},errors:r.errors}),c.shouldFocus&&!g&&De(n,Ae,u?h:a.mount),g},Se=(u,c)=>{let l={...i.mount?s:o};return c&&(l=dr(c.dirtyFields?r.dirtyFields:r.touchedFields,l)),j(u)?l:X(u)?v(l,u):u.map(g=>v(l,g))},bt=(u,c)=>({invalid:!!v((c||r).errors,u),isDirty:!!v((c||r).dirtyFields,u),error:v((c||r).errors,u),isValidating:!!v(r.validatingFields,u),isTouched:!!v((c||r).touchedFields,u)}),Tr=u=>{u&&Fe(u).forEach(c=>L(r.errors,c)),m.state.next({errors:u?r.errors:{}})},kt=(u,c,l)=>{const g=(v(n,u,{_f:{}})._f||{}).ref,h=v(r.errors,u)||{},{ref:d,message:w,type:E,...x}=h;D(r.errors,u,{...x,...c,ref:g}),m.state.next({name:u,errors:r.errors,isValid:!1}),l&&l.shouldFocus&&g&&g.focus&&g.focus()},Cr=(u,c)=>ne(u)?m.state.subscribe({next:l=>"values"in l&&u(A(void 0,c),l)}):A(u,c,!0),zt=u=>m.state.subscribe({next:c=>{cn(u.name,c.name,u.exact)&&un(c,u.formState||y,Nr,u.reRenderRoot)&&u.callback({values:{...s},...r,...c,defaultValues:o})}}).unsubscribe,Rr=u=>(i.mount=!0,k={...k,...u.formState},zt({...u,formState:k})),Qe=(u,c={})=>{for(const l of u?Fe(u):a.mount)a.mount.delete(l),a.array.delete(l),c.keepValue||(L(n,l),L(s,l)),!c.keepError&&L(r.errors,l),!c.keepDirty&&L(r.dirtyFields,l),!c.keepTouched&&L(r.touchedFields,l),!c.keepIsValidating&&L(r.validatingFields,l),!t.shouldUnregister&&!c.keepDefaultValue&&L(o,l);m.state.next({values:B(s)}),m.state.next({...r,...c.keepDirty?{isDirty:oe()}:{}}),!c.keepIsValid&&V()},Zt=({disabled:u,name:c})=>{(ie(u)&&i.mount||u||a.disabled.has(c))&&(u?a.disabled.add(c):a.disabled.delete(c))},et=(u,c={})=>{let l=v(n,u);const g=ie(c.disabled)||ie(t.disabled);return D(n,u,{...l||{},_f:{...l&&l._f?l._f:{ref:{name:u}},name:u,mount:!0,...c}}),a.mount.add(u),l?Zt({disabled:ie(c.disabled)?c.disabled:t.disabled,name:u}):Z(u,!0,c.value),{...g?{disabled:c.disabled||t.disabled}:{},...t.progressive?{required:!!c.required,min:Ee(c.min),max:Ee(c.max),minLength:Ee(c.minLength),maxLength:Ee(c.maxLength),pattern:Ee(c.pattern)}:{},name:u,onChange:se,onBlur:se,ref:h=>{if(h){et(u,c),l=v(n,u);const d=j(h.value)&&h.querySelectorAll&&h.querySelectorAll("input,select,textarea")[0]||h,w=Qr(d),E=l._f.refs||[];if(w?E.find(x=>x===d):d===l._f.ref)return;D(n,u,{_f:{...l._f,...w?{refs:[...E.filter(ot),d,...Array.isArray(v(o,u))?[{}]:[]],ref:{type:d.type,name:u}}:{ref:d}}}),Z(u,!1,void 0,d)}else l=v(n,u,{}),l._f&&(l._f.mount=!1),(t.shouldUnregister||c.shouldUnregister)&&!(Kr(a.array,u)&&i.action)&&a.unMount.add(u)}}},tt=()=>t.shouldFocusError&&De(n,Ae,a.mount),Ur=u=>{ie(u)&&(m.state.next({disabled:u}),De(n,(c,l)=>{const g=v(n,l);g&&(c.disabled=g._f.disabled||u,Array.isArray(g._f.refs)&&g._f.refs.forEach(h=>{h.disabled=g._f.disabled||u}))},0,!1))},$t=(u,c)=>async l=>{let g;l&&(l.preventDefault&&l.preventDefault(),l.persist&&l.persist());let h=B(s);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:d,values:w}=await fe();r.errors=d,h=B(w)}else await ee(n);if(a.disabled.size)for(const d of a.disabled)L(h,d);if(L(r.errors,"root"),K(r.errors)){m.state.next({errors:{}});try{await u(h,l)}catch(d){g=d}}else c&&await c({...r.errors},l),tt(),setTimeout(tt);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:K(r.errors)&&!g,submitCount:r.submitCount+1,errors:r.errors}),g)throw g},jr=(u,c={})=>{v(n,u)&&(j(c.defaultValue)?H(u,B(v(o,u))):(H(u,c.defaultValue),D(o,u,B(c.defaultValue))),c.keepTouched||L(r.touchedFields,u),c.keepDirty||(L(r.dirtyFields,u),r.isDirty=c.defaultValue?oe(u,B(v(o,u))):oe()),c.keepError||(L(r.errors,u),y.isValid&&V()),m.state.next({...r}))},At=(u,c={})=>{const l=u?B(u):o,g=B(l),h=K(u),d=h?o:g;if(c.keepDefaultValues||(o=l),!c.keepValues){if(c.keepDirtyValues){const w=new Set([...a.mount,...Object.keys(ke(o,s))]);for(const E of Array.from(w))v(r.dirtyFields,E)?D(d,E,v(s,E)):H(E,v(d,E))}else{if(ft&&j(u))for(const w of a.mount){const E=v(n,w);if(E&&E._f){const x=Array.isArray(E._f.refs)?E._f.refs[0]:E._f.ref;if(Ue(x)){const Y=x.closest("form");if(Y){Y.reset();break}}}}if(c.keepFieldsRef)for(const w of a.mount)H(w,v(d,w));else n={}}s=t.shouldUnregister?c.keepDefaultValues?B(o):{}:B(d),m.array.next({values:{...d}}),m.state.next({values:{...d}})}a={mount:c.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!y.isValid||!!c.keepIsValid||!!c.keepDirtyValues||!t.shouldUnregister&&!K(d),i.watch=!!t.shouldUnregister,i.action=!1,c.keepErrors||(r.errors={}),m.state.next({submitCount:c.keepSubmitCount?r.submitCount:0,isDirty:h?!1:c.keepDirty?r.isDirty:!!(c.keepDefaultValues&&!re(u,o)),isSubmitted:c.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:h?{}:c.keepDirtyValues?c.keepDefaultValues&&s?ke(o,s):r.dirtyFields:c.keepDefaultValues&&u?ke(o,u):c.keepDirty?r.dirtyFields:{},touchedFields:c.keepTouched?r.touchedFields:{},errors:c.keepErrors?r.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Et=(u,c)=>At(ne(u)?u(s):u,c),Lr=(u,c={})=>{const l=v(n,u),g=l&&l._f;if(g){const h=g.refs?g.refs[0]:g.ref;h.focus&&(h.focus(),c.shouldSelect&&ne(h.select)&&h.select())}},Nr=u=>{r={...r,...u}},Ft={control:{register:et,unregister:Qe,getFieldState:bt,handleSubmit:$t,setError:kt,_subscribe:zt,_runSchema:fe,_focusError:tt,_getWatch:A,_getDirty:oe,_setValid:V,_setFieldArray:ce,_setDisabledField:Zt,_setErrors:R,_getFieldArray:F,_reset:At,_resetDefaultValues:()=>ne(t.defaultValues)&&t.defaultValues().then(u=>{Et(u,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:pe,_disableForm:Ur,_subjects:m,_proxyFormState:y,get _fields(){return n},get _formValues(){return s},get _state(){return i},set _state(u){i=u},get _defaultValues(){return o},get _names(){return a},set _names(u){a=u},get _formState(){return r},get _options(){return t},set _options(u){t={...t,...u}}},subscribe:Rr,trigger:we,register:et,handleSubmit:$t,watch:Cr,setValue:H,getValues:Se,reset:Et,resetField:jr,clearErrors:Tr,unregister:Qe,setError:kt,setFocus:Lr,getFieldState:bt};return{...Ft,formControl:Ft}}function mu(e={}){const t=P.useRef(void 0),r=P.useRef(void 0),[n,o]=P.useState({isDirty:!1,isValidating:!1,isLoading:ne(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:ne(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!ne(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...a}=hn(e);t.current={...a,formState:n}}const s=t.current.control;return s._options=e,fr(()=>{const i=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),s._formState.isReady=!0,i},[s]),P.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),P.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),P.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),P.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),P.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==n.isDirty&&s._subjects.state.next({isDirty:i})}},[s,n.isDirty]),P.useEffect(()=>{var i;e.values&&!re(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),!((i=s._options.resetOptions)===null||i===void 0)&&i.keepIsValid||s._setValid(),r.current=e.values,o(a=>({...a}))):s._resetDefaultValues()},[s,e.values]),P.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=Xr(n,s),t.current}const Mt=(e,t,r)=>{if(e&&"reportValidity"in e){const n=v(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},pn=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?Mt(n.ref,r,e):n&&n.refs&&n.refs.forEach(o=>Mt(o,r,e))}},vu=(e,t)=>{t.shouldUseNativeValidation&&pn(e,t);const r={};for(const n in e){const o=v(t.fields,n),s=Object.assign(e[n]||{},{ref:o&&o.ref});if(_n(t.names||Object.keys(e),n)){const i=Object.assign({},v(r,n));D(i,"root",s),D(r,n,i)}else D(r,n,s)}return r},_n=(e,t)=>{const r=Bt(t);return e.some(n=>Bt(n).match(`^${r}\\.\\d+`))};function Bt(e){return e.replace(/\]|\[/g,"")}function f(e,t,r){function n(a,p){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:p,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,p);const _=i.prototype,y=Object.keys(_);for(let k=0;k<y.length;k++){const m=y[k];m in a||(a[m]=_[m].bind(a))}}const o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var p;const _=r?.Parent?new s:this;n(_,a),(p=_._zod).deferred??(p.deferred=[]);for(const y of _._zod.deferred)y();return _}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Ze extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class vr extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const yr={};function ge(e){return yr}function gn(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function ct(e,t){return typeof t=="bigint"?t.toString():t}function gt(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function mt(e){return e==null}function vt(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const Wt=Symbol("evaluating");function S(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Wt)return n===void 0&&(n=Wt,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function ve(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ye(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function qt(e){return JSON.stringify(e)}function mn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const wr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Le(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const vn=gt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Oe(e){if(Le(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Le(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function br(e){return Oe(e)?{...e}:Array.isArray(e)?[...e]:e}const yn=new Set(["string","number","symbol"]);function We(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function he(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function b(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function wn(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function bn(e,t){const r=e._zod.def,n=ye(e._zod.def,{get shape(){const o={};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(o[s]=r.shape[s])}return ve(this,"shape",o),o},checks:[]});return he(e,n)}function kn(e,t){const r=e._zod.def,n=ye(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete o[s]}return ve(this,"shape",o),o},checks:[]});return he(e,n)}function zn(e,t){if(!Oe(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const o=ye(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return ve(this,"shape",s),s},checks:[]});return he(e,o)}function Zn(e,t){if(!Oe(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return ve(this,"shape",n),n},checks:e._zod.def.checks};return he(e,r)}function $n(e,t){const r=ye(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return ve(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return he(e,r)}function An(e,t,r){const n=ye(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=e?new e({type:"optional",innerType:o[i]}):o[i])}else for(const i in o)s[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return ve(this,"shape",s),s},checks:[]});return he(t,n)}function En(e,t,r){const n=ye(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(r)for(const i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return ve(this,"shape",s),s},checks:[]});return he(t,n)}function ze(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function kr(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Pe(e){return typeof e=="string"?e:e?.message}function me(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Pe(e.inst?._zod.def?.error?.(e))??Pe(t?.error?.(e))??Pe(r.customError?.(e))??Pe(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function yt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ve(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const zr=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ct,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Zr=f("$ZodError",zr),qe=f("$ZodError",zr,{Parent:Error});function Fn(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Dn(e,t=r=>r.message){const r={_errors:[]},n=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>n({issues:i}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)r._errors.push(t(s));else{let i=r,a=0;for(;a<s.path.length;){const p=s.path[a];a===s.path.length-1?(i[p]=i[p]||{_errors:[]},i[p]._errors.push(t(s))):i[p]=i[p]||{_errors:[]},i=i[p],a++}}};return n(e),r}const Je=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Ze;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(p=>me(p,s,ge())));throw wr(a,o?.callee),a}return i.value},yu=Je(qe),Ke=e=>async(t,r,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(p=>me(p,s,ge())));throw wr(a,o?.callee),a}return i.value},wu=Ke(qe),He=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ze;return s.issues.length?{success:!1,error:new(e??Zr)(s.issues.map(i=>me(i,o,ge())))}:{success:!0,data:s.value}},On=He(qe),Ge=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>me(i,o,ge())))}:{success:!0,data:s.value}},Vn=Ge(qe),xn=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Je(e)(t,r,o)},Sn=e=>(t,r,n)=>Je(e)(t,r,n),In=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ke(e)(t,r,o)},Pn=e=>async(t,r,n)=>Ke(e)(t,r,n),Tn=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return He(e)(t,r,o)},Cn=e=>(t,r,n)=>He(e)(t,r,n),Rn=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ge(e)(t,r,o)},Un=e=>async(t,r,n)=>Ge(e)(t,r,n),jn=/^[cC][^\s-]{8,}$/,Ln=/^[0-9a-z]+$/,Nn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Mn=/^[0-9a-vA-V]{20}$/,Bn=/^[A-Za-z0-9]{27}$/,Wn=/^[a-zA-Z0-9_-]{21}$/,qn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Jn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Jt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Kn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Hn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Gn(){return new RegExp(Hn,"u")}const Xn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Yn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Qn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,eo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,to=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$r=/^[A-Za-z0-9_-]*$/,ro=/^\+(?:[0-9]){6,14}[0-9]$/,Ar="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",no=new RegExp(`^${Ar}$`);function Er(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function oo(e){return new RegExp(`^${Er(e)}$`)}function so(e){const t=Er({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Ar}T(?:${n})$`)}const io=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},uo=/^[^A-Z]*$/,co=/^[^a-z]*$/,ue=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ao=f("$ZodCheckMaxLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!mt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const i=yt(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),lo=f("$ZodCheckMinLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!mt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const i=yt(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fo=f("$ZodCheckLengthEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!mt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,s=o.length;if(s===t.length)return;const i=yt(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Xe=f("$ZodCheckStringFormat",(e,t)=>{var r,n;ue.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ho=f("$ZodCheckRegex",(e,t)=>{Xe.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),po=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=uo),Xe.init(e,t)}),_o=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=co),Xe.init(e,t)}),go=f("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);const r=We(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),mo=f("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);const r=new RegExp(`^${We(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),vo=f("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);const r=new RegExp(`.*${We(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),yo=f("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class wo{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
2
|
+
`).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,o.join(`
|
|
3
|
+
`))}}const bo={major:4,minor:1,patch:13},M=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=bo;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,a,p)=>{let _=ze(i),y;for(const k of a){if(k._zod.def.when){if(!k._zod.def.when(i))continue}else if(_)continue;const m=i.issues.length,O=k._zod.check(i);if(O instanceof Promise&&p?.async===!1)throw new Ze;if(y||O instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await O,i.issues.length!==m&&(_||(_=ze(i,m)))});else{if(i.issues.length===m)continue;_||(_=ze(i,m))}}return y?y.then(()=>i):i},s=(i,a,p)=>{if(ze(i))return i.aborted=!0,i;const _=o(a,n,p);if(_ instanceof Promise){if(p.async===!1)throw new Ze;return _.then(y=>e._zod.parse(y,p))}return e._zod.parse(_,p)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const _=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return _ instanceof Promise?_.then(y=>s(y,i,a)):s(_,i,a)}const p=e._zod.parse(i,a);if(p instanceof Promise){if(a.async===!1)throw new Ze;return p.then(_=>o(_,n,a))}return o(p,n,a)}}e["~standard"]={validate:o=>{try{const s=On(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Vn(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),wt=f("$ZodString",(e,t)=>{M.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??io(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),T=f("$ZodStringFormat",(e,t)=>{Xe.init(e,t),wt.init(e,t)}),ko=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Jn),T.init(e,t)}),zo=f("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Jt(n))}else t.pattern??(t.pattern=Jt());T.init(e,t)}),Zo=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Kn),T.init(e,t)}),$o=f("$ZodURL",(e,t)=>{T.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ao=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Gn()),T.init(e,t)}),Eo=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Wn),T.init(e,t)}),Fo=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=jn),T.init(e,t)}),Do=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ln),T.init(e,t)}),Oo=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Nn),T.init(e,t)}),Vo=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Mn),T.init(e,t)}),xo=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Bn),T.init(e,t)}),So=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=so(t)),T.init(e,t)}),Io=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=no),T.init(e,t)}),Po=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=oo(t)),T.init(e,t)}),To=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=qn),T.init(e,t)}),Co=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Xn),T.init(e,t),e._zod.bag.format="ipv4"}),Ro=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Yn),T.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Uo=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Qn),T.init(e,t)}),jo=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=eo),T.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[o,s]=n;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Fr(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Lo=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=to),T.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Fr(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function No(e){if(!$r.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Fr(r)}const Mo=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=$r),T.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{No(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Bo=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ro),T.init(e,t)});function Wo(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const qo=f("$ZodJWT",(e,t)=>{T.init(e,t),e._zod.check=r=>{Wo(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Jo=f("$ZodUnknown",(e,t)=>{M.init(e,t),e._zod.parse=r=>r}),Ko=f("$ZodNever",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Kt(e,t,r){e.issues.length&&t.issues.push(...kr(r,e.issues)),t.value[r]=e.value}const Ho=f("$ZodArray",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],p=t.element._zod.run({value:a,issues:[]},n);p instanceof Promise?s.push(p.then(_=>Kt(_,r,i))):Kt(p,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Ne(e,t,r,n){e.issues.length&&t.issues.push(...kr(r,e.issues)),e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Dr(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=wn(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Or(e,t,r,n,o,s){const i=[],a=o.keySet,p=o.catchall._zod,_=p.def.type;for(const y in t){if(a.has(y))continue;if(_==="never"){i.push(y);continue}const k=p.run({value:t[y],issues:[]},n);k instanceof Promise?e.push(k.then(m=>Ne(m,r,y,t))):Ne(k,r,y,t)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const Go=f("$ZodObject",(e,t)=>{if(M.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const p={...a};return Object.defineProperty(t,"shape",{value:p}),p}})}const n=gt(()=>Dr(t));S(e._zod,"propValues",()=>{const a=t.shape,p={};for(const _ in a){const y=a[_]._zod;if(y.values){p[_]??(p[_]=new Set);for(const k of y.values)p[_].add(k)}}return p});const o=Le,s=t.catchall;let i;e._zod.parse=(a,p)=>{i??(i=n.value);const _=a.value;if(!o(_))return a.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),a;a.value={};const y=[],k=i.shape;for(const m of i.keys){const I=k[m]._zod.run({value:_[m],issues:[]},p);I instanceof Promise?y.push(I.then(V=>Ne(V,a,m,_))):Ne(I,a,m,_)}return s?Or(y,_,a,p,n.value,e):y.length?Promise.all(y).then(()=>a):a}}),Xo=f("$ZodObjectJIT",(e,t)=>{Go.init(e,t);const r=e._zod.parse,n=gt(()=>Dr(t)),o=m=>{const O=new wo(["shape","payload","ctx"]),I=n.value,V=R=>{const Z=qt(R);return`shape[${Z}]._zod.run({ value: input[${Z}], issues: [] }, ctx)`};O.write("const input = payload.value;");const q=Object.create(null);let ce=0;for(const R of I.keys)q[R]=`key_${ce++}`;O.write("const newResult = {};");for(const R of I.keys){const Z=q[R],$=qt(R);O.write(`const ${Z} = ${V(R)};`),O.write(`
|
|
4
|
+
if (${Z}.issues.length) {
|
|
5
|
+
payload.issues = payload.issues.concat(${Z}.issues.map(iss => ({
|
|
6
|
+
...iss,
|
|
7
|
+
path: iss.path ? [${$}, ...iss.path] : [${$}]
|
|
8
|
+
})));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
if (${Z}.value === undefined) {
|
|
13
|
+
if (${$} in input) {
|
|
14
|
+
newResult[${$}] = undefined;
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
newResult[${$}] = ${Z}.value;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
`)}O.write("payload.value = newResult;"),O.write("return payload;");const z=O.compile();return(R,Z)=>z(m,R,Z)};let s;const i=Le,a=!yr.jitless,_=a&&vn.value,y=t.catchall;let k;e._zod.parse=(m,O)=>{k??(k=n.value);const I=m.value;return i(I)?a&&_&&O?.async===!1&&O.jitless!==!0?(s||(s=o(t.shape)),m=s(m,O),y?Or([],I,m,O,k,e):m):r(m,O):(m.issues.push({expected:"object",code:"invalid_type",input:I,inst:e}),m)}});function Ht(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!ze(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>me(i,n,ge())))}),t)}const Yo=f("$ZodUnion",(e,t)=>{M.init(e,t),S(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),S(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),S(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),S(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>vt(s.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let i=!1;const a=[];for(const p of t.options){const _=p._zod.run({value:o.value,issues:[]},s);if(_ instanceof Promise)a.push(_),i=!0;else{if(_.issues.length===0)return _;a.push(_)}}return i?Promise.all(a).then(p=>Ht(p,o,e,s)):Ht(a,o,e,s)}}),Qo=f("$ZodIntersection",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([p,_])=>Gt(r,p,_)):Gt(r,s,i)}});function at(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Oe(e)&&Oe(t)){const r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(const s of n){const i=at(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],s=t[n],i=at(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Gt(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),ze(e))return e;const n=at(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const es=f("$ZodEnum",(e,t)=>{M.init(e,t);const r=gn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>yn.has(typeof o)).map(o=>typeof o=="string"?We(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),ts=f("$ZodTransform",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new vr(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Ze;return r.value=o,r}});function Xt(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const rs=f("$ZodOptional",(e,t)=>{M.init(e,t),e._zod.optin="optional",e._zod.optout="optional",S(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),S(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${vt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Xt(s,r.value)):Xt(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),ns=f("$ZodNullable",(e,t)=>{M.init(e,t),S(e._zod,"optin",()=>t.innerType._zod.optin),S(e._zod,"optout",()=>t.innerType._zod.optout),S(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${vt(r.source)}|null)$`):void 0}),S(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),os=f("$ZodDefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",S(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Yt(s,t)):Yt(o,t)}});function Yt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ss=f("$ZodPrefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",S(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),is=f("$ZodNonOptional",(e,t)=>{M.init(e,t),S(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Qt(s,e)):Qt(o,e)}});function Qt(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const us=f("$ZodCatch",(e,t)=>{M.init(e,t),S(e._zod,"optin",()=>t.innerType._zod.optin),S(e._zod,"optout",()=>t.innerType._zod.optout),S(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>me(i,n,ge()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>me(s,n,ge()))},input:r.value}),r.issues=[]),r)}}),cs=f("$ZodPipe",(e,t)=>{M.init(e,t),S(e._zod,"values",()=>t.in._zod.values),S(e._zod,"optin",()=>t.in._zod.optin),S(e._zod,"optout",()=>t.out._zod.optout),S(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>Te(i,t.in,n)):Te(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Te(s,t.out,n)):Te(o,t.out,n)}});function Te(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const as=f("$ZodReadonly",(e,t)=>{M.init(e,t),S(e._zod,"propValues",()=>t.innerType._zod.propValues),S(e._zod,"values",()=>t.innerType._zod.values),S(e._zod,"optin",()=>t.innerType?._zod?.optin),S(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(er):er(o)}});function er(e){return e.value=Object.freeze(e.value),e}const ls=f("$ZodCustom",(e,t)=>{ue.init(e,t),M.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>tr(s,r,n,e));tr(o,r,n,e)}});function tr(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Ve(o))}}var rr;class fs{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function ds(){return new fs}(rr=globalThis).__zod_globalRegistry??(rr.__zod_globalRegistry=ds());const Ce=globalThis.__zod_globalRegistry;function hs(e,t){return new e({type:"string",...b(t)})}function ps(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...b(t)})}function nr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...b(t)})}function _s(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...b(t)})}function gs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(t)})}function ms(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(t)})}function vs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(t)})}function ys(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...b(t)})}function ws(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...b(t)})}function bs(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(t)})}function ks(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...b(t)})}function zs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(t)})}function Zs(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...b(t)})}function $s(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...b(t)})}function As(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(t)})}function Es(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(t)})}function Fs(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(t)})}function Ds(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(t)})}function Os(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(t)})}function Vs(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...b(t)})}function xs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...b(t)})}function Ss(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...b(t)})}function Is(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...b(t)})}function Ps(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(t)})}function Ts(e,t){return new e({type:"string",format:"date",check:"string_format",...b(t)})}function Cs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...b(t)})}function Rs(e,t){return new e({type:"string",format:"duration",check:"string_format",...b(t)})}function Us(e){return new e({type:"unknown"})}function js(e,t){return new e({type:"never",...b(t)})}function Vr(e,t){return new ao({check:"max_length",...b(t),maximum:e})}function Me(e,t){return new lo({check:"min_length",...b(t),minimum:e})}function xr(e,t){return new fo({check:"length_equals",...b(t),length:e})}function Ls(e,t){return new ho({check:"string_format",format:"regex",...b(t),pattern:e})}function Ns(e){return new po({check:"string_format",format:"lowercase",...b(e)})}function Ms(e){return new _o({check:"string_format",format:"uppercase",...b(e)})}function Bs(e,t){return new go({check:"string_format",format:"includes",...b(t),includes:e})}function Ws(e,t){return new mo({check:"string_format",format:"starts_with",...b(t),prefix:e})}function qs(e,t){return new vo({check:"string_format",format:"ends_with",...b(t),suffix:e})}function $e(e){return new yo({check:"overwrite",tx:e})}function Js(e){return $e(t=>t.normalize(e))}function Ks(){return $e(e=>e.trim())}function Hs(){return $e(e=>e.toLowerCase())}function Gs(){return $e(e=>e.toUpperCase())}function Xs(){return $e(e=>mn(e))}function Ys(e,t,r){return new e({type:"array",element:t,...b(r)})}function Qs(e,t,r){return new e({type:"custom",check:"custom",fn:t,...b(r)})}function ei(e){const t=ti(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ve(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Ve(o))}},e(r.value,r)));return t}function ti(e,t){const r=new ue({check:"custom",...b(t)});return r._zod.check=e,r}const ri=f("ZodISODateTime",(e,t)=>{So.init(e,t),C.init(e,t)});function ni(e){return Ps(ri,e)}const oi=f("ZodISODate",(e,t)=>{Io.init(e,t),C.init(e,t)});function si(e){return Ts(oi,e)}const ii=f("ZodISOTime",(e,t)=>{Po.init(e,t),C.init(e,t)});function ui(e){return Cs(ii,e)}const ci=f("ZodISODuration",(e,t)=>{To.init(e,t),C.init(e,t)});function ai(e){return Rs(ci,e)}const li=(e,t)=>{Zr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Dn(e,r)},flatten:{value:r=>Fn(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,ct,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,ct,2)}},isEmpty:{get(){return e.issues.length===0}}})},Q=f("ZodError",li,{Parent:Error}),fi=Je(Q),di=Ke(Q),hi=He(Q),pi=Ge(Q),_i=xn(Q),gi=Sn(Q),mi=In(Q),vi=Pn(Q),yi=Tn(Q),wi=Cn(Q),bi=Rn(Q),ki=Un(Q),W=f("ZodType",(e,t)=>(M.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(ye(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>he(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>fi(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>hi(e,r,n),e.parseAsync=async(r,n)=>di(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>pi(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>_i(e,r,n),e.decode=(r,n)=>gi(e,r,n),e.encodeAsync=async(r,n)=>mi(e,r,n),e.decodeAsync=async(r,n)=>vi(e,r,n),e.safeEncode=(r,n)=>yi(e,r,n),e.safeDecode=(r,n)=>wi(e,r,n),e.safeEncodeAsync=async(r,n)=>bi(e,r,n),e.safeDecodeAsync=async(r,n)=>ki(e,r,n),e.refine=(r,n)=>e.check(du(r,n)),e.superRefine=r=>e.check(hu(r)),e.overwrite=r=>e.check($e(r)),e.optional=()=>ir(e),e.nullable=()=>ur(e),e.nullish=()=>ir(ur(e)),e.nonoptional=r=>su(e,r),e.array=()=>Wi(e),e.or=r=>Ki([e,r]),e.and=r=>Gi(e,r),e.transform=r=>cr(e,Qi(r)),e.default=r=>ru(e,r),e.prefault=r=>ou(e,r),e.catch=r=>uu(e,r),e.pipe=r=>cr(e,r),e.readonly=()=>lu(e),e.describe=r=>{const n=e.clone();return Ce.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ce.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ce.get(e);const n=e.clone();return Ce.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Sr=f("_ZodString",(e,t)=>{wt.init(e,t),W.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Ls(...n)),e.includes=(...n)=>e.check(Bs(...n)),e.startsWith=(...n)=>e.check(Ws(...n)),e.endsWith=(...n)=>e.check(qs(...n)),e.min=(...n)=>e.check(Me(...n)),e.max=(...n)=>e.check(Vr(...n)),e.length=(...n)=>e.check(xr(...n)),e.nonempty=(...n)=>e.check(Me(1,...n)),e.lowercase=n=>e.check(Ns(n)),e.uppercase=n=>e.check(Ms(n)),e.trim=()=>e.check(Ks()),e.normalize=(...n)=>e.check(Js(...n)),e.toLowerCase=()=>e.check(Hs()),e.toUpperCase=()=>e.check(Gs()),e.slugify=()=>e.check(Xs())}),zi=f("ZodString",(e,t)=>{wt.init(e,t),Sr.init(e,t),e.email=r=>e.check(ps(Zi,r)),e.url=r=>e.check(ys($i,r)),e.jwt=r=>e.check(Is(ji,r)),e.emoji=r=>e.check(ws(Ai,r)),e.guid=r=>e.check(nr(or,r)),e.uuid=r=>e.check(_s(Re,r)),e.uuidv4=r=>e.check(gs(Re,r)),e.uuidv6=r=>e.check(ms(Re,r)),e.uuidv7=r=>e.check(vs(Re,r)),e.nanoid=r=>e.check(bs(Ei,r)),e.guid=r=>e.check(nr(or,r)),e.cuid=r=>e.check(ks(Fi,r)),e.cuid2=r=>e.check(zs(Di,r)),e.ulid=r=>e.check(Zs(Oi,r)),e.base64=r=>e.check(Vs(Ci,r)),e.base64url=r=>e.check(xs(Ri,r)),e.xid=r=>e.check($s(Vi,r)),e.ksuid=r=>e.check(As(xi,r)),e.ipv4=r=>e.check(Es(Si,r)),e.ipv6=r=>e.check(Fs(Ii,r)),e.cidrv4=r=>e.check(Ds(Pi,r)),e.cidrv6=r=>e.check(Os(Ti,r)),e.e164=r=>e.check(Ss(Ui,r)),e.datetime=r=>e.check(ni(r)),e.date=r=>e.check(si(r)),e.time=r=>e.check(ui(r)),e.duration=r=>e.check(ai(r))});function bu(e){return hs(zi,e)}const C=f("ZodStringFormat",(e,t)=>{T.init(e,t),Sr.init(e,t)}),Zi=f("ZodEmail",(e,t)=>{Zo.init(e,t),C.init(e,t)}),or=f("ZodGUID",(e,t)=>{ko.init(e,t),C.init(e,t)}),Re=f("ZodUUID",(e,t)=>{zo.init(e,t),C.init(e,t)}),$i=f("ZodURL",(e,t)=>{$o.init(e,t),C.init(e,t)}),Ai=f("ZodEmoji",(e,t)=>{Ao.init(e,t),C.init(e,t)}),Ei=f("ZodNanoID",(e,t)=>{Eo.init(e,t),C.init(e,t)}),Fi=f("ZodCUID",(e,t)=>{Fo.init(e,t),C.init(e,t)}),Di=f("ZodCUID2",(e,t)=>{Do.init(e,t),C.init(e,t)}),Oi=f("ZodULID",(e,t)=>{Oo.init(e,t),C.init(e,t)}),Vi=f("ZodXID",(e,t)=>{Vo.init(e,t),C.init(e,t)}),xi=f("ZodKSUID",(e,t)=>{xo.init(e,t),C.init(e,t)}),Si=f("ZodIPv4",(e,t)=>{Co.init(e,t),C.init(e,t)}),Ii=f("ZodIPv6",(e,t)=>{Ro.init(e,t),C.init(e,t)}),Pi=f("ZodCIDRv4",(e,t)=>{Uo.init(e,t),C.init(e,t)}),Ti=f("ZodCIDRv6",(e,t)=>{jo.init(e,t),C.init(e,t)}),Ci=f("ZodBase64",(e,t)=>{Lo.init(e,t),C.init(e,t)}),Ri=f("ZodBase64URL",(e,t)=>{Mo.init(e,t),C.init(e,t)}),Ui=f("ZodE164",(e,t)=>{Bo.init(e,t),C.init(e,t)}),ji=f("ZodJWT",(e,t)=>{qo.init(e,t),C.init(e,t)}),Li=f("ZodUnknown",(e,t)=>{Jo.init(e,t),W.init(e,t)});function sr(){return Us(Li)}const Ni=f("ZodNever",(e,t)=>{Ko.init(e,t),W.init(e,t)});function Mi(e){return js(Ni,e)}const Bi=f("ZodArray",(e,t)=>{Ho.init(e,t),W.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Me(r,n)),e.nonempty=r=>e.check(Me(1,r)),e.max=(r,n)=>e.check(Vr(r,n)),e.length=(r,n)=>e.check(xr(r,n)),e.unwrap=()=>e.element});function Wi(e,t){return Ys(Bi,e,t)}const qi=f("ZodObject",(e,t)=>{Xo.init(e,t),W.init(e,t),S(e,"shape",()=>t.shape),e.keyof=()=>Xi(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:sr()}),e.loose=()=>e.clone({...e._zod.def,catchall:sr()}),e.strict=()=>e.clone({...e._zod.def,catchall:Mi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>zn(e,r),e.safeExtend=r=>Zn(e,r),e.merge=r=>$n(e,r),e.pick=r=>bn(e,r),e.omit=r=>kn(e,r),e.partial=(...r)=>An(Ir,e,r[0]),e.required=(...r)=>En(Pr,e,r[0])});function ku(e,t){const r={type:"object",shape:e??{},...b(t)};return new qi(r)}const Ji=f("ZodUnion",(e,t)=>{Yo.init(e,t),W.init(e,t),e.options=t.options});function Ki(e,t){return new Ji({type:"union",options:e,...b(t)})}const Hi=f("ZodIntersection",(e,t)=>{Qo.init(e,t),W.init(e,t)});function Gi(e,t){return new Hi({type:"intersection",left:e,right:t})}const lt=f("ZodEnum",(e,t)=>{es.init(e,t),W.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new lt({...t,checks:[],...b(o),entries:s})},e.exclude=(n,o)=>{const s={...t.entries};for(const i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new lt({...t,checks:[],...b(o),entries:s})}});function Xi(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new lt({type:"enum",entries:r,...b(t)})}const Yi=f("ZodTransform",(e,t)=>{ts.init(e,t),W.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new vr(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(Ve(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Ve(i))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function Qi(e){return new Yi({type:"transform",transform:e})}const Ir=f("ZodOptional",(e,t)=>{rs.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ir(e){return new Ir({type:"optional",innerType:e})}const eu=f("ZodNullable",(e,t)=>{ns.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ur(e){return new eu({type:"nullable",innerType:e})}const tu=f("ZodDefault",(e,t)=>{os.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ru(e,t){return new tu({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():br(t)}})}const nu=f("ZodPrefault",(e,t)=>{ss.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ou(e,t){return new nu({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():br(t)}})}const Pr=f("ZodNonOptional",(e,t)=>{is.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function su(e,t){return new Pr({type:"nonoptional",innerType:e,...b(t)})}const iu=f("ZodCatch",(e,t)=>{us.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function uu(e,t){return new iu({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const cu=f("ZodPipe",(e,t)=>{cs.init(e,t),W.init(e,t),e.in=t.in,e.out=t.out});function cr(e,t){return new cu({type:"pipe",in:e,out:t})}const au=f("ZodReadonly",(e,t)=>{as.init(e,t),W.init(e,t),e.unwrap=()=>e._zod.def.innerType});function lu(e){return new au({type:"readonly",innerType:e})}const fu=f("ZodCustom",(e,t)=>{ls.init(e,t),W.init(e,t)});function du(e,t={}){return Qs(fu,e,t)}function hu(e){return ei(e)}export{Zr as $,wu as a,Yr as b,ku as c,bu as d,gu as e,pn as o,yu as p,vu as s,mu as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./radix-ui-CV3R9pD6.js";import{c as l,B as p,aa as w,ab as y,ac as k,e as z,S as h}from"./index-C6Dah-xh.js";import{a as M,u as R,b as W}from"./tanstack-Df9bCj5R.js";import{t as g}from"./notifications-B2Pz7lik.js";import{r as j}from"./react-vendor-FspHSO0w.js";import{aq as v,b as E,T as C,q as S,Z as P,f as O,U as $,S as T,ar as I,y as H,a1 as F,a2 as q}from"./icons-ZmwVoUeR.js";import"./utils-CzKF5WmX.js";import"./form-utils-DP6ILe7Z.js";import"./code-highlight-BoHWVYut.js";const A={sm:{dimension:80,strokeWidth:6,fontSize:"text-lg",labelSize:"text-[10px]"},md:{dimension:120,strokeWidth:8,fontSize:"text-3xl",labelSize:"text-xs"},lg:{dimension:160,strokeWidth:10,fontSize:"text-4xl",labelSize:"text-sm"}},B={ok:{stroke:"#22C55E",glow:"rgba(34, 197, 94, 0.4)"},warning:{stroke:"#EAB308",glow:"rgba(234, 179, 8, 0.4)"},error:{stroke:"#EF4444",glow:"rgba(239, 68, 68, 0.4)"}};function D({passed:s,total:t,status:a,size:o="md"}){const n=A[o],d=B[a],i=t>0?Math.round(s/t*100):0,r=(n.dimension-n.strokeWidth)/2,c=2*Math.PI*r,f=c-i/100*c,x=n.dimension/2;return e.jsxs("div",{className:"relative inline-flex items-center justify-center",children:[e.jsxs("svg",{width:n.dimension,height:n.dimension,className:"transform -rotate-90",style:{filter:`drop-shadow(0 0 8px ${d.glow})`},children:[e.jsx("circle",{cx:x,cy:x,r,fill:"none",stroke:"currentColor",strokeWidth:n.strokeWidth,className:"text-muted/30"}),e.jsx("circle",{cx:x,cy:x,r,fill:"none",stroke:d.stroke,strokeWidth:n.strokeWidth,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:f,className:"transition-all duration-1000 ease-out"}),i>0&&e.jsx("circle",{cx:x+r*Math.cos(i/100*2*Math.PI-Math.PI/2),cy:x+r*Math.sin(i/100*2*Math.PI-Math.PI/2),r:n.strokeWidth/2,fill:d.stroke,className:"animate-pulse",style:{filter:`drop-shadow(0 0 4px ${d.glow})`}})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("span",{className:l("font-mono font-bold tracking-tight",n.fontSize),children:i}),e.jsx("span",{className:l("font-mono uppercase tracking-widest text-muted-foreground",n.labelSize),children:"health"})]})]})}function b({label:s,value:t,color:a,bgColor:o}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full animate-pulse",o)}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:s}),e.jsx("span",{className:l("font-mono font-bold text-sm",a),children:t})]})}function L({total:s,passed:t,warnings:a,errors:o,info:n}){const d=t/s*100,i=a/s*100,r=o/s*100,c=n/s*100;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"h-2 rounded-full overflow-hidden bg-muted/50 flex",children:[r>0&&e.jsx("div",{className:"h-full bg-red-500 transition-all duration-500",style:{width:`${r}%`}}),i>0&&e.jsx("div",{className:"h-full bg-yellow-500 transition-all duration-500",style:{width:`${i}%`}}),c>0&&e.jsx("div",{className:"h-full bg-blue-500 transition-all duration-500",style:{width:`${c}%`}}),d>0&&e.jsx("div",{className:"h-full bg-green-500 transition-all duration-500",style:{width:`${d}%`}})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Checks"}),e.jsx("span",{className:"font-mono font-bold text-lg",children:s})]}),e.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[e.jsx(b,{label:"OK",value:t,color:"text-green-500",bgColor:"bg-green-500"}),e.jsx(b,{label:"WARN",value:a,color:"text-yellow-500",bgColor:"bg-yellow-500"}),e.jsx(b,{label:"ERR",value:o,color:"text-red-500",bgColor:"bg-red-500"}),e.jsx(b,{label:"INFO",value:n,color:"text-blue-500",bgColor:"bg-blue-500"})]})]})]})}function G(){return M({queryKey:["health"],queryFn:async()=>(await fetch("/api/health")).json(),refetchInterval:3e4})}function K(){const s=R();return W({mutationFn:async t=>{const a=await fetch(`/api/health/fix/${t}`,{method:"POST"}),o=await a.json();if(!a.ok)throw new Error(o.message);return o},onSuccess:t=>{s.invalidateQueries({queryKey:["health"]}),g.success(t.message)},onError:t=>{g.error(t.message)}})}const Q={ok:{dot:"bg-green-500",label:"OK",labelColor:"text-green-500"},warning:{dot:"bg-yellow-500",label:"WARN",labelColor:"text-yellow-500"},error:{dot:"bg-red-500",label:"ERR",labelColor:"text-red-500"},info:{dot:"bg-blue-500",label:"INFO",labelColor:"text-blue-500"}};function U({check:s}){const t=K(),a=Q[s.status],[o,n]=j.useState(!1),d=s.details||s.fix,i=r=>{navigator.clipboard.writeText(r),g.success("Copied to clipboard")};return d?e.jsx(w,{open:o,onOpenChange:n,children:e.jsxs("div",{className:l("group rounded-lg border transition-all duration-150",o?"border-border bg-muted/30":"border-transparent hover:border-border/50 hover:bg-muted/50"),children:[e.jsx(y,{asChild:!0,children:e.jsxs("button",{className:"w-full flex items-center gap-3 px-3 py-2 text-left",children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",a.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",a.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",a.labelColor),children:["[",a.label,"]"]}),e.jsx(E,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-200",o&&"rotate-90")})]})}),e.jsx(k,{children:e.jsxs("div",{className:"px-3 pb-3 pt-1 space-y-2 ml-7",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.message}),s.details&&e.jsx("pre",{className:"text-xs font-mono text-muted-foreground bg-background/50 rounded p-2 overflow-x-auto border border-border/50",children:s.details}),s.fix&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 bg-background/50 rounded px-2 py-1.5 border border-border/50",children:[e.jsx(C,{className:"w-3 h-3 text-muted-foreground shrink-0"}),e.jsx("code",{className:"text-xs font-mono flex-1 truncate",children:s.fix}),e.jsx(p,{variant:"ghost",size:"sm",onClick:()=>s.fix&&i(s.fix),className:"h-5 w-5 p-0",children:e.jsx(S,{className:"w-3 h-3"})})]}),s.fixable&&s.status!=="ok"&&e.jsxs(p,{size:"sm",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-7 px-3 text-xs",children:[e.jsx(v,{className:"w-3 h-3 mr-1"}),"Apply Fix"]})]})]})})]})}):e.jsxs("div",{className:l("group flex items-center gap-3 px-3 py-2 rounded-lg","hover:bg-muted/50 transition-colors duration-150","border border-transparent hover:border-border/50"),children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",a.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",a.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",a.labelColor),children:["[",a.label,"]"]}),s.fixable&&s.status!=="ok"&&e.jsxs(p,{size:"sm",variant:"ghost",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-6 px-2 text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx(v,{className:"w-3 h-3 mr-1"}),"Fix"]})]})}const Z={Monitor:I,Settings:T,Users:$,Shield:O,Zap:P};function V({group:s,defaultOpen:t=!0}){const[a,o]=j.useState(t),n=Z[s.icon]||I,d=s.checks.filter(m=>m.status==="ok").length,i=s.checks.length,r=s.checks.some(m=>m.status==="error"),c=s.checks.some(m=>m.status==="warning"),f=Math.round(d/i*100),x=r?"text-red-500":c?"text-yellow-500":"text-green-500",u=r?"bg-red-500":c?"bg-yellow-500":"bg-green-500";return e.jsx(w,{open:a,onOpenChange:o,children:e.jsxs("div",{className:l("rounded-lg border transition-all duration-200",r?"border-red-500/30":c?"border-yellow-500/30":"border-border"),children:[e.jsx(y,{asChild:!0,children:e.jsxs("button",{className:l("w-full flex items-center gap-3 p-3 text-left rounded-lg","hover:bg-muted/50 transition-colors duration-150",a&&"rounded-b-none border-b border-border/50"),children:[e.jsx("div",{className:l("p-1.5 rounded-md",r?"bg-red-500/10 text-red-500":c?"bg-yellow-500/10 text-yellow-500":"bg-muted text-muted-foreground"),children:e.jsx(n,{className:"w-4 h-4"})}),e.jsx("span",{className:"flex-1 text-sm font-semibold",children:s.name}),!a&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("div",{className:"w-16 h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:l("h-full transition-all duration-500",u),style:{width:`${f}%`}})})}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",x),children:[d,"/",i]}),e.jsx(H,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-200",a&&"rotate-180")})]})}),e.jsx(k,{children:e.jsx("div",{className:"p-2 space-y-0.5",children:s.checks.map(m=>e.jsx(U,{check:m},m.id))})})]})})}function J(s){return s.errors>0?"error":s.warnings>0?"warning":"ok"}function X(s){const t=Math.floor((Date.now()-s)/1e3);if(t<5)return"just now";if(t<60)return`${t}s ago`;const a=Math.floor(t/60);return a<60?`${a}m ago`:`${Math.floor(a/60)}h ago`}function Y(s){return[...s].sort((t,a)=>{const o=t.checks.filter(r=>r.status==="error").length,n=a.checks.filter(r=>r.status==="error").length,d=t.checks.filter(r=>r.status==="warning").length,i=a.checks.filter(r=>r.status==="warning").length;return o!==n?n-o:i-d})}function _(){return e.jsxs("div",{className:"font-mono text-sm text-muted-foreground flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"$"}),e.jsx("span",{children:"ccs doctor"})]})}function ee(){return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[e.jsx("div",{className:"rounded-xl border bg-gradient-to-br from-background to-muted/20 p-6",children:e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx(h,{className:"w-[120px] h-[120px] rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx(h,{className:"h-5 w-48"}),e.jsx(h,{className:"h-8 w-64"}),e.jsx(h,{className:"h-4 w-32"})]})]})}),e.jsx(h,{className:"h-16 w-full rounded-lg"}),e.jsx("div",{className:"space-y-3",children:[1,2,3,4].map(s=>e.jsx(h,{className:"h-20 rounded-lg"},s))})]})}function ce(){const{data:s,isLoading:t,refetch:a,dataUpdatedAt:o}=G(),n=o,[d,i]=j.useState(0);j.useEffect(()=>{const u=setInterval(()=>i(m=>m+1),1e3);return()=>clearInterval(u)},[]);const r=()=>{navigator.clipboard.writeText("ccs doctor"),g.success("Copied to clipboard")},c=()=>{a(),g.info("Refreshing health checks...")};if(t&&!s)return e.jsx(ee,{});const f=s?J(s.summary):"ok",x=s?.groups?Y(s.groups):[];return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[e.jsxs("div",{className:l("relative overflow-hidden rounded-xl border p-6","bg-gradient-to-br from-background via-background to-muted/30"),children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.02] pointer-events-none",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, currentColor 2px, currentColor 3px)"}}),e.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),e.jsxs("div",{className:"relative flex flex-col md:flex-row items-start md:items-center gap-6",children:[s&&e.jsx("div",{className:"shrink-0",children:e.jsx(D,{passed:s.summary.passed,total:s.summary.total-s.summary.info,status:f,size:"md"})}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx(_,{}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"text-2xl font-bold font-mono tracking-tight",children:"System Health"}),s?.version&&e.jsxs(z,{variant:"outline",className:"font-mono text-xs bg-muted/50",children:["build ",s.version]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(F,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Last scan:"}),e.jsx("span",{className:"font-mono",children:n?X(n):"--"}),e.jsx("span",{className:"text-muted-foreground",children:"|"}),e.jsx("span",{className:"text-muted-foreground",children:"Auto-refresh:"}),e.jsx("span",{className:"font-mono text-green-500",children:"30s"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(p,{variant:"outline",size:"sm",onClick:r,className:"gap-2 font-mono text-xs",children:[e.jsx(C,{className:"w-3 h-3"}),"ccs doctor",e.jsx(S,{className:"w-3 h-3 opacity-50"})]}),e.jsxs(p,{variant:"outline",size:"sm",onClick:c,disabled:t,className:"gap-2",children:[e.jsx(q,{className:l("w-4 h-4",t&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"}),e.jsx("kbd",{className:"hidden md:inline-flex h-5 items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:"R"})]})]})]})]}),s&&e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsx(L,{total:s.summary.total,passed:s.summary.passed,warnings:s.summary.warnings,errors:s.summary.errors,info:s.summary.info})}),x.length>0&&e.jsx("div",{className:"space-y-3",children:x.map((u,m)=>e.jsx(V,{group:u,defaultOpen:m<2||u.checks.some(N=>N.status==="error"||N.status==="warning")},u.id))}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground border-t pt-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{children:["Version ",e.jsx("span",{className:"font-mono",children:s?.version??"--"})]}),e.jsxs("span",{children:["Platform"," ",e.jsx("span",{className:"font-mono",children:typeof navigator<"u"?navigator.platform:"linux"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),e.jsx("span",{children:"Live monitoring active"})]})]})]})}export{ce as HealthPage};
|