@chenpu17/cc-gw 0.8.2 → 0.8.3

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.
Files changed (36) hide show
  1. package/README.md +3 -3
  2. package/package.json +5 -5
  3. package/src/web/dist/assets/About-CTbbI3Xf.js +1 -0
  4. package/src/web/dist/assets/ApiKeys-Dca6MyO2.js +1 -0
  5. package/src/web/dist/assets/ConfirmDialog-DW7jBfm1.js +1 -0
  6. package/src/web/dist/assets/{Dashboard-BizLDn_V.js → Dashboard-DMo-YHgS.js} +1 -1
  7. package/src/web/dist/assets/{DialogShell-CiIvBp8J.js → DialogShell-BqzUE3vU.js} +1 -1
  8. package/src/web/dist/assets/{Events-DpPg8dt0.js → Events-19qjsHJf.js} +1 -1
  9. package/src/web/dist/assets/{Help-B9ewdIkl.js → Help-FrXAXPhx.js} +1 -1
  10. package/src/web/dist/assets/{Login-5O2Xtr5G.js → Login-BYpsX-S8.js} +1 -1
  11. package/src/web/dist/assets/{Logs-D29vlNyO.js → Logs-ynLMNHgv.js} +1 -1
  12. package/src/web/dist/assets/ModelManagement-DrE_4kky.js +1 -0
  13. package/src/web/dist/assets/{PageHeader-CSF0BWul.js → PageHeader-DDxjKW4B.js} +1 -1
  14. package/src/web/dist/assets/{PageSection-Bp_SuEp0.js → PageSection-DRyQEnmK.js} +1 -1
  15. package/src/web/dist/assets/{PageState-BeXrzVEe.js → PageState-DA98vXl7.js} +1 -1
  16. package/src/web/dist/assets/{Profiler-Cwuq3cjV.js → Profiler-D5P7FF0I.js} +1 -1
  17. package/src/web/dist/assets/Settings-D8Xgk7cH.js +1 -0
  18. package/src/web/dist/assets/{Skeleton-8j6Dxod1.js → Skeleton-D_opZxQ7.js} +1 -1
  19. package/src/web/dist/assets/{badge-BvMdmUqJ.js → badge-B-TfGxGB.js} +1 -1
  20. package/src/web/dist/assets/{card-CjhYPqKk.js → card-I07afQF2.js} +1 -1
  21. package/src/web/dist/assets/{gateway-B0gBBN92.js → gateway-CkqHb_VE.js} +1 -1
  22. package/src/web/dist/assets/index-CYeQpt9d.js +61 -0
  23. package/src/web/dist/assets/{input-BnFZKjRM.js → input-DZMeIHxj.js} +1 -1
  24. package/src/web/dist/assets/{label-i5-Lf72z.js → label-DZr7itdg.js} +1 -1
  25. package/src/web/dist/assets/{popover-EFz6sQ7C.js → popover-_LyL4tgU.js} +1 -1
  26. package/src/web/dist/assets/{select-KdDvaKo4.js → select-BUvJR07s.js} +1 -1
  27. package/src/web/dist/assets/{switch-BVWWsjy3.js → switch-BpfcwR9i.js} +1 -1
  28. package/src/web/dist/assets/{useApiQuery-fBWRSgFK.js → useApiQuery-BzbOtl4s.js} +1 -1
  29. package/src/web/dist/assets/useAppMutation-D8Mjcv9t.js +1 -0
  30. package/src/web/dist/index.html +1 -1
  31. package/src/web/dist/assets/About-BCHV3wbt.js +0 -1
  32. package/src/web/dist/assets/ApiKeys-Do48QVpZ.js +0 -1
  33. package/src/web/dist/assets/ModelManagement-CrmNhCAh.js +0 -1
  34. package/src/web/dist/assets/Settings-Q6TBItFQ.js +0 -1
  35. package/src/web/dist/assets/index-BzuBtvAC.js +0 -61
  36. package/src/web/dist/assets/useAppMutation-Cd6HN12q.js +0 -1
@@ -0,0 +1,61 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-DMo-YHgS.js","assets/vendor-5iCEqDpV.js","assets/PageHeader-DDxjKW4B.js","assets/badge-B-TfGxGB.js","assets/PageState-DA98vXl7.js","assets/select-BUvJR07s.js","assets/radix-CmyU-WBH.js","assets/EChart-VRAvk6sX.js","assets/charts-react-DJ_0LNAP.js","assets/charts-core-C-3-Lo7l.js","assets/charts-engine-BI1CmRJo.js","assets/PageSection-DRyQEnmK.js","assets/card-I07afQF2.js","assets/Skeleton-D_opZxQ7.js","assets/i18n-C7VVFIdN.js","assets/useApiQuery-BzbOtl4s.js","assets/query-DxhDvnDC.js","assets/queryKeys-BMvyDTQS.js","assets/router-D8u_RlVh.js","assets/Logs-ynLMNHgv.js","assets/input-DZMeIHxj.js","assets/label-DZr7itdg.js","assets/DialogShell-BqzUE3vU.js","assets/clipboard-CALi6bTW.js","assets/utils-DQfq7gRo.js","assets/popover-_LyL4tgU.js","assets/gateway-CkqHb_VE.js","assets/Events-19qjsHJf.js","assets/ModelManagement-DrE_4kky.js","assets/ConfirmDialog-DW7jBfm1.js","assets/useAppMutation-D8Mjcv9t.js","assets/switch-BpfcwR9i.js","assets/ApiKeys-Dca6MyO2.js","assets/Settings-D8Xgk7cH.js","assets/About-CTbbI3Xf.js","assets/Help-FrXAXPhx.js","assets/Login-BYpsX-S8.js","assets/Profiler-D5P7FF0I.js"])))=>i.map(i=>d[i]);
2
+ import{J as ue,r,j as t,K,L as pe,N as me,O as he,P as ge,S as fe,T as ye,U as ve,V as be,W as Pe,X as Te,Y as Ce,Z as we,$ as xe,a0 as ke,a1 as U,a2 as Ae,a3 as Ie,a4 as z,a5 as B,a6 as Ee,a7 as Re,a8 as Se,a9 as De,aa as Le,q as qe}from"./vendor-5iCEqDpV.js";import{Q as He}from"./query-DxhDvnDC.js";import{i as C,a as Ne,I as je,u as b}from"./i18n-C7VVFIdN.js";import{u as S,O as Me,N as H,a as W,B as Fe,R as Oe,b as T}from"./router-D8u_RlVh.js";import{S as _e,a as V,b as G,P as Ke,C as Y,I as $,c as Q,d as J,R as X,L as Z,e as ee,f as Ue,T as ze,g as Be,h as We,i as Ve,j as Ge,k as te}from"./radix-CmyU-WBH.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function a(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(n){if(n.ep)return;n.ep=!0;const i=a(n);fetch(n.href,i)}})();const A={themeMode:"cc-gw-theme",language:"cc-gw-language",dashboard:{endpointFilter:"cc-gw.dashboard.endpoint-filter"},logs:{visibleColumns:"cc-gw.logs.visible-columns",density:"cc-gw.logs.density",pageSize:"cc-gw.logs.page-size",filtersExpanded:"cc-gw.logs.filters-expanded",providerFilter:"cc-gw.logs.provider-filter",endpointFilter:"cc-gw.logs.endpoint-filter",modelFilter:"cc-gw.logs.model-filter",statusFilter:"cc-gw.logs.status-filter",fromDate:"cc-gw.logs.from-date",toDate:"cc-gw.logs.to-date",selectedApiKeys:"cc-gw.logs.selected-api-keys"},apiKeys:{rangeDays:"cc-gw.api-keys.range-days",search:"cc-gw.api-keys.search",statusFilter:"cc-gw.api-keys.status-filter"}},Ye={zh:{translation:{app:{title:"cc-gw 控制台",skipToContent:"跳转到主要内容",consoleSubtitle:"网关控制平面",environmentLabel:"运行状态",online:"服务在线"},nav:{dashboard:"仪表盘",logs:"请求日志",events:"事件",models:"模型与路由管理",apiKeys:"API 密钥",settings:"设置",help:"使用指南",about:"关于",profiler:"性能分析",group:{overview:"概览",admin:"管理"}},language:{zh:"简体中文",en:"English"},common:{loading:"加载中...",loadingShort:"加载中...",noData:"暂无数据",languageSelector:"语言选择",yes:"是",edit:"编辑",delete:"删除",create:"创建",save:"保存",saving:"保存中...",cancel:"取消",actions:{loading:"处理中...",refresh:"刷新",refreshing:"刷新中...",manualRefresh:"手动刷新",reset:"重置",close:"关闭",openNavigation:"打开导航",closeNavigation:"关闭导航",save:"保存设置",saving:"保存中...",cancel:"取消",copy:"复制",testConnection:"测试连接",testingConnection:"测试中...",cleanup:"清理历史日志",cleaning:"清理中...",checkUpdates:"检查更新",logout:"退出登录"},theme:{label:"主题",light:"亮色",dark:"暗色",system:"跟随系统"},status:{success:"成功",error:"失败",enabled:"已启用",disabled:"已禁用"},notifications:{featureInProgress:"功能开发中,敬请期待。"},units:{request:"次",ms:"ms",token:"Tokens",msPerToken:"ms/Token"},noMatches:"无匹配项",unknownError:"未知错误",filters:{activeCount:"{{count}} 个筛选条件",collapse:"收起筛选",expand:"展开筛选",allRequests:"全部请求"}},login:{title:"登录 cc-gw 控制台",description:"启用 Web UI 访问控制后,请输入账号与密码继续。",fields:{username:"用户名",usernamePlaceholder:"请输入用户名",password:"密码",passwordPlaceholder:"请输入密码"},actions:{submit:"登录"},validation:{required:"请填写用户名和密码",failed:"登录失败,请检查账号或密码后重试"},hint:"如果忘记密码,可在服务器上通过 CLI 或编辑配置重置 Web 登录设置。",status:"已登录:{{username}}"},dashboard:{description:"快速了解请求规模与实时运行状态。",labels:{providers:"Provider 数量",activeClientAddresses:"活跃来源地址",activeClientSessions:"活跃会话",uniqueClientAddressesLastHour:"1小时活跃客户端 IP",uniqueClientSessionsLastHour:"1小时会话",todayRequests:"今日请求",activeRequests:"活跃转发连接",requestsPerMinute:"RPM",outputTokensPerMinute:"TPM",cpu:"CPU 占用率",database:"数据库",memory:"内存占用"},filters:{endpoint:"端点筛选",endpointAll:"全部端点",endpointAnthropic:"anthropic",endpointOpenAI:"openai"},status:{listeningLabel:"监听地址",listening:"监听:{{host}}:{{port}}",providers:"Provider 数量:{{value}}",todayRequests:"今日请求:{{value}}",active:"活动请求:{{value}}",dbSize:"数据库:{{value}}",memory:"内存占用:{{value}}"},actions:{compact:"释放数据库空间",compacting:"整理中..."},toast:{overviewError:"统计数据获取失败",dailyError:"趋势数据获取失败",modelError:"模型统计获取失败",statusError:"状态信息获取失败",dbError:"数据库信息获取失败",recentError:"最近请求获取失败",compactSuccess:{title:"数据库整理完成",desc:"空闲页已整理,建议稍后刷新确认容量。"},compactError:{title:"数据库整理失败",desc:"错误信息:{{message}}"}},cards:{todayRequests:"今日请求数",todayInput:"今日输入 Tokens",todayCacheRead:"今日缓存读取",todayCacheCreation:"今日缓存写入",todayOutput:"今日输出 Tokens",todayCached:"今日缓存 Tokens",avgLatency:"平均响应耗时"},charts:{requestsTitle:"请求趋势",requestsDesc:"最近 14 天请求与 Token 走势",modelTitle:"模型调用分布",modelDesc:"近 7 天不同模型的调用次数与 Token 走势",barRequests:"请求数",lineInput:"输入 Tokens",lineOutput:"输出 Tokens",lineCached:"缓存 Tokens",lineCacheRead:"缓存读取",lineCacheCreation:"缓存写入",axisTokens:"Tokens",ttftLabel:"TTFT(ms)",tpotLabel:"TPOT(ms/Token)",ttftTitle:"TTFT 模型对比",ttftDesc:"比较不同模型的首 Token 耗时 (TTFT)",ttftEmpty:"暂无 TTFT 数据。",tpotTitle:"TPOT 模型对比",tpotDesc:"比较不同模型的平均 Token 耗时 (TPOT)",tpotEmpty:"暂无 TPOT 数据。",ttftAxis:"TTFT (ms)",tpotAxis:"TPOT (ms/Token)",empty:"暂无数据"},insights:{totalRequests:"趋势期总请求",totalRequestsHint:"最近 14 天累计请求量",busiestDay:"最忙的一天",busiestDayHint:"{{value}} 次请求",topModel:"最高频模型",topModelHint:"{{value}} 次调用",fastestTtft:"最快 TTFT 模型"},recent:{title:"最新请求",subtitle:"仅展示最近 {{count}} 条记录",loading:"加载中...",empty:"暂无请求记录",routePlaceholder:"未指定",columns:{time:"时间",endpoint:"端点",provider:"Provider",route:"路由",latency:"耗时(ms)",status:"状态"}},modelTable:{title:"模型性能摘要",description:"统计每个后端模型的请求数、平均耗时、TTFT 与 TPOT。",empty:"暂无模型统计数据。",columns:{model:"Provider/模型",requests:"请求数",latency:"平均耗时",ttft:"TTFT",tpot:"TPOT"}}},logs:{title:"请求日志",description:"查看近期请求,支持筛选 Provider、模型、成功状态及时间范围。",filtersTitle:"筛选条件",filtersDescription:"组合多种条件精准定位请求记录。",summary:{total:"记录总数:{{value}}"},filters:{provider:"Provider",providerAll:"全部 Provider",endpoint:"请求端点",endpointAll:"全部端点",endpointAnthropic:"anthropic",endpointOpenAI:"openai",apiKey:"API Key",apiKeyHint:"可多选,不选择时将展示全部密钥。",modelId:"模型 ID",modelPlaceholder:"如 deepseek-chat",status:"状态",statusAll:"全部",statusSuccess:"成功",statusError:"失败",startDate:"起始日期",endDate:"结束日期",apiKeyAll:"全部密钥",apiKeySelected:"{{count}} 个已选"},actions:{columns:"列设置",visibleCount:"已显示 {{count}} 列",manualRefresh:"手动刷新",refreshing:"刷新中...",export:"导出 ZIP 日志",exporting:"导出中...",detail:"详情"},quickViews:{all:"全部流量",errors:"仅看失败",today:"今天",anthropic:"Anthropic",openai:"OpenAI"},table:{loading:"正在加载日志...",empty:"未找到符合条件的日志记录。",density:{comfortable:"标准",compact:"紧凑"},requestedModelFallback:"未指定",apiKeyUnknown:"未知密钥",columns:{time:"时间",endpoint:"端点",provider:"Provider",requestedModel:"请求模型",routedModel:"路由模型",apiKey:"API Key",inputTokens:"输入 Tokens",cacheReadTokens:"缓存读取",cacheCreationTokens:"缓存写入",outputTokens:"输出 Tokens",stream:"Stream",latency:"耗时(ms)",ttft:"TTFT(ms)",tpot:"TPOT(ms/Token)",status:"状态",error:"错误信息",actions:"操作"},pagination:{perPage:"每页",unit:"条",previous:"上一页",next:"下一页",pageLabel:"第 {{page}} / {{total}} 页"}},endpointAnthropic:"anthropic",endpointOpenAI:"openai",toast:{listError:{title:"日志获取失败",desc:"错误信息:{{message}}"},providerError:{title:"Provider 列表获取失败",desc:"错误信息:{{message}}"},exportSuccess:{title:"导出完成",desc:"ZIP 压缩包已开始下载,包内包含 `logs.json`。"},exportError:{title:"导出失败",desc:"错误信息:{{message}}"}},stream:{streaming:"流式",single:"单次"},detail:{title:"日志详情",id:"ID #{{id}}",infoSection:"基本信息",info:{time:"时间",sessionId:"Session ID",endpoint:"端点",provider:"Provider",requestedModel:"请求模型",noRequestedModel:"未指定",model:"路由模型",stream:"Stream",latency:"耗时",status:"状态",inputTokens:"输入 Tokens",cacheReadTokens:"缓存读取",cacheCreationTokens:"缓存写入",outputTokens:"输出 Tokens",ttft:"TTFT (首 Token 耗时)",tpot:"TPOT (平均 ms/Token)",error:"错误信息"},summary:{route:"{{from}} → {{to}}",latency:"耗时:{{value}}",ttft:"TTFT:{{value}}",tpot:"TPOT:{{value}}",stream:"Stream:{{value}}"},payload:{title:"Payloads",helperWithUpstream:"客户端与上游链路内容已分开展示。",helperClientOnly:"当前请求未发生额外链路改写,仅展示客户端侧内容。",clientRequest:"客户端请求体",upstreamRequest:"上游请求体",upstreamResponse:"上游响应体",clientResponse:"客户端响应体",emptyRequest:"暂无请求内容",emptyResponse:"暂无响应内容"},apiKey:{title:"密钥信息",name:"密钥名称",identifier:"密钥 ID",masked:"掩码展示",maskedUnavailable:"暂无掩码信息",raw:"原始密钥",rawUnavailable:"未记录原始密钥",rawMasked:"原始密钥(已脱敏)",rawMaskedHint:"出于安全考虑,仅展示部分前后缀。如需完整值,请在上游服务中重新生成。",missing:"未记录",lastUsed:"最后使用"},copy:{requestSuccess:"请求体已复制到剪贴板。",responseSuccess:"响应体已复制到剪贴板。",keySuccess:"API 密钥已复制到剪贴板。",empty:"{{label}}为空,无法复制。",failure:"复制失败",failureFallback:"无法复制内容,请稍后再试。"},loadError:"无法加载日志详情。"}},providers:{title:"模型提供商",description:"管理集成的模型服务,查看默认模型及支持能力。",emptyState:"暂无 Provider,请点击“新增提供商”以开始配置。",emptyFiltered:"当前筛选条件下没有匹配的 Provider。",count:"已配置:{{count}} 个 Provider",filters:{searchPlaceholder:"按名称、ID 或 Base URL 搜索",typeAll:"全部类型"},toast:{createSuccess:"已添加 Provider:{{name}}",updateSuccess:"已更新 Provider:{{name}}",testSuccess:"Provider 连通性检查通过。",testSuccessDesc:"状态:{{status}} · 耗时:{{duration}}",testFailure:"Provider 连通性检查失败:{{message}}",loadFailure:"获取配置失败:{{message}}",deleteSuccess:"已删除 Provider:{{name}}",deleteFailure:"删除 Provider 失败:{{message}}"},actions:{add:"新增提供商",refresh:"刷新",refreshing:"刷新中...",edit:"编辑",delete:"删除",test:"测试连接"},quickAddHuawei:{button:"一键添加华为云模型",title:"一键添加华为云模型",description:"输入 API Key 即可快速添加华为云 DeepSeek V3.1、KIMI-K2 与 Qwen3-235B-A22B 模型。",apiKeyLabel:"API Key",apiKeyPlaceholder:"请输入华为云 API Key",note:"完成后可在提供商列表中查看并进一步调整配置。",submit:"添加",providerLabel:"华为云",validation:{apiKey:"请填写 API Key"},toast:{success:"已添加华为云模型",added:"已添加 {{name}}",failure:"添加失败,请稍后重试"}},testDialog:{title:"连接测试选项",subtitle:"针对 {{name}} 的测试请求",description:"部分 Claude 兼容服务需要额外 Header 才能通过诊断。请选择需要附加的 Header,不勾选则保持最简请求。",headerValue:"Header 值:{{value}}",presetLabel:"模拟 Claude Code 请求(推荐)",presetDescription:"附加 Claude CLI 常用的 Header(anthropic-beta、x-app、user-agent 等)以提升兼容性。",presetPreviewSummary:"查看将附加的 Header 列表",preservedInfo:"以下 Header 将自动附加(来自当前配置):",cancel:"取消",primary:"开始测试",options:{beta:{label:"`anthropic-beta` 头",description:"启用 Claude Code 的实验特性(如工具流式);fox code_cc 等服务通常要求此头。"},browser:{label:"`anthropic-dangerous-direct-browser-access` 头",description:"标记请求来自受信客户端,Claude Code 默认会携带此头。"},xApp:{label:"`x-app` 头",description:"标识请求来源,Claude CLI 默认发送为 cli。"},userAgent:{label:"`user-agent` 头",description:"模拟 Claude CLI 的 User-Agent 值。"},accept:{label:"`accept` 头",description:"声明客户端接受 JSON 响应格式。"},acceptLanguage:{label:"`accept-language` 头",description:"兼容要求语言信息的服务。"},secFetchMode:{label:"`sec-fetch-mode` 头",description:"与浏览器/CLI 保持一致的访问信息。"},acceptEncoding:{label:"`accept-encoding` 头",description:"允许 gzip/deflate 压缩响应内容。"},stainlessHelper:{label:"`x-stainless-helper-method` 头",description:"表明请求使用 Claude CLI 的 stream helper。"},stainlessRetry:{label:"`x-stainless-retry-count` 头",description:"Claude CLI 当前的重试计数。"},stainlessTimeout:{label:"`x-stainless-timeout` 头",description:"Claude CLI 设定的超时时间(秒)。"},stainlessLang:{label:"`x-stainless-lang` 头",description:"Claude CLI 所使用的语言标识。"},stainlessPackage:{label:"`x-stainless-package-version` 头",description:"Claude CLI 的包版本号。"},stainlessOs:{label:"`x-stainless-os` 头",description:"调用方所在的操作系统。"},stainlessArch:{label:"`x-stainless-arch` 头",description:"调用方 CPU 架构信息。"},stainlessRuntime:{label:"`x-stainless-runtime` 头",description:"运行时环境标识,例如 node。"},stainlessRuntimeVersion:{label:"`x-stainless-runtime-version` 头",description:"运行时环境的版本号。"}}},card:{defaultModelLabel:"默认模型",defaultModel:"默认模型:{{model}}",noDefault:"未设置默认模型",modelsTitle:"支持模型",noModels:"尚未配置模型。",authMode:"认证方式",modelCount:"{{count}} 个模型",passthrough:"透传模式"},drawer:{createTitle:"新增 Provider",editTitle:"编辑 Provider",quickStart:"快速配置",description:"配置基础信息与模型列表。",formSummary:"当前草稿",modelsDescription:"维护支持的模型列表。",defaultHint:"当前默认模型:{{model}}",summary:{type:"Provider 类型",auth:"认证方式",models:"模型数量",untitled:"未命名 Provider"},sections:{type:"1. 选择 Provider 类型",basic:"2. 填写基础信息",auth:"3. 设置认证",checklist:"提交前检查"},hints:{type:"先选择 Provider 模板,可自动填入推荐 Base URL。",basic:"ID 用于路由映射;显示名称用于界面展示。",auth:"根据上游接口要求选择 Header 认证方式。",customProvider:"自定义兼容服务",checkUrl:"确认 Base URL 指向上游 API 根路径。",checkAuth:"确认密钥与认证 Header 类型匹配。",checkModels:"如需路由提示和默认模型,请补充模型列表。",advancedTitle:"高级模式说明",advancedBody:"开启后可单独维护显示名称与模型别名;如果只是快速接入,保留默认同步即可。"},fields:{id:"Provider ID",idPlaceholder:"如 openai",label:"显示名称",labelPlaceholder:"如 官方主账号",baseUrl:"Base URL",baseUrlPlaceholder:"https://api.example.com/v1",type:"Provider 类型",apiKey:"API Key(可选)",apiKeyPlaceholder:"可留空以从环境变量读取",authMode:"认证方式",authModeHint:"选择 API 认证方式,填写对应的密钥值。",authModeApiKey:"默认方式(Anthropic: x-api-key / OpenAI: Bearer)",authModeAuthToken:"Authorization: Bearer",authModeXAuthToken:"X-Auth-Token",models:"模型配置",showAdvanced:"显示高级选项",hideAdvanced:"隐藏高级选项",addModel:"新增模型",modelId:"模型 ID",modelIdPlaceholder:"如 claude-sonnet-4-5-20250929",modelLabel:"显示名称(可选)",modelLabelPlaceholder:"如 GPT-4 旗舰",setDefault:"设为默认模型",removeModel:"删除模型"},errors:{idRequired:"请填写 Provider ID",idDuplicate:"该 Provider ID 已存在",baseUrlInvalid:"Base URL 格式无效",modelsRequired:"请至少配置一个模型",modelInvalid:"模型 ID 不可为空或重复",defaultInvalid:"默认模型必须在模型列表中"},toast:{saveFailure:"保存失败:{{message}}"},noModelsTitle:"透传模式已启用",noModelsHint:'当前未配置模型列表。该 Provider 将以"透传"模式使用,可在模型路由中映射,或在请求中直接指定模型。',routeExample:"路由映射示例:"},confirm:{delete:"确认删除 Provider「{{name}}」?"}},modelManagement:{title:"模型与路由管理",description:"统一维护模型提供商配置、模型路由映射与自定义端点。",header:{providersHelper:"先维护 Provider 供应池,再为内置端点和自定义端点配置路由规则。",routingHelper:"当前工作区正在编辑「{{name}}」的路由规则,保持单工作区上下文以减少切换混淆。"},overview:{synced:"工作区已同步",unsavedCount:"未保存 {{count}}",providersStat:"Providers",providersStatHint:"已接入的上游供应池",routeWorkspacesStat:"路由工作区",routeWorkspacesStatHint:"内置端点 + 自定义端点",customEndpointsStat:"自定义端点",customEndpointsStatHint:"额外暴露的接入入口",activeWorkspace:"当前工作区",activeWorkspaceProvider:"Provider 清单",activeWorkspaceRouting:"路由编辑区",providerAndSystem:"资源与内置路由",providerPoolTag:"Provider 池",systemEndpointTag:"内置端点",customEndpoints:"自定义端点",customEndpointsHint:"自定义端点保留紧凑横向卡片,便于快速切换、编辑和删除。",headerWithCustom:"优先在此处切换和维护自定义端点,避免主工作区被多列布局挤压。",headerWithoutCustom:"先配置提供商与内置路由,需要时再补充自定义端点。",endpointEnabled:"已启用",endpointDisabled:"已停用",endpointProtocols:"{{count}} 条协议路径",endpointNoProtocol:"尚未配置协议路径",endpointMorePaths:"另有 {{count}} 条路径",endpointManagedExternally:"该端点不可删除,仅可调整配置。",routesEditorHint:"源模型 -> 目标 provider:model",suggestionHint:"一键补充该端点常见的源模型写法,减少手工录入。",resourceCardTitle:"Provider 供应池",resourceCardDescription:"Provider 只表示上游模型资源与鉴权配置,不直接决定外部请求入口。",entryCardTitle:"Endpoint 入口层",entryCardDescription:"Anthropic、OpenAI 与自定义端点才是网关对外暴露的入口;路由与模板都按 endpoint 作用域管理。"},providersSemantics:{title:"先维护 Provider 资源池,再维护 Endpoint 路由",description:"这里配置的是上游供应商、认证方式和模型清单;真正对客户端暴露的仍是内置端点与自定义端点。"},tabs:{providers:"模型提供商",providersDesc:"配置上游模型提供商以及认证信息。",anthropic:"Anthropic 路由",anthropicDesc:"管理 /anthropic 端点的模型映射和默认配置。",openai:"OpenAI 路由",openaiDesc:"管理 /openai 端点的模型映射和默认配置。",customEndpoint:"自定义端点"},addEndpoint:"添加端点",createEndpoint:"创建端点",editEndpoint:"编辑端点",deleteEndpointConfirm:'确定要删除端点 "{{label}}" 吗?此操作无法撤销。',deleteEndpointSuccess:"端点删除成功",deleteEndpointError:"删除失败:{{error}}",createEndpointSuccess:"端点创建成功",createEndpointError:"创建失败:{{error}}",updateEndpointSuccess:"端点更新成功",updateEndpointError:"更新失败:{{error}}",endpointValidationError:"请填写所有必填字段",pathValidationError:"请填写所有路径信息",atLeastOnePath:"至少需要一个路径",endpointId:"端点 ID",endpointIdPlaceholder:"如 custom-api",endpointIdHint:"ID 创建后不可修改,用于内部标识。",endpointLabel:"显示名称",endpointLabelPlaceholder:"如 我的自定义 API",endpointPath:"访问路径",endpointPaths:"访问路径",endpointPathPlaceholder:"如 /custom/api",endpointPathHint:"路径需以 / 开头,修改后立即生效。",endpointProtocol:"协议类型",endpointEnabled:"启用此端点",endpointRoutingHint:"创建后,您可以在此端点的路由配置 Tab 中设置模型路由规则。",addPath:"添加路径",removePath:"删除路径",protocolAnthropic:"Anthropic 协议",protocolOpenAI:"OpenAI",protocolOpenAIChat:"OpenAI Chat",protocolOpenAIResponses:"OpenAI Responses",protocolHint:{anthropic:"Anthropic Messages API 协议(/v1/messages)","openai-auto":"OpenAI 协议(支持 Chat Completions 和 Responses API)。请确保路径以 /v1/chat/completions 或 /v1/responses 结尾。","openai-chat":"OpenAI Chat Completions API 协议(/v1/chat/completions)","openai-responses":"OpenAI Responses API 协议(/v1/responses)"},actions:{saveRoutes:"保存路由",unsaved:"有未保存修改",footerTitle:"路由操作",footerDirtyHint:"已修改当前路由规则,请在此处完成保存。",footerSavedHint:"当前路由已与服务器保持同步。"},routesEditorTitle:"路由规则",emptyRoutesHint:"点击下方按钮添加路由规则。",routing:{selectTarget:"请选择目标 Provider:模型"},claudeValidation:{title:"Claude Code 请求校验防护(实验特性)",description:"开启后,仅允许符合 Claude Code 协议的 /anthropic 请求;不合规请求会直接返回 430。",toggleLabel:"启用校验",statusEnabled:"已启用 Claude Code 校验",statusDisabled:"当前未启用(默认)"},toast:{routesSaved:"模型路由已更新。",routesSaveFailure:"保存模型路由失败:{{message}}",presetSaved:'已保存模板 "{{name}}"。',presetSaveFailure:"保存模板失败:{{message}}",presetApplySuccess:'已应用模板 "{{name}}"。',presetApplyFailure:"应用模板失败:{{message}}",presetDeleteSuccess:'模板 "{{name}}" 已删除。',presetDeleteFailure:"删除模板失败:{{message}}",claudeValidationEnabled:"Claude Code 请求校验防护(实验特性)已启用。",claudeValidationDisabled:"Claude Code 请求校验防护(实验特性)已关闭。",claudeValidationFailure:"更新 Claude 校验防护状态失败:{{message}}"},presets:{title:"路由模板",description:"保存当前 Anthropic 路由映射,便于在不同 Provider 方案之间快速切换。",namePlaceholder:"输入模板名称,例如 fox",save:"保存模板",saving:"保存中...",empty:"尚未保存任何模板。",apply:"应用",applying:"应用中...",delete:"删除",deleting:"删除中...",rulesCount:"{{count}} 条规则",noRules:"空模板",previewTooltip:"悬停查看路由规则",diffTitle:"应用模板确认",diffDescription:'以下路由将被替换为模板 "{{name}}" 的配置:',diffAdded:"新增",diffRemoved:"移除",diffChanged:"变更",diffConfirm:"确认应用",diffEmpty:"模板与当前配置相同,无需变更。"},validation:{presetName:"请输入模板名称。",presetDuplicate:"模板 {{name}} 已存在,请使用其他名称。"},confirm:{deletePreset:'确定要删除模板 "{{name}}" 吗?'}},events:{title:"安全事件",description:"查看校验防护与系统检测记录,及时发现异常访问。",filters:{title:"筛选条件",allLevels:"全部严重级别",typePlaceholder:"按事件类型过滤(可留空)"},actions:{newest:"最新",older:"更早"},levels:{info:"提示",warn:"警告",error:"错误"},empty:{title:"暂无事件记录",subtitle:"当前没有可用的安全事件。"},details:"查看详情",defaultTitle:"未命名事件",defaultMessage:"未提供详细描述。",toast:{loadFailure:"加载事件失败:{{message}}"}},settings:{title:"设置",description:"调整网关端口、日志策略及其他运行参数。",toast:{loadFailure:"配置加载失败:{{message}}",saveSuccess:"系统配置已更新。",saveFailure:"保存失败:{{message}}",protocolRestartRequired:"配置已保存!请执行 cc-gw restart --daemon 重启服务使协议配置生效",copySuccess:"配置文件路径已复制到剪贴板。",copyFailure:"复制失败:{{message}}",cleanupSuccess:"已删除 {{count}} 条历史日志。",cleanupNone:"没有需要删除的日志。",cleanupFailure:"清理失败:{{message}}",clearAllSuccess:"日志已清空(请求 {{logs}} 条,统计 {{metrics}} 条)。",clearAllFailure:"清空失败:{{message}}",missingConfig:"未能加载配置,请刷新或稍后再试。",authLoadFailure:"安全配置加载失败:{{message}}"},sections:{basics:"基础配置",routing:"模型路由",configFile:"配置文件",cleanup:"日志清理",security:"访问安全",protocol:"协议配置",jump:"跳转到"},overview:{title:"当前运行概览",description:"先确认当前监听方式、访问保护和配置文件位置,再进入具体调优。",unsavedCount:"待保存 {{count}} 项",cards:{protocols:"协议入口",security:"控制台访问",configFile:"配置文件"},values:{authEnabled:"已启用登录保护",authDisabled:"未启用登录保护",httpOnly:"仅 HTTP",httpsOnly:"仅 HTTPS",httpAndHttps:"HTTP + HTTPS"}},fields:{port:"监听端口",host:"监听地址(可选)",hostPlaceholder:"默认 127.0.0.1",retention:"日志保留天数",logExportTimeout:"日志导出超时 (秒)",logExportTimeoutHint:"默认 60 秒;导出量较大时可调高,范围 5-600 秒。",bodyLimit:"请求体大小上限 (MB)",bodyLimitHint:"默认 10 MB;如 Claude Code 的 /compact 遇到 413,可适当调大。",defaults:"默认模型配置",storeRequestPayloads:"保存请求内容",storeRequestPayloadsHint:"开启后会在日志数据库中保留客户端请求;如发生协议转换,也会额外保存发往上游的请求体。",storeResponsePayloads:"保存响应内容",storeResponsePayloadsHint:"开启后会保留客户端响应;如发生协议转换,也会保存上游原始响应。流式响应会整理为完整消息而不是 chunk 片段。",logLevel:"日志级别",logLevelOption:{fatal:"致命 (fatal)",error:"错误 (error)",warn:"警告 (warn)",info:"信息 (info)",debug:"调试 (debug)",trace:"跟踪 (trace)"},enableRoutingFallback:"启用模型回退策略",enableRoutingFallbackHint:"无匹配模型时自动落到首个可用模型。默认关闭,建议仅在明确需要时开启。"},auth:{description:"开启 Web UI 登录后,所有管理接口仅对已登录用户开放,模型代理端点仍保持兼容。",enable:"启用 Web UI 登录保护",enableHint:"推荐在多人共用或生产环境中开启,访问 /ui 与 /api/* 将需要先登录。",username:"登录用户名",usernamePlaceholder:"设置用于登录的用户名",password:"登录密码",passwordPlaceholder:"至少 6 位字符",confirmPassword:"确认密码",confirmPasswordPlaceholder:"再次输入登录密码",status:"当前状态",statusEnabled:"已启用登录保护",statusDisabled:"未启用登录保护",passwordHintRequired:"首次启用或修改用户名时必须设置新密码(不少于 6 位)。",passwordHintOptional:"如需更新密码可填写新值,留空则沿用旧密码。",actions:{save:"保存安全设置"},toast:{success:"安全设置已更新。",failure:"保存失败:{{message}}"},validation:{username:"请填写用户名",minLength:"密码至少需要 6 位字符",passwordRequired:"请设置登录密码",confirmMismatch:"两次输入的密码不一致"}},protocol:{description:"配置 HTTP 和 HTTPS 服务端口,默认同时启用两个协议",restartWarning:"⚠️ 修改协议配置后需要重启服务才能生效",restartHint:"保存配置后,请执行以下命令重启服务:",restartTip:"💡 提示:端口、协议启用状态、证书路径需要重启;Provider 和路由配置支持热加载无需重启",http:{enable:"启用 HTTP",hint:"标准 HTTP 协议,适用于本地开发和内网环境",port:"HTTP 端口",host:"HTTP 主机地址"},https:{enable:"启用 HTTPS",hint:"HTTPS 加密协议",port:"HTTPS 端口",host:"HTTPS 主机地址",keyPath:"证书私钥路径",certPath:"证书文件路径",caPath:"CA 证书路径 (可选)",warning:"⚠️ 关于 HTTPS 证书",invalidCert:"自签名证书无效:",invalidCertDetail:"Claude Code 和大多数 AI 工具无法信任自签名证书,会导致连接失败。",recommended:"推荐方案:",recommendedDetail:"本地开发环境建议使用 HTTP 协议(127.0.0.1 本地访问非常安全)。",tip:"💡 如需 HTTPS,请使用受信任 CA(如 Let's Encrypt)签发的正式证书,或配置反向代理(如 Nginx/Caddy)处理 HTTPS。"}},validation:{port:"请输入 1-65535 之间的端口号",retention:"日志保留天数需为 1-365 之间的数字",logExportTimeout:"日志导出超时需在 5-600 秒之间",bodyLimit:"请求体大小需在 1-2048 MB 之间",protocolRequired:"至少需要启用 HTTP 或 HTTPS 协议",httpPort:"HTTP 端口必须在 1-65535 之间",httpsPort:"HTTPS 端口必须在 1-65535 之间",httpsCertificate:"HTTPS 已启用但缺少证书路径,请手动配置受信任的证书",routePair:"请填写完整的来源模型与目标模型配置。",routeDuplicate:"模型 {{model}} 已存在映射,请勿重复配置。"},defaults:{completion:"对话:{{model}}",reasoning:"推理:{{model}}",background:"后台:{{model}}",none:"未设置默认模型"},routing:{title:"模型路由映射",description:"为 Claude Code 发起的模型请求指定实际 Provider 与模型 ID(如将 claude 系列映射至 Kimi)。如需禁用映射,可留空或移除。",titleByEndpoint:"{{endpoint}} 路由配置",descriptionByEndpoint:{anthropic:"当 Claude Code 通过 /anthropic 端点请求特定模型时,将根据此映射选择目标 Provider 与模型。",openai:"当 Codex 通过 /openai 端点请求特定模型时,将根据此映射选择目标 Provider 与模型。"},wildcardHint:"来源模型支持使用 * 通配符(如 claude-*),匹配度更高的规则优先;若目标写成 providerId:*,会将请求里的模型名原样转发给对应 Provider。",add:"新增映射",empty:"尚未配置映射,系统将使用默认模型策略。",source:"来源模型",target:"目标 Provider:模型",sourceLabel:"来源模型",sourcePlaceholder:"如 claude-sonnet-4-5-20250929",targetLabel:"目标 Provider:模型",targetPlaceholder:"如 kimi:kimi-k2-0905-preview",customTargetOption:"自定义目标…",providerPassthroughOption:"{{provider}} · 透传原始模型 (*)",remove:"移除",suggested:"常用 Anthropic 模型"},file:{description:"当前配置存储在本地文件,可通过编辑该文件进行离线修改。",unknown:"未知路径"},cleanup:{description:"立即清理早于当前保留天数的日志记录。",softLabel:"轻度操作",softTitle:"清理过期日志",softDescription:"仅删除超过保留天数的历史日志,适合日常维护。",confirmTitle:"清理历史日志",confirmDescription:"该操作会删除超过保留天数的历史日志,但不会影响当前较新的记录。",hardLabel:"高风险操作",hardTitle:"彻底清空日志",clearAllTitle:"彻底清空日志",clearAll:"彻底清空",clearingAll:"清空中...",confirmCleanup:"该操作会删除超过保留天数的历史日志,但不会影响当前较新的记录。",confirmClearAll:"此操作会删除全部请求日志和日统计数据,且无法恢复。",clearAllWarning:"该操作会删除所有日志记录及日统计数据,请谨慎操作。"}},help:{title:"使用指南",intro:"完整的 cc-gw 配置和使用指南,帮助您从零开始搭建 AI 模型网关。",note:"所有配置变更都会实时生效。建议通过 Web UI 进行配置管理,CLI 主要用于服务启动和重启。",helper:"推荐顺序:先启动服务,再配置 Provider,然后创建 API 密钥,最后接入 Claude Code 或 Codex。",clientConfig:{title:"客户端配置指南",subtitle:"选择您的客户端工具,按照步骤进行配置"},advancedGuide:{title:"高级使用指南",subtitle:"日常使用技巧与最佳实践"},sections:{configuration:{title:"🚀 基础配置流程",items:["📦 **安装并启动服务**:运行 `npm install -g @chenpu17/cc-gw && cc-gw start --daemon --port 4100`,然后访问 http://127.0.0.1:4100/ui",'🔧 **配置模型提供商**:在"模型管理 → 模型提供商"中添加至少一个 Provider,配置 Base URL、API Key 和默认模型','🔑 **生成网关 API Key(可选)**:在"API 密钥"页面创建 API 密钥,为不同客户端创建独立密钥。默认情况下,所有请求都可以通过网关访问。']},claudeCodeConfig:{title:"⚡ Claude Code 配置",items:["🎯 **配置环境变量**:\n```bash\nexport ANTHROPIC_BASE_URL=http://127.0.0.1:4100/anthropic\nexport ANTHROPIC_API_KEY=sk-ant-oat01-8HEmUDacamV1...\n```\n写入 ~/.bashrc 或 ~/.zshrc 后执行 `source ~/.bashrc` 或 `source ~/.zshrc` 让变量生效。",'🔧 **插件设置配置**:\n- 在 Claude Code 插件设置中选择"自定义 API"\n- 填入 Base URL:`http://127.0.0.1:4100/anthropic`\n- 填入 API Key:使用你的实际 API Key(如 `sk-ant-oat01-8HEmUDacamV1...`)','✅ **快速验证**:\n```bash\nclaude "你好,请简短回应"\n```\n输出正常即代表配置成功,可在"请求日志"页看到对应记录。']},codexConfig:{title:"🛠️ Codex CLI 配置",items:[`📝 **编辑配置文件**:
3
+ 在 \`~/.codex/config.toml\` 进行配置:
4
+ \`\`\`toml
5
+ model = "gpt-5-codex"
6
+ model_provider = "cc_gw"
7
+ model_reasoning_effort = "high"
8
+ disable_response_storage = true
9
+
10
+ [model_providers.cc_gw]
11
+ name = "cc_gw"
12
+ base_url = "http://127.0.0.1:4100/openai/v1"
13
+ wire_api = "responses"
14
+ env_key = "cc_gw_key"
15
+ \`\`\``,"🔑 **设置环境变量**:\n```bash\nexport cc_gw_key=sk-ant.....\n```\n写入 ~/.bashrc 或 ~/.zshrc 后执行 `source` 让变量生效。",'✅ **验证配置**:\n```bash\ncodex status # 检查连接状态\ncodex ask "你好,请介绍一下自己" # 测试对话\ncodex chat # 进入交互模式\n```\n输出正常即代表配置成功。']},usage:{title:"📊 日常使用指南",items:["📈 **仪表盘监控**:实时查看请求量、Token 使用量、缓存命中率和响应时间(TTFT/TPOT)等关键指标",'📋 **日志分析**:使用"请求日志"页面筛选和分析请求记录;详情抽屉会按客户端/上游链路分开展示 payload 区块,便于定位协议改写问题','🔄 **模型路由管理**:在"模型管理 → 路由配置"中设置模型映射规则,实现不同模型的智能路由','🎛️ **系统配置**:在"设置"页面中调整日志保留策略、数据存储设置和运行参数',"🔐 **安全配置**:启用 Web UI 登录保护,设置用户名密码,确保管理接口安全"]},tips:{title:"💡 高级技巧与最佳实践",items:["📦 **环境变量管理**:推荐使用 direnv 管理环境变量,创建 .envrc 文件自动加载配置",`🔌 **自定义接入点**:创建额外的 API 端点以支持不同的协议和独立路由配置。在"模型管理"页面可以创建和管理自定义接入点。
16
+
17
+ **主要特性**:
18
+ • 只需配置基础路径(如 \`/my-endpoint\`),系统会根据协议自动注册完整 API 路径
19
+ • 支持 Anthropic 和 OpenAI 协议(Chat Completions / Responses API)
20
+ • 每个端点可配置独立的模型路由规则
21
+ • 一个端点可注册多个路径,支持多种协议
22
+
23
+ **示例配置**:
24
+ \`\`\`json
25
+ {
26
+ "id": "claude-api",
27
+ "label": "Claude 专用接入点",
28
+ "path": "/claude",
29
+ "protocol": "anthropic"
30
+ }
31
+ \`\`\`
32
+ 配置后,客户端通过 \`http://127.0.0.1:4100/claude/v1/messages\` 访问(路径自动扩展)。`,"🗃️ **数据备份**:定期备份 ~/.cc-gw/ 目录(包含配置、日志和数据库)",'🧹 **日志清理**:根据需要调整日志保留天数,或使用"日志清理"功能手动清理','🔍 **问题排查**:开启"保存请求内容 / 保存响应内容"后,可在日志详情里复制客户端与上游 payload,用于调试兼容性问题',"⚡ **性能优化**:如无需排障,可关闭 payload 存储以减少磁盘占用与敏感数据落盘风险","🎯 **模型切换**:使用路由模板功能,实现不同 Provider 方案的一键切换","📊 **监控告警**:结合 Dashboard 数据设置自定义监控,及时发现异常"]}},faq:{title:"❓ 常见问题解答",items:[{q:"如何解决 Claude Code 连接失败问题?",a:'1) 检查 cc-gw 服务状态:`cc-gw status`\n2) 验证环境变量:`echo $ANTHROPIC_BASE_URL`\n3) 确认 API Key 正确性\n4) 在"请求日志"中查看详细错误信息'},{q:"如何使用自定义接入点?",a:'在"模型管理"页面创建自定义接入点,配置基础路径(如 `/my-endpoint`)和协议类型。系统会自动根据协议注册完整的 API 路径。例如,配置 `/claude` + `anthropic` 协议后,客户端通过 `http://127.0.0.1:4100/claude/v1/messages` 访问。\n\n如果遇到 404 错误,检查:\n1) 端点是否已启用\n2) 客户端使用的是完整路径(包括协议子路径)\n3) 查看服务器日志确认路由是否注册成功'},{q:"为什么没有缓存命中数据?",a:"需要上游 Provider 返回 cached_tokens 或 input_tokens_details.cached_tokens 字段。确认 Provider 支持缓存功能并已正确配置。"},{q:"如何配置多个客户端使用不同模型?",a:'为每个客户端创建独立的 API Key,在"模型管理 → 路由配置"中设置不同的路由规则,或使用不同的环境变量配置。也可以为不同客户端创建专用的自定义接入点。'},{q:"Codex CLI 如何连接到 cc-gw?",a:'配置 ~/.codex/config.toml 文件,设置 model_provider 为 "cc_gw",base_url 为 cc-gw 的 OpenAI 兼容端点,并设置相应的环境变量。'},{q:"如何备份和迁移配置?",a:"备份整个 ~/.cc-gw/ 目录,包含 config.json、数据库和日志文件。在新环境中恢复目录并重启服务即可。"},{q:"Web UI 显示 404 错误怎么办?",a:"确认已执行 `pnpm --filter @cc-gw/web build`,或使用 npm 全局安装版本。检查服务启动日志中的静态资源路径。"}]}},about:{title:"关于",description:"查看 cc-gw 的版本信息、构建元数据与运行状态。",app:{title:"应用信息",subtitle:"版本与构建元数据一目了然。",labels:{name:"名称",version:"版本",buildTime:"构建时间",runtime:"后端运行时",backendVersion:"后端版本"},hint:{buildTime:"构建时间以 UTC 表示,便于排查部署版本。"}},status:{title:"运行状态",subtitle:"来自当前网关实例的实时指标。",loading:"正在获取运行状态...",empty:"未能获取状态信息。",labels:{host:"监听地址",port:"监听端口",providers:"已配置 Provider",active:"活动请求",platform:"运行平台",pid:"进程 PID"},hint:{active:"活动请求数每分钟刷新一次,可快速判断当前负载。"}},support:{title:"使用提示",subtitle:"运行维护说明",description:"通过 Web UI 管理 Provider、模型路由与日志,高级配置可直接编辑 ~/.cc-gw/config.json。",tip:"高级配置建议结合 CLI 使用,可将 ~/.cc-gw/config.json 纳入版本管理或自动化脚本。",actions:{checkUpdates:"检查更新",checkingUpdates:"检查中..."}},update:{available:"发现新版本 v{{version}}",current:"当前已是最新版本 v{{version}}",channel:"更新通道:{{channel}}"},toast:{statusError:{title:"状态加载失败"},upToDate:{title:"当前已是最新版本 v{{version}}",description:"npm registry 中没有发现更高版本。"},updateAvailable:{title:"发现新版本 v{{version}}",description:"可通过 npm install -g {{packageName}} 更新。"},updateError:{title:"检查更新失败"}}},apiKeys:{title:"API 密钥管理",description:"创建和管理用于访问网关的 API 密钥",helper:"建议为不同客户端、环境或自动化任务使用独立密钥,便于回溯、限权和停用。",createNew:"创建新密钥",createAction:"创建",createDescription:"创建一个新的 API 密钥用于身份验证,可选填写密钥描述。",descriptionLabel:"密钥描述(可选)",keyDescriptionPlaceholder:"例如:仅供内部测试环境使用",keyNamePlaceholder:"输入密钥名称",keyCreated:"API 密钥已创建",saveKeyWarning:"请妥善保管此密钥。您也可以随时通过密钥列表查看完整密钥。",wildcard:"通配符",wildcardHint:"启用该密钥后,任何自定义密钥与空密钥都可以通过认证;如需限制访问,可随时禁用该密钥。",status:{enabled:"已启用",disabled:"已禁用"},actions:{enable:"启用",disable:"禁用",delete:"删除",reveal:"显示完整密钥",hide:"隐藏密钥"},created:"创建时间",lastUsed:"最后使用",requestCount:"请求次数",totalTokens:"总令牌数",deleteDialogTitle:"删除 API 密钥",confirmDelete:"确定要删除此 API 密钥吗?此操作无法撤销。",errors:{nameRequired:"密钥名称不能为空"},analytics:{title:"密钥使用分析",description:"展示最近 {{days}} 天的密钥调用情况",range:{today:"今日",week:"近 7 天",month:"近 30 天"},cards:{total:"总密钥数",enabled:"启用密钥",active:"活跃密钥({{days}} 天)"},charts:{requests:"按密钥的请求次数(Top 10)",tokens:"按密钥的 Token 消耗(Top 10)"},tokens:{input:"输入 Token",output:"输出 Token"},requestsSeries:"请求次数",empty:"所选时间范围内暂无统计数据。",unknownKey:"未知密钥"},quickStart:{title:"推荐使用方式",description:"先按客户端拆分密钥,再逐步收紧权限,可以显著降低排查成本。",create:{title:"按客户端分组",description:"例如为 Claude Code、Codex、CI 或测试环境分别创建独立密钥。"},restrict:{title:"按端点限制访问",description:"需要时只开放 Anthropic、OpenAI 或自定义接入点,避免误用。"},wildcard:{title:"谨慎使用通配密钥",description:"通配密钥适合临时兼容;生产环境更推荐关闭它并使用命名密钥。"}},list:{title:"密钥列表",empty:"尚未创建 API 密钥,点击右上角按钮开始创建。",emptyFiltered:"当前筛选条件下没有匹配的 API 密钥。"},filters:{searchPlaceholder:"按名称、描述或端点搜索",all:"全部",enabled:"已启用",disabled:"已禁用"},summary:{totalCount:"密钥 {{count}}",wildcard:"通配符密钥:{{count}}",restricted:"受限密钥:{{count}}",unrestricted:"不限制端点:{{count}}"},toast:{keyCreated:"API 密钥创建成功",keyUpdated:"API 密钥已更新",keyDeleted:"API 密钥已删除",keyCopied:"密钥已复制到剪贴板",createFailure:"创建失败:{{message}}",updateFailure:"更新失败:{{message}}",deleteFailure:"删除失败:{{message}}",revealFailure:"获取密钥失败",copyFailure:"复制失败"},allowedEndpoints:"允许的端点",allEndpoints:"全部端点(不限制)",editEndpoints:"编辑端点权限",endpointRestricted:"已限制端点",selectEndpoints:"选择此密钥可以访问的端点,不选择则允许访问全部端点。",maxConcurrency:"最大并发数",maxConcurrencyPlaceholder:"留空表示不限制",maxConcurrencyHelper:"设置此密钥同时请求的最大数量。留空或设为 0 表示不限制。"},endpoints:{title:"自定义端点",description:"管理自定义 API 端点,支持多种协议类型。",createButton:"新增端点",createTitle:"创建端点",editTitle:"编辑端点",emptyTitle:"暂无自定义端点",emptyDescription:'点击"新增端点"按钮创建您的第一个自定义端点。',loadError:"加载端点列表失败",id:"ID",path:"路径",disabled:"已禁用",hasRouting:"已配置路由",protocols:{anthropic:"Anthropic 协议","openai-chat":"OpenAI Chat","openai-responses":"OpenAI Responses"},protocolHints:{anthropic:"Anthropic Messages API 协议(/v1/messages)","openai-chat":"OpenAI Chat Completions API 协议(/v1/chat/completions)","openai-responses":"OpenAI Responses API 协议(/v1/responses)"},form:{id:"端点 ID",idPlaceholder:"如 custom-api",idHint:"ID 创建后不可修改,用于内部标识。",label:"显示名称",labelPlaceholder:"如 我的自定义 API",path:"访问路径",pathPlaceholder:"如 /custom/api",pathHint:"路径需以 / 开头,修改后立即生效。",protocol:"协议类型",enabled:"启用此端点"},routing:{title:"路由配置(可选)",modelRoutes:"模型路由规则",addRoute:"添加规则",noRoutes:"暂无路由规则",sourceModelPlaceholder:"源模型(如 claude-3-5-sonnet-20241022)",targetPlaceholder:"目标(如 anthropic:claude-3-5-sonnet-20241022)",modelRoutesHint:"格式:源模型 → provider:model,支持通配符(如 gpt-* → openai:*)",defaults:"默认模型配置",defaultCompletion:"常规对话默认模型",defaultReasoning:"推理任务默认模型",defaultBackground:"后台任务默认模型",longContextThreshold:"长上下文阈值(tokens)",defaultPlaceholder:"如 anthropic:claude-3-5-sonnet-20241022"},createSuccess:"端点创建成功",createError:"创建失败:{{error}}",updateSuccess:"端点更新成功",updateError:"更新失败:{{error}}",deleteSuccess:"端点删除成功",deleteError:"删除失败:{{error}}",deleteConfirm:'确定要删除端点 "{{label}}" 吗?此操作无法撤销。',validationError:"请填写所有必填字段"},profiler:{description:"记录并分析 LLM 会话的延迟与 token 用量。"}}},en:{translation:{app:{title:"cc-gw Console",skipToContent:"Skip to main content",consoleSubtitle:"Gateway control plane",environmentLabel:"Environment",online:"Service online"},nav:{dashboard:"Dashboard",logs:"Logs",events:"Events",models:"Models & Routing",apiKeys:"API Keys",settings:"Settings",help:"Help",about:"About",profiler:"Profiler",group:{overview:"Overview",admin:"Admin"}},language:{zh:"Simplified Chinese",en:"English"},common:{loading:"Loading...",loadingShort:"Loading...",noData:"No data available",languageSelector:"Language selector",yes:"Yes",edit:"Edit",delete:"Delete",create:"Create",save:"Save",saving:"Saving...",cancel:"Cancel",actions:{loading:"Working...",refresh:"Refresh",refreshing:"Refreshing...",manualRefresh:"Manual refresh",reset:"Reset",close:"Close",openNavigation:"Open navigation",closeNavigation:"Close navigation",save:"Save changes",saving:"Saving...",cancel:"Cancel",copy:"Copy",testConnection:"Test connection",testingConnection:"Testing...",cleanup:"Clean up logs",cleaning:"Cleaning...",checkUpdates:"Check for updates",logout:"Sign out"},theme:{label:"Theme",light:"Light",dark:"Dark",system:"System"},status:{success:"Success",error:"Error",enabled:"Enabled",disabled:"Disabled"},notifications:{featureInProgress:"Feature under development. Stay tuned!"},units:{request:"req",ms:"ms",token:"tokens",msPerToken:"ms/token"},noMatches:"No matches",unknownError:"Unknown error",filters:{activeCount:"{{count}} active filters",collapse:"Collapse filters",expand:"Expand filters",allRequests:"All requests"}},login:{title:"Sign in to cc-gw",description:"Authentication is required before accessing the console.",fields:{username:"Username",usernamePlaceholder:"Enter your username",password:"Password",passwordPlaceholder:"Enter your password"},actions:{submit:"Sign in"},validation:{required:"Please enter both username and password",failed:"Sign in failed. Check your credentials and try again."},hint:"Forgot your credentials? You can reset the Web UI login settings from the server CLI or by editing the configuration file.",status:"Signed in as {{username}}"},dashboard:{description:"Monitor request volume and runtime health at a glance.",labels:{providers:"Providers",activeClientAddresses:"Active client addresses",activeClientSessions:"Active sessions",uniqueClientAddressesLastHour:"1h active client IPs",uniqueClientSessionsLastHour:"1h sessions",todayRequests:"Today requests",activeRequests:"Active forwarded connections",requestsPerMinute:"RPM",outputTokensPerMinute:"TPM",cpu:"CPU usage",database:"Database",memory:"Memory"},filters:{endpoint:"Endpoint",endpointAll:"All endpoints",endpointAnthropic:"anthropic",endpointOpenAI:"openai"},status:{listeningLabel:"Listening",listening:"Listening: {{host}}:{{port}}",providers:"Providers: {{value}}",todayRequests:"Requests today: {{value}}",active:"Active requests: {{value}}",dbSize:"Database: {{value}}",memory:"Memory usage: {{value}}"},actions:{compact:"Compact database",compacting:"Compacting..."},toast:{overviewError:"Failed to load overview metrics",dailyError:"Failed to load trend metrics",modelError:"Failed to load model statistics",statusError:"Failed to load gateway status",dbError:"Failed to load database info",recentError:"Failed to load recent requests",compactSuccess:{title:"Database compact completed",desc:"Free pages were compacted. Refresh later to confirm size."},compactError:{title:"Database compact failed",desc:"Error: {{message}}"}},cards:{todayRequests:"Requests Today",todayInput:"Input Tokens Today",todayCacheRead:"Cache Read Today",todayCacheCreation:"Cache Creation Today",todayOutput:"Output Tokens Today",todayCached:"Cached Tokens Today",avgLatency:"Average Latency"},charts:{requestsTitle:"Request Trends",requestsDesc:"Requests and token usage over the last 14 days",modelTitle:"Model Distribution",modelDesc:"Requests and tokens by model in the past 7 days",barRequests:"Requests",lineInput:"Input tokens",lineOutput:"Output tokens",lineCached:"Cached tokens",lineCacheRead:"Cache Read",lineCacheCreation:"Cache Creation",axisTokens:"Tokens",ttftLabel:"TTFT (ms)",tpotLabel:"TPOT (ms/token)",ttftTitle:"TTFT Comparison",ttftDesc:"Compare first-token latency (TTFT) across models",ttftEmpty:"No TTFT data available.",tpotTitle:"TPOT Comparison",tpotDesc:"Compare per-token latency (TPOT) across models",tpotEmpty:"No TPOT data available.",ttftAxis:"TTFT (ms)",tpotAxis:"TPOT (ms/token)",empty:"No data"},insights:{totalRequests:"Requests in range",totalRequestsHint:"Total requests across the last 14 days",busiestDay:"Busiest day",busiestDayHint:"{{value}} requests",topModel:"Top model",topModelHint:"{{value}} calls",fastestTtft:"Fastest TTFT model"},recent:{title:"Recent Requests",subtitle:"Showing the latest {{count}} records",loading:"Loading...",empty:"No recent requests",routePlaceholder:"Not specified",columns:{time:"Time",endpoint:"Endpoint",provider:"Provider",route:"Route",latency:"Latency (ms)",status:"Status"}},modelTable:{title:"Model Performance Snapshot",description:"Requests, average latency, TTFT, and TPOT by downstream model.",empty:"No model statistics available.",columns:{model:"Provider/Model",requests:"Requests",latency:"Avg Latency",ttft:"TTFT",tpot:"TPOT"}}},logs:{title:"Request Logs",description:"Inspect recent traffic with provider/model/status filters and date range.",filtersTitle:"Filters",filtersDescription:"Combine conditions to zero in on the requests you care about.",summary:{total:"Total records: {{value}}"},filters:{provider:"Provider",providerAll:"All providers",endpoint:"Endpoint",endpointAll:"All endpoints",endpointAnthropic:"anthropic",endpointOpenAI:"openai",apiKey:"API Key",apiKeyHint:"Select one or more keys; leave empty to include all.",modelId:"Model ID",modelPlaceholder:"e.g. deepseek-chat",status:"Status",statusAll:"All",statusSuccess:"Success",statusError:"Error",startDate:"Start date",endDate:"End date",apiKeyAll:"All keys",apiKeySelected:"{{count}} selected"},actions:{columns:"Columns",visibleCount:"{{count}} columns visible",manualRefresh:"Manual refresh",refreshing:"Refreshing...",export:"Export ZIP",exporting:"Exporting...",detail:"Detail"},quickViews:{all:"All traffic",errors:"Errors only",today:"Today",anthropic:"Anthropic",openai:"OpenAI"},table:{loading:"Loading logs...",empty:"No records match the current filters.",density:{comfortable:"Comfortable",compact:"Compact"},requestedModelFallback:"Not specified",apiKeyUnknown:"Unknown key",columns:{time:"Time",endpoint:"Endpoint",provider:"Provider",requestedModel:"Requested model",routedModel:"Routed model",apiKey:"API Key",inputTokens:"Input Tokens",cacheReadTokens:"Cache Read",cacheCreationTokens:"Cache Creation",outputTokens:"Output Tokens",stream:"Stream",latency:"Latency (ms)",ttft:"TTFT (ms)",tpot:"TPOT (ms/token)",status:"Status",error:"Error",actions:"Actions"},pagination:{perPage:"per page",unit:"items",previous:"Previous",next:"Next",pageLabel:"Page {{page}} / {{total}}"}},endpointAnthropic:"anthropic",endpointOpenAI:"openai",stream:{streaming:"Streaming",single:"Non-streaming"},toast:{listError:{title:"Failed to fetch logs",desc:"Error: {{message}}"},providerError:{title:"Failed to fetch providers",desc:"Error: {{message}}"},exportSuccess:{title:"Export ready",desc:"The ZIP archive is downloading now and contains `logs.json`."},exportError:{title:"Export failed",desc:"Error: {{message}}"}},detail:{title:"Log Detail",id:"ID #{{id}}",infoSection:"Overview",info:{time:"Time",sessionId:"Session ID",endpoint:"Endpoint",provider:"Provider",requestedModel:"Requested model",noRequestedModel:"Not specified",model:"Routed model",stream:"Stream",latency:"Latency",status:"Status",inputTokens:"Input Tokens",cacheReadTokens:"Cache Read",cacheCreationTokens:"Cache Creation",outputTokens:"Output Tokens",ttft:"TTFT (first token latency)",tpot:"TPOT (avg ms/token)",error:"Error"},summary:{route:"{{from}} → {{to}}",latency:"Latency: {{value}}",ttft:"TTFT: {{value}}",tpot:"TPOT: {{value}}",stream:"Stream: {{value}}"},payload:{title:"Payloads",helperWithUpstream:"Client and upstream payloads are shown separately.",helperClientOnly:"No upstream rewrite was recorded, so only client-side payloads are shown.",clientRequest:"Client request",upstreamRequest:"Upstream request",upstreamResponse:"Upstream response",clientResponse:"Client response",emptyRequest:"No request content",emptyResponse:"No response content"},apiKey:{title:"API key",name:"Key name",identifier:"Key ID",masked:"Masked form",maskedUnavailable:"No mask available",raw:"Raw key",rawUnavailable:"Raw key not stored",rawMasked:"Raw key (masked)",rawMaskedHint:"For security, only the prefix and suffix are shown. Regenerate the key upstream if you need the full value.",missing:"Not recorded",lastUsed:"Last used"},copy:{requestSuccess:"Request body copied to clipboard.",responseSuccess:"Response body copied to clipboard.",keySuccess:"API key copied to clipboard.",empty:"Cannot copy empty {{label}}.",failure:"Copy failed",failureFallback:"Unable to copy content. Please try again later."},loadError:"Unable to load log detail."}},providers:{title:"Model Providers",description:"Manage integrated services and default models.",emptyState:'No providers yet. Click "Add provider" to get started.',emptyFiltered:"No providers match the current filters.",count:"{{count}} providers configured",filters:{searchPlaceholder:"Search by name, ID, or Base URL",typeAll:"All types"},toast:{createSuccess:"Provider added: {{name}}",updateSuccess:"Provider updated: {{name}}",testSuccess:"Connection test succeeded.",testSuccessDesc:"HTTP {{status}} · {{duration}} elapsed",testFailure:"Connection test failed: {{message}}",loadFailure:"Failed to load config: {{message}}",deleteSuccess:"Provider removed: {{name}}",deleteFailure:"Failed to remove provider: {{message}}"},actions:{add:"Add provider",refresh:"Refresh",refreshing:"Refreshing...",edit:"Edit",delete:"Delete",test:"Test connection"},quickAddHuawei:{button:"Quick add Huawei models",title:"Quick add Huawei models",description:"Provide the API key to automatically configure Huawei Cloud DeepSeek V3.1, KIMI-K2, and Qwen3-235B-A22B.",apiKeyLabel:"API Key",apiKeyPlaceholder:"Enter your Huawei Cloud API Key",note:"You can further adjust settings from the provider list after creation.",submit:"Add provider",providerLabel:"Huawei Cloud",validation:{apiKey:"API Key is required"},toast:{success:"Huawei provider added",added:"{{name}} added successfully",failure:"Failed to add provider. Please try again later."}},testDialog:{title:"Connection Test Options",subtitle:"Test request for {{name}}",description:"Some Claude-compatible providers expect additional headers before accepting diagnostic calls. Select the headers to include; leave unchecked to send none.",headerValue:"Header value: {{value}}",presetLabel:"Simulate Claude Code request (recommended)",presetDescription:"Adds the headers Claude CLI normally sends (anthropic-beta, x-app, user-agent, etc.) for maximum compatibility.",presetPreviewSummary:"Show headers that will be attached",preservedInfo:"Headers below are always included from the saved configuration:",cancel:"Cancel",primary:"Run Test",options:{beta:{label:"`anthropic-beta` header",description:"Enables Claude Code experimental capabilities like fine-grained tool streaming. Services such as fox code_cc typically require it."},browser:{label:"`anthropic-dangerous-direct-browser-access` header",description:"Marks the request as coming from a trusted client. Claude Code includes this header by default."},xApp:{label:"`x-app` header",description:"Identifies the client as Claude CLI (cli)."},userAgent:{label:"`user-agent` header",description:"Imitates the Claude CLI user agent string."},accept:{label:"`accept` header",description:"Declares JSON as the expected response format."},acceptLanguage:{label:"`accept-language` header",description:"Provides language information for providers that require it."},secFetchMode:{label:"`sec-fetch-mode` header",description:"Matches browser/CLI fetch metadata."},acceptEncoding:{label:"`accept-encoding` header",description:"Allows gzip/deflate compressed responses."},stainlessHelper:{label:"`x-stainless-helper-method` header",description:"Indicates the Claude CLI stream helper."},stainlessRetry:{label:"`x-stainless-retry-count` header",description:"Carries Claude CLI retry metadata."},stainlessTimeout:{label:"`x-stainless-timeout` header",description:"Specifies the CLI timeout window in seconds."},stainlessLang:{label:"`x-stainless-lang` header",description:"Reports the implementation language (js)."},stainlessPackage:{label:"`x-stainless-package-version` header",description:"Provides the Claude CLI package version."},stainlessOs:{label:"`x-stainless-os` header",description:"Reports the operating system of the caller."},stainlessArch:{label:"`x-stainless-arch` header",description:"Reports the CPU architecture of the caller."},stainlessRuntime:{label:"`x-stainless-runtime` header",description:"Specifies the runtime environment (e.g. node)."},stainlessRuntimeVersion:{label:"`x-stainless-runtime-version` header",description:"Specifies the runtime version number."}}},card:{defaultModelLabel:"Default model",defaultModel:"Default model: {{model}}",noDefault:"No default model",modelsTitle:"Supported models",noModels:"No models configured yet.",authMode:"Auth mode",modelCount:"{{count}} models",passthrough:"Pass-through"},drawer:{createTitle:"Add Provider",editTitle:"Edit Provider",quickStart:"Quick setup",description:"Configure base settings and model list.",formSummary:"Current draft",modelsDescription:"Maintain supported models.",defaultHint:"Current default model: {{model}}",summary:{type:"Provider type",auth:"Authentication",models:"Models",untitled:"Untitled provider"},sections:{type:"1. Choose provider type",basic:"2. Basic information",auth:"3. Authentication",checklist:"Pre-flight checks"},hints:{type:"Start from a provider template to prefill the recommended Base URL.",basic:"The ID is used by routing rules; the display name is used in the UI.",auth:"Pick the header strategy expected by the upstream API.",customProvider:"Custom compatible service",checkUrl:"Make sure the Base URL points to the upstream API root.",checkAuth:"Make sure the key matches the selected auth header mode.",checkModels:"Add models if you want route suggestions and a default model.",advancedTitle:"About advanced mode",advancedBody:"Advanced mode lets you manage display names and model aliases separately. Keep the default sync if you only need a fast integration."},fields:{id:"Provider ID",idPlaceholder:"e.g. openai",label:"Display name",labelPlaceholder:"e.g. OpenAI Official",baseUrl:"Base URL",baseUrlPlaceholder:"https://api.example.com/v1",type:"Provider type",apiKey:"API Key (optional)",apiKeyPlaceholder:"Leave blank to read from environment",authMode:"Authentication mode",authModeHint:"Select the API authentication method and fill in the corresponding key.",authModeApiKey:"Default (Anthropic: x-api-key / OpenAI: Bearer)",authModeAuthToken:"Authorization: Bearer",authModeXAuthToken:"X-Auth-Token",models:"Model configuration",showAdvanced:"Show advanced options",hideAdvanced:"Hide advanced options",addModel:"Add model",modelId:"Model ID",modelIdPlaceholder:"e.g. claude-sonnet-4-5-20250929",modelLabel:"Display name (optional)",modelLabelPlaceholder:"e.g. GPT-4 Flagship",setDefault:"Set as default",removeModel:"Remove model"},errors:{idRequired:"Provider ID is required",idDuplicate:"Provider ID already exists",baseUrlInvalid:"Invalid Base URL",modelsRequired:"Configure at least one model",modelInvalid:"Model IDs must be unique and non-empty",defaultInvalid:"Default model must exist in the list"},toast:{saveFailure:"Save failed: {{message}}"},noModelsTitle:"Pass-through Mode Enabled",noModelsHint:"No models are defined. This provider will run in pass-through mode—map routes in model routing or specify models directly in requests.",routeExample:"Route Mapping Example:"},confirm:{delete:"Remove provider “{{name}}”?"}},modelManagement:{title:"Models & Routing",description:"Configure providers, routing rules, and custom endpoints.",header:{providersHelper:"Maintain the provider pool first, then define routing for built-in and custom endpoints.",routingHelper:'You are editing routing rules for "{{name}}" in a single focused workspace.'},overview:{synced:"Workspace synced",unsavedCount:"{{count}} unsaved",providersStat:"Providers",providersStatHint:"Connected upstream supply pool",routeWorkspacesStat:"Route workspaces",routeWorkspacesStatHint:"System + custom endpoints",customEndpointsStat:"Custom endpoints",customEndpointsStatHint:"Additional public entry points",activeWorkspace:"Active workspace",activeWorkspaceProvider:"Provider inventory",activeWorkspaceRouting:"Routing editor",providerAndSystem:"Resources & system routing",providerPoolTag:"Provider pool",systemEndpointTag:"System endpoint",customEndpoints:"Custom endpoints",customEndpointsHint:"Keep custom endpoints in a compact horizontal strip so they remain easy to switch, edit, and remove.",headerWithCustom:"Switch and maintain custom endpoints here to avoid squeezing the main workspace into a multi-column layout.",headerWithoutCustom:"Set up providers and built-in routing first, then add custom endpoints when needed.",endpointEnabled:"Enabled",endpointDisabled:"Disabled",endpointProtocols:"{{count}} protocol paths",endpointNoProtocol:"No protocol path configured",endpointMorePaths:"{{count}} more paths",endpointManagedExternally:"This endpoint cannot be removed from the UI.",routesEditorHint:"Source model -> target provider:model",suggestionHint:"Seed common source model names for this endpoint with one click.",resourceCardTitle:"Provider supply pool",resourceCardDescription:"Providers represent upstream model resources and authentication only; they are not public gateway entry points by themselves.",entryCardTitle:"Endpoint entry layer",entryCardDescription:"Anthropic, OpenAI, and custom endpoints are the actual public gateway entries. Routing rules and presets are scoped per endpoint."},providersSemantics:{title:"Maintain the provider pool first, then endpoint routing",description:"This workspace defines upstream vendors, auth, and model inventory. Public traffic still enters through built-in or custom endpoints."},tabs:{providers:"Providers",providersDesc:"Manage upstream providers and authentication.",anthropic:"Anthropic Routing",anthropicDesc:"Control mappings for the /anthropic endpoint.",openai:"OpenAI Routing",openaiDesc:"Control mappings for the /openai endpoint.",customEndpoint:"Custom Endpoint"},addEndpoint:"Add Endpoint",createEndpoint:"Create Endpoint",editEndpoint:"Edit Endpoint",deleteEndpointConfirm:'Are you sure you want to delete endpoint "{{label}}"? This action cannot be undone.',deleteEndpointSuccess:"Endpoint deleted successfully",deleteEndpointError:"Failed to delete: {{error}}",createEndpointSuccess:"Endpoint created successfully",createEndpointError:"Failed to create: {{error}}",updateEndpointSuccess:"Endpoint updated successfully",updateEndpointError:"Failed to update: {{error}}",endpointValidationError:"Please fill in all required fields",pathValidationError:"Please fill in all path information",atLeastOnePath:"At least one path is required",endpointId:"Endpoint ID",endpointIdPlaceholder:"e.g. custom-api",endpointIdHint:"ID cannot be changed after creation, used for internal identification.",endpointLabel:"Display Name",endpointLabelPlaceholder:"e.g. My Custom API",endpointPath:"Access Path",endpointPaths:"Access Paths",endpointPathPlaceholder:"e.g. /custom/api",endpointPathHint:"Path must start with /. Changes take effect immediately.",endpointProtocol:"Protocol Type",endpointEnabled:"Enable this endpoint",endpointRoutingHint:"After creation, you can configure routing rules in this endpoint's routing tab.",addPath:"Add Path",removePath:"Remove Path",protocolAnthropic:"Anthropic Protocol",protocolOpenAI:"OpenAI",protocolOpenAIChat:"OpenAI Chat",protocolOpenAIResponses:"OpenAI Responses",protocolHint:{anthropic:"Anthropic Messages API protocol (/v1/messages)","openai-auto":"OpenAI protocol (supports Chat Completions and Responses APIs). Path must end with /v1/chat/completions or /v1/responses.","openai-chat":"OpenAI Chat Completions API protocol (/v1/chat/completions)","openai-responses":"OpenAI Responses API protocol (/v1/responses)"},actions:{saveRoutes:"Save routes",unsaved:"Unsaved changes",footerTitle:"Route actions",footerDirtyHint:"You changed the current rules. Save them here when you are ready.",footerSavedHint:"The current routing rules are in sync with the server."},routesEditorTitle:"Routing rules",emptyRoutesHint:"Use the buttons below to add your first route.",routing:{selectTarget:"Select provider:model"},claudeValidation:{title:"Claude Code request validation",description:"When enabled, /anthropic requests must follow the Claude Code schema; invalid payloads are rejected with 430.",toggleLabel:"Enable validation",statusEnabled:"Claude Code validation enabled",statusDisabled:"Disabled by default"},toast:{routesSaved:"Model routes updated successfully.",routesSaveFailure:"Failed to save model routes: {{message}}",presetSaved:'Preset "{{name}}" saved.',presetSaveFailure:"Failed to save preset: {{message}}",presetApplySuccess:'Applied preset "{{name}}".',presetApplyFailure:"Failed to apply preset: {{message}}",presetDeleteSuccess:'Preset "{{name}}" deleted.',presetDeleteFailure:"Failed to delete preset: {{message}}",claudeValidationEnabled:"Claude Code request validation enabled.",claudeValidationDisabled:"Claude Code request validation disabled.",claudeValidationFailure:"Failed to update Claude validation: {{message}}"},presets:{title:"Routing presets",description:"Capture the current Anthropic routing map and switch providers with one click.",namePlaceholder:"Preset name, e.g. fox",save:"Save preset",saving:"Saving...",empty:"No presets saved yet.",apply:"Apply",applying:"Applying...",delete:"Delete",deleting:"Deleting...",rulesCount:"{{count}} rules",noRules:"Empty preset",previewTooltip:"Hover to view routing rules",diffTitle:"Confirm preset application",diffDescription:'The following routes will be replaced with preset "{{name}}":',diffAdded:"Added",diffRemoved:"Removed",diffChanged:"Changed",diffConfirm:"Confirm",diffEmpty:"Preset matches current configuration. No changes needed."},validation:{presetName:"Enter a preset name.",presetDuplicate:"Preset {{name}} already exists."},confirm:{deletePreset:'Delete preset "{{name}}"?'}},events:{title:"Security Events",description:"Review validation defenses and system alerts to spot suspicious traffic.",filters:{title:"Filters",allLevels:"All severities",typePlaceholder:"Filter by type (optional)"},actions:{newest:"Newest",older:"Older"},levels:{info:"Info",warn:"Warning",error:"Error"},empty:{title:"No events recorded",subtitle:"There are no security events yet."},details:"View details",defaultTitle:"Untitled event",defaultMessage:"No additional description provided.",toast:{loadFailure:"Failed to load events: {{message}}"}},settings:{title:"Settings",description:"Adjust gateway port, log retention, and runtime parameters.",toast:{loadFailure:"Failed to load config: {{message}}",saveSuccess:"Settings saved successfully.",saveFailure:"Save failed: {{message}}",protocolRestartRequired:"Configuration saved. Run cc-gw restart --daemon to apply protocol changes.",copySuccess:"Config path copied to clipboard.",copyFailure:"Copy failed: {{message}}",cleanupSuccess:"{{count}} old logs removed.",cleanupNone:"No logs met the cleanup criteria.",cleanupFailure:"Cleanup failed: {{message}}",clearAllSuccess:"All logs cleared ({{logs}} requests, {{metrics}} daily rows).",clearAllFailure:"Full wipe failed: {{message}}",missingConfig:"Configuration not available. Refresh and try again.",authLoadFailure:"Failed to load security settings: {{message}}"},sections:{basics:"Basic configuration",routing:"Model routing",configFile:"Configuration file",cleanup:"Log cleanup",security:"Access security",protocol:"Protocol Configuration",jump:"Jump to"},overview:{title:"Current snapshot",description:"Confirm listening protocols, console protection, and config location before editing deeper settings.",unsavedCount:"{{count}} pending",cards:{protocols:"Protocols",security:"Console access",configFile:"Config file"},values:{authEnabled:"Sign-in required",authDisabled:"Open access",httpOnly:"HTTP only",httpsOnly:"HTTPS only",httpAndHttps:"HTTP + HTTPS"}},fields:{port:"Listen port",host:"Listen host (optional)",hostPlaceholder:"Defaults to 127.0.0.1",retention:"Log retention days",logExportTimeout:"Log export timeout (seconds)",logExportTimeoutHint:"Default is 60 seconds. Increase for larger exports. Range: 5-600 seconds.",bodyLimit:"Request body limit (MB)",bodyLimitHint:"Default is 10 MB. Increase this value if Claude Code /compact returns 413 errors.",defaults:"Default models",storeRequestPayloads:"Store request bodies",storeRequestPayloadsHint:"Persist the client request body, and also the rewritten upstream request when protocol conversion happens.",storeResponsePayloads:"Store response bodies",storeResponsePayloadsHint:"Persist the client response body and, when applicable, the upstream response. Streamed responses are materialized into a complete offline message instead of raw chunks.",logLevel:"Log level",logLevelOption:{fatal:"Fatal",error:"Error",warn:"Warn",info:"Info",debug:"Debug",trace:"Trace"},enableRoutingFallback:"Enable routing fallback",enableRoutingFallbackHint:"Automatically fall back to the first available model when no mapping matches. Disabled by default; enable only if you need legacy behavior."},auth:{description:"Require a username and password before accessing the Web UI. Model relay endpoints (/anthropic, /openai) remain publicly accessible.",enable:"Enable Web UI sign-in",enableHint:"Recommended for shared or production instances. The console and all /api/* routes will require authentication.",username:"Username",usernamePlaceholder:"Set the login username",password:"Password",passwordPlaceholder:"At least 6 characters",confirmPassword:"Confirm password",confirmPasswordPlaceholder:"Re-enter the password",status:"Current status",statusEnabled:"Sign-in protection enabled",statusDisabled:"Sign-in protection disabled",passwordHintRequired:"A new password (≥6 characters) is required when enabling auth or changing the username.",passwordHintOptional:"Optional: set a new password. Leave blank to keep the current password.",actions:{save:"Save security settings"},toast:{success:"Security settings updated.",failure:"Failed to save security settings: {{message}}"},validation:{username:"Please enter a username",minLength:"Password must be at least 6 characters",passwordRequired:"Please provide a password",confirmMismatch:"Passwords do not match"}},protocol:{description:"Configure HTTP and HTTPS service ports (both protocols enabled by default)",restartWarning:"⚠️ Service restart required after modifying protocol configuration",restartHint:"After saving, execute the following command to restart:",restartTip:"💡 Tip: Port, protocol enable status, and certificate paths require restart; Provider and routing configs support hot-reload",http:{enable:"Enable HTTP",hint:"Standard HTTP protocol, suitable for local development and internal networks",port:"HTTP Port",host:"HTTP Host"},https:{enable:"Enable HTTPS",hint:"HTTPS encrypted protocol",port:"HTTPS Port",host:"HTTPS Host",keyPath:"Certificate Private Key Path",certPath:"Certificate File Path",caPath:"CA Certificate Path (Optional)",warning:"⚠️ About HTTPS Certificates",invalidCert:"Self-signed certificates are invalid:",invalidCertDetail:"Claude Code and most AI tools cannot trust self-signed certificates, causing connection failures.",recommended:"Recommended:",recommendedDetail:"For local development, use HTTP protocol (127.0.0.1 local access is secure).",tip:"💡 If HTTPS is required, use certificates from trusted CAs (e.g., Let's Encrypt) or configure a reverse proxy (e.g., Nginx/Caddy) to handle HTTPS."}},validation:{port:"Enter a port between 1 and 65535",retention:"Retention days must be between 1 and 365",logExportTimeout:"Log export timeout must be between 5 and 600 seconds",bodyLimit:"Request body limit must be between 1 and 2048 MB",protocolRequired:"Enable at least HTTP or HTTPS.",httpPort:"HTTP port must be between 1 and 65535",httpsPort:"HTTPS port must be between 1 and 65535",httpsCertificate:"HTTPS is enabled but certificate paths are missing.",routePair:"Fill both the source and target models.",routeDuplicate:"A route for {{model}} already exists."},defaults:{completion:"Conversation: {{model}}",reasoning:"Reasoning: {{model}}",background:"Background: {{model}}",none:"No defaults configured"},routing:{title:"Model routing map",description:"Override Claude Code model requests with provider:model targets (e.g., map Claude to Kimi). Leave empty to fall back to defaults.",titleByEndpoint:"{{endpoint}} routing",descriptionByEndpoint:{anthropic:"Requests hitting the /anthropic endpoint will use these mappings.",openai:"Requests hitting the /openai endpoint will use these mappings."},wildcardHint:"Source model ids accept '*' wildcards (e.g. claude-*); the most specific match wins, and targets defined as providerId:* forward the original requested model name upstream.",add:"Add route",empty:"No custom routes configured. Default strategy will be used.",source:"Source model",target:"Target provider:model",sourceLabel:"Source model",sourcePlaceholder:"e.g. claude-sonnet-4-5-20250929",targetLabel:"Target provider:model",targetPlaceholder:"e.g. kimi:kimi-k2-0905-preview",customTargetOption:"Custom target…",providerPassthroughOption:"{{provider}} · passthrough (*)",remove:"Remove",suggested:"Anthropic presets"},file:{description:"Configuration is stored locally; edit the file for offline adjustments.",unknown:"Unknown path"},cleanup:{description:"Immediately purge logs older than the retention window.",softLabel:"Routine action",softTitle:"Clean up expired logs",softDescription:"Deletes only logs older than the retention window. Suitable for normal maintenance.",confirmTitle:"Clean up logs",confirmDescription:"This deletes only logs older than the configured retention window and keeps recent records intact.",hardLabel:"High-risk action",hardTitle:"Clear all logs",clearAllTitle:"Clear all logs",clearAll:"Clear everything",clearingAll:"Clearing…",confirmCleanup:"This deletes only logs older than the configured retention window and keeps recent records intact.",confirmClearAll:"This removes every request log and daily metric row. The operation cannot be undone.",clearAllWarning:"Deletes every log entry and daily metric. This cannot be undone."}},help:{title:"Help & Guidance",intro:"This page summarises how to configure cc-gw via the Web UI and how to operate it day to day.",note:"Changes are written to ~/.cc-gw/config.json immediately. Prefer editing through the Web UI; use the CLI mainly to start or restart the daemon.",helper:"Recommended order: start the service, add providers, create API keys, then connect Claude Code or Codex.",clientConfig:{title:"Client Configuration Guide",subtitle:"Choose your client tool and follow the steps to configure"},advancedGuide:{title:"Advanced Usage Guide",subtitle:"Daily usage tips and best practices"},sections:{configuration:{title:"1. Initial Setup",items:["Install the service and start it with `npm install -g @chenpu17/cc-gw && cc-gw start --daemon --port 4100`, then open http://127.0.0.1:4100/ui.",'Go to "Model Management → Providers" to add upstream providers including base URL, API key, and default model.','Generate Gateway API Keys (Optional): Create API keys on the "API Keys" page for different clients. By default, all requests can pass through the gateway.']},claudeCodeConfig:{title:"2. Claude Code Configuration",items:["Configure environment variables:\n```bash\nexport ANTHROPIC_BASE_URL=http://127.0.0.1:4100/anthropic\nexport ANTHROPIC_API_KEY=sk-ant-oat01-8HEmUDacamV1...\n```\nAdd them to ~/.bashrc or ~/.zshrc and run `source ~/.bashrc` or `source ~/.zshrc` to apply.",'Plugin setup:\n- In Claude Code plugin settings, select "Custom API"\n- Base URL: `http://127.0.0.1:4100/anthropic`\n- API Key: Use your actual API key (e.g., `sk-ant-oat01-8HEmUDacamV1...`)','Quick verification:\n```bash\nclaude "Hello, please respond briefly"\n```\nSuccessful response indicates proper configuration. Check the "Request Logs" page to see the request.']},codexConfig:{title:"3. Codex CLI Configuration",items:[`Edit configuration file in \`~/.codex/config.toml\`:
33
+ \`\`\`toml
34
+ model = "gpt-5-codex"
35
+ model_provider = "cc_gw"
36
+ model_reasoning_effort = "high"
37
+ disable_response_storage = true
38
+
39
+ [model_providers.cc_gw]
40
+ name = "cc_gw"
41
+ base_url = "http://127.0.0.1:4100/openai/v1"
42
+ wire_api = "responses"
43
+ env_key = "cc_gw_key"
44
+ \`\`\``,"Set environment variable:\n```bash\nexport cc_gw_key=sk-ant.....\n```\nAdd to ~/.bashrc or ~/.zshrc and run `source` to apply.",'Verify configuration:\n```bash\ncodex status # Check connection status\ncodex ask "Hello, please introduce yourself" # Test conversation\ncodex chat # Enter interactive mode\n```\nSuccessful responses indicate proper setup.']},usage:{title:"4. Daily Usage",items:["Use the dashboard to keep an eye on request volume, token usage, cache hits, and TTFT/TPOT trends.","“Request Logs” provides rich filters plus separated client/upstream payload blocks, which makes protocol-rewrite debugging much easier.","“Model Management” lets you switch defaults or update mappings without redeploying IDE extensions or automation scripts.","“Settings” controls log retention, payload storage, and runtime parameters to suit your operations."]},tips:{title:"5. Practical Tips",items:["Use **direnv** to manage environment variables — create a .envrc file for automatic configuration loading.",`🔌 **Custom Endpoints**: Create additional API endpoints with different protocols and independent routing. Manage them in the "Model Management" page.
45
+
46
+ **Key Features**:
47
+ • Configure only the base path (e.g., \`/my-endpoint\`), the system automatically registers full API paths based on protocol
48
+ • Support for Anthropic and OpenAI protocols (Chat Completions / Responses API)
49
+ • Each endpoint can have independent model routing rules
50
+ • One endpoint can register multiple paths with different protocols
51
+
52
+ **Example Configuration**:
53
+ \`\`\`json
54
+ {
55
+ "id": "claude-api",
56
+ "label": "Claude Dedicated Endpoint",
57
+ "path": "/claude",
58
+ "protocol": "anthropic"
59
+ }
60
+ \`\`\`
61
+ After configuration, clients access via \`http://127.0.0.1:4100/claude/v1/messages\` (path auto-expansion).`,'Enable "Store request bodies" / "Store response bodies" to inspect and copy client-side and upstream payloads from the log drawer when troubleshooting.',"If you do not need payload-level troubleshooting, turn off payload storage to reduce local disk usage and privacy exposure.","Use **routing presets** to save common routing configurations and quickly switch between different provider setups.","If you edit ~/.cc-gw/config.json manually, refresh the Settings page or restart cc-gw so the UI reflects the latest configuration."]}},faq:{title:"Frequently asked questions",items:[{q:"How can I change the default model for each endpoint?",a:'Go to "Model Management → Routing" and choose defaults for /anthropic and /openai. Saving applies the change right away.'},{q:"How do I use custom endpoints?",a:'Create a custom endpoint in the "Model Management" page by configuring a base path (e.g., `/my-endpoint`) and protocol type. The system automatically registers full API paths based on the protocol. For example, after configuring `/claude` + `anthropic` protocol, clients access via `http://127.0.0.1:4100/claude/v1/messages`.\n\nIf you encounter 404 errors, check:\n1) Is the endpoint enabled?\n2) Are clients using the complete path (including protocol subpath)?\n3) Check server logs to confirm route registration'},{q:"Why are cached token numbers missing?",a:"Upstream providers must return cached_tokens or input_tokens_details.cached_tokens. Enable cache metrics on the provider if supported."},{q:"How can I use different models for different clients?",a:'Create separate API keys for each client and configure different routing rules in "Model Management → Routing". You can also create dedicated custom endpoints for different clients.'}]}},apiKeys:{title:"API Keys Management",description:"Create and manage API keys for gateway access",helper:"Use separate keys for each client, environment, or automation task so you can audit, restrict, and revoke access cleanly.",createNew:"Create New Key",createAction:"Create",createDescription:"Create a new API key for authentication and optionally add a description.",descriptionLabel:"Key description (optional)",keyDescriptionPlaceholder:"e.g. Internal staging access only",keyNamePlaceholder:"Enter key name",keyCreated:"API Key Created",saveKeyWarning:"Keep this key secure. You can also reveal the full key anytime from the key list.",wildcard:"Any Key",wildcardHint:"When enabled, any custom key — including an empty key — is accepted. Disable this key to enforce strict authentication.",status:{enabled:"Enabled",disabled:"Disabled"},actions:{enable:"Enable",disable:"Disable",delete:"Delete",reveal:"Reveal key",hide:"Hide key"},created:"Created",lastUsed:"Last Used",requestCount:"Requests",totalTokens:"Total Tokens",deleteDialogTitle:"Delete API key",confirmDelete:"Are you sure you want to delete this API key? This action cannot be undone.",errors:{nameRequired:"Key name is required"},analytics:{title:"Key Usage Analytics",description:"Highlights for the past {{days}} days of API key activity",range:{today:"Today",week:"Last 7 days",month:"Last 30 days"},cards:{total:"Total keys",enabled:"Enabled keys",active:"Active keys ({{days}} days)"},charts:{requests:"Top 10 keys by request count",tokens:"Top 10 keys by token usage"},tokens:{input:"Input tokens",output:"Output tokens"},requestsSeries:"Requests",empty:"No activity for the selected range.",unknownKey:"Unknown key"},quickStart:{title:"Recommended workflow",description:"Start with separate keys per client, then tighten endpoint access as needed.",create:{title:"Split keys by client",description:"Create different keys for Claude Code, Codex, CI, or staging so logs stay easy to trace."},restrict:{title:"Restrict endpoint access",description:"Limit keys to Anthropic, OpenAI, or custom endpoints when you want tighter isolation."},wildcard:{title:"Use wildcard sparingly",description:"Wildcard access is convenient for migration, but named keys are safer for production."}},list:{title:"Key Inventory",empty:"No API keys found. Use the button above to create one.",emptyFiltered:"No API keys match the current filters."},filters:{searchPlaceholder:"Search by name, description, or endpoint",all:"All",enabled:"Enabled",disabled:"Disabled"},summary:{totalCount:"{{count}} keys",wildcard:"Wildcard keys: {{count}}",restricted:"Restricted keys: {{count}}",unrestricted:"Unrestricted keys: {{count}}"},toast:{keyCreated:"API key created successfully",keyUpdated:"API key updated successfully",keyDeleted:"API key deleted successfully",keyCopied:"Key copied to clipboard",createFailure:"Failed to create: {{message}}",updateFailure:"Failed to update: {{message}}",deleteFailure:"Failed to delete: {{message}}",revealFailure:"Failed to reveal key",copyFailure:"Failed to copy"},allowedEndpoints:"Allowed Endpoints",allEndpoints:"All endpoints (unrestricted)",editEndpoints:"Edit Endpoint Access",endpointRestricted:"Restricted",selectEndpoints:"Select which endpoints this key can access. Leave empty to allow all.",maxConcurrency:"Max Concurrency",maxConcurrencyPlaceholder:"Leave empty for unlimited",maxConcurrencyHelper:"Set the maximum number of simultaneous requests for this key. Leave empty or set to 0 for unlimited."},about:{title:"About",description:"Review cc-gw version details, build metadata, and current runtime status.",app:{title:"Application",subtitle:"Gateway build metadata at a glance.",labels:{name:"Name",version:"Version",buildTime:"Build time",runtime:"Backend runtime",backendVersion:"Backend version"},hint:{buildTime:"Timestamps are recorded in UTC so you can trace deployments easily."}},status:{title:"Runtime status",subtitle:"Live metrics reported by the running gateway.",loading:"Fetching status...",empty:"Unable to retrieve status information.",labels:{host:"Listen host",port:"Listen port",providers:"Providers configured",active:"Active requests",platform:"Platform",pid:"Process PID"},hint:{active:"Active request totals refresh roughly every minute."}},support:{title:"Operational notes",subtitle:"Maintenance guidance",description:"Manage providers, routing, and logs in the Web UI; advanced settings live in ~/.cc-gw/config.json.",tip:"Consider keeping ~/.cc-gw/config.json under version control or managing it via automation scripts.",actions:{checkUpdates:"Check for updates",checkingUpdates:"Checking..."}},update:{available:"Update available: v{{version}}",current:"You are on the latest version: v{{version}}",channel:"Channel: {{channel}}"},toast:{statusError:{title:"Failed to load status"},upToDate:{title:"You are on the latest version: v{{version}}",description:"No newer release was found on npm."},updateAvailable:{title:"Update available: v{{version}}",description:"Upgrade with npm install -g {{packageName}}."},updateError:{title:"Failed to check for updates"}}},endpoints:{title:"Custom Endpoints",description:"Manage custom API endpoints with multiple protocol support.",createButton:"Add Endpoint",createTitle:"Create Endpoint",editTitle:"Edit Endpoint",emptyTitle:"No custom endpoints",emptyDescription:'Click "Add Endpoint" to create your first custom endpoint.',loadError:"Failed to load endpoints",id:"ID",path:"Path",disabled:"Disabled",hasRouting:"Routing configured",protocols:{anthropic:"Anthropic Protocol","openai-chat":"OpenAI Chat","openai-responses":"OpenAI Responses"},protocolHints:{anthropic:"Anthropic Messages API protocol (/v1/messages)","openai-chat":"OpenAI Chat Completions API protocol (/v1/chat/completions)","openai-responses":"OpenAI Responses API protocol (/v1/responses)"},form:{id:"Endpoint ID",idPlaceholder:"e.g. custom-api",idHint:"ID cannot be changed after creation, used for internal identification.",label:"Display Name",labelPlaceholder:"e.g. My Custom API",path:"Access Path",pathPlaceholder:"e.g. /custom/api",pathHint:"Path must start with /. Changes take effect immediately.",protocol:"Protocol Type",enabled:"Enable this endpoint"},routing:{title:"Routing Configuration (Optional)",modelRoutes:"Model Routing Rules",addRoute:"Add Rule",noRoutes:"No routing rules",sourceModelPlaceholder:"Source model (e.g. claude-3-5-sonnet-20241022)",targetPlaceholder:"Target (e.g. anthropic:claude-3-5-sonnet-20241022)",modelRoutesHint:"Format: source model → provider:model, wildcards supported (e.g. gpt-* → openai:*)",defaults:"Default Model Configuration",defaultCompletion:"Default for completion tasks",defaultReasoning:"Default for reasoning tasks",defaultBackground:"Default for background tasks",longContextThreshold:"Long context threshold (tokens)",defaultPlaceholder:"e.g. anthropic:claude-3-5-sonnet-20241022"},createSuccess:"Endpoint created successfully",createError:"Failed to create: {{error}}",updateSuccess:"Endpoint updated successfully",updateError:"Failed to update: {{error}}",deleteSuccess:"Endpoint deleted successfully",deleteError:"Failed to delete: {{error}}",deleteConfirm:'Are you sure you want to delete endpoint "{{label}}"? This action cannot be undone.',validationError:"Please fill in all required fields"},profiler:{description:"Record and analyze LLM session latency and token usage."}}}};function $e(){if(typeof window>"u")return"zh";const e=window.localStorage.getItem(A.language);return e==="zh"||e==="en"?e:"zh"}function N(e){if(typeof window>"u")return;const o=e.toLowerCase().startsWith("zh")?"zh":"en";window.localStorage.setItem(A.language,o)}C.isInitialized||(C.use(Ne).init({resources:Ye,lng:$e(),fallbackLng:"en",interpolation:{escapeValue:!1}}),C.on("languageChanged",N),N(C.language));function Qe(e,o){const a=o,s=a==null?void 0:a.status;return s===401||s===403||s===404?!1:e<2}function Je(){return new ue({defaultOptions:{queries:{retry:Qe,staleTime:3e4,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}function Xe(e){return typeof e=="function"?e():e}function Ze(e,o,a={}){const{serialize:s=JSON.stringify,deserialize:n=JSON.parse}=a,[i,l]=r.useState(()=>{const d=Xe(o);if(typeof window>"u")return d;const u=window.localStorage.getItem(e);if(u===null)return d;try{return n(u)}catch{return d}});return r.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(e,s(i))}catch{}},[e,i]),[i,l]}const oe=r.createContext(void 0);function et(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function j(e){const o=document.documentElement;o.dataset.theme=e,e==="dark"?o.classList.add("dark"):o.classList.remove("dark")}function tt({children:e}){const[o,a]=Ze(A.themeMode,"system",{serialize:i=>i,deserialize:i=>i==="light"||i==="dark"||i==="system"?i:"system"}),s=r.useMemo(()=>typeof window<"u"?et(o):"light",[o]);r.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),l=d=>{o==="system"&&j(d.matches?"dark":"light")};return i.addEventListener("change",l),()=>i.removeEventListener("change",l)},[o]),r.useEffect(()=>{typeof window>"u"||j(s)},[s]);const n=r.useMemo(()=>({mode:o,resolved:s,setMode:a}),[o,s]);return t.jsx(oe.Provider,{value:n,children:e})}function ot(){const e=r.useContext(oe);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const ae=r.createContext(void 0);function at(){return`toast_${Math.random().toString(36).slice(2)}`}function st({children:e}){const[o,a]=r.useState([]),s=r.useCallback(d=>{a(u=>u.filter(c=>c.id!==d))},[]),n=r.useCallback(d=>{a(u=>u.map(c=>c.id===d?{...c,dismissing:!0}:c)),setTimeout(()=>s(d),200)},[s]),i=r.useCallback(d=>{const u=d.id??at();a(m=>[...m,{...d,id:u}]);const c=d.durationMs??3e3;c>0&&setTimeout(()=>n(u),c)},[n]),l=r.useMemo(()=>({toasts:o,pushToast:i,dismissToast:n}),[o,n,i]);return t.jsxs(ae.Provider,{value:l,children:[e,t.jsx("div",{"aria-live":"polite","aria-atomic":"false",className:"fixed right-6 top-6 z-50 flex w-80 flex-col gap-3",children:o.map(d=>t.jsx("div",{role:"alert",className:`rounded-md border border-border bg-card p-4 text-card-foreground shadow-lg ${d.dismissing?"animate-toast-out":"animate-toast-in"} ${d.variant==="error"?"border-destructive/20 bg-destructive/10 text-destructive":d.variant==="success"?"border-[hsl(var(--success)/0.2)] bg-[hsl(var(--success-bg))] text-[hsl(var(--success)/1)]":""}`,children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-semibold",children:d.title}),d.description?t.jsx("p",{className:"mt-1 text-sm opacity-75",children:d.description}):null]}),t.jsx("button",{type:"button","aria-label":"Dismiss",className:"text-sm text-muted-foreground hover:text-foreground",onClick:()=>d.id&&n(d.id),children:"×"})]})},d.id))})]})}function Gt(){const e=r.useContext(ae);if(!e)throw new Error("useToast must be used within ToastProvider");return e}const g=K.create({baseURL:"/",timeout:15e3,withCredentials:!0});g.interceptors.request.use(e=>{const o=(e.method??"get").toLowerCase();if(o==="get"||o==="head"){const a=pe.from(e.headers);a.set("Cache-Control","no-cache"),a.set("Pragma","no-cache"),e.headers=a}return e});g.interceptors.response.use(e=>e,e=>Promise.reject(e));function I(e){var o,a,s;if(K.isAxiosError(e)){const n=(o=e.response)==null?void 0:o.status;return{message:((s=(a=e.response)==null?void 0:a.data)==null?void 0:s.error)||e.message||"请求失败,请稍后再试",status:n,code:String(n??"unknown")}}return{message:e instanceof Error?e.message:"请求失败,请稍后再试"}}async function nt(e){return(await g.request(e)).data}async function v(e){return(await e).data}const Yt={list:async()=>v(g.get("/api/custom-endpoints")),create:async e=>v(g.post("/api/custom-endpoints",e)),update:async(e,o)=>v(g.put(`/api/custom-endpoints/${e}`,o)),delete:async e=>v(g.delete(`/api/custom-endpoints/${e}`))},E={session:async()=>nt({url:"/auth/session",method:"GET"}),login:async(e,o)=>v(g.post("/auth/login",{username:e,password:o})),logout:async()=>v(g.post("/auth/logout"))},se=r.createContext(void 0);function it({children:e}){const o=r.useRef(!0),[a,s]=r.useState({loading:!0,authEnabled:!1,isAuthenticated:!0,username:void 0,error:null}),n=r.useCallback(c=>{o.current&&s(c)},[]),i=r.useCallback(async()=>{n(c=>({...c,loading:!0,error:null}));try{const c=await E.session();n(()=>({loading:!1,authEnabled:!!c.authEnabled,isAuthenticated:!c.authEnabled||!!c.authenticated,username:c.username??void 0,error:null}))}catch(c){const m=I(c);n(()=>({loading:!1,authEnabled:!1,isAuthenticated:!0,username:void 0,error:m.message}))}},[n]),l=r.useCallback(async(c,m)=>{n(p=>({...p,loading:!0,error:null}));try{await E.login(c,m),await i()}catch(p){const y=I(p);throw n(P=>({...P,loading:!1,error:y.message,isAuthenticated:!1})),y}},[i,n]),d=r.useCallback(async()=>{n(c=>({...c,loading:!0}));try{await E.logout()}catch(c){const m=I(c);n(p=>({...p,error:m.message}))}finally{await i()}},[i,n]);r.useEffect(()=>{o.current=!0,i();const c=g.interceptors.response.use(m=>m,async m=>{var p;return((p=m==null?void 0:m.response)==null?void 0:p.status)===401&&await i(),Promise.reject(m)});return()=>{o.current=!1,g.interceptors.response.eject(c)}},[i]);const u=r.useMemo(()=>({...a,refresh:i,login:l,logout:d}),[a,i,l,d]);return t.jsx(se.Provider,{value:u,children:e})}function D(){const e=r.useContext(se);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}function rt({children:e}){const[o]=r.useState(()=>Je());return t.jsx(He,{client:o,children:t.jsx(je,{i18n:C,children:t.jsx(tt,{children:t.jsx(st,{children:t.jsx(it,{children:e})})})})})}function h(...e){return me(he(e))}function ne({label:e}){const{t:o}=b();return t.jsx("div",{className:"flex h-full items-center justify-center p-12",role:"status","aria-live":"polite",children:t.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[t.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-xl border border-primary/15 bg-primary/10 text-primary",children:t.jsx(ge,{className:"h-6 w-6 animate-spin","aria-hidden":"true"})}),t.jsx("p",{className:"text-sm text-muted-foreground",children:e??o("common.loading")})]})})}const lt="modulepreload",dt=function(e){return"/"+e},M={},f=function(o,a,s){let n=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),d=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));n=Promise.allSettled(a.map(u=>{if(u=dt(u),u in M)return;M[u]=!0;const c=u.endsWith(".css"),m=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${m}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":lt,c||(p.as="script"),p.crossOrigin="",p.href=u,d&&p.setAttribute("nonce",d),document.head.appendChild(p),c)return new Promise((y,P)=>{p.addEventListener("load",y),p.addEventListener("error",()=>P(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return n.then(l=>{for(const d of l||[])d.status==="rejected"&&i(d.reason);return o().catch(i)})},ct=r.lazy(()=>f(()=>import("./Dashboard-DMo-YHgS.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))),ut=r.lazy(()=>f(()=>import("./Logs-ynLMNHgv.js"),__vite__mapDeps([19,1,2,3,12,20,21,5,6,14,22,4,23,15,16,17,24,25,13,26,18]))),pt=r.lazy(()=>f(()=>import("./Events-19qjsHJf.js"),__vite__mapDeps([27,1,2,3,11,12,4,15,16,17,20,5,6,14,18]))),F=r.lazy(()=>f(()=>import("./ModelManagement-DrE_4kky.js"),__vite__mapDeps([28,1,29,22,6,2,3,14,30,16,20,21,5,31,17,12,25,26,15,18]))),mt=r.lazy(()=>f(()=>import("./ApiKeys-Dca6MyO2.js"),__vite__mapDeps([32,1,2,3,29,22,6,20,21,15,16,17,14,7,8,9,10,11,12,30,23,18]))),ht=r.lazy(()=>f(()=>import("./Settings-D8Xgk7cH.js"),__vite__mapDeps([33,1,29,22,6,2,3,12,20,21,31,5,14,15,16,30,26,23,17,18]))),gt=r.lazy(()=>f(()=>import("./About-CTbbI3Xf.js"),__vite__mapDeps([34,1,2,3,11,12,4,30,16,15,17,14,18,6]))),ft=r.lazy(()=>f(()=>import("./Help-FrXAXPhx.js"),__vite__mapDeps([35,1,2,3,11,12,23,14,16,18,6]))),yt=r.lazy(()=>f(()=>import("./Login-BYpsX-S8.js"),__vite__mapDeps([36,1,12,20,21,14,18,16,6]))),vt=r.lazy(()=>f(()=>import("./Profiler-D5P7FF0I.js"),__vite__mapDeps([37,1,16,4,3,24,17,14,18,6]))),ie=[{path:"/",index:!0,element:ct,nav:{icon:fe,labelKey:"nav.dashboard",descriptionKey:"dashboard.description",matchPaths:["/"]}},{path:"/logs",element:ut,nav:{icon:ye,labelKey:"nav.logs",descriptionKey:"logs.description"}},{path:"/models",element:F,nav:{icon:ve,labelKey:"nav.models",descriptionKey:"modelManagement.description",matchPaths:["/models","/providers"]}},{path:"/providers",element:F},{path:"/events",element:pt,nav:{icon:be,labelKey:"nav.events",descriptionKey:"events.description"}},{path:"/api-keys",element:mt,nav:{icon:Pe,labelKey:"nav.apiKeys",descriptionKey:"apiKeys.description"}},{path:"/profiler",element:vt,nav:{icon:Te,labelKey:"nav.profiler",descriptionKey:"profiler.description"}},{path:"/settings",element:ht,nav:{icon:Ce,labelKey:"nav.settings",descriptionKey:"settings.description"}},{path:"/help",element:ft,nav:{icon:we,labelKey:"nav.help",descriptionKey:"help.intro"}},{path:"/about",element:gt,nav:{icon:xe,labelKey:"nav.about",descriptionKey:"about.description"}}],bt=[{path:"/login",element:yt}],w=ie.filter(e=>!!e.nav);function Pt(e){return e==="/"?w[0]:w.find(o=>(o.nav.matchPaths??[o.path]).some(s=>s!=="/"&&e.startsWith(s)))??w[0]}function Tt(){return typeof window>"u"?"/":window.location.pathname.startsWith("/ui")?"/ui":"/"}const Ct=ke("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-[0_8px_20px_-12px_hsl(var(--primary)/0.4)] hover:-translate-y-0.5 hover:bg-primary/95 hover:shadow-[0_14px_28px_-14px_hsl(var(--primary)/0.45)]",destructive:"bg-destructive text-destructive-foreground shadow-[0_8px_20px_-12px_rgba(220,38,38,0.55)] hover:-translate-y-0.5 hover:bg-destructive/95",outline:"border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary/90 text-secondary-foreground hover:bg-secondary",ghost:"text-muted-foreground hover:bg-accent hover:text-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 px-3.5 text-[13px]",lg:"h-11 px-8",icon:"h-10 w-10 rounded-2xl"}},defaultVariants:{variant:"default",size:"default"}}),x=r.forwardRef(({className:e,variant:o,size:a,asChild:s=!1,...n},i)=>{const l=s?_e:"button";return t.jsx(l,{className:h(Ct({variant:o,size:a,className:e})),ref:i,...n})});x.displayName="Button";const re=Ue,le=ze,wt=r.forwardRef(({className:e,inset:o,children:a,...s},n)=>t.jsxs(V,{ref:n,className:h("flex cursor-default select-none items-center gap-2 rounded-xl px-3 py-2 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",o&&"pl-8",e),...s,children:[a,t.jsx(U,{className:"ml-auto"})]}));wt.displayName=V.displayName;const xt=r.forwardRef(({className:e,...o},a)=>t.jsx(G,{ref:a,className:h("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-2 text-popover-foreground shadow-md 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",e),...o}));xt.displayName=G.displayName;const L=r.forwardRef(({className:e,sideOffset:o=4,...a},s)=>t.jsx(Ke,{children:t.jsx(Y,{ref:s,sideOffset:o,className:h("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-2 text-popover-foreground shadow-md 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",e),...a})}));L.displayName=Y.displayName;const q=r.forwardRef(({className:e,inset:o,...a},s)=>t.jsx($,{ref:s,className:h("relative flex cursor-default select-none items-center gap-2 rounded-xl px-3 py-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",o&&"pl-8",e),...a}));q.displayName=$.displayName;const kt=r.forwardRef(({className:e,children:o,checked:a,...s},n)=>t.jsxs(Q,{ref:n,className:h("relative flex cursor-default select-none items-center rounded-xl py-2 pl-8 pr-3 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:a,...s,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(J,{children:t.jsx(Ae,{className:"h-4 w-4"})})}),o]}));kt.displayName=Q.displayName;const At=r.forwardRef(({className:e,children:o,...a},s)=>t.jsxs(X,{ref:s,className:h("relative flex cursor-default select-none items-center rounded-xl py-2 pl-8 pr-3 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(J,{children:t.jsx(Ie,{className:"h-2 w-2 fill-current"})})}),o]}));At.displayName=X.displayName;const It=r.forwardRef(({className:e,inset:o,...a},s)=>t.jsx(Z,{ref:s,className:h("px-3 py-2 text-sm font-semibold",o&&"pl-8",e),...a}));It.displayName=Z.displayName;const Et=r.forwardRef(({className:e,...o},a)=>t.jsx(ee,{ref:a,className:h("-mx-1 my-1 h-px bg-muted",e),...o}));Et.displayName=ee.displayName;const O=[{mode:"light",labelKey:"common.theme.light",icon:z},{mode:"dark",labelKey:"common.theme.dark",icon:B},{mode:"system",labelKey:"common.theme.system",icon:Ee}];function Rt(){const{mode:e,setMode:o,resolved:a}=ot(),{t:s}=b(),n=O.find(l=>l.mode===e),i=(n==null?void 0:n.icon)||(a==="dark"?B:z);return t.jsxs(re,{children:[t.jsx(le,{asChild:!0,children:t.jsxs(x,{variant:"ghost",size:"sm","aria-label":s("common.theme.label"),"data-testid":"theme-switcher-trigger",children:[t.jsx(i,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),t.jsx("span",{className:"hidden sm:inline",children:s((n==null?void 0:n.labelKey)??"common.theme.label")})]})}),t.jsx(L,{align:"end",children:O.map(l=>{const d=l.icon,u=l.mode===e;return t.jsxs(q,{onClick:()=>o(l.mode),className:u?"bg-accent":"",children:[t.jsx(d,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),s(l.labelKey)]},l.mode)})})]})}const _=[{code:"zh",labelKey:"language.zh",nativeName:"中文"},{code:"en",labelKey:"language.en",nativeName:"English"}];function St(){const{i18n:e,t:o}=b(),a=e.language.startsWith("zh")?"zh":"en",s=_.find(i=>i.code===a),n=i=>{typeof window<"u"&&window.localStorage.setItem(A.language,i),e.changeLanguage(i)};return t.jsxs(re,{children:[t.jsx(le,{asChild:!0,children:t.jsxs(x,{variant:"ghost",size:"sm","aria-label":o("common.languageSelector"),"data-testid":"language-switcher-trigger",children:[t.jsx(Re,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),t.jsx("span",{className:"hidden sm:inline",children:(s==null?void 0:s.nativeName)??"Language"})]})}),t.jsx(L,{align:"end",children:_.map(i=>t.jsx(q,{onClick:()=>n(i.code),className:i.code===a?"bg-accent":"",children:i.nativeName},i.code))})]})}const Dt=Be,Lt=We,qt=Ve,de=r.forwardRef(({className:e,sideOffset:o=4,...a},s)=>t.jsx(Ge,{children:t.jsx(te,{ref:s,sideOffset:o,className:h("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...a})}));de.displayName=te.displayName;function Ht(e,o){return(o.nav.matchPaths??[o.path]).some(s=>s==="/"?e==="/":e.startsWith(s))}const Nt=["/","/logs","/models","/events","/profiler"],jt=["/api-keys","/settings","/help","/about"];function k({label:e,items:o,pathname:a,compact:s,onNavigate:n}){const{t:i}=b();return o.length===0?null:t.jsxs("div",{className:"space-y-0.5",children:[!s&&t.jsx("p",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-widest text-muted-foreground/60",children:e}),o.map(l=>{const d=l.nav.icon,u=Ht(a,l),c=i(l.nav.labelKey);return s?t.jsxs(Lt,{children:[t.jsx(qt,{asChild:!0,children:t.jsx(H,{to:l.path,onClick:n,end:l.path==="/",className:h("flex items-center justify-center rounded-full p-2.5 transition-colors",u?"bg-accent text-primary":"text-muted-foreground hover:bg-secondary hover:text-foreground"),"aria-label":c,children:t.jsx(d,{className:"h-5 w-5","aria-hidden":"true"})})}),t.jsx(de,{side:"right",children:c})]},l.path):t.jsxs(H,{to:l.path,onClick:n,end:l.path==="/",className:h("flex items-center gap-3 rounded-full px-3 py-2 text-sm font-medium transition-colors",u?"bg-accent text-primary":"text-muted-foreground hover:bg-secondary hover:text-foreground"),children:[t.jsx(d,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate",children:c}),u&&t.jsx(U,{className:"h-3.5 w-3.5 shrink-0 opacity-60"})]},l.path)})]})}function R({compact:e,onNavigate:o}){const{t:a}=b(),s=S(),{authEnabled:n,username:i}=D(),l=w.filter(u=>Nt.includes(u.path)),d=w.filter(u=>jt.includes(u.path));return t.jsxs("div",{className:h("flex h-full flex-col",e?"items-center":""),children:[t.jsxs("div",{className:h("flex shrink-0 items-center border-b border-border",e?"h-16 w-full justify-center":"h-16 gap-3 px-5"),children:[t.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary text-xs font-bold text-primary-foreground",children:"GW"}),!e&&t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold text-foreground",children:a("app.title")}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a("app.consoleSubtitle")})]})]}),t.jsx("div",{className:h("flex-1 overflow-y-auto",e?"w-full p-2":"space-y-4 p-3"),children:e?t.jsx(Dt,{delayDuration:0,children:t.jsxs("div",{className:"space-y-1",children:[t.jsx(k,{label:"",items:l,pathname:s.pathname,compact:!0,onNavigate:o}),t.jsx("div",{className:"my-2 border-t border-border"}),t.jsx(k,{label:"",items:d,pathname:s.pathname,compact:!0,onNavigate:o})]})}):t.jsxs(t.Fragment,{children:[t.jsx(k,{label:a("nav.group.overview"),items:l,pathname:s.pathname,onNavigate:o}),t.jsx(k,{label:a("nav.group.admin"),items:d,pathname:s.pathname,onNavigate:o})]})}),n&&i&&!e&&t.jsx("div",{className:"shrink-0 border-t border-border p-3",children:t.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-2 py-2",children:[t.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-secondary text-xs font-semibold text-muted-foreground",children:i.slice(0,2).toUpperCase()}),t.jsx("span",{className:"flex-1 truncate text-xs text-muted-foreground",children:i})]})})]})}function Mt(){const{t:e}=b(),o=S(),[a,s]=r.useState(!1),{authEnabled:n,username:i,logout:l}=D(),[d,u]=r.useState(!1);r.useEffect(()=>{s(!1)},[o.pathname]);const c=r.useMemo(()=>Pt(o.pathname),[o.pathname]),m=e(c.nav.labelKey),p=e(c.nav.descriptionKey),y=async()=>{if(!d){u(!0);try{await l()}finally{u(!1)}}};return t.jsxs("div",{className:"flex h-screen overflow-hidden bg-background",children:[t.jsx("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:m-4 focus:rounded-md focus:bg-primary focus:px-4 focus:py-2 focus:text-primary-foreground",children:e("app.skipToContent")}),t.jsx("aside",{className:"hidden w-16 shrink-0 flex-col border-r border-border bg-card md:flex lg:hidden",children:t.jsx(R,{compact:!0})}),t.jsx("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-border bg-card lg:flex",children:t.jsx(R,{})}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsxs("header",{className:"sticky top-0 z-30 flex h-16 shrink-0 items-center justify-between gap-4 border-b border-border bg-card px-4 lg:px-6",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(x,{variant:"ghost",size:"icon",className:"md:hidden",onClick:()=>s(P=>!P),"aria-label":e(a?"common.actions.closeNavigation":"common.actions.openNavigation"),"aria-expanded":a,"aria-controls":"mobile-nav",children:a?t.jsx(Se,{className:"h-5 w-5"}):t.jsx(De,{className:"h-5 w-5"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-semibold text-foreground",children:m}),t.jsx("p",{className:"hidden text-xs text-muted-foreground sm:block",children:p})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[n&&i&&t.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:e("login.status",{username:i})}),n&&t.jsx(x,{variant:"ghost",size:"sm",onClick:()=>void y(),disabled:d,children:e(d?"common.actions.loading":"common.actions.logout")}),t.jsx(St,{}),t.jsx(Rt,{})]})]}),t.jsx("main",{id:"main-content",role:"main",tabIndex:-1,className:"flex-1 overflow-y-auto",children:t.jsx("div",{className:"mx-auto max-w-7xl px-4 py-6 lg:px-8 lg:py-8 animate-in fade-in slide-in-from-bottom-4 duration-300",children:t.jsx(Me,{})})})]}),a&&t.jsxs("div",{className:"fixed inset-0 z-40 md:hidden",role:"dialog","aria-modal":"true",children:[t.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm",onClick:()=>s(!1)}),t.jsx("div",{id:"mobile-nav",className:"fixed inset-y-0 left-0 w-64 border-r border-border bg-card shadow-lg animate-in slide-in-from-left duration-200",children:t.jsx(R,{onNavigate:()=>s(!1)})})]})]})}function Ft({children:e}){const{authEnabled:o,isAuthenticated:a,loading:s}=D(),n=S();return s?t.jsx(ne,{}):!o||a?e:t.jsx(W,{to:"/login",replace:!0,state:{from:n}})}function Ot(){return t.jsx(Ft,{children:t.jsx(Mt,{})})}function _t(){return t.jsx(Fe,{basename:Tt(),children:t.jsx(r.Suspense,{fallback:t.jsx(ne,{}),children:t.jsxs(Oe,{children:[t.jsx(T,{path:"/",element:t.jsx(Ot,{}),children:ie.map(e=>{const o=e.element;return e.index?t.jsx(T,{index:!0,element:t.jsx(o,{})},"index"):t.jsx(T,{path:e.path.slice(1),element:t.jsx(o,{})},e.path)})}),bt.map(e=>{const o=e.element;return t.jsx(T,{path:e.path,element:t.jsx(o,{})},e.path)}),t.jsx(T,{path:"*",element:t.jsx(W,{to:"/",replace:!0})})]})})})}function Kt(){return t.jsx(rt,{children:t.jsx(_t,{})})}const ce=document.getElementById("root");if(!ce)throw new Error("Root element #root not found");Le.createRoot(ce).render(t.jsx(qe.StrictMode,{children:t.jsx(Kt,{})}));export{x as B,ne as L,Dt as T,Ze as a,g as b,h as c,Yt as d,Lt as e,qt as f,de as g,v as h,D as i,nt as r,A as s,I as t,Gt as u};
@@ -1 +1 @@
1
- import{r as i,j as s}from"./vendor-5iCEqDpV.js";import{c as n}from"./index-BzuBtvAC.js";const l=i.forwardRef(({className:e,type:r,...o},t)=>s.jsx("input",{type:r,className:n("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:t,...o}));l.displayName="Input";export{l as I};
1
+ import{r as i,j as s}from"./vendor-5iCEqDpV.js";import{c as n}from"./index-CYeQpt9d.js";const l=i.forwardRef(({className:e,type:r,...o},t)=>s.jsx("input",{type:r,className:n("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:t,...o}));l.displayName="Input";export{l as I};
@@ -1 +1 @@
1
- import{r as o,j as r}from"./vendor-5iCEqDpV.js";import{c as t}from"./index-BzuBtvAC.js";const l=o.forwardRef(({className:e,...a},s)=>r.jsx("label",{ref:s,className:t("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...a}));l.displayName="Label";export{l as L};
1
+ import{r as o,j as r}from"./vendor-5iCEqDpV.js";import{c as t}from"./index-CYeQpt9d.js";const l=o.forwardRef(({className:e,...a},s)=>r.jsx("label",{ref:s,className:t("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...a}));l.displayName="Label";export{l as L};
@@ -1 +1 @@
1
- import{r as i,j as o}from"./vendor-5iCEqDpV.js";import{l as n,m,n as p,o as t}from"./radix-CmyU-WBH.js";import{c as l}from"./index-BzuBtvAC.js";const x=n,b=m,f=i.forwardRef(({className:a,align:e="center",sideOffset:s=4,...r},d)=>o.jsx(p,{children:o.jsx(t,{ref:d,align:e,sideOffset:s,className:l("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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",a),...r})}));f.displayName=t.displayName;export{x as P,b as a,f as b};
1
+ import{r as i,j as o}from"./vendor-5iCEqDpV.js";import{l as n,m,n as p,o as t}from"./radix-CmyU-WBH.js";import{c as l}from"./index-CYeQpt9d.js";const x=n,b=m,f=i.forwardRef(({className:a,align:e="center",sideOffset:s=4,...r},d)=>o.jsx(p,{children:o.jsx(t,{ref:d,align:e,sideOffset:s,className:l("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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",a),...r})}));f.displayName=t.displayName;export{x as P,b as a,f as b};
@@ -1 +1 @@
1
- import{r,j as e,al as d,a2 as w,ak as N}from"./vendor-5iCEqDpV.js";import{r as g,V as j,s as n,t as b,u as S,v as i,w as v,x as c,y as R,z as C,A as m,B as p,D as f,E as u}from"./radix-CmyU-WBH.js";import{c as o}from"./index-BzuBtvAC.js";const U=g,L=j,I=r.forwardRef(({className:t,children:s,...a},l)=>e.jsxs(n,{ref:l,className:o("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground transition-all focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[s,e.jsx(b,{asChild:!0,children:e.jsx(d,{className:"h-4 w-4 opacity-50"})})]}));I.displayName=n.displayName;const x=r.forwardRef(({className:t,...s},a)=>e.jsx(m,{ref:a,className:o("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(N,{className:"h-4 w-4"})}));x.displayName=m.displayName;const h=r.forwardRef(({className:t,...s},a)=>e.jsx(p,{ref:a,className:o("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(d,{className:"h-4 w-4"})}));h.displayName=p.displayName;const B=r.forwardRef(({className:t,children:s,position:a="popper",...l},y)=>e.jsx(S,{children:e.jsxs(i,{ref:y,className:o("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...l,children:[e.jsx(x,{}),e.jsx(v,{className:o("p-2",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(h,{})]})}));B.displayName=i.displayName;const k=r.forwardRef(({className:t,...s},a)=>e.jsx(f,{ref:a,className:o("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...s}));k.displayName=f.displayName;const z=r.forwardRef(({className:t,children:s,...a},l)=>e.jsxs(c,{ref:l,className:o("relative flex w-full cursor-default select-none items-center rounded-xl py-2 pl-8 pr-3 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(R,{children:e.jsx(w,{className:"h-4 w-4"})})}),e.jsx(C,{children:s})]}));z.displayName=c.displayName;const D=r.forwardRef(({className:t,...s},a)=>e.jsx(u,{ref:a,className:o("-mx-1 my-1 h-px bg-muted",t),...s}));D.displayName=u.displayName;export{U as S,I as a,L as b,B as c,z as d};
1
+ import{r,j as e,al as d,a2 as w,ak as N}from"./vendor-5iCEqDpV.js";import{r as g,V as j,s as n,t as b,u as S,v as i,w as v,x as c,y as R,z as C,A as m,B as p,D as f,E as u}from"./radix-CmyU-WBH.js";import{c as o}from"./index-CYeQpt9d.js";const U=g,L=j,I=r.forwardRef(({className:t,children:s,...a},l)=>e.jsxs(n,{ref:l,className:o("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground transition-all focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[s,e.jsx(b,{asChild:!0,children:e.jsx(d,{className:"h-4 w-4 opacity-50"})})]}));I.displayName=n.displayName;const x=r.forwardRef(({className:t,...s},a)=>e.jsx(m,{ref:a,className:o("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(N,{className:"h-4 w-4"})}));x.displayName=m.displayName;const h=r.forwardRef(({className:t,...s},a)=>e.jsx(p,{ref:a,className:o("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(d,{className:"h-4 w-4"})}));h.displayName=p.displayName;const B=r.forwardRef(({className:t,children:s,position:a="popper",...l},y)=>e.jsx(S,{children:e.jsxs(i,{ref:y,className:o("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...l,children:[e.jsx(x,{}),e.jsx(v,{className:o("p-2",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(h,{})]})}));B.displayName=i.displayName;const k=r.forwardRef(({className:t,...s},a)=>e.jsx(f,{ref:a,className:o("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...s}));k.displayName=f.displayName;const z=r.forwardRef(({className:t,children:s,...a},l)=>e.jsxs(c,{ref:l,className:o("relative flex w-full cursor-default select-none items-center rounded-xl py-2 pl-8 pr-3 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(R,{children:e.jsx(w,{className:"h-4 w-4"})})}),e.jsx(C,{children:s})]}));z.displayName=c.displayName;const D=r.forwardRef(({className:t,...s},a)=>e.jsx(u,{ref:a,className:o("-mx-1 my-1 h-px bg-muted",t),...s}));D.displayName=u.displayName;export{U as S,I as a,L as b,B as c,z as d};
@@ -1 +1 @@
1
- import{r as i,j as e}from"./vendor-5iCEqDpV.js";import{p as r,q as n}from"./radix-CmyU-WBH.js";import{c as s}from"./index-BzuBtvAC.js";const c=i.forwardRef(({className:a,...t},o)=>e.jsx(r,{className:s("peer inline-flex h-7 w-12 shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-[inset_0_0_0_1px_rgba(15,23,42,0.06)] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...t,ref:o,children:e.jsx(n,{className:s("pointer-events-none block h-6 w-6 rounded-full bg-background shadow-[0_3px_10px_rgba(15,23,42,0.18)] ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));c.displayName=r.displayName;export{c as S};
1
+ import{r as i,j as e}from"./vendor-5iCEqDpV.js";import{p as r,q as n}from"./radix-CmyU-WBH.js";import{c as s}from"./index-CYeQpt9d.js";const c=i.forwardRef(({className:a,...t},o)=>e.jsx(r,{className:s("peer inline-flex h-7 w-12 shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-[inset_0_0_0_1px_rgba(15,23,42,0.06)] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...t,ref:o,children:e.jsx(n,{className:s("pointer-events-none block h-6 w-6 rounded-full bg-background shadow-[0_3px_10px_rgba(15,23,42,0.18)] ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));c.displayName=r.displayName;export{c as S};
@@ -1 +1 @@
1
- import{aC as o}from"./vendor-5iCEqDpV.js";import{a as u}from"./query-DxhDvnDC.js";import{r as s,t as i}from"./index-BzuBtvAC.js";function m(r,e,a){return u({queryKey:r,placeholderData:o,...a,queryFn:async()=>{try{return await s(e)}catch(t){throw i(t)}}})}export{m as u};
1
+ import{aC as o}from"./vendor-5iCEqDpV.js";import{a as u}from"./query-DxhDvnDC.js";import{r as s,t as i}from"./index-CYeQpt9d.js";function m(r,e,a){return u({queryKey:r,placeholderData:o,...a,queryFn:async()=>{try{return await s(e)}catch(t){throw i(t)}}})}export{m as u};
@@ -0,0 +1 @@
1
+ import{u as o,b as q}from"./query-DxhDvnDC.js";import{u as x,t as y}from"./index-CYeQpt9d.js";function j({mutationFn:C,successToast:a,errorToast:p,invalidateKeys:n,onSuccess:m,onError:f,...M}){const Q=o(),{pushToast:A}=x();return q({...M,mutationFn:async t=>{try{return await C(t)}catch(u){throw y(u)}},onSuccess:async(t,u,w,h)=>{n!=null&&n.length&&await Promise.all(n.map(g=>Q.invalidateQueries({queryKey:g})));const i=a==null?void 0:a(t,u);i&&A({...i,variant:"success"}),await(m==null?void 0:m(t,u,w,h))},onError:async(t,u,w,h)=>{const i=p==null?void 0:p(t,u);i&&A({...i,variant:"error"}),await(f==null?void 0:f(t,u,w,h))}})}export{j as u};
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
6
6
  <meta name="format-detection" content="telephone=no" />
7
7
  <title>cc-gw 控制台</title>
8
- <script type="module" crossorigin src="/assets/index-BzuBtvAC.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-CYeQpt9d.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/vendor-5iCEqDpV.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/query-DxhDvnDC.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/i18n-C7VVFIdN.js">
@@ -1 +0,0 @@
1
- import{r as c,j as e,ab as P,aA as T,aB as u,aj as B,Z as R}from"./vendor-5iCEqDpV.js";import{P as q}from"./PageHeader-CSF0BWul.js";import{P as m}from"./PageSection-Bp_SuEp0.js";import{P as A,a as C}from"./PageState-BeXrzVEe.js";import{u as I}from"./useApiQuery-fBWRSgFK.js";import{u as V,B as p}from"./index-BzuBtvAC.js";import{q as F}from"./queryKeys-BMvyDTQS.js";import{B as o}from"./badge-BvMdmUqJ.js";import{C as l,a as n}from"./card-CjhYPqKk.js";import{u as G}from"./i18n-C7VVFIdN.js";import"./query-DxhDvnDC.js";import"./router-D8u_RlVh.js";import"./radix-CmyU-WBH.js";const z="0.8.2",M={version:z};function ae(){var b,h,f,j,v,g,N,y,w,k;const{t:a}=G(),{pushToast:s}=V(),t=I(F.status.gateway(),{url:"/api/status",method:"GET"},{staleTime:6e4});c.useEffect(()=>{t.isError&&t.error&&s({title:a("about.toast.statusError.title"),description:t.error.message,variant:"error"})},[s,t.error,t.isError,a]);const i=M.version,d="2026-03-30T03:46:10.391Z",L=c.useMemo(()=>{var r,S;return[{label:a("about.app.labels.name"),value:e.jsx("span",{className:"font-mono",children:"cc-gw"})},{label:a("about.app.labels.version"),value:e.jsxs("span",{"data-visual-volatile":"true",className:"font-mono text-primary",children:["v",i]})},{label:a("about.app.labels.buildTime"),value:e.jsx("span",{"data-visual-volatile":"true",children:d}),hint:a("about.app.hint.buildTime")},{label:a("about.app.labels.runtime"),value:e.jsx("span",{className:"font-mono",children:((r=t.data)==null?void 0:r.runtime)??"rust"})},{label:a("about.app.labels.backendVersion"),value:e.jsx("span",{"data-visual-volatile":"true",className:"font-mono",children:((S=t.data)==null?void 0:S.backendVersion)??"-"})}]},[i,d,(b=t.data)==null?void 0:b.backendVersion,(h=t.data)==null?void 0:h.runtime,a]),x=c.useMemo(()=>{var r;return t.data?[{label:a("about.status.labels.host"),value:t.data.host??"127.0.0.1"},{label:a("about.status.labels.port"),value:e.jsx("span",{"data-visual-volatile":"true",children:t.data.port.toLocaleString()})},{label:a("about.status.labels.providers"),value:t.data.providers.toLocaleString()},{label:a("about.status.labels.active"),value:(t.data.activeRequests??0).toLocaleString(),hint:a("about.status.hint.active")},{label:a("about.status.labels.platform"),value:t.data.platform??"-"},{label:a("about.status.labels.pid"),value:e.jsx("span",{"data-visual-volatile":"true",children:((r=t.data.pid)==null?void 0:r.toLocaleString())??"-"})}]:[]},[t.data,a]);return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(q,{icon:e.jsx(T,{className:"h-5 w-5","aria-hidden":"true"}),title:a("about.title"),description:a("about.description"),badge:e.jsxs("span",{"data-visual-volatile":"true",children:["v",i]}),eyebrow:"Runtime",breadcrumb:"Gateway / About",helper:a("about.support.description"),actions:e.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:flex-wrap sm:justify-end",children:[e.jsx("div",{className:"rounded-lg border border-border bg-secondary px-3 py-2 text-xs text-muted-foreground",children:"manual refresh only"}),e.jsxs(p,{onClick:()=>s({title:a("about.toast.updatesPlanned"),variant:"info"}),className:"w-full sm:w-auto",children:[e.jsx(P,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),a("about.support.actions.checkUpdates")]})]})}),e.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.3fr)_minmax(320px,0.9fr)]",children:[e.jsx(l,{className:"overflow-hidden",children:e.jsx(n,{className:"pt-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-primary/20 bg-accent px-3 py-1 text-xs font-semibold uppercase tracking-wider text-primary",children:[e.jsx(u,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Runtime snapshot"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{"data-visual-volatile":"true",className:"text-3xl font-semibold tracking-tight text-foreground",children:[((f=t.data)==null?void 0:f.host)??"127.0.0.1",":",((j=t.data)==null?void 0:j.port)??"-"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("about.description")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(o,{variant:"outline",children:((v=t.data)==null?void 0:v.runtime)??"rust"}),e.jsx(o,{variant:"outline",children:((g=t.data)==null?void 0:g.platform)??"-"}),e.jsxs(o,{variant:"secondary",children:[a("about.status.labels.providers"),": ",((y=(N=t.data)==null?void 0:N.providers)==null?void 0:y.toLocaleString())??"-"]}),e.jsxs(o,{variant:"secondary",children:[a("about.status.labels.active"),": ",(((w=t.data)==null?void 0:w.activeRequests)??0).toLocaleString()]})]})]})})}),e.jsx(l,{className:"overflow-hidden",children:e.jsx(n,{className:"pt-6",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Build"}),e.jsxs("p",{"data-visual-volatile":"true",className:"font-mono text-lg text-primary",children:["v",i]}),e.jsx("p",{"data-visual-volatile":"true",className:"text-sm text-muted-foreground",children:d}),e.jsx("div",{className:"rounded-lg border border-border bg-secondary px-4 py-3 text-sm text-muted-foreground",children:a("about.support.tip")})]})})})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsx(m,{title:a("about.app.title"),description:a("about.app.subtitle"),children:e.jsx(E,{items:L})}),e.jsx(m,{title:a("about.status.title"),description:a("about.status.subtitle"),actions:e.jsxs(p,{variant:"outline",size:"sm",onClick:()=>void t.refetch(),disabled:t.isFetching,children:[e.jsx(B,{className:Q(t.isFetching),"aria-hidden":"true"}),t.isFetching?a("common.actions.refreshing"):a("common.actions.refresh")]}),children:t.isLoading?e.jsx(A,{compact:!0,label:a("about.status.loading")}):t.isError?e.jsx(C,{compact:!0,tone:"danger",icon:e.jsx(u,{className:"h-5 w-5","aria-hidden":"true"}),title:a("common.status.error"),description:((k=t.error)==null?void 0:k.message)??a("common.unknownError"),action:e.jsx(p,{variant:"outline",size:"sm",onClick:()=>void t.refetch(),children:a("common.actions.refresh")})}):x.length>0?e.jsx(E,{items:x}):e.jsx(C,{compact:!0,tone:"primary",icon:e.jsx(u,{className:"h-5 w-5","aria-hidden":"true"}),title:a("about.status.empty"),description:a("common.actions.refresh")})})]}),e.jsx(m,{title:a("about.support.title"),description:e.jsxs("span",{className:"space-y-1",children:[e.jsx("span",{className:"block text-sm font-medium text-primary",children:a("about.support.subtitle")}),e.jsx("span",{children:a("about.support.description")})]}),children:e.jsx(l,{children:e.jsxs(n,{className:"flex flex-col gap-4 pt-5 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-2xl bg-primary/10 text-primary",children:e.jsx(R,{className:"h-5 w-5","aria-hidden":"true"})}),e.jsx("p",{className:"max-w-2xl text-sm text-muted-foreground",children:a("about.support.tip")})]}),e.jsx("code",{className:"inline-flex self-start rounded-lg border border-border bg-secondary px-3 py-2 text-xs font-medium",children:"~/.cc-gw/config.json"})]})})})]})}function E({items:a}){return a.length===0?null:e.jsx("dl",{className:"grid gap-4 sm:grid-cols-2",children:a.map(s=>e.jsx(l,{children:e.jsxs(n,{className:"pt-5",children:[e.jsx("dt",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:s.label}),e.jsx("dd",{className:"mt-2 text-sm font-semibold text-foreground",children:s.value}),s.hint?e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s.hint}):null]})},s.label))})}function Q(a){return`mr-2 h-4 w-4${a?" animate-spin":""}`}export{ae as default};
@@ -1 +0,0 @@
1
- import{r as c,j as e,a2 as Ze,au as ve,W as Ke,av as Ne,aw as we,ax as es,ay as ss,as}from"./vendor-5iCEqDpV.js";import{c as se,r as ts,h as B,b as U,B as K,u as ns,a as _,s as J,L as rs}from"./index-BzuBtvAC.js";import{P as is}from"./PageHeader-CSF0BWul.js";import{C as ls,u as z}from"./useAppMutation-Cd6HN12q.js";import{D as ae,A as te,a as ne,b as re,c as Ce,d as ie,e as le}from"./DialogShell-CiIvBp8J.js";import{I as $}from"./input-BnFZKjRM.js";import{L as O}from"./label-i5-Lf72z.js";import{u as H}from"./useApiQuery-fBWRSgFK.js";import{q as v}from"./queryKeys-BMvyDTQS.js";import{u as N}from"./i18n-C7VVFIdN.js";import{E as os}from"./EChart-VRAvk6sX.js";import{P as oe}from"./PageSection-Bp_SuEp0.js";import{B as C}from"./badge-BvMdmUqJ.js";import{C as de,a as ce}from"./card-CjhYPqKk.js";import{e as ds}from"./charts-core-C-3-Lo7l.js";import{c as cs}from"./clipboard-CALi6bTW.js";import"./query-DxhDvnDC.js";import"./router-D8u_RlVh.js";import"./radix-CmyU-WBH.js";import"./charts-react-DJ_0LNAP.js";import"./charts-engine-BI1CmRJo.js";const Ee=c.forwardRef(({className:s,...a},i)=>e.jsx("textarea",{className:se("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s),ref:i,...a}));Ee.displayName="Textarea";const A={listRequest(){return{url:"/api/keys",method:"GET"}},overviewRequest(s){return{url:"/api/stats/api-keys/overview",method:"GET",params:{days:s}}},usageRequest(s,a=10){return{url:"/api/stats/api-keys/usage",method:"GET",params:{days:s,limit:a}}},customEndpointOptionsRequest(){return{url:"/api/custom-endpoints",method:"GET"}},create:async s=>B(U.post("/api/keys",s)),update:async(s,a)=>{await B(U.patch(`/api/keys/${s}`,a))},delete:async s=>{await B(U.delete(`/api/keys/${s}`))},reveal:async s=>ts({url:`/api/keys/${s}/reveal`,method:"GET"})},ke=[{value:1,labelKey:"apiKeys.analytics.range.today"},{value:7,labelKey:"apiKeys.analytics.range.week"},{value:30,labelKey:"apiKeys.analytics.range.month"}];function ps(){var i;const s=[{id:"anthropic",label:"Anthropic"},{id:"openai",label:"OpenAI"}],a=H(v.customEndpoints.all(),A.customEndpointOptionsRequest());return c.useMemo(()=>{var l;const t=(((l=a.data)==null?void 0:l.endpoints)??[]).map(u=>({id:u.id,label:u.label||u.id}));return[...s,...t]},[(i=a.data)==null?void 0:i.endpoints])}function De({available:s,hint:a,onChange:i,selected:t}){const{t:l}=N(),u=t.length===0,g=()=>{i([])},j=o=>{if(t.includes(o)){i(t.filter(p=>p!==o));return}i([...t,o])};return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"rounded-lg border border-border bg-secondary px-3 py-3 text-xs text-muted-foreground",children:a}),e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-lg border border-border bg-card px-3 py-2.5 transition-colors hover:border-primary/20 hover:bg-accent/50",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:g,className:"h-4 w-4 rounded border-input accent-primary"}),e.jsx("span",{className:"text-sm font-medium",children:l("apiKeys.allEndpoints")})]}),e.jsx("div",{className:"grid max-h-40 gap-1 overflow-y-auto",children:s.map(o=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-lg border border-border bg-card px-3 py-2.5 transition-colors hover:border-primary/20 hover:bg-accent/50",children:[e.jsx("input",{type:"checkbox",checked:!u&&t.includes(o.id),onChange:()=>j(o.id),className:"h-4 w-4 rounded border-input accent-primary"}),e.jsx("span",{className:"text-sm",children:o.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",o.id,")"]})]},o.id))})]})}function us({availableEndpoints:s,isOpen:a,keyDescription:i,keyName:t,maxConcurrency:l,onDescriptionChange:u,onEndpointsChange:g,onKeyNameChange:j,onMaxConcurrencyChange:o,onOpenChange:p,onSubmit:y,selectedEndpoints:r}){const{t:x}=N();return e.jsx(ae,{open:a,onOpenChange:p,children:e.jsxs(te,{className:"max-w-2xl",children:[e.jsxs(ne,{children:[e.jsx(re,{children:x("apiKeys.createNew")}),e.jsx(Ce,{children:x("apiKeys.createDescription")})]}),e.jsxs(ie,{className:"space-y-4",children:[e.jsx("div",{className:"rounded-lg border border-primary/20 bg-accent px-4 py-3 text-xs text-primary",children:x("apiKeys.selectEndpoints")}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"rounded-[1rem] border border-blue-200 bg-blue-50/70 px-3 py-3 text-xs text-blue-900 dark:border-blue-800 dark:bg-blue-950/30 dark:text-blue-100",children:[e.jsx("p",{className:"font-semibold",children:"Restricted"}),e.jsx("p",{className:"mt-1 text-blue-800/85 dark:text-blue-100/80",children:"Select explicit endpoints before saving."})]}),e.jsxs("div",{className:"rounded-[1rem] border border-amber-200 bg-amber-50/70 px-3 py-3 text-xs text-amber-900 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-100",children:[e.jsx("p",{className:"font-semibold",children:"Unrestricted"}),e.jsx("p",{className:"mt-1 text-amber-800/85 dark:text-amber-100/80",children:"Leave endpoint selection empty for broad access."})]}),e.jsxs("div",{className:"rounded-[1rem] border border-rose-200 bg-rose-50/70 px-3 py-3 text-xs text-rose-900 dark:border-rose-800 dark:bg-rose-950/30 dark:text-rose-100",children:[e.jsx("p",{className:"font-semibold",children:"Wildcard"}),e.jsx("p",{className:"mt-1 text-rose-800/85 dark:text-rose-100/80",children:"Special-case key with the highest blast radius."})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(O,{htmlFor:"keyName",children:[x("apiKeys.keyNamePlaceholder")," *"]}),e.jsx($,{id:"keyName",value:t,onChange:h=>j(h.target.value),placeholder:x("apiKeys.keyNamePlaceholder"),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),y())}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"keyDescription",children:x("apiKeys.descriptionLabel")}),e.jsx(Ee,{id:"keyDescription",value:i,onChange:h=>u(h.target.value),placeholder:x("apiKeys.keyDescriptionPlaceholder"),rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{children:x("apiKeys.allowedEndpoints")}),e.jsx(De,{available:s,selected:r,onChange:g,hint:x("apiKeys.selectEndpoints")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"maxConcurrency",children:x("apiKeys.maxConcurrency")}),e.jsx($,{id:"maxConcurrency",type:"number",min:"0",value:l,onChange:h=>o(h.target.value),placeholder:x("apiKeys.maxConcurrencyPlaceholder")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:x("apiKeys.maxConcurrencyHelper")})]})]}),e.jsxs(le,{children:[e.jsx(K,{variant:"outline",onClick:()=>p(!1),children:x("common.actions.cancel")}),e.jsx(K,{onClick:y,children:x("apiKeys.createAction")})]})]})})}function xs({createdKey:s,onClose:a,onCopy:i}){const{t}=N();return e.jsx(ae,{open:!!s,onOpenChange:l=>{l||a()},children:e.jsxs(te,{className:"max-w-xl",children:[e.jsx(ne,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-600",children:e.jsx(Ze,{className:"h-5 w-5","aria-hidden":"true"})}),e.jsx(re,{children:t("apiKeys.keyCreated")})]})}),e.jsxs(ie,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:t("apiKeys.saveKeyWarning")}),e.jsx("div",{className:"rounded-lg border border-border bg-secondary px-4 py-3 font-mono text-sm",children:s==null?void 0:s.key}),s!=null&&s.description?e.jsx("p",{className:"whitespace-pre-wrap text-sm text-muted-foreground",children:s.description}):null]}),e.jsxs(le,{children:[e.jsxs(K,{onClick:()=>i((s==null?void 0:s.key)??""),children:[e.jsx(ve,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),t("common.actions.copy")]}),e.jsx(K,{variant:"outline",onClick:a,children:t("common.actions.close")})]})]})})}function ms({apiKey:s,availableEndpoints:a,maxConcurrency:i,onClose:t,onEndpointsChange:l,onMaxConcurrencyChange:u,onSave:g,selectedEndpoints:j}){const{t:o}=N();return e.jsx(ae,{open:!!s,onOpenChange:p=>{p||t()},children:e.jsxs(te,{className:"max-w-2xl",children:[e.jsxs(ne,{children:[e.jsx(re,{children:o("apiKeys.editEndpoints")}),e.jsx(Ce,{children:s==null?void 0:s.name})]}),e.jsxs(ie,{className:"space-y-4",children:[!(s!=null&&s.isWildcard)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"rounded-lg border border-[hsl(var(--warning)/0.3)] bg-[hsl(var(--warning-bg))] px-4 py-3 text-xs text-[hsl(var(--warning)/1)]",children:o("apiKeys.allEndpoints")}),e.jsx("div",{className:"rounded-lg border border-border bg-secondary px-4 py-3 text-xs text-muted-foreground",children:"Empty selection means unrestricted access. Only explicit selections create a restricted key scope."}),e.jsx(De,{available:a,selected:j,onChange:l,hint:o("apiKeys.selectEndpoints")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"editMaxConcurrency",children:o("apiKeys.maxConcurrency")}),e.jsx($,{id:"editMaxConcurrency",type:"number",min:"0",value:i,onChange:p=>u(p.target.value),placeholder:o("apiKeys.maxConcurrencyPlaceholder")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:o("apiKeys.maxConcurrencyHelper")})]})]}),e.jsxs(le,{children:[e.jsx(K,{variant:"outline",onClick:t,children:o("common.actions.cancel")}),e.jsx(K,{onClick:g,children:o("common.save")})]})]})})}function ys({deleteTarget:s,isDeleting:a,onConfirm:i,onOpenChange:t}){const{t:l}=N();return e.jsx(ls,{open:!!s,onOpenChange:t,title:l("apiKeys.deleteDialogTitle"),description:l("apiKeys.confirmDelete"),confirmLabel:s&&a===s.id?l("common.actions.loading"):l("apiKeys.actions.delete"),cancelLabel:l("common.actions.cancel"),loading:s?a===s.id:!1,onConfirm:i,children:s?e.jsx("div",{className:"rounded-lg border border-destructive/20 bg-destructive/10 px-3 py-2 font-mono text-xs text-foreground",children:s.name}):null})}function hs(){const{t:s}=N();return e.jsx(oe,{eyebrow:"Recommended",title:s("apiKeys.quickStart.title"),description:s("apiKeys.quickStart.description"),contentClassName:"pt-5",children:e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(X,{icon:e.jsx(Ke,{className:"h-4 w-4","aria-hidden":"true"}),title:s("apiKeys.quickStart.create.title"),description:s("apiKeys.quickStart.create.description")}),e.jsx(X,{icon:e.jsx(Ne,{className:"h-4 w-4","aria-hidden":"true"}),title:s("apiKeys.quickStart.restrict.title"),description:s("apiKeys.quickStart.restrict.description")}),e.jsx(X,{icon:e.jsx(we,{className:"h-4 w-4","aria-hidden":"true"}),title:s("apiKeys.quickStart.wildcard.title"),description:s("apiKeys.quickStart.wildcard.description")})]})})}function gs({activeKeysValue:s,enabledKeysValue:a,loading:i,onRangeChange:t,rangeDays:l,requestsChartOption:u,totalKeysValue:g,tokensChartOption:j,usageLength:o}){const{t:p}=N();return e.jsx(oe,{eyebrow:"Usage",title:p("apiKeys.analytics.title"),description:p("apiKeys.analytics.description",{days:l}),actions:e.jsx("div",{className:"flex w-full items-center gap-1 overflow-x-auto rounded-full border border-border bg-secondary p-1 sm:w-auto",children:ke.map(y=>{const r=l===y.value;return e.jsx("button",{type:"button",onClick:()=>t(y.value),className:se("inline-flex h-8 shrink-0 items-center rounded-full px-3.5 text-xs font-medium transition-all",r?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-primary/5 hover:text-foreground"),children:p(y.labelKey)},y.value)})}),children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(Y,{label:p("apiKeys.analytics.cards.total"),value:g}),e.jsx(Y,{label:p("apiKeys.analytics.cards.enabled"),value:a}),e.jsx(Y,{label:p("apiKeys.analytics.cards.active",{days:l}),value:s})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsx(fe,{title:p("apiKeys.analytics.charts.requests"),loading:i,empty:o===0,emptyText:p("apiKeys.analytics.empty"),option:u}),e.jsx(fe,{title:p("apiKeys.analytics.charts.tokens"),loading:i,empty:o===0,emptyText:p("apiKeys.analytics.empty"),option:j})]})]})})}function bs({filteredKeys:s,formatDate:a,hasWildcard:i,isDeleting:t,isRevealing:l,keys:u,onCopy:g,onDelete:j,onEditEndpoints:o,onFilterChange:p,onHide:y,onReveal:r,onStatusFilterChange:x,onToggleEnabled:h,restrictedCount:E,revealedKeys:T,search:w,statusFilter:q,unrestrictedCount:f,wildcardCount:M}){const{t:m}=N();return e.jsx(oe,{eyebrow:"Inventory",title:m("apiKeys.list.title"),description:i?m("apiKeys.wildcardHint"):void 0,actions:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(C,{variant:"outline",children:`${s.length}/${u.length}`}),e.jsx(C,{variant:"outline",children:m("apiKeys.summary.wildcard",{count:M})}),e.jsx(C,{variant:"outline",children:m("apiKeys.summary.restricted",{count:E})})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(Z,{label:m("apiKeys.list.title"),value:`${s.length}/${u.length}`,helper:m("apiKeys.filters.searchPlaceholder")}),e.jsx(Z,{label:m("apiKeys.summary.wildcard",{count:M}),value:String(M),helper:m("apiKeys.wildcardHint")}),e.jsx(Z,{label:m("apiKeys.summary.restricted",{count:E}),value:String(E),helper:m("apiKeys.summary.unrestricted",{count:f})})]}),e.jsxs("div",{className:"grid gap-3 rounded-lg border border-border bg-secondary p-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,360px)] xl:grid-cols-[minmax(0,1fr)_180px_auto]",children:[e.jsx($,{value:w,onChange:b=>p(b.target.value),placeholder:m("apiKeys.filters.searchPlaceholder")}),e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto rounded-full border border-border bg-secondary p-1",children:["all","enabled","disabled"].map(b=>e.jsx("button",{type:"button",onClick:()=>x(b),className:se("inline-flex h-8 shrink-0 items-center rounded-full px-3.5 text-xs font-medium transition-all",q===b?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-primary/5 hover:text-foreground"),children:m(`apiKeys.filters.${b}`)},b))}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 lg:col-span-2 xl:col-span-1",children:[e.jsx(C,{variant:"secondary",children:m("apiKeys.summary.wildcard",{count:M})}),e.jsx(C,{variant:"secondary",children:m("apiKeys.summary.restricted",{count:E})})]})]}),u.length===0?e.jsx("div",{className:"flex h-32 items-center justify-center rounded-lg border border-dashed border-border",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:m("apiKeys.list.empty")})}):s.length===0?e.jsx("div",{className:"flex h-32 items-center justify-center rounded-lg border border-dashed border-border",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:m("apiKeys.list.emptyFiltered")})}):e.jsx("div",{className:"grid gap-4",children:s.map(b=>e.jsx(js,{formatDate:a,isDeleting:t===b.id,isRevealing:l===b.id,keySummary:b,onCopy:g,onDelete:j,onEditEndpoints:o,onHide:y,onReveal:r,onToggleEnabled:h,revealedValue:T.get(b.id)},b.id))})]})})}function X({description:s,icon:a,title:i}){return e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10 text-primary",children:a}),e.jsx("p",{className:"mt-3 text-sm font-semibold text-foreground",children:i}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s})]})}function js({formatDate:s,isDeleting:a,isRevealing:i,keySummary:t,onCopy:l,onDelete:u,onEditEndpoints:g,onHide:j,onReveal:o,onToggleEnabled:p,revealedValue:y}){var h,E,T,w;const{t:r}=N(),x=(t.totalInputTokens+t.totalOutputTokens).toLocaleString();return t.isWildcard||(((h=t.allowedEndpoints)==null?void 0:h.length)??0)>0,e.jsx(de,{"data-testid":"api-key-card",children:e.jsx(ce,{className:"space-y-4 pt-4",children:e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{className:"min-w-0 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h3",{className:"text-base font-semibold",children:t.name}),t.isWildcard?e.jsx(C,{variant:"secondary",children:r("apiKeys.wildcard")}):null,e.jsx(C,{variant:t.enabled?"default":"outline",children:t.enabled?r("apiKeys.status.enabled"):r("apiKeys.status.disabled")}),t.isWildcard?null:e.jsx(C,{variant:"outline",className:"text-xs",children:(((E=t.allowedEndpoints)==null?void 0:E.length)??0)>0?r("apiKeys.endpointRestricted"):r("apiKeys.allEndpoints")}),!t.isWildcard&&t.allowedEndpoints&&t.allowedEndpoints.length>0?t.allowedEndpoints.map(q=>e.jsx(C,{variant:"outline",className:"text-xs",children:q},q)):t.isWildcard?null:e.jsx(C,{variant:"secondary",className:"text-xs opacity-60",children:r("apiKeys.allEndpoints")})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-3",children:[e.jsx(ee,{label:r("apiKeys.requestCount"),value:t.requestCount.toLocaleString()}),e.jsx(ee,{label:r("apiKeys.totalTokens"),value:x}),e.jsx(ee,{label:r("apiKeys.maxConcurrency"),value:t.maxConcurrency?String(t.maxConcurrency):r("apiKeys.maxConcurrencyPlaceholder")})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx("code",{className:"block max-w-full break-all rounded-lg border border-border bg-secondary px-3 py-1.5 font-mono text-sm",children:t.isWildcard?r("apiKeys.wildcard"):y??t.maskedKey??"********"}),t.isWildcard?null:e.jsx("div",{className:"flex items-center gap-1 self-start",children:y?e.jsxs(e.Fragment,{children:[e.jsx(K,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>l(y),"aria-label":r("common.actions.copy"),title:r("common.actions.copy"),children:e.jsx(ve,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsx(K,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>j(t.id),"aria-label":r("apiKeys.actions.hide"),title:r("apiKeys.actions.hide"),children:e.jsx(we,{className:"h-4 w-4","aria-hidden":"true"})})]}):e.jsx(K,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>o(t.id),disabled:i,"aria-label":r("apiKeys.actions.reveal"),title:r("apiKeys.actions.reveal"),children:i?e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary border-t-transparent"}):e.jsx(es,{className:"h-4 w-4","aria-hidden":"true"})})})]}),t.isWildcard?e.jsx("p",{className:"text-sm text-muted-foreground",children:r("apiKeys.wildcardHint")}):t.description?e.jsx("p",{className:"whitespace-pre-wrap text-sm text-muted-foreground",children:t.description}):null,t.isWildcard?null:e.jsx("div",{className:"rounded-lg border border-border bg-secondary px-3 py-2 text-xs text-muted-foreground",children:(((T=t.allowedEndpoints)==null?void 0:T.length)??0)>0?`${r("apiKeys.allowedEndpoints")}: ${(w=t.allowedEndpoints)==null?void 0:w.join(", ")}`:r("apiKeys.allEndpoints")}),e.jsxs("div",{className:"grid gap-3 text-sm sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:r("apiKeys.created")}),e.jsx("p",{className:"font-medium",children:s(t.createdAt)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:r("apiKeys.lastUsed")}),e.jsx("p",{className:"font-medium",children:s(t.lastUsedAt)})]})]})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:flex lg:flex-wrap lg:justify-end",children:[e.jsxs(K,{variant:"outline",size:"sm",onClick:()=>g(t),className:"w-full lg:w-auto",children:[e.jsx(Ne,{className:"mr-1 h-3.5 w-3.5","aria-hidden":"true"}),t.isWildcard?r("apiKeys.maxConcurrency"):r("apiKeys.editEndpoints")]}),e.jsx(K,{variant:t.enabled?"outline":"default",size:"sm",onClick:()=>p(t.id,t.enabled),className:"w-full lg:w-auto",children:t.enabled?r("apiKeys.actions.disable"):r("apiKeys.actions.enable")}),t.isWildcard?null:e.jsx(K,{variant:"ghost",size:"icon",className:"h-9 w-full text-destructive hover:bg-destructive/10 hover:text-destructive sm:w-9",onClick:()=>u(t),disabled:a,"aria-label":r("apiKeys.actions.delete"),children:e.jsx(ss,{className:"h-4 w-4","aria-hidden":"true"})})]})]})})})}function Y({label:s,value:a}){return e.jsx(de,{children:e.jsxs(ce,{className:"pt-4",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:s}),e.jsx("p",{className:"mt-2 text-2xl font-semibold text-foreground",children:a})]})})}function Z({helper:s,label:a,value:i}){return e.jsxs("div",{className:"rounded-lg border border-border bg-card px-4 py-3",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:a}),e.jsx("p",{className:"mt-2 text-lg font-semibold text-foreground",children:i}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s})]})}function ee({label:s,value:a}){return e.jsxs("div",{className:"rounded-lg border border-border bg-secondary px-3 py-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-[0.16em] text-muted-foreground",children:s}),e.jsx("p",{className:"mt-1 truncate text-sm font-medium",children:a})]})}function fe({empty:s,emptyText:a,loading:i,option:t,title:l}){const{t:u}=N();return e.jsx(de,{children:e.jsxs(ce,{className:"space-y-4 pt-4",children:[e.jsx("h3",{className:"text-base font-semibold",children:l}),i?e.jsx("div",{className:"flex h-[280px] items-center justify-center",children:e.jsx("span",{className:"text-sm text-muted-foreground",children:u("common.loadingShort")})}):s?e.jsx("div",{className:"flex h-[280px] items-center justify-center rounded-lg border border-dashed border-border",children:e.jsx("span",{className:"text-sm text-muted-foreground",children:a})}):e.jsx(os,{echarts:ds,option:t,style:{height:280},notMerge:!0,lazyUpdate:!0})]})})}function fs(){const{t:s}=N(),{pushToast:a}=ns(),[i,t]=c.useState(!1),[l,u]=c.useState(""),[g,j]=c.useState(""),[o,p]=c.useState([]),[y,r]=c.useState(""),[x,h]=c.useState(null),[E,T]=c.useState(null),[w,q]=c.useState(null),[f,M]=_(J.apiKeys.rangeDays,7,{serialize:n=>String(n),deserialize:n=>{const d=Number(n);return ke.some(k=>k.value===d)?d:7}}),[m,b]=c.useState(new Map),[Ae,pe]=c.useState(null),[F,Q]=c.useState(null),[W,ue]=c.useState([]),[L,xe]=c.useState(""),[V,Te]=_(J.apiKeys.search,""),[P,qe]=_(J.apiKeys.statusFilter,"all",{serialize:n=>n,deserialize:n=>n==="enabled"||n==="disabled"?n:"all"}),Se=ps(),me=H(v.apiKeys.all(),A.listRequest()),Me=H(v.apiKeys.overview(f),A.overviewRequest(f)),ye=H(v.apiKeys.usage(f),A.usageRequest(f)),he=z({mutationFn:A.create,invalidateKeys:[v.apiKeys.all(),v.apiKeys.overview(f),v.apiKeys.usage(f)],successToast:()=>({title:s("apiKeys.toast.keyCreated")}),errorToast:n=>({title:s("apiKeys.toast.createFailure",{message:n.message})})}),I=z({mutationFn:({id:n,...d})=>A.update(n,d),invalidateKeys:[v.apiKeys.all(),v.apiKeys.overview(f),v.apiKeys.usage(f)],successToast:()=>({title:s("apiKeys.toast.keyUpdated")}),errorToast:n=>({title:s("apiKeys.toast.updateFailure",{message:n.message})})}),ge=z({mutationFn:({id:n})=>A.delete(n),invalidateKeys:[v.apiKeys.all(),v.apiKeys.overview(f),v.apiKeys.usage(f)],successToast:()=>({title:s("apiKeys.toast.keyDeleted")}),errorToast:n=>({title:s("apiKeys.toast.deleteFailure",{message:n.message})})}),be=z({mutationFn:({id:n})=>A.reveal(n),errorToast:n=>({title:s("apiKeys.toast.revealFailure"),description:n.message})}),S=me.data??[],R=Me.data,D=ye.data??[],Re=S.some(n=>n.isWildcard),Fe=S.filter(n=>n.isWildcard).length,Oe=S.filter(n=>{var d;return!n.isWildcard&&(((d=n.allowedEndpoints)==null?void 0:d.length)??0)>0}).length,We=S.filter(n=>{var d;return!n.isWildcard&&(((d=n.allowedEndpoints)==null?void 0:d.length)??0)===0}).length,Le=R?R.totalKeys.toLocaleString():"-",Pe=R?R.enabledKeys.toLocaleString():"-",Ie=R?R.activeKeys.toLocaleString():"-",ze=c.useMemo(()=>S.filter(n=>{if(!(P==="all"||(P==="enabled"?n.enabled:!n.enabled)))return!1;const k=V.trim().toLowerCase();return k?[n.name,n.description??"",n.maskedKey??"",...n.allowedEndpoints??[]].join(" ").toLowerCase().includes(k):!0}),[S,V,P]),He=c.useMemo(()=>{const n=D.map(d=>d.apiKeyName??s("apiKeys.analytics.unknownKey"));return{tooltip:{trigger:"axis"},grid:{left:60,right:20,top:40,bottom:40},xAxis:{type:"category",data:n,axisLabel:{interval:0,rotate:20}},yAxis:{type:"value"},series:[{name:s("apiKeys.analytics.requestsSeries"),type:"bar",data:D.map(d=>d.requests),itemStyle:{color:"hsl(var(--primary))"}}]}},[s,D]),$e=c.useMemo(()=>{const n=D.map(d=>d.apiKeyName??s("apiKeys.analytics.unknownKey"));return{tooltip:{trigger:"axis"},legend:{data:[s("apiKeys.analytics.tokens.input"),s("apiKeys.analytics.tokens.output")]},grid:{left:60,right:20,top:50,bottom:40},xAxis:{type:"category",data:n,axisLabel:{interval:0,rotate:20}},yAxis:{type:"value"},series:[{name:s("apiKeys.analytics.tokens.input"),type:"bar",stack:"tokens",itemStyle:{color:"#22c55e"},data:D.map(d=>d.inputTokens)},{name:s("apiKeys.analytics.tokens.output"),type:"bar",stack:"tokens",itemStyle:{color:"#0ea5e9"},data:D.map(d=>d.outputTokens)}]}},[s,D]),je=c.useCallback(()=>{u(""),j(""),p([]),r("")},[]),G=c.useCallback(n=>{t(n),n||je()},[je]),Qe=c.useCallback(async()=>{if(!l.trim()){a({title:s("apiKeys.errors.nameRequired"),variant:"error"});return}try{const n=await he.mutateAsync({name:l.trim(),description:g.trim()||void 0,allowedEndpoints:o.length>0?o:void 0,maxConcurrency:y?Number(y):null});h(n),G(!1)}catch{}},[he,G,g,o,y,l,a,s]),Ve=c.useCallback(async(n,d)=>{try{await I.mutateAsync({id:n,enabled:!d})}catch{}},[I]),Ge=c.useCallback(async()=>{if(w){T(w.id);try{await ge.mutateAsync({id:w.id}),q(null)}catch{}finally{T(null)}}},[w,ge]),Be=c.useCallback(async n=>{if(!m.has(n)){pe(n);try{const d=await be.mutateAsync({id:n});b(k=>new Map(k).set(n,d.key))}catch{}finally{pe(null)}}},[be,m]),Ue=c.useCallback(n=>{b(d=>{const k=new Map(d);return k.delete(n),k})},[]),_e=c.useCallback(async n=>{try{await cs(n),a({title:s("apiKeys.toast.keyCopied"),variant:"success"})}catch(d){a({title:s("apiKeys.toast.copyFailure"),description:d instanceof Error?d.message:s("common.unknownError"),variant:"error"})}},[a,s]),Je=c.useCallback(n=>{Q(n),ue(n.allowedEndpoints??[]),xe(n.maxConcurrency?String(n.maxConcurrency):"")},[]),Xe=c.useCallback(async()=>{if(F)try{await I.mutateAsync({id:F.id,...F.isWildcard?{}:{allowedEndpoints:W.length>0?W:null},maxConcurrency:L?Number(L):null}),Q(null)}catch{}},[F,W,L,I]),Ye=c.useCallback(n=>n?new Date(n).toLocaleString():s("common.noData"),[s]);return{activeKeysValue:Ie,availableEndpoints:Se,deleteTarget:w,editEndpointsKey:F,editEndpointsSelection:W,editMaxConcurrency:L,enabledKeysValue:Pe,filteredKeys:ze,formatDate:Ye,handleCopyKey:_e,handleCreateDialogChange:G,handleCreateKey:Qe,handleDeleteKey:Ge,handleHideKey:Ue,handleOpenEditEndpoints:Je,handleRevealKey:Be,handleSaveEndpoints:Xe,handleToggleEnabled:Ve,hasWildcard:Re,isCreateDialogOpen:i,isDeleting:E,isRevealing:Ae,keys:S,keysQuery:me,newKeyDescription:g,newKeyEndpoints:o,newKeyMaxConcurrency:y,newKeyName:l,newlyCreatedKey:x,rangeDays:f,requestsChartOption:He,restrictedCount:Oe,revealedKeys:m,search:V,setDeleteTarget:q,setEditEndpointsKey:Q,setEditEndpointsSelection:ue,setEditMaxConcurrency:xe,setNewKeyDescription:j,setNewKeyEndpoints:p,setNewKeyMaxConcurrency:r,setNewKeyName:u,setNewlyCreatedKey:h,setRangeDays:M,setSearch:Te,setStatusFilter:qe,statusFilter:P,tokensChartOption:$e,totalKeysValue:Le,unrestrictedCount:We,usage:D,usageQuery:ye,wildcardCount:Fe}}function Hs(){const{t:s}=N(),a=fs(),i=s("apiKeys.summary.totalCount",{count:a.keys.length});return a.keysQuery.isLoading?e.jsx(rs,{}):e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(is,{icon:e.jsx(Ke,{className:"h-5 w-5","aria-hidden":"true"}),title:s("apiKeys.title"),description:s("apiKeys.description"),eyebrow:"Access Control",breadcrumb:"Gateway / API Keys",helper:s("apiKeys.helper"),badge:i,actions:e.jsxs("div",{className:"flex w-full flex-col gap-2 sm:w-auto sm:flex-row sm:flex-wrap sm:justify-end",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-secondary px-3 py-2 text-xs text-muted-foreground",children:[s("apiKeys.summary.wildcard",{count:a.wildcardCount})," / ",s("apiKeys.summary.restricted",{count:a.restrictedCount})," / ",s("apiKeys.summary.unrestricted",{count:a.unrestrictedCount})]}),e.jsxs(K,{onClick:()=>a.handleCreateDialogChange(!0),className:"w-full sm:w-auto",children:[e.jsx(as,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),s("apiKeys.createNew")]})]})}),e.jsx(hs,{}),e.jsx(gs,{activeKeysValue:a.activeKeysValue,enabledKeysValue:a.enabledKeysValue,loading:a.usageQuery.isLoading,onRangeChange:a.setRangeDays,rangeDays:a.rangeDays,requestsChartOption:a.requestsChartOption,totalKeysValue:a.totalKeysValue,tokensChartOption:a.tokensChartOption,usageLength:a.usage.length}),e.jsx(bs,{filteredKeys:a.filteredKeys,formatDate:a.formatDate,hasWildcard:a.hasWildcard,isDeleting:a.isDeleting,isRevealing:a.isRevealing,keys:a.keys,onCopy:t=>void a.handleCopyKey(t),onDelete:a.setDeleteTarget,onEditEndpoints:a.handleOpenEditEndpoints,onFilterChange:a.setSearch,onHide:a.handleHideKey,onReveal:t=>void a.handleRevealKey(t),onStatusFilterChange:a.setStatusFilter,onToggleEnabled:(t,l)=>void a.handleToggleEnabled(t,l),restrictedCount:a.restrictedCount,revealedKeys:a.revealedKeys,search:a.search,statusFilter:a.statusFilter,unrestrictedCount:a.unrestrictedCount,wildcardCount:a.wildcardCount}),e.jsx(us,{availableEndpoints:a.availableEndpoints,isOpen:a.isCreateDialogOpen,keyDescription:a.newKeyDescription,keyName:a.newKeyName,maxConcurrency:a.newKeyMaxConcurrency,onDescriptionChange:a.setNewKeyDescription,onEndpointsChange:a.setNewKeyEndpoints,onKeyNameChange:a.setNewKeyName,onMaxConcurrencyChange:a.setNewKeyMaxConcurrency,onOpenChange:a.handleCreateDialogChange,onSubmit:()=>void a.handleCreateKey(),selectedEndpoints:a.newKeyEndpoints}),e.jsx(xs,{createdKey:a.newlyCreatedKey,onClose:()=>a.setNewlyCreatedKey(null),onCopy:t=>void a.handleCopyKey(t)}),e.jsx(ms,{apiKey:a.editEndpointsKey,availableEndpoints:a.availableEndpoints,maxConcurrency:a.editMaxConcurrency,onClose:()=>a.setEditEndpointsKey(null),onEndpointsChange:a.setEditEndpointsSelection,onMaxConcurrencyChange:a.setEditMaxConcurrency,onSave:()=>void a.handleSaveEndpoints(),selectedEndpoints:a.editEndpointsSelection}),e.jsx(ys,{deleteTarget:a.deleteTarget,isDeleting:a.isDeleting,onConfirm:()=>void a.handleDeleteKey(),onOpenChange:t=>{!t&&a.isDeleting===null&&a.setDeleteTarget(null)}})]})}export{Hs as default};