@chenpu17/cc-gw 0.3.11 → 0.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/README.md +26 -1
  2. package/package.json +1 -1
  3. package/src/cli/dist/index.js +1 -0
  4. package/src/server/dist/index.js +2451 -208
  5. package/src/web/dist/assets/{About-DmfYXdTi.js → About-AtNnIQdC.js} +2 -2
  6. package/src/web/dist/assets/{ApiKeys-Bq84uD5O.js → ApiKeys-C0HThTh3.js} +1 -1
  7. package/src/web/dist/assets/{Button-B4UYWk6z.js → Button-BILWXCdK.js} +1 -1
  8. package/src/web/dist/assets/{Dashboard-CJmps0fW.js → Dashboard-MoDWKsK7.js} +1 -1
  9. package/src/web/dist/assets/{FormField-DKIC96zy.js → FormField-CQdheUGn.js} +1 -1
  10. package/src/web/dist/assets/{Help-C7fFCpNH.js → Help-_WE0-0d_.js} +1 -1
  11. package/src/web/dist/assets/{Input-Cr1GbVY7.js → Input-BNPjbXjl.js} +1 -1
  12. package/src/web/dist/assets/{Login-f_-O93Uo.js → Login-fnBtj3Wf.js} +1 -1
  13. package/src/web/dist/assets/{Logs-CyN3g8z0.js → Logs-u8JddAMA.js} +1 -1
  14. package/src/web/dist/assets/ModelManagement-B5GXkgZG.js +1 -0
  15. package/src/web/dist/assets/{PageSection-eOpSKdGw.js → PageSection-BSlxJLSp.js} +1 -1
  16. package/src/web/dist/assets/Settings-B7l_r0Os.js +1 -0
  17. package/src/web/dist/assets/{StatusBadge-CFXAJ2QF.js → StatusBadge-C2HAoly7.js} +1 -1
  18. package/src/web/dist/assets/{copy-Br9n1n5X.js → copy-29mhVWV7.js} +1 -1
  19. package/src/web/dist/assets/index-BfK_4zVV.css +1 -0
  20. package/src/web/dist/assets/{index-DtOsr5xX.js → index-C9B4ue7v.js} +1 -1
  21. package/src/web/dist/assets/{index-ChT0XT-w.js → index-jumaCK3B.js} +4 -4
  22. package/src/web/dist/assets/{info-Cnwm2-vh.js → info-m01xBxq8.js} +1 -1
  23. package/src/web/dist/assets/{useApiQuery-mBT5M_Q6.js → useApiQuery-Ckrkcu4L.js} +1 -1
  24. package/src/web/dist/index.html +2 -2
  25. package/src/web/dist/assets/ModelManagement-B11a4hW3.js +0 -1
  26. package/src/web/dist/assets/Settings-BUNwIquC.js +0 -1
  27. package/src/web/dist/assets/index-BOv43c_r.css +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-CJmps0fW.js","assets/index-DtOsr5xX.js","assets/PageSection-eOpSKdGw.js","assets/Input-Cr1GbVY7.js","assets/StatusBadge-CFXAJ2QF.js","assets/useApiQuery-mBT5M_Q6.js","assets/Logs-CyN3g8z0.js","assets/FormField-DKIC96zy.js","assets/Button-B4UYWk6z.js","assets/ModelManagement-B11a4hW3.js","assets/ApiKeys-Bq84uD5O.js","assets/copy-Br9n1n5X.js","assets/Settings-BUNwIquC.js","assets/About-DmfYXdTi.js","assets/info-Cnwm2-vh.js","assets/Help-C7fFCpNH.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-MoDWKsK7.js","assets/index-C9B4ue7v.js","assets/PageSection-BSlxJLSp.js","assets/Input-BNPjbXjl.js","assets/StatusBadge-C2HAoly7.js","assets/useApiQuery-Ckrkcu4L.js","assets/Logs-u8JddAMA.js","assets/FormField-CQdheUGn.js","assets/Button-BILWXCdK.js","assets/ModelManagement-B5GXkgZG.js","assets/ApiKeys-C0HThTh3.js","assets/copy-29mhVWV7.js","assets/Settings-B7l_r0Os.js","assets/About-AtNnIQdC.js","assets/info-m01xBxq8.js","assets/Help-_WE0-0d_.js"])))=>i.map(i=>d[i]);
2
2
  var nm=Object.defineProperty;var wu=e=>{throw TypeError(e)};var rm=(e,t,n)=>t in e?nm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var xu=(e,t,n)=>rm(e,typeof t!="symbol"?t+"":t,n),Ro=(e,t,n)=>t.has(e)||wu("Cannot "+n);var P=(e,t,n)=>(Ro(e,t,"read from private field"),n?n.call(e):t.get(e)),z=(e,t,n)=>t.has(e)?wu("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),_=(e,t,n,r)=>(Ro(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ge=(e,t,n)=>(Ro(e,t,"access private method"),n);var zs=(e,t,n,r)=>({set _(s){_(e,t,s,n)},get _(){return P(e,t,r)}});function sm(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function im(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Dd={exports:{}},eo={},Md={exports:{}},M={};/**
3
3
  * @license React
4
4
  * react.production.min.js
@@ -145,7 +145,7 @@ Error generating stack: `+i.message+`
145
145
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Gc]=this[Gc]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Br(o);r[a]||(L1(s,o),r[a]=!0)}return k.isArray(t)?t.forEach(i):i(t),this}};Fe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);k.reduceDescriptors(Fe.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});k.freezeMethods(Fe);function ra(e,t){const n=this||Ms,r=t||n,s=Fe.from(r.headers);let i=r.data;return k.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Ih(e){return!!(e&&e.__CANCEL__)}function Ir(e,t,n){D.call(this,e??"canceled",D.ERR_CANCELED,t,n),this.name="CanceledError"}k.inherits(Ir,D,{__CANCEL__:!0});function Fh(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new D("Request failed with status code "+n.status,[D.ERR_BAD_REQUEST,D.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function O1(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function N1(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),c=r[i];o||(o=u),n[s]=l,r[s]=u;let d=i,f=0;for(;d!==s;)f+=n[d++],d=d%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const w=c&&u-c;return w?Math.round(f*1e3/w):void 0}}function A1(e,t){let n=0,r=1e3/t,s,i;const o=(u,c=Date.now())=>{n=c,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const c=Date.now(),d=c-n;d>=r?o(u,c):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>s&&o(s)]}const Qi=(e,t,n=3)=>{let r=0;const s=N1(50,250);return A1(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=o-r,u=s(l),c=o<=a;r=o;const d={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a&&c?(a-o)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},n)},Yc=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Xc=e=>(...t)=>k.asap(()=>e(...t)),I1=xe.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,xe.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(xe.origin),xe.navigator&&/(msie|trident)/i.test(xe.navigator.userAgent)):()=>!0,F1=xe.hasStandardBrowserEnv?{write(e,t,n,r,s,i){const o=[e+"="+encodeURIComponent(t)];k.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),k.isString(r)&&o.push("path="+r),k.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function _1(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function j1(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function _h(e,t,n){let r=!_1(t);return e&&(r||n==!1)?j1(e,t):t}const Zc=e=>e instanceof Fe?{...e}:e;function Mn(e,t){t=t||{};const n={};function r(u,c,d,f){return k.isPlainObject(u)&&k.isPlainObject(c)?k.merge.call({caseless:f},u,c):k.isPlainObject(c)?k.merge({},c):k.isArray(c)?c.slice():c}function s(u,c,d,f){if(k.isUndefined(c)){if(!k.isUndefined(u))return r(void 0,u,d,f)}else return r(u,c,d,f)}function i(u,c){if(!k.isUndefined(c))return r(void 0,c)}function o(u,c){if(k.isUndefined(c)){if(!k.isUndefined(u))return r(void 0,u)}else return r(void 0,c)}function a(u,c,d){if(d in t)return r(u,c);if(d in e)return r(void 0,u)}const l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(u,c,d)=>s(Zc(u),Zc(c),d,!0)};return k.forEach(Object.keys({...e,...t}),function(c){const d=l[c]||s,f=d(e[c],t[c],c);k.isUndefined(f)&&d!==a||(n[c]=f)}),n}const jh=e=>{const t=Mn({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=Fe.from(o),t.url=Oh(_h(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),k.isFormData(n)){if(xe.hasStandardBrowserEnv||xe.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(k.isFunction(n.getHeaders)){const l=n.getHeaders(),u=["content-type","content-length"];Object.entries(l).forEach(([c,d])=>{u.includes(c.toLowerCase())&&o.set(c,d)})}}if(xe.hasStandardBrowserEnv&&(r&&k.isFunction(r)&&(r=r(t)),r||r!==!1&&I1(t.url))){const l=s&&i&&F1.read(i);l&&o.set(s,l)}return t},D1=typeof XMLHttpRequest<"u",M1=D1&&function(e){return new Promise(function(n,r){const s=jh(e);let i=s.data;const o=Fe.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:u}=s,c,d,f,w,g;function v(){w&&w(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(c),s.signal&&s.signal.removeEventListener("abort",c)}let x=new XMLHttpRequest;x.open(s.method.toUpperCase(),s.url,!0),x.timeout=s.timeout;function h(){if(!x)return;const m=Fe.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:m,config:e,request:x};Fh(function(b){n(b),v()},function(b){r(b),v()},C),x=null}"onloadend"in x?x.onloadend=h:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(h)},x.onabort=function(){x&&(r(new D("Request aborted",D.ECONNABORTED,e,x)),x=null)},x.onerror=function(y){const C=y&&y.message?y.message:"Network Error",T=new D(C,D.ERR_NETWORK,e,x);T.event=y||null,r(T),x=null},x.ontimeout=function(){let y=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||Nh;s.timeoutErrorMessage&&(y=s.timeoutErrorMessage),r(new D(y,C.clarifyTimeoutError?D.ETIMEDOUT:D.ECONNABORTED,e,x)),x=null},i===void 0&&o.setContentType(null),"setRequestHeader"in x&&k.forEach(o.toJSON(),function(y,C){x.setRequestHeader(C,y)}),k.isUndefined(s.withCredentials)||(x.withCredentials=!!s.withCredentials),a&&a!=="json"&&(x.responseType=s.responseType),u&&([f,g]=Qi(u,!0),x.addEventListener("progress",f)),l&&x.upload&&([d,w]=Qi(l),x.upload.addEventListener("progress",d),x.upload.addEventListener("loadend",w)),(s.cancelToken||s.signal)&&(c=m=>{x&&(r(!m||m.type?new Ir(null,e,x):m),x.abort(),x=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));const p=O1(s.url);if(p&&xe.protocols.indexOf(p)===-1){r(new D("Unsupported protocol "+p+":",D.ERR_BAD_REQUEST,e));return}x.send(i||null)})},U1=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(u){if(!s){s=!0,a();const c=u instanceof Error?u:this.reason;r.abort(c instanceof D?c:new Ir(c instanceof Error?c.message:c))}};let o=t&&setTimeout(()=>{o=null,i(new D(`timeout ${t} of ms exceeded`,D.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:l}=r;return l.unsubscribe=()=>k.asap(a),l}},z1=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},$1=async function*(e,t){for await(const n of B1(e))yield*z1(n,t)},B1=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},ed=(e,t,n,r)=>{const s=$1(e,t);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:c}=await s.next();if(u){a(),l.close();return}let d=c.byteLength;if(n){let f=i+=d;n(f)}l.enqueue(new Uint8Array(c))}catch(u){throw a(u),u}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},td=64*1024,{isFunction:si}=k,H1=(({Request:e,Response:t})=>({Request:e,Response:t}))(k.global),{ReadableStream:nd,TextEncoder:rd}=k.global,sd=(e,...t)=>{try{return!!e(...t)}catch{return!1}},K1=e=>{e=k.merge.call({skipUndefined:!0},H1,e);const{fetch:t,Request:n,Response:r}=e,s=t?si(t):typeof fetch=="function",i=si(n),o=si(r);if(!s)return!1;const a=s&&si(nd),l=s&&(typeof rd=="function"?(g=>v=>g.encode(v))(new rd):async g=>new Uint8Array(await new n(g).arrayBuffer())),u=i&&a&&sd(()=>{let g=!1;const v=new n(xe.origin,{body:new nd,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return g&&!v}),c=o&&a&&sd(()=>k.isReadableStream(new r("").body)),d={stream:c&&(g=>g.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!d[g]&&(d[g]=(v,x)=>{let h=v&&v[g];if(h)return h.call(v);throw new D(`Response type '${g}' is not supported`,D.ERR_NOT_SUPPORT,x)})});const f=async g=>{if(g==null)return 0;if(k.isBlob(g))return g.size;if(k.isSpecCompliantForm(g))return(await new n(xe.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if(k.isArrayBufferView(g)||k.isArrayBuffer(g))return g.byteLength;if(k.isURLSearchParams(g)&&(g=g+""),k.isString(g))return(await l(g)).byteLength},w=async(g,v)=>{const x=k.toFiniteNumber(g.getContentLength());return x??f(v)};return async g=>{let{url:v,method:x,data:h,signal:p,cancelToken:m,timeout:y,onDownloadProgress:C,onUploadProgress:T,responseType:b,headers:O,withCredentials:U="same-origin",fetchOptions:A}=jh(g),H=t||fetch;b=b?(b+"").toLowerCase():"text";let Xe=U1([p,m&&m.toAbortSignal()],y),_e=null;const me=Xe&&Xe.unsubscribe&&(()=>{Xe.unsubscribe()});let ct;try{if(T&&u&&x!=="get"&&x!=="head"&&(ct=await w(O,h))!==0){let $=new n(v,{method:"POST",body:h,duplex:"half"}),V;if(k.isFormData(h)&&(V=$.headers.get("content-type"))&&O.setContentType(V),$.body){const[Dt,He]=Yc(ct,Qi(Xc(T)));h=ed($.body,td,Dt,He)}}k.isString(U)||(U=U?"include":"omit");const ie=i&&"credentials"in n.prototype,kt={...A,signal:Xe,method:x.toUpperCase(),headers:O.normalize().toJSON(),body:h,duplex:"half",credentials:ie?U:void 0};_e=i&&new n(v,kt);let L=await(i?H(_e,A):H(v,kt));const I=c&&(b==="stream"||b==="response");if(c&&(C||I&&me)){const $={};["status","statusText","headers"].forEach($n=>{$[$n]=L[$n]});const V=k.toFiniteNumber(L.headers.get("content-length")),[Dt,He]=C&&Yc(V,Qi(Xc(C),!0))||[];L=new r(ed(L.body,td,Dt,()=>{He&&He(),me&&me()}),$)}b=b||"text";let F=await d[k.findKey(d,b)||"text"](L,g);return!I&&me&&me(),await new Promise(($,V)=>{Fh($,V,{data:F,headers:Fe.from(L.headers),status:L.status,statusText:L.statusText,config:g,request:_e})})}catch(ie){throw me&&me(),ie&&ie.name==="TypeError"&&/Load failed|fetch/i.test(ie.message)?Object.assign(new D("Network Error",D.ERR_NETWORK,g,_e),{cause:ie.cause||ie}):D.from(ie,ie&&ie.code,g,_e)}}},q1=new Map,Dh=e=>{let t=e?e.env:{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,a=o,l,u,c=q1;for(;a--;)l=i[a],u=c.get(l),u===void 0&&c.set(l,u=a?new Map:K1(t)),c=u;return u};Dh();const cl={http:l1,xhr:M1,fetch:{get:Dh}};k.forEach(cl,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const id=e=>`- ${e}`,V1=e=>k.isFunction(e)||e===null||e===!1,Mh={getAdapter:(e,t)=>{e=k.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let a;if(s=r,!V1(r)&&(s=cl[(a=String(r)).toLowerCase()],s===void 0))throw new D(`Unknown adapter '${a}'`);if(s&&(k.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
146
146
  `+o.map(id).join(`
147
147
  `):" "+id(o[0]):"as no adapter specified";throw new D("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s},adapters:cl};function sa(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ir(null,e)}function od(e){return sa(e),e.headers=Fe.from(e.headers),e.data=ra.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Mh.getAdapter(e.adapter||Ms.adapter,e)(e).then(function(r){return sa(e),r.data=ra.call(e,e.transformResponse,r),r.headers=Fe.from(r.headers),r},function(r){return Ih(r)||(sa(e),r&&r.response&&(r.response.data=ra.call(e,e.transformResponse,r.response),r.response.headers=Fe.from(r.response.headers))),Promise.reject(r)})}const Uh="1.12.2",Po={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Po[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const ad={};Po.transitional=function(t,n,r){function s(i,o){return"[Axios v"+Uh+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new D(s(o," has been removed"+(n?" in "+n:"")),D.ERR_DEPRECATED);return n&&!ad[o]&&(ad[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,a):!0}};Po.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function W1(e,t,n){if(typeof e!="object")throw new D("options must be an object",D.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const a=e[i],l=a===void 0||o(a,i,e);if(l!==!0)throw new D("option "+i+" must be "+l,D.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new D("Unknown option "+i,D.ERR_BAD_OPTION)}}const ki={assertOptions:W1,validators:Po},ft=ki.validators;let An=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Jc,response:new Jc}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
148
- `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Mn(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&ki.assertOptions(r,{silentJSONParsing:ft.transitional(ft.boolean),forcedJSONParsing:ft.transitional(ft.boolean),clarifyTimeoutError:ft.transitional(ft.boolean)},!1),s!=null&&(k.isFunction(s)?n.paramsSerializer={serialize:s}:ki.assertOptions(s,{encode:ft.function,serialize:ft.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ki.assertOptions(n,{baseUrl:ft.spelling("baseURL"),withXsrfToken:ft.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&k.merge(i.common,i[n.method]);i&&k.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),n.headers=Fe.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(l=l&&v.synchronous,a.unshift(v.fulfilled,v.rejected))});const u=[];this.interceptors.response.forEach(function(v){u.push(v.fulfilled,v.rejected)});let c,d=0,f;if(!l){const g=[od.bind(this),void 0];for(g.unshift(...a),g.push(...u),f=g.length,c=Promise.resolve(n);d<f;)c=c.then(g[d++],g[d++]);return c}f=a.length;let w=n;for(;d<f;){const g=a[d++],v=a[d++];try{w=g(w)}catch(x){v.call(this,x);break}}try{c=od.call(this,w)}catch(g){return Promise.reject(g)}for(d=0,f=u.length;d<f;)c=c.then(u[d++],u[d++]);return c}getUri(t){t=Mn(this.defaults,t);const n=_h(t.baseURL,t.url,t.allowAbsoluteUrls);return Oh(n,t.params,t.paramsSerializer)}};k.forEach(["delete","get","head","options"],function(t){An.prototype[t]=function(n,r){return this.request(Mn(r||{},{method:t,url:n,data:(r||{}).data}))}});k.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,a){return this.request(Mn(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}An.prototype[t]=n(),An.prototype[t+"Form"]=n(!0)});let Q1=class zh{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,a){r.reason||(r.reason=new Ir(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new zh(function(s){t=s}),cancel:t}}};function J1(e){return function(n){return e.apply(null,n)}}function G1(e){return k.isObject(e)&&e.isAxiosError===!0}const dl={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(dl).forEach(([e,t])=>{dl[t]=e});function $h(e){const t=new An(e),n=vh(An.prototype.request,t);return k.extend(n,An.prototype,t,{allOwnKeys:!0}),k.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return $h(Mn(e,s))},n}const ne=$h(Ms);ne.Axios=An;ne.CanceledError=Ir;ne.CancelToken=Q1;ne.isCancel=Ih;ne.VERSION=Uh;ne.toFormData=Co;ne.AxiosError=D;ne.Cancel=ne.CanceledError;ne.all=function(t){return Promise.all(t)};ne.spread=J1;ne.isAxiosError=G1;ne.mergeConfig=Mn;ne.AxiosHeaders=Fe;ne.formToJSON=e=>Ah(k.isHTMLForm(e)?new FormData(e):e);ne.getAdapter=Mh.getAdapter;ne.HttpStatusCode=dl;ne.default=ne;const{Axios:jx,AxiosError:Dx,CanceledError:Mx,isCancel:Ux,CancelToken:zx,VERSION:$x,all:Bx,Cancel:Hx,isAxiosError:Kx,spread:qx,toFormData:Vx,AxiosHeaders:Wx,HttpStatusCode:Qx,formToJSON:Jx,getAdapter:Gx,mergeConfig:Yx}=ne,qn=ne.create({baseURL:"/",timeout:15e3,withCredentials:!0});qn.interceptors.response.use(e=>e,e=>Promise.reject(e));function ia(e){var t,n,r;if(ne.isAxiosError(e)){const s=(t=e.response)==null?void 0:t.status;return{message:((r=(n=e.response)==null?void 0:n.data)==null?void 0:r.error)||e.message||"请求失败,请稍后再试",status:s,code:String(s??"unknown")}}return{message:e instanceof Error?e.message:"请求失败,请稍后再试"}}const Bh=S.createContext(void 0);function Y1({children:e}){const t=S.useRef(!0),[n,r]=S.useState({loading:!0,authEnabled:!1,isAuthenticated:!0,username:void 0,error:null}),s=S.useCallback(u=>{t.current&&r(u)},[]),i=S.useCallback(async()=>{s(u=>({...u,loading:!0,error:null}));try{const{data:u}=await qn.get("/auth/session");s(()=>({loading:!1,authEnabled:!!u.authEnabled,isAuthenticated:!u.authEnabled||!!u.authenticated,username:u.username??void 0,error:null}))}catch(u){const c=ia(u);s(()=>({loading:!1,authEnabled:!1,isAuthenticated:!0,username:void 0,error:c.message}))}},[s]),o=S.useCallback(async(u,c)=>{s(d=>({...d,loading:!0,error:null}));try{await qn.post("/auth/login",{username:u,password:c}),await i()}catch(d){const f=ia(d);throw s(w=>({...w,loading:!1,error:f.message,isAuthenticated:!1})),f}},[i,s]),a=S.useCallback(async()=>{s(u=>({...u,loading:!0}));try{await qn.post("/auth/logout")}catch(u){const c=ia(u);s(d=>({...d,error:c.message}))}finally{await i()}},[i,s]);S.useEffect(()=>{t.current=!0,i();const u=qn.interceptors.response.use(c=>c,async c=>{var d;return((d=c==null?void 0:c.response)==null?void 0:d.status)===401&&await i(),Promise.reject(c)});return()=>{t.current=!1,qn.interceptors.response.eject(u)}},[i]);const l=S.useMemo(()=>({...n,refresh:i,login:o,logout:a}),[n,i,o,a]);return E.jsx(Bh.Provider,{value:l,children:e})}function Hh(){const e=S.useContext(Bh);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const X1=[{to:"/",icon:av,labelKey:"nav.dashboard"},{to:"/logs",icon:uv,labelKey:"nav.logs"},{to:"/models",icon:fv,labelKey:"nav.models"},{to:"/api-keys",icon:cv,labelKey:"nav.apiKeys"},{to:"/settings",icon:gv,labelKey:"nav.settings"},{to:"/help",icon:pv,labelKey:"nav.help"},{to:"/about",icon:lv,labelKey:"nav.about"}];function ld({onNavigate:e}){const{t}=Fs();return E.jsx("nav",{className:"flex h-full flex-col gap-1","aria-label":t("app.title"),children:X1.map(n=>{const r=n.icon;return E.jsx(My,{to:n.to,onClick:e,className:({isActive:s})=>Lt("group relative flex items-center justify-center gap-1.5 rounded-lg px-1.5 py-1.5 transition-all duration-200",s?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"text-slate-600 hover:bg-slate-100 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-800 dark:hover:text-slate-200"),end:n.to==="/",title:t(n.labelKey),children:({isActive:s})=>E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"flex h-7 w-7 items-center justify-center",children:E.jsx(r,{size:14,className:Lt("transition-colors duration-200",s?"text-blue-600 dark:text-blue-400":"text-slate-500 dark:text-slate-400"),"aria-hidden":"true"})}),E.jsx("span",{className:Lt("hidden xl:block font-medium text-xs leading-tight whitespace-nowrap transition-colors duration-200",s?"text-blue-700 dark:text-blue-300":"text-slate-700 dark:text-slate-300"),children:t(n.labelKey)})]})},n.to)})})}function Z1(){const{t:e}=Fs(),t=mn(),[n,r]=S.useState(!1),{authEnabled:s,username:i,logout:o}=Hh(),[a,l]=S.useState(!1);S.useEffect(()=>{r(!1)},[t.pathname]);const u=async()=>{if(!a){l(!0);try{await o()}finally{l(!1)}}};return E.jsxs("div",{className:"relative flex min-h-screen text-slate-900 dark:text-slate-50",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-blue-600 focus:px-4 focus:py-2 focus:text-white",children:e("app.skipToContent")}),E.jsxs("aside",{className:"relative z-20 hidden flex-col gap-3 border-r border-slate-200/20 bg-white/60 px-2 py-3 shadow-md shadow-slate-200/15 backdrop-blur-sm lg:flex lg:w-36 lg:min-w-[9rem] lg:max-w-[9rem] xl:w-40 xl:min-w-[10rem] xl:max-w-[10rem] 2xl:w-44 2xl:min-w-[11rem] 2xl:max-w-[11rem] lg:flex-shrink-0 dark:border-slate-800/20 dark:bg-slate-950/60 dark:shadow-lg dark:shadow-slate-900/20",children:[E.jsx("div",{className:"space-y-2","aria-label":e("app.title"),children:E.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-slate-200/30 bg-white/80 p-1.5 shadow-sm shadow-slate-200/20 backdrop-blur-sm dark:border-slate-700/30 dark:bg-slate-900/80 dark:shadow-md dark:shadow-slate-900/20",children:[E.jsx("div",{className:"grid h-6 w-6 place-items-center rounded-lg bg-gradient-to-br from-blue-500 via-blue-600 to-indigo-600 text-xs font-bold text-white shadow-md shadow-blue-500/20",children:"GW"}),E.jsx("div",{className:"hidden xl:block",children:E.jsx("p",{className:"text-xs font-bold text-slate-800 dark:text-slate-100 truncate",children:e("app.title")})})]})}),E.jsx("div",{className:"flex-1 overflow-y-auto",children:E.jsx(ld,{})})]}),E.jsxs("div",{className:"flex flex-1 flex-col",children:[E.jsxs("header",{className:"sticky top-0 z-30 flex items-center justify-between gap-2 sm:gap-4 border-b border-slate-200/30 bg-white/90 px-3 sm:px-4 lg:px-6 py-2.5 sm:py-3 shadow-md shadow-slate-200/15 backdrop-blur-sm dark:border-slate-800/30 dark:bg-slate-950/90 dark:shadow-lg dark:shadow-slate-900/20",children:[E.jsxs("div",{className:"flex items-center gap-3 lg:hidden",children:[E.jsx("button",{type:"button",className:"inline-flex h-11 w-11 items-center justify-center rounded-2xl border border-slate-200/50 bg-white/90 text-slate-600 shadow-lg shadow-slate-200/30 transition-shadow duration-200 hover:bg-white hover:shadow-xl dark:border-slate-700/50 dark:bg-slate-900/90 dark:text-slate-200 dark:shadow-xl dark:shadow-slate-900/30 dark:hover:bg-slate-900",onClick:()=>r(c=>!c),"aria-label":e(n?"common.actions.closeNavigation":"common.actions.openNavigation"),"aria-expanded":n,"aria-controls":"mobile-nav",children:n?E.jsx($c,{size:20,"aria-hidden":"true"}):E.jsx(hv,{size:20,"aria-hidden":"true"})}),E.jsx("div",{className:"text-lg font-bold gradient-text",children:e("app.title")})]}),E.jsxs("div",{className:"flex items-center gap-3",children:[s?E.jsxs("div",{className:"flex items-center gap-3",children:[i?E.jsx("span",{className:"hidden text-xs font-medium text-slate-500 dark:text-slate-400 sm:inline",children:e("login.status",{username:i})}):null,E.jsx("button",{type:"button",onClick:()=>void u(),className:Lt(yh,"h-10 rounded-full px-4"),disabled:a,children:e(a?"common.actions.loading":"common.actions.logout")})]}):null,E.jsx(Sv,{}),E.jsx(kv,{})]})]}),E.jsx("main",{id:"main-content",role:"main",tabIndex:-1,className:"flex-1 overflow-y-auto px-3 sm:px-4 lg:px-6 pb-8 sm:pb-12 lg:pb-16 pt-6 sm:pt-8",children:E.jsx("div",{className:Lt(xv,"animate-fade-in"),children:E.jsx(Py,{})})})]}),n?E.jsx("div",{className:"fixed inset-0 z-40 bg-slate-900/80 backdrop-blur-sm lg:hidden animate-fade-in",role:"dialog","aria-modal":"true",children:E.jsxs("div",{id:"mobile-nav",className:"absolute inset-y-0 left-0 w-72 sm:w-80 border-r border-slate-200/40 bg-gradient-to-b from-white/95 to-white/90 px-4 sm:px-6 py-6 sm:py-8 shadow-2xl shadow-slate-900/30 backdrop-blur-xl animate-slide-up dark:border-slate-800/40 dark:from-slate-950/95 dark:to-slate-950/90 gpu-accelerated",children:[E.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[E.jsx("span",{className:"text-lg font-bold gradient-text",children:e("app.title")}),E.jsx("button",{type:"button",className:"inline-flex h-10 w-10 items-center justify-center rounded-2xl border border-slate-200/50 bg-white/90 text-slate-600 shadow-lg shadow-slate-200/30 transition-shadow duration-200 hover:bg-white dark:border-slate-700/50 dark:bg-slate-900/90 dark:text-slate-200 dark:shadow-xl dark:shadow-slate-900/30",onClick:()=>r(!1),"aria-label":e("common.actions.closeNavigation"),children:E.jsx($c,{size:18,"aria-hidden":"true"})})]}),E.jsx(ld,{onNavigate:()=>r(!1)})]})}):null]})}var Eo=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ew={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Kt,yl,Rd,tw=(Rd=class{constructor(){z(this,Kt,ew);z(this,yl,!1)}setTimeoutProvider(e){_(this,Kt,e)}setTimeout(e,t){return P(this,Kt).setTimeout(e,t)}clearTimeout(e){P(this,Kt).clearTimeout(e)}setInterval(e,t){return P(this,Kt).setInterval(e,t)}clearInterval(e){P(this,Kt).clearInterval(e)}},Kt=new WeakMap,yl=new WeakMap,Rd),fl=new tw;function nw(e){setTimeout(e,0)}var bo=typeof window>"u"||"Deno"in globalThis;function tt(){}function rw(e,t){return typeof e=="function"?e(t):e}function sw(e){return typeof e=="number"&&e>=0&&e!==1/0}function iw(e,t){return Math.max(e+(t||0)-Date.now(),0)}function pl(e,t){return typeof e=="function"?e(t):e}function ow(e,t){return typeof e=="function"?e(t):e}function ud(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==yu(o,t.options))return!1}else if(!Ps(t.queryKey,o))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function cd(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Cs(t.options.mutationKey)!==Cs(i))return!1}else if(!Ps(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function yu(e,t){return((t==null?void 0:t.queryKeyHashFn)||Cs)(e)}function Cs(e){return JSON.stringify(e,(t,n)=>hl(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ps(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ps(e[n],t[n])):!1}var aw=Object.prototype.hasOwnProperty;function Kh(e,t){if(e===t)return e;const n=dd(e)&&dd(t);if(!n&&!(hl(e)&&hl(t)))return t;const s=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),o=i.length,a=n?new Array(o):{};let l=0;for(let u=0;u<o;u++){const c=n?u:i[u],d=e[c],f=t[c];if(d===f){a[c]=d,(n?u<s:aw.call(e,c))&&l++;continue}if(d===null||f===null||typeof d!="object"||typeof f!="object"){a[c]=f;continue}const w=Kh(d,f);a[c]=w,w===d&&l++}return s===o&&l===s?e:a}function Xx(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function dd(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function hl(e){if(!fd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!fd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function fd(e){return Object.prototype.toString.call(e)==="[object Object]"}function lw(e){return new Promise(t=>{fl.setTimeout(t,e)})}function uw(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Kh(e,t):t}function Zx(e){return e}function cw(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function dw(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var vu=Symbol();function qh(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===vu?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ek(e,t){return typeof e=="function"?e(...t):!!e}var Cn,qt,cr,Ld,fw=(Ld=class extends Eo{constructor(){super();z(this,Cn);z(this,qt);z(this,cr);_(this,cr,t=>{if(!bo&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){P(this,qt)||this.setEventListener(P(this,cr))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,qt))==null||t.call(this),_(this,qt,void 0))}setEventListener(t){var n;_(this,cr,t),(n=P(this,qt))==null||n.call(this),_(this,qt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){P(this,Cn)!==t&&(_(this,Cn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof P(this,Cn)=="boolean"?P(this,Cn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Cn=new WeakMap,qt=new WeakMap,cr=new WeakMap,Ld),Vh=new fw;function pw(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var hw=nw;function mw(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=hw;const i=a=>{t?e.push(a):s(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||o()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var Pe=mw(),dr,Vt,fr,Od,gw=(Od=class extends Eo{constructor(){super();z(this,dr,!0);z(this,Vt);z(this,fr);_(this,fr,t=>{if(!bo&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){P(this,Vt)||this.setEventListener(P(this,fr))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,Vt))==null||t.call(this),_(this,Vt,void 0))}setEventListener(t){var n;_(this,fr,t),(n=P(this,Vt))==null||n.call(this),_(this,Vt,t(this.setOnline.bind(this)))}setOnline(t){P(this,dr)!==t&&(_(this,dr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return P(this,dr)}},dr=new WeakMap,Vt=new WeakMap,fr=new WeakMap,Od),Ji=new gw;function yw(e){return Math.min(1e3*2**e,3e4)}function Wh(e){return(e??"online")==="online"?Ji.isOnline():!0}var ml=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Qh(e){let t=!1,n=0,r;const s=pw(),i=()=>s.status!=="pending",o=v=>{var x;if(!i()){const h=new ml(v);f(h),(x=e.onCancel)==null||x.call(e,h)}},a=()=>{t=!0},l=()=>{t=!1},u=()=>Vh.isFocused()&&(e.networkMode==="always"||Ji.isOnline())&&e.canRun(),c=()=>Wh(e.networkMode)&&e.canRun(),d=v=>{i()||(r==null||r(),s.resolve(v))},f=v=>{i()||(r==null||r(),s.reject(v))},w=()=>new Promise(v=>{var x;r=h=>{(i()||u())&&v(h)},(x=e.onPause)==null||x.call(e)}).then(()=>{var v;r=void 0,i()||(v=e.onContinue)==null||v.call(e)}),g=()=>{if(i())return;let v;const x=n===0?e.initialPromise:void 0;try{v=x??e.fn()}catch(h){v=Promise.reject(h)}Promise.resolve(v).then(d).catch(h=>{var T;if(i())return;const p=e.retry??(bo?0:3),m=e.retryDelay??yw,y=typeof m=="function"?m(n,h):m,C=p===!0||typeof p=="number"&&n<p||typeof p=="function"&&p(n,h);if(t||!C){f(h);return}n++,(T=e.onFail)==null||T.call(e,n,h),lw(y).then(()=>u()?void 0:w()).then(()=>{t?f(h):g()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?g():w().then(g),s)}}var Pn,Nd,Jh=(Nd=class{constructor(){z(this,Pn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),sw(this.gcTime)&&_(this,Pn,fl.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bo?1/0:5*60*1e3))}clearGcTimeout(){P(this,Pn)&&(fl.clearTimeout(P(this,Pn)),_(this,Pn,void 0))}},Pn=new WeakMap,Nd),En,pr,qe,bn,le,bs,Tn,nt,St,Ad,vw=(Ad=class extends Jh{constructor(t){super();z(this,nt);z(this,En);z(this,pr);z(this,qe);z(this,bn);z(this,le);z(this,bs);z(this,Tn);_(this,Tn,!1),_(this,bs,t.defaultOptions),this.setOptions(t.options),this.observers=[],_(this,bn,t.client),_(this,qe,P(this,bn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,_(this,En,pd(this.options)),this.state=t.state??P(this,En),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=P(this,le))==null?void 0:t.promise}setOptions(t){if(this.options={...P(this,bs),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=pd(this.options);n.data!==void 0&&(this.setData(n.data,{updatedAt:n.dataUpdatedAt,manual:!0}),_(this,En,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&P(this,qe).remove(this)}setData(t,n){const r=uw(this.state.data,t,this.options);return ge(this,nt,St).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ge(this,nt,St).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=P(this,le))==null?void 0:r.promise;return(s=P(this,le))==null||s.cancel(t),n?n.then(tt).catch(tt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(P(this,En))}isActive(){return this.observers.some(t=>ow(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===vu||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>pl(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!iw(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,le))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,le))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),P(this,qe).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(P(this,le)&&(P(this,Tn)?P(this,le).cancel({revert:!0}):P(this,le).cancelRetry()),this.scheduleGc()),P(this,qe).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ge(this,nt,St).call(this,{type:"invalidate"})}async fetch(t,n){var l,u,c,d,f,w,g,v,x,h,p,m;if(this.state.fetchStatus!=="idle"&&((l=P(this,le))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(P(this,le))return P(this,le).continueRetry(),P(this,le).promise}if(t&&this.setOptions(t),!this.options.queryFn){const y=this.observers.find(C=>C.options.queryFn);y&&this.setOptions(y.options)}const r=new AbortController,s=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(_(this,Tn,!0),r.signal)})},i=()=>{const y=qh(this.options,n),T=(()=>{const b={client:P(this,bn),queryKey:this.queryKey,meta:this.meta};return s(b),b})();return _(this,Tn,!1),this.options.persister?this.options.persister(y,T,this):y(T)},a=(()=>{const y={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:P(this,bn),state:this.state,fetchFn:i};return s(y),y})();(u=this.options.behavior)==null||u.onFetch(a,this),_(this,pr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&ge(this,nt,St).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),_(this,le,Qh({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:y=>{y instanceof ml&&y.revert&&this.setState({...P(this,pr),fetchStatus:"idle"}),r.abort()},onFail:(y,C)=>{ge(this,nt,St).call(this,{type:"failed",failureCount:y,error:C})},onPause:()=>{ge(this,nt,St).call(this,{type:"pause"})},onContinue:()=>{ge(this,nt,St).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const y=await P(this,le).start();if(y===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(y),(w=(f=P(this,qe).config).onSuccess)==null||w.call(f,y,this),(v=(g=P(this,qe).config).onSettled)==null||v.call(g,y,this.state.error,this),y}catch(y){if(y instanceof ml){if(y.silent)return P(this,le).promise;if(y.revert){if(this.state.data===void 0)throw y;return this.state.data}}throw ge(this,nt,St).call(this,{type:"error",error:y}),(h=(x=P(this,qe).config).onError)==null||h.call(x,y,this),(m=(p=P(this,qe).config).onSettled)==null||m.call(p,this.state.data,y,this),y}finally{this.scheduleGc()}}},En=new WeakMap,pr=new WeakMap,qe=new WeakMap,bn=new WeakMap,le=new WeakMap,bs=new WeakMap,Tn=new WeakMap,nt=new WeakSet,St=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...ww(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return _(this,pr,t.manual?s:void 0),s;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Pe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),P(this,qe).notify({query:this,type:"updated",action:t})})},Ad);function ww(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Wh(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function pd(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}function hd(e){return{onFetch:(t,n)=>{var c,d,f,w,g;const r=t.options,s=(f=(d=(c=t.fetchOptions)==null?void 0:c.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,i=((w=t.state.data)==null?void 0:w.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let v=!1;const x=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(t.signal.aborted?v=!0:t.signal.addEventListener("abort",()=>{v=!0}),t.signal)})},h=qh(t.options,t.fetchOptions),p=async(m,y,C)=>{if(v)return Promise.reject();if(y==null&&m.pages.length)return Promise.resolve(m);const b=(()=>{const H={client:t.client,queryKey:t.queryKey,pageParam:y,direction:C?"backward":"forward",meta:t.options.meta};return x(H),H})(),O=await h(b),{maxPages:U}=t.options,A=C?dw:cw;return{pages:A(m.pages,O,U),pageParams:A(m.pageParams,y,U)}};if(s&&i.length){const m=s==="backward",y=m?xw:md,C={pages:i,pageParams:o},T=y(r,C);a=await p(C,T,m)}else{const m=e??i.length;do{const y=l===0?o[0]??r.initialPageParam:md(r,a);if(l>0&&y==null)break;a=await p(a,y),l++}while(l<m)}return a};t.options.persister?t.fetchFn=()=>{var v,x;return(x=(v=t.options).persister)==null?void 0:x.call(v,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function md(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function xw(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Ts,ht,Se,Rn,mt,Ut,Id,kw=(Id=class extends Jh{constructor(t){super();z(this,mt);z(this,Ts);z(this,ht);z(this,Se);z(this,Rn);_(this,Ts,t.client),this.mutationId=t.mutationId,_(this,Se,t.mutationCache),_(this,ht,[]),this.state=t.state||Sw(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){P(this,ht).includes(t)||(P(this,ht).push(t),this.clearGcTimeout(),P(this,Se).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){_(this,ht,P(this,ht).filter(n=>n!==t)),this.scheduleGc(),P(this,Se).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){P(this,ht).length||(this.state.status==="pending"?this.scheduleGc():P(this,Se).remove(this))}continue(){var t;return((t=P(this,Rn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,l,u,c,d,f,w,g,v,x,h,p,m,y,C,T,b,O,U;const n=()=>{ge(this,mt,Ut).call(this,{type:"continue"})},r={client:P(this,Ts),meta:this.options.meta,mutationKey:this.options.mutationKey};_(this,Rn,Qh({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(A,H)=>{ge(this,mt,Ut).call(this,{type:"failed",failureCount:A,error:H})},onPause:()=>{ge(this,mt,Ut).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>P(this,Se).canRun(this)}));const s=this.state.status==="pending",i=!P(this,Rn).canStart();try{if(s)n();else{ge(this,mt,Ut).call(this,{type:"pending",variables:t,isPaused:i}),await((a=(o=P(this,Se).config).onMutate)==null?void 0:a.call(o,t,this,r));const H=await((u=(l=this.options).onMutate)==null?void 0:u.call(l,t,r));H!==this.state.context&&ge(this,mt,Ut).call(this,{type:"pending",context:H,variables:t,isPaused:i})}const A=await P(this,Rn).start();return await((d=(c=P(this,Se).config).onSuccess)==null?void 0:d.call(c,A,t,this.state.context,this,r)),await((w=(f=this.options).onSuccess)==null?void 0:w.call(f,A,t,this.state.context,r)),await((v=(g=P(this,Se).config).onSettled)==null?void 0:v.call(g,A,null,this.state.variables,this.state.context,this,r)),await((h=(x=this.options).onSettled)==null?void 0:h.call(x,A,null,t,this.state.context,r)),ge(this,mt,Ut).call(this,{type:"success",data:A}),A}catch(A){try{throw await((m=(p=P(this,Se).config).onError)==null?void 0:m.call(p,A,t,this.state.context,this,r)),await((C=(y=this.options).onError)==null?void 0:C.call(y,A,t,this.state.context,r)),await((b=(T=P(this,Se).config).onSettled)==null?void 0:b.call(T,void 0,A,this.state.variables,this.state.context,this,r)),await((U=(O=this.options).onSettled)==null?void 0:U.call(O,void 0,A,t,this.state.context,r)),A}finally{ge(this,mt,Ut).call(this,{type:"error",error:A})}}finally{P(this,Se).runNext(this)}}},Ts=new WeakMap,ht=new WeakMap,Se=new WeakMap,Rn=new WeakMap,mt=new WeakSet,Ut=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Pe.batch(()=>{P(this,ht).forEach(r=>{r.onMutationUpdate(t)}),P(this,Se).notify({mutation:this,type:"updated",action:t})})},Id);function Sw(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Et,rt,Rs,Fd,Cw=(Fd=class extends Eo{constructor(t={}){super();z(this,Et);z(this,rt);z(this,Rs);this.config=t,_(this,Et,new Set),_(this,rt,new Map),_(this,Rs,0)}build(t,n,r){const s=new kw({client:t,mutationCache:this,mutationId:++zs(this,Rs)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){P(this,Et).add(t);const n=ii(t);if(typeof n=="string"){const r=P(this,rt).get(n);r?r.push(t):P(this,rt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(P(this,Et).delete(t)){const n=ii(t);if(typeof n=="string"){const r=P(this,rt).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&P(this,rt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ii(t);if(typeof n=="string"){const r=P(this,rt).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=ii(t);if(typeof n=="string"){const s=(r=P(this,rt).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Pe.batch(()=>{P(this,Et).forEach(t=>{this.notify({type:"removed",mutation:t})}),P(this,Et).clear(),P(this,rt).clear()})}getAll(){return Array.from(P(this,Et))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>cd(n,r))}findAll(t={}){return this.getAll().filter(n=>cd(t,n))}notify(t){Pe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Pe.batch(()=>Promise.all(t.map(n=>n.continue().catch(tt))))}},Et=new WeakMap,rt=new WeakMap,Rs=new WeakMap,Fd);function ii(e){var t;return(t=e.options.scope)==null?void 0:t.id}var gt,_d,Pw=(_d=class extends Eo{constructor(t={}){super();z(this,gt);this.config=t,_(this,gt,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??yu(s,n);let o=this.get(i);return o||(o=new vw({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){P(this,gt).has(t.queryHash)||(P(this,gt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=P(this,gt).get(t.queryHash);n&&(t.destroy(),n===t&&P(this,gt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Pe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return P(this,gt).get(t)}getAll(){return[...P(this,gt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ud(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>ud(t,r)):n}notify(t){Pe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Pe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Pe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},gt=new WeakMap,_d),ee,Wt,Qt,hr,mr,Jt,gr,yr,jd,Ew=(jd=class{constructor(e={}){z(this,ee);z(this,Wt);z(this,Qt);z(this,hr);z(this,mr);z(this,Jt);z(this,gr);z(this,yr);_(this,ee,e.queryCache||new Pw),_(this,Wt,e.mutationCache||new Cw),_(this,Qt,e.defaultOptions||{}),_(this,hr,new Map),_(this,mr,new Map),_(this,Jt,0)}mount(){zs(this,Jt)._++,P(this,Jt)===1&&(_(this,gr,Vh.subscribe(async e=>{e&&(await this.resumePausedMutations(),P(this,ee).onFocus())})),_(this,yr,Ji.subscribe(async e=>{e&&(await this.resumePausedMutations(),P(this,ee).onOnline())})))}unmount(){var e,t;zs(this,Jt)._--,P(this,Jt)===0&&((e=P(this,gr))==null||e.call(this),_(this,gr,void 0),(t=P(this,yr))==null||t.call(this),_(this,yr,void 0))}isFetching(e){return P(this,ee).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return P(this,Wt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=P(this,ee).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=P(this,ee).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(pl(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return P(this,ee).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=P(this,ee).get(r.queryHash),i=s==null?void 0:s.state.data,o=rw(t,i);if(o!==void 0)return P(this,ee).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Pe.batch(()=>P(this,ee).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=P(this,ee).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=P(this,ee);Pe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=P(this,ee);return Pe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Pe.batch(()=>P(this,ee).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(tt).catch(tt)}invalidateQueries(e,t={}){return Pe.batch(()=>(P(this,ee).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Pe.batch(()=>P(this,ee).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(tt)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(tt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=P(this,ee).build(this,t);return n.isStaleByTime(pl(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(tt).catch(tt)}fetchInfiniteQuery(e){return e.behavior=hd(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(tt).catch(tt)}ensureInfiniteQueryData(e){return e.behavior=hd(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ji.isOnline()?P(this,Wt).resumePausedMutations():Promise.resolve()}getQueryCache(){return P(this,ee)}getMutationCache(){return P(this,Wt)}getDefaultOptions(){return P(this,Qt)}setDefaultOptions(e){_(this,Qt,e)}setQueryDefaults(e,t){P(this,hr).set(Cs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...P(this,hr).values()],n={};return t.forEach(r=>{Ps(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){P(this,mr).set(Cs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...P(this,mr).values()],n={};return t.forEach(r=>{Ps(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...P(this,Qt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=yu(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===vu&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...P(this,Qt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){P(this,ee).clear(),P(this,Wt).clear()}},ee=new WeakMap,Wt=new WeakMap,Qt=new WeakMap,hr=new WeakMap,mr=new WeakMap,Jt=new WeakMap,gr=new WeakMap,yr=new WeakMap,jd),Gh=S.createContext(void 0),tk=e=>{const t=S.useContext(Gh);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},bw=({client:e,children:t})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),E.jsx(Gh.Provider,{value:e,children:t}));const j=e=>typeof e=="string",Hr=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},gd=e=>e==null?"":""+e,Tw=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},Rw=/###/g,yd=e=>e&&e.indexOf("###")>-1?e.replace(Rw,"."):e,vd=e=>!e||j(e),rs=(e,t,n)=>{const r=j(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(vd(e))return{};const i=yd(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return vd(e)?{}:{obj:e,k:yd(r[s])}},wd=(e,t,n)=>{const{obj:r,k:s}=rs(e,t,Object);if(r!==void 0||t.length===1){r[s]=n;return}let i=t[t.length-1],o=t.slice(0,t.length-1),a=rs(e,o,Object);for(;a.obj===void 0&&o.length;)i=`${o[o.length-1]}.${i}`,o=o.slice(0,o.length-1),a=rs(e,o,Object),a&&a.obj&&typeof a.obj[`${a.k}.${i}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${i}`]=n},Lw=(e,t,n,r)=>{const{obj:s,k:i}=rs(e,t,Object);s[i]=s[i]||[],s[i].push(n)},Gi=(e,t)=>{const{obj:n,k:r}=rs(e,t);if(n)return n[r]},Ow=(e,t,n)=>{const r=Gi(e,n);return r!==void 0?r:Gi(t,n)},Yh=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?j(e[r])||e[r]instanceof String||j(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Yh(e[r],t[r],n):e[r]=t[r]);return e},Hn=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Nw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Aw=e=>j(e)?e.replace(/[&<>"'\/]/g,t=>Nw[t]):e;class Iw{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const Fw=[" ",",","?","!",";"],_w=new Iw(20),jw=(e,t,n)=>{t=t||"",n=n||"";const r=Fw.filter(o=>t.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const s=_w.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let i=!s.test(e);if(!i){const o=e.indexOf(n);o>0&&!s.test(e.substring(0,o))&&(i=!0)}return i},gl=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let s=e;for(let i=0;i<r.length;){if(!s||typeof s!="object")return;let o,a="";for(let l=i;l<r.length;++l)if(l!==i&&(a+=n),a+=r[l],o=s[a],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&l<r.length-1)continue;i+=l-i+1;break}s=o}return s},Yi=e=>e&&e.replace("_","-"),Dw={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class Xi{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||Dw,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,s){return s&&!this.debug?null:(j(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Xi(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Xi(this.logger,t)}}var vt=new Xi;class To{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(n)||0;this.observers[r].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(o=>{let[a,l]=o;for(let u=0;u<l;u++)a(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[a,l]=o;for(let u=0;u<l;u++)a.apply(a,[t,...r])})}}class xd extends To{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,o=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;t.indexOf(".")>-1?a=t.split("."):(a=[t,n],r&&(Array.isArray(r)?a.push(...r):j(r)&&i?a.push(...r.split(i)):a.push(r)));const l=Gi(this.data,a);return!l&&!n&&!r&&t.indexOf(".")>-1&&(t=a[0],n=a[1],r=a.slice(2).join(".")),l||!o||!j(r)?l:gl(this.data&&this.data[t]&&this.data[t][n],r,i)}addResource(t,n,r,s){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(a=t.split("."),s=n,n=a[1]),this.addNamespaces(n),wd(this.data,a,s),i.silent||this.emit("added",t,n,r,s)}addResources(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in r)(j(r[i])||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,i){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),s=r,r=n,n=a[1]),this.addNamespaces(n);let l=Gi(this.data,a)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?Yh(l,r,i):l={...l,...r},wd(this.data,a,l),o.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var Xh={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,s){return e.forEach(i=>{this.processors[i]&&(t=this.processors[i].process(t,n,r,s))}),t}};const kd={};class Zi extends To{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Tw(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=vt.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const o=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!jw(t,r,s);if(o&&!a){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:j(i)?[i]:i};const u=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),t=u.join(s)}return{key:t,namespaces:j(i)?[i]:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const s=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:a}=this.extractFromKey(t[t.length-1],n),l=a[a.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const y=n.nsSeparator||this.options.nsSeparator;return s?{res:`${l}${y}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${y}${o}`}return s?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:o}const d=this.resolve(t,n);let f=d&&d.res;const w=d&&d.usedKey||o,g=d&&d.exactUsedKey||o,v=Object.prototype.toString.apply(f),x=["[object Number]","[object Function]","[object RegExp]"],h=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,p=!this.i18nFormat||this.i18nFormat.handleAsObject,m=!j(f)&&typeof f!="boolean"&&typeof f!="number";if(p&&f&&m&&x.indexOf(v)<0&&!(j(h)&&Array.isArray(f))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const y=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,f,{...n,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;return s?(d.res=y,d.usedParams=this.getUsedParamsDetails(n),d):y}if(i){const y=Array.isArray(f),C=y?[]:{},T=y?g:w;for(const b in f)if(Object.prototype.hasOwnProperty.call(f,b)){const O=`${T}${i}${b}`;C[b]=this.translate(O,{...n,joinArrays:!1,ns:a}),C[b]===O&&(C[b]=f[b])}f=C}}else if(p&&j(h)&&Array.isArray(f))f=f.join(h),f&&(f=this.extendTranslation(f,t,n,r));else{let y=!1,C=!1;const T=n.count!==void 0&&!j(n.count),b=Zi.hasDefaultValue(n),O=T?this.pluralResolver.getSuffix(u,n.count,n):"",U=n.ordinal&&T?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",A=T&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),H=A&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${O}`]||n[`defaultValue${U}`]||n.defaultValue;!this.isValidLookup(f)&&b&&(y=!0,f=H),this.isValidLookup(f)||(C=!0,f=o);const _e=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:f,me=b&&H!==f&&this.options.updateMissing;if(C||y||me){if(this.logger.log(me?"updateKey":"missingKey",u,l,o,me?H:f),i){const L=this.resolve(o,{...n,keySeparator:!1});L&&L.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 ct=[];const ie=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ie&&ie[0])for(let L=0;L<ie.length;L++)ct.push(ie[L]);else this.options.saveMissingTo==="all"?ct=this.languageUtils.toResolveHierarchy(n.lng||this.language):ct.push(n.lng||this.language);const kt=(L,I,F)=>{const $=b&&F!==f?F:_e;this.options.missingKeyHandler?this.options.missingKeyHandler(L,l,I,$,me,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(L,l,I,$,me,n),this.emit("missingKey",L,l,I,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&T?ct.forEach(L=>{const I=this.pluralResolver.getSuffixes(L,n);A&&n[`defaultValue${this.options.pluralSeparator}zero`]&&I.indexOf(`${this.options.pluralSeparator}zero`)<0&&I.push(`${this.options.pluralSeparator}zero`),I.forEach(F=>{kt([L],o+F,n[`defaultValue${F}`]||H)})}):kt(ct,o,H))}f=this.extendTranslation(f,t,n,d,r),C&&f===o&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${o}`),(C||y)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,y?f:void 0):f=this.options.parseMissingKeyHandler(f))}return s?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}extendTranslation(t,n,r,s,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=j(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&!j(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language||s.usedLng,r),u){const f=t.match(this.interpolator.nestingRegexp),w=f&&f.length;c<w&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&s&&s.res&&(r.lng=this.language||s.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var f=arguments.length,w=new Array(f),g=0;g<f;g++)w[g]=arguments[g];return i&&i[0]===w[0]&&!r.context?(o.logger.warn(`It seems you are nesting recursively key: ${w[0]} in key: ${n[0]}`),null):o.translate(...w,n)},r)),r.interpolation&&this.interpolator.reset()}const a=r.postProcess||this.options.postProcess,l=j(a)?[a]:a;return t!=null&&l&&l.length&&r.applyPostProcessor!==!1&&(t=Xh.handle(l,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,s,i,o,a;return j(t)&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;s=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&!j(n.count),w=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(j(n.context)||typeof n.context=="number")&&n.context!=="",v=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(x=>{this.isValidLookup(r)||(a=x,!kd[`${v[0]}-${x}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(kd[`${v[0]}-${x}`]=!0,this.logger.warn(`key "${s}" for languages "${v.join(", ")}" won't get resolved as namespace "${a}" 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!!!")),v.forEach(h=>{if(this.isValidLookup(r))return;o=h;const p=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(p,c,h,x,n);else{let y;f&&(y=this.pluralResolver.getSuffix(h,n.count,n));const C=`${this.options.pluralSeparator}zero`,T=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(p.push(c+y),n.ordinal&&y.indexOf(T)===0&&p.push(c+y.replace(T,this.options.pluralSeparator)),w&&p.push(c+C)),g){const b=`${c}${this.options.contextSeparator}${n.context}`;p.push(b),f&&(p.push(b+y),n.ordinal&&y.indexOf(T)===0&&p.push(b+y.replace(T,this.options.pluralSeparator)),w&&p.push(b+C))}}let m;for(;m=p.pop();)this.isValidLookup(r)||(i=m,r=this.getResource(h,x,m,n))}))})}),{res:r,usedKey:s,exactUsedKey:i,usedLng:o,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!j(t.replace);let s=r?t.replace:t;if(r&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const i of n)delete s[i]}return s}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}const oa=e=>e.charAt(0).toUpperCase()+e.slice(1);class Sd{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=vt.create("languageUtils")}getScriptPartFromCode(t){if(t=Yi(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Yi(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(j(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let s=Intl.getCanonicalLocales(t)[0];if(s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s)return s}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(s=>s.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=oa(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=oa(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=oa(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(i=>{if(i===s)return i;if(!(i.indexOf("-")<0&&s.indexOf("-")<0)&&(i.indexOf("-")>0&&s.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===s||i.indexOf(s)===0&&s.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),j(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),s=[],i=o=>{o&&(this.isSupportedCode(o)?s.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return j(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):j(t)&&i(this.formatLanguageCode(t)),r.forEach(o=>{s.indexOf(o)<0&&i(this.formatLanguageCode(o))}),s}}let Mw=[{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}],Uw={1:e=>+(e>1),2:e=>+(e!=1),3:e=>0,4:e=>e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,5:e=>e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5,6:e=>e==1?0:e>=2&&e<=4?1:2,7:e=>e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,8:e=>e==1?0:e==2?1:e!=8&&e!=11?2:3,9:e=>+(e>=2),10:e=>e==1?0:e==2?1:e<7?2:e<11?3:4,11:e=>e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3,12:e=>+(e%10!=1||e%100==11),13:e=>+(e!==0),14:e=>e==1?0:e==2?1:e==3?2:3,15:e=>e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2,16:e=>e%10==1&&e%100!=11?0:e!==0?1:2,17:e=>e==1||e%10==1&&e%100!=11?0:1,18:e=>e==0?0:e==1?1:2,19:e=>e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3,20:e=>e==1?0:e==0||e%100>0&&e%100<20?1:2,21:e=>e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0,22:e=>e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3};const zw=["v1","v2","v3"],$w=["v4"],Cd={zero:0,one:1,two:2,few:3,many:4,other:5},Bw=()=>{const e={};return Mw.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:Uw[t.fc]}})}),e};class Hw{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=vt.create("pluralResolver"),(!this.options.compatibilityJSON||$w.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=Bw(),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi()){const r=Yi(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:s});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let o;try{o=new Intl.PluralRules(r,{type:s})}catch{if(!t.match(/-|_/))return;const l=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(l,n)}return this.pluralRulesCache[i]=o,o}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(s=>`${n}${s}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((s,i)=>Cd[s]-Cd[i]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):r.numbers.map(s=>this.getSuffix(t,s,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=this.getRule(t,r);return s?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:this.getSuffixRetroCompatible(s,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let s=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));const i=()=>this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString();return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?`_plural_${s.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?i():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!zw.includes(this.options.compatibilityJSON)}}const Pd=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=Ow(e,t,n);return!i&&s&&j(n)&&(i=gl(e,n,r),i===void 0&&(i=gl(t,n,r))),i},aa=e=>e.replace(/\$/g,"$$$$");class Kw{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=vt.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:s,prefix:i,prefixEscaped:o,suffix:a,suffixEscaped:l,formatSeparator:u,unescapeSuffix:c,unescapePrefix:d,nestingPrefix:f,nestingPrefixEscaped:w,nestingSuffix:g,nestingSuffixEscaped:v,nestingOptionsSeparator:x,maxReplaces:h,alwaysFormat:p}=t.interpolation;this.escape=n!==void 0?n:Aw,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?Hn(i):o||"{{",this.suffix=a?Hn(a):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=c?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=f?Hn(f):w||Hn("$t("),this.nestingSuffix=g?Hn(g):v||Hn(")"),this.nestingOptionsSeparator=x||",",this.maxReplaces=h||1e3,this.alwaysFormat=p!==void 0?p:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let i,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=w=>{if(w.indexOf(this.formatSeparator)<0){const h=Pd(n,l,w,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(h,void 0,r,{...s,...n,interpolationkey:w}):h}const g=w.split(this.formatSeparator),v=g.shift().trim(),x=g.join(this.formatSeparator).trim();return this.format(Pd(n,l,v,this.options.keySeparator,this.options.ignoreJSONStructure),x,r,{...s,...n,interpolationkey:v})};this.resetRegExp();const c=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,d=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:w=>aa(w)},{regex:this.regexp,safeValue:w=>this.escapeValue?aa(this.escape(w)):aa(w)}].forEach(w=>{for(a=0;i=w.regex.exec(t);){const g=i[1].trim();if(o=u(g),o===void 0)if(typeof c=="function"){const x=c(t,i,s);o=j(x)?x:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))o="";else if(d){o=i[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),o="";else!j(o)&&!this.useRawValueToEscape&&(o=gd(o));const v=w.safeValue(o);if(t=t.replace(i[0],v),d?(w.regex.lastIndex+=o.length,w.regex.lastIndex-=i[0].length):w.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,i,o;const a=(l,u)=>{const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,o);const w=f.match(/'/g),g=f.match(/"/g);(w&&w.length%2===0&&!g||g.length%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),u&&(o={...u,...o})}catch(v){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,v),`${l}${c}${f}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;s=this.nestingRegexp.exec(t);){let l=[];o={...r},o=o.replace&&!j(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const c=s[1].split(this.formatSeparator).map(d=>d.trim());s[1]=c.shift(),l=c,u=!0}if(i=n(a.call(this,s[1].trim(),o),o),i&&s[0]===t&&!j(i))return i;j(i)||(i=gd(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),u&&(i=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const qw=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);t==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(o=>{if(o){const[a,...l]=o.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),c=a.trim();n[c]||(n[c]=u),u==="false"&&(n[c]=!1),u==="true"&&(n[c]=!0),isNaN(u)||(n[c]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},Kn=e=>{const t={};return(n,r,s)=>{let i=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(i={...i,[s.interpolationkey]:void 0});const o=r+JSON.stringify(i);let a=t[o];return a||(a=e(Yi(r),s),t[o]=a),a(n)}};class Vw{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=vt.create("formatter"),this.options=t,this.formats={number:Kn((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:Kn((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:Kn((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:Kn((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:Kn((n,r)=>{const s=new Intl.ListFormat(n,{...r});return i=>s.format(i)})},this.init(t)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Kn(n)}format(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=n.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(a=>a.indexOf(")")>-1)){const a=i.findIndex(l=>l.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,a)].join(this.formatSeparator)}return i.reduce((a,l)=>{const{formatName:u,formatOptions:c}=qw(l);if(this.formats[u]){let d=a;try{const f=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},w=f.locale||f.lng||s.locale||s.lng||r;d=this.formats[u](a,w,{...c,...s,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}const Ww=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class Qw extends To{constructor(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=vt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,s.backend,s)}queueLoad(t,n,r,s){const i={},o={},a={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,c=!1,o[f]===void 0&&(o[f]=!0),i[f]===void 0&&(i[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(a[u]=!0)}),(Object.keys(i).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(i),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const s=t.split("|"),i=s[0],o=s[1];n&&this.emit("failedLoading",i,o,n),!n&&r&&this.store.addResourceBundle(i,o,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const a={};this.queue.forEach(l=>{Lw(l.loaded,[i],o),Ww(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{a[u][d]===void 0&&(a[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:s,wait:i,callback:o});return}this.readingCalls++;const a=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,i*2,o)},i);return}o(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>a(null,c)).catch(a):a(null,u)}catch(u){a(u)}return}return l(t,n,a)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=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."),s&&s();j(t)&&(t=this.languageUtils.toResolveHierarchy(t)),j(n)&&(n=[n]);const i=this.queueLoad(t,n,r,s);if(!i.toLoad.length)return i.pending.length||s(),null;i.toLoad.forEach(o=>{this.loadOne(o)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),s=r[0],i=r[1];this.read(s,i,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${n}loading namespace ${i} for language ${s} failed`,o),!o&&a&&this.logger.log(`${n}loaded namespace ${i} for language ${s}`,a),this.loaded(t,o,a)})}saveMissing(t,n,r,s,i){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" 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(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...o,isUpdate:i},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,s,l):c=u(t,n,r,s),c&&typeof c.then=="function"?c.then(d=>a(null,d)).catch(a):a(null,c)}catch(c){a(c)}else u(t,n,r,s,a,l)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const Ed=()=>({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:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),j(e[1])&&(t.defaultValue=e[1]),j(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),bd=e=>(j(e.ns)&&(e.ns=[e.ns]),j(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),j(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),oi=()=>{},Jw=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Es extends To{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=bd(t),this.services={},this.logger=vt,this.modules={external:[]},Jw(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(j(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=Ed();this.options={...s,...this.options,...bd(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const i=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?vt.init(i(this.modules.logger),this.options):vt.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=Vw);const d=new Sd(this.options);this.store=new xd(this.options.resources,this.options);const f=this.services;f.logger=vt,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new Hw(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(f.formatter=i(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Kw(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Qw(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(w){for(var g=arguments.length,v=new Array(g>1?g-1:0),x=1;x<g;x++)v[x-1]=arguments[x];t.emit(w,...v)}),this.modules.languageDetector&&(f.languageDetector=i(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=i(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new Zi(this.services,this.options),this.translator.on("*",function(w){for(var g=arguments.length,v=new Array(g>1?g-1:0),x=1;x<g;x++)v[x-1]=arguments[x];t.emit(w,...v)}),this.modules.external.forEach(w=>{w.init&&w.init(this)})}if(this.format=this.options.interpolation.format,r||(r=oi),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 t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=Hr(),u=()=>{const c=(d,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),r(d,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(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:oi;const s=j(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],o=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{u!=="cimode"&&i.indexOf(u)<0&&i.push(u)})};s?o(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload&&this.options.preload.forEach(a=>o(a)),this.services.backendConnector.load(i,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const s=Hr();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=oi),this.services.backendConnector.reload(t,n,i=>{s.resolve(),r(i)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Xh.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const s=Hr();this.emit("languageChanging",t);const i=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,u)=>{u?(i(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,s.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=j(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{o(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),s}getFixedT(t,n,r){var s=this;const i=function(o,a){let l;if(typeof a!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d<u;d++)c[d-2]=arguments[d];l=s.options.overloadTranslationOptionHandler([o,a].concat(c))}else l={...a};l.lng=l.lng||i.lng,l.lngs=l.lngs||i.lngs,l.ns=l.ns||i.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||r||i.keyPrefix);const f=s.options.keySeparator||".";let w;return l.keyPrefix&&Array.isArray(o)?w=o.map(g=>`${l.keyPrefix}${f}${g}`):w=l.keyPrefix?`${l.keyPrefix}${f}${o}`:o,s.t(w,l)};return j(t)?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=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 r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===0||u===2};if(n.precheck){const a=n.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,t)&&(!s||o(i,t)))}loadNamespaces(t,n){const r=Hr();return this.options.ns?(j(t)&&(t=[t]),t.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Hr();j(t)&&(t=[t]);const s=this.options.preload||[],i=t.filter(o=>s.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return i.length?(this.options.preload=s.concat(i),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["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"],r=this.services&&this.services.languageUtils||new Sd(Ed());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Es(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:oi;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new Es(s);return(t.debug!==void 0||t.prefix!==void 0)&&(i.logger=i.logger.clone(t)),["store","services","language"].forEach(a=>{i[a]=this[a]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r&&(i.store=new xd(this.store.data,s),i.services.resourceStore=i.store),i.translator=new Zi(i.services,s),i.translator.on("*",function(a){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c<l;c++)u[c-1]=arguments[c];i.emit(a,...u)}),i.init(s,n),i.translator.options=s,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const de=Es.createInstance();de.createInstance=Es.createInstance;de.createInstance;de.dir;de.init;de.loadResources;de.reloadResources;de.use;de.changeLanguage;de.getFixedT;de.t;de.exists;de.setDefaultNamespace;de.hasLoadedNamespace;de.loadNamespaces;de.loadLanguages;const Gw={zh:{translation:{app:{title:"cc-gw 控制台",skipToContent:"跳转到主要内容"},nav:{dashboard:"仪表盘",logs:"请求日志",models:"模型管理",apiKeys:"API 密钥",settings:"设置",help:"使用指南",about:"关于"},language:{zh:"简体中文",en:"English"},common:{loading:"加载中...",loadingShort:"加载中...",noData:"暂无数据",languageSelector:"语言选择",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"}},login:{title:"登录 cc-gw 控制台",description:"启用 Web UI 访问控制后,请输入账号与密码继续。",fields:{username:"用户名",usernamePlaceholder:"请输入用户名",password:"密码",passwordPlaceholder:"请输入密码"},actions:{submit:"登录"},validation:{required:"请填写用户名和密码",failed:"登录失败,请检查账号或密码后重试"},hint:"如果忘记密码,可在服务器上通过 CLI 或编辑配置重置 Web 登录设置。",status:"已登录:{{username}}"},dashboard:{description:"快速了解请求规模与实时运行状态。",filters:{endpoint:"端点筛选",endpointAll:"全部端点",endpointAnthropic:"anthropic",endpointOpenAI:"openai"},status:{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",todayOutput:"今日输出 Tokens",avgLatency:"平均响应耗时"},charts:{requestsTitle:"请求趋势",requestsDesc:"最近 14 天请求与 Token 走势",modelTitle:"模型调用分布",modelDesc:"近 7 天不同模型的调用次数与 Token 走势",barRequests:"请求数",lineInput:"输入 Tokens",lineOutput:"输出 Tokens",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:"暂无数据"},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:"未找到符合条件的日志记录。",requestedModelFallback:"未指定",apiKeyUnknown:"未知密钥",columns:{time:"时间",endpoint:"端点",provider:"Provider",requestedModel:"请求模型",routedModel:"路由模型",apiKey:"API Key",inputTokens:"输入 Tokens",cachedTokens:"缓存 Tokens",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",cachedTokens:"缓存 Tokens",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,请点击“新增提供商”以开始配置。",count:"已配置:{{count}} 个 Provider",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:{defaultModel:"默认模型:{{model}}",noDefault:"未设置默认模型",modelsTitle:"支持模型",noModels:"尚未配置模型。"},drawer:{createTitle:"新增 Provider",editTitle:"编辑 Provider",description:"配置基础信息与模型列表。",modelsDescription:"维护支持的模型列表。",defaultHint:"当前默认模型:{{model}}",fields:{id:"Provider ID",idPlaceholder:"如 openai",label:"显示名称",labelPlaceholder:"如 OpenAI 官方",baseUrl:"Base URL",baseUrlPlaceholder:"https://api.example.com/v1",type:"Provider 类型",apiKey:"API Key(可选)",apiKeyPlaceholder:"可留空以从环境变量读取",authMode:"认证方式",authModeHint:"Claude Code 可使用 Token 或 API Key,选择后填写对应值。",authModeApiKey:"使用 API Key(x-api-key)",authModeAuthToken:"使用 Auth Token(Authorization: Bearer)",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}}"}},confirm:{delete:"确认删除 Provider「{{name}}」?"}},modelManagement:{title:"模型管理",description:"统一维护模型提供商配置与模型路由映射。",tabs:{providers:"模型提供商",providersDesc:"配置上游模型提供商以及认证信息。",anthropic:"Anthropic 路由",anthropicDesc:"管理 /anthropic 端点的模型映射和默认配置。",openai:"OpenAI 路由",openaiDesc:"管理 /openai 端点的模型映射和默认配置。"},actions:{saveRoutes:"保存路由"},routing:{selectTarget:"请选择目标 Provider:模型"},toast:{routesSaved:"模型路由已更新。",routesSaveFailure:"保存模型路由失败:{{message}}",presetSaved:"已保存模板 “{{name}}”。",presetSaveFailure:"保存模板失败:{{message}}",presetApplySuccess:"已应用模板 “{{name}}”。",presetApplyFailure:"应用模板失败:{{message}}",presetDeleteSuccess:"模板 “{{name}}” 已删除。",presetDeleteFailure:"删除模板失败:{{message}}"},presets:{title:"路由模板",description:"保存当前 Anthropic 路由映射,便于在不同 Provider 方案之间快速切换。",namePlaceholder:"输入模板名称,例如 fox",save:"保存模板",saving:"保存中...",empty:"尚未保存任何模板。",apply:"应用",applying:"应用中...",delete:"删除",deleting:"删除中..."},validation:{presetName:"请输入模板名称。",presetDuplicate:"模板 {{name}} 已存在,请使用其他名称。"},confirm:{deletePreset:"确定要删除模板 “{{name}}” 吗?"}},settings:{title:"系统设置",description:"调整网关端口、日志策略及其他运行参数。",toast:{loadFailure:"配置加载失败:{{message}}",saveSuccess:"系统配置已更新。",saveFailure:"保存失败:{{message}}",copySuccess:"配置文件路径已复制到剪贴板。",copyFailure:"复制失败:{{message}}",cleanupSuccess:"已删除 {{count}} 条历史日志。",cleanupNone:"没有需要删除的日志。",cleanupFailure:"清理失败:{{message}}",clearAllSuccess:"日志已清空(请求 {{logs}} 条,统计 {{metrics}} 条)。",clearAllFailure:"清空失败:{{message}}",missingConfig:"未能加载配置,请刷新或稍后再试。",authLoadFailure:"安全配置加载失败:{{message}}"},sections:{basics:"基础配置",routing:"模型路由",configFile:"配置文件",cleanup:"日志清理",security:"访问安全"},fields:{port:"监听端口",host:"监听地址(可选)",hostPlaceholder:"默认 0.0.0.0",retention:"日志保留天数",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 …”日志(含状态码与耗时),关闭后终端更安静。"},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:"两次输入的密码不一致"}},validation:{port:"请输入 1-65535 之间的端口号",retention:"日志保留天数需为 1-365 之间的数字",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:"尚未配置映射,系统将使用默认模型策略。",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:"立即清理早于当前保留天数的日志记录。",clearAll:"彻底清空",clearingAll:"清空中...",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:[`📝 **编辑配置文件**:
148
+ `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Mn(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&ki.assertOptions(r,{silentJSONParsing:ft.transitional(ft.boolean),forcedJSONParsing:ft.transitional(ft.boolean),clarifyTimeoutError:ft.transitional(ft.boolean)},!1),s!=null&&(k.isFunction(s)?n.paramsSerializer={serialize:s}:ki.assertOptions(s,{encode:ft.function,serialize:ft.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ki.assertOptions(n,{baseUrl:ft.spelling("baseURL"),withXsrfToken:ft.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&k.merge(i.common,i[n.method]);i&&k.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),n.headers=Fe.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(l=l&&v.synchronous,a.unshift(v.fulfilled,v.rejected))});const u=[];this.interceptors.response.forEach(function(v){u.push(v.fulfilled,v.rejected)});let c,d=0,f;if(!l){const g=[od.bind(this),void 0];for(g.unshift(...a),g.push(...u),f=g.length,c=Promise.resolve(n);d<f;)c=c.then(g[d++],g[d++]);return c}f=a.length;let w=n;for(;d<f;){const g=a[d++],v=a[d++];try{w=g(w)}catch(x){v.call(this,x);break}}try{c=od.call(this,w)}catch(g){return Promise.reject(g)}for(d=0,f=u.length;d<f;)c=c.then(u[d++],u[d++]);return c}getUri(t){t=Mn(this.defaults,t);const n=_h(t.baseURL,t.url,t.allowAbsoluteUrls);return Oh(n,t.params,t.paramsSerializer)}};k.forEach(["delete","get","head","options"],function(t){An.prototype[t]=function(n,r){return this.request(Mn(r||{},{method:t,url:n,data:(r||{}).data}))}});k.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,a){return this.request(Mn(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}An.prototype[t]=n(),An.prototype[t+"Form"]=n(!0)});let Q1=class zh{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,a){r.reason||(r.reason=new Ir(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new zh(function(s){t=s}),cancel:t}}};function J1(e){return function(n){return e.apply(null,n)}}function G1(e){return k.isObject(e)&&e.isAxiosError===!0}const dl={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(dl).forEach(([e,t])=>{dl[t]=e});function $h(e){const t=new An(e),n=vh(An.prototype.request,t);return k.extend(n,An.prototype,t,{allOwnKeys:!0}),k.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return $h(Mn(e,s))},n}const ne=$h(Ms);ne.Axios=An;ne.CanceledError=Ir;ne.CancelToken=Q1;ne.isCancel=Ih;ne.VERSION=Uh;ne.toFormData=Co;ne.AxiosError=D;ne.Cancel=ne.CanceledError;ne.all=function(t){return Promise.all(t)};ne.spread=J1;ne.isAxiosError=G1;ne.mergeConfig=Mn;ne.AxiosHeaders=Fe;ne.formToJSON=e=>Ah(k.isHTMLForm(e)?new FormData(e):e);ne.getAdapter=Mh.getAdapter;ne.HttpStatusCode=dl;ne.default=ne;const{Axios:jx,AxiosError:Dx,CanceledError:Mx,isCancel:Ux,CancelToken:zx,VERSION:$x,all:Bx,Cancel:Hx,isAxiosError:Kx,spread:qx,toFormData:Vx,AxiosHeaders:Wx,HttpStatusCode:Qx,formToJSON:Jx,getAdapter:Gx,mergeConfig:Yx}=ne,qn=ne.create({baseURL:"/",timeout:15e3,withCredentials:!0});qn.interceptors.response.use(e=>e,e=>Promise.reject(e));function ia(e){var t,n,r;if(ne.isAxiosError(e)){const s=(t=e.response)==null?void 0:t.status;return{message:((r=(n=e.response)==null?void 0:n.data)==null?void 0:r.error)||e.message||"请求失败,请稍后再试",status:s,code:String(s??"unknown")}}return{message:e instanceof Error?e.message:"请求失败,请稍后再试"}}const Bh=S.createContext(void 0);function Y1({children:e}){const t=S.useRef(!0),[n,r]=S.useState({loading:!0,authEnabled:!1,isAuthenticated:!0,username:void 0,error:null}),s=S.useCallback(u=>{t.current&&r(u)},[]),i=S.useCallback(async()=>{s(u=>({...u,loading:!0,error:null}));try{const{data:u}=await qn.get("/auth/session");s(()=>({loading:!1,authEnabled:!!u.authEnabled,isAuthenticated:!u.authEnabled||!!u.authenticated,username:u.username??void 0,error:null}))}catch(u){const c=ia(u);s(()=>({loading:!1,authEnabled:!1,isAuthenticated:!0,username:void 0,error:c.message}))}},[s]),o=S.useCallback(async(u,c)=>{s(d=>({...d,loading:!0,error:null}));try{await qn.post("/auth/login",{username:u,password:c}),await i()}catch(d){const f=ia(d);throw s(w=>({...w,loading:!1,error:f.message,isAuthenticated:!1})),f}},[i,s]),a=S.useCallback(async()=>{s(u=>({...u,loading:!0}));try{await qn.post("/auth/logout")}catch(u){const c=ia(u);s(d=>({...d,error:c.message}))}finally{await i()}},[i,s]);S.useEffect(()=>{t.current=!0,i();const u=qn.interceptors.response.use(c=>c,async c=>{var d;return((d=c==null?void 0:c.response)==null?void 0:d.status)===401&&await i(),Promise.reject(c)});return()=>{t.current=!1,qn.interceptors.response.eject(u)}},[i]);const l=S.useMemo(()=>({...n,refresh:i,login:o,logout:a}),[n,i,o,a]);return E.jsx(Bh.Provider,{value:l,children:e})}function Hh(){const e=S.useContext(Bh);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const X1=[{to:"/",icon:av,labelKey:"nav.dashboard"},{to:"/logs",icon:uv,labelKey:"nav.logs"},{to:"/models",icon:fv,labelKey:"nav.models"},{to:"/api-keys",icon:cv,labelKey:"nav.apiKeys"},{to:"/settings",icon:gv,labelKey:"nav.settings"},{to:"/help",icon:pv,labelKey:"nav.help"},{to:"/about",icon:lv,labelKey:"nav.about"}];function ld({onNavigate:e}){const{t}=Fs();return E.jsx("nav",{className:"flex h-full flex-col gap-1","aria-label":t("app.title"),children:X1.map(n=>{const r=n.icon;return E.jsx(My,{to:n.to,onClick:e,className:({isActive:s})=>Lt("group relative flex items-center justify-center gap-1.5 rounded-lg px-1.5 py-1.5 transition-all duration-200",s?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"text-slate-600 hover:bg-slate-100 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-800 dark:hover:text-slate-200"),end:n.to==="/",title:t(n.labelKey),children:({isActive:s})=>E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"flex h-7 w-7 items-center justify-center",children:E.jsx(r,{size:14,className:Lt("transition-colors duration-200",s?"text-blue-600 dark:text-blue-400":"text-slate-500 dark:text-slate-400"),"aria-hidden":"true"})}),E.jsx("span",{className:Lt("hidden xl:block font-medium text-xs leading-tight whitespace-nowrap transition-colors duration-200",s?"text-blue-700 dark:text-blue-300":"text-slate-700 dark:text-slate-300"),children:t(n.labelKey)})]})},n.to)})})}function Z1(){const{t:e}=Fs(),t=mn(),[n,r]=S.useState(!1),{authEnabled:s,username:i,logout:o}=Hh(),[a,l]=S.useState(!1);S.useEffect(()=>{r(!1)},[t.pathname]);const u=async()=>{if(!a){l(!0);try{await o()}finally{l(!1)}}};return E.jsxs("div",{className:"relative flex min-h-screen text-slate-900 dark:text-slate-50",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-blue-600 focus:px-4 focus:py-2 focus:text-white",children:e("app.skipToContent")}),E.jsxs("aside",{className:"relative z-20 hidden flex-col gap-3 border-r border-slate-200/20 bg-white/60 px-2 py-3 shadow-md shadow-slate-200/15 backdrop-blur-sm lg:flex lg:w-36 lg:min-w-[9rem] lg:max-w-[9rem] xl:w-40 xl:min-w-[10rem] xl:max-w-[10rem] 2xl:w-44 2xl:min-w-[11rem] 2xl:max-w-[11rem] lg:flex-shrink-0 dark:border-slate-800/20 dark:bg-slate-950/60 dark:shadow-lg dark:shadow-slate-900/20",children:[E.jsx("div",{className:"space-y-2","aria-label":e("app.title"),children:E.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-slate-200/30 bg-white/80 p-1.5 shadow-sm shadow-slate-200/20 backdrop-blur-sm dark:border-slate-700/30 dark:bg-slate-900/80 dark:shadow-md dark:shadow-slate-900/20",children:[E.jsx("div",{className:"grid h-6 w-6 place-items-center rounded-lg bg-gradient-to-br from-blue-500 via-blue-600 to-indigo-600 text-xs font-bold text-white shadow-md shadow-blue-500/20",children:"GW"}),E.jsx("div",{className:"hidden xl:block",children:E.jsx("p",{className:"text-xs font-bold text-slate-800 dark:text-slate-100 truncate",children:e("app.title")})})]})}),E.jsx("div",{className:"flex-1 overflow-y-auto",children:E.jsx(ld,{})})]}),E.jsxs("div",{className:"flex flex-1 flex-col",children:[E.jsxs("header",{className:"sticky top-0 z-30 flex items-center justify-between gap-2 sm:gap-4 border-b border-slate-200/30 bg-white/90 px-3 sm:px-4 lg:px-6 py-2.5 sm:py-3 shadow-md shadow-slate-200/15 backdrop-blur-sm dark:border-slate-800/30 dark:bg-slate-950/90 dark:shadow-lg dark:shadow-slate-900/20",children:[E.jsxs("div",{className:"flex items-center gap-3 lg:hidden",children:[E.jsx("button",{type:"button",className:"inline-flex h-11 w-11 items-center justify-center rounded-2xl border border-slate-200/50 bg-white/90 text-slate-600 shadow-lg shadow-slate-200/30 transition-shadow duration-200 hover:bg-white hover:shadow-xl dark:border-slate-700/50 dark:bg-slate-900/90 dark:text-slate-200 dark:shadow-xl dark:shadow-slate-900/30 dark:hover:bg-slate-900",onClick:()=>r(c=>!c),"aria-label":e(n?"common.actions.closeNavigation":"common.actions.openNavigation"),"aria-expanded":n,"aria-controls":"mobile-nav",children:n?E.jsx($c,{size:20,"aria-hidden":"true"}):E.jsx(hv,{size:20,"aria-hidden":"true"})}),E.jsx("div",{className:"text-lg font-bold gradient-text",children:e("app.title")})]}),E.jsxs("div",{className:"flex items-center gap-3",children:[s?E.jsxs("div",{className:"flex items-center gap-3",children:[i?E.jsx("span",{className:"hidden text-xs font-medium text-slate-500 dark:text-slate-400 sm:inline",children:e("login.status",{username:i})}):null,E.jsx("button",{type:"button",onClick:()=>void u(),className:Lt(yh,"h-10 rounded-full px-4"),disabled:a,children:e(a?"common.actions.loading":"common.actions.logout")})]}):null,E.jsx(Sv,{}),E.jsx(kv,{})]})]}),E.jsx("main",{id:"main-content",role:"main",tabIndex:-1,className:"flex-1 overflow-y-auto px-3 sm:px-4 lg:px-6 pb-8 sm:pb-12 lg:pb-16 pt-6 sm:pt-8",children:E.jsx("div",{className:Lt(xv,"animate-fade-in"),children:E.jsx(Py,{})})})]}),n?E.jsx("div",{className:"fixed inset-0 z-40 bg-slate-900/80 backdrop-blur-sm lg:hidden animate-fade-in",role:"dialog","aria-modal":"true",children:E.jsxs("div",{id:"mobile-nav",className:"absolute inset-y-0 left-0 w-72 sm:w-80 border-r border-slate-200/40 bg-gradient-to-b from-white/95 to-white/90 px-4 sm:px-6 py-6 sm:py-8 shadow-2xl shadow-slate-900/30 backdrop-blur-xl animate-slide-up dark:border-slate-800/40 dark:from-slate-950/95 dark:to-slate-950/90 gpu-accelerated",children:[E.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[E.jsx("span",{className:"text-lg font-bold gradient-text",children:e("app.title")}),E.jsx("button",{type:"button",className:"inline-flex h-10 w-10 items-center justify-center rounded-2xl border border-slate-200/50 bg-white/90 text-slate-600 shadow-lg shadow-slate-200/30 transition-shadow duration-200 hover:bg-white dark:border-slate-700/50 dark:bg-slate-900/90 dark:text-slate-200 dark:shadow-xl dark:shadow-slate-900/30",onClick:()=>r(!1),"aria-label":e("common.actions.closeNavigation"),children:E.jsx($c,{size:18,"aria-hidden":"true"})})]}),E.jsx(ld,{onNavigate:()=>r(!1)})]})}):null]})}var Eo=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ew={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Kt,yl,Rd,tw=(Rd=class{constructor(){z(this,Kt,ew);z(this,yl,!1)}setTimeoutProvider(e){_(this,Kt,e)}setTimeout(e,t){return P(this,Kt).setTimeout(e,t)}clearTimeout(e){P(this,Kt).clearTimeout(e)}setInterval(e,t){return P(this,Kt).setInterval(e,t)}clearInterval(e){P(this,Kt).clearInterval(e)}},Kt=new WeakMap,yl=new WeakMap,Rd),fl=new tw;function nw(e){setTimeout(e,0)}var bo=typeof window>"u"||"Deno"in globalThis;function tt(){}function rw(e,t){return typeof e=="function"?e(t):e}function sw(e){return typeof e=="number"&&e>=0&&e!==1/0}function iw(e,t){return Math.max(e+(t||0)-Date.now(),0)}function pl(e,t){return typeof e=="function"?e(t):e}function ow(e,t){return typeof e=="function"?e(t):e}function ud(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==yu(o,t.options))return!1}else if(!Ps(t.queryKey,o))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function cd(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Cs(t.options.mutationKey)!==Cs(i))return!1}else if(!Ps(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function yu(e,t){return((t==null?void 0:t.queryKeyHashFn)||Cs)(e)}function Cs(e){return JSON.stringify(e,(t,n)=>hl(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ps(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ps(e[n],t[n])):!1}var aw=Object.prototype.hasOwnProperty;function Kh(e,t){if(e===t)return e;const n=dd(e)&&dd(t);if(!n&&!(hl(e)&&hl(t)))return t;const s=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),o=i.length,a=n?new Array(o):{};let l=0;for(let u=0;u<o;u++){const c=n?u:i[u],d=e[c],f=t[c];if(d===f){a[c]=d,(n?u<s:aw.call(e,c))&&l++;continue}if(d===null||f===null||typeof d!="object"||typeof f!="object"){a[c]=f;continue}const w=Kh(d,f);a[c]=w,w===d&&l++}return s===o&&l===s?e:a}function Xx(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function dd(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function hl(e){if(!fd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!fd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function fd(e){return Object.prototype.toString.call(e)==="[object Object]"}function lw(e){return new Promise(t=>{fl.setTimeout(t,e)})}function uw(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Kh(e,t):t}function Zx(e){return e}function cw(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function dw(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var vu=Symbol();function qh(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===vu?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ek(e,t){return typeof e=="function"?e(...t):!!e}var Cn,qt,cr,Ld,fw=(Ld=class extends Eo{constructor(){super();z(this,Cn);z(this,qt);z(this,cr);_(this,cr,t=>{if(!bo&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){P(this,qt)||this.setEventListener(P(this,cr))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,qt))==null||t.call(this),_(this,qt,void 0))}setEventListener(t){var n;_(this,cr,t),(n=P(this,qt))==null||n.call(this),_(this,qt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){P(this,Cn)!==t&&(_(this,Cn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof P(this,Cn)=="boolean"?P(this,Cn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Cn=new WeakMap,qt=new WeakMap,cr=new WeakMap,Ld),Vh=new fw;function pw(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var hw=nw;function mw(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=hw;const i=a=>{t?e.push(a):s(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||o()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var Pe=mw(),dr,Vt,fr,Od,gw=(Od=class extends Eo{constructor(){super();z(this,dr,!0);z(this,Vt);z(this,fr);_(this,fr,t=>{if(!bo&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){P(this,Vt)||this.setEventListener(P(this,fr))}onUnsubscribe(){var t;this.hasListeners()||((t=P(this,Vt))==null||t.call(this),_(this,Vt,void 0))}setEventListener(t){var n;_(this,fr,t),(n=P(this,Vt))==null||n.call(this),_(this,Vt,t(this.setOnline.bind(this)))}setOnline(t){P(this,dr)!==t&&(_(this,dr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return P(this,dr)}},dr=new WeakMap,Vt=new WeakMap,fr=new WeakMap,Od),Ji=new gw;function yw(e){return Math.min(1e3*2**e,3e4)}function Wh(e){return(e??"online")==="online"?Ji.isOnline():!0}var ml=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Qh(e){let t=!1,n=0,r;const s=pw(),i=()=>s.status!=="pending",o=v=>{var x;if(!i()){const h=new ml(v);f(h),(x=e.onCancel)==null||x.call(e,h)}},a=()=>{t=!0},l=()=>{t=!1},u=()=>Vh.isFocused()&&(e.networkMode==="always"||Ji.isOnline())&&e.canRun(),c=()=>Wh(e.networkMode)&&e.canRun(),d=v=>{i()||(r==null||r(),s.resolve(v))},f=v=>{i()||(r==null||r(),s.reject(v))},w=()=>new Promise(v=>{var x;r=h=>{(i()||u())&&v(h)},(x=e.onPause)==null||x.call(e)}).then(()=>{var v;r=void 0,i()||(v=e.onContinue)==null||v.call(e)}),g=()=>{if(i())return;let v;const x=n===0?e.initialPromise:void 0;try{v=x??e.fn()}catch(h){v=Promise.reject(h)}Promise.resolve(v).then(d).catch(h=>{var T;if(i())return;const p=e.retry??(bo?0:3),m=e.retryDelay??yw,y=typeof m=="function"?m(n,h):m,C=p===!0||typeof p=="number"&&n<p||typeof p=="function"&&p(n,h);if(t||!C){f(h);return}n++,(T=e.onFail)==null||T.call(e,n,h),lw(y).then(()=>u()?void 0:w()).then(()=>{t?f(h):g()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?g():w().then(g),s)}}var Pn,Nd,Jh=(Nd=class{constructor(){z(this,Pn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),sw(this.gcTime)&&_(this,Pn,fl.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bo?1/0:5*60*1e3))}clearGcTimeout(){P(this,Pn)&&(fl.clearTimeout(P(this,Pn)),_(this,Pn,void 0))}},Pn=new WeakMap,Nd),En,pr,qe,bn,le,bs,Tn,nt,St,Ad,vw=(Ad=class extends Jh{constructor(t){super();z(this,nt);z(this,En);z(this,pr);z(this,qe);z(this,bn);z(this,le);z(this,bs);z(this,Tn);_(this,Tn,!1),_(this,bs,t.defaultOptions),this.setOptions(t.options),this.observers=[],_(this,bn,t.client),_(this,qe,P(this,bn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,_(this,En,pd(this.options)),this.state=t.state??P(this,En),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=P(this,le))==null?void 0:t.promise}setOptions(t){if(this.options={...P(this,bs),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=pd(this.options);n.data!==void 0&&(this.setData(n.data,{updatedAt:n.dataUpdatedAt,manual:!0}),_(this,En,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&P(this,qe).remove(this)}setData(t,n){const r=uw(this.state.data,t,this.options);return ge(this,nt,St).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ge(this,nt,St).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=P(this,le))==null?void 0:r.promise;return(s=P(this,le))==null||s.cancel(t),n?n.then(tt).catch(tt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(P(this,En))}isActive(){return this.observers.some(t=>ow(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===vu||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>pl(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!iw(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,le))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=P(this,le))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),P(this,qe).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(P(this,le)&&(P(this,Tn)?P(this,le).cancel({revert:!0}):P(this,le).cancelRetry()),this.scheduleGc()),P(this,qe).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ge(this,nt,St).call(this,{type:"invalidate"})}async fetch(t,n){var l,u,c,d,f,w,g,v,x,h,p,m;if(this.state.fetchStatus!=="idle"&&((l=P(this,le))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(P(this,le))return P(this,le).continueRetry(),P(this,le).promise}if(t&&this.setOptions(t),!this.options.queryFn){const y=this.observers.find(C=>C.options.queryFn);y&&this.setOptions(y.options)}const r=new AbortController,s=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(_(this,Tn,!0),r.signal)})},i=()=>{const y=qh(this.options,n),T=(()=>{const b={client:P(this,bn),queryKey:this.queryKey,meta:this.meta};return s(b),b})();return _(this,Tn,!1),this.options.persister?this.options.persister(y,T,this):y(T)},a=(()=>{const y={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:P(this,bn),state:this.state,fetchFn:i};return s(y),y})();(u=this.options.behavior)==null||u.onFetch(a,this),_(this,pr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&ge(this,nt,St).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),_(this,le,Qh({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:y=>{y instanceof ml&&y.revert&&this.setState({...P(this,pr),fetchStatus:"idle"}),r.abort()},onFail:(y,C)=>{ge(this,nt,St).call(this,{type:"failed",failureCount:y,error:C})},onPause:()=>{ge(this,nt,St).call(this,{type:"pause"})},onContinue:()=>{ge(this,nt,St).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const y=await P(this,le).start();if(y===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(y),(w=(f=P(this,qe).config).onSuccess)==null||w.call(f,y,this),(v=(g=P(this,qe).config).onSettled)==null||v.call(g,y,this.state.error,this),y}catch(y){if(y instanceof ml){if(y.silent)return P(this,le).promise;if(y.revert){if(this.state.data===void 0)throw y;return this.state.data}}throw ge(this,nt,St).call(this,{type:"error",error:y}),(h=(x=P(this,qe).config).onError)==null||h.call(x,y,this),(m=(p=P(this,qe).config).onSettled)==null||m.call(p,this.state.data,y,this),y}finally{this.scheduleGc()}}},En=new WeakMap,pr=new WeakMap,qe=new WeakMap,bn=new WeakMap,le=new WeakMap,bs=new WeakMap,Tn=new WeakMap,nt=new WeakSet,St=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...ww(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return _(this,pr,t.manual?s:void 0),s;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Pe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),P(this,qe).notify({query:this,type:"updated",action:t})})},Ad);function ww(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Wh(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function pd(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}function hd(e){return{onFetch:(t,n)=>{var c,d,f,w,g;const r=t.options,s=(f=(d=(c=t.fetchOptions)==null?void 0:c.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,i=((w=t.state.data)==null?void 0:w.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let v=!1;const x=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(t.signal.aborted?v=!0:t.signal.addEventListener("abort",()=>{v=!0}),t.signal)})},h=qh(t.options,t.fetchOptions),p=async(m,y,C)=>{if(v)return Promise.reject();if(y==null&&m.pages.length)return Promise.resolve(m);const b=(()=>{const H={client:t.client,queryKey:t.queryKey,pageParam:y,direction:C?"backward":"forward",meta:t.options.meta};return x(H),H})(),O=await h(b),{maxPages:U}=t.options,A=C?dw:cw;return{pages:A(m.pages,O,U),pageParams:A(m.pageParams,y,U)}};if(s&&i.length){const m=s==="backward",y=m?xw:md,C={pages:i,pageParams:o},T=y(r,C);a=await p(C,T,m)}else{const m=e??i.length;do{const y=l===0?o[0]??r.initialPageParam:md(r,a);if(l>0&&y==null)break;a=await p(a,y),l++}while(l<m)}return a};t.options.persister?t.fetchFn=()=>{var v,x;return(x=(v=t.options).persister)==null?void 0:x.call(v,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function md(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function xw(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Ts,ht,Se,Rn,mt,Ut,Id,kw=(Id=class extends Jh{constructor(t){super();z(this,mt);z(this,Ts);z(this,ht);z(this,Se);z(this,Rn);_(this,Ts,t.client),this.mutationId=t.mutationId,_(this,Se,t.mutationCache),_(this,ht,[]),this.state=t.state||Sw(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){P(this,ht).includes(t)||(P(this,ht).push(t),this.clearGcTimeout(),P(this,Se).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){_(this,ht,P(this,ht).filter(n=>n!==t)),this.scheduleGc(),P(this,Se).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){P(this,ht).length||(this.state.status==="pending"?this.scheduleGc():P(this,Se).remove(this))}continue(){var t;return((t=P(this,Rn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,l,u,c,d,f,w,g,v,x,h,p,m,y,C,T,b,O,U;const n=()=>{ge(this,mt,Ut).call(this,{type:"continue"})},r={client:P(this,Ts),meta:this.options.meta,mutationKey:this.options.mutationKey};_(this,Rn,Qh({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(A,H)=>{ge(this,mt,Ut).call(this,{type:"failed",failureCount:A,error:H})},onPause:()=>{ge(this,mt,Ut).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>P(this,Se).canRun(this)}));const s=this.state.status==="pending",i=!P(this,Rn).canStart();try{if(s)n();else{ge(this,mt,Ut).call(this,{type:"pending",variables:t,isPaused:i}),await((a=(o=P(this,Se).config).onMutate)==null?void 0:a.call(o,t,this,r));const H=await((u=(l=this.options).onMutate)==null?void 0:u.call(l,t,r));H!==this.state.context&&ge(this,mt,Ut).call(this,{type:"pending",context:H,variables:t,isPaused:i})}const A=await P(this,Rn).start();return await((d=(c=P(this,Se).config).onSuccess)==null?void 0:d.call(c,A,t,this.state.context,this,r)),await((w=(f=this.options).onSuccess)==null?void 0:w.call(f,A,t,this.state.context,r)),await((v=(g=P(this,Se).config).onSettled)==null?void 0:v.call(g,A,null,this.state.variables,this.state.context,this,r)),await((h=(x=this.options).onSettled)==null?void 0:h.call(x,A,null,t,this.state.context,r)),ge(this,mt,Ut).call(this,{type:"success",data:A}),A}catch(A){try{throw await((m=(p=P(this,Se).config).onError)==null?void 0:m.call(p,A,t,this.state.context,this,r)),await((C=(y=this.options).onError)==null?void 0:C.call(y,A,t,this.state.context,r)),await((b=(T=P(this,Se).config).onSettled)==null?void 0:b.call(T,void 0,A,this.state.variables,this.state.context,this,r)),await((U=(O=this.options).onSettled)==null?void 0:U.call(O,void 0,A,t,this.state.context,r)),A}finally{ge(this,mt,Ut).call(this,{type:"error",error:A})}}finally{P(this,Se).runNext(this)}}},Ts=new WeakMap,ht=new WeakMap,Se=new WeakMap,Rn=new WeakMap,mt=new WeakSet,Ut=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Pe.batch(()=>{P(this,ht).forEach(r=>{r.onMutationUpdate(t)}),P(this,Se).notify({mutation:this,type:"updated",action:t})})},Id);function Sw(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Et,rt,Rs,Fd,Cw=(Fd=class extends Eo{constructor(t={}){super();z(this,Et);z(this,rt);z(this,Rs);this.config=t,_(this,Et,new Set),_(this,rt,new Map),_(this,Rs,0)}build(t,n,r){const s=new kw({client:t,mutationCache:this,mutationId:++zs(this,Rs)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){P(this,Et).add(t);const n=ii(t);if(typeof n=="string"){const r=P(this,rt).get(n);r?r.push(t):P(this,rt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(P(this,Et).delete(t)){const n=ii(t);if(typeof n=="string"){const r=P(this,rt).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&P(this,rt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ii(t);if(typeof n=="string"){const r=P(this,rt).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=ii(t);if(typeof n=="string"){const s=(r=P(this,rt).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Pe.batch(()=>{P(this,Et).forEach(t=>{this.notify({type:"removed",mutation:t})}),P(this,Et).clear(),P(this,rt).clear()})}getAll(){return Array.from(P(this,Et))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>cd(n,r))}findAll(t={}){return this.getAll().filter(n=>cd(t,n))}notify(t){Pe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Pe.batch(()=>Promise.all(t.map(n=>n.continue().catch(tt))))}},Et=new WeakMap,rt=new WeakMap,Rs=new WeakMap,Fd);function ii(e){var t;return(t=e.options.scope)==null?void 0:t.id}var gt,_d,Pw=(_d=class extends Eo{constructor(t={}){super();z(this,gt);this.config=t,_(this,gt,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??yu(s,n);let o=this.get(i);return o||(o=new vw({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){P(this,gt).has(t.queryHash)||(P(this,gt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=P(this,gt).get(t.queryHash);n&&(t.destroy(),n===t&&P(this,gt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Pe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return P(this,gt).get(t)}getAll(){return[...P(this,gt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ud(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>ud(t,r)):n}notify(t){Pe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Pe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Pe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},gt=new WeakMap,_d),ee,Wt,Qt,hr,mr,Jt,gr,yr,jd,Ew=(jd=class{constructor(e={}){z(this,ee);z(this,Wt);z(this,Qt);z(this,hr);z(this,mr);z(this,Jt);z(this,gr);z(this,yr);_(this,ee,e.queryCache||new Pw),_(this,Wt,e.mutationCache||new Cw),_(this,Qt,e.defaultOptions||{}),_(this,hr,new Map),_(this,mr,new Map),_(this,Jt,0)}mount(){zs(this,Jt)._++,P(this,Jt)===1&&(_(this,gr,Vh.subscribe(async e=>{e&&(await this.resumePausedMutations(),P(this,ee).onFocus())})),_(this,yr,Ji.subscribe(async e=>{e&&(await this.resumePausedMutations(),P(this,ee).onOnline())})))}unmount(){var e,t;zs(this,Jt)._--,P(this,Jt)===0&&((e=P(this,gr))==null||e.call(this),_(this,gr,void 0),(t=P(this,yr))==null||t.call(this),_(this,yr,void 0))}isFetching(e){return P(this,ee).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return P(this,Wt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=P(this,ee).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=P(this,ee).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(pl(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return P(this,ee).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=P(this,ee).get(r.queryHash),i=s==null?void 0:s.state.data,o=rw(t,i);if(o!==void 0)return P(this,ee).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Pe.batch(()=>P(this,ee).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=P(this,ee).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=P(this,ee);Pe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=P(this,ee);return Pe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Pe.batch(()=>P(this,ee).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(tt).catch(tt)}invalidateQueries(e,t={}){return Pe.batch(()=>(P(this,ee).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Pe.batch(()=>P(this,ee).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(tt)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(tt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=P(this,ee).build(this,t);return n.isStaleByTime(pl(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(tt).catch(tt)}fetchInfiniteQuery(e){return e.behavior=hd(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(tt).catch(tt)}ensureInfiniteQueryData(e){return e.behavior=hd(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ji.isOnline()?P(this,Wt).resumePausedMutations():Promise.resolve()}getQueryCache(){return P(this,ee)}getMutationCache(){return P(this,Wt)}getDefaultOptions(){return P(this,Qt)}setDefaultOptions(e){_(this,Qt,e)}setQueryDefaults(e,t){P(this,hr).set(Cs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...P(this,hr).values()],n={};return t.forEach(r=>{Ps(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){P(this,mr).set(Cs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...P(this,mr).values()],n={};return t.forEach(r=>{Ps(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...P(this,Qt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=yu(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===vu&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...P(this,Qt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){P(this,ee).clear(),P(this,Wt).clear()}},ee=new WeakMap,Wt=new WeakMap,Qt=new WeakMap,hr=new WeakMap,mr=new WeakMap,Jt=new WeakMap,gr=new WeakMap,yr=new WeakMap,jd),Gh=S.createContext(void 0),tk=e=>{const t=S.useContext(Gh);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},bw=({client:e,children:t})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),E.jsx(Gh.Provider,{value:e,children:t}));const j=e=>typeof e=="string",Hr=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},gd=e=>e==null?"":""+e,Tw=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},Rw=/###/g,yd=e=>e&&e.indexOf("###")>-1?e.replace(Rw,"."):e,vd=e=>!e||j(e),rs=(e,t,n)=>{const r=j(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(vd(e))return{};const i=yd(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return vd(e)?{}:{obj:e,k:yd(r[s])}},wd=(e,t,n)=>{const{obj:r,k:s}=rs(e,t,Object);if(r!==void 0||t.length===1){r[s]=n;return}let i=t[t.length-1],o=t.slice(0,t.length-1),a=rs(e,o,Object);for(;a.obj===void 0&&o.length;)i=`${o[o.length-1]}.${i}`,o=o.slice(0,o.length-1),a=rs(e,o,Object),a&&a.obj&&typeof a.obj[`${a.k}.${i}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${i}`]=n},Lw=(e,t,n,r)=>{const{obj:s,k:i}=rs(e,t,Object);s[i]=s[i]||[],s[i].push(n)},Gi=(e,t)=>{const{obj:n,k:r}=rs(e,t);if(n)return n[r]},Ow=(e,t,n)=>{const r=Gi(e,n);return r!==void 0?r:Gi(t,n)},Yh=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?j(e[r])||e[r]instanceof String||j(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Yh(e[r],t[r],n):e[r]=t[r]);return e},Hn=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Nw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Aw=e=>j(e)?e.replace(/[&<>"'\/]/g,t=>Nw[t]):e;class Iw{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const Fw=[" ",",","?","!",";"],_w=new Iw(20),jw=(e,t,n)=>{t=t||"",n=n||"";const r=Fw.filter(o=>t.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const s=_w.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let i=!s.test(e);if(!i){const o=e.indexOf(n);o>0&&!s.test(e.substring(0,o))&&(i=!0)}return i},gl=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let s=e;for(let i=0;i<r.length;){if(!s||typeof s!="object")return;let o,a="";for(let l=i;l<r.length;++l)if(l!==i&&(a+=n),a+=r[l],o=s[a],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&l<r.length-1)continue;i+=l-i+1;break}s=o}return s},Yi=e=>e&&e.replace("_","-"),Dw={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class Xi{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||Dw,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,s){return s&&!this.debug?null:(j(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Xi(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Xi(this.logger,t)}}var vt=new Xi;class To{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(n)||0;this.observers[r].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(o=>{let[a,l]=o;for(let u=0;u<l;u++)a(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[a,l]=o;for(let u=0;u<l;u++)a.apply(a,[t,...r])})}}class xd extends To{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,o=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;t.indexOf(".")>-1?a=t.split("."):(a=[t,n],r&&(Array.isArray(r)?a.push(...r):j(r)&&i?a.push(...r.split(i)):a.push(r)));const l=Gi(this.data,a);return!l&&!n&&!r&&t.indexOf(".")>-1&&(t=a[0],n=a[1],r=a.slice(2).join(".")),l||!o||!j(r)?l:gl(this.data&&this.data[t]&&this.data[t][n],r,i)}addResource(t,n,r,s){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(a=t.split("."),s=n,n=a[1]),this.addNamespaces(n),wd(this.data,a,s),i.silent||this.emit("added",t,n,r,s)}addResources(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in r)(j(r[i])||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,i){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),s=r,r=n,n=a[1]),this.addNamespaces(n);let l=Gi(this.data,a)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?Yh(l,r,i):l={...l,...r},wd(this.data,a,l),o.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var Xh={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,s){return e.forEach(i=>{this.processors[i]&&(t=this.processors[i].process(t,n,r,s))}),t}};const kd={};class Zi extends To{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Tw(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=vt.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const o=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!jw(t,r,s);if(o&&!a){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:j(i)?[i]:i};const u=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),t=u.join(s)}return{key:t,namespaces:j(i)?[i]:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const s=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:a}=this.extractFromKey(t[t.length-1],n),l=a[a.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const y=n.nsSeparator||this.options.nsSeparator;return s?{res:`${l}${y}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${y}${o}`}return s?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:o}const d=this.resolve(t,n);let f=d&&d.res;const w=d&&d.usedKey||o,g=d&&d.exactUsedKey||o,v=Object.prototype.toString.apply(f),x=["[object Number]","[object Function]","[object RegExp]"],h=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,p=!this.i18nFormat||this.i18nFormat.handleAsObject,m=!j(f)&&typeof f!="boolean"&&typeof f!="number";if(p&&f&&m&&x.indexOf(v)<0&&!(j(h)&&Array.isArray(f))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const y=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,f,{...n,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;return s?(d.res=y,d.usedParams=this.getUsedParamsDetails(n),d):y}if(i){const y=Array.isArray(f),C=y?[]:{},T=y?g:w;for(const b in f)if(Object.prototype.hasOwnProperty.call(f,b)){const O=`${T}${i}${b}`;C[b]=this.translate(O,{...n,joinArrays:!1,ns:a}),C[b]===O&&(C[b]=f[b])}f=C}}else if(p&&j(h)&&Array.isArray(f))f=f.join(h),f&&(f=this.extendTranslation(f,t,n,r));else{let y=!1,C=!1;const T=n.count!==void 0&&!j(n.count),b=Zi.hasDefaultValue(n),O=T?this.pluralResolver.getSuffix(u,n.count,n):"",U=n.ordinal&&T?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",A=T&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),H=A&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${O}`]||n[`defaultValue${U}`]||n.defaultValue;!this.isValidLookup(f)&&b&&(y=!0,f=H),this.isValidLookup(f)||(C=!0,f=o);const _e=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:f,me=b&&H!==f&&this.options.updateMissing;if(C||y||me){if(this.logger.log(me?"updateKey":"missingKey",u,l,o,me?H:f),i){const L=this.resolve(o,{...n,keySeparator:!1});L&&L.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 ct=[];const ie=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ie&&ie[0])for(let L=0;L<ie.length;L++)ct.push(ie[L]);else this.options.saveMissingTo==="all"?ct=this.languageUtils.toResolveHierarchy(n.lng||this.language):ct.push(n.lng||this.language);const kt=(L,I,F)=>{const $=b&&F!==f?F:_e;this.options.missingKeyHandler?this.options.missingKeyHandler(L,l,I,$,me,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(L,l,I,$,me,n),this.emit("missingKey",L,l,I,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&T?ct.forEach(L=>{const I=this.pluralResolver.getSuffixes(L,n);A&&n[`defaultValue${this.options.pluralSeparator}zero`]&&I.indexOf(`${this.options.pluralSeparator}zero`)<0&&I.push(`${this.options.pluralSeparator}zero`),I.forEach(F=>{kt([L],o+F,n[`defaultValue${F}`]||H)})}):kt(ct,o,H))}f=this.extendTranslation(f,t,n,d,r),C&&f===o&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${o}`),(C||y)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,y?f:void 0):f=this.options.parseMissingKeyHandler(f))}return s?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}extendTranslation(t,n,r,s,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=j(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&!j(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language||s.usedLng,r),u){const f=t.match(this.interpolator.nestingRegexp),w=f&&f.length;c<w&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&s&&s.res&&(r.lng=this.language||s.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var f=arguments.length,w=new Array(f),g=0;g<f;g++)w[g]=arguments[g];return i&&i[0]===w[0]&&!r.context?(o.logger.warn(`It seems you are nesting recursively key: ${w[0]} in key: ${n[0]}`),null):o.translate(...w,n)},r)),r.interpolation&&this.interpolator.reset()}const a=r.postProcess||this.options.postProcess,l=j(a)?[a]:a;return t!=null&&l&&l.length&&r.applyPostProcessor!==!1&&(t=Xh.handle(l,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,s,i,o,a;return j(t)&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;s=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&!j(n.count),w=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(j(n.context)||typeof n.context=="number")&&n.context!=="",v=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(x=>{this.isValidLookup(r)||(a=x,!kd[`${v[0]}-${x}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(kd[`${v[0]}-${x}`]=!0,this.logger.warn(`key "${s}" for languages "${v.join(", ")}" won't get resolved as namespace "${a}" 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!!!")),v.forEach(h=>{if(this.isValidLookup(r))return;o=h;const p=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(p,c,h,x,n);else{let y;f&&(y=this.pluralResolver.getSuffix(h,n.count,n));const C=`${this.options.pluralSeparator}zero`,T=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(p.push(c+y),n.ordinal&&y.indexOf(T)===0&&p.push(c+y.replace(T,this.options.pluralSeparator)),w&&p.push(c+C)),g){const b=`${c}${this.options.contextSeparator}${n.context}`;p.push(b),f&&(p.push(b+y),n.ordinal&&y.indexOf(T)===0&&p.push(b+y.replace(T,this.options.pluralSeparator)),w&&p.push(b+C))}}let m;for(;m=p.pop();)this.isValidLookup(r)||(i=m,r=this.getResource(h,x,m,n))}))})}),{res:r,usedKey:s,exactUsedKey:i,usedLng:o,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!j(t.replace);let s=r?t.replace:t;if(r&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const i of n)delete s[i]}return s}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}const oa=e=>e.charAt(0).toUpperCase()+e.slice(1);class Sd{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=vt.create("languageUtils")}getScriptPartFromCode(t){if(t=Yi(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Yi(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(j(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let s=Intl.getCanonicalLocales(t)[0];if(s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s)return s}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(s=>s.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=oa(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=oa(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=oa(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(i=>{if(i===s)return i;if(!(i.indexOf("-")<0&&s.indexOf("-")<0)&&(i.indexOf("-")>0&&s.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===s||i.indexOf(s)===0&&s.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),j(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),s=[],i=o=>{o&&(this.isSupportedCode(o)?s.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return j(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):j(t)&&i(this.formatLanguageCode(t)),r.forEach(o=>{s.indexOf(o)<0&&i(this.formatLanguageCode(o))}),s}}let Mw=[{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}],Uw={1:e=>+(e>1),2:e=>+(e!=1),3:e=>0,4:e=>e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,5:e=>e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5,6:e=>e==1?0:e>=2&&e<=4?1:2,7:e=>e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,8:e=>e==1?0:e==2?1:e!=8&&e!=11?2:3,9:e=>+(e>=2),10:e=>e==1?0:e==2?1:e<7?2:e<11?3:4,11:e=>e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3,12:e=>+(e%10!=1||e%100==11),13:e=>+(e!==0),14:e=>e==1?0:e==2?1:e==3?2:3,15:e=>e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2,16:e=>e%10==1&&e%100!=11?0:e!==0?1:2,17:e=>e==1||e%10==1&&e%100!=11?0:1,18:e=>e==0?0:e==1?1:2,19:e=>e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3,20:e=>e==1?0:e==0||e%100>0&&e%100<20?1:2,21:e=>e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0,22:e=>e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3};const zw=["v1","v2","v3"],$w=["v4"],Cd={zero:0,one:1,two:2,few:3,many:4,other:5},Bw=()=>{const e={};return Mw.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:Uw[t.fc]}})}),e};class Hw{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=vt.create("pluralResolver"),(!this.options.compatibilityJSON||$w.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=Bw(),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi()){const r=Yi(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:s});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let o;try{o=new Intl.PluralRules(r,{type:s})}catch{if(!t.match(/-|_/))return;const l=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(l,n)}return this.pluralRulesCache[i]=o,o}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(s=>`${n}${s}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((s,i)=>Cd[s]-Cd[i]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):r.numbers.map(s=>this.getSuffix(t,s,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=this.getRule(t,r);return s?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:this.getSuffixRetroCompatible(s,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let s=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));const i=()=>this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString();return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?`_plural_${s.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?i():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!zw.includes(this.options.compatibilityJSON)}}const Pd=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=Ow(e,t,n);return!i&&s&&j(n)&&(i=gl(e,n,r),i===void 0&&(i=gl(t,n,r))),i},aa=e=>e.replace(/\$/g,"$$$$");class Kw{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=vt.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:s,prefix:i,prefixEscaped:o,suffix:a,suffixEscaped:l,formatSeparator:u,unescapeSuffix:c,unescapePrefix:d,nestingPrefix:f,nestingPrefixEscaped:w,nestingSuffix:g,nestingSuffixEscaped:v,nestingOptionsSeparator:x,maxReplaces:h,alwaysFormat:p}=t.interpolation;this.escape=n!==void 0?n:Aw,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?Hn(i):o||"{{",this.suffix=a?Hn(a):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=c?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=f?Hn(f):w||Hn("$t("),this.nestingSuffix=g?Hn(g):v||Hn(")"),this.nestingOptionsSeparator=x||",",this.maxReplaces=h||1e3,this.alwaysFormat=p!==void 0?p:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let i,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=w=>{if(w.indexOf(this.formatSeparator)<0){const h=Pd(n,l,w,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(h,void 0,r,{...s,...n,interpolationkey:w}):h}const g=w.split(this.formatSeparator),v=g.shift().trim(),x=g.join(this.formatSeparator).trim();return this.format(Pd(n,l,v,this.options.keySeparator,this.options.ignoreJSONStructure),x,r,{...s,...n,interpolationkey:v})};this.resetRegExp();const c=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,d=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:w=>aa(w)},{regex:this.regexp,safeValue:w=>this.escapeValue?aa(this.escape(w)):aa(w)}].forEach(w=>{for(a=0;i=w.regex.exec(t);){const g=i[1].trim();if(o=u(g),o===void 0)if(typeof c=="function"){const x=c(t,i,s);o=j(x)?x:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))o="";else if(d){o=i[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),o="";else!j(o)&&!this.useRawValueToEscape&&(o=gd(o));const v=w.safeValue(o);if(t=t.replace(i[0],v),d?(w.regex.lastIndex+=o.length,w.regex.lastIndex-=i[0].length):w.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,i,o;const a=(l,u)=>{const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,o);const w=f.match(/'/g),g=f.match(/"/g);(w&&w.length%2===0&&!g||g.length%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),u&&(o={...u,...o})}catch(v){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,v),`${l}${c}${f}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;s=this.nestingRegexp.exec(t);){let l=[];o={...r},o=o.replace&&!j(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const c=s[1].split(this.formatSeparator).map(d=>d.trim());s[1]=c.shift(),l=c,u=!0}if(i=n(a.call(this,s[1].trim(),o),o),i&&s[0]===t&&!j(i))return i;j(i)||(i=gd(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),u&&(i=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const qw=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);t==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(o=>{if(o){const[a,...l]=o.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),c=a.trim();n[c]||(n[c]=u),u==="false"&&(n[c]=!1),u==="true"&&(n[c]=!0),isNaN(u)||(n[c]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},Kn=e=>{const t={};return(n,r,s)=>{let i=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(i={...i,[s.interpolationkey]:void 0});const o=r+JSON.stringify(i);let a=t[o];return a||(a=e(Yi(r),s),t[o]=a),a(n)}};class Vw{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=vt.create("formatter"),this.options=t,this.formats={number:Kn((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:Kn((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:Kn((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:Kn((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:Kn((n,r)=>{const s=new Intl.ListFormat(n,{...r});return i=>s.format(i)})},this.init(t)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Kn(n)}format(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=n.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(a=>a.indexOf(")")>-1)){const a=i.findIndex(l=>l.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,a)].join(this.formatSeparator)}return i.reduce((a,l)=>{const{formatName:u,formatOptions:c}=qw(l);if(this.formats[u]){let d=a;try{const f=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},w=f.locale||f.lng||s.locale||s.lng||r;d=this.formats[u](a,w,{...c,...s,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}const Ww=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class Qw extends To{constructor(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=vt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,s.backend,s)}queueLoad(t,n,r,s){const i={},o={},a={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,c=!1,o[f]===void 0&&(o[f]=!0),i[f]===void 0&&(i[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(a[u]=!0)}),(Object.keys(i).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(i),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const s=t.split("|"),i=s[0],o=s[1];n&&this.emit("failedLoading",i,o,n),!n&&r&&this.store.addResourceBundle(i,o,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const a={};this.queue.forEach(l=>{Lw(l.loaded,[i],o),Ww(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{a[u][d]===void 0&&(a[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:s,wait:i,callback:o});return}this.readingCalls++;const a=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,i*2,o)},i);return}o(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>a(null,c)).catch(a):a(null,u)}catch(u){a(u)}return}return l(t,n,a)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=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."),s&&s();j(t)&&(t=this.languageUtils.toResolveHierarchy(t)),j(n)&&(n=[n]);const i=this.queueLoad(t,n,r,s);if(!i.toLoad.length)return i.pending.length||s(),null;i.toLoad.forEach(o=>{this.loadOne(o)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),s=r[0],i=r[1];this.read(s,i,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${n}loading namespace ${i} for language ${s} failed`,o),!o&&a&&this.logger.log(`${n}loaded namespace ${i} for language ${s}`,a),this.loaded(t,o,a)})}saveMissing(t,n,r,s,i){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" 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(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...o,isUpdate:i},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,s,l):c=u(t,n,r,s),c&&typeof c.then=="function"?c.then(d=>a(null,d)).catch(a):a(null,c)}catch(c){a(c)}else u(t,n,r,s,a,l)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const Ed=()=>({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:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),j(e[1])&&(t.defaultValue=e[1]),j(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),bd=e=>(j(e.ns)&&(e.ns=[e.ns]),j(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),j(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),oi=()=>{},Jw=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Es extends To{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=bd(t),this.services={},this.logger=vt,this.modules={external:[]},Jw(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(j(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=Ed();this.options={...s,...this.options,...bd(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const i=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?vt.init(i(this.modules.logger),this.options):vt.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=Vw);const d=new Sd(this.options);this.store=new xd(this.options.resources,this.options);const f=this.services;f.logger=vt,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new Hw(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(f.formatter=i(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Kw(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Qw(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(w){for(var g=arguments.length,v=new Array(g>1?g-1:0),x=1;x<g;x++)v[x-1]=arguments[x];t.emit(w,...v)}),this.modules.languageDetector&&(f.languageDetector=i(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=i(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new Zi(this.services,this.options),this.translator.on("*",function(w){for(var g=arguments.length,v=new Array(g>1?g-1:0),x=1;x<g;x++)v[x-1]=arguments[x];t.emit(w,...v)}),this.modules.external.forEach(w=>{w.init&&w.init(this)})}if(this.format=this.options.interpolation.format,r||(r=oi),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 t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=Hr(),u=()=>{const c=(d,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),r(d,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(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:oi;const s=j(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],o=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{u!=="cimode"&&i.indexOf(u)<0&&i.push(u)})};s?o(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload&&this.options.preload.forEach(a=>o(a)),this.services.backendConnector.load(i,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const s=Hr();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=oi),this.services.backendConnector.reload(t,n,i=>{s.resolve(),r(i)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Xh.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const s=Hr();this.emit("languageChanging",t);const i=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,u)=>{u?(i(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,s.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=j(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{o(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),s}getFixedT(t,n,r){var s=this;const i=function(o,a){let l;if(typeof a!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d<u;d++)c[d-2]=arguments[d];l=s.options.overloadTranslationOptionHandler([o,a].concat(c))}else l={...a};l.lng=l.lng||i.lng,l.lngs=l.lngs||i.lngs,l.ns=l.ns||i.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||r||i.keyPrefix);const f=s.options.keySeparator||".";let w;return l.keyPrefix&&Array.isArray(o)?w=o.map(g=>`${l.keyPrefix}${f}${g}`):w=l.keyPrefix?`${l.keyPrefix}${f}${o}`:o,s.t(w,l)};return j(t)?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=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 r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===0||u===2};if(n.precheck){const a=n.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,t)&&(!s||o(i,t)))}loadNamespaces(t,n){const r=Hr();return this.options.ns?(j(t)&&(t=[t]),t.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Hr();j(t)&&(t=[t]);const s=this.options.preload||[],i=t.filter(o=>s.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return i.length?(this.options.preload=s.concat(i),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["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"],r=this.services&&this.services.languageUtils||new Sd(Ed());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Es(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:oi;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new Es(s);return(t.debug!==void 0||t.prefix!==void 0)&&(i.logger=i.logger.clone(t)),["store","services","language"].forEach(a=>{i[a]=this[a]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r&&(i.store=new xd(this.store.data,s),i.services.resourceStore=i.store),i.translator=new Zi(i.services,s),i.translator.on("*",function(a){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c<l;c++)u[c-1]=arguments[c];i.emit(a,...u)}),i.init(s,n),i.translator.options=s,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const de=Es.createInstance();de.createInstance=Es.createInstance;de.createInstance;de.dir;de.init;de.loadResources;de.reloadResources;de.use;de.changeLanguage;de.getFixedT;de.t;de.exists;de.setDefaultNamespace;de.hasLoadedNamespace;de.loadNamespaces;de.loadLanguages;const Gw={zh:{translation:{app:{title:"cc-gw 控制台",skipToContent:"跳转到主要内容"},nav:{dashboard:"仪表盘",logs:"请求日志",models:"模型管理",apiKeys:"API 密钥",settings:"设置",help:"使用指南",about:"关于"},language:{zh:"简体中文",en:"English"},common:{loading:"加载中...",loadingShort:"加载中...",noData:"暂无数据",languageSelector:"语言选择",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"}},login:{title:"登录 cc-gw 控制台",description:"启用 Web UI 访问控制后,请输入账号与密码继续。",fields:{username:"用户名",usernamePlaceholder:"请输入用户名",password:"密码",passwordPlaceholder:"请输入密码"},actions:{submit:"登录"},validation:{required:"请填写用户名和密码",failed:"登录失败,请检查账号或密码后重试"},hint:"如果忘记密码,可在服务器上通过 CLI 或编辑配置重置 Web 登录设置。",status:"已登录:{{username}}"},dashboard:{description:"快速了解请求规模与实时运行状态。",filters:{endpoint:"端点筛选",endpointAll:"全部端点",endpointAnthropic:"anthropic",endpointOpenAI:"openai"},status:{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",todayOutput:"今日输出 Tokens",avgLatency:"平均响应耗时"},charts:{requestsTitle:"请求趋势",requestsDesc:"最近 14 天请求与 Token 走势",modelTitle:"模型调用分布",modelDesc:"近 7 天不同模型的调用次数与 Token 走势",barRequests:"请求数",lineInput:"输入 Tokens",lineOutput:"输出 Tokens",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:"暂无数据"},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:"未找到符合条件的日志记录。",requestedModelFallback:"未指定",apiKeyUnknown:"未知密钥",columns:{time:"时间",endpoint:"端点",provider:"Provider",requestedModel:"请求模型",routedModel:"路由模型",apiKey:"API Key",inputTokens:"输入 Tokens",cachedTokens:"缓存 Tokens",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",cachedTokens:"缓存 Tokens",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,请点击“新增提供商”以开始配置。",count:"已配置:{{count}} 个 Provider",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:{defaultModel:"默认模型:{{model}}",noDefault:"未设置默认模型",modelsTitle:"支持模型",noModels:"尚未配置模型。"},drawer:{createTitle:"新增 Provider",editTitle:"编辑 Provider",description:"配置基础信息与模型列表。",modelsDescription:"维护支持的模型列表。",defaultHint:"当前默认模型:{{model}}",fields:{id:"Provider ID",idPlaceholder:"如 openai",label:"显示名称",labelPlaceholder:"如 OpenAI 官方",baseUrl:"Base URL",baseUrlPlaceholder:"https://api.example.com/v1",type:"Provider 类型",apiKey:"API Key(可选)",apiKeyPlaceholder:"可留空以从环境变量读取",authMode:"认证方式",authModeHint:"Claude Code 可使用 Token 或 API Key,选择后填写对应值。",authModeApiKey:"使用 API Key(x-api-key)",authModeAuthToken:"使用 Auth Token(Authorization: Bearer)",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 端点的模型映射和默认配置。"},actions:{saveRoutes:"保存路由"},routing:{selectTarget:"请选择目标 Provider:模型"},toast:{routesSaved:"模型路由已更新。",routesSaveFailure:"保存模型路由失败:{{message}}",presetSaved:"已保存模板 “{{name}}”。",presetSaveFailure:"保存模板失败:{{message}}",presetApplySuccess:"已应用模板 “{{name}}”。",presetApplyFailure:"应用模板失败:{{message}}",presetDeleteSuccess:"模板 “{{name}}” 已删除。",presetDeleteFailure:"删除模板失败:{{message}}"},presets:{title:"路由模板",description:"保存当前 Anthropic 路由映射,便于在不同 Provider 方案之间快速切换。",namePlaceholder:"输入模板名称,例如 fox",save:"保存模板",saving:"保存中...",empty:"尚未保存任何模板。",apply:"应用",applying:"应用中...",delete:"删除",deleting:"删除中..."},validation:{presetName:"请输入模板名称。",presetDuplicate:"模板 {{name}} 已存在,请使用其他名称。"},confirm:{deletePreset:"确定要删除模板 “{{name}}” 吗?"}},settings:{title:"系统设置",description:"调整网关端口、日志策略及其他运行参数。",toast:{loadFailure:"配置加载失败:{{message}}",saveSuccess:"系统配置已更新。",saveFailure:"保存失败:{{message}}",copySuccess:"配置文件路径已复制到剪贴板。",copyFailure:"复制失败:{{message}}",cleanupSuccess:"已删除 {{count}} 条历史日志。",cleanupNone:"没有需要删除的日志。",cleanupFailure:"清理失败:{{message}}",clearAllSuccess:"日志已清空(请求 {{logs}} 条,统计 {{metrics}} 条)。",clearAllFailure:"清空失败:{{message}}",missingConfig:"未能加载配置,请刷新或稍后再试。",authLoadFailure:"安全配置加载失败:{{message}}"},sections:{basics:"基础配置",routing:"模型路由",configFile:"配置文件",cleanup:"日志清理",security:"访问安全"},fields:{port:"监听端口",host:"监听地址(可选)",hostPlaceholder:"默认 0.0.0.0",retention:"日志保留天数",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:"两次输入的密码不一致"}},validation:{port:"请输入 1-65535 之间的端口号",retention:"日志保留天数需为 1-365 之间的数字",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:"尚未配置映射,系统将使用默认模型策略。",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:"立即清理早于当前保留天数的日志记录。",clearAll:"彻底清空",clearingAll:"清空中...",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:[`📝 **编辑配置文件**:
149
149
  在 \`~/.codex/config.toml\` 进行配置:
150
150
  \`\`\`toml
151
151
  model = "gpt-5-codex"
@@ -158,7 +158,7 @@ name = "cc_gw"
158
158
  base_url = "http://127.0.0.1:4100/openai/v1"
159
159
  wire_api = "responses"
160
160
  env_key = "cc_gw_key"
161
- \`\`\``,"🔑 **设置环境变量**:\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 文件自动加载配置","🗃️ **数据备份**:定期备份 ~/.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:"需要上游 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:"构建时间",node:"Node 版本"},hint:{buildTime:"构建时间以 UTC 表示,便于排查部署版本。"}},status:{title:"运行状态",subtitle:"来自当前网关实例的实时指标。",loading:"正在获取运行状态...",empty:"未能获取状态信息。",labels:{host:"监听地址",port:"监听端口",providers:"已配置 Provider",active:"活动请求"},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:"删除"},created:"创建时间",lastUsed:"最后使用",requestCount:"请求次数",totalTokens:"总令牌数",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 密钥,点击右上角按钮开始创建。"},toast:{keyCreated:"API 密钥创建成功",keyUpdated:"API 密钥已更新",keyDeleted:"API 密钥已删除",keyCopied:"密钥已复制到剪贴板",createFailure:"创建失败:{{message}}",updateFailure:"更新失败:{{message}}",deleteFailure:"删除失败:{{message}}"}}}},en:{translation:{app:{title:"cc-gw Console",skipToContent:"Skip to main content"},nav:{dashboard:"Dashboard",logs:"Logs",models:"Model Management",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",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"}},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.",filters:{endpoint:"Endpoint",endpointAll:"All endpoints",endpointAnthropic:"anthropic",endpointOpenAI:"openai"},status:{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",todayOutput:"Output 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",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"},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.",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",cachedTokens:"Cached Tokens",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",cachedTokens:"Cached Tokens",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.',count:"{{count}} providers configured",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:{defaultModel:"Default model: {{model}}",noDefault:"No default model",modelsTitle:"Supported models",noModels:"No models configured yet."},drawer:{createTitle:"Add Provider",editTitle:"Edit Provider",description:"Configure base settings and model list.",modelsDescription:"Maintain supported models.",defaultHint:"Current default model: {{model}}",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:"Claude Code can authenticate with either an API key (x-api-key) or an auth token (Authorization: Bearer).",authModeApiKey:"Use API Key (x-api-key)",authModeAuthToken:"Use Auth Token (Authorization: Bearer)",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}}"}},confirm:{delete:"Remove provider “{{name}}”?"}},modelManagement:{title:"Model Management",description:"Configure providers and maintain model routing rules in one place.",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."},actions:{saveRoutes:"Save routes"},routing:{selectTarget:"Select provider:model"},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}}"},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..."},validation:{presetName:"Enter a preset name.",presetDuplicate:"Preset {{name}} already exists."},confirm:{deletePreset:"Delete preset “{{name}}”?"}},settings:{title:"System 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}}",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"},fields:{port:"Listen port",host:"Listen host (optional)",hostPlaceholder:"Defaults to 0.0.0.0",retention:"Log retention days",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."},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"}},validation:{port:"Enter a port between 1 and 65535",retention:"Retention days must be between 1 and 365",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.",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.",clearAll:"Clear everything",clearingAll:"Clearing…",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 in "System Settings → API Keys" 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\`:
161
+ \`\`\``,"🔑 **设置环境变量**:\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 文件自动加载配置","🗃️ **数据备份**:定期备份 ~/.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:"需要上游 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:"构建时间",node:"Node 版本"},hint:{buildTime:"构建时间以 UTC 表示,便于排查部署版本。"}},status:{title:"运行状态",subtitle:"来自当前网关实例的实时指标。",loading:"正在获取运行状态...",empty:"未能获取状态信息。",labels:{host:"监听地址",port:"监听端口",providers:"已配置 Provider",active:"活动请求"},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:"删除"},created:"创建时间",lastUsed:"最后使用",requestCount:"请求次数",totalTokens:"总令牌数",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 密钥,点击右上角按钮开始创建。"},toast:{keyCreated:"API 密钥创建成功",keyUpdated:"API 密钥已更新",keyDeleted:"API 密钥已删除",keyCopied:"密钥已复制到剪贴板",createFailure:"创建失败:{{message}}",updateFailure:"更新失败:{{message}}",deleteFailure:"删除失败:{{message}}"}}}},en:{translation:{app:{title:"cc-gw Console",skipToContent:"Skip to main content"},nav:{dashboard:"Dashboard",logs:"Logs",models:"Model Management",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",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"}},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.",filters:{endpoint:"Endpoint",endpointAll:"All endpoints",endpointAnthropic:"anthropic",endpointOpenAI:"openai"},status:{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",todayOutput:"Output 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",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"},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.",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",cachedTokens:"Cached Tokens",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",cachedTokens:"Cached Tokens",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.',count:"{{count}} providers configured",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:{defaultModel:"Default model: {{model}}",noDefault:"No default model",modelsTitle:"Supported models",noModels:"No models configured yet."},drawer:{createTitle:"Add Provider",editTitle:"Edit Provider",description:"Configure base settings and model list.",modelsDescription:"Maintain supported models.",defaultHint:"Current default model: {{model}}",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:"Claude Code can authenticate with either an API key (x-api-key) or an auth token (Authorization: Bearer).",authModeApiKey:"Use API Key (x-api-key)",authModeAuthToken:"Use Auth Token (Authorization: Bearer)",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:"Model Management",description:"Configure providers and maintain model routing rules in one place.",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."},actions:{saveRoutes:"Save routes"},routing:{selectTarget:"Select provider:model"},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}}"},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..."},validation:{presetName:"Enter a preset name.",presetDuplicate:"Preset {{name}} already exists."},confirm:{deletePreset:"Delete preset “{{name}}”?"}},settings:{title:"System 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}}",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"},fields:{port:"Listen port",host:"Listen host (optional)",hostPlaceholder:"Defaults to 0.0.0.0",retention:"Log retention days",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"}},validation:{port:"Enter a port between 1 and 65535",retention:"Retention days must be between 1 and 365",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.",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.",clearAll:"Clear everything",clearingAll:"Clearing…",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 in "System Settings → API Keys" 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\`:
162
162
  \`\`\`toml
163
163
  model = "gpt-5-codex"
164
164
  model_provider = "cc_gw"
@@ -170,4 +170,4 @@ name = "cc_gw"
170
170
  base_url = "http://127.0.0.1:4100/openai/v1"
171
171
  wire_api = "responses"
172
172
  env_key = "cc_gw_key"
173
- \`\`\``,"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:["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.","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:"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."}]}},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:"This is the only time you'll see the full key. Save it securely!",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"},created:"Created",lastUsed:"Last Used",requestCount:"Requests",totalTokens:"Total Tokens",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."},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}}"}},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",node:"Node 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"},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."}}}}};de.isInitialized||de.use(ev).init({resources:Gw,lng:"zh",fallbackLng:"en",interpolation:{escapeValue:!1}});const Zh=S.createContext(void 0);function Yw(){return`toast_${Math.random().toString(36).slice(2)}`}function Xw({children:e}){const[t,n]=S.useState([]),r=S.useCallback(o=>{n(a=>a.filter(l=>l.id!==o))},[]),s=S.useCallback(o=>{const a=o.id??Yw();n(u=>[...u,{...o,id:a}]);const l=o.durationMs??3e3;l>0&&setTimeout(()=>r(a),l)},[r]),i=S.useMemo(()=>({toasts:t,pushToast:s,dismissToast:r}),[t,r,s]);return E.jsxs(Zh.Provider,{value:i,children:[e,E.jsx("div",{className:"fixed right-6 top-6 z-50 flex w-80 flex-col gap-3",children:t.map(o=>E.jsx("div",{className:`rounded-md border border-slate-200 bg-white p-4 shadow-lg dark:border-slate-700 dark:bg-slate-800 ${o.variant==="error"?"border-red-200 bg-red-50 text-red-900 dark:border-red-700 dark:bg-red-900/40 dark:text-red-200":o.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:o.title}),o.description?E.jsx("p",{className:"mt-1 text-sm opacity-75",children:o.description}):null]}),E.jsx("button",{type:"button",className:"text-sm text-slate-500 hover:text-slate-900 dark:text-slate-400 dark:hover:text-slate-100",onClick:()=>r(o.id),children:"×"})]})},o.id))})]})}function nk(){const e=S.useContext(Zh);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function Zw({children:e}){const[t]=S.useState(()=>new Ew);return E.jsx(bw,{client:t,children:E.jsx(sv,{i18n:de,children:E.jsx(vv,{children:E.jsx(Xw,{children:E.jsx(Y1,{children:e})})})})})}function em(){const{t:e}=Fs();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:e("common.loading")})]})})}const ex=S.lazy(()=>hn(()=>import("./Dashboard-CJmps0fW.js"),__vite__mapDeps([0,1,2,3,4,5]))),tx=S.lazy(()=>hn(()=>import("./Logs-CyN3g8z0.js"),__vite__mapDeps([6,5,2,7,3,8,4]))),Td=S.lazy(()=>hn(()=>import("./ModelManagement-B11a4hW3.js"),__vite__mapDeps([9,5]))),nx=S.lazy(()=>hn(()=>import("./ApiKeys-Bq84uD5O.js"),__vite__mapDeps([10,1,5,2,7,3,8,4,11]))),rx=S.lazy(()=>hn(()=>import("./Settings-BUNwIquC.js"),__vite__mapDeps([12,5,2,11]))),sx=S.lazy(()=>hn(()=>import("./About-DmfYXdTi.js"),__vite__mapDeps([13,5,2,3,8,14]))),ix=S.lazy(()=>hn(()=>import("./Help-C7fFCpNH.js"),__vite__mapDeps([15,2,14]))),ox=S.lazy(()=>hn(()=>import("./Login-f_-O93Uo.js"),[]));function ax({children:e}){const{authEnabled:t,isAuthenticated:n,loading:r}=Hh(),s=mn();return r?E.jsx(em,{}):!t||n?e:E.jsx(lh,{to:"/login",replace:!0,state:{from:s}})}function lx(){return E.jsx(Zw,{children:E.jsx(Fy,{basename:typeof window<"u"&&window.location.pathname.startsWith("/ui")?"/ui":"/",children:E.jsx(S.Suspense,{fallback:E.jsx(em,{}),children:E.jsxs(by,{children:[E.jsxs(Ke,{path:"/",element:E.jsx(ax,{children:E.jsx(Z1,{})}),children:[E.jsx(Ke,{index:!0,element:E.jsx(ex,{})}),E.jsx(Ke,{path:"logs",element:E.jsx(tx,{})}),E.jsx(Ke,{path:"models",element:E.jsx(Td,{})}),E.jsx(Ke,{path:"providers",element:E.jsx(Td,{})}),E.jsx(Ke,{path:"api-keys",element:E.jsx(nx,{})}),E.jsx(Ke,{path:"settings",element:E.jsx(rx,{})}),E.jsx(Ke,{path:"about",element:E.jsx(sx,{})}),E.jsx(Ke,{path:"help",element:E.jsx(ix,{})})]}),E.jsx(Ke,{path:"/login",element:E.jsx(ox,{})}),E.jsx(Ke,{path:"*",element:E.jsx(lh,{to:"/",replace:!0})})]})})})})}const tm=document.getElementById("root");if(!tm)throw new Error("Root element #root not found");la.createRoot(tm).render(E.jsx(Wd.StrictMode,{children:E.jsx(lx,{})}));export{tk as $,kx as A,av as B,Sx as C,im as D,Px as E,uv as F,Ex as G,pv as H,Eo as I,pw as J,cv as K,em as L,ow as M,Xx as N,pl as O,tt as P,bo as Q,Wd as R,gv as S,sw as T,iw as U,fl as V,Vh as W,ww as X,uw as Y,Pe as Z,ek as _,nk as a,Zx as a0,vx as a1,dx as a2,hx as a3,px as a4,sh as a5,mn as a6,Hh as a7,qn as b,Be as c,Lt as d,Ix as e,Ox as f,wx as g,Nx as h,Cx as i,E as j,yh as k,Lx as l,mx as m,Ax as n,Tx as o,bx as p,A0 as q,S as r,xx as s,ia as t,Fs as u,cx as v,fx as w,gx as x,Rx as y,yx as z};
173
+ \`\`\``,"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:["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.","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:"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."}]}},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:"This is the only time you'll see the full key. Save it securely!",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"},created:"Created",lastUsed:"Last Used",requestCount:"Requests",totalTokens:"Total Tokens",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."},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}}"}},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",node:"Node 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"},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."}}}}};de.isInitialized||de.use(ev).init({resources:Gw,lng:"zh",fallbackLng:"en",interpolation:{escapeValue:!1}});const Zh=S.createContext(void 0);function Yw(){return`toast_${Math.random().toString(36).slice(2)}`}function Xw({children:e}){const[t,n]=S.useState([]),r=S.useCallback(o=>{n(a=>a.filter(l=>l.id!==o))},[]),s=S.useCallback(o=>{const a=o.id??Yw();n(u=>[...u,{...o,id:a}]);const l=o.durationMs??3e3;l>0&&setTimeout(()=>r(a),l)},[r]),i=S.useMemo(()=>({toasts:t,pushToast:s,dismissToast:r}),[t,r,s]);return E.jsxs(Zh.Provider,{value:i,children:[e,E.jsx("div",{className:"fixed right-6 top-6 z-50 flex w-80 flex-col gap-3",children:t.map(o=>E.jsx("div",{className:`rounded-md border border-slate-200 bg-white p-4 shadow-lg dark:border-slate-700 dark:bg-slate-800 ${o.variant==="error"?"border-red-200 bg-red-50 text-red-900 dark:border-red-700 dark:bg-red-900/40 dark:text-red-200":o.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:o.title}),o.description?E.jsx("p",{className:"mt-1 text-sm opacity-75",children:o.description}):null]}),E.jsx("button",{type:"button",className:"text-sm text-slate-500 hover:text-slate-900 dark:text-slate-400 dark:hover:text-slate-100",onClick:()=>r(o.id),children:"×"})]})},o.id))})]})}function nk(){const e=S.useContext(Zh);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function Zw({children:e}){const[t]=S.useState(()=>new Ew);return E.jsx(bw,{client:t,children:E.jsx(sv,{i18n:de,children:E.jsx(vv,{children:E.jsx(Xw,{children:E.jsx(Y1,{children:e})})})})})}function em(){const{t:e}=Fs();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:e("common.loading")})]})})}const ex=S.lazy(()=>hn(()=>import("./Dashboard-MoDWKsK7.js"),__vite__mapDeps([0,1,2,3,4,5]))),tx=S.lazy(()=>hn(()=>import("./Logs-u8JddAMA.js"),__vite__mapDeps([6,5,2,7,3,8,4]))),Td=S.lazy(()=>hn(()=>import("./ModelManagement-B5GXkgZG.js"),__vite__mapDeps([9,5]))),nx=S.lazy(()=>hn(()=>import("./ApiKeys-C0HThTh3.js"),__vite__mapDeps([10,1,5,2,7,3,8,4,11]))),rx=S.lazy(()=>hn(()=>import("./Settings-B7l_r0Os.js"),__vite__mapDeps([12,5,2,11]))),sx=S.lazy(()=>hn(()=>import("./About-AtNnIQdC.js"),__vite__mapDeps([13,5,2,3,8,14]))),ix=S.lazy(()=>hn(()=>import("./Help-_WE0-0d_.js"),__vite__mapDeps([15,2,14]))),ox=S.lazy(()=>hn(()=>import("./Login-fnBtj3Wf.js"),[]));function ax({children:e}){const{authEnabled:t,isAuthenticated:n,loading:r}=Hh(),s=mn();return r?E.jsx(em,{}):!t||n?e:E.jsx(lh,{to:"/login",replace:!0,state:{from:s}})}function lx(){return E.jsx(Zw,{children:E.jsx(Fy,{basename:typeof window<"u"&&window.location.pathname.startsWith("/ui")?"/ui":"/",children:E.jsx(S.Suspense,{fallback:E.jsx(em,{}),children:E.jsxs(by,{children:[E.jsxs(Ke,{path:"/",element:E.jsx(ax,{children:E.jsx(Z1,{})}),children:[E.jsx(Ke,{index:!0,element:E.jsx(ex,{})}),E.jsx(Ke,{path:"logs",element:E.jsx(tx,{})}),E.jsx(Ke,{path:"models",element:E.jsx(Td,{})}),E.jsx(Ke,{path:"providers",element:E.jsx(Td,{})}),E.jsx(Ke,{path:"api-keys",element:E.jsx(nx,{})}),E.jsx(Ke,{path:"settings",element:E.jsx(rx,{})}),E.jsx(Ke,{path:"about",element:E.jsx(sx,{})}),E.jsx(Ke,{path:"help",element:E.jsx(ix,{})})]}),E.jsx(Ke,{path:"/login",element:E.jsx(ox,{})}),E.jsx(Ke,{path:"*",element:E.jsx(lh,{to:"/",replace:!0})})]})})})})}const tm=document.getElementById("root");if(!tm)throw new Error("Root element #root not found");la.createRoot(tm).render(E.jsx(Wd.StrictMode,{children:E.jsx(lx,{})}));export{tk as $,kx as A,av as B,Sx as C,im as D,Px as E,uv as F,Ex as G,pv as H,Eo as I,pw as J,cv as K,em as L,ow as M,Xx as N,pl as O,tt as P,bo as Q,Wd as R,gv as S,sw as T,iw as U,fl as V,Vh as W,ww as X,uw as Y,Pe as Z,ek as _,nk as a,Zx as a0,vx as a1,dx as a2,hx as a3,px as a4,sh as a5,mn as a6,Hh as a7,qn as b,Be as c,Lt as d,Ix as e,Ox as f,wx as g,Nx as h,Cx as i,E as j,yh as k,Lx as l,mx as m,Ax as n,Tx as o,bx as p,A0 as q,S as r,xx as s,ia as t,Fs as u,cx as v,fx as w,gx as x,Rx as y,yx as z};