@chenpu17/cc-gw 0.7.21 → 0.8.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +98 -548
- package/package.json +41 -62
- package/src/cli/dist/index.js +95 -32
- package/src/web/dist/assets/About-g7O_JA6K.js +1 -0
- package/src/web/dist/assets/ApiKeys-CEJ9-jBz.js +1 -0
- package/src/web/dist/assets/ConfirmDialog-DwZk3ejq.js +1 -0
- package/src/web/dist/assets/Dashboard-OPVlXupp.js +1 -0
- package/src/web/dist/assets/EChart-CfTG8iSv.js +1 -0
- package/src/web/dist/assets/Events-D7p4pym8.js +1 -0
- package/src/web/dist/assets/Help-DbNTCxxV.js +8 -0
- package/src/web/dist/assets/Login-h9CRbinI.js +1 -0
- package/src/web/dist/assets/Logs-DN-Cl2dm.js +1 -0
- package/src/web/dist/assets/ModelManagement-CrpcomEc.js +1 -0
- package/src/web/dist/assets/PageHeader-CbpaEUEn.js +1 -0
- package/src/web/dist/assets/PageSection-6q9HngU5.js +1 -0
- package/src/web/dist/assets/Settings-Bp_GpSh3.js +1 -0
- package/src/web/dist/assets/Skeleton-DFeA7kZw.js +1 -0
- package/src/web/dist/assets/card-DRsnBFyp.js +1 -0
- package/src/web/dist/assets/charts-core-BjxPMAw_.js +12 -0
- package/src/web/dist/assets/charts-engine-B4YVo-Wh.js +16 -0
- package/src/web/dist/assets/charts-react-BxiU3S4Y.js +1 -0
- package/src/web/dist/assets/i18n-qAxAISVU.js +1 -0
- package/src/web/dist/assets/index-BKEgpvTe.js +61 -0
- package/src/web/dist/assets/index-BfFWdxjR.css +1 -0
- package/src/web/dist/assets/input-BCUUQfiv.js +1 -0
- package/src/web/dist/assets/label-CtuP7N6a.js +1 -0
- package/src/web/dist/assets/query-BnTlXVsy.js +1 -0
- package/src/web/dist/assets/radix-CwKvZelb.js +5 -0
- package/src/web/dist/assets/router-Ju3lwB-M.js +19 -0
- package/src/web/dist/assets/select-C-e-41FP.js +1 -0
- package/src/web/dist/assets/switch-D72iMnTO.js +1 -0
- package/src/web/dist/assets/useApiQuery-C4-HjWYY.js +1 -0
- package/src/web/dist/assets/vendor-UrUELLAG.js +317 -0
- package/src/web/dist/index.html +7 -2
- package/src/server/dist/index.js +0 -18202
- package/src/web/dist/assets/About-Bjq70P_K.js +0 -6
- package/src/web/dist/assets/ApiKeys-BHwlIBRG.js +0 -16
- package/src/web/dist/assets/Dashboard-Bv6E5M2u.js +0 -16
- package/src/web/dist/assets/Events-DyqUKr1b.js +0 -16
- package/src/web/dist/assets/Help-BNn_Zuo4.js +0 -23
- package/src/web/dist/assets/Login-BHXuuVq3.js +0 -1
- package/src/web/dist/assets/Logs-CRnJOy2J.js +0 -6
- package/src/web/dist/assets/ModelManagement-DAE8AYAE.js +0 -6
- package/src/web/dist/assets/PageHeader-D2u2opjK.js +0 -1
- package/src/web/dist/assets/PageSection-jfq2rgUu.js +0 -1
- package/src/web/dist/assets/Settings-CssUPWdg.js +0 -6
- package/src/web/dist/assets/Skeleton-BwMNCVcg.js +0 -1
- package/src/web/dist/assets/card-C9wVDhpJ.js +0 -1
- package/src/web/dist/assets/dialog-DbEoPxgf.js +0 -10
- package/src/web/dist/assets/index-B1EJcuR-.css +0 -1
- package/src/web/dist/assets/index-BjqieXJo.js +0 -48
- package/src/web/dist/assets/index-Blclkvp7.js +0 -280
- package/src/web/dist/assets/info-BmVX8zJd.js +0 -6
- package/src/web/dist/assets/input-CGgq_gCJ.js +0 -1
- package/src/web/dist/assets/label-BGUvZ4t2.js +0 -1
- package/src/web/dist/assets/refresh-cw-D7rJxbFV.js +0 -6
- package/src/web/dist/assets/select-Chuh7X1A.js +0 -11
- package/src/web/dist/assets/shield-Beuqdf31.js +0 -11
- package/src/web/dist/assets/switch-XbPwmM_b.js +0 -1
- package/src/web/dist/assets/useApiQuery-DiX6xcfY.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Ne=Object.defineProperty;var Ce=(n,e,t)=>e in n?Ne(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var se=(n,e,t)=>Ce(n,typeof e!="symbol"?e+"":e,t);import{r as R}from"./vendor-UrUELLAG.js";function Re(){if(console&&console.warn){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];k(e[0])&&(e[0]=`react-i18next:: ${e[0]}`),console.warn(...e)}}const ne={};function Z(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];k(e[0])&&ne[e[0]]||(k(e[0])&&(ne[e[0]]=new Date),Re(...e))}const be=(n,e)=>()=>{if(n.isInitialized)e();else{const t=()=>{setTimeout(()=>{n.off("initialized",t)},0),e()};n.on("initialized",t)}},ie=(n,e,t)=>{n.loadNamespaces(e,be(n,t))},re=(n,e,t,s)=>{k(t)&&(t=[t]),t.forEach(i=>{n.options.ns.indexOf(i)<0&&n.options.ns.push(i)}),n.loadLanguages(e,be(n,s))},Pe=function(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=e.languages[0],i=e.options?e.options.fallbackLng:!1,r=e.languages[e.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const a=(o,l)=>{const u=e.services.backendConnector.state[`${o}|${l}`];return u===-1||u===2};return t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!a(e.isLanguageChangingTo,n)?!1:!!(e.hasResourceBundle(s,n)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||a(s,n)&&(!i||a(r,n)))},$e=function(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(Z("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(n,{lng:t.lng,precheck:(i,r)=>{if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!r(i.isLanguageChangingTo,n))return!1}}):Pe(n,e,t)},k=n=>typeof n=="string",ke=n=>typeof n=="object"&&n!==null,Ie=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Ee={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Fe=n=>Ee[n],je=n=>n.replace(Ie,Fe);let q={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:je};const Te=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};q={...q,...n}},Ae=()=>q;let xe;const De=n=>{xe=n},Ue=()=>xe,dt={type:"3rdParty",init(n){Te(n.options.react),De(n)}},ye=R.createContext();class Ve{constructor(){se(this,"getUsedNamespaces",()=>Object.keys(this.usedNamespaces));this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}}const Ke=(n,e)=>{const t=R.useRef();return R.useEffect(()=>{t.current=n},[n,e]),t.current},Se=(n,e,t,s)=>n.getFixedT(e,t,s),Me=(n,e,t,s)=>R.useCallback(Se(n,e,t,s),[n,e,t,s]),pt=function(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:t}=e,{i18n:s,defaultNS:i}=R.useContext(ye)||{},r=t||s||Ue();if(r&&!r.reportNamespaces&&(r.reportNamespaces=new Ve),!r){Z("You will need to pass in an i18next instance by using initReactI18next");const m=(v,y)=>k(y)?y:ke(y)&&k(y.defaultValue)?y.defaultValue:Array.isArray(v)?v[v.length-1]:v,L=[m,{},!1];return L.t=m,L.i18n={},L.ready=!1,L}r.options.react&&r.options.react.wait!==void 0&&Z("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...Ae(),...r.options.react,...e},{useSuspense:o,keyPrefix:l}=a;let u=i||r.options&&r.options.defaultNS;u=k(u)?[u]:u||["translation"],r.reportNamespaces.addUsedNamespaces&&r.reportNamespaces.addUsedNamespaces(u);const c=(r.isInitialized||r.initializedStoreOnce)&&u.every(m=>$e(m,r,a)),g=Me(r,e.lng||null,a.nsMode==="fallback"?u:u[0],l),f=()=>g,h=()=>Se(r,e.lng||null,a.nsMode==="fallback"?u:u[0],l),[p,x]=R.useState(f);let b=u.join();e.lng&&(b=`${e.lng}${b}`);const O=Ke(b),S=R.useRef(!0);R.useEffect(()=>{const{bindI18n:m,bindI18nStore:L}=a;S.current=!0,!c&&!o&&(e.lng?re(r,e.lng,u,()=>{S.current&&x(h)}):ie(r,u,()=>{S.current&&x(h)})),c&&O&&O!==b&&S.current&&x(h);const v=()=>{S.current&&x(h)};return m&&r&&r.on(m,v),L&&r&&r.store.on(L,v),()=>{S.current=!1,m&&r&&m.split(" ").forEach(y=>r.off(y,v)),L&&r&&L.split(" ").forEach(y=>r.store.off(y,v))}},[r,b]),R.useEffect(()=>{S.current&&c&&x(f)},[r,l,c]);const C=[p,r,c];if(C.t=p,C.i18n=r,C.ready=c,c||!c&&!o)return C;throw new Promise(m=>{e.lng?re(r,e.lng,u,()=>m()):ie(r,u,()=>m())})};function mt(n){let{i18n:e,defaultNS:t,children:s}=n;const i=R.useMemo(()=>({i18n:e,defaultNS:t}),[e,t]);return R.createElement(ye.Provider,{value:i},s)}const d=n=>typeof n=="string",D=()=>{let n,e;const t=new Promise((s,i)=>{n=s,e=i});return t.resolve=n,t.reject=e,t},ae=n=>n==null?"":""+n,ze=(n,e,t)=>{n.forEach(s=>{e[s]&&(t[s]=e[s])})},He=/###/g,oe=n=>n&&n.indexOf("###")>-1?n.replace(He,"."):n,le=n=>!n||d(n),U=(n,e,t)=>{const s=d(e)?e.split("."):e;let i=0;for(;i<s.length-1;){if(le(n))return{};const r=oe(s[i]);!n[r]&&t&&(n[r]=new t),Object.prototype.hasOwnProperty.call(n,r)?n=n[r]:n={},++i}return le(n)?{}:{obj:n,k:oe(s[i])}},ue=(n,e,t)=>{const{obj:s,k:i}=U(n,e,Object);if(s!==void 0||e.length===1){s[i]=t;return}let r=e[e.length-1],a=e.slice(0,e.length-1),o=U(n,a,Object);for(;o.obj===void 0&&a.length;)r=`${a[a.length-1]}.${r}`,a=a.slice(0,a.length-1),o=U(n,a,Object),o&&o.obj&&typeof o.obj[`${o.k}.${r}`]<"u"&&(o.obj=void 0);o.obj[`${o.k}.${r}`]=t},Je=(n,e,t,s)=>{const{obj:i,k:r}=U(n,e,Object);i[r]=i[r]||[],i[r].push(t)},H=(n,e)=>{const{obj:t,k:s}=U(n,e);if(t)return t[s]},Be=(n,e,t)=>{const s=H(n,t);return s!==void 0?s:H(e,t)},Le=(n,e,t)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in n?d(n[s])||n[s]instanceof String||d(e[s])||e[s]instanceof String?t&&(n[s]=e[s]):Le(n[s],e[s],t):n[s]=e[s]);return n},I=n=>n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var We={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Ye=n=>d(n)?n.replace(/[&<>"'\/]/g,e=>We[e]):n;class Qe{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}const Ge=[" ",",","?","!",";"],Ze=new Qe(20),qe=(n,e,t)=>{e=e||"",t=t||"";const s=Ge.filter(a=>e.indexOf(a)<0&&t.indexOf(a)<0);if(s.length===0)return!0;const i=Ze.getRegExp(`(${s.map(a=>a==="?"?"\\?":a).join("|")})`);let r=!i.test(n);if(!r){const a=n.indexOf(t);a>0&&!i.test(n.substring(0,a))&&(r=!0)}return r},X=function(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!n)return;if(n[e])return n[e];const s=e.split(t);let i=n;for(let r=0;r<s.length;){if(!i||typeof i!="object")return;let a,o="";for(let l=r;l<s.length;++l)if(l!==r&&(o+=t),o+=s[l],a=i[o],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&l<s.length-1)continue;r+=l-r+1;break}i=a}return i},J=n=>n&&n.replace("_","-"),Xe={type:"logger",log(n){this.output("log",n)},warn(n){this.output("warn",n)},error(n){this.output("error",n)},output(n,e){console&&console[n]&&console[n].apply(console,e)}};class B{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Xe,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"log","",!0)}warn(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"warn","",!0)}error(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"error","")}deprecate(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,s,i){return i&&!this.debug?null:(d(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new B(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new B(this.logger,e)}}var P=new B;class Y{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const i=this.observers[s].get(t)||0;this.observers[s].set(t,i+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),i=1;i<t;i++)s[i-1]=arguments[i];this.observers[e]&&Array.from(this.observers[e].entries()).forEach(a=>{let[o,l]=a;for(let u=0;u<l;u++)o(...s)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[o,l]=a;for(let u=0;u<l;u++)o.apply(o,[e,...s])})}}class fe extends Y{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const r=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],s&&(Array.isArray(s)?o.push(...s):d(s)&&r?o.push(...s.split(r)):o.push(s)));const l=H(this.data,o);return!l&&!t&&!s&&e.indexOf(".")>-1&&(e=o[0],t=o[1],s=o.slice(2).join(".")),l||!a||!d(s)?l:X(this.data&&this.data[e]&&this.data[e][t],s,r)}addResource(e,t,s,i){let r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let o=[e,t];s&&(o=o.concat(a?s.split(a):s)),e.indexOf(".")>-1&&(o=e.split("."),i=t,t=o[1]),this.addNamespaces(t),ue(this.data,o,i),r.silent||this.emit("added",e,t,s,i)}addResources(e,t,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const r in s)(d(s[r])||Array.isArray(s[r]))&&this.addResource(e,t,r,s[r],{silent:!0});i.silent||this.emit("added",e,t,s)}addResourceBundle(e,t,s,i,r){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),i=s,s=t,t=o[1]),this.addNamespaces(t);let l=H(this.data,o)||{};a.skipCopy||(s=JSON.parse(JSON.stringify(s))),i?Le(l,s,r):l={...l,...s},ue(this.data,o,l),a.silent||this.emit("added",e,t,s)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(i=>t[i]&&Object.keys(t[i]).length>0)}toJSON(){return this.data}}var ve={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,e,t,s,i){return n.forEach(r=>{this.processors[r]&&(e=this.processors[r].process(e,t,s,i))}),e}};const ce={};class W extends Y{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ze(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=P.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const s=this.resolve(e,t);return s&&s.res!==void 0}extractFromKey(e,t){let s=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const i=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let r=t.ns||this.options.defaultNS||[];const a=s&&e.indexOf(s)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!qe(e,s,i);if(a&&!o){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:d(r)?[r]:r};const u=e.split(s);(s!==i||s===i&&this.options.ns.indexOf(u[0])>-1)&&(r=u.shift()),e=u.join(i)}return{key:e,namespaces:d(r)?[r]:r}}translate(e,t,s){if(typeof t!="object"&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),typeof t=="object"&&(t={...t}),t||(t={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const i=t.returnDetails!==void 0?t.returnDetails:this.options.returnDetails,r=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,{key:a,namespaces:o}=this.extractFromKey(e[e.length-1],t),l=o[o.length-1],u=t.lng||this.language,c=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const m=t.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${m}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:`${l}${m}${a}`}return i?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:a}const g=this.resolve(e,t);let f=g&&g.res;const h=g&&g.usedKey||a,p=g&&g.exactUsedKey||a,x=Object.prototype.toString.apply(f),b=["[object Number]","[object Function]","[object RegExp]"],O=t.joinArrays!==void 0?t.joinArrays:this.options.joinArrays,S=!this.i18nFormat||this.i18nFormat.handleAsObject,C=!d(f)&&typeof f!="boolean"&&typeof f!="number";if(S&&f&&C&&b.indexOf(x)<0&&!(d(O)&&Array.isArray(f))){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const m=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...t,ns:o}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(g.res=m,g.usedParams=this.getUsedParamsDetails(t),g):m}if(r){const m=Array.isArray(f),L=m?[]:{},v=m?p:h;for(const y in f)if(Object.prototype.hasOwnProperty.call(f,y)){const K=`${v}${r}${y}`;L[y]=this.translate(K,{...t,joinArrays:!1,ns:o}),L[y]===K&&(L[y]=f[y])}f=L}}else if(S&&d(O)&&Array.isArray(f))f=f.join(O),f&&(f=this.extendTranslation(f,e,t,s));else{let m=!1,L=!1;const v=t.count!==void 0&&!d(t.count),y=W.hasDefaultValue(t),K=v?this.pluralResolver.getSuffix(u,t.count,t):"",Oe=t.ordinal&&v?this.pluralResolver.getSuffix(u,t.count,{ordinal:!1}):"",_=v&&!t.ordinal&&t.count===0&&this.pluralResolver.shouldUseIntlApi(),F=_&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${K}`]||t[`defaultValue${Oe}`]||t.defaultValue;!this.isValidLookup(f)&&y&&(m=!0,f=F),this.isValidLookup(f)||(L=!0,f=a);const we=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&L?void 0:f,j=y&&F!==f&&this.options.updateMissing;if(L||m||j){if(this.logger.log(j?"updateKey":"missingKey",u,l,a,j?F:f),r){const N=this.resolve(a,{...t,keySeparator:!1});N&&N.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let T=[];const M=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if(this.options.saveMissingTo==="fallback"&&M&&M[0])for(let N=0;N<M.length;N++)T.push(M[N]);else this.options.saveMissingTo==="all"?T=this.languageUtils.toResolveHierarchy(t.lng||this.language):T.push(t.lng||this.language);const ee=(N,$,A)=>{const te=y&&A!==f?A:we;this.options.missingKeyHandler?this.options.missingKeyHandler(N,l,$,te,j,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(N,l,$,te,j,t),this.emit("missingKey",N,l,$,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&v?T.forEach(N=>{const $=this.pluralResolver.getSuffixes(N,t);_&&t[`defaultValue${this.options.pluralSeparator}zero`]&&$.indexOf(`${this.options.pluralSeparator}zero`)<0&&$.push(`${this.options.pluralSeparator}zero`),$.forEach(A=>{ee([N],a+A,t[`defaultValue${A}`]||F)})}):ee(T,a,F))}f=this.extendTranslation(f,e,t,g,s),L&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${a}`),(L||m)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,m?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(g.res=f,g.usedParams=this.getUsedParamsDetails(t),g):f}extendTranslation(e,t,s,i,r){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const u=d(e)&&(s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=e.match(this.interpolator.nestingRegexp);c=f&&f.length}let g=s.replace&&!d(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(g={...this.options.interpolation.defaultVariables,...g}),e=this.interpolator.interpolate(e,g,s.lng||this.language||i.usedLng,s),u){const f=e.match(this.interpolator.nestingRegexp),h=f&&f.length;c<h&&(s.nest=!1)}!s.lng&&this.options.compatibilityAPI!=="v1"&&i&&i.res&&(s.lng=this.language||i.usedLng),s.nest!==!1&&(e=this.interpolator.nest(e,function(){for(var f=arguments.length,h=new Array(f),p=0;p<f;p++)h[p]=arguments[p];return r&&r[0]===h[0]&&!s.context?(a.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${t[0]}`),null):a.translate(...h,t)},s)),s.interpolation&&this.interpolator.reset()}const o=s.postProcess||this.options.postProcess,l=d(o)?[o]:o;return e!=null&&l&&l.length&&s.applyPostProcessor!==!1&&(e=ve.handle(l,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s,i,r,a,o;return d(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(s))return;const u=this.extractFromKey(l,t),c=u.key;i=c;let g=u.namespaces;this.options.fallbackNS&&(g=g.concat(this.options.fallbackNS));const f=t.count!==void 0&&!d(t.count),h=f&&!t.ordinal&&t.count===0&&this.pluralResolver.shouldUseIntlApi(),p=t.context!==void 0&&(d(t.context)||typeof t.context=="number")&&t.context!=="",x=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);g.forEach(b=>{this.isValidLookup(s)||(o=b,!ce[`${x[0]}-${b}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(o)&&(ce[`${x[0]}-${b}`]=!0,this.logger.warn(`key "${i}" for languages "${x.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),x.forEach(O=>{if(this.isValidLookup(s))return;a=O;const S=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(S,c,O,b,t);else{let m;f&&(m=this.pluralResolver.getSuffix(O,t.count,t));const L=`${this.options.pluralSeparator}zero`,v=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(S.push(c+m),t.ordinal&&m.indexOf(v)===0&&S.push(c+m.replace(v,this.options.pluralSeparator)),h&&S.push(c+L)),p){const y=`${c}${this.options.contextSeparator}${t.context}`;S.push(y),f&&(S.push(y+m),t.ordinal&&m.indexOf(v)===0&&S.push(y+m.replace(v,this.options.pluralSeparator)),h&&S.push(y+L))}}let C;for(;C=S.pop();)this.isValidLookup(s)||(r=C,s=this.getResource(O,b,C,t))}))})}),{res:s,usedKey:i,exactUsedKey:r,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,s,i):this.resourceStore.getResource(e,t,s,i)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!d(e.replace);let i=s?e.replace:e;if(s&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!s){i={...i};for(const r of t)delete i[r]}return i}static hasDefaultValue(e){const t="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t===s.substring(0,t.length)&&e[s]!==void 0)return!0;return!1}}const Q=n=>n.charAt(0).toUpperCase()+n.slice(1);class ge{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=P.create("languageUtils")}getScriptPartFromCode(e){if(e=J(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=J(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(d(e)&&e.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let i=Intl.getCanonicalLocales(e)[0];if(i&&this.options.lowerCaseLng&&(i=i.toLowerCase()),i)return i}catch{}const t=["hans","hant","latn","cyrl","cans","mong","arab"];let s=e.split("-");return this.options.lowerCaseLng?s=s.map(i=>i.toLowerCase()):s.length===2?(s[0]=s[0].toLowerCase(),s[1]=s[1].toUpperCase(),t.indexOf(s[1].toLowerCase())>-1&&(s[1]=Q(s[1].toLowerCase()))):s.length===3&&(s[0]=s[0].toLowerCase(),s[1].length===2&&(s[1]=s[1].toUpperCase()),s[0]!=="sgn"&&s[2].length===2&&(s[2]=s[2].toUpperCase()),t.indexOf(s[1].toLowerCase())>-1&&(s[1]=Q(s[1].toLowerCase())),t.indexOf(s[2].toLowerCase())>-1&&(s[2]=Q(s[2].toLowerCase()))),s.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(s=>{if(t)return;const i=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(i))&&(t=i)}),!t&&this.options.supportedLngs&&e.forEach(s=>{if(t)return;const i=this.getLanguagePartFromCode(s);if(this.isSupportedCode(i))return t=i;t=this.options.supportedLngs.find(r=>{if(r===i)return r;if(!(r.indexOf("-")<0&&i.indexOf("-")<0)&&(r.indexOf("-")>0&&i.indexOf("-")<0&&r.substring(0,r.indexOf("-"))===i||r.indexOf(i)===0&&i.length>1))return r})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),d(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let s=e[t];return s||(s=e[this.getScriptPartFromCode(t)]),s||(s=e[this.formatLanguageCode(t)]),s||(s=e[this.getLanguagePartFromCode(t)]),s||(s=e.default),s||[]}toResolveHierarchy(e,t){const s=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],r=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return d(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&r(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&r(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&r(this.getLanguagePartFromCode(e))):d(e)&&r(this.formatLanguageCode(e)),s.forEach(a=>{i.indexOf(a)<0&&r(this.formatLanguageCode(a))}),i}}let _e=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],et={1:n=>+(n>1),2:n=>+(n!=1),3:n=>0,4:n=>n%10==1&&n%100!=11?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2,5:n=>n==0?0:n==1?1:n==2?2:n%100>=3&&n%100<=10?3:n%100>=11?4:5,6:n=>n==1?0:n>=2&&n<=4?1:2,7:n=>n==1?0:n%10>=2&&n%10<=4&&(n%100<10||n%100>=20)?1:2,8:n=>n==1?0:n==2?1:n!=8&&n!=11?2:3,9:n=>+(n>=2),10:n=>n==1?0:n==2?1:n<7?2:n<11?3:4,11:n=>n==1||n==11?0:n==2||n==12?1:n>2&&n<20?2:3,12:n=>+(n%10!=1||n%100==11),13:n=>+(n!==0),14:n=>n==1?0:n==2?1:n==3?2:3,15:n=>n%10==1&&n%100!=11?0:n%10>=2&&(n%100<10||n%100>=20)?1:2,16:n=>n%10==1&&n%100!=11?0:n!==0?1:2,17:n=>n==1||n%10==1&&n%100!=11?0:1,18:n=>n==0?0:n==1?1:2,19:n=>n==1?0:n==0||n%100>1&&n%100<11?1:n%100>10&&n%100<20?2:3,20:n=>n==1?0:n==0||n%100>0&&n%100<20?1:2,21:n=>n%100==1?1:n%100==2?2:n%100==3||n%100==4?3:0,22:n=>n==1?0:n==2?1:(n<0||n>10)&&n%10==0?2:3};const tt=["v1","v2","v3"],st=["v4"],he={zero:0,one:1,two:2,few:3,many:4,other:5},nt=()=>{const n={};return _e.forEach(e=>{e.lngs.forEach(t=>{n[t]={numbers:e.nr,plurals:et[e.fc]}})}),n};class it{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=P.create("pluralResolver"),(!this.options.compatibilityJSON||st.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=nt(),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi()){const s=J(e==="dev"?"en":e),i=t.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:s,type:i});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];let a;try{a=new Intl.PluralRules(s,{type:i})}catch{if(!e.match(/-|_/))return;const l=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(l,t)}return this.pluralRulesCache[r]=a,a}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const s=this.getRule(e,t);return this.shouldUseIntlApi()?s&&s.resolvedOptions().pluralCategories.length>1:s&&s.numbers.length>1}getPluralFormsOfKey(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,s).map(i=>`${t}${i}`)}getSuffixes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const s=this.getRule(e,t);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort((i,r)=>he[i]-he[r]).map(i=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${i}`):s.numbers.map(i=>this.getSuffix(e,i,t)):[]}getSuffix(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(e,s);return i?this.shouldUseIntlApi()?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${i.select(t)}`:this.getSuffixRetroCompatible(i,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const s=e.noAbs?e.plurals(t):e.plurals(Math.abs(t));let i=e.numbers[s];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const r=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:r():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?r():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}shouldUseIntlApi(){return!tt.includes(this.options.compatibilityJSON)}}const de=function(n,e,t){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,r=Be(n,e,t);return!r&&i&&d(t)&&(r=X(n,t,s),r===void 0&&(r=X(e,t,s))),r},G=n=>n.replace(/\$/g,"$$$$");class rt{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=P.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(t=>t),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:s,useRawValueToEscape:i,prefix:r,prefixEscaped:a,suffix:o,suffixEscaped:l,formatSeparator:u,unescapeSuffix:c,unescapePrefix:g,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:p,nestingSuffixEscaped:x,nestingOptionsSeparator:b,maxReplaces:O,alwaysFormat:S}=e.interpolation;this.escape=t!==void 0?t:Ye,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=r?I(r):a||"{{",this.suffix=o?I(o):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=c?"":g||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=f?I(f):h||I("$t("),this.nestingSuffix=p?I(p):x||I(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=O||1e3,this.alwaysFormat=S!==void 0?S:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,s)=>t&&t.source===s?(t.lastIndex=0,t):new RegExp(s,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,s,i){let r,a,o;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){const O=de(t,l,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(O,void 0,s,{...i,...t,interpolationkey:h}):O}const p=h.split(this.formatSeparator),x=p.shift().trim(),b=p.join(this.formatSeparator).trim();return this.format(de(t,l,x,this.options.keySeparator,this.options.ignoreJSONStructure),b,s,{...i,...t,interpolationkey:x})};this.resetRegExp();const c=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,g=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>G(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?G(this.escape(h)):G(h)}].forEach(h=>{for(o=0;r=h.regex.exec(e);){const p=r[1].trim();if(a=u(p),a===void 0)if(typeof c=="function"){const b=c(e,r,i);a=d(b)?b:""}else if(i&&Object.prototype.hasOwnProperty.call(i,p))a="";else if(g){a=r[0];continue}else this.logger.warn(`missed to pass in variable ${p} for interpolating ${e}`),a="";else!d(a)&&!this.useRawValueToEscape&&(a=ae(a));const x=h.safeValue(a);if(e=e.replace(r[0],x),g?(h.regex.lastIndex+=a.length,h.regex.lastIndex-=r[0].length):h.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,r,a;const o=(l,u)=>{const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const g=l.split(new RegExp(`${c}[ ]*{`));let f=`{${g[1]}`;l=g[0],f=this.interpolate(f,a);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),u&&(a={...u,...a})}catch(x){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,x),`${l}${c}${f}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,l};for(;i=this.nestingRegexp.exec(e);){let l=[];a={...s},a=a.replace&&!d(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(g=>g.trim());i[1]=c.shift(),l=c,u=!0}if(r=t(o.call(this,i[1].trim(),a),a),r&&i[0]===e&&!d(r))return r;d(r)||(r=ae(r)),r||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),r=""),u&&(r=l.reduce((c,g)=>this.format(c,g,s.lng,{...s,interpolationkey:i[1].trim()}),r.trim())),e=e.replace(i[0],r),this.regexp.lastIndex=0}return e}}const at=n=>{let e=n.toLowerCase().trim();const t={};if(n.indexOf("(")>-1){const s=n.split("(");e=s[0].toLowerCase().trim();const i=s[1].substring(0,s[1].length-1);e==="currency"&&i.indexOf(":")<0?t.currency||(t.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?t.range||(t.range=i.trim()):i.split(";").forEach(a=>{if(a){const[o,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),c=o.trim();t[c]||(t[c]=u),u==="false"&&(t[c]=!1),u==="true"&&(t[c]=!0),isNaN(u)||(t[c]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},E=n=>{const e={};return(t,s,i)=>{let r=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(r={...r,[i.interpolationkey]:void 0});const a=s+JSON.stringify(r);let o=e[a];return o||(o=n(J(s),i),e[a]=o),o(t)}};class ot{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=P.create("formatter"),this.options=e,this.formats={number:E((t,s)=>{const i=new Intl.NumberFormat(t,{...s});return r=>i.format(r)}),currency:E((t,s)=>{const i=new Intl.NumberFormat(t,{...s,style:"currency"});return r=>i.format(r)}),datetime:E((t,s)=>{const i=new Intl.DateTimeFormat(t,{...s});return r=>i.format(r)}),relativetime:E((t,s)=>{const i=new Intl.RelativeTimeFormat(t,{...s});return r=>i.format(r,s.range||"day")}),list:E((t,s)=>{const i=new Intl.ListFormat(t,{...s});return r=>i.format(r)})},this.init(e)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=E(t)}format(e,t,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const r=t.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&r[0].indexOf(")")<0&&r.find(o=>o.indexOf(")")>-1)){const o=r.findIndex(l=>l.indexOf(")")>-1);r[0]=[r[0],...r.splice(1,o)].join(this.formatSeparator)}return r.reduce((o,l)=>{const{formatName:u,formatOptions:c}=at(l);if(this.formats[u]){let g=o;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||s;g=this.formats[u](o,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return g}else this.logger.warn(`there was no format function for ${u}`);return o},e)}}const lt=(n,e)=>{n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)};class ut extends Y{constructor(e,t,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=s,this.languageUtils=s.languageUtils,this.options=i,this.logger=P.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(s,i.backend,i)}queueLoad(e,t,s,i){const r={},a={},o={},l={};return e.forEach(u=>{let c=!0;t.forEach(g=>{const f=`${u}|${g}`;!s.reload&&this.store.hasResourceBundle(u,g)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,c=!1,a[f]===void 0&&(a[f]=!0),r[f]===void 0&&(r[f]=!0),l[g]===void 0&&(l[g]=!0)))}),c||(o[u]=!0)}),(Object.keys(r).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(r),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(l)}}loaded(e,t,s){const i=e.split("|"),r=i[0],a=i[1];t&&this.emit("failedLoading",r,a,t),!t&&s&&this.store.addResourceBundle(r,a,s,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&s&&(this.state[e]=0);const o={};this.queue.forEach(l=>{Je(l.loaded,[r],a),lt(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{o[u]||(o[u]={});const c=l.loaded[u];c.length&&c.forEach(g=>{o[u][g]===void 0&&(o[u][g]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(l=>!l.done)}read(e,t,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:s,tried:i,wait:r,callback:a});return}this.readingCalls++;const o=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const g=this.waitingReads.shift();this.read(g.lng,g.ns,g.fcName,g.tried,g.wait,g.callback)}if(u&&c&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,e,t,s,i+1,r*2,a)},r);return}a(u,c)},l=this.backend[s].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(c=>o(null,c)).catch(o):o(null,u)}catch(u){o(u)}return}return l(e,t,o)}prepareLoading(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();d(e)&&(e=this.languageUtils.toResolveHierarchy(e)),d(t)&&(t=[t]);const r=this.queueLoad(e,t,s,i);if(!r.toLoad.length)return r.pending.length||i(),null;r.toLoad.forEach(a=>{this.loadOne(a)})}load(e,t,s){this.prepareLoading(e,t,{},s)}reload(e,t,s){this.prepareLoading(e,t,{reload:!0},s)}loadOne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const s=e.split("|"),i=s[0],r=s[1];this.read(i,r,"read",void 0,void 0,(a,o)=>{a&&this.logger.warn(`${t}loading namespace ${r} for language ${i} failed`,a),!a&&o&&this.logger.log(`${t}loaded namespace ${r} for language ${i}`,o),this.loaded(e,a,o)})}saveMissing(e,t,s,i,r){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${s}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if(this.backend&&this.backend.create){const l={...a,isUpdate:r},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(e,t,s,i,l):c=u(e,t,s,i),c&&typeof c.then=="function"?c.then(g=>o(null,g)).catch(o):o(null,c)}catch(c){o(c)}else u(e,t,s,i,o,l)}!e||!e[0]||this.store.addResource(e[0],t,s,i)}}}const pe=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:n=>{let e={};if(typeof n[1]=="object"&&(e=n[1]),d(n[1])&&(e.defaultValue=n[1]),d(n[2])&&(e.tDescription=n[2]),typeof n[2]=="object"||typeof n[3]=="object"){const t=n[3]||n[2];Object.keys(t).forEach(s=>{e[s]=t[s]})}return e},interpolation:{escapeValue:!0,format:n=>n,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),me=n=>(d(n.ns)&&(n.ns=[n.ns]),d(n.fallbackLng)&&(n.fallbackLng=[n.fallbackLng]),d(n.fallbackNS)&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs&&n.supportedLngs.indexOf("cimode")<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),n),z=()=>{},ft=n=>{Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(t=>{typeof n[t]=="function"&&(n[t]=n[t].bind(n))})};class V extends Y{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(super(),this.options=me(e),this.services={},this.logger=P,this.modules={external:[]},ft(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof t=="function"&&(s=t,t={}),!t.defaultNS&&t.defaultNS!==!1&&t.ns&&(d(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const i=pe();this.options={...i,...this.options,...me(t)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const r=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?P.init(r(this.modules.logger),this.options):P.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=ot);const g=new ge(this.options);this.store=new fe(this.options.resources,this.options);const f=this.services;f.logger=P,f.resourceStore=this.store,f.languageUtils=g,f.pluralResolver=new it(g,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=r(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new rt(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new ut(r(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,x=new Array(p>1?p-1:0),b=1;b<p;b++)x[b-1]=arguments[b];e.emit(h,...x)}),this.modules.languageDetector&&(f.languageDetector=r(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=r(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new W(this.services,this.options),this.translator.on("*",function(h){for(var p=arguments.length,x=new Array(p>1?p-1:0),b=1;b<p;b++)x[b-1]=arguments[b];e.emit(h,...x)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,s||(s=z),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return e.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return e.store[c](...arguments),e}});const l=D(),u=()=>{const c=(g,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),s(g,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(e){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:z;const i=d(e)?e:this.language;if(typeof e=="function"&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const r=[],a=o=>{if(!o||o==="cimode")return;this.services.languageUtils.toResolveHierarchy(o).forEach(u=>{u!=="cimode"&&r.indexOf(u)<0&&r.push(u)})};i?a(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload&&this.options.preload.forEach(o=>a(o)),this.services.backendConnector.load(r,this.options.ns,o=>{!o&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(o)})}else s(null)}reloadResources(e,t,s){const i=D();return typeof e=="function"&&(s=e,e=void 0),typeof t=="function"&&(s=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),s||(s=z),this.services.backendConnector.reload(e,t,r=>{i.resolve(),s(r)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&ve.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let t=0;t<this.languages.length;t++){const s=this.languages[t];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}changeLanguage(e,t){var s=this;this.isLanguageChangingTo=e;const i=D();this.emit("languageChanging",e);const r=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(l,u)=>{u?(r(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return s.t(...arguments)}),t&&t(l,function(){return s.t(...arguments)})},o=l=>{!e&&!l&&this.services.languageDetector&&(l=[]);const u=d(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||r(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{a(c,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),i}getFixedT(e,t,s){var i=this;const r=function(a,o){let l;if(typeof o!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),g=2;g<u;g++)c[g-2]=arguments[g];l=i.options.overloadTranslationOptionHandler([a,o].concat(c))}else l={...o};l.lng=l.lng||r.lng,l.lngs=l.lngs||r.lngs,l.ns=l.ns||r.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||s||r.keyPrefix);const f=i.options.keySeparator||".";let h;return l.keyPrefix&&Array.isArray(a)?h=a.map(p=>`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${a}`:a,i.t(h,l)};return d(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=s,r}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const s=t.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,r=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const a=(o,l)=>{const u=this.services.backendConnector.state[`${o}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const o=t.precheck(this,a);if(o!==void 0)return o}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(s,e)&&(!i||a(r,e)))}loadNamespaces(e,t){const s=D();return this.options.ns?(d(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{s.resolve(),t&&t(i)}),s):(t&&t(),Promise.resolve())}loadLanguages(e,t){const s=D();d(e)&&(e=[e]);const i=this.options.preload||[],r=e.filter(a=>i.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return r.length?(this.options.preload=i.concat(r),this.loadResources(a=>{s.resolve(),t&&t(a)}),s):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=this.services&&this.services.languageUtils||new ge(pe());return t.indexOf(s.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new V(e,t)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:z;const s=e.forkResourceStore;s&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},r=new V(i);return(e.debug!==void 0||e.prefix!==void 0)&&(r.logger=r.logger.clone(e)),["store","services","language"].forEach(o=>{r[o]=this[o]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},s&&(r.store=new fe(this.store.data,i),r.services.resourceStore=r.store),r.translator=new W(r.services,i),r.translator.on("*",function(o){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c<l;c++)u[c-1]=arguments[c];r.emit(o,...u)}),r.init(i,t),r.translator.options=i,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const w=V.createInstance();w.createInstance=V.createInstance;w.createInstance;w.dir;w.init;w.loadResources;w.reloadResources;w.use;w.changeLanguage;w.getFixedT;w.t;w.exists;w.setDefaultNamespace;w.hasLoadedNamespace;w.loadNamespaces;w.loadLanguages;export{mt as I,dt as a,w as i,pt as u};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-OPVlXupp.js","assets/vendor-UrUELLAG.js","assets/EChart-CfTG8iSv.js","assets/charts-react-BxiU3S4Y.js","assets/charts-core-BjxPMAw_.js","assets/charts-engine-B4YVo-Wh.js","assets/Skeleton-DFeA7kZw.js","assets/PageHeader-CbpaEUEn.js","assets/PageSection-6q9HngU5.js","assets/card-DRsnBFyp.js","assets/useApiQuery-C4-HjWYY.js","assets/query-BnTlXVsy.js","assets/select-C-e-41FP.js","assets/radix-CwKvZelb.js","assets/i18n-qAxAISVU.js","assets/router-Ju3lwB-M.js","assets/Logs-DN-Cl2dm.js","assets/clipboard-CALi6bTW.js","assets/input-BCUUQfiv.js","assets/label-CtuP7N6a.js","assets/Events-D7p4pym8.js","assets/ModelManagement-CrpcomEc.js","assets/ConfirmDialog-DwZk3ejq.js","assets/switch-D72iMnTO.js","assets/ApiKeys-CEJ9-jBz.js","assets/Settings-Bp_GpSh3.js","assets/About-g7O_JA6K.js","assets/Help-DbNTCxxV.js","assets/Login-h9CRbinI.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as i,f as e,J as ie,K as re,L as le,N as de,O as ce,P as ue,S as q,T as _,U as pe,V as me,W as M,X as he,Y as ge,Z as fe,$ as ye,a0 as ve,a1 as be,a2 as xe,a3 as Pe,a4 as I,a5 as Te,a6 as we,a7 as Ce,k as ke}from"./vendor-UrUELLAG.js";import{u as H,O as Ae,N as F,B as Ie,R as Ee,a as g,b as O}from"./router-Ju3lwB-M.js";import{S as Re,a as K,b as U,P as Se,C as B,I as z,c as V,d as W,R as G,L as $,e as Y,f as Le,T as De,g as je,h as Q,i as Ne,j as qe,k as _e}from"./radix-CwKvZelb.js";import{u as b,i as C,a as Me,I as He}from"./i18n-qAxAISVU.js";import{Q as Fe}from"./query-BnTlXVsy.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const r of a)if(r.type==="childList")for(const d of r.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&n(d)}).observe(document,{childList:!0,subtree:!0});function s(a){const r={};return a.integrity&&(r.integrity=a.integrity),a.referrerPolicy&&(r.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?r.credentials="include":a.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function n(a){if(a.ep)return;a.ep=!0;const r=s(a);fetch(a.href,r)}})();const Oe="modulepreload",Ke=function(t){return"/"+t},E={},y=function(o,s,n){let a=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),l=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));a=Promise.allSettled(s.map(u=>{if(u=Ke(u),u in E)return;E[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":Oe,c||(p.as="script"),p.crossOrigin="",p.href=u,l&&p.setAttribute("nonce",l),document.head.appendChild(p),c)return new Promise((x,v)=>{p.addEventListener("load",x),p.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${u}`)))})}))}function r(d){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=d,window.dispatchEvent(l),!l.defaultPrevented)throw d}return a.then(d=>{for(const l of d||[])l.status==="rejected"&&r(l.reason);return o().catch(r)})},R="cc-gw-theme",X=i.createContext(void 0);function Ue(t){return t==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t}function S(t){const o=document.documentElement;o.dataset.theme=t,t==="dark"?o.classList.add("dark"):o.classList.remove("dark")}function Be({children:t}){const[o,s]=i.useState(()=>{if(typeof window>"u")return"system";const r=window.localStorage.getItem(R);return r==="light"||r==="dark"||r==="system"?r:"system"}),n=i.useMemo(()=>typeof window<"u"?Ue(o):"light",[o]);i.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia("(prefers-color-scheme: dark)"),d=l=>{o==="system"&&S(l.matches?"dark":"light")};return r.addEventListener("change",d),()=>r.removeEventListener("change",d)},[o]),i.useEffect(()=>{typeof window>"u"||(S(n),window.localStorage.setItem(R,o))},[o,n]);const a=i.useMemo(()=>({mode:o,resolved:n,setMode:s}),[o,n]);return e.jsx(X.Provider,{value:a,children:t})}function ze(){const t=i.useContext(X);if(!t)throw new Error("useTheme must be used within ThemeProvider");return t}function h(...t){return ie(re(t))}const Ve=le("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_rgba(59,130,246,0.65)] hover:-translate-y-0.5 hover:bg-primary/95 hover:shadow-[0_14px_28px_-14px_rgba(59,130,246,0.7)]",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-border/80 bg-background/85 text-foreground shadow-[0_1px_2px_rgba(15,23,42,0.03)] hover:border-primary/30 hover:bg-primary/5 hover:text-primary",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"}}),P=i.forwardRef(({className:t,variant:o,size:s,asChild:n=!1,...a},r)=>{const d=n?Re:"button";return e.jsx(d,{className:h(Ve({variant:o,size:s,className:t})),ref:r,...a})});P.displayName="Button";const J=Le,Z=De,We=i.forwardRef(({className:t,inset:o,children:s,...n},a)=>e.jsxs(K,{ref:a,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",t),...n,children:[s,e.jsx(de,{className:"ml-auto"})]}));We.displayName=K.displayName;const Ge=i.forwardRef(({className:t,...o},s)=>e.jsx(U,{ref:s,className:h("z-50 min-w-[8rem] overflow-hidden rounded-[1.25rem] border border-white/60 bg-popover/95 p-2 text-popover-foreground shadow-[0_16px_40px_-28px_rgba(15,23,42,0.45)] backdrop-blur 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",t),...o}));Ge.displayName=U.displayName;const k=i.forwardRef(({className:t,sideOffset:o=4,...s},n)=>e.jsx(Se,{children:e.jsx(B,{ref:n,sideOffset:o,className:h("z-50 min-w-[8rem] overflow-hidden rounded-[1.25rem] border border-white/60 bg-popover/95 p-2 text-popover-foreground shadow-[0_16px_40px_-28px_rgba(15,23,42,0.45)] backdrop-blur 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",t),...s})}));k.displayName=B.displayName;const A=i.forwardRef(({className:t,inset:o,...s},n)=>e.jsx(z,{ref:n,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",t),...s}));A.displayName=z.displayName;const $e=i.forwardRef(({className:t,children:o,checked:s,...n},a)=>e.jsxs(V,{ref:a,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",t),checked:s,...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(W,{children:e.jsx(ce,{className:"h-4 w-4"})})}),o]}));$e.displayName=V.displayName;const Ye=i.forwardRef(({className:t,children:o,...s},n)=>e.jsxs(G,{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",t),...s,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(W,{children:e.jsx(ue,{className:"h-2 w-2 fill-current"})})}),o]}));Ye.displayName=G.displayName;const Qe=i.forwardRef(({className:t,inset:o,...s},n)=>e.jsx($,{ref:n,className:h("px-3 py-2 text-sm font-semibold",o&&"pl-8",t),...s}));Qe.displayName=$.displayName;const Xe=i.forwardRef(({className:t,...o},s)=>e.jsx(Y,{ref:s,className:h("-mx-1 my-1 h-px bg-muted",t),...o}));Xe.displayName=Y.displayName;const L=[{mode:"light",labelKey:"common.theme.light",icon:q},{mode:"dark",labelKey:"common.theme.dark",icon:_},{mode:"system",labelKey:"common.theme.system",icon:pe}];function Je(){const{mode:t,setMode:o,resolved:s}=ze(),{t:n}=b(),a=L.find(d=>d.mode===t),r=(a==null?void 0:a.icon)||(s==="dark"?_:q);return e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,children:e.jsxs(P,{variant:"ghost",size:"sm","aria-label":n("common.theme.label"),children:[e.jsx(r,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),e.jsx("span",{className:"hidden sm:inline",children:n((a==null?void 0:a.labelKey)??"common.theme.label")})]})}),e.jsx(k,{align:"end",children:L.map(d=>{const l=d.icon,u=d.mode===t;return e.jsxs(A,{onClick:()=>o(d.mode),className:u?"bg-accent":"",children:[e.jsx(l,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),n(d.labelKey)]},d.mode)})})]})}const D=[{code:"zh",labelKey:"language.zh",nativeName:"中文"},{code:"en",labelKey:"language.en",nativeName:"English"}];function Ze(){const{i18n:t,t:o}=b(),s=t.language.startsWith("zh")?"zh":"en",n=D.find(a=>a.code===s);return e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,children:e.jsxs(P,{variant:"ghost",size:"sm","aria-label":o("common.languageSelector"),children:[e.jsx(me,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),e.jsx("span",{className:"hidden sm:inline",children:(n==null?void 0:n.nativeName)??"Language"})]})}),e.jsx(k,{align:"end",children:D.map(a=>e.jsx(A,{onClick:()=>t.changeLanguage(a.code),className:a.code===s?"bg-accent":"",children:a.nativeName},a.code))})]})}const et=Ne,tt=qe,at=_e,ee=i.forwardRef(({className:t,sideOffset:o=4,...s},n)=>e.jsx(je,{children:e.jsx(Q,{ref:n,sideOffset:o,className:h("z-50 overflow-hidden rounded-2xl border border-white/60 bg-popover/95 px-3 py-2 text-sm text-popover-foreground shadow-[0_16px_40px_-28px_rgba(15,23,42,0.45)] backdrop-blur 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",t),...s})}));ee.displayName=Q.displayName;const f=M.create({baseURL:"/",timeout:15e3,withCredentials:!0});f.interceptors.response.use(t=>t,t=>Promise.reject(t));function w(t){var o,s,n;if(M.isAxiosError(t)){const a=(o=t.response)==null?void 0:o.status;return{message:((n=(s=t.response)==null?void 0:s.data)==null?void 0:n.error)||t.message||"请求失败,请稍后再试",status:a,code:String(a??"unknown")}}return{message:t instanceof Error?t.message:"请求失败,请稍后再试"}}const kt={list:async()=>(await f.get("/api/custom-endpoints")).data,create:async t=>(await f.post("/api/custom-endpoints",t)).data,update:async(t,o)=>(await f.put(`/api/custom-endpoints/${t}`,o)).data,delete:async t=>(await f.delete(`/api/custom-endpoints/${t}`)).data},At={list:async t=>(await f.get("/api/events",{params:{limit:t==null?void 0:t.limit,cursor:t==null?void 0:t.cursor,level:t==null?void 0:t.level,type:t==null?void 0:t.type}})).data},te=i.createContext(void 0);function ot({children:t}){const o=i.useRef(!0),[s,n]=i.useState({loading:!0,authEnabled:!1,isAuthenticated:!0,username:void 0,error:null}),a=i.useCallback(c=>{o.current&&n(c)},[]),r=i.useCallback(async()=>{a(c=>({...c,loading:!0,error:null}));try{const{data:c}=await f.get("/auth/session");a(()=>({loading:!1,authEnabled:!!c.authEnabled,isAuthenticated:!c.authEnabled||!!c.authenticated,username:c.username??void 0,error:null}))}catch(c){const m=w(c);a(()=>({loading:!1,authEnabled:!1,isAuthenticated:!0,username:void 0,error:m.message}))}},[a]),d=i.useCallback(async(c,m)=>{a(p=>({...p,loading:!0,error:null}));try{await f.post("/auth/login",{username:c,password:m}),await r()}catch(p){const x=w(p);throw a(v=>({...v,loading:!1,error:x.message,isAuthenticated:!1})),x}},[r,a]),l=i.useCallback(async()=>{a(c=>({...c,loading:!0}));try{await f.post("/auth/logout")}catch(c){const m=w(c);a(p=>({...p,error:m.message}))}finally{await r()}},[r,a]);i.useEffect(()=>{o.current=!0,r();const c=f.interceptors.response.use(m=>m,async m=>{var p;return((p=m==null?void 0:m.response)==null?void 0:p.status)===401&&await r(),Promise.reject(m)});return()=>{o.current=!1,f.interceptors.response.eject(c)}},[r]);const u=i.useMemo(()=>({...s,refresh:r,login:d,logout:l}),[s,r,d,l]);return e.jsx(te.Provider,{value:u,children:t})}function ae(){const t=i.useContext(te);if(!t)throw new Error("useAuth must be used within an AuthProvider");return t}const T=[{to:"/",icon:he,labelKey:"nav.dashboard",descriptionKey:"dashboard.description"},{to:"/logs",icon:ge,labelKey:"nav.logs",descriptionKey:"logs.description"},{to:"/models",icon:fe,labelKey:"nav.models",descriptionKey:"modelManagement.description"},{to:"/events",icon:ye,labelKey:"nav.events",descriptionKey:"events.description"},{to:"/api-keys",icon:ve,labelKey:"nav.apiKeys",descriptionKey:"apiKeys.description"},{to:"/settings",icon:be,labelKey:"nav.settings",descriptionKey:"settings.description"},{to:"/help",icon:xe,labelKey:"nav.help",descriptionKey:"help.intro"},{to:"/about",icon:Pe,labelKey:"nav.about",descriptionKey:"about.description"}];function j({onNavigate:t}){const{t:o}=b();return e.jsx("nav",{className:"flex h-full flex-col gap-1","aria-label":o("app.title"),children:T.map(s=>{const n=s.icon;return e.jsx(F,{to:s.to,onClick:t,className:({isActive:a})=>h("group relative flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200",a?"bg-primary/10 text-primary shadow-[inset_0_0_0_1px_rgba(59,130,246,0.08)]":"text-muted-foreground hover:bg-background/80 hover:text-foreground"),end:s.to==="/",title:o(s.labelKey),children:({isActive:a})=>e.jsxs(e.Fragment,{children:[a&&e.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-1 h-6 rounded-r-full bg-primary"}),e.jsx(n,{className:h("h-4 w-4 transition-colors",a?"text-primary":""),"aria-hidden":"true"}),e.jsx("span",{children:o(s.labelKey)})]})},s.to)})})}function st({onNavigate:t}){const{t:o}=b();return e.jsx(et,{delayDuration:0,children:e.jsx("nav",{className:"flex h-full flex-col gap-1","aria-label":o("app.title"),children:T.map(s=>{const n=s.icon;return e.jsxs(tt,{children:[e.jsx(at,{asChild:!0,children:e.jsx(F,{to:s.to,onClick:t,className:({isActive:a})=>h("group relative flex items-center justify-center rounded-lg p-2.5 transition-all duration-200",a?"bg-primary/10 text-primary shadow-[inset_0_0_0_1px_rgba(59,130,246,0.08)]":"text-muted-foreground hover:bg-background/80 hover:text-foreground"),end:s.to==="/",children:({isActive:a})=>e.jsxs(e.Fragment,{children:[a&&e.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-1 h-5 rounded-r-full bg-primary"}),e.jsx(n,{className:h("h-5 w-5",a?"text-primary":""),"aria-hidden":"true"})]})})}),e.jsx(ee,{side:"right",children:o(s.labelKey)})]},s.to)})})})}function nt(){const{t}=b(),o=H(),[s,n]=i.useState(!1),{authEnabled:a,username:r,logout:d}=ae(),[l,u]=i.useState(!1);i.useEffect(()=>{n(!1)},[o.pathname]);const c=i.useMemo(()=>o.pathname==="/"?T[0]:T.find(v=>v.to!=="/"&&o.pathname.startsWith(v.to))??T[0],[o.pathname]),m=t(c.labelKey),p=t(c.descriptionKey),x=async()=>{if(!l){u(!0);try{await d()}finally{u(!1)}}};return e.jsxs("div",{className:"app-shell relative flex min-h-screen bg-background",children:[e.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:t("app.skipToContent")}),e.jsxs("aside",{className:"hidden w-16 flex-col border-r border-white/40 bg-card/72 backdrop-blur-xl xl:hidden lg:flex",children:[e.jsx("div",{className:"flex h-16 items-center justify-center border-b border-white/40",children:e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-[1.1rem] bg-gradient-to-br from-primary via-primary to-sky-400 text-xs font-bold text-primary-foreground shadow-[0_12px_28px_-18px_rgba(59,130,246,0.8)]",children:"GW"})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:e.jsx(st,{})})]}),e.jsxs("aside",{className:"hidden w-64 flex-col border-r border-white/40 bg-card/72 backdrop-blur-xl xl:flex",children:[e.jsxs("div",{className:"flex h-20 items-center gap-3 border-b border-white/40 px-5",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-[1.1rem] bg-gradient-to-br from-primary via-primary to-sky-400 text-xs font-bold text-primary-foreground shadow-[0_12px_28px_-18px_rgba(59,130,246,0.8)]",children:"GW"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-semibold text-foreground",children:t("app.title")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("app.consoleSubtitle")})]})]}),e.jsx("div",{className:"border-b border-white/40 px-5 py-4",children:e.jsxs("div",{className:"rounded-[1.2rem] border border-white/50 bg-background/75 px-4 py-3 shadow-[0_1px_2px_rgba(15,23,42,0.04)]",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:t("app.environmentLabel")}),e.jsxs("div",{className:"mt-2 flex items-center gap-2 text-sm font-medium",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500"}),t("app.online")]})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:e.jsx(j,{})})]}),e.jsxs("div",{className:"flex flex-1 flex-col",children:[e.jsxs("header",{className:"sticky top-0 z-30 flex min-h-16 items-center justify-between gap-4 border-b border-white/40 bg-background/78 px-4 backdrop-blur-xl lg:px-6",children:[e.jsxs("div",{className:"flex items-center gap-3 lg:hidden",children:[e.jsx(P,{variant:"ghost",size:"icon",onClick:()=>n(v=>!v),"aria-label":t(s?"common.actions.closeNavigation":"common.actions.openNavigation"),"aria-expanded":s,"aria-controls":"mobile-nav",children:s?e.jsx(I,{className:"h-5 w-5"}):e.jsx(Te,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold tracking-[-0.01em]",children:m}),e.jsx("p",{className:"text-xs text-muted-foreground",children:p})]})]}),e.jsx("div",{className:"hidden min-w-0 flex-1 lg:block",children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-lg font-semibold tracking-[-0.02em] text-foreground",children:m}),e.jsx("p",{className:"truncate text-sm text-muted-foreground",children:p})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"hidden rounded-full border border-emerald-500/20 bg-emerald-500/10 px-3 py-1 text-xs font-medium text-emerald-700 dark:text-emerald-300 lg:inline-flex",children:t("app.online")}),a&&r&&e.jsx("span",{className:"hidden text-sm text-muted-foreground sm:inline",children:t("login.status",{username:r})}),a&&e.jsx(P,{variant:"ghost",size:"sm",onClick:()=>void x(),disabled:l,children:t(l?"common.actions.loading":"common.actions.logout")}),e.jsx(Ze,{}),e.jsx(Je,{})]})]}),e.jsx("main",{id:"main-content",role:"main",tabIndex:-1,className:"flex-1 overflow-y-auto",children:e.jsx("div",{className:"container 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:e.jsx(Ae,{})})})]}),s&&e.jsxs("div",{className:"fixed inset-0 z-40 lg:hidden",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm",onClick:()=>n(!1)}),e.jsxs("div",{id:"mobile-nav",className:"fixed inset-y-0 left-0 w-72 border-r border-white/40 bg-card/95 p-6 shadow-lg backdrop-blur-xl animate-in slide-in-from-left",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:t("app.title")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("app.consoleSubtitle")})]}),e.jsx(P,{variant:"ghost",size:"icon",onClick:()=>n(!1),"aria-label":t("common.actions.closeNavigation"),children:e.jsx(I,{className:"h-5 w-5"})})]}),e.jsx(j,{onNavigate:()=>n(!1)})]})]})]})}const it={zh:{translation:{app:{title:"cc-gw 控制台",skipToContent:"跳转到主要内容",consoleSubtitle:"网关控制平面",environmentLabel:"运行状态",online:"服务在线"},nav:{dashboard:"仪表盘",logs:"请求日志",events:"事件",models:"模型与路由管理",apiKeys:"API 密钥",settings:"设置",help:"使用指南",about:"关于"},language:{zh:"简体中文",en:"English"},common:{loading:"加载中...",loadingShort:"加载中...",noData:"暂无数据",languageSelector:"语言选择",yes:"是",edit:"编辑",delete:"删除",create:"创建",save:"保存",saving:"保存中...",cancel:"取消",actions:{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:"失败"},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小时来源地址",uniqueClientSessionsLastHour:"1小时会话",todayRequests:"今日请求",activeRequests:"活跃转发连接",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:{manualRefresh:"手动刷新",refreshing:"刷新中...",export:"导出日志",exporting:"导出中...",detail:"详情"},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:"压缩日志文件已开始下载。"},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:{request:"请求体",response:"响应体",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:"统一维护模型提供商配置、模型路由映射与自定义端点。",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:"跳转到"},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:"开启后会记录模型返回的数据(含流式片段);关闭可降低磁盘与隐私风险。",logLevel:"日志级别",logLevelOption:{fatal:"致命 (fatal)",error:"错误 (error)",warn:"警告 (warn)",info:"信息 (info)",debug:"调试 (debug)",trace:"跟踪 (trace)"},requestLogging:"输出访问日志",requestLoggingHint:"控制是否在终端打印“incoming request …”日志,方便观察访问来源。",responseLogging:"输出响应日志",responseLoggingHint:"控制是否输出“request completed …”日志(含状态码与耗时),关闭后终端更安静。",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 之间",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:"仅删除超过保留天数的历史日志,适合日常维护。",hardLabel:"高风险操作",hardTitle:"彻底清空日志",clearAll:"彻底清空",clearingAll:"清空中...",confirmCleanup:"该操作会删除超过保留天数的历史日志,但不会影响当前较新的记录。",confirmClearAll:"此操作会删除全部请求日志和日统计数据,且无法恢复。",clearAllWarning:"该操作会删除所有日志记录及日统计数据,请谨慎操作。"}},help:{title:"使用指南",intro:"完整的 cc-gw 配置和使用指南,帮助您从零开始搭建 AI 模型网关。",note:"所有配置变更都会实时生效。建议通过 Web UI 进行配置管理,CLI 主要用于服务启动和重启。",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)等关键指标",'📋 **日志分析**:使用"请求日志"页面筛选和分析请求记录,支持按 Provider、模型、状态、时间范围等多维度过滤','🔄 **模型路由管理**:在"模型管理 → 路由配置"中设置模型映射规则,实现不同模型的智能路由','🎛️ **系统配置**:在"设置"页面中调整日志保留策略、数据存储设置和运行参数',"🔐 **安全配置**:启用 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/ 目录(包含配置、日志和数据库)",'🧹 **日志清理**:根据需要调整日志保留天数,或使用"日志清理"功能手动清理','🔍 **问题排查**:开启"保存请求/响应内容"以便调试客户端兼容性问题',"⚡ **性能优化**:关闭不必要的访问日志可降低终端输出,提升服务性能","🎯 **模型切换**:使用路由模板功能,实现不同 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:"检查更新"}},toast:{statusError:{title:"状态加载失败"},updatesPlanned:"检查更新功能将在后续版本提供。"}},apiKeys:{title:"API 密钥管理",description:"创建和管理用于访问网关的 API 密钥",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:"未知密钥"},list:{title:"密钥列表",empty:"尚未创建 API 密钥,点击右上角按钮开始创建。",emptyFiltered:"当前筛选条件下没有匹配的 API 密钥。"},filters:{searchPlaceholder:"按名称、描述或端点搜索",all:"全部",enabled:"已启用",disabled:"已禁用"},summary:{wildcard:"通配符密钥:{{count}}",restricted:"受限密钥:{{count}}"},toast:{keyCreated:"API 密钥创建成功",keyUpdated:"API 密钥已更新",keyDeleted:"API 密钥已删除",keyCopied:"密钥已复制到剪贴板",createFailure:"创建失败:{{message}}",updateFailure:"更新失败:{{message}}",deleteFailure:"删除失败:{{message}}",revealFailure:"获取密钥失败",copyFailure:"复制失败"},allowedEndpoints:"允许的端点",allEndpoints:"全部端点(不限制)",editEndpoints:"编辑端点权限",endpointRestricted:"已限制端点",selectEndpoints:"选择此密钥可以访问的端点,不选择则允许访问全部端点。"},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:"请填写所有必填字段"}}},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"},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:{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"},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 client addresses",uniqueClientSessionsLastHour:"1h sessions",todayRequests:"Today requests",activeRequests:"Active forwarded connections",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:{manualRefresh:"Manual refresh",refreshing:"Refreshing...",export:"Export logs",exporting:"Exporting...",detail:"Detail"},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:"A compressed log archive is downloading now."},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:{request:"Request body",response:"Response body",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.",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"},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:"Keep the full prompt for debugging; disable if payloads are sensitive.",storeResponsePayloads:"Store response bodies",storeResponsePayloadsHint:"Persist the full model output (including streaming chunks). Disable to reduce disk usage.",logLevel:"Log level",logLevelOption:{fatal:"Fatal",error:"Error",warn:"Warn",info:"Info",debug:"Debug",trace:"Trace"},requestLogging:"Emit request logs",requestLoggingHint:"Controls the “incoming request …” lines printed to the console. Helpful for tracing traffic.",responseLogging:"Emit response logs",responseLoggingHint:"Controls the “request completed …” entries (status + latency). Disable for quieter output.",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",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.",hardLabel:"High-risk action",hardTitle:"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.",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 full payload replay for debugging client/provider compatibility issues.","“Model Management” lets you switch defaults or update mappings without redeploying IDE extensions or automation scripts.","“Settings” controls log retention, payload storage, and log verbosity 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/response bodies" to copy raw payloads from the log drawer when troubleshooting.',"Turn off request or response logs individually to keep the console quiet while preserving metrics and database records.","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",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"},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:{wildcard:"Wildcard keys: {{count}}",restricted:"Restricted 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."},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"}},toast:{statusError:{title:"Failed to load status"},updatesPlanned:"Update checks will arrive in a future release."}},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"}}}};C.isInitialized||C.use(Me).init({resources:it,lng:"zh",fallbackLng:"en",interpolation:{escapeValue:!1}});const oe=i.createContext(void 0);function rt(){return`toast_${Math.random().toString(36).slice(2)}`}function lt({children:t}){const[o,s]=i.useState([]),n=i.useCallback(l=>{s(u=>u.filter(c=>c.id!==l))},[]),a=i.useCallback(l=>{s(u=>u.map(c=>c.id===l?{...c,dismissing:!0}:c)),setTimeout(()=>n(l),200)},[n]),r=i.useCallback(l=>{const u=l.id??rt();s(m=>[...m,{...l,id:u}]);const c=l.durationMs??3e3;c>0&&setTimeout(()=>a(u),c)},[a]),d=i.useMemo(()=>({toasts:o,pushToast:r,dismissToast:a}),[o,a,r]);return e.jsxs(oe.Provider,{value:d,children:[t,e.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(l=>e.jsx("div",{role:"alert",className:`rounded-md border border-slate-200 bg-white p-4 shadow-lg dark:border-slate-700 dark:bg-slate-800 ${l.dismissing?"animate-toast-out":"animate-toast-in"} ${l.variant==="error"?"border-red-200 bg-red-50 text-red-900 dark:border-red-700 dark:bg-red-900/40 dark:text-red-200":l.variant==="success"?"border-emerald-200 bg-emerald-50 text-emerald-900 dark:border-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-200":""}`,children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold",children:l.title}),l.description?e.jsx("p",{className:"mt-1 text-sm opacity-75",children:l.description}):null]}),e.jsx("button",{type:"button","aria-label":"Dismiss",className:"text-sm text-slate-500 hover:text-slate-900 dark:text-slate-400 dark:hover:text-slate-100",onClick:()=>l.id&&a(l.id),children:"×"})]})},l.id))})]})}function It(){const t=i.useContext(oe);if(!t)throw new Error("useToast must be used within ToastProvider");return t}function dt({children:t}){const[o]=i.useState(()=>new we);return e.jsx(Fe,{client:o,children:e.jsx(He,{i18n:C,children:e.jsx(Be,{children:e.jsx(lt,{children:e.jsx(ot,{children:t})})})})})}function se(){const{t}=b();return e.jsx("div",{className:"flex h-full items-center justify-center p-12",role:"status","aria-live":"polite",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"}),e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:t("common.loading")})]})})}function Et(){const{t}=b();return e.jsxs("div",{className:"flex items-center gap-3 text-sm text-slate-500 dark:text-slate-400",children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-slate-300 border-t-transparent dark:border-slate-600"}),e.jsx("span",{children:t("common.loading")})]})}const ct=i.lazy(()=>y(()=>import("./Dashboard-OPVlXupp.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))),ut=i.lazy(()=>y(()=>import("./Logs-DN-Cl2dm.js"),__vite__mapDeps([16,1,10,11,6,7,17,18,19,9,12,13,14,15]))),pt=i.lazy(()=>y(()=>import("./Events-D7p4pym8.js"),__vite__mapDeps([20,1,7,18,9,12,13,14,15,11]))),N=i.lazy(()=>y(()=>import("./ModelManagement-CrpcomEc.js"),__vite__mapDeps([21,1,11,10,7,22,13,18,19,9,23,12,14,15]))),mt=i.lazy(()=>y(()=>import("./ApiKeys-CEJ9-jBz.js"),__vite__mapDeps([24,1,2,3,4,5,10,11,7,8,9,22,13,17,18,19,14,15]))),ht=i.lazy(()=>y(()=>import("./Settings-Bp_GpSh3.js"),__vite__mapDeps([25,1,10,11,7,22,13,17,18,19,9,23,12,14,15]))),gt=i.lazy(()=>y(()=>import("./About-g7O_JA6K.js"),__vite__mapDeps([26,1,10,11,7,8,9,14,15,13]))),ft=i.lazy(()=>y(()=>import("./Help-DbNTCxxV.js"),__vite__mapDeps([27,1,7,8,9,17,14,15,13,11]))),yt=i.lazy(()=>y(()=>import("./Login-h9CRbinI.js"),__vite__mapDeps([28,1,18,19,9,14,15,13,11])));function vt({children:t}){const{authEnabled:o,isAuthenticated:s,loading:n}=ae(),a=H();return n?e.jsx(se,{}):!o||s?t:e.jsx(O,{to:"/login",replace:!0,state:{from:a}})}function bt(){return e.jsx(dt,{children:e.jsx(Ie,{basename:typeof window<"u"&&window.location.pathname.startsWith("/ui")?"/ui":"/",children:e.jsx(i.Suspense,{fallback:e.jsx(se,{}),children:e.jsxs(Ee,{children:[e.jsxs(g,{path:"/",element:e.jsx(vt,{children:e.jsx(nt,{})}),children:[e.jsx(g,{index:!0,element:e.jsx(ct,{})}),e.jsx(g,{path:"logs",element:e.jsx(ut,{})}),e.jsx(g,{path:"events",element:e.jsx(pt,{})}),e.jsx(g,{path:"models",element:e.jsx(N,{})}),e.jsx(g,{path:"providers",element:e.jsx(N,{})}),e.jsx(g,{path:"api-keys",element:e.jsx(mt,{})}),e.jsx(g,{path:"settings",element:e.jsx(ht,{})}),e.jsx(g,{path:"about",element:e.jsx(gt,{})}),e.jsx(g,{path:"help",element:e.jsx(ft,{})})]}),e.jsx(g,{path:"/login",element:e.jsx(yt,{})}),e.jsx(g,{path:"*",element:e.jsx(O,{to:"/",replace:!0})})]})})})})}const ne=document.getElementById("root");if(!ne)throw new Error("Root element #root not found");Ce.createRoot(ne).render(e.jsx(ke.StrictMode,{children:e.jsx(bt,{})}));export{P as B,Et as L,et as T,f as a,kt as b,h as c,tt as d,At as e,at as f,ee as g,se as h,ae as i,w as t,It as u};
|