@chenpu17/cc-gw 0.7.20 → 0.7.21

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 (29) hide show
  1. package/package.json +1 -1
  2. package/src/server/dist/index.js +42 -27
  3. package/src/web/dist/assets/{About-CE2fqYju.js → About-Bjq70P_K.js} +2 -2
  4. package/src/web/dist/assets/{ApiKeys-jnqKcfat.js → ApiKeys-BHwlIBRG.js} +1 -1
  5. package/src/web/dist/assets/{Dashboard-B61eM9AQ.js → Dashboard-Bv6E5M2u.js} +1 -1
  6. package/src/web/dist/assets/{Events-DXUNZen5.js → Events-DyqUKr1b.js} +1 -1
  7. package/src/web/dist/assets/{Help-DTQVUeCR.js → Help-BNn_Zuo4.js} +1 -1
  8. package/src/web/dist/assets/{Login-BcTP1zb_.js → Login-BHXuuVq3.js} +1 -1
  9. package/src/web/dist/assets/Logs-CRnJOy2J.js +6 -0
  10. package/src/web/dist/assets/{ModelManagement-D2ZQEDua.js → ModelManagement-DAE8AYAE.js} +1 -1
  11. package/src/web/dist/assets/{PageHeader-D2Zq1K4t.js → PageHeader-D2u2opjK.js} +1 -1
  12. package/src/web/dist/assets/{PageSection-wWtyIp2D.js → PageSection-jfq2rgUu.js} +1 -1
  13. package/src/web/dist/assets/Settings-CssUPWdg.js +6 -0
  14. package/src/web/dist/assets/{Skeleton-BRSmcxNh.js → Skeleton-BwMNCVcg.js} +1 -1
  15. package/src/web/dist/assets/{card-Dl49soGw.js → card-C9wVDhpJ.js} +1 -1
  16. package/src/web/dist/assets/{dialog-CW6Z62O9.js → dialog-DbEoPxgf.js} +1 -1
  17. package/src/web/dist/assets/{index-Cu1IXjrr.js → index-BjqieXJo.js} +1 -1
  18. package/src/web/dist/assets/{index-Bdp0nMlR.js → index-Blclkvp7.js} +4 -4
  19. package/src/web/dist/assets/{info-Yuz8DmBH.js → info-BmVX8zJd.js} +1 -1
  20. package/src/web/dist/assets/{input-B6w5gzdL.js → input-CGgq_gCJ.js} +1 -1
  21. package/src/web/dist/assets/{label-CuU6RIsU.js → label-BGUvZ4t2.js} +1 -1
  22. package/src/web/dist/assets/{refresh-cw-Duv0QKyb.js → refresh-cw-D7rJxbFV.js} +1 -1
  23. package/src/web/dist/assets/{select-Cfzsn-JK.js → select-Chuh7X1A.js} +1 -1
  24. package/src/web/dist/assets/{shield--mDWO-No.js → shield-Beuqdf31.js} +1 -1
  25. package/src/web/dist/assets/{switch-DoT-Ur3p.js → switch-XbPwmM_b.js} +1 -1
  26. package/src/web/dist/assets/{useApiQuery-CL9_n4sn.js → useApiQuery-DiX6xcfY.js} +1 -1
  27. package/src/web/dist/index.html +1 -1
  28. package/src/web/dist/assets/Logs-Cy6rL2PL.js +0 -6
  29. package/src/web/dist/assets/Settings-Bz_Hag2N.js +0 -6
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-B61eM9AQ.js","assets/index-Cu1IXjrr.js","assets/Skeleton-BRSmcxNh.js","assets/PageHeader-D2Zq1K4t.js","assets/PageSection-wWtyIp2D.js","assets/card-Dl49soGw.js","assets/useApiQuery-CL9_n4sn.js","assets/select-Cfzsn-JK.js","assets/Logs-Cy6rL2PL.js","assets/clipboard-CALi6bTW.js","assets/input-B6w5gzdL.js","assets/label-CuU6RIsU.js","assets/refresh-cw-Duv0QKyb.js","assets/Events-DXUNZen5.js","assets/ModelManagement-D2ZQEDua.js","assets/switch-DoT-Ur3p.js","assets/dialog-CW6Z62O9.js","assets/ApiKeys-jnqKcfat.js","assets/shield--mDWO-No.js","assets/Settings-Bz_Hag2N.js","assets/About-CE2fqYju.js","assets/info-Yuz8DmBH.js","assets/Help-DTQVUeCR.js","assets/Login-BcTP1zb_.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-Bv6E5M2u.js","assets/index-BjqieXJo.js","assets/Skeleton-BwMNCVcg.js","assets/PageHeader-D2u2opjK.js","assets/PageSection-jfq2rgUu.js","assets/card-C9wVDhpJ.js","assets/useApiQuery-DiX6xcfY.js","assets/select-Chuh7X1A.js","assets/Logs-CRnJOy2J.js","assets/clipboard-CALi6bTW.js","assets/input-CGgq_gCJ.js","assets/label-BGUvZ4t2.js","assets/refresh-cw-D7rJxbFV.js","assets/Events-DyqUKr1b.js","assets/ModelManagement-DAE8AYAE.js","assets/switch-XbPwmM_b.js","assets/dialog-DbEoPxgf.js","assets/ApiKeys-BHwlIBRG.js","assets/shield-Beuqdf31.js","assets/Settings-CssUPWdg.js","assets/About-Bjq70P_K.js","assets/info-BmVX8zJd.js","assets/Help-BNn_Zuo4.js","assets/Login-BHXuuVq3.js"])))=>i.map(i=>d[i]);
2
2
  var z0=Object.defineProperty;var sf=e=>{throw TypeError(e)};var $0=(e,t,n)=>t in e?z0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var af=(e,t,n)=>$0(e,typeof t!="symbol"?t+"":t,n),Sl=(e,t,n)=>t.has(e)||sf("Cannot "+n);var A=(e,t,n)=>(Sl(e,t,"read from private field"),n?n.call(e):t.get(e)),Z=(e,t,n)=>t.has(e)?sf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),B=(e,t,n,r)=>(Sl(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Ie=(e,t,n)=>(Sl(e,t,"access private method"),n);var ei=(e,t,n,r)=>({set _(o){B(e,t,o,n)},get _(){return A(e,t,r)}});function B0(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:()=>r[o]})}}}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 o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function nm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rm={exports:{}},_a={},om={exports:{}},X={};/**
3
3
  * @license React
4
4
  * react.production.min.js
@@ -218,7 +218,7 @@ PERFORMANCE OF THIS SOFTWARE.
218
218
  `)}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(o=>r.set(o)),r}static accessor(t){const r=(this[mh]=this[mh]={accessors:{}}).accessors,o=this.prototype;function s(i){const a=Ko(i);r[a]||(QA(o,i),r[a]=!0)}return T.isArray(t)?t.forEach(s):s(t),this}};Ze.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);T.reduceDescriptors(Ze.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});T.freezeMethods(Ze);function lu(e,t){const n=this||Js,r=t||n,o=Ze.from(r.headers);let s=r.data;return T.forEach(e,function(a){s=a.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function f0(e){return!!(e&&e.__CANCEL__)}function Mo(e,t,n){V.call(this,e??"canceled",V.ERR_CANCELED,t,n),this.name="CanceledError"}T.inherits(Mo,V,{__CANCEL__:!0});function p0(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new V("Request failed with status code "+n.status,[V.ERR_BAD_REQUEST,V.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function YA(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function XA(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,s=0,i;return t=t!==void 0?t:1e3,function(l){const u=Date.now(),c=r[s];i||(i=u),n[o]=l,r[o]=u;let d=s,f=0;for(;d!==o;)f+=n[d++],d=d%e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),u-i<t)return;const v=c&&u-c;return v?Math.round(f*1e3/v):void 0}}function JA(e,t){let n=0,r=1e3/t,o,s;const i=(u,c=Date.now())=>{n=c,o=null,s&&(clearTimeout(s),s=null),e(...u)};return[(...u)=>{const c=Date.now(),d=c-n;d>=r?i(u,c):(o=u,s||(s=setTimeout(()=>{s=null,i(o)},r-d)))},()=>o&&i(o)]}const Aa=(e,t,n=3)=>{let r=0;const o=XA(50,250);return JA(s=>{const i=s.loaded,a=s.lengthComputable?s.total:void 0,l=i-r,u=o(l),c=i<=a;r=i;const d={loaded:i,total:a,progress:a?i/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a&&c?(a-i)/u:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},n)},gh=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},yh=e=>(...t)=>T.asap(()=>e(...t)),ZA=Fe.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Fe.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Fe.origin),Fe.navigator&&/(msie|trident)/i.test(Fe.navigator.userAgent)):()=>!0,eO=Fe.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];T.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),T.isString(r)&&i.push("path="+r),T.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.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 tO(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function nO(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function h0(e,t,n){let r=!tO(t);return e&&(r||n==!1)?nO(e,t):t}const vh=e=>e instanceof Ze?{...e}:e;function Sr(e,t){t=t||{};const n={};function r(u,c,d,f){return T.isPlainObject(u)&&T.isPlainObject(c)?T.merge.call({caseless:f},u,c):T.isPlainObject(c)?T.merge({},c):T.isArray(c)?c.slice():c}function o(u,c,d,f){if(T.isUndefined(c)){if(!T.isUndefined(u))return r(void 0,u,d,f)}else return r(u,c,d,f)}function s(u,c){if(!T.isUndefined(c))return r(void 0,c)}function i(u,c){if(T.isUndefined(c)){if(!T.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:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,c,d)=>o(vh(u),vh(c),d,!0)};return T.forEach(Object.keys({...e,...t}),function(c){const d=l[c]||o,f=d(e[c],t[c],c);T.isUndefined(f)&&d!==a||(n[c]=f)}),n}const m0=e=>{const t=Sr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:a}=t;if(t.headers=i=Ze.from(i),t.url=u0(h0(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),T.isFormData(n)){if(Fe.hasStandardBrowserEnv||Fe.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(T.isFunction(n.getHeaders)){const l=n.getHeaders(),u=["content-type","content-length"];Object.entries(l).forEach(([c,d])=>{u.includes(c.toLowerCase())&&i.set(c,d)})}}if(Fe.hasStandardBrowserEnv&&(r&&T.isFunction(r)&&(r=r(t)),r||r!==!1&&ZA(t.url))){const l=o&&s&&eO.read(s);l&&i.set(o,l)}return t},rO=typeof XMLHttpRequest<"u",oO=rO&&function(e){return new Promise(function(n,r){const o=m0(e);let s=o.data;const i=Ze.from(o.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:u}=o,c,d,f,v,g;function m(){v&&v(),g&&g(),o.cancelToken&&o.cancelToken.unsubscribe(c),o.signal&&o.signal.removeEventListener("abort",c)}let x=new XMLHttpRequest;x.open(o.method.toUpperCase(),o.url,!0),x.timeout=o.timeout;function y(){if(!x)return;const w=Ze.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),b={data:!a||a==="text"||a==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:w,config:e,request:x};p0(function(E){n(E),m()},function(E){r(E),m()},b),x=null}"onloadend"in x?x.onloadend=y:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(y)},x.onabort=function(){x&&(r(new V("Request aborted",V.ECONNABORTED,e,x)),x=null)},x.onerror=function(S){const b=S&&S.message?S.message:"Network Error",P=new V(b,V.ERR_NETWORK,e,x);P.event=S||null,r(P),x=null},x.ontimeout=function(){let S=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const b=o.transitional||c0;o.timeoutErrorMessage&&(S=o.timeoutErrorMessage),r(new V(S,b.clarifyTimeoutError?V.ETIMEDOUT:V.ECONNABORTED,e,x)),x=null},s===void 0&&i.setContentType(null),"setRequestHeader"in x&&T.forEach(i.toJSON(),function(S,b){x.setRequestHeader(b,S)}),T.isUndefined(o.withCredentials)||(x.withCredentials=!!o.withCredentials),a&&a!=="json"&&(x.responseType=o.responseType),u&&([f,g]=Aa(u,!0),x.addEventListener("progress",f)),l&&x.upload&&([d,v]=Aa(l),x.upload.addEventListener("progress",d),x.upload.addEventListener("loadend",v)),(o.cancelToken||o.signal)&&(c=w=>{x&&(r(!w||w.type?new Mo(null,e,x):w),x.abort(),x=null)},o.cancelToken&&o.cancelToken.subscribe(c),o.signal&&(o.signal.aborted?c():o.signal.addEventListener("abort",c)));const h=YA(o.url);if(h&&Fe.protocols.indexOf(h)===-1){r(new V("Unsupported protocol "+h+":",V.ERR_BAD_REQUEST,e));return}x.send(s||null)})},sO=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,o;const s=function(u){if(!o){o=!0,a();const c=u instanceof Error?u:this.reason;r.abort(c instanceof V?c:new Mo(c instanceof Error?c.message:c))}};let i=t&&setTimeout(()=>{i=null,s(new V(`timeout ${t} of ms exceeded`,V.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>T.asap(a),l}},iO=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,o;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},aO=async function*(e,t){for await(const n of lO(e))yield*iO(n,t)},lO=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()}},wh=(e,t,n,r)=>{const o=aO(e,t);let s=0,i,a=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:c}=await o.next();if(u){a(),l.close();return}let d=c.byteLength;if(n){let f=s+=d;n(f)}l.enqueue(new Uint8Array(c))}catch(u){throw a(u),u}},cancel(l){return a(l),o.return()}},{highWaterMark:2})},xh=64*1024,{isFunction:Pi}=T,uO=(({Request:e,Response:t})=>({Request:e,Response:t}))(T.global),{ReadableStream:Sh,TextEncoder:Ch}=T.global,bh=(e,...t)=>{try{return!!e(...t)}catch{return!1}},cO=e=>{e=T.merge.call({skipUndefined:!0},uO,e);const{fetch:t,Request:n,Response:r}=e,o=t?Pi(t):typeof fetch=="function",s=Pi(n),i=Pi(r);if(!o)return!1;const a=o&&Pi(Sh),l=o&&(typeof Ch=="function"?(g=>m=>g.encode(m))(new Ch):async g=>new Uint8Array(await new n(g).arrayBuffer())),u=s&&a&&bh(()=>{let g=!1;const m=new n(Fe.origin,{body:new Sh,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return g&&!m}),c=i&&a&&bh(()=>T.isReadableStream(new r("").body)),d={stream:c&&(g=>g.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!d[g]&&(d[g]=(m,x)=>{let y=m&&m[g];if(y)return y.call(m);throw new V(`Response type '${g}' is not supported`,V.ERR_NOT_SUPPORT,x)})});const f=async g=>{if(g==null)return 0;if(T.isBlob(g))return g.size;if(T.isSpecCompliantForm(g))return(await new n(Fe.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if(T.isArrayBufferView(g)||T.isArrayBuffer(g))return g.byteLength;if(T.isURLSearchParams(g)&&(g=g+""),T.isString(g))return(await l(g)).byteLength},v=async(g,m)=>{const x=T.toFiniteNumber(g.getContentLength());return x??f(m)};return async g=>{let{url:m,method:x,data:y,signal:h,cancelToken:w,timeout:S,onDownloadProgress:b,onUploadProgress:P,responseType:E,headers:R,withCredentials:I="same-origin",fetchOptions:N}=m0(g),j=t||fetch;E=E?(E+"").toLowerCase():"text";let K=sO([h,w&&w.toAbortSignal()],S),W=null;const $=K&&K.unsubscribe&&(()=>{K.unsubscribe()});let J;try{if(P&&u&&x!=="get"&&x!=="head"&&(J=await v(R,y))!==0){let z=new n(m,{method:"POST",body:y,duplex:"half"}),q;if(T.isFormData(y)&&(q=z.headers.get("content-type"))&&R.setContentType(q),z.body){const[re,ne]=gh(J,Aa(yh(P)));y=wh(z.body,xh,re,ne)}}T.isString(I)||(I=I?"include":"omit");const U=s&&"credentials"in n.prototype,Q={...N,signal:K,method:x.toUpperCase(),headers:R.normalize().toJSON(),body:y,duplex:"half",credentials:U?I:void 0};W=s&&new n(m,Q);let k=await(s?j(W,N):j(m,Q));const O=c&&(E==="stream"||E==="response");if(c&&(b||O&&$)){const z={};["status","statusText","headers"].forEach(Le=>{z[Le]=k[Le]});const q=T.toFiniteNumber(k.headers.get("content-length")),[re,ne]=b&&gh(q,Aa(yh(b),!0))||[];k=new r(wh(k.body,xh,re,()=>{ne&&ne(),$&&$()}),z)}E=E||"text";let M=await d[T.findKey(d,E)||"text"](k,g);return!O&&$&&$(),await new Promise((z,q)=>{p0(z,q,{data:M,headers:Ze.from(k.headers),status:k.status,statusText:k.statusText,config:g,request:W})})}catch(U){throw $&&$(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new V("Network Error",V.ERR_NETWORK,g,W),{cause:U.cause||U}):V.from(U,U&&U.code,g,W)}}},dO=new Map,g0=e=>{let t=e?e.env:{};const{fetch:n,Request:r,Response:o}=t,s=[r,o,n];let i=s.length,a=i,l,u,c=dO;for(;a--;)l=s[a],u=c.get(l),u===void 0&&c.set(l,u=a?new Map:cO(t)),c=u;return u};g0();const Pc={http:TA,xhr:oO,fetch:{get:g0}};T.forEach(Pc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Eh=e=>`- ${e}`,fO=e=>T.isFunction(e)||e===null||e===!1,y0={getAdapter:(e,t)=>{e=T.isArray(e)?e:[e];const{length:n}=e;let r,o;const s={};for(let i=0;i<n;i++){r=e[i];let a;if(o=r,!fO(r)&&(o=Pc[(a=String(r)).toLowerCase()],o===void 0))throw new V(`Unknown adapter '${a}'`);if(o&&(T.isFunction(o)||(o=o.get(t))))break;s[a||"#"+i]=o}if(!o){const i=Object.entries(s).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=n?i.length>1?`since :
219
219
  `+i.map(Eh).join(`
220
220
  `):" "+Eh(i[0]):"as no adapter specified";throw new V("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return o},adapters:Pc};function uu(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Mo(null,e)}function kh(e){return uu(e),e.headers=Ze.from(e.headers),e.data=lu.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),y0.getAdapter(e.adapter||Js.adapter,e)(e).then(function(r){return uu(e),r.data=lu.call(e,e.transformResponse,r),r.headers=Ze.from(r.headers),r},function(r){return f0(r)||(uu(e),r&&r.response&&(r.response.data=lu.call(e,e.transformResponse,r.response),r.response.headers=Ze.from(r.response.headers))),Promise.reject(r)})}const v0="1.12.2",yl={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{yl[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ph={};yl.transitional=function(t,n,r){function o(s,i){return"[Axios v"+v0+"] Transitional option '"+s+"'"+i+(r?". "+r:"")}return(s,i,a)=>{if(t===!1)throw new V(o(i," has been removed"+(n?" in "+n:"")),V.ERR_DEPRECATED);return n&&!Ph[i]&&(Ph[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,i,a):!0}};yl.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function pO(e,t,n){if(typeof e!="object")throw new V("options must be an object",V.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const a=e[s],l=a===void 0||i(a,s,e);if(l!==!0)throw new V("option "+s+" must be "+l,V.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new V("Unknown option "+s,V.ERR_BAD_OPTION)}}const Wi={assertOptions:pO,validators:yl},Mt=Wi.validators;let hr=class{constructor(t){this.defaults=t||{},this.interceptors={request:new hh,response:new hh}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const s=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
221
- `+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Sr(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&Wi.assertOptions(r,{silentJSONParsing:Mt.transitional(Mt.boolean),forcedJSONParsing:Mt.transitional(Mt.boolean),clarifyTimeoutError:Mt.transitional(Mt.boolean)},!1),o!=null&&(T.isFunction(o)?n.paramsSerializer={serialize:o}:Wi.assertOptions(o,{encode:Mt.function,serialize:Mt.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Wi.assertOptions(n,{baseUrl:Mt.spelling("baseURL"),withXsrfToken:Mt.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&T.merge(s.common,s[n.method]);s&&T.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),n.headers=Ze.concat(i,s);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let c,d=0,f;if(!l){const g=[kh.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 v=n;for(;d<f;){const g=a[d++],m=a[d++];try{v=g(v)}catch(x){m.call(this,x);break}}try{c=kh.call(this,v)}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=Sr(this.defaults,t);const n=h0(t.baseURL,t.url,t.allowAbsoluteUrls);return u0(n,t.params,t.paramsSerializer)}};T.forEach(["delete","get","head","options"],function(t){hr.prototype[t]=function(n,r){return this.request(Sr(r||{},{method:t,url:n,data:(r||{}).data}))}});T.forEach(["post","put","patch"],function(t){function n(r){return function(s,i,a){return this.request(Sr(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}hr.prototype[t]=n(),hr.prototype[t+"Form"]=n(!0)});let hO=class w0{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{r.subscribe(a),s=a}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s,i,a){r.reason||(r.reason=new Mo(s,i,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 w0(function(o){t=o}),cancel:t}}};function mO(e){return function(n){return e.apply(null,n)}}function gO(e){return T.isObject(e)&&e.isAxiosError===!0}const Rc={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(Rc).forEach(([e,t])=>{Rc[t]=e});function x0(e){const t=new hr(e),n=Xw(hr.prototype.request,t);return T.extend(n,hr.prototype,t,{allOwnKeys:!0}),T.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return x0(Sr(e,o))},n}const me=x0(Js);me.Axios=hr;me.CanceledError=Mo;me.CancelToken=hO;me.isCancel=f0;me.VERSION=v0;me.toFormData=gl;me.AxiosError=V;me.Cancel=me.CanceledError;me.all=function(t){return Promise.all(t)};me.spread=mO;me.isAxiosError=gO;me.mergeConfig=Sr;me.AxiosHeaders=Ze;me.formToJSON=e=>d0(T.isHTMLForm(e)?new FormData(e):e);me.getAdapter=y0.getAdapter;me.HttpStatusCode=Rc;me.default=me;const{Axios:D2,AxiosError:F2,CanceledError:j2,isCancel:U2,CancelToken:z2,VERSION:$2,all:B2,Cancel:H2,isAxiosError:V2,spread:K2,toFormData:W2,AxiosHeaders:q2,HttpStatusCode:G2,formToJSON:Q2,getAdapter:Y2,mergeConfig:X2}=me,kt=me.create({baseURL:"/",timeout:15e3,withCredentials:!0});kt.interceptors.response.use(e=>e,e=>Promise.reject(e));function cu(e){var t,n,r;if(me.isAxiosError(e)){const o=(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:o,code:String(o??"unknown")}}return{message:e instanceof Error?e.message:"请求失败,请稍后再试"}}const J2={list:async()=>(await kt.get("/api/custom-endpoints")).data,create:async e=>(await kt.post("/api/custom-endpoints",e)).data,update:async(e,t)=>(await kt.put(`/api/custom-endpoints/${e}`,t)).data,delete:async e=>(await kt.delete(`/api/custom-endpoints/${e}`)).data},Z2={list:async e=>(await kt.get("/api/events",{params:{limit:e==null?void 0:e.limit,cursor:e==null?void 0:e.cursor,level:e==null?void 0:e.level,type:e==null?void 0:e.type}})).data},S0=p.createContext(void 0);function yO({children:e}){const t=p.useRef(!0),[n,r]=p.useState({loading:!0,authEnabled:!1,isAuthenticated:!0,username:void 0,error:null}),o=p.useCallback(u=>{t.current&&r(u)},[]),s=p.useCallback(async()=>{o(u=>({...u,loading:!0,error:null}));try{const{data:u}=await kt.get("/auth/session");o(()=>({loading:!1,authEnabled:!!u.authEnabled,isAuthenticated:!u.authEnabled||!!u.authenticated,username:u.username??void 0,error:null}))}catch(u){const c=cu(u);o(()=>({loading:!1,authEnabled:!1,isAuthenticated:!0,username:void 0,error:c.message}))}},[o]),i=p.useCallback(async(u,c)=>{o(d=>({...d,loading:!0,error:null}));try{await kt.post("/auth/login",{username:u,password:c}),await s()}catch(d){const f=cu(d);throw o(v=>({...v,loading:!1,error:f.message,isAuthenticated:!1})),f}},[s,o]),a=p.useCallback(async()=>{o(u=>({...u,loading:!0}));try{await kt.post("/auth/logout")}catch(u){const c=cu(u);o(d=>({...d,error:c.message}))}finally{await s()}},[s,o]);p.useEffect(()=>{t.current=!0,s();const u=kt.interceptors.response.use(c=>c,async c=>{var d;return((d=c==null?void 0:c.response)==null?void 0:d.status)===401&&await s(),Promise.reject(c)});return()=>{t.current=!1,kt.interceptors.response.eject(u)}},[s]);const l=p.useMemo(()=>({...n,refresh:s,login:i,logout:a}),[n,s,i,a]);return C.jsx(S0.Provider,{value:l,children:e})}function C0(){const e=p.useContext(S0);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const b0=[{to:"/",icon:HC,labelKey:"nav.dashboard"},{to:"/logs",icon:GC,labelKey:"nav.logs"},{to:"/models",icon:XC,labelKey:"nav.models"},{to:"/events",icon:BC,labelKey:"nav.events"},{to:"/api-keys",icon:QC,labelKey:"nav.apiKeys"},{to:"/settings",icon:tb,labelKey:"nav.settings"},{to:"/help",icon:JC,labelKey:"nav.help"},{to:"/about",icon:qC,labelKey:"nav.about"}];function Rh({onNavigate:e}){const{t}=Er();return C.jsx("nav",{className:"flex h-full flex-col gap-1","aria-label":t("app.title"),children:b0.map(n=>{const r=n.icon;return C.jsx(Ty,{to:n.to,onClick:e,className:({isActive:o})=>et("group relative flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200",o?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-muted hover:text-foreground"),end:n.to==="/",title:t(n.labelKey),children:({isActive:o})=>C.jsxs(C.Fragment,{children:[o&&C.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-1 h-6 rounded-r-full bg-primary"}),C.jsx(r,{className:et("h-4 w-4 transition-colors",o?"text-primary":""),"aria-hidden":"true"}),C.jsx("span",{children:t(n.labelKey)})]})},n.to)})})}function vO({onNavigate:e}){const{t}=Er();return C.jsx(zT,{delayDuration:0,children:C.jsx("nav",{className:"flex h-full flex-col gap-1","aria-label":t("app.title"),children:b0.map(n=>{const r=n.icon;return C.jsxs($T,{children:[C.jsx(BT,{asChild:!0,children:C.jsx(Ty,{to:n.to,onClick:e,className:({isActive:o})=>et("group relative flex items-center justify-center rounded-lg p-2.5 transition-all duration-200",o?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-muted hover:text-foreground"),end:n.to==="/",children:({isActive:o})=>C.jsxs(C.Fragment,{children:[o&&C.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-1 h-5 rounded-r-full bg-primary"}),C.jsx(r,{className:et("h-5 w-5",o?"text-primary":""),"aria-hidden":"true"})]})})}),C.jsx(Yw,{side:"right",children:t(n.labelKey)})]},n.to)})})})}function wO(){const{t:e}=Er(),t=Yn(),[n,r]=p.useState(!1),{authEnabled:o,username:s,logout:i}=C0(),[a,l]=p.useState(!1);p.useEffect(()=>{r(!1)},[t.pathname]);const u=async()=>{if(!a){l(!0);try{await i()}finally{l(!1)}}};return C.jsxs("div",{className:"relative flex min-h-screen bg-background",children:[C.jsx("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:m-4 focus:rounded-md focus:bg-primary focus:px-4 focus:py-2 focus:text-primary-foreground",children:e("app.skipToContent")}),C.jsxs("aside",{className:"hidden w-16 flex-col border-r bg-card lg:flex xl:hidden",children:[C.jsx("div",{className:"flex h-14 items-center justify-center border-b",children:C.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-primary to-primary/80 text-xs font-bold text-primary-foreground shadow-sm",children:"GW"})}),C.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:C.jsx(vO,{})})]}),C.jsxs("aside",{className:"hidden w-56 flex-col border-r bg-card xl:flex",children:[C.jsxs("div",{className:"flex h-14 items-center gap-3 border-b px-4",children:[C.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-primary to-primary/80 text-xs font-bold text-primary-foreground shadow-sm",children:"GW"}),C.jsx("span",{className:"font-semibold text-foreground",children:e("app.title")})]}),C.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:C.jsx(Rh,{})})]}),C.jsxs("div",{className:"flex flex-1 flex-col",children:[C.jsxs("header",{className:"sticky top-0 z-30 flex h-14 items-center justify-between gap-4 border-b bg-card px-4 lg:px-6",children:[C.jsxs("div",{className:"flex items-center gap-3 lg:hidden",children:[C.jsx(eo,{variant:"ghost",size:"icon",onClick:()=>r(c=>!c),"aria-label":e(n?"common.actions.closeNavigation":"common.actions.openNavigation"),"aria-expanded":n,"aria-controls":"mobile-nav",children:n?C.jsx(Tp,{className:"h-5 w-5"}):C.jsx(ZC,{className:"h-5 w-5"})}),C.jsx("span",{className:"font-semibold",children:e("app.title")})]}),C.jsx("div",{className:"hidden lg:block"}),C.jsxs("div",{className:"flex items-center gap-2",children:[o&&s&&C.jsx("span",{className:"hidden text-sm text-muted-foreground sm:inline",children:e("login.status",{username:s})}),o&&C.jsx(eo,{variant:"ghost",size:"sm",onClick:()=>void u(),disabled:a,children:e(a?"common.actions.loading":"common.actions.logout")}),C.jsx(gT,{}),C.jsx(mT,{})]})]}),C.jsx("main",{id:"main-content",role:"main",tabIndex:-1,className:"flex-1 overflow-y-auto",children:C.jsx("div",{className:"container mx-auto max-w-7xl px-4 py-6 lg:px-8 lg:py-8 animate-in fade-in slide-in-from-bottom-4 duration-300",children:C.jsx(iC,{})})})]}),n&&C.jsxs("div",{className:"fixed inset-0 z-40 lg:hidden",role:"dialog","aria-modal":"true",children:[C.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm",onClick:()=>r(!1)}),C.jsxs("div",{id:"mobile-nav",className:"fixed inset-y-0 left-0 w-72 border-r bg-card p-6 shadow-lg animate-in slide-in-from-left",children:[C.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[C.jsx("span",{className:"font-semibold",children:e("app.title")}),C.jsx(eo,{variant:"ghost",size:"icon",onClick:()=>r(!1),"aria-label":e("common.actions.closeNavigation"),children:C.jsx(Tp,{className:"h-5 w-5"})})]}),C.jsx(Rh,{onNavigate:()=>r(!1)})]})]})]})}var vl=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(){}},xO={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},En,Ic,qh,SO=(qh=class{constructor(){Z(this,En,xO);Z(this,Ic,!1)}setTimeoutProvider(e){B(this,En,e)}setTimeout(e,t){return A(this,En).setTimeout(e,t)}clearTimeout(e){A(this,En).clearTimeout(e)}setInterval(e,t){return A(this,En).setInterval(e,t)}clearInterval(e){A(this,En).clearInterval(e)}},En=new WeakMap,Ic=new WeakMap,qh),Tc=new SO;function CO(e){setTimeout(e,0)}var wl=typeof window>"u"||"Deno"in globalThis;function xt(){}function bO(e,t){return typeof e=="function"?e(t):e}function EO(e){return typeof e=="number"&&e>=0&&e!==1/0}function kO(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ac(e,t){return typeof e=="function"?e(t):e}function PO(e,t){return typeof e=="function"?e(t):e}function Th(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:s,queryKey:i,stale:a}=e;if(i){if(r){if(t.queryHash!==nf(i,t.options))return!1}else if(!Is(t.queryKey,i))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||o&&o!==t.state.fetchStatus||s&&!s(t))}function Ah(e,t){const{exact:n,status:r,predicate:o,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(Ls(t.options.mutationKey)!==Ls(s))return!1}else if(!Is(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function nf(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ls)(e)}function Ls(e){return JSON.stringify(e,(t,n)=>Oc(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Is(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Is(e[n],t[n])):!1}var RO=Object.prototype.hasOwnProperty;function E0(e,t){if(e===t)return e;const n=Oh(e)&&Oh(t);if(!n&&!(Oc(e)&&Oc(t)))return t;const o=(n?e:Object.keys(e)).length,s=n?t:Object.keys(t),i=s.length,a=n?new Array(i):{};let l=0;for(let u=0;u<i;u++){const c=n?u:s[u],d=e[c],f=t[c];if(d===f){a[c]=d,(n?u<o:RO.call(e,c))&&l++;continue}if(d===null||f===null||typeof d!="object"||typeof f!="object"){a[c]=f;continue}const v=E0(d,f);a[c]=v,v===d&&l++}return o===i&&l===o?e:a}function eN(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 Oh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Oc(e){if(!Nh(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Nh(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Nh(e){return Object.prototype.toString.call(e)==="[object Object]"}function TO(e){return new Promise(t=>{Tc.setTimeout(t,e)})}function AO(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?E0(e,t):t}function tN(e){return e}function OO(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function NO(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var rf=Symbol();function k0(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===rf?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function nN(e,t){return typeof e=="function"?e(...t):!!e}var sr,kn,ro,Gh,LO=(Gh=class extends vl{constructor(){super();Z(this,sr);Z(this,kn);Z(this,ro);B(this,ro,t=>{if(!wl&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){A(this,kn)||this.setEventListener(A(this,ro))}onUnsubscribe(){var t;this.hasListeners()||((t=A(this,kn))==null||t.call(this),B(this,kn,void 0))}setEventListener(t){var n;B(this,ro,t),(n=A(this,kn))==null||n.call(this),B(this,kn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){A(this,sr)!==t&&(B(this,sr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof A(this,sr)=="boolean"?A(this,sr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},sr=new WeakMap,kn=new WeakMap,ro=new WeakMap,Gh),P0=new LO;function IO(){let e,t;const n=new Promise((o,s)=>{e=o,t=s});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}var MO=CO;function _O(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=MO;const s=a=>{t?e.push(a):o(()=>{n(a)})},i=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||i()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Be=_O(),oo,Pn,so,Qh,DO=(Qh=class extends vl{constructor(){super();Z(this,oo,!0);Z(this,Pn);Z(this,so);B(this,so,t=>{if(!wl&&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(){A(this,Pn)||this.setEventListener(A(this,so))}onUnsubscribe(){var t;this.hasListeners()||((t=A(this,Pn))==null||t.call(this),B(this,Pn,void 0))}setEventListener(t){var n;B(this,so,t),(n=A(this,Pn))==null||n.call(this),B(this,Pn,t(this.setOnline.bind(this)))}setOnline(t){A(this,oo)!==t&&(B(this,oo,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return A(this,oo)}},oo=new WeakMap,Pn=new WeakMap,so=new WeakMap,Qh),Oa=new DO;function FO(e){return Math.min(1e3*2**e,3e4)}function R0(e){return(e??"online")==="online"?Oa.isOnline():!0}var Nc=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function T0(e){let t=!1,n=0,r;const o=IO(),s=()=>o.status!=="pending",i=m=>{var x;if(!s()){const y=new Nc(m);f(y),(x=e.onCancel)==null||x.call(e,y)}},a=()=>{t=!0},l=()=>{t=!1},u=()=>P0.isFocused()&&(e.networkMode==="always"||Oa.isOnline())&&e.canRun(),c=()=>R0(e.networkMode)&&e.canRun(),d=m=>{s()||(r==null||r(),o.resolve(m))},f=m=>{s()||(r==null||r(),o.reject(m))},v=()=>new Promise(m=>{var x;r=y=>{(s()||u())&&m(y)},(x=e.onPause)==null||x.call(e)}).then(()=>{var m;r=void 0,s()||(m=e.onContinue)==null||m.call(e)}),g=()=>{if(s())return;let m;const x=n===0?e.initialPromise:void 0;try{m=x??e.fn()}catch(y){m=Promise.reject(y)}Promise.resolve(m).then(d).catch(y=>{var P;if(s())return;const h=e.retry??(wl?0:3),w=e.retryDelay??FO,S=typeof w=="function"?w(n,y):w,b=h===!0||typeof h=="number"&&n<h||typeof h=="function"&&h(n,y);if(t||!b){f(y);return}n++,(P=e.onFail)==null||P.call(e,n,y),TO(S).then(()=>u()?void 0:v()).then(()=>{t?f(y):g()})})};return{promise:o,status:()=>o.status,cancel:i,continue:()=>(r==null||r(),o),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?g():v().then(g),o)}}var ir,Yh,A0=(Yh=class{constructor(){Z(this,ir)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),EO(this.gcTime)&&B(this,ir,Tc.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(wl?1/0:5*60*1e3))}clearGcTimeout(){A(this,ir)&&(Tc.clearTimeout(A(this,ir)),B(this,ir,void 0))}},ir=new WeakMap,Yh),ar,io,ct,lr,Ce,_s,ur,St,Qt,Xh,jO=(Xh=class extends A0{constructor(t){super();Z(this,St);Z(this,ar);Z(this,io);Z(this,ct);Z(this,lr);Z(this,Ce);Z(this,_s);Z(this,ur);B(this,ur,!1),B(this,_s,t.defaultOptions),this.setOptions(t.options),this.observers=[],B(this,lr,t.client),B(this,ct,A(this,lr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,B(this,ar,Lh(this.options)),this.state=t.state??A(this,ar),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=A(this,Ce))==null?void 0:t.promise}setOptions(t){if(this.options={...A(this,_s),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Lh(this.options);n.data!==void 0&&(this.setData(n.data,{updatedAt:n.dataUpdatedAt,manual:!0}),B(this,ar,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&A(this,ct).remove(this)}setData(t,n){const r=AO(this.state.data,t,this.options);return Ie(this,St,Qt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Ie(this,St,Qt).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=A(this,Ce))==null?void 0:r.promise;return(o=A(this,Ce))==null||o.cancel(t),n?n.then(xt).catch(xt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(A(this,ar))}isActive(){return this.observers.some(t=>PO(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===rf||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ac(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:!kO(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=A(this,Ce))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=A(this,Ce))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),A(this,ct).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(A(this,Ce)&&(A(this,ur)?A(this,Ce).cancel({revert:!0}):A(this,Ce).cancelRetry()),this.scheduleGc()),A(this,ct).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ie(this,St,Qt).call(this,{type:"invalidate"})}async fetch(t,n){var l,u,c,d,f,v,g,m,x,y,h,w;if(this.state.fetchStatus!=="idle"&&((l=A(this,Ce))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(A(this,Ce))return A(this,Ce).continueRetry(),A(this,Ce).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(b=>b.options.queryFn);S&&this.setOptions(S.options)}const r=new AbortController,o=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(B(this,ur,!0),r.signal)})},s=()=>{const S=k0(this.options,n),P=(()=>{const E={client:A(this,lr),queryKey:this.queryKey,meta:this.meta};return o(E),E})();return B(this,ur,!1),this.options.persister?this.options.persister(S,P,this):S(P)},a=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:A(this,lr),state:this.state,fetchFn:s};return o(S),S})();(u=this.options.behavior)==null||u.onFetch(a,this),B(this,io,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&Ie(this,St,Qt).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),B(this,Ce,T0({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:S=>{S instanceof Nc&&S.revert&&this.setState({...A(this,io),fetchStatus:"idle"}),r.abort()},onFail:(S,b)=>{Ie(this,St,Qt).call(this,{type:"failed",failureCount:S,error:b})},onPause:()=>{Ie(this,St,Qt).call(this,{type:"pause"})},onContinue:()=>{Ie(this,St,Qt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const S=await A(this,Ce).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(v=(f=A(this,ct).config).onSuccess)==null||v.call(f,S,this),(m=(g=A(this,ct).config).onSettled)==null||m.call(g,S,this.state.error,this),S}catch(S){if(S instanceof Nc){if(S.silent)return A(this,Ce).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw Ie(this,St,Qt).call(this,{type:"error",error:S}),(y=(x=A(this,ct).config).onError)==null||y.call(x,S,this),(w=(h=A(this,ct).config).onSettled)==null||w.call(h,this.state.data,S,this),S}finally{this.scheduleGc()}}},ar=new WeakMap,io=new WeakMap,ct=new WeakMap,lr=new WeakMap,Ce=new WeakMap,_s=new WeakMap,ur=new WeakMap,St=new WeakSet,Qt=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,...UO(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...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 B(this,io,t.manual?o:void 0),o;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Be.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),A(this,ct).notify({query:this,type:"updated",action:t})})},Xh);function UO(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:R0(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Lh(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 Ih(e){return{onFetch:(t,n)=>{var c,d,f,v,g;const r=t.options,o=(f=(d=(c=t.fetchOptions)==null?void 0:c.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,s=((v=t.state.data)==null?void 0:v.pages)||[],i=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let m=!1;const x=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},y=k0(t.options,t.fetchOptions),h=async(w,S,b)=>{if(m)return Promise.reject();if(S==null&&w.pages.length)return Promise.resolve(w);const E=(()=>{const j={client:t.client,queryKey:t.queryKey,pageParam:S,direction:b?"backward":"forward",meta:t.options.meta};return x(j),j})(),R=await y(E),{maxPages:I}=t.options,N=b?NO:OO;return{pages:N(w.pages,R,I),pageParams:N(w.pageParams,S,I)}};if(o&&s.length){const w=o==="backward",S=w?zO:Mh,b={pages:s,pageParams:i},P=S(r,b);a=await h(b,P,w)}else{const w=e??s.length;do{const S=l===0?i[0]??r.initialPageParam:Mh(r,a);if(l>0&&S==null)break;a=await h(a,S),l++}while(l<w)}return a};t.options.persister?t.fetchFn=()=>{var m,x;return(x=(m=t.options).persister)==null?void 0:x.call(m,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function Mh(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 zO(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 Ds,Dt,ze,cr,Ft,wn,Jh,$O=(Jh=class extends A0{constructor(t){super();Z(this,Ft);Z(this,Ds);Z(this,Dt);Z(this,ze);Z(this,cr);B(this,Ds,t.client),this.mutationId=t.mutationId,B(this,ze,t.mutationCache),B(this,Dt,[]),this.state=t.state||BO(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){A(this,Dt).includes(t)||(A(this,Dt).push(t),this.clearGcTimeout(),A(this,ze).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){B(this,Dt,A(this,Dt).filter(n=>n!==t)),this.scheduleGc(),A(this,ze).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){A(this,Dt).length||(this.state.status==="pending"?this.scheduleGc():A(this,ze).remove(this))}continue(){var t;return((t=A(this,cr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,a,l,u,c,d,f,v,g,m,x,y,h,w,S,b,P,E,R,I;const n=()=>{Ie(this,Ft,wn).call(this,{type:"continue"})},r={client:A(this,Ds),meta:this.options.meta,mutationKey:this.options.mutationKey};B(this,cr,T0({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(N,j)=>{Ie(this,Ft,wn).call(this,{type:"failed",failureCount:N,error:j})},onPause:()=>{Ie(this,Ft,wn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>A(this,ze).canRun(this)}));const o=this.state.status==="pending",s=!A(this,cr).canStart();try{if(o)n();else{Ie(this,Ft,wn).call(this,{type:"pending",variables:t,isPaused:s}),await((a=(i=A(this,ze).config).onMutate)==null?void 0:a.call(i,t,this,r));const j=await((u=(l=this.options).onMutate)==null?void 0:u.call(l,t,r));j!==this.state.context&&Ie(this,Ft,wn).call(this,{type:"pending",context:j,variables:t,isPaused:s})}const N=await A(this,cr).start();return await((d=(c=A(this,ze).config).onSuccess)==null?void 0:d.call(c,N,t,this.state.context,this,r)),await((v=(f=this.options).onSuccess)==null?void 0:v.call(f,N,t,this.state.context,r)),await((m=(g=A(this,ze).config).onSettled)==null?void 0:m.call(g,N,null,this.state.variables,this.state.context,this,r)),await((y=(x=this.options).onSettled)==null?void 0:y.call(x,N,null,t,this.state.context,r)),Ie(this,Ft,wn).call(this,{type:"success",data:N}),N}catch(N){try{throw await((w=(h=A(this,ze).config).onError)==null?void 0:w.call(h,N,t,this.state.context,this,r)),await((b=(S=this.options).onError)==null?void 0:b.call(S,N,t,this.state.context,r)),await((E=(P=A(this,ze).config).onSettled)==null?void 0:E.call(P,void 0,N,this.state.variables,this.state.context,this,r)),await((I=(R=this.options).onSettled)==null?void 0:I.call(R,void 0,N,t,this.state.context,r)),N}finally{Ie(this,Ft,wn).call(this,{type:"error",error:N})}}finally{A(this,ze).runNext(this)}}},Ds=new WeakMap,Dt=new WeakMap,ze=new WeakMap,cr=new WeakMap,Ft=new WeakSet,wn=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),Be.batch(()=>{A(this,Dt).forEach(r=>{r.onMutationUpdate(t)}),A(this,ze).notify({mutation:this,type:"updated",action:t})})},Jh);function BO(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Zt,Ct,Fs,Zh,HO=(Zh=class extends vl{constructor(t={}){super();Z(this,Zt);Z(this,Ct);Z(this,Fs);this.config=t,B(this,Zt,new Set),B(this,Ct,new Map),B(this,Fs,0)}build(t,n,r){const o=new $O({client:t,mutationCache:this,mutationId:++ei(this,Fs)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){A(this,Zt).add(t);const n=Ri(t);if(typeof n=="string"){const r=A(this,Ct).get(n);r?r.push(t):A(this,Ct).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(A(this,Zt).delete(t)){const n=Ri(t);if(typeof n=="string"){const r=A(this,Ct).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&A(this,Ct).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ri(t);if(typeof n=="string"){const r=A(this,Ct).get(n),o=r==null?void 0:r.find(s=>s.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=Ri(t);if(typeof n=="string"){const o=(r=A(this,Ct).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Be.batch(()=>{A(this,Zt).forEach(t=>{this.notify({type:"removed",mutation:t})}),A(this,Zt).clear(),A(this,Ct).clear()})}getAll(){return Array.from(A(this,Zt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ah(n,r))}findAll(t={}){return this.getAll().filter(n=>Ah(t,n))}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Be.batch(()=>Promise.all(t.map(n=>n.continue().catch(xt))))}},Zt=new WeakMap,Ct=new WeakMap,Fs=new WeakMap,Zh);function Ri(e){var t;return(t=e.options.scope)==null?void 0:t.id}var jt,em,VO=(em=class extends vl{constructor(t={}){super();Z(this,jt);this.config=t,B(this,jt,new Map)}build(t,n,r){const o=n.queryKey,s=n.queryHash??nf(o,n);let i=this.get(s);return i||(i=new jO({client:t,queryKey:o,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(i)),i}add(t){A(this,jt).has(t.queryHash)||(A(this,jt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=A(this,jt).get(t.queryHash);n&&(t.destroy(),n===t&&A(this,jt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Be.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return A(this,jt).get(t)}getAll(){return[...A(this,jt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Th(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Th(t,r)):n}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Be.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Be.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},jt=new WeakMap,em),pe,Rn,Tn,ao,lo,An,uo,co,tm,KO=(tm=class{constructor(e={}){Z(this,pe);Z(this,Rn);Z(this,Tn);Z(this,ao);Z(this,lo);Z(this,An);Z(this,uo);Z(this,co);B(this,pe,e.queryCache||new VO),B(this,Rn,e.mutationCache||new HO),B(this,Tn,e.defaultOptions||{}),B(this,ao,new Map),B(this,lo,new Map),B(this,An,0)}mount(){ei(this,An)._++,A(this,An)===1&&(B(this,uo,P0.subscribe(async e=>{e&&(await this.resumePausedMutations(),A(this,pe).onFocus())})),B(this,co,Oa.subscribe(async e=>{e&&(await this.resumePausedMutations(),A(this,pe).onOnline())})))}unmount(){var e,t;ei(this,An)._--,A(this,An)===0&&((e=A(this,uo))==null||e.call(this),B(this,uo,void 0),(t=A(this,co))==null||t.call(this),B(this,co,void 0))}isFetching(e){return A(this,pe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return A(this,Rn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=A(this,pe).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=A(this,pe).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ac(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return A(this,pe).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=A(this,pe).get(r.queryHash),s=o==null?void 0:o.state.data,i=bO(t,s);if(i!==void 0)return A(this,pe).build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Be.batch(()=>A(this,pe).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=A(this,pe).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=A(this,pe);Be.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=A(this,pe);return Be.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Be.batch(()=>A(this,pe).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(xt).catch(xt)}invalidateQueries(e,t={}){return Be.batch(()=>(A(this,pe).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=Be.batch(()=>A(this,pe).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let s=o.fetch(void 0,n);return n.throwOnError||(s=s.catch(xt)),o.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(xt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=A(this,pe).build(this,t);return n.isStaleByTime(Ac(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xt).catch(xt)}fetchInfiniteQuery(e){return e.behavior=Ih(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xt).catch(xt)}ensureInfiniteQueryData(e){return e.behavior=Ih(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Oa.isOnline()?A(this,Rn).resumePausedMutations():Promise.resolve()}getQueryCache(){return A(this,pe)}getMutationCache(){return A(this,Rn)}getDefaultOptions(){return A(this,Tn)}setDefaultOptions(e){B(this,Tn,e)}setQueryDefaults(e,t){A(this,ao).set(Ls(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...A(this,ao).values()],n={};return t.forEach(r=>{Is(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){A(this,lo).set(Ls(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...A(this,lo).values()],n={};return t.forEach(r=>{Is(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...A(this,Tn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=nf(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===rf&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...A(this,Tn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){A(this,pe).clear(),A(this,Rn).clear()}},pe=new WeakMap,Rn=new WeakMap,Tn=new WeakMap,ao=new WeakMap,lo=new WeakMap,An=new WeakMap,uo=new WeakMap,co=new WeakMap,tm),O0=p.createContext(void 0),rN=e=>{const t=p.useContext(O0);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},WO=({client:e,children:t})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),C.jsx(O0.Provider,{value:e,children:t}));const H=e=>typeof e=="string",Wo=()=>{let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n},_h=e=>e==null?"":""+e,qO=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},GO=/###/g,Dh=e=>e&&e.indexOf("###")>-1?e.replace(GO,"."):e,Fh=e=>!e||H(e),as=(e,t,n)=>{const r=H(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(Fh(e))return{};const s=Dh(r[o]);!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={},++o}return Fh(e)?{}:{obj:e,k:Dh(r[o])}},jh=(e,t,n)=>{const{obj:r,k:o}=as(e,t,Object);if(r!==void 0||t.length===1){r[o]=n;return}let s=t[t.length-1],i=t.slice(0,t.length-1),a=as(e,i,Object);for(;a.obj===void 0&&i.length;)s=`${i[i.length-1]}.${s}`,i=i.slice(0,i.length-1),a=as(e,i,Object),a&&a.obj&&typeof a.obj[`${a.k}.${s}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=n},QO=(e,t,n,r)=>{const{obj:o,k:s}=as(e,t,Object);o[s]=o[s]||[],o[s].push(n)},Na=(e,t)=>{const{obj:n,k:r}=as(e,t);if(n)return n[r]},YO=(e,t,n)=>{const r=Na(e,n);return r!==void 0?r:Na(t,n)},N0=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?H(e[r])||e[r]instanceof String||H(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):N0(e[r],t[r],n):e[r]=t[r]);return e},Mr=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var XO={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const JO=e=>H(e)?e.replace(/[&<>"'\/]/g,t=>XO[t]):e;class ZO{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 e2=[" ",",","?","!",";"],t2=new ZO(20),n2=(e,t,n)=>{t=t||"",n=n||"";const r=e2.filter(i=>t.indexOf(i)<0&&n.indexOf(i)<0);if(r.length===0)return!0;const o=t2.getRegExp(`(${r.map(i=>i==="?"?"\\?":i).join("|")})`);let s=!o.test(e);if(!s){const i=e.indexOf(n);i>0&&!o.test(e.substring(0,i))&&(s=!0)}return s},Lc=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 o=e;for(let s=0;s<r.length;){if(!o||typeof o!="object")return;let i,a="";for(let l=s;l<r.length;++l)if(l!==s&&(a+=n),a+=r[l],i=o[a],i!==void 0){if(["string","number","boolean"].indexOf(typeof i)>-1&&l<r.length-1)continue;s+=l-s+1;break}o=i}return o},La=e=>e&&e.replace("_","-"),r2={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 Ia{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||r2,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,o){return o&&!this.debug?null:(H(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Ia(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Ia(this.logger,t)}}var Bt=new Ia;class xl{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(n)||0;this.observers[r].set(n,o+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),o=1;o<n;o++)r[o-1]=arguments[o];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(i=>{let[a,l]=i;for(let u=0;u<l;u++)a(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(i=>{let[a,l]=i;for(let u=0;u<l;u++)a.apply(a,[t,...r])})}}class Uh extends xl{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 o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,i=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;t.indexOf(".")>-1?a=t.split("."):(a=[t,n],r&&(Array.isArray(r)?a.push(...r):H(r)&&s?a.push(...r.split(s)):a.push(r)));const l=Na(this.data,a);return!l&&!n&&!r&&t.indexOf(".")>-1&&(t=a[0],n=a[1],r=a.slice(2).join(".")),l||!i||!H(r)?l:Lc(this.data&&this.data[t]&&this.data[t][n],r,s)}addResource(t,n,r,o){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(i?r.split(i):r)),t.indexOf(".")>-1&&(a=t.split("."),o=n,n=a[1]),this.addNamespaces(n),jh(this.data,a,o),s.silent||this.emit("added",t,n,r,o)}addResources(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in r)(H(r[s])||Array.isArray(r[s]))&&this.addResource(t,n,s,r[s],{silent:!0});o.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,o,s){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),o=r,r=n,n=a[1]),this.addNamespaces(n);let l=Na(this.data,a)||{};i.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?N0(l,r,s):l={...l,...r},jh(this.data,a,l),i.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(o=>n[o]&&Object.keys(n[o]).length>0)}toJSON(){return this.data}}var L0={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(s=>{this.processors[s]&&(t=this.processors[s].process(t,n,r,o))}),t}};const zh={};class Ma extends xl{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),qO(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Bt.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 o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const i=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!n2(t,r,o);if(i&&!a){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:H(s)?[s]:s};const u=t.split(r);(r!==o||r===o&&this.options.ns.indexOf(u[0])>-1)&&(s=u.shift()),t=u.join(o)}return{key:t,namespaces:H(s)?[s]:s}}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 o=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:i,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 S=n.nsSeparator||this.options.nsSeparator;return o?{res:`${l}${S}${i}`,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${S}${i}`}return o?{res:i,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:i}const d=this.resolve(t,n);let f=d&&d.res;const v=d&&d.usedKey||i,g=d&&d.exactUsedKey||i,m=Object.prototype.toString.apply(f),x=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,h=!this.i18nFormat||this.i18nFormat.handleAsObject,w=!H(f)&&typeof f!="boolean"&&typeof f!="number";if(h&&f&&w&&x.indexOf(m)<0&&!(H(y)&&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 S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,f,{...n,ns:a}):`key '${i} (${this.language})' returned an object instead of string.`;return o?(d.res=S,d.usedParams=this.getUsedParamsDetails(n),d):S}if(s){const S=Array.isArray(f),b=S?[]:{},P=S?g:v;for(const E in f)if(Object.prototype.hasOwnProperty.call(f,E)){const R=`${P}${s}${E}`;b[E]=this.translate(R,{...n,joinArrays:!1,ns:a}),b[E]===R&&(b[E]=f[E])}f=b}}else if(h&&H(y)&&Array.isArray(f))f=f.join(y),f&&(f=this.extendTranslation(f,t,n,r));else{let S=!1,b=!1;const P=n.count!==void 0&&!H(n.count),E=Ma.hasDefaultValue(n),R=P?this.pluralResolver.getSuffix(u,n.count,n):"",I=n.ordinal&&P?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",N=P&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),j=N&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${R}`]||n[`defaultValue${I}`]||n.defaultValue;!this.isValidLookup(f)&&E&&(S=!0,f=j),this.isValidLookup(f)||(b=!0,f=i);const W=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&b?void 0:f,$=E&&j!==f&&this.options.updateMissing;if(b||S||$){if(this.logger.log($?"updateKey":"missingKey",u,l,i,$?j:f),s){const k=this.resolve(i,{...n,keySeparator:!1});k&&k.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 J=[];const U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&U&&U[0])for(let k=0;k<U.length;k++)J.push(U[k]);else this.options.saveMissingTo==="all"?J=this.languageUtils.toResolveHierarchy(n.lng||this.language):J.push(n.lng||this.language);const Q=(k,O,M)=>{const z=E&&M!==f?M:W;this.options.missingKeyHandler?this.options.missingKeyHandler(k,l,O,z,$,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(k,l,O,z,$,n),this.emit("missingKey",k,l,O,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?J.forEach(k=>{const O=this.pluralResolver.getSuffixes(k,n);N&&n[`defaultValue${this.options.pluralSeparator}zero`]&&O.indexOf(`${this.options.pluralSeparator}zero`)<0&&O.push(`${this.options.pluralSeparator}zero`),O.forEach(M=>{Q([k],i+M,n[`defaultValue${M}`]||j)})}):Q(J,i,j))}f=this.extendTranslation(f,t,n,d,r),b&&f===i&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${i}`),(b||S)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${i}`:i,S?f:void 0):f=this.options.parseMissingKeyHandler(f))}return o?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}extendTranslation(t,n,r,o,s){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=H(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&&!H(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||o.usedLng,r),u){const f=t.match(this.interpolator.nestingRegexp),v=f&&f.length;c<v&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&o&&o.res&&(r.lng=this.language||o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var f=arguments.length,v=new Array(f),g=0;g<f;g++)v[g]=arguments[g];return s&&s[0]===v[0]&&!r.context?(i.logger.warn(`It seems you are nesting recursively key: ${v[0]} in key: ${n[0]}`),null):i.translate(...v,n)},r)),r.interpolation&&this.interpolator.reset()}const a=r.postProcess||this.options.postProcess,l=H(a)?[a]:a;return t!=null&&l&&l.length&&r.applyPostProcessor!==!1&&(t=L0.handle(l,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,o,s,i,a;return H(t)&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;o=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&!H(n.count),v=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(H(n.context)||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(x=>{this.isValidLookup(r)||(a=x,!zh[`${m[0]}-${x}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(zh[`${m[0]}-${x}`]=!0,this.logger.warn(`key "${o}" for languages "${m.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!!!")),m.forEach(y=>{if(this.isValidLookup(r))return;i=y;const h=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(h,c,y,x,n);else{let S;f&&(S=this.pluralResolver.getSuffix(y,n.count,n));const b=`${this.options.pluralSeparator}zero`,P=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(h.push(c+S),n.ordinal&&S.indexOf(P)===0&&h.push(c+S.replace(P,this.options.pluralSeparator)),v&&h.push(c+b)),g){const E=`${c}${this.options.contextSeparator}${n.context}`;h.push(E),f&&(h.push(E+S),n.ordinal&&S.indexOf(P)===0&&h.push(E+S.replace(P,this.options.pluralSeparator)),v&&h.push(E+b))}}let w;for(;w=h.pop();)this.isValidLookup(r)||(s=w,r=this.getResource(y,x,w,n))}))})}),{res:r,usedKey:o,exactUsedKey:s,usedLng:i,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,o):this.resourceStore.getResource(t,n,r,o)}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&&!H(t.replace);let o=r?t.replace:t;if(r&&typeof t.count<"u"&&(o.count=t.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!r){o={...o};for(const s of n)delete o[s]}return o}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 du=e=>e.charAt(0).toUpperCase()+e.slice(1);class $h{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Bt.create("languageUtils")}getScriptPartFromCode(t){if(t=La(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=La(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(H(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let o=Intl.getCanonicalLocales(t)[0];if(o&&this.options.lowerCaseLng&&(o=o.toLowerCase()),o)return o}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(o=>o.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=du(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]=du(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=du(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 o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(n=o)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const o=this.getLanguagePartFromCode(r);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(s=>{if(s===o)return s;if(!(s.indexOf("-")<0&&o.indexOf("-")<0)&&(s.indexOf("-")>0&&o.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===o||s.indexOf(o)===0&&o.length>1))return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),H(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),o=[],s=i=>{i&&(this.isSupportedCode(i)?o.push(i):this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`))};return H(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):H(t)&&s(this.formatLanguageCode(t)),r.forEach(i=>{o.indexOf(i)<0&&s(this.formatLanguageCode(i))}),o}}let o2=[{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}],s2={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 i2=["v1","v2","v3"],a2=["v4"],Bh={zero:0,one:1,two:2,few:3,many:4,other:5},l2=()=>{const e={};return o2.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:s2[t.fc]}})}),e};class u2{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Bt.create("pluralResolver"),(!this.options.compatibilityJSON||a2.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=l2(),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=La(t==="dev"?"en":t),o=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:o});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let i;try{i=new Intl.PluralRules(r,{type:o})}catch{if(!t.match(/-|_/))return;const l=this.languageUtils.getLanguagePartFromCode(t);i=this.getRule(l,n)}return this.pluralRulesCache[s]=i,i}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(o=>`${n}${o}`)}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((o,s)=>Bh[o]-Bh[s]).map(o=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${o}`):r.numbers.map(o=>this.getSuffix(t,o,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const o=this.getRule(t,r);return o?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(n)}`:this.getSuffixRetroCompatible(o,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 o=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(o===2?o="plural":o===1&&(o=""));const s=()=>this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString();return this.options.compatibilityJSON==="v1"?o===1?"":typeof o=="number"?`_plural_${o.toString()}`:s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!i2.includes(this.options.compatibilityJSON)}}const Hh=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=YO(e,t,n);return!s&&o&&H(n)&&(s=Lc(e,n,r),s===void 0&&(s=Lc(t,n,r))),s},fu=e=>e.replace(/\$/g,"$$$$");class c2{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Bt.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:o,prefix:s,prefixEscaped:i,suffix:a,suffixEscaped:l,formatSeparator:u,unescapeSuffix:c,unescapePrefix:d,nestingPrefix:f,nestingPrefixEscaped:v,nestingSuffix:g,nestingSuffixEscaped:m,nestingOptionsSeparator:x,maxReplaces:y,alwaysFormat:h}=t.interpolation;this.escape=n!==void 0?n:JO,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=s?Mr(s):i||"{{",this.suffix=a?Mr(a):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=c?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=f?Mr(f):v||Mr("$t("),this.nestingSuffix=g?Mr(g):m||Mr(")"),this.nestingOptionsSeparator=x||",",this.maxReplaces=y||1e3,this.alwaysFormat=h!==void 0?h:!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,o){let s,i,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=v=>{if(v.indexOf(this.formatSeparator)<0){const y=Hh(n,l,v,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...o,...n,interpolationkey:v}):y}const g=v.split(this.formatSeparator),m=g.shift().trim(),x=g.join(this.formatSeparator).trim();return this.format(Hh(n,l,m,this.options.keySeparator,this.options.ignoreJSONStructure),x,r,{...o,...n,interpolationkey:m})};this.resetRegExp();const c=o&&o.missingInterpolationHandler||this.options.missingInterpolationHandler,d=o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:v=>fu(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?fu(this.escape(v)):fu(v)}].forEach(v=>{for(a=0;s=v.regex.exec(t);){const g=s[1].trim();if(i=u(g),i===void 0)if(typeof c=="function"){const x=c(t,s,o);i=H(x)?x:""}else if(o&&Object.prototype.hasOwnProperty.call(o,g))i="";else if(d){i=s[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),i="";else!H(i)&&!this.useRawValueToEscape&&(i=_h(i));const m=v.safeValue(i);if(t=t.replace(s[0],m),d?(v.regex.lastIndex+=i.length,v.regex.lastIndex-=s[0].length):v.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,s,i;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,i);const v=f.match(/'/g),g=f.match(/"/g);(v&&v.length%2===0&&!g||g.length%2!==0)&&(f=f.replace(/'/g,'"'));try{i=JSON.parse(f),u&&(i={...u,...i})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${c}${f}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,l};for(;o=this.nestingRegexp.exec(t);){let l=[];i={...r},i=i.replace&&!H(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;let u=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){const c=o[1].split(this.formatSeparator).map(d=>d.trim());o[1]=c.shift(),l=c,u=!0}if(s=n(a.call(this,o[1].trim(),i),i),s&&o[0]===t&&!H(s))return s;H(s)||(s=_h(s)),s||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),s=""),u&&(s=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:o[1].trim()}),s.trim())),t=t.replace(o[0],s),this.regexp.lastIndex=0}return t}}const d2=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);t==="currency"&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(i=>{if(i){const[a,...l]=i.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}},_r=e=>{const t={};return(n,r,o)=>{let s=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(s={...s,[o.interpolationkey]:void 0});const i=r+JSON.stringify(s);let a=t[i];return a||(a=e(La(r),o),t[i]=a),a(n)}};class f2{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Bt.create("formatter"),this.options=t,this.formats={number:_r((n,r)=>{const o=new Intl.NumberFormat(n,{...r});return s=>o.format(s)}),currency:_r((n,r)=>{const o=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>o.format(s)}),datetime:_r((n,r)=>{const o=new Intl.DateTimeFormat(n,{...r});return s=>o.format(s)}),relativetime:_r((n,r)=>{const o=new Intl.RelativeTimeFormat(n,{...r});return s=>o.format(s,r.range||"day")}),list:_r((n,r)=>{const o=new Intl.ListFormat(n,{...r});return s=>o.format(s)})},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()]=_r(n)}format(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(a=>a.indexOf(")")>-1)){const a=s.findIndex(l=>l.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,a)].join(this.formatSeparator)}return s.reduce((a,l)=>{const{formatName:u,formatOptions:c}=d2(l);if(this.formats[u]){let d=a;try{const f=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},v=f.locale||f.lng||o.locale||o.lng||r;d=this.formats[u](a,v,{...c,...o,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}const p2=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class h2 extends xl{constructor(t,n,r){let o=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=o,this.logger=Bt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,o.backend,o)}queueLoad(t,n,r,o){const s={},i={},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?i[f]===void 0&&(i[f]=!0):(this.state[f]=1,c=!1,i[f]===void 0&&(i[f]=!0),s[f]===void 0&&(s[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(a[u]=!0)}),(Object.keys(s).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(s),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const o=t.split("|"),s=o[0],i=o[1];n&&this.emit("failedLoading",s,i,n),!n&&r&&this.store.addResourceBundle(s,i,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=>{QO(l.loaded,[s],i),p2(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 o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!t.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:o,wait:s,callback:i});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&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,o+1,s*2,i)},s);return}i(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]:{},o=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."),o&&o();H(t)&&(t=this.languageUtils.toResolveHierarchy(t)),H(n)&&(n=[n]);const s=this.queueLoad(t,n,r,o);if(!s.toLoad.length)return s.pending.length||o(),null;s.toLoad.forEach(i=>{this.loadOne(i)})}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("|"),o=r[0],s=r[1];this.read(o,s,"read",void 0,void 0,(i,a)=>{i&&this.logger.warn(`${n}loading namespace ${s} for language ${o} failed`,i),!i&&a&&this.logger.log(`${n}loaded namespace ${s} for language ${o}`,a),this.loaded(t,i,a)})}saveMissing(t,n,r,o,s){let i=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={...i,isUpdate:s},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,o,l):c=u(t,n,r,o),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,o,a,l)}!t||!t[0]||this.store.addResource(t[0],n,r,o)}}}const Vh=()=>({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]),H(e[1])&&(t.defaultValue=e[1]),H(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}}),Kh=e=>(H(e.ns)&&(e.ns=[e.ns]),H(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),H(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Ti=()=>{},m2=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Ms extends xl{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Kh(t),this.services={},this.logger=Bt,this.modules={external:[]},m2(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&&(H(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const o=Vh();this.options={...o,...this.options,...Kh(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...o.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const s=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?Bt.init(s(this.modules.logger),this.options):Bt.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=f2);const d=new $h(this.options);this.store=new Uh(this.options.resources,this.options);const f=this.services;f.logger=Bt,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new u2(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(f.formatter=s(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new c2(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new h2(s(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(v){for(var g=arguments.length,m=new Array(g>1?g-1:0),x=1;x<g;x++)m[x-1]=arguments[x];t.emit(v,...m)}),this.modules.languageDetector&&(f.languageDetector=s(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=s(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new Ma(this.services,this.options),this.translator.on("*",function(v){for(var g=arguments.length,m=new Array(g>1?g-1:0),x=1;x<g;x++)m[x-1]=arguments[x];t.emit(v,...m)}),this.modules.external.forEach(v=>{v.init&&v.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Ti),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=Wo(),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]:Ti;const o=H(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(o&&o.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],i=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{u!=="cimode"&&s.indexOf(u)<0&&s.push(u)})};o?i(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>i(l)),this.options.preload&&this.options.preload.forEach(a=>i(a)),this.services.backendConnector.load(s,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const o=Wo();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=Ti),this.services.backendConnector.reload(t,n,s=>{o.resolve(),r(s)}),o}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"&&L0.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 o=Wo();this.emit("languageChanging",t);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},i=(l,u)=>{u?(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,o.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=H(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{i(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),o}getFixedT(t,n,r){var o=this;const s=function(i,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=o.options.overloadTranslationOptionHandler([i,a].concat(c))}else l={...a};l.lng=l.lng||s.lng,l.lngs=l.lngs||s.lngs,l.ns=l.ns||s.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||r||s.keyPrefix);const f=o.options.keySeparator||".";let v;return l.keyPrefix&&Array.isArray(i)?v=i.map(g=>`${l.keyPrefix}${f}${g}`):v=l.keyPrefix?`${l.keyPrefix}${f}${i}`:i,o.t(v,l)};return H(t)?s.lng=t:s.lngs=t,s.ns=n,s.keyPrefix=r,s}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],o=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const i=(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,i);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(r,t)&&(!o||i(s,t)))}loadNamespaces(t,n){const r=Wo();return this.options.ns?(H(t)&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Wo();H(t)&&(t=[t]);const o=this.options.preload||[],s=t.filter(i=>o.indexOf(i)<0&&this.services.languageUtils.isSupportedCode(i));return s.length?(this.options.preload=o.concat(s),this.loadResources(i=>{r.resolve(),n&&n(i)}),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 $h(Vh());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 Ms(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ti;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},s=new Ms(o);return(t.debug!==void 0||t.prefix!==void 0)&&(s.logger=s.logger.clone(t)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r&&(s.store=new Uh(this.store.data,o),s.services.resourceStore=s.store),s.translator=new Ma(s.services,o),s.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];s.emit(a,...u)}),s.init(o,n),s.translator.options=o,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ke=Ms.createInstance();ke.createInstance=Ms.createInstance;ke.createInstance;ke.dir;ke.init;ke.loadResources;ke.reloadResources;ke.use;ke.changeLanguage;ke.getFixedT;ke.t;ke.exists;ke.setDefaultNamespace;ke.hasLoadedNamespace;ke.loadNamespaces;ke.loadLanguages;const g2={zh:{translation:{app:{title:"cc-gw 控制台",skipToContent:"跳转到主要内容"},nav:{dashboard:"仪表盘",logs:"请求日志",events:"事件",models:"模型与路由管理",apiKeys:"API 密钥",settings:"设置",help:"使用指南",about:"关于"},language:{zh:"简体中文",en:"English"},common:{loading:"加载中...",loadingShort:"加载中...",noData:"暂无数据",languageSelector:"语言选择",yes:"是",edit:"编辑",delete:"删除",create:"创建",save:"保存",saving:"保存中...",cancel:"取消",actions:{refresh:"刷新",refreshing:"刷新中...",manualRefresh:"手动刷新",reset:"重置",close:"关闭",openNavigation:"打开导航",closeNavigation:"关闭导航",save:"保存设置",saving:"保存中...",cancel:"取消",copy:"复制",testConnection:"测试连接",testingConnection:"测试中...",cleanup:"清理历史日志",cleaning:"清理中...",checkUpdates:"检查更新",logout:"退出登录"},theme:{label:"主题",light:"亮色",dark:"暗色",system:"跟随系统"},status:{success:"成功",error:"失败"},notifications:{featureInProgress:"功能开发中,敬请期待。"},units:{request:"次",ms:"ms",token:"Tokens",msPerToken:"ms/Token"},noMatches:"无匹配项",unknownError:"未知错误",filters:{activeCount:"{{count}} 个筛选条件",collapse:"收起筛选",expand:"展开筛选",allRequests:"全部请求"}},login:{title:"登录 cc-gw 控制台",description:"启用 Web UI 访问控制后,请输入账号与密码继续。",fields:{username:"用户名",usernamePlaceholder:"请输入用户名",password:"密码",passwordPlaceholder:"请输入密码"},actions:{submit:"登录"},validation:{required:"请填写用户名和密码",failed:"登录失败,请检查账号或密码后重试"},hint:"如果忘记密码,可在服务器上通过 CLI 或编辑配置重置 Web 登录设置。",status:"已登录:{{username}}"},dashboard:{description:"快速了解请求规模与实时运行状态。",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",todayCacheRead:"今日缓存读取",todayCacheCreation:"今日缓存写入",todayOutput:"今日输出 Tokens",todayCached:"今日缓存 Tokens",avgLatency:"平均响应耗时"},charts:{requestsTitle:"请求趋势",requestsDesc:"最近 14 天请求与 Token 走势",modelTitle:"模型调用分布",modelDesc:"近 7 天不同模型的调用次数与 Token 走势",barRequests:"请求数",lineInput:"输入 Tokens",lineOutput:"输出 Tokens",lineCached:"缓存 Tokens",lineCacheRead:"缓存读取",lineCacheCreation:"缓存写入",axisTokens:"Tokens",ttftLabel:"TTFT(ms)",tpotLabel:"TPOT(ms/Token)",ttftTitle:"TTFT 模型对比",ttftDesc:"比较不同模型的首 Token 耗时 (TTFT)",ttftEmpty:"暂无 TTFT 数据。",tpotTitle:"TPOT 模型对比",tpotDesc:"比较不同模型的平均 Token 耗时 (TPOT)",tpotEmpty:"暂无 TPOT 数据。",ttftAxis:"TTFT (ms)",tpotAxis:"TPOT (ms/Token)",empty:"暂无数据"},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",cacheReadTokens:"缓存读取",cacheCreationTokens:"缓存写入",outputTokens:"输出 Tokens",stream:"Stream",latency:"耗时(ms)",ttft:"TTFT(ms)",tpot:"TPOT(ms/Token)",status:"状态",error:"错误信息",actions:"操作"},pagination:{perPage:"每页",unit:"条",previous:"上一页",next:"下一页",pageLabel:"第 {{page}} / {{total}} 页"}},endpointAnthropic:"anthropic",endpointOpenAI:"openai",toast:{listError:{title:"日志获取失败",desc:"错误信息:{{message}}"},providerError:{title:"Provider 列表获取失败",desc:"错误信息:{{message}}"},exportSuccess:{title:"导出完成",desc:"压缩日志文件已开始下载。"},exportError:{title:"导出失败",desc:"错误信息:{{message}}"}},stream:{streaming:"流式",single:"单次"},detail:{title:"日志详情",id:"ID #{{id}}",infoSection:"基本信息",info:{time:"时间",sessionId:"Session ID",endpoint:"端点",provider:"Provider",requestedModel:"请求模型",noRequestedModel:"未指定",model:"路由模型",stream:"Stream",latency:"耗时",status:"状态",inputTokens:"输入 Tokens",cacheReadTokens:"缓存读取",cacheCreationTokens:"缓存写入",outputTokens:"输出 Tokens",ttft:"TTFT (首 Token 耗时)",tpot:"TPOT (平均 ms/Token)",error:"错误信息"},summary:{route:"{{from}} → {{to}}",latency:"耗时:{{value}}",ttft:"TTFT:{{value}}",tpot:"TPOT:{{value}}",stream:"Stream:{{value}}"},payload:{request:"请求体",response:"响应体",emptyRequest:"暂无请求内容",emptyResponse:"暂无响应内容"},apiKey:{title:"密钥信息",name:"密钥名称",identifier:"密钥 ID",masked:"掩码展示",maskedUnavailable:"暂无掩码信息",raw:"原始密钥",rawUnavailable:"未记录原始密钥",rawMasked:"原始密钥(已脱敏)",rawMaskedHint:"出于安全考虑,仅展示部分前后缀。如需完整值,请在上游服务中重新生成。",missing:"未记录",lastUsed:"最后使用"},copy:{requestSuccess:"请求体已复制到剪贴板。",responseSuccess:"响应体已复制到剪贴板。",keySuccess:"API 密钥已复制到剪贴板。",empty:"{{label}}为空,无法复制。",failure:"复制失败",failureFallback:"无法复制内容,请稍后再试。"},loadError:"无法加载日志详情。"}},providers:{title:"模型提供商",description:"管理集成的模型服务,查看默认模型及支持能力。",emptyState:"暂无 Provider,请点击“新增提供商”以开始配置。",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:"选择 API 认证方式,填写对应的密钥值。",authModeApiKey:"默认方式(Anthropic: x-api-key / OpenAI: Bearer)",authModeAuthToken:"Authorization: Bearer",authModeXAuthToken:"X-Auth-Token",models:"模型配置",showAdvanced:"显示高级选项",hideAdvanced:"隐藏高级选项",addModel:"新增模型",modelId:"模型 ID",modelIdPlaceholder:"如 claude-sonnet-4-5-20250929",modelLabel:"显示名称(可选)",modelLabelPlaceholder:"如 GPT-4 旗舰",setDefault:"设为默认模型",removeModel:"删除模型"},errors:{idRequired:"请填写 Provider ID",idDuplicate:"该 Provider ID 已存在",baseUrlInvalid:"Base URL 格式无效",modelsRequired:"请至少配置一个模型",modelInvalid:"模型 ID 不可为空或重复",defaultInvalid:"默认模型必须在模型列表中"},toast:{saveFailure:"保存失败:{{message}}"},noModelsTitle:"透传模式已启用",noModelsHint:'当前未配置模型列表。该 Provider 将以"透传"模式使用,可在模型路由中映射,或在请求中直接指定模型。',routeExample:"路由映射示例:"},confirm:{delete:"确认删除 Provider「{{name}}」?"}},modelManagement:{title:"模型与路由管理",description:"统一维护模型提供商配置、模型路由映射与自定义端点。",tabs:{providers:"模型提供商",providersDesc:"配置上游模型提供商以及认证信息。",anthropic:"Anthropic 路由",anthropicDesc:"管理 /anthropic 端点的模型映射和默认配置。",openai:"OpenAI 路由",openaiDesc:"管理 /openai 端点的模型映射和默认配置。",customEndpoint:"自定义端点"},addEndpoint:"添加端点",createEndpoint:"创建端点",editEndpoint:"编辑端点",deleteEndpointConfirm:'确定要删除端点 "{{label}}" 吗?此操作无法撤销。',deleteEndpointSuccess:"端点删除成功",deleteEndpointError:"删除失败:{{error}}",createEndpointSuccess:"端点创建成功",createEndpointError:"创建失败:{{error}}",updateEndpointSuccess:"端点更新成功",updateEndpointError:"更新失败:{{error}}",endpointValidationError:"请填写所有必填字段",pathValidationError:"请填写所有路径信息",atLeastOnePath:"至少需要一个路径",endpointId:"端点 ID",endpointIdPlaceholder:"如 custom-api",endpointIdHint:"ID 创建后不可修改,用于内部标识。",endpointLabel:"显示名称",endpointLabelPlaceholder:"如 我的自定义 API",endpointPath:"访问路径",endpointPaths:"访问路径",endpointPathPlaceholder:"如 /custom/api",endpointPathHint:"路径需以 / 开头,修改后立即生效。",endpointProtocol:"协议类型",endpointEnabled:"启用此端点",endpointRoutingHint:"创建后,您可以在此端点的路由配置 Tab 中设置模型路由规则。",addPath:"添加路径",removePath:"删除路径",protocolAnthropic:"Anthropic 协议",protocolOpenAI:"OpenAI",protocolOpenAIChat:"OpenAI Chat",protocolOpenAIResponses:"OpenAI Responses",protocolHint:{anthropic:"Anthropic Messages API 协议(/v1/messages)","openai-auto":"OpenAI 协议(支持 Chat Completions 和 Responses API)。请确保路径以 /v1/chat/completions 或 /v1/responses 结尾。","openai-chat":"OpenAI Chat Completions API 协议(/v1/chat/completions)","openai-responses":"OpenAI Responses API 协议(/v1/responses)"},actions:{saveRoutes:"保存路由"},routing:{selectTarget:"请选择目标 Provider:模型"},claudeValidation:{title:"Claude Code 请求校验防护(实验特性)",description:"开启后,仅允许符合 Claude Code 协议的 /anthropic 请求;不合规请求会直接返回 430。",toggleLabel:"启用校验",statusEnabled:"已启用 Claude Code 校验",statusDisabled:"当前未启用(默认)"},toast:{routesSaved:"模型路由已更新。",routesSaveFailure:"保存模型路由失败:{{message}}",presetSaved:'已保存模板 "{{name}}"。',presetSaveFailure:"保存模板失败:{{message}}",presetApplySuccess:'已应用模板 "{{name}}"。',presetApplyFailure:"应用模板失败:{{message}}",presetDeleteSuccess:'模板 "{{name}}" 已删除。',presetDeleteFailure:"删除模板失败:{{message}}",claudeValidationEnabled:"Claude Code 请求校验防护(实验特性)已启用。",claudeValidationDisabled:"Claude Code 请求校验防护(实验特性)已关闭。",claudeValidationFailure:"更新 Claude 校验防护状态失败:{{message}}"},presets:{title:"路由模板",description:"保存当前 Anthropic 路由映射,便于在不同 Provider 方案之间快速切换。",namePlaceholder:"输入模板名称,例如 fox",save:"保存模板",saving:"保存中...",empty:"尚未保存任何模板。",apply:"应用",applying:"应用中...",delete:"删除",deleting:"删除中...",rulesCount:"{{count}} 条规则",noRules:"空模板",previewTooltip:"悬停查看路由规则",diffTitle:"应用模板确认",diffDescription:'以下路由将被替换为模板 "{{name}}" 的配置:',diffAdded:"新增",diffRemoved:"移除",diffChanged:"变更",diffConfirm:"确认应用",diffEmpty:"模板与当前配置相同,无需变更。"},validation:{presetName:"请输入模板名称。",presetDuplicate:"模板 {{name}} 已存在,请使用其他名称。"},confirm:{deletePreset:'确定要删除模板 "{{name}}" 吗?'}},events:{title:"安全事件",description:"查看校验防护与系统检测记录,及时发现异常访问。",filters:{title:"筛选条件",allLevels:"全部严重级别",typePlaceholder:"按事件类型过滤(可留空)"},actions:{newest:"最新",older:"更早"},levels:{info:"提示",warn:"警告",error:"错误"},empty:{title:"暂无事件记录",subtitle:"当前没有可用的安全事件。"},details:"查看详情",defaultTitle:"未命名事件",defaultMessage:"未提供详细描述。",toast:{loadFailure:"加载事件失败:{{message}}"}},settings:{title:"系统设置",description:"调整网关端口、日志策略及其他运行参数。",toast:{loadFailure:"配置加载失败:{{message}}",saveSuccess:"系统配置已更新。",saveFailure:"保存失败:{{message}}",protocolRestartRequired:"配置已保存!请执行 cc-gw restart --daemon 重启服务使协议配置生效",copySuccess:"配置文件路径已复制到剪贴板。",copyFailure:"复制失败:{{message}}",cleanupSuccess:"已删除 {{count}} 条历史日志。",cleanupNone:"没有需要删除的日志。",cleanupFailure:"清理失败:{{message}}",clearAllSuccess:"日志已清空(请求 {{logs}} 条,统计 {{metrics}} 条)。",clearAllFailure:"清空失败:{{message}}",missingConfig:"未能加载配置,请刷新或稍后再试。",authLoadFailure:"安全配置加载失败:{{message}}"},sections:{basics:"基础配置",routing:"模型路由",configFile:"配置文件",cleanup:"日志清理",security:"访问安全",protocol:"协议配置",jump:"跳转到"},fields:{port:"监听端口",host:"监听地址(可选)",hostPlaceholder:"默认 127.0.0.1",retention:"日志保留天数",bodyLimit:"请求体大小上限 (MB)",bodyLimitHint:"默认 10 MB;如 Claude Code 的 /compact 遇到 413,可适当调大。",defaults:"默认模型配置",storeRequestPayloads:"保存请求内容",storeRequestPayloadsHint:"开启后会在日志数据库中保留完整请求原文,便于排查;如含敏感信息可关闭。",storeResponsePayloads:"保存响应内容",storeResponsePayloadsHint:"开启后会记录模型返回的数据(含流式片段);关闭可降低磁盘与隐私风险。",logLevel:"日志级别",logLevelOption:{fatal:"致命 (fatal)",error:"错误 (error)",warn:"警告 (warn)",info:"信息 (info)",debug:"调试 (debug)",trace:"跟踪 (trace)"},requestLogging:"输出访问日志",requestLoggingHint:"控制是否在终端打印“incoming request …”日志,方便观察访问来源。",responseLogging:"输出响应日志",responseLoggingHint:"控制是否输出“request completed …”日志(含状态码与耗时),关闭后终端更安静。",enableRoutingFallback:"启用模型回退策略",enableRoutingFallbackHint:"无匹配模型时自动落到首个可用模型。默认关闭,建议仅在明确需要时开启。"},auth:{description:"开启 Web UI 登录后,所有管理接口仅对已登录用户开放,模型代理端点仍保持兼容。",enable:"启用 Web UI 登录保护",enableHint:"推荐在多人共用或生产环境中开启,访问 /ui 与 /api/* 将需要先登录。",username:"登录用户名",usernamePlaceholder:"设置用于登录的用户名",password:"登录密码",passwordPlaceholder:"至少 6 位字符",confirmPassword:"确认密码",confirmPasswordPlaceholder:"再次输入登录密码",status:"当前状态",statusEnabled:"已启用登录保护",statusDisabled:"未启用登录保护",passwordHintRequired:"首次启用或修改用户名时必须设置新密码(不少于 6 位)。",passwordHintOptional:"如需更新密码可填写新值,留空则沿用旧密码。",actions:{save:"保存安全设置"},toast:{success:"安全设置已更新。",failure:"保存失败:{{message}}"},validation:{username:"请填写用户名",minLength:"密码至少需要 6 位字符",passwordRequired:"请设置登录密码",confirmMismatch:"两次输入的密码不一致"}},protocol:{description:"配置 HTTP 和 HTTPS 服务端口,默认同时启用两个协议",restartWarning:"⚠️ 修改协议配置后需要重启服务才能生效",restartHint:"保存配置后,请执行以下命令重启服务:",restartTip:"💡 提示:端口、协议启用状态、证书路径需要重启;Provider 和路由配置支持热加载无需重启",http:{enable:"启用 HTTP",hint:"标准 HTTP 协议,适用于本地开发和内网环境",port:"HTTP 端口",host:"HTTP 主机地址"},https:{enable:"启用 HTTPS",hint:"HTTPS 加密协议",port:"HTTPS 端口",host:"HTTPS 主机地址",keyPath:"证书私钥路径",certPath:"证书文件路径",caPath:"CA 证书路径 (可选)",warning:"⚠️ 关于 HTTPS 证书",invalidCert:"自签名证书无效:",invalidCertDetail:"Claude Code 和大多数 AI 工具无法信任自签名证书,会导致连接失败。",recommended:"推荐方案:",recommendedDetail:"本地开发环境建议使用 HTTP 协议(127.0.0.1 本地访问非常安全)。",tip:"💡 如需 HTTPS,请使用受信任 CA(如 Let's Encrypt)签发的正式证书,或配置反向代理(如 Nginx/Caddy)处理 HTTPS。"}},validation:{port:"请输入 1-65535 之间的端口号",retention:"日志保留天数需为 1-365 之间的数字",bodyLimit:"请求体大小需在 1-2048 MB 之间",routePair:"请填写完整的来源模型与目标模型配置。",routeDuplicate:"模型 {{model}} 已存在映射,请勿重复配置。"},defaults:{completion:"对话:{{model}}",reasoning:"推理:{{model}}",background:"后台:{{model}}",none:"未设置默认模型"},routing:{title:"模型路由映射",description:"为 Claude Code 发起的模型请求指定实际 Provider 与模型 ID(如将 claude 系列映射至 Kimi)。如需禁用映射,可留空或移除。",titleByEndpoint:"{{endpoint}} 路由配置",descriptionByEndpoint:{anthropic:"当 Claude Code 通过 /anthropic 端点请求特定模型时,将根据此映射选择目标 Provider 与模型。",openai:"当 Codex 通过 /openai 端点请求特定模型时,将根据此映射选择目标 Provider 与模型。"},wildcardHint:"来源模型支持使用 * 通配符(如 claude-*),匹配度更高的规则优先;若目标写成 providerId:*,会将请求里的模型名原样转发给对应 Provider。",add:"新增映射",empty:"尚未配置映射,系统将使用默认模型策略。",source:"来源模型",target:"目标 Provider:模型",sourceLabel:"来源模型",sourcePlaceholder:"如 claude-sonnet-4-5-20250929",targetLabel:"目标 Provider:模型",targetPlaceholder:"如 kimi:kimi-k2-0905-preview",customTargetOption:"自定义目标…",providerPassthroughOption:"{{provider}} · 透传原始模型 (*)",remove:"移除",suggested:"常用 Anthropic 模型"},file:{description:"当前配置存储在本地文件,可通过编辑该文件进行离线修改。",unknown:"未知路径"},cleanup:{description:"立即清理早于当前保留天数的日志记录。",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:[`📝 **编辑配置文件**:
221
+ `+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Sr(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&Wi.assertOptions(r,{silentJSONParsing:Mt.transitional(Mt.boolean),forcedJSONParsing:Mt.transitional(Mt.boolean),clarifyTimeoutError:Mt.transitional(Mt.boolean)},!1),o!=null&&(T.isFunction(o)?n.paramsSerializer={serialize:o}:Wi.assertOptions(o,{encode:Mt.function,serialize:Mt.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Wi.assertOptions(n,{baseUrl:Mt.spelling("baseURL"),withXsrfToken:Mt.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&T.merge(s.common,s[n.method]);s&&T.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),n.headers=Ze.concat(i,s);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let c,d=0,f;if(!l){const g=[kh.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 v=n;for(;d<f;){const g=a[d++],m=a[d++];try{v=g(v)}catch(x){m.call(this,x);break}}try{c=kh.call(this,v)}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=Sr(this.defaults,t);const n=h0(t.baseURL,t.url,t.allowAbsoluteUrls);return u0(n,t.params,t.paramsSerializer)}};T.forEach(["delete","get","head","options"],function(t){hr.prototype[t]=function(n,r){return this.request(Sr(r||{},{method:t,url:n,data:(r||{}).data}))}});T.forEach(["post","put","patch"],function(t){function n(r){return function(s,i,a){return this.request(Sr(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}hr.prototype[t]=n(),hr.prototype[t+"Form"]=n(!0)});let hO=class w0{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{r.subscribe(a),s=a}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s,i,a){r.reason||(r.reason=new Mo(s,i,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 w0(function(o){t=o}),cancel:t}}};function mO(e){return function(n){return e.apply(null,n)}}function gO(e){return T.isObject(e)&&e.isAxiosError===!0}const Rc={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(Rc).forEach(([e,t])=>{Rc[t]=e});function x0(e){const t=new hr(e),n=Xw(hr.prototype.request,t);return T.extend(n,hr.prototype,t,{allOwnKeys:!0}),T.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return x0(Sr(e,o))},n}const me=x0(Js);me.Axios=hr;me.CanceledError=Mo;me.CancelToken=hO;me.isCancel=f0;me.VERSION=v0;me.toFormData=gl;me.AxiosError=V;me.Cancel=me.CanceledError;me.all=function(t){return Promise.all(t)};me.spread=mO;me.isAxiosError=gO;me.mergeConfig=Sr;me.AxiosHeaders=Ze;me.formToJSON=e=>d0(T.isHTMLForm(e)?new FormData(e):e);me.getAdapter=y0.getAdapter;me.HttpStatusCode=Rc;me.default=me;const{Axios:D2,AxiosError:F2,CanceledError:j2,isCancel:U2,CancelToken:z2,VERSION:$2,all:B2,Cancel:H2,isAxiosError:V2,spread:K2,toFormData:W2,AxiosHeaders:q2,HttpStatusCode:G2,formToJSON:Q2,getAdapter:Y2,mergeConfig:X2}=me,kt=me.create({baseURL:"/",timeout:15e3,withCredentials:!0});kt.interceptors.response.use(e=>e,e=>Promise.reject(e));function cu(e){var t,n,r;if(me.isAxiosError(e)){const o=(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:o,code:String(o??"unknown")}}return{message:e instanceof Error?e.message:"请求失败,请稍后再试"}}const J2={list:async()=>(await kt.get("/api/custom-endpoints")).data,create:async e=>(await kt.post("/api/custom-endpoints",e)).data,update:async(e,t)=>(await kt.put(`/api/custom-endpoints/${e}`,t)).data,delete:async e=>(await kt.delete(`/api/custom-endpoints/${e}`)).data},Z2={list:async e=>(await kt.get("/api/events",{params:{limit:e==null?void 0:e.limit,cursor:e==null?void 0:e.cursor,level:e==null?void 0:e.level,type:e==null?void 0:e.type}})).data},S0=p.createContext(void 0);function yO({children:e}){const t=p.useRef(!0),[n,r]=p.useState({loading:!0,authEnabled:!1,isAuthenticated:!0,username:void 0,error:null}),o=p.useCallback(u=>{t.current&&r(u)},[]),s=p.useCallback(async()=>{o(u=>({...u,loading:!0,error:null}));try{const{data:u}=await kt.get("/auth/session");o(()=>({loading:!1,authEnabled:!!u.authEnabled,isAuthenticated:!u.authEnabled||!!u.authenticated,username:u.username??void 0,error:null}))}catch(u){const c=cu(u);o(()=>({loading:!1,authEnabled:!1,isAuthenticated:!0,username:void 0,error:c.message}))}},[o]),i=p.useCallback(async(u,c)=>{o(d=>({...d,loading:!0,error:null}));try{await kt.post("/auth/login",{username:u,password:c}),await s()}catch(d){const f=cu(d);throw o(v=>({...v,loading:!1,error:f.message,isAuthenticated:!1})),f}},[s,o]),a=p.useCallback(async()=>{o(u=>({...u,loading:!0}));try{await kt.post("/auth/logout")}catch(u){const c=cu(u);o(d=>({...d,error:c.message}))}finally{await s()}},[s,o]);p.useEffect(()=>{t.current=!0,s();const u=kt.interceptors.response.use(c=>c,async c=>{var d;return((d=c==null?void 0:c.response)==null?void 0:d.status)===401&&await s(),Promise.reject(c)});return()=>{t.current=!1,kt.interceptors.response.eject(u)}},[s]);const l=p.useMemo(()=>({...n,refresh:s,login:i,logout:a}),[n,s,i,a]);return C.jsx(S0.Provider,{value:l,children:e})}function C0(){const e=p.useContext(S0);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const b0=[{to:"/",icon:HC,labelKey:"nav.dashboard"},{to:"/logs",icon:GC,labelKey:"nav.logs"},{to:"/models",icon:XC,labelKey:"nav.models"},{to:"/events",icon:BC,labelKey:"nav.events"},{to:"/api-keys",icon:QC,labelKey:"nav.apiKeys"},{to:"/settings",icon:tb,labelKey:"nav.settings"},{to:"/help",icon:JC,labelKey:"nav.help"},{to:"/about",icon:qC,labelKey:"nav.about"}];function Rh({onNavigate:e}){const{t}=Er();return C.jsx("nav",{className:"flex h-full flex-col gap-1","aria-label":t("app.title"),children:b0.map(n=>{const r=n.icon;return C.jsx(Ty,{to:n.to,onClick:e,className:({isActive:o})=>et("group relative flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200",o?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-muted hover:text-foreground"),end:n.to==="/",title:t(n.labelKey),children:({isActive:o})=>C.jsxs(C.Fragment,{children:[o&&C.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-1 h-6 rounded-r-full bg-primary"}),C.jsx(r,{className:et("h-4 w-4 transition-colors",o?"text-primary":""),"aria-hidden":"true"}),C.jsx("span",{children:t(n.labelKey)})]})},n.to)})})}function vO({onNavigate:e}){const{t}=Er();return C.jsx(zT,{delayDuration:0,children:C.jsx("nav",{className:"flex h-full flex-col gap-1","aria-label":t("app.title"),children:b0.map(n=>{const r=n.icon;return C.jsxs($T,{children:[C.jsx(BT,{asChild:!0,children:C.jsx(Ty,{to:n.to,onClick:e,className:({isActive:o})=>et("group relative flex items-center justify-center rounded-lg p-2.5 transition-all duration-200",o?"bg-primary/10 text-primary":"text-muted-foreground hover:bg-muted hover:text-foreground"),end:n.to==="/",children:({isActive:o})=>C.jsxs(C.Fragment,{children:[o&&C.jsx("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-1 h-5 rounded-r-full bg-primary"}),C.jsx(r,{className:et("h-5 w-5",o?"text-primary":""),"aria-hidden":"true"})]})})}),C.jsx(Yw,{side:"right",children:t(n.labelKey)})]},n.to)})})})}function wO(){const{t:e}=Er(),t=Yn(),[n,r]=p.useState(!1),{authEnabled:o,username:s,logout:i}=C0(),[a,l]=p.useState(!1);p.useEffect(()=>{r(!1)},[t.pathname]);const u=async()=>{if(!a){l(!0);try{await i()}finally{l(!1)}}};return C.jsxs("div",{className:"relative flex min-h-screen bg-background",children:[C.jsx("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:m-4 focus:rounded-md focus:bg-primary focus:px-4 focus:py-2 focus:text-primary-foreground",children:e("app.skipToContent")}),C.jsxs("aside",{className:"hidden w-16 flex-col border-r bg-card lg:flex xl:hidden",children:[C.jsx("div",{className:"flex h-14 items-center justify-center border-b",children:C.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-primary to-primary/80 text-xs font-bold text-primary-foreground shadow-sm",children:"GW"})}),C.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:C.jsx(vO,{})})]}),C.jsxs("aside",{className:"hidden w-56 flex-col border-r bg-card xl:flex",children:[C.jsxs("div",{className:"flex h-14 items-center gap-3 border-b px-4",children:[C.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-primary to-primary/80 text-xs font-bold text-primary-foreground shadow-sm",children:"GW"}),C.jsx("span",{className:"font-semibold text-foreground",children:e("app.title")})]}),C.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:C.jsx(Rh,{})})]}),C.jsxs("div",{className:"flex flex-1 flex-col",children:[C.jsxs("header",{className:"sticky top-0 z-30 flex h-14 items-center justify-between gap-4 border-b bg-card px-4 lg:px-6",children:[C.jsxs("div",{className:"flex items-center gap-3 lg:hidden",children:[C.jsx(eo,{variant:"ghost",size:"icon",onClick:()=>r(c=>!c),"aria-label":e(n?"common.actions.closeNavigation":"common.actions.openNavigation"),"aria-expanded":n,"aria-controls":"mobile-nav",children:n?C.jsx(Tp,{className:"h-5 w-5"}):C.jsx(ZC,{className:"h-5 w-5"})}),C.jsx("span",{className:"font-semibold",children:e("app.title")})]}),C.jsx("div",{className:"hidden lg:block"}),C.jsxs("div",{className:"flex items-center gap-2",children:[o&&s&&C.jsx("span",{className:"hidden text-sm text-muted-foreground sm:inline",children:e("login.status",{username:s})}),o&&C.jsx(eo,{variant:"ghost",size:"sm",onClick:()=>void u(),disabled:a,children:e(a?"common.actions.loading":"common.actions.logout")}),C.jsx(gT,{}),C.jsx(mT,{})]})]}),C.jsx("main",{id:"main-content",role:"main",tabIndex:-1,className:"flex-1 overflow-y-auto",children:C.jsx("div",{className:"container mx-auto max-w-7xl px-4 py-6 lg:px-8 lg:py-8 animate-in fade-in slide-in-from-bottom-4 duration-300",children:C.jsx(iC,{})})})]}),n&&C.jsxs("div",{className:"fixed inset-0 z-40 lg:hidden",role:"dialog","aria-modal":"true",children:[C.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm",onClick:()=>r(!1)}),C.jsxs("div",{id:"mobile-nav",className:"fixed inset-y-0 left-0 w-72 border-r bg-card p-6 shadow-lg animate-in slide-in-from-left",children:[C.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[C.jsx("span",{className:"font-semibold",children:e("app.title")}),C.jsx(eo,{variant:"ghost",size:"icon",onClick:()=>r(!1),"aria-label":e("common.actions.closeNavigation"),children:C.jsx(Tp,{className:"h-5 w-5"})})]}),C.jsx(Rh,{onNavigate:()=>r(!1)})]})]})]})}var vl=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(){}},xO={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},En,Ic,qh,SO=(qh=class{constructor(){Z(this,En,xO);Z(this,Ic,!1)}setTimeoutProvider(e){B(this,En,e)}setTimeout(e,t){return A(this,En).setTimeout(e,t)}clearTimeout(e){A(this,En).clearTimeout(e)}setInterval(e,t){return A(this,En).setInterval(e,t)}clearInterval(e){A(this,En).clearInterval(e)}},En=new WeakMap,Ic=new WeakMap,qh),Tc=new SO;function CO(e){setTimeout(e,0)}var wl=typeof window>"u"||"Deno"in globalThis;function xt(){}function bO(e,t){return typeof e=="function"?e(t):e}function EO(e){return typeof e=="number"&&e>=0&&e!==1/0}function kO(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ac(e,t){return typeof e=="function"?e(t):e}function PO(e,t){return typeof e=="function"?e(t):e}function Th(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:s,queryKey:i,stale:a}=e;if(i){if(r){if(t.queryHash!==nf(i,t.options))return!1}else if(!Is(t.queryKey,i))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||o&&o!==t.state.fetchStatus||s&&!s(t))}function Ah(e,t){const{exact:n,status:r,predicate:o,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(Ls(t.options.mutationKey)!==Ls(s))return!1}else if(!Is(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function nf(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ls)(e)}function Ls(e){return JSON.stringify(e,(t,n)=>Oc(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Is(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Is(e[n],t[n])):!1}var RO=Object.prototype.hasOwnProperty;function E0(e,t){if(e===t)return e;const n=Oh(e)&&Oh(t);if(!n&&!(Oc(e)&&Oc(t)))return t;const o=(n?e:Object.keys(e)).length,s=n?t:Object.keys(t),i=s.length,a=n?new Array(i):{};let l=0;for(let u=0;u<i;u++){const c=n?u:s[u],d=e[c],f=t[c];if(d===f){a[c]=d,(n?u<o:RO.call(e,c))&&l++;continue}if(d===null||f===null||typeof d!="object"||typeof f!="object"){a[c]=f;continue}const v=E0(d,f);a[c]=v,v===d&&l++}return o===i&&l===o?e:a}function eN(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 Oh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Oc(e){if(!Nh(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Nh(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Nh(e){return Object.prototype.toString.call(e)==="[object Object]"}function TO(e){return new Promise(t=>{Tc.setTimeout(t,e)})}function AO(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?E0(e,t):t}function tN(e){return e}function OO(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function NO(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var rf=Symbol();function k0(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===rf?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function nN(e,t){return typeof e=="function"?e(...t):!!e}var sr,kn,ro,Gh,LO=(Gh=class extends vl{constructor(){super();Z(this,sr);Z(this,kn);Z(this,ro);B(this,ro,t=>{if(!wl&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){A(this,kn)||this.setEventListener(A(this,ro))}onUnsubscribe(){var t;this.hasListeners()||((t=A(this,kn))==null||t.call(this),B(this,kn,void 0))}setEventListener(t){var n;B(this,ro,t),(n=A(this,kn))==null||n.call(this),B(this,kn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){A(this,sr)!==t&&(B(this,sr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof A(this,sr)=="boolean"?A(this,sr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},sr=new WeakMap,kn=new WeakMap,ro=new WeakMap,Gh),P0=new LO;function IO(){let e,t;const n=new Promise((o,s)=>{e=o,t=s});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}var MO=CO;function _O(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=MO;const s=a=>{t?e.push(a):o(()=>{n(a)})},i=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||i()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Be=_O(),oo,Pn,so,Qh,DO=(Qh=class extends vl{constructor(){super();Z(this,oo,!0);Z(this,Pn);Z(this,so);B(this,so,t=>{if(!wl&&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(){A(this,Pn)||this.setEventListener(A(this,so))}onUnsubscribe(){var t;this.hasListeners()||((t=A(this,Pn))==null||t.call(this),B(this,Pn,void 0))}setEventListener(t){var n;B(this,so,t),(n=A(this,Pn))==null||n.call(this),B(this,Pn,t(this.setOnline.bind(this)))}setOnline(t){A(this,oo)!==t&&(B(this,oo,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return A(this,oo)}},oo=new WeakMap,Pn=new WeakMap,so=new WeakMap,Qh),Oa=new DO;function FO(e){return Math.min(1e3*2**e,3e4)}function R0(e){return(e??"online")==="online"?Oa.isOnline():!0}var Nc=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function T0(e){let t=!1,n=0,r;const o=IO(),s=()=>o.status!=="pending",i=m=>{var x;if(!s()){const y=new Nc(m);f(y),(x=e.onCancel)==null||x.call(e,y)}},a=()=>{t=!0},l=()=>{t=!1},u=()=>P0.isFocused()&&(e.networkMode==="always"||Oa.isOnline())&&e.canRun(),c=()=>R0(e.networkMode)&&e.canRun(),d=m=>{s()||(r==null||r(),o.resolve(m))},f=m=>{s()||(r==null||r(),o.reject(m))},v=()=>new Promise(m=>{var x;r=y=>{(s()||u())&&m(y)},(x=e.onPause)==null||x.call(e)}).then(()=>{var m;r=void 0,s()||(m=e.onContinue)==null||m.call(e)}),g=()=>{if(s())return;let m;const x=n===0?e.initialPromise:void 0;try{m=x??e.fn()}catch(y){m=Promise.reject(y)}Promise.resolve(m).then(d).catch(y=>{var P;if(s())return;const h=e.retry??(wl?0:3),w=e.retryDelay??FO,S=typeof w=="function"?w(n,y):w,b=h===!0||typeof h=="number"&&n<h||typeof h=="function"&&h(n,y);if(t||!b){f(y);return}n++,(P=e.onFail)==null||P.call(e,n,y),TO(S).then(()=>u()?void 0:v()).then(()=>{t?f(y):g()})})};return{promise:o,status:()=>o.status,cancel:i,continue:()=>(r==null||r(),o),cancelRetry:a,continueRetry:l,canStart:c,start:()=>(c()?g():v().then(g),o)}}var ir,Yh,A0=(Yh=class{constructor(){Z(this,ir)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),EO(this.gcTime)&&B(this,ir,Tc.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(wl?1/0:5*60*1e3))}clearGcTimeout(){A(this,ir)&&(Tc.clearTimeout(A(this,ir)),B(this,ir,void 0))}},ir=new WeakMap,Yh),ar,io,ct,lr,Ce,_s,ur,St,Qt,Xh,jO=(Xh=class extends A0{constructor(t){super();Z(this,St);Z(this,ar);Z(this,io);Z(this,ct);Z(this,lr);Z(this,Ce);Z(this,_s);Z(this,ur);B(this,ur,!1),B(this,_s,t.defaultOptions),this.setOptions(t.options),this.observers=[],B(this,lr,t.client),B(this,ct,A(this,lr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,B(this,ar,Lh(this.options)),this.state=t.state??A(this,ar),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=A(this,Ce))==null?void 0:t.promise}setOptions(t){if(this.options={...A(this,_s),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Lh(this.options);n.data!==void 0&&(this.setData(n.data,{updatedAt:n.dataUpdatedAt,manual:!0}),B(this,ar,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&A(this,ct).remove(this)}setData(t,n){const r=AO(this.state.data,t,this.options);return Ie(this,St,Qt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Ie(this,St,Qt).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=A(this,Ce))==null?void 0:r.promise;return(o=A(this,Ce))==null||o.cancel(t),n?n.then(xt).catch(xt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(A(this,ar))}isActive(){return this.observers.some(t=>PO(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===rf||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ac(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:!kO(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=A(this,Ce))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=A(this,Ce))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),A(this,ct).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(A(this,Ce)&&(A(this,ur)?A(this,Ce).cancel({revert:!0}):A(this,Ce).cancelRetry()),this.scheduleGc()),A(this,ct).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ie(this,St,Qt).call(this,{type:"invalidate"})}async fetch(t,n){var l,u,c,d,f,v,g,m,x,y,h,w;if(this.state.fetchStatus!=="idle"&&((l=A(this,Ce))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(A(this,Ce))return A(this,Ce).continueRetry(),A(this,Ce).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(b=>b.options.queryFn);S&&this.setOptions(S.options)}const r=new AbortController,o=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(B(this,ur,!0),r.signal)})},s=()=>{const S=k0(this.options,n),P=(()=>{const E={client:A(this,lr),queryKey:this.queryKey,meta:this.meta};return o(E),E})();return B(this,ur,!1),this.options.persister?this.options.persister(S,P,this):S(P)},a=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:A(this,lr),state:this.state,fetchFn:s};return o(S),S})();(u=this.options.behavior)==null||u.onFetch(a,this),B(this,io,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=a.fetchOptions)==null?void 0:c.meta))&&Ie(this,St,Qt).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),B(this,Ce,T0({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:S=>{S instanceof Nc&&S.revert&&this.setState({...A(this,io),fetchStatus:"idle"}),r.abort()},onFail:(S,b)=>{Ie(this,St,Qt).call(this,{type:"failed",failureCount:S,error:b})},onPause:()=>{Ie(this,St,Qt).call(this,{type:"pause"})},onContinue:()=>{Ie(this,St,Qt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const S=await A(this,Ce).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(v=(f=A(this,ct).config).onSuccess)==null||v.call(f,S,this),(m=(g=A(this,ct).config).onSettled)==null||m.call(g,S,this.state.error,this),S}catch(S){if(S instanceof Nc){if(S.silent)return A(this,Ce).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw Ie(this,St,Qt).call(this,{type:"error",error:S}),(y=(x=A(this,ct).config).onError)==null||y.call(x,S,this),(w=(h=A(this,ct).config).onSettled)==null||w.call(h,this.state.data,S,this),S}finally{this.scheduleGc()}}},ar=new WeakMap,io=new WeakMap,ct=new WeakMap,lr=new WeakMap,Ce=new WeakMap,_s=new WeakMap,ur=new WeakMap,St=new WeakSet,Qt=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,...UO(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...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 B(this,io,t.manual?o:void 0),o;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Be.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),A(this,ct).notify({query:this,type:"updated",action:t})})},Xh);function UO(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:R0(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Lh(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 Ih(e){return{onFetch:(t,n)=>{var c,d,f,v,g;const r=t.options,o=(f=(d=(c=t.fetchOptions)==null?void 0:c.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,s=((v=t.state.data)==null?void 0:v.pages)||[],i=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let m=!1;const x=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},y=k0(t.options,t.fetchOptions),h=async(w,S,b)=>{if(m)return Promise.reject();if(S==null&&w.pages.length)return Promise.resolve(w);const E=(()=>{const j={client:t.client,queryKey:t.queryKey,pageParam:S,direction:b?"backward":"forward",meta:t.options.meta};return x(j),j})(),R=await y(E),{maxPages:I}=t.options,N=b?NO:OO;return{pages:N(w.pages,R,I),pageParams:N(w.pageParams,S,I)}};if(o&&s.length){const w=o==="backward",S=w?zO:Mh,b={pages:s,pageParams:i},P=S(r,b);a=await h(b,P,w)}else{const w=e??s.length;do{const S=l===0?i[0]??r.initialPageParam:Mh(r,a);if(l>0&&S==null)break;a=await h(a,S),l++}while(l<w)}return a};t.options.persister?t.fetchFn=()=>{var m,x;return(x=(m=t.options).persister)==null?void 0:x.call(m,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function Mh(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 zO(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 Ds,Dt,ze,cr,Ft,wn,Jh,$O=(Jh=class extends A0{constructor(t){super();Z(this,Ft);Z(this,Ds);Z(this,Dt);Z(this,ze);Z(this,cr);B(this,Ds,t.client),this.mutationId=t.mutationId,B(this,ze,t.mutationCache),B(this,Dt,[]),this.state=t.state||BO(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){A(this,Dt).includes(t)||(A(this,Dt).push(t),this.clearGcTimeout(),A(this,ze).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){B(this,Dt,A(this,Dt).filter(n=>n!==t)),this.scheduleGc(),A(this,ze).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){A(this,Dt).length||(this.state.status==="pending"?this.scheduleGc():A(this,ze).remove(this))}continue(){var t;return((t=A(this,cr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,a,l,u,c,d,f,v,g,m,x,y,h,w,S,b,P,E,R,I;const n=()=>{Ie(this,Ft,wn).call(this,{type:"continue"})},r={client:A(this,Ds),meta:this.options.meta,mutationKey:this.options.mutationKey};B(this,cr,T0({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(N,j)=>{Ie(this,Ft,wn).call(this,{type:"failed",failureCount:N,error:j})},onPause:()=>{Ie(this,Ft,wn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>A(this,ze).canRun(this)}));const o=this.state.status==="pending",s=!A(this,cr).canStart();try{if(o)n();else{Ie(this,Ft,wn).call(this,{type:"pending",variables:t,isPaused:s}),await((a=(i=A(this,ze).config).onMutate)==null?void 0:a.call(i,t,this,r));const j=await((u=(l=this.options).onMutate)==null?void 0:u.call(l,t,r));j!==this.state.context&&Ie(this,Ft,wn).call(this,{type:"pending",context:j,variables:t,isPaused:s})}const N=await A(this,cr).start();return await((d=(c=A(this,ze).config).onSuccess)==null?void 0:d.call(c,N,t,this.state.context,this,r)),await((v=(f=this.options).onSuccess)==null?void 0:v.call(f,N,t,this.state.context,r)),await((m=(g=A(this,ze).config).onSettled)==null?void 0:m.call(g,N,null,this.state.variables,this.state.context,this,r)),await((y=(x=this.options).onSettled)==null?void 0:y.call(x,N,null,t,this.state.context,r)),Ie(this,Ft,wn).call(this,{type:"success",data:N}),N}catch(N){try{throw await((w=(h=A(this,ze).config).onError)==null?void 0:w.call(h,N,t,this.state.context,this,r)),await((b=(S=this.options).onError)==null?void 0:b.call(S,N,t,this.state.context,r)),await((E=(P=A(this,ze).config).onSettled)==null?void 0:E.call(P,void 0,N,this.state.variables,this.state.context,this,r)),await((I=(R=this.options).onSettled)==null?void 0:I.call(R,void 0,N,t,this.state.context,r)),N}finally{Ie(this,Ft,wn).call(this,{type:"error",error:N})}}finally{A(this,ze).runNext(this)}}},Ds=new WeakMap,Dt=new WeakMap,ze=new WeakMap,cr=new WeakMap,Ft=new WeakSet,wn=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),Be.batch(()=>{A(this,Dt).forEach(r=>{r.onMutationUpdate(t)}),A(this,ze).notify({mutation:this,type:"updated",action:t})})},Jh);function BO(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Zt,Ct,Fs,Zh,HO=(Zh=class extends vl{constructor(t={}){super();Z(this,Zt);Z(this,Ct);Z(this,Fs);this.config=t,B(this,Zt,new Set),B(this,Ct,new Map),B(this,Fs,0)}build(t,n,r){const o=new $O({client:t,mutationCache:this,mutationId:++ei(this,Fs)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){A(this,Zt).add(t);const n=Ri(t);if(typeof n=="string"){const r=A(this,Ct).get(n);r?r.push(t):A(this,Ct).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(A(this,Zt).delete(t)){const n=Ri(t);if(typeof n=="string"){const r=A(this,Ct).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&A(this,Ct).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ri(t);if(typeof n=="string"){const r=A(this,Ct).get(n),o=r==null?void 0:r.find(s=>s.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=Ri(t);if(typeof n=="string"){const o=(r=A(this,Ct).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Be.batch(()=>{A(this,Zt).forEach(t=>{this.notify({type:"removed",mutation:t})}),A(this,Zt).clear(),A(this,Ct).clear()})}getAll(){return Array.from(A(this,Zt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ah(n,r))}findAll(t={}){return this.getAll().filter(n=>Ah(t,n))}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Be.batch(()=>Promise.all(t.map(n=>n.continue().catch(xt))))}},Zt=new WeakMap,Ct=new WeakMap,Fs=new WeakMap,Zh);function Ri(e){var t;return(t=e.options.scope)==null?void 0:t.id}var jt,em,VO=(em=class extends vl{constructor(t={}){super();Z(this,jt);this.config=t,B(this,jt,new Map)}build(t,n,r){const o=n.queryKey,s=n.queryHash??nf(o,n);let i=this.get(s);return i||(i=new jO({client:t,queryKey:o,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(i)),i}add(t){A(this,jt).has(t.queryHash)||(A(this,jt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=A(this,jt).get(t.queryHash);n&&(t.destroy(),n===t&&A(this,jt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Be.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return A(this,jt).get(t)}getAll(){return[...A(this,jt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Th(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Th(t,r)):n}notify(t){Be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Be.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Be.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},jt=new WeakMap,em),pe,Rn,Tn,ao,lo,An,uo,co,tm,KO=(tm=class{constructor(e={}){Z(this,pe);Z(this,Rn);Z(this,Tn);Z(this,ao);Z(this,lo);Z(this,An);Z(this,uo);Z(this,co);B(this,pe,e.queryCache||new VO),B(this,Rn,e.mutationCache||new HO),B(this,Tn,e.defaultOptions||{}),B(this,ao,new Map),B(this,lo,new Map),B(this,An,0)}mount(){ei(this,An)._++,A(this,An)===1&&(B(this,uo,P0.subscribe(async e=>{e&&(await this.resumePausedMutations(),A(this,pe).onFocus())})),B(this,co,Oa.subscribe(async e=>{e&&(await this.resumePausedMutations(),A(this,pe).onOnline())})))}unmount(){var e,t;ei(this,An)._--,A(this,An)===0&&((e=A(this,uo))==null||e.call(this),B(this,uo,void 0),(t=A(this,co))==null||t.call(this),B(this,co,void 0))}isFetching(e){return A(this,pe).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return A(this,Rn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=A(this,pe).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=A(this,pe).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ac(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return A(this,pe).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=A(this,pe).get(r.queryHash),s=o==null?void 0:o.state.data,i=bO(t,s);if(i!==void 0)return A(this,pe).build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Be.batch(()=>A(this,pe).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=A(this,pe).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=A(this,pe);Be.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=A(this,pe);return Be.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Be.batch(()=>A(this,pe).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(xt).catch(xt)}invalidateQueries(e,t={}){return Be.batch(()=>(A(this,pe).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=Be.batch(()=>A(this,pe).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let s=o.fetch(void 0,n);return n.throwOnError||(s=s.catch(xt)),o.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(xt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=A(this,pe).build(this,t);return n.isStaleByTime(Ac(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xt).catch(xt)}fetchInfiniteQuery(e){return e.behavior=Ih(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xt).catch(xt)}ensureInfiniteQueryData(e){return e.behavior=Ih(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Oa.isOnline()?A(this,Rn).resumePausedMutations():Promise.resolve()}getQueryCache(){return A(this,pe)}getMutationCache(){return A(this,Rn)}getDefaultOptions(){return A(this,Tn)}setDefaultOptions(e){B(this,Tn,e)}setQueryDefaults(e,t){A(this,ao).set(Ls(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...A(this,ao).values()],n={};return t.forEach(r=>{Is(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){A(this,lo).set(Ls(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...A(this,lo).values()],n={};return t.forEach(r=>{Is(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...A(this,Tn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=nf(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===rf&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...A(this,Tn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){A(this,pe).clear(),A(this,Rn).clear()}},pe=new WeakMap,Rn=new WeakMap,Tn=new WeakMap,ao=new WeakMap,lo=new WeakMap,An=new WeakMap,uo=new WeakMap,co=new WeakMap,tm),O0=p.createContext(void 0),rN=e=>{const t=p.useContext(O0);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},WO=({client:e,children:t})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),C.jsx(O0.Provider,{value:e,children:t}));const H=e=>typeof e=="string",Wo=()=>{let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n},_h=e=>e==null?"":""+e,qO=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},GO=/###/g,Dh=e=>e&&e.indexOf("###")>-1?e.replace(GO,"."):e,Fh=e=>!e||H(e),as=(e,t,n)=>{const r=H(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(Fh(e))return{};const s=Dh(r[o]);!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={},++o}return Fh(e)?{}:{obj:e,k:Dh(r[o])}},jh=(e,t,n)=>{const{obj:r,k:o}=as(e,t,Object);if(r!==void 0||t.length===1){r[o]=n;return}let s=t[t.length-1],i=t.slice(0,t.length-1),a=as(e,i,Object);for(;a.obj===void 0&&i.length;)s=`${i[i.length-1]}.${s}`,i=i.slice(0,i.length-1),a=as(e,i,Object),a&&a.obj&&typeof a.obj[`${a.k}.${s}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=n},QO=(e,t,n,r)=>{const{obj:o,k:s}=as(e,t,Object);o[s]=o[s]||[],o[s].push(n)},Na=(e,t)=>{const{obj:n,k:r}=as(e,t);if(n)return n[r]},YO=(e,t,n)=>{const r=Na(e,n);return r!==void 0?r:Na(t,n)},N0=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?H(e[r])||e[r]instanceof String||H(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):N0(e[r],t[r],n):e[r]=t[r]);return e},Mr=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var XO={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const JO=e=>H(e)?e.replace(/[&<>"'\/]/g,t=>XO[t]):e;class ZO{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 e2=[" ",",","?","!",";"],t2=new ZO(20),n2=(e,t,n)=>{t=t||"",n=n||"";const r=e2.filter(i=>t.indexOf(i)<0&&n.indexOf(i)<0);if(r.length===0)return!0;const o=t2.getRegExp(`(${r.map(i=>i==="?"?"\\?":i).join("|")})`);let s=!o.test(e);if(!s){const i=e.indexOf(n);i>0&&!o.test(e.substring(0,i))&&(s=!0)}return s},Lc=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 o=e;for(let s=0;s<r.length;){if(!o||typeof o!="object")return;let i,a="";for(let l=s;l<r.length;++l)if(l!==s&&(a+=n),a+=r[l],i=o[a],i!==void 0){if(["string","number","boolean"].indexOf(typeof i)>-1&&l<r.length-1)continue;s+=l-s+1;break}o=i}return o},La=e=>e&&e.replace("_","-"),r2={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 Ia{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||r2,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,o){return o&&!this.debug?null:(H(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Ia(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Ia(this.logger,t)}}var Bt=new Ia;class xl{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(n)||0;this.observers[r].set(n,o+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),o=1;o<n;o++)r[o-1]=arguments[o];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(i=>{let[a,l]=i;for(let u=0;u<l;u++)a(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(i=>{let[a,l]=i;for(let u=0;u<l;u++)a.apply(a,[t,...r])})}}class Uh extends xl{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 o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,i=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;t.indexOf(".")>-1?a=t.split("."):(a=[t,n],r&&(Array.isArray(r)?a.push(...r):H(r)&&s?a.push(...r.split(s)):a.push(r)));const l=Na(this.data,a);return!l&&!n&&!r&&t.indexOf(".")>-1&&(t=a[0],n=a[1],r=a.slice(2).join(".")),l||!i||!H(r)?l:Lc(this.data&&this.data[t]&&this.data[t][n],r,s)}addResource(t,n,r,o){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(i?r.split(i):r)),t.indexOf(".")>-1&&(a=t.split("."),o=n,n=a[1]),this.addNamespaces(n),jh(this.data,a,o),s.silent||this.emit("added",t,n,r,o)}addResources(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in r)(H(r[s])||Array.isArray(r[s]))&&this.addResource(t,n,s,r[s],{silent:!0});o.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,o,s){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),o=r,r=n,n=a[1]),this.addNamespaces(n);let l=Na(this.data,a)||{};i.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?N0(l,r,s):l={...l,...r},jh(this.data,a,l),i.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(o=>n[o]&&Object.keys(n[o]).length>0)}toJSON(){return this.data}}var L0={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(s=>{this.processors[s]&&(t=this.processors[s].process(t,n,r,o))}),t}};const zh={};class Ma extends xl{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),qO(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Bt.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 o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const i=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!n2(t,r,o);if(i&&!a){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:H(s)?[s]:s};const u=t.split(r);(r!==o||r===o&&this.options.ns.indexOf(u[0])>-1)&&(s=u.shift()),t=u.join(o)}return{key:t,namespaces:H(s)?[s]:s}}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 o=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:i,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 S=n.nsSeparator||this.options.nsSeparator;return o?{res:`${l}${S}${i}`,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${S}${i}`}return o?{res:i,usedKey:i,exactUsedKey:i,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:i}const d=this.resolve(t,n);let f=d&&d.res;const v=d&&d.usedKey||i,g=d&&d.exactUsedKey||i,m=Object.prototype.toString.apply(f),x=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,h=!this.i18nFormat||this.i18nFormat.handleAsObject,w=!H(f)&&typeof f!="boolean"&&typeof f!="number";if(h&&f&&w&&x.indexOf(m)<0&&!(H(y)&&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 S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(v,f,{...n,ns:a}):`key '${i} (${this.language})' returned an object instead of string.`;return o?(d.res=S,d.usedParams=this.getUsedParamsDetails(n),d):S}if(s){const S=Array.isArray(f),b=S?[]:{},P=S?g:v;for(const E in f)if(Object.prototype.hasOwnProperty.call(f,E)){const R=`${P}${s}${E}`;b[E]=this.translate(R,{...n,joinArrays:!1,ns:a}),b[E]===R&&(b[E]=f[E])}f=b}}else if(h&&H(y)&&Array.isArray(f))f=f.join(y),f&&(f=this.extendTranslation(f,t,n,r));else{let S=!1,b=!1;const P=n.count!==void 0&&!H(n.count),E=Ma.hasDefaultValue(n),R=P?this.pluralResolver.getSuffix(u,n.count,n):"",I=n.ordinal&&P?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",N=P&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),j=N&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${R}`]||n[`defaultValue${I}`]||n.defaultValue;!this.isValidLookup(f)&&E&&(S=!0,f=j),this.isValidLookup(f)||(b=!0,f=i);const W=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&b?void 0:f,$=E&&j!==f&&this.options.updateMissing;if(b||S||$){if(this.logger.log($?"updateKey":"missingKey",u,l,i,$?j:f),s){const k=this.resolve(i,{...n,keySeparator:!1});k&&k.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 J=[];const U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&U&&U[0])for(let k=0;k<U.length;k++)J.push(U[k]);else this.options.saveMissingTo==="all"?J=this.languageUtils.toResolveHierarchy(n.lng||this.language):J.push(n.lng||this.language);const Q=(k,O,M)=>{const z=E&&M!==f?M:W;this.options.missingKeyHandler?this.options.missingKeyHandler(k,l,O,z,$,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(k,l,O,z,$,n),this.emit("missingKey",k,l,O,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?J.forEach(k=>{const O=this.pluralResolver.getSuffixes(k,n);N&&n[`defaultValue${this.options.pluralSeparator}zero`]&&O.indexOf(`${this.options.pluralSeparator}zero`)<0&&O.push(`${this.options.pluralSeparator}zero`),O.forEach(M=>{Q([k],i+M,n[`defaultValue${M}`]||j)})}):Q(J,i,j))}f=this.extendTranslation(f,t,n,d,r),b&&f===i&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${i}`),(b||S)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${i}`:i,S?f:void 0):f=this.options.parseMissingKeyHandler(f))}return o?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}extendTranslation(t,n,r,o,s){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=H(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&&!H(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||o.usedLng,r),u){const f=t.match(this.interpolator.nestingRegexp),v=f&&f.length;c<v&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&o&&o.res&&(r.lng=this.language||o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var f=arguments.length,v=new Array(f),g=0;g<f;g++)v[g]=arguments[g];return s&&s[0]===v[0]&&!r.context?(i.logger.warn(`It seems you are nesting recursively key: ${v[0]} in key: ${n[0]}`),null):i.translate(...v,n)},r)),r.interpolation&&this.interpolator.reset()}const a=r.postProcess||this.options.postProcess,l=H(a)?[a]:a;return t!=null&&l&&l.length&&r.applyPostProcessor!==!1&&(t=L0.handle(l,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,o,s,i,a;return H(t)&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;o=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&!H(n.count),v=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(H(n.context)||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(x=>{this.isValidLookup(r)||(a=x,!zh[`${m[0]}-${x}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(zh[`${m[0]}-${x}`]=!0,this.logger.warn(`key "${o}" for languages "${m.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!!!")),m.forEach(y=>{if(this.isValidLookup(r))return;i=y;const h=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(h,c,y,x,n);else{let S;f&&(S=this.pluralResolver.getSuffix(y,n.count,n));const b=`${this.options.pluralSeparator}zero`,P=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(h.push(c+S),n.ordinal&&S.indexOf(P)===0&&h.push(c+S.replace(P,this.options.pluralSeparator)),v&&h.push(c+b)),g){const E=`${c}${this.options.contextSeparator}${n.context}`;h.push(E),f&&(h.push(E+S),n.ordinal&&S.indexOf(P)===0&&h.push(E+S.replace(P,this.options.pluralSeparator)),v&&h.push(E+b))}}let w;for(;w=h.pop();)this.isValidLookup(r)||(s=w,r=this.getResource(y,x,w,n))}))})}),{res:r,usedKey:o,exactUsedKey:s,usedLng:i,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,o):this.resourceStore.getResource(t,n,r,o)}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&&!H(t.replace);let o=r?t.replace:t;if(r&&typeof t.count<"u"&&(o.count=t.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!r){o={...o};for(const s of n)delete o[s]}return o}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 du=e=>e.charAt(0).toUpperCase()+e.slice(1);class $h{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Bt.create("languageUtils")}getScriptPartFromCode(t){if(t=La(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=La(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(H(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let o=Intl.getCanonicalLocales(t)[0];if(o&&this.options.lowerCaseLng&&(o=o.toLowerCase()),o)return o}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(o=>o.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=du(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]=du(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=du(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 o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(n=o)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const o=this.getLanguagePartFromCode(r);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(s=>{if(s===o)return s;if(!(s.indexOf("-")<0&&o.indexOf("-")<0)&&(s.indexOf("-")>0&&o.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===o||s.indexOf(o)===0&&o.length>1))return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),H(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),o=[],s=i=>{i&&(this.isSupportedCode(i)?o.push(i):this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`))};return H(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):H(t)&&s(this.formatLanguageCode(t)),r.forEach(i=>{o.indexOf(i)<0&&s(this.formatLanguageCode(i))}),o}}let o2=[{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}],s2={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 i2=["v1","v2","v3"],a2=["v4"],Bh={zero:0,one:1,two:2,few:3,many:4,other:5},l2=()=>{const e={};return o2.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:s2[t.fc]}})}),e};class u2{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Bt.create("pluralResolver"),(!this.options.compatibilityJSON||a2.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=l2(),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=La(t==="dev"?"en":t),o=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:o});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let i;try{i=new Intl.PluralRules(r,{type:o})}catch{if(!t.match(/-|_/))return;const l=this.languageUtils.getLanguagePartFromCode(t);i=this.getRule(l,n)}return this.pluralRulesCache[s]=i,i}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(o=>`${n}${o}`)}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((o,s)=>Bh[o]-Bh[s]).map(o=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${o}`):r.numbers.map(o=>this.getSuffix(t,o,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const o=this.getRule(t,r);return o?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(n)}`:this.getSuffixRetroCompatible(o,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 o=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(o===2?o="plural":o===1&&(o=""));const s=()=>this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString();return this.options.compatibilityJSON==="v1"?o===1?"":typeof o=="number"?`_plural_${o.toString()}`:s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!i2.includes(this.options.compatibilityJSON)}}const Hh=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=YO(e,t,n);return!s&&o&&H(n)&&(s=Lc(e,n,r),s===void 0&&(s=Lc(t,n,r))),s},fu=e=>e.replace(/\$/g,"$$$$");class c2{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Bt.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:o,prefix:s,prefixEscaped:i,suffix:a,suffixEscaped:l,formatSeparator:u,unescapeSuffix:c,unescapePrefix:d,nestingPrefix:f,nestingPrefixEscaped:v,nestingSuffix:g,nestingSuffixEscaped:m,nestingOptionsSeparator:x,maxReplaces:y,alwaysFormat:h}=t.interpolation;this.escape=n!==void 0?n:JO,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=s?Mr(s):i||"{{",this.suffix=a?Mr(a):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=c?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=f?Mr(f):v||Mr("$t("),this.nestingSuffix=g?Mr(g):m||Mr(")"),this.nestingOptionsSeparator=x||",",this.maxReplaces=y||1e3,this.alwaysFormat=h!==void 0?h:!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,o){let s,i,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=v=>{if(v.indexOf(this.formatSeparator)<0){const y=Hh(n,l,v,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...o,...n,interpolationkey:v}):y}const g=v.split(this.formatSeparator),m=g.shift().trim(),x=g.join(this.formatSeparator).trim();return this.format(Hh(n,l,m,this.options.keySeparator,this.options.ignoreJSONStructure),x,r,{...o,...n,interpolationkey:m})};this.resetRegExp();const c=o&&o.missingInterpolationHandler||this.options.missingInterpolationHandler,d=o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:v=>fu(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?fu(this.escape(v)):fu(v)}].forEach(v=>{for(a=0;s=v.regex.exec(t);){const g=s[1].trim();if(i=u(g),i===void 0)if(typeof c=="function"){const x=c(t,s,o);i=H(x)?x:""}else if(o&&Object.prototype.hasOwnProperty.call(o,g))i="";else if(d){i=s[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),i="";else!H(i)&&!this.useRawValueToEscape&&(i=_h(i));const m=v.safeValue(i);if(t=t.replace(s[0],m),d?(v.regex.lastIndex+=i.length,v.regex.lastIndex-=s[0].length):v.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,s,i;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,i);const v=f.match(/'/g),g=f.match(/"/g);(v&&v.length%2===0&&!g||g.length%2!==0)&&(f=f.replace(/'/g,'"'));try{i=JSON.parse(f),u&&(i={...u,...i})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${c}${f}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,l};for(;o=this.nestingRegexp.exec(t);){let l=[];i={...r},i=i.replace&&!H(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;let u=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){const c=o[1].split(this.formatSeparator).map(d=>d.trim());o[1]=c.shift(),l=c,u=!0}if(s=n(a.call(this,o[1].trim(),i),i),s&&o[0]===t&&!H(s))return s;H(s)||(s=_h(s)),s||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),s=""),u&&(s=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:o[1].trim()}),s.trim())),t=t.replace(o[0],s),this.regexp.lastIndex=0}return t}}const d2=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);t==="currency"&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(i=>{if(i){const[a,...l]=i.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}},_r=e=>{const t={};return(n,r,o)=>{let s=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(s={...s,[o.interpolationkey]:void 0});const i=r+JSON.stringify(s);let a=t[i];return a||(a=e(La(r),o),t[i]=a),a(n)}};class f2{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Bt.create("formatter"),this.options=t,this.formats={number:_r((n,r)=>{const o=new Intl.NumberFormat(n,{...r});return s=>o.format(s)}),currency:_r((n,r)=>{const o=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>o.format(s)}),datetime:_r((n,r)=>{const o=new Intl.DateTimeFormat(n,{...r});return s=>o.format(s)}),relativetime:_r((n,r)=>{const o=new Intl.RelativeTimeFormat(n,{...r});return s=>o.format(s,r.range||"day")}),list:_r((n,r)=>{const o=new Intl.ListFormat(n,{...r});return s=>o.format(s)})},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()]=_r(n)}format(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(a=>a.indexOf(")")>-1)){const a=s.findIndex(l=>l.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,a)].join(this.formatSeparator)}return s.reduce((a,l)=>{const{formatName:u,formatOptions:c}=d2(l);if(this.formats[u]){let d=a;try{const f=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},v=f.locale||f.lng||o.locale||o.lng||r;d=this.formats[u](a,v,{...c,...o,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}const p2=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class h2 extends xl{constructor(t,n,r){let o=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=o,this.logger=Bt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,o.backend,o)}queueLoad(t,n,r,o){const s={},i={},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?i[f]===void 0&&(i[f]=!0):(this.state[f]=1,c=!1,i[f]===void 0&&(i[f]=!0),s[f]===void 0&&(s[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(a[u]=!0)}),(Object.keys(s).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(s),pending:Object.keys(i),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const o=t.split("|"),s=o[0],i=o[1];n&&this.emit("failedLoading",s,i,n),!n&&r&&this.store.addResourceBundle(s,i,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=>{QO(l.loaded,[s],i),p2(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 o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,i=arguments.length>5?arguments[5]:void 0;if(!t.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:o,wait:s,callback:i});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&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,o+1,s*2,i)},s);return}i(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]:{},o=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."),o&&o();H(t)&&(t=this.languageUtils.toResolveHierarchy(t)),H(n)&&(n=[n]);const s=this.queueLoad(t,n,r,o);if(!s.toLoad.length)return s.pending.length||o(),null;s.toLoad.forEach(i=>{this.loadOne(i)})}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("|"),o=r[0],s=r[1];this.read(o,s,"read",void 0,void 0,(i,a)=>{i&&this.logger.warn(`${n}loading namespace ${s} for language ${o} failed`,i),!i&&a&&this.logger.log(`${n}loaded namespace ${s} for language ${o}`,a),this.loaded(t,i,a)})}saveMissing(t,n,r,o,s){let i=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={...i,isUpdate:s},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,o,l):c=u(t,n,r,o),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,o,a,l)}!t||!t[0]||this.store.addResource(t[0],n,r,o)}}}const Vh=()=>({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]),H(e[1])&&(t.defaultValue=e[1]),H(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}}),Kh=e=>(H(e.ns)&&(e.ns=[e.ns]),H(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),H(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Ti=()=>{},m2=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Ms extends xl{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Kh(t),this.services={},this.logger=Bt,this.modules={external:[]},m2(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&&(H(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const o=Vh();this.options={...o,...this.options,...Kh(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...o.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const s=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?Bt.init(s(this.modules.logger),this.options):Bt.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=f2);const d=new $h(this.options);this.store=new Uh(this.options.resources,this.options);const f=this.services;f.logger=Bt,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new u2(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(f.formatter=s(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new c2(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new h2(s(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(v){for(var g=arguments.length,m=new Array(g>1?g-1:0),x=1;x<g;x++)m[x-1]=arguments[x];t.emit(v,...m)}),this.modules.languageDetector&&(f.languageDetector=s(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=s(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new Ma(this.services,this.options),this.translator.on("*",function(v){for(var g=arguments.length,m=new Array(g>1?g-1:0),x=1;x<g;x++)m[x-1]=arguments[x];t.emit(v,...m)}),this.modules.external.forEach(v=>{v.init&&v.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Ti),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=Wo(),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]:Ti;const o=H(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(o&&o.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],i=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{u!=="cimode"&&s.indexOf(u)<0&&s.push(u)})};o?i(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>i(l)),this.options.preload&&this.options.preload.forEach(a=>i(a)),this.services.backendConnector.load(s,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const o=Wo();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=Ti),this.services.backendConnector.reload(t,n,s=>{o.resolve(),r(s)}),o}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"&&L0.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 o=Wo();this.emit("languageChanging",t);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},i=(l,u)=>{u?(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,o.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=H(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{i(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),o}getFixedT(t,n,r){var o=this;const s=function(i,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=o.options.overloadTranslationOptionHandler([i,a].concat(c))}else l={...a};l.lng=l.lng||s.lng,l.lngs=l.lngs||s.lngs,l.ns=l.ns||s.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||r||s.keyPrefix);const f=o.options.keySeparator||".";let v;return l.keyPrefix&&Array.isArray(i)?v=i.map(g=>`${l.keyPrefix}${f}${g}`):v=l.keyPrefix?`${l.keyPrefix}${f}${i}`:i,o.t(v,l)};return H(t)?s.lng=t:s.lngs=t,s.ns=n,s.keyPrefix=r,s}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],o=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const i=(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,i);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(r,t)&&(!o||i(s,t)))}loadNamespaces(t,n){const r=Wo();return this.options.ns?(H(t)&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Wo();H(t)&&(t=[t]);const o=this.options.preload||[],s=t.filter(i=>o.indexOf(i)<0&&this.services.languageUtils.isSupportedCode(i));return s.length?(this.options.preload=o.concat(s),this.loadResources(i=>{r.resolve(),n&&n(i)}),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 $h(Vh());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 Ms(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ti;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},s=new Ms(o);return(t.debug!==void 0||t.prefix!==void 0)&&(s.logger=s.logger.clone(t)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r&&(s.store=new Uh(this.store.data,o),s.services.resourceStore=s.store),s.translator=new Ma(s.services,o),s.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];s.emit(a,...u)}),s.init(o,n),s.translator.options=o,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ke=Ms.createInstance();ke.createInstance=Ms.createInstance;ke.createInstance;ke.dir;ke.init;ke.loadResources;ke.reloadResources;ke.use;ke.changeLanguage;ke.getFixedT;ke.t;ke.exists;ke.setDefaultNamespace;ke.hasLoadedNamespace;ke.loadNamespaces;ke.loadLanguages;const g2={zh:{translation:{app:{title:"cc-gw 控制台",skipToContent:"跳转到主要内容"},nav:{dashboard:"仪表盘",logs:"请求日志",events:"事件",models:"模型与路由管理",apiKeys:"API 密钥",settings:"设置",help:"使用指南",about:"关于"},language:{zh:"简体中文",en:"English"},common:{loading:"加载中...",loadingShort:"加载中...",noData:"暂无数据",languageSelector:"语言选择",yes:"是",edit:"编辑",delete:"删除",create:"创建",save:"保存",saving:"保存中...",cancel:"取消",actions:{refresh:"刷新",refreshing:"刷新中...",manualRefresh:"手动刷新",reset:"重置",close:"关闭",openNavigation:"打开导航",closeNavigation:"关闭导航",save:"保存设置",saving:"保存中...",cancel:"取消",copy:"复制",testConnection:"测试连接",testingConnection:"测试中...",cleanup:"清理历史日志",cleaning:"清理中...",checkUpdates:"检查更新",logout:"退出登录"},theme:{label:"主题",light:"亮色",dark:"暗色",system:"跟随系统"},status:{success:"成功",error:"失败"},notifications:{featureInProgress:"功能开发中,敬请期待。"},units:{request:"次",ms:"ms",token:"Tokens",msPerToken:"ms/Token"},noMatches:"无匹配项",unknownError:"未知错误",filters:{activeCount:"{{count}} 个筛选条件",collapse:"收起筛选",expand:"展开筛选",allRequests:"全部请求"}},login:{title:"登录 cc-gw 控制台",description:"启用 Web UI 访问控制后,请输入账号与密码继续。",fields:{username:"用户名",usernamePlaceholder:"请输入用户名",password:"密码",passwordPlaceholder:"请输入密码"},actions:{submit:"登录"},validation:{required:"请填写用户名和密码",failed:"登录失败,请检查账号或密码后重试"},hint:"如果忘记密码,可在服务器上通过 CLI 或编辑配置重置 Web 登录设置。",status:"已登录:{{username}}"},dashboard:{description:"快速了解请求规模与实时运行状态。",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",todayCacheRead:"今日缓存读取",todayCacheCreation:"今日缓存写入",todayOutput:"今日输出 Tokens",todayCached:"今日缓存 Tokens",avgLatency:"平均响应耗时"},charts:{requestsTitle:"请求趋势",requestsDesc:"最近 14 天请求与 Token 走势",modelTitle:"模型调用分布",modelDesc:"近 7 天不同模型的调用次数与 Token 走势",barRequests:"请求数",lineInput:"输入 Tokens",lineOutput:"输出 Tokens",lineCached:"缓存 Tokens",lineCacheRead:"缓存读取",lineCacheCreation:"缓存写入",axisTokens:"Tokens",ttftLabel:"TTFT(ms)",tpotLabel:"TPOT(ms/Token)",ttftTitle:"TTFT 模型对比",ttftDesc:"比较不同模型的首 Token 耗时 (TTFT)",ttftEmpty:"暂无 TTFT 数据。",tpotTitle:"TPOT 模型对比",tpotDesc:"比较不同模型的平均 Token 耗时 (TPOT)",tpotEmpty:"暂无 TPOT 数据。",ttftAxis:"TTFT (ms)",tpotAxis:"TPOT (ms/Token)",empty:"暂无数据"},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",cacheReadTokens:"缓存读取",cacheCreationTokens:"缓存写入",outputTokens:"输出 Tokens",stream:"Stream",latency:"耗时(ms)",ttft:"TTFT(ms)",tpot:"TPOT(ms/Token)",status:"状态",error:"错误信息",actions:"操作"},pagination:{perPage:"每页",unit:"条",previous:"上一页",next:"下一页",pageLabel:"第 {{page}} / {{total}} 页"}},endpointAnthropic:"anthropic",endpointOpenAI:"openai",toast:{listError:{title:"日志获取失败",desc:"错误信息:{{message}}"},providerError:{title:"Provider 列表获取失败",desc:"错误信息:{{message}}"},exportSuccess:{title:"导出完成",desc:"压缩日志文件已开始下载。"},exportError:{title:"导出失败",desc:"错误信息:{{message}}"}},stream:{streaming:"流式",single:"单次"},detail:{title:"日志详情",id:"ID #{{id}}",infoSection:"基本信息",info:{time:"时间",sessionId:"Session ID",endpoint:"端点",provider:"Provider",requestedModel:"请求模型",noRequestedModel:"未指定",model:"路由模型",stream:"Stream",latency:"耗时",status:"状态",inputTokens:"输入 Tokens",cacheReadTokens:"缓存读取",cacheCreationTokens:"缓存写入",outputTokens:"输出 Tokens",ttft:"TTFT (首 Token 耗时)",tpot:"TPOT (平均 ms/Token)",error:"错误信息"},summary:{route:"{{from}} → {{to}}",latency:"耗时:{{value}}",ttft:"TTFT:{{value}}",tpot:"TPOT:{{value}}",stream:"Stream:{{value}}"},payload:{request:"请求体",response:"响应体",emptyRequest:"暂无请求内容",emptyResponse:"暂无响应内容"},apiKey:{title:"密钥信息",name:"密钥名称",identifier:"密钥 ID",masked:"掩码展示",maskedUnavailable:"暂无掩码信息",raw:"原始密钥",rawUnavailable:"未记录原始密钥",rawMasked:"原始密钥(已脱敏)",rawMaskedHint:"出于安全考虑,仅展示部分前后缀。如需完整值,请在上游服务中重新生成。",missing:"未记录",lastUsed:"最后使用"},copy:{requestSuccess:"请求体已复制到剪贴板。",responseSuccess:"响应体已复制到剪贴板。",keySuccess:"API 密钥已复制到剪贴板。",empty:"{{label}}为空,无法复制。",failure:"复制失败",failureFallback:"无法复制内容,请稍后再试。"},loadError:"无法加载日志详情。"}},providers:{title:"模型提供商",description:"管理集成的模型服务,查看默认模型及支持能力。",emptyState:"暂无 Provider,请点击“新增提供商”以开始配置。",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:"选择 API 认证方式,填写对应的密钥值。",authModeApiKey:"默认方式(Anthropic: x-api-key / OpenAI: Bearer)",authModeAuthToken:"Authorization: Bearer",authModeXAuthToken:"X-Auth-Token",models:"模型配置",showAdvanced:"显示高级选项",hideAdvanced:"隐藏高级选项",addModel:"新增模型",modelId:"模型 ID",modelIdPlaceholder:"如 claude-sonnet-4-5-20250929",modelLabel:"显示名称(可选)",modelLabelPlaceholder:"如 GPT-4 旗舰",setDefault:"设为默认模型",removeModel:"删除模型"},errors:{idRequired:"请填写 Provider ID",idDuplicate:"该 Provider ID 已存在",baseUrlInvalid:"Base URL 格式无效",modelsRequired:"请至少配置一个模型",modelInvalid:"模型 ID 不可为空或重复",defaultInvalid:"默认模型必须在模型列表中"},toast:{saveFailure:"保存失败:{{message}}"},noModelsTitle:"透传模式已启用",noModelsHint:'当前未配置模型列表。该 Provider 将以"透传"模式使用,可在模型路由中映射,或在请求中直接指定模型。',routeExample:"路由映射示例:"},confirm:{delete:"确认删除 Provider「{{name}}」?"}},modelManagement:{title:"模型与路由管理",description:"统一维护模型提供商配置、模型路由映射与自定义端点。",tabs:{providers:"模型提供商",providersDesc:"配置上游模型提供商以及认证信息。",anthropic:"Anthropic 路由",anthropicDesc:"管理 /anthropic 端点的模型映射和默认配置。",openai:"OpenAI 路由",openaiDesc:"管理 /openai 端点的模型映射和默认配置。",customEndpoint:"自定义端点"},addEndpoint:"添加端点",createEndpoint:"创建端点",editEndpoint:"编辑端点",deleteEndpointConfirm:'确定要删除端点 "{{label}}" 吗?此操作无法撤销。',deleteEndpointSuccess:"端点删除成功",deleteEndpointError:"删除失败:{{error}}",createEndpointSuccess:"端点创建成功",createEndpointError:"创建失败:{{error}}",updateEndpointSuccess:"端点更新成功",updateEndpointError:"更新失败:{{error}}",endpointValidationError:"请填写所有必填字段",pathValidationError:"请填写所有路径信息",atLeastOnePath:"至少需要一个路径",endpointId:"端点 ID",endpointIdPlaceholder:"如 custom-api",endpointIdHint:"ID 创建后不可修改,用于内部标识。",endpointLabel:"显示名称",endpointLabelPlaceholder:"如 我的自定义 API",endpointPath:"访问路径",endpointPaths:"访问路径",endpointPathPlaceholder:"如 /custom/api",endpointPathHint:"路径需以 / 开头,修改后立即生效。",endpointProtocol:"协议类型",endpointEnabled:"启用此端点",endpointRoutingHint:"创建后,您可以在此端点的路由配置 Tab 中设置模型路由规则。",addPath:"添加路径",removePath:"删除路径",protocolAnthropic:"Anthropic 协议",protocolOpenAI:"OpenAI",protocolOpenAIChat:"OpenAI Chat",protocolOpenAIResponses:"OpenAI Responses",protocolHint:{anthropic:"Anthropic Messages API 协议(/v1/messages)","openai-auto":"OpenAI 协议(支持 Chat Completions 和 Responses API)。请确保路径以 /v1/chat/completions 或 /v1/responses 结尾。","openai-chat":"OpenAI Chat Completions API 协议(/v1/chat/completions)","openai-responses":"OpenAI Responses API 协议(/v1/responses)"},actions:{saveRoutes:"保存路由"},routing:{selectTarget:"请选择目标 Provider:模型"},claudeValidation:{title:"Claude Code 请求校验防护(实验特性)",description:"开启后,仅允许符合 Claude Code 协议的 /anthropic 请求;不合规请求会直接返回 430。",toggleLabel:"启用校验",statusEnabled:"已启用 Claude Code 校验",statusDisabled:"当前未启用(默认)"},toast:{routesSaved:"模型路由已更新。",routesSaveFailure:"保存模型路由失败:{{message}}",presetSaved:'已保存模板 "{{name}}"。',presetSaveFailure:"保存模板失败:{{message}}",presetApplySuccess:'已应用模板 "{{name}}"。',presetApplyFailure:"应用模板失败:{{message}}",presetDeleteSuccess:'模板 "{{name}}" 已删除。',presetDeleteFailure:"删除模板失败:{{message}}",claudeValidationEnabled:"Claude Code 请求校验防护(实验特性)已启用。",claudeValidationDisabled:"Claude Code 请求校验防护(实验特性)已关闭。",claudeValidationFailure:"更新 Claude 校验防护状态失败:{{message}}"},presets:{title:"路由模板",description:"保存当前 Anthropic 路由映射,便于在不同 Provider 方案之间快速切换。",namePlaceholder:"输入模板名称,例如 fox",save:"保存模板",saving:"保存中...",empty:"尚未保存任何模板。",apply:"应用",applying:"应用中...",delete:"删除",deleting:"删除中...",rulesCount:"{{count}} 条规则",noRules:"空模板",previewTooltip:"悬停查看路由规则",diffTitle:"应用模板确认",diffDescription:'以下路由将被替换为模板 "{{name}}" 的配置:',diffAdded:"新增",diffRemoved:"移除",diffChanged:"变更",diffConfirm:"确认应用",diffEmpty:"模板与当前配置相同,无需变更。"},validation:{presetName:"请输入模板名称。",presetDuplicate:"模板 {{name}} 已存在,请使用其他名称。"},confirm:{deletePreset:'确定要删除模板 "{{name}}" 吗?'}},events:{title:"安全事件",description:"查看校验防护与系统检测记录,及时发现异常访问。",filters:{title:"筛选条件",allLevels:"全部严重级别",typePlaceholder:"按事件类型过滤(可留空)"},actions:{newest:"最新",older:"更早"},levels:{info:"提示",warn:"警告",error:"错误"},empty:{title:"暂无事件记录",subtitle:"当前没有可用的安全事件。"},details:"查看详情",defaultTitle:"未命名事件",defaultMessage:"未提供详细描述。",toast:{loadFailure:"加载事件失败:{{message}}"}},settings:{title:"系统设置",description:"调整网关端口、日志策略及其他运行参数。",toast:{loadFailure:"配置加载失败:{{message}}",saveSuccess:"系统配置已更新。",saveFailure:"保存失败:{{message}}",protocolRestartRequired:"配置已保存!请执行 cc-gw restart --daemon 重启服务使协议配置生效",copySuccess:"配置文件路径已复制到剪贴板。",copyFailure:"复制失败:{{message}}",cleanupSuccess:"已删除 {{count}} 条历史日志。",cleanupNone:"没有需要删除的日志。",cleanupFailure:"清理失败:{{message}}",clearAllSuccess:"日志已清空(请求 {{logs}} 条,统计 {{metrics}} 条)。",clearAllFailure:"清空失败:{{message}}",missingConfig:"未能加载配置,请刷新或稍后再试。",authLoadFailure:"安全配置加载失败:{{message}}"},sections:{basics:"基础配置",routing:"模型路由",configFile:"配置文件",cleanup:"日志清理",security:"访问安全",protocol:"协议配置",jump:"跳转到"},fields:{port:"监听端口",host:"监听地址(可选)",hostPlaceholder:"默认 127.0.0.1",retention:"日志保留天数",logExportTimeout:"日志导出超时 (秒)",logExportTimeoutHint:"默认 60 秒;导出量较大时可调高,范围 5-600 秒。",bodyLimit:"请求体大小上限 (MB)",bodyLimitHint:"默认 10 MB;如 Claude Code 的 /compact 遇到 413,可适当调大。",defaults:"默认模型配置",storeRequestPayloads:"保存请求内容",storeRequestPayloadsHint:"开启后会在日志数据库中保留完整请求原文,便于排查;如含敏感信息可关闭。",storeResponsePayloads:"保存响应内容",storeResponsePayloadsHint:"开启后会记录模型返回的数据(含流式片段);关闭可降低磁盘与隐私风险。",logLevel:"日志级别",logLevelOption:{fatal:"致命 (fatal)",error:"错误 (error)",warn:"警告 (warn)",info:"信息 (info)",debug:"调试 (debug)",trace:"跟踪 (trace)"},requestLogging:"输出访问日志",requestLoggingHint:"控制是否在终端打印“incoming request …”日志,方便观察访问来源。",responseLogging:"输出响应日志",responseLoggingHint:"控制是否输出“request completed …”日志(含状态码与耗时),关闭后终端更安静。",enableRoutingFallback:"启用模型回退策略",enableRoutingFallbackHint:"无匹配模型时自动落到首个可用模型。默认关闭,建议仅在明确需要时开启。"},auth:{description:"开启 Web UI 登录后,所有管理接口仅对已登录用户开放,模型代理端点仍保持兼容。",enable:"启用 Web UI 登录保护",enableHint:"推荐在多人共用或生产环境中开启,访问 /ui 与 /api/* 将需要先登录。",username:"登录用户名",usernamePlaceholder:"设置用于登录的用户名",password:"登录密码",passwordPlaceholder:"至少 6 位字符",confirmPassword:"确认密码",confirmPasswordPlaceholder:"再次输入登录密码",status:"当前状态",statusEnabled:"已启用登录保护",statusDisabled:"未启用登录保护",passwordHintRequired:"首次启用或修改用户名时必须设置新密码(不少于 6 位)。",passwordHintOptional:"如需更新密码可填写新值,留空则沿用旧密码。",actions:{save:"保存安全设置"},toast:{success:"安全设置已更新。",failure:"保存失败:{{message}}"},validation:{username:"请填写用户名",minLength:"密码至少需要 6 位字符",passwordRequired:"请设置登录密码",confirmMismatch:"两次输入的密码不一致"}},protocol:{description:"配置 HTTP 和 HTTPS 服务端口,默认同时启用两个协议",restartWarning:"⚠️ 修改协议配置后需要重启服务才能生效",restartHint:"保存配置后,请执行以下命令重启服务:",restartTip:"💡 提示:端口、协议启用状态、证书路径需要重启;Provider 和路由配置支持热加载无需重启",http:{enable:"启用 HTTP",hint:"标准 HTTP 协议,适用于本地开发和内网环境",port:"HTTP 端口",host:"HTTP 主机地址"},https:{enable:"启用 HTTPS",hint:"HTTPS 加密协议",port:"HTTPS 端口",host:"HTTPS 主机地址",keyPath:"证书私钥路径",certPath:"证书文件路径",caPath:"CA 证书路径 (可选)",warning:"⚠️ 关于 HTTPS 证书",invalidCert:"自签名证书无效:",invalidCertDetail:"Claude Code 和大多数 AI 工具无法信任自签名证书,会导致连接失败。",recommended:"推荐方案:",recommendedDetail:"本地开发环境建议使用 HTTP 协议(127.0.0.1 本地访问非常安全)。",tip:"💡 如需 HTTPS,请使用受信任 CA(如 Let's Encrypt)签发的正式证书,或配置反向代理(如 Nginx/Caddy)处理 HTTPS。"}},validation:{port:"请输入 1-65535 之间的端口号",retention:"日志保留天数需为 1-365 之间的数字",logExportTimeout:"日志导出超时需在 5-600 秒之间",bodyLimit:"请求体大小需在 1-2048 MB 之间",routePair:"请填写完整的来源模型与目标模型配置。",routeDuplicate:"模型 {{model}} 已存在映射,请勿重复配置。"},defaults:{completion:"对话:{{model}}",reasoning:"推理:{{model}}",background:"后台:{{model}}",none:"未设置默认模型"},routing:{title:"模型路由映射",description:"为 Claude Code 发起的模型请求指定实际 Provider 与模型 ID(如将 claude 系列映射至 Kimi)。如需禁用映射,可留空或移除。",titleByEndpoint:"{{endpoint}} 路由配置",descriptionByEndpoint:{anthropic:"当 Claude Code 通过 /anthropic 端点请求特定模型时,将根据此映射选择目标 Provider 与模型。",openai:"当 Codex 通过 /openai 端点请求特定模型时,将根据此映射选择目标 Provider 与模型。"},wildcardHint:"来源模型支持使用 * 通配符(如 claude-*),匹配度更高的规则优先;若目标写成 providerId:*,会将请求里的模型名原样转发给对应 Provider。",add:"新增映射",empty:"尚未配置映射,系统将使用默认模型策略。",source:"来源模型",target:"目标 Provider:模型",sourceLabel:"来源模型",sourcePlaceholder:"如 claude-sonnet-4-5-20250929",targetLabel:"目标 Provider:模型",targetPlaceholder:"如 kimi:kimi-k2-0905-preview",customTargetOption:"自定义目标…",providerPassthroughOption:"{{provider}} · 透传原始模型 (*)",remove:"移除",suggested:"常用 Anthropic 模型"},file:{description:"当前配置存储在本地文件,可通过编辑该文件进行离线修改。",unknown:"未知路径"},cleanup:{description:"立即清理早于当前保留天数的日志记录。",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:[`📝 **编辑配置文件**:
222
222
  在 \`~/.codex/config.toml\` 进行配置:
223
223
  \`\`\`toml
224
224
  model = "gpt-5-codex"
@@ -248,7 +248,7 @@ env_key = "cc_gw_key"
248
248
  "protocol": "anthropic"
249
249
  }
250
250
  \`\`\`
251
- 配置后,客户端通过 \`http://127.0.0.1:4100/claude/v1/messages\` 访问(路径自动扩展)。`,"🗃️ **数据备份**:定期备份 ~/.cc-gw/ 目录(包含配置、日志和数据库)",'🧹 **日志清理**:根据需要调整日志保留天数,或使用"日志清理"功能手动清理','🔍 **问题排查**:开启"保存请求/响应内容"以便调试客户端兼容性问题',"⚡ **性能优化**:关闭不必要的访问日志可降低终端输出,提升服务性能","🎯 **模型切换**:使用路由模板功能,实现不同 Provider 方案的一键切换","📊 **监控告警**:结合 Dashboard 数据设置自定义监控,及时发现异常"]}},faq:{title:"❓ 常见问题解答",items:[{q:"如何解决 Claude Code 连接失败问题?",a:'1) 检查 cc-gw 服务状态:`cc-gw status`\n2) 验证环境变量:`echo $ANTHROPIC_BASE_URL`\n3) 确认 API Key 正确性\n4) 在"请求日志"中查看详细错误信息'},{q:"如何使用自定义接入点?",a:'在"模型管理"页面创建自定义接入点,配置基础路径(如 `/my-endpoint`)和协议类型。系统会自动根据协议注册完整的 API 路径。例如,配置 `/claude` + `anthropic` 协议后,客户端通过 `http://127.0.0.1:4100/claude/v1/messages` 访问。\n\n如果遇到 404 错误,检查:\n1) 端点是否已启用\n2) 客户端使用的是完整路径(包括协议子路径)\n3) 查看服务器日志确认路由是否注册成功'},{q:"为什么没有缓存命中数据?",a:"需要上游 Provider 返回 cached_tokens 或 input_tokens_details.cached_tokens 字段。确认 Provider 支持缓存功能并已正确配置。"},{q:"如何配置多个客户端使用不同模型?",a:'为每个客户端创建独立的 API Key,在"模型管理 → 路由配置"中设置不同的路由规则,或使用不同的环境变量配置。也可以为不同客户端创建专用的自定义接入点。'},{q:"Codex CLI 如何连接到 cc-gw?",a:'配置 ~/.codex/config.toml 文件,设置 model_provider 为 "cc_gw",base_url 为 cc-gw 的 OpenAI 兼容端点,并设置相应的环境变量。'},{q:"如何备份和迁移配置?",a:"备份整个 ~/.cc-gw/ 目录,包含 config.json、数据库和日志文件。在新环境中恢复目录并重启服务即可。"},{q:"Web UI 显示 404 错误怎么办?",a:"确认已执行 `pnpm --filter @cc-gw/web build`,或使用 npm 全局安装版本。检查服务启动日志中的静态资源路径。"}]}},about:{title:"关于",description:"查看 cc-gw 的版本信息、构建元数据与运行状态。",app:{title:"应用信息",subtitle:"版本与构建元数据一目了然。",labels:{name:"名称",version:"版本",buildTime:"构建时间",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:"删除",reveal:"显示完整密钥",hide:"隐藏密钥"},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}}",revealFailure:"获取密钥失败",copyFailure:"复制失败"},allowedEndpoints:"允许的端点",allEndpoints:"全部端点(不限制)",editEndpoints:"编辑端点权限",endpointRestricted:"已限制端点",selectEndpoints:"选择此密钥可以访问的端点,不选择则允许访问全部端点。"},endpoints:{title:"自定义端点",description:"管理自定义 API 端点,支持多种协议类型。",createButton:"新增端点",createTitle:"创建端点",editTitle:"编辑端点",emptyTitle:"暂无自定义端点",emptyDescription:'点击"新增端点"按钮创建您的第一个自定义端点。',loadError:"加载端点列表失败",id:"ID",path:"路径",disabled:"已禁用",hasRouting:"已配置路由",protocols:{anthropic:"Anthropic 协议","openai-chat":"OpenAI Chat","openai-responses":"OpenAI Responses"},protocolHints:{anthropic:"Anthropic Messages API 协议(/v1/messages)","openai-chat":"OpenAI Chat Completions API 协议(/v1/chat/completions)","openai-responses":"OpenAI Responses API 协议(/v1/responses)"},form:{id:"端点 ID",idPlaceholder:"如 custom-api",idHint:"ID 创建后不可修改,用于内部标识。",label:"显示名称",labelPlaceholder:"如 我的自定义 API",path:"访问路径",pathPlaceholder:"如 /custom/api",pathHint:"路径需以 / 开头,修改后立即生效。",protocol:"协议类型",enabled:"启用此端点"},routing:{title:"路由配置(可选)",modelRoutes:"模型路由规则",addRoute:"添加规则",noRoutes:"暂无路由规则",sourceModelPlaceholder:"源模型(如 claude-3-5-sonnet-20241022)",targetPlaceholder:"目标(如 anthropic:claude-3-5-sonnet-20241022)",modelRoutesHint:"格式:源模型 → provider:model,支持通配符(如 gpt-* → openai:*)",defaults:"默认模型配置",defaultCompletion:"常规对话默认模型",defaultReasoning:"推理任务默认模型",defaultBackground:"后台任务默认模型",longContextThreshold:"长上下文阈值(tokens)",defaultPlaceholder:"如 anthropic:claude-3-5-sonnet-20241022"},createSuccess:"端点创建成功",createError:"创建失败:{{error}}",updateSuccess:"端点更新成功",updateError:"更新失败:{{error}}",deleteSuccess:"端点删除成功",deleteError:"删除失败:{{error}}",deleteConfirm:'确定要删除端点 "{{label}}" 吗?此操作无法撤销。',validationError:"请填写所有必填字段"}}},en:{translation:{app:{title:"cc-gw Console",skipToContent:"Skip to main content"},nav:{dashboard:"Dashboard",logs:"Logs",events:"Events",models:"Models & Routing",apiKeys:"API Keys",settings:"Settings",help:"Help",about:"About"},language:{zh:"Simplified Chinese",en:"English"},common:{loading:"Loading...",loadingShort:"Loading...",noData:"No data available",languageSelector:"Language selector",yes:"Yes",edit:"Edit",delete:"Delete",create:"Create",save:"Save",saving:"Saving...",cancel:"Cancel",actions:{refresh:"Refresh",refreshing:"Refreshing...",manualRefresh:"Manual refresh",reset:"Reset",close:"Close",openNavigation:"Open navigation",closeNavigation:"Close navigation",save:"Save changes",saving:"Saving...",cancel:"Cancel",copy:"Copy",testConnection:"Test connection",testingConnection:"Testing...",cleanup:"Clean up logs",cleaning:"Cleaning...",checkUpdates:"Check for updates",logout:"Sign out"},theme:{label:"Theme",light:"Light",dark:"Dark",system:"System"},status:{success:"Success",error:"Error"},notifications:{featureInProgress:"Feature under development. Stay tuned!"},units:{request:"req",ms:"ms",token:"tokens",msPerToken:"ms/token"},noMatches:"No matches",unknownError:"Unknown error",filters:{activeCount:"{{count}} active filters",collapse:"Collapse filters",expand:"Expand filters",allRequests:"All requests"}},login:{title:"Sign in to cc-gw",description:"Authentication is required before accessing the console.",fields:{username:"Username",usernamePlaceholder:"Enter your username",password:"Password",passwordPlaceholder:"Enter your password"},actions:{submit:"Sign in"},validation:{required:"Please enter both username and password",failed:"Sign in failed. Check your credentials and try again."},hint:"Forgot your credentials? You can reset the Web UI login settings from the server CLI or by editing the configuration file.",status:"Signed in as {{username}}"},dashboard:{description:"Monitor request volume and runtime health at a glance.",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",todayCacheRead:"Cache Read Today",todayCacheCreation:"Cache Creation Today",todayOutput:"Output Tokens Today",todayCached:"Cached Tokens Today",avgLatency:"Average Latency"},charts:{requestsTitle:"Request Trends",requestsDesc:"Requests and token usage over the last 14 days",modelTitle:"Model Distribution",modelDesc:"Requests and tokens by model in the past 7 days",barRequests:"Requests",lineInput:"Input tokens",lineOutput:"Output tokens",lineCached:"Cached tokens",lineCacheRead:"Cache Read",lineCacheCreation:"Cache Creation",axisTokens:"Tokens",ttftLabel:"TTFT (ms)",tpotLabel:"TPOT (ms/token)",ttftTitle:"TTFT Comparison",ttftDesc:"Compare first-token latency (TTFT) across models",ttftEmpty:"No TTFT data available.",tpotTitle:"TPOT Comparison",tpotDesc:"Compare per-token latency (TPOT) across models",tpotEmpty:"No TPOT data available.",ttftAxis:"TTFT (ms)",tpotAxis:"TPOT (ms/token)",empty:"No data"},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",cacheReadTokens:"Cache Read",cacheCreationTokens:"Cache Creation",outputTokens:"Output Tokens",stream:"Stream",latency:"Latency (ms)",ttft:"TTFT (ms)",tpot:"TPOT (ms/token)",status:"Status",error:"Error",actions:"Actions"},pagination:{perPage:"per page",unit:"items",previous:"Previous",next:"Next",pageLabel:"Page {{page}} / {{total}}"}},endpointAnthropic:"anthropic",endpointOpenAI:"openai",stream:{streaming:"Streaming",single:"Non-streaming"},toast:{listError:{title:"Failed to fetch logs",desc:"Error: {{message}}"},providerError:{title:"Failed to fetch providers",desc:"Error: {{message}}"},exportSuccess:{title:"Export ready",desc:"A compressed log archive is downloading now."},exportError:{title:"Export failed",desc:"Error: {{message}}"}},detail:{title:"Log Detail",id:"ID #{{id}}",infoSection:"Overview",info:{time:"Time",sessionId:"Session ID",endpoint:"Endpoint",provider:"Provider",requestedModel:"Requested model",noRequestedModel:"Not specified",model:"Routed model",stream:"Stream",latency:"Latency",status:"Status",inputTokens:"Input Tokens",cacheReadTokens:"Cache Read",cacheCreationTokens:"Cache Creation",outputTokens:"Output Tokens",ttft:"TTFT (first token latency)",tpot:"TPOT (avg ms/token)",error:"Error"},summary:{route:"{{from}} → {{to}}",latency:"Latency: {{value}}",ttft:"TTFT: {{value}}",tpot:"TPOT: {{value}}",stream:"Stream: {{value}}"},payload:{request:"Request body",response:"Response body",emptyRequest:"No request content",emptyResponse:"No response content"},apiKey:{title:"API key",name:"Key name",identifier:"Key ID",masked:"Masked form",maskedUnavailable:"No mask available",raw:"Raw key",rawUnavailable:"Raw key not stored",rawMasked:"Raw key (masked)",rawMaskedHint:"For security, only the prefix and suffix are shown. Regenerate the key upstream if you need the full value.",missing:"Not recorded",lastUsed:"Last used"},copy:{requestSuccess:"Request body copied to clipboard.",responseSuccess:"Response body copied to clipboard.",keySuccess:"API key copied to clipboard.",empty:"Cannot copy empty {{label}}.",failure:"Copy failed",failureFallback:"Unable to copy content. Please try again later."},loadError:"Unable to load log detail."}},providers:{title:"Model Providers",description:"Manage integrated services and default models.",emptyState:'No providers yet. Click "Add provider" to get started.',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:"Select the API authentication method and fill in the corresponding key.",authModeApiKey:"Default (Anthropic: x-api-key / OpenAI: Bearer)",authModeAuthToken:"Authorization: Bearer",authModeXAuthToken:"X-Auth-Token",models:"Model configuration",showAdvanced:"Show advanced options",hideAdvanced:"Hide advanced options",addModel:"Add model",modelId:"Model ID",modelIdPlaceholder:"e.g. claude-sonnet-4-5-20250929",modelLabel:"Display name (optional)",modelLabelPlaceholder:"e.g. GPT-4 Flagship",setDefault:"Set as default",removeModel:"Remove model"},errors:{idRequired:"Provider ID is required",idDuplicate:"Provider ID already exists",baseUrlInvalid:"Invalid Base URL",modelsRequired:"Configure at least one model",modelInvalid:"Model IDs must be unique and non-empty",defaultInvalid:"Default model must exist in the list"},toast:{saveFailure:"Save failed: {{message}}"},noModelsTitle:"Pass-through Mode Enabled",noModelsHint:"No models are defined. This provider will run in pass-through mode—map routes in model routing or specify models directly in requests.",routeExample:"Route Mapping Example:"},confirm:{delete:"Remove provider “{{name}}”?"}},modelManagement:{title:"Models & Routing",description:"Configure providers, routing rules, and custom endpoints.",tabs:{providers:"Providers",providersDesc:"Manage upstream providers and authentication.",anthropic:"Anthropic Routing",anthropicDesc:"Control mappings for the /anthropic endpoint.",openai:"OpenAI Routing",openaiDesc:"Control mappings for the /openai endpoint.",customEndpoint:"Custom Endpoint"},addEndpoint:"Add Endpoint",createEndpoint:"Create Endpoint",editEndpoint:"Edit Endpoint",deleteEndpointConfirm:'Are you sure you want to delete endpoint "{{label}}"? This action cannot be undone.',deleteEndpointSuccess:"Endpoint deleted successfully",deleteEndpointError:"Failed to delete: {{error}}",createEndpointSuccess:"Endpoint created successfully",createEndpointError:"Failed to create: {{error}}",updateEndpointSuccess:"Endpoint updated successfully",updateEndpointError:"Failed to update: {{error}}",endpointValidationError:"Please fill in all required fields",pathValidationError:"Please fill in all path information",atLeastOnePath:"At least one path is required",endpointId:"Endpoint ID",endpointIdPlaceholder:"e.g. custom-api",endpointIdHint:"ID cannot be changed after creation, used for internal identification.",endpointLabel:"Display Name",endpointLabelPlaceholder:"e.g. My Custom API",endpointPath:"Access Path",endpointPaths:"Access Paths",endpointPathPlaceholder:"e.g. /custom/api",endpointPathHint:"Path must start with /. Changes take effect immediately.",endpointProtocol:"Protocol Type",endpointEnabled:"Enable this endpoint",endpointRoutingHint:"After creation, you can configure routing rules in this endpoint's routing tab.",addPath:"Add Path",removePath:"Remove Path",protocolAnthropic:"Anthropic Protocol",protocolOpenAI:"OpenAI",protocolOpenAIChat:"OpenAI Chat",protocolOpenAIResponses:"OpenAI Responses",protocolHint:{anthropic:"Anthropic Messages API protocol (/v1/messages)","openai-auto":"OpenAI protocol (supports Chat Completions and Responses APIs). Path must end with /v1/chat/completions or /v1/responses.","openai-chat":"OpenAI Chat Completions API protocol (/v1/chat/completions)","openai-responses":"OpenAI Responses API protocol (/v1/responses)"},actions:{saveRoutes:"Save routes"},routing:{selectTarget:"Select provider:model"},claudeValidation:{title:"Claude Code request validation",description:"When enabled, /anthropic requests must follow the Claude Code schema; invalid payloads are rejected with 430.",toggleLabel:"Enable validation",statusEnabled:"Claude Code validation enabled",statusDisabled:"Disabled by default"},toast:{routesSaved:"Model routes updated successfully.",routesSaveFailure:"Failed to save model routes: {{message}}",presetSaved:'Preset "{{name}}" saved.',presetSaveFailure:"Failed to save preset: {{message}}",presetApplySuccess:'Applied preset "{{name}}".',presetApplyFailure:"Failed to apply preset: {{message}}",presetDeleteSuccess:'Preset "{{name}}" deleted.',presetDeleteFailure:"Failed to delete preset: {{message}}",claudeValidationEnabled:"Claude Code request validation enabled.",claudeValidationDisabled:"Claude Code request validation disabled.",claudeValidationFailure:"Failed to update Claude validation: {{message}}"},presets:{title:"Routing presets",description:"Capture the current Anthropic routing map and switch providers with one click.",namePlaceholder:"Preset name, e.g. fox",save:"Save preset",saving:"Saving...",empty:"No presets saved yet.",apply:"Apply",applying:"Applying...",delete:"Delete",deleting:"Deleting...",rulesCount:"{{count}} rules",noRules:"Empty preset",previewTooltip:"Hover to view routing rules",diffTitle:"Confirm preset application",diffDescription:'The following routes will be replaced with preset "{{name}}":',diffAdded:"Added",diffRemoved:"Removed",diffChanged:"Changed",diffConfirm:"Confirm",diffEmpty:"Preset matches current configuration. No changes needed."},validation:{presetName:"Enter a preset name.",presetDuplicate:"Preset {{name}} already exists."},confirm:{deletePreset:'Delete preset "{{name}}"?'}},events:{title:"Security Events",description:"Review validation defenses and system alerts to spot suspicious traffic.",filters:{title:"Filters",allLevels:"All severities",typePlaceholder:"Filter by type (optional)"},actions:{newest:"Newest",older:"Older"},levels:{info:"Info",warn:"Warning",error:"Error"},empty:{title:"No events recorded",subtitle:"There are no security events yet."},details:"View details",defaultTitle:"Untitled event",defaultMessage:"No additional description provided.",toast:{loadFailure:"Failed to load events: {{message}}"}},settings:{title:"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}}",protocolRestartRequired:"Configuration saved. Run cc-gw restart --daemon to apply protocol changes.",copySuccess:"Config path copied to clipboard.",copyFailure:"Copy failed: {{message}}",cleanupSuccess:"{{count}} old logs removed.",cleanupNone:"No logs met the cleanup criteria.",cleanupFailure:"Cleanup failed: {{message}}",clearAllSuccess:"All logs cleared ({{logs}} requests, {{metrics}} daily rows).",clearAllFailure:"Full wipe failed: {{message}}",missingConfig:"Configuration not available. Refresh and try again.",authLoadFailure:"Failed to load security settings: {{message}}"},sections:{basics:"Basic configuration",routing:"Model routing",configFile:"Configuration file",cleanup:"Log cleanup",security:"Access security",protocol:"Protocol Configuration",jump:"Jump to"},fields:{port:"Listen port",host:"Listen host (optional)",hostPlaceholder:"Defaults to 127.0.0.1",retention:"Log retention days",bodyLimit:"Request body limit (MB)",bodyLimitHint:"Default is 10 MB. Increase this value if Claude Code /compact returns 413 errors.",defaults:"Default models",storeRequestPayloads:"Store request bodies",storeRequestPayloadsHint:"Keep the full prompt for debugging; disable if payloads are sensitive.",storeResponsePayloads:"Store response bodies",storeResponsePayloadsHint:"Persist the full model output (including streaming chunks). Disable to reduce disk usage.",logLevel:"Log level",logLevelOption:{fatal:"Fatal",error:"Error",warn:"Warn",info:"Info",debug:"Debug",trace:"Trace"},requestLogging:"Emit request logs",requestLoggingHint:"Controls the “incoming request …” lines printed to the console. Helpful for tracing traffic.",responseLogging:"Emit response logs",responseLoggingHint:"Controls the “request completed …” entries (status + latency). Disable for quieter output.",enableRoutingFallback:"Enable routing fallback",enableRoutingFallbackHint:"Automatically fall back to the first available model when no mapping matches. Disabled by default; enable only if you need legacy behavior."},auth:{description:"Require a username and password before accessing the Web UI. Model relay endpoints (/anthropic, /openai) remain publicly accessible.",enable:"Enable Web UI sign-in",enableHint:"Recommended for shared or production instances. The console and all /api/* routes will require authentication.",username:"Username",usernamePlaceholder:"Set the login username",password:"Password",passwordPlaceholder:"At least 6 characters",confirmPassword:"Confirm password",confirmPasswordPlaceholder:"Re-enter the password",status:"Current status",statusEnabled:"Sign-in protection enabled",statusDisabled:"Sign-in protection disabled",passwordHintRequired:"A new password (≥6 characters) is required when enabling auth or changing the username.",passwordHintOptional:"Optional: set a new password. Leave blank to keep the current password.",actions:{save:"Save security settings"},toast:{success:"Security settings updated.",failure:"Failed to save security settings: {{message}}"},validation:{username:"Please enter a username",minLength:"Password must be at least 6 characters",passwordRequired:"Please provide a password",confirmMismatch:"Passwords do not match"}},protocol:{description:"Configure HTTP and HTTPS service ports (both protocols enabled by default)",restartWarning:"⚠️ Service restart required after modifying protocol configuration",restartHint:"After saving, execute the following command to restart:",restartTip:"💡 Tip: Port, protocol enable status, and certificate paths require restart; Provider and routing configs support hot-reload",http:{enable:"Enable HTTP",hint:"Standard HTTP protocol, suitable for local development and internal networks",port:"HTTP Port",host:"HTTP Host"},https:{enable:"Enable HTTPS",hint:"HTTPS encrypted protocol",port:"HTTPS Port",host:"HTTPS Host",keyPath:"Certificate Private Key Path",certPath:"Certificate File Path",caPath:"CA Certificate Path (Optional)",warning:"⚠️ About HTTPS Certificates",invalidCert:"Self-signed certificates are invalid:",invalidCertDetail:"Claude Code and most AI tools cannot trust self-signed certificates, causing connection failures.",recommended:"Recommended:",recommendedDetail:"For local development, use HTTP protocol (127.0.0.1 local access is secure).",tip:"💡 If HTTPS is required, use certificates from trusted CAs (e.g., Let's Encrypt) or configure a reverse proxy (e.g., Nginx/Caddy) to handle HTTPS."}},validation:{port:"Enter a port between 1 and 65535",retention:"Retention days must be between 1 and 365",bodyLimit:"Request body limit must be between 1 and 2048 MB",routePair:"Fill both the source and target models.",routeDuplicate:"A route for {{model}} already exists."},defaults:{completion:"Conversation: {{model}}",reasoning:"Reasoning: {{model}}",background:"Background: {{model}}",none:"No defaults configured"},routing:{title:"Model routing map",description:"Override Claude Code model requests with provider:model targets (e.g., map Claude to Kimi). Leave empty to fall back to defaults.",titleByEndpoint:"{{endpoint}} routing",descriptionByEndpoint:{anthropic:"Requests hitting the /anthropic endpoint will use these mappings.",openai:"Requests hitting the /openai endpoint will use these mappings."},wildcardHint:"Source model ids accept '*' wildcards (e.g. claude-*); the most specific match wins, and targets defined as providerId:* forward the original requested model name upstream.",add:"Add route",empty:"No custom routes configured. Default strategy will be used.",source:"Source model",target:"Target provider:model",sourceLabel:"Source model",sourcePlaceholder:"e.g. claude-sonnet-4-5-20250929",targetLabel:"Target provider:model",targetPlaceholder:"e.g. kimi:kimi-k2-0905-preview",customTargetOption:"Custom target…",providerPassthroughOption:"{{provider}} · passthrough (*)",remove:"Remove",suggested:"Anthropic presets"},file:{description:"Configuration is stored locally; edit the file for offline adjustments.",unknown:"Unknown path"},cleanup:{description:"Immediately purge logs older than the retention window.",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\`:
251
+ 配置后,客户端通过 \`http://127.0.0.1:4100/claude/v1/messages\` 访问(路径自动扩展)。`,"🗃️ **数据备份**:定期备份 ~/.cc-gw/ 目录(包含配置、日志和数据库)",'🧹 **日志清理**:根据需要调整日志保留天数,或使用"日志清理"功能手动清理','🔍 **问题排查**:开启"保存请求/响应内容"以便调试客户端兼容性问题',"⚡ **性能优化**:关闭不必要的访问日志可降低终端输出,提升服务性能","🎯 **模型切换**:使用路由模板功能,实现不同 Provider 方案的一键切换","📊 **监控告警**:结合 Dashboard 数据设置自定义监控,及时发现异常"]}},faq:{title:"❓ 常见问题解答",items:[{q:"如何解决 Claude Code 连接失败问题?",a:'1) 检查 cc-gw 服务状态:`cc-gw status`\n2) 验证环境变量:`echo $ANTHROPIC_BASE_URL`\n3) 确认 API Key 正确性\n4) 在"请求日志"中查看详细错误信息'},{q:"如何使用自定义接入点?",a:'在"模型管理"页面创建自定义接入点,配置基础路径(如 `/my-endpoint`)和协议类型。系统会自动根据协议注册完整的 API 路径。例如,配置 `/claude` + `anthropic` 协议后,客户端通过 `http://127.0.0.1:4100/claude/v1/messages` 访问。\n\n如果遇到 404 错误,检查:\n1) 端点是否已启用\n2) 客户端使用的是完整路径(包括协议子路径)\n3) 查看服务器日志确认路由是否注册成功'},{q:"为什么没有缓存命中数据?",a:"需要上游 Provider 返回 cached_tokens 或 input_tokens_details.cached_tokens 字段。确认 Provider 支持缓存功能并已正确配置。"},{q:"如何配置多个客户端使用不同模型?",a:'为每个客户端创建独立的 API Key,在"模型管理 → 路由配置"中设置不同的路由规则,或使用不同的环境变量配置。也可以为不同客户端创建专用的自定义接入点。'},{q:"Codex CLI 如何连接到 cc-gw?",a:'配置 ~/.codex/config.toml 文件,设置 model_provider 为 "cc_gw",base_url 为 cc-gw 的 OpenAI 兼容端点,并设置相应的环境变量。'},{q:"如何备份和迁移配置?",a:"备份整个 ~/.cc-gw/ 目录,包含 config.json、数据库和日志文件。在新环境中恢复目录并重启服务即可。"},{q:"Web UI 显示 404 错误怎么办?",a:"确认已执行 `pnpm --filter @cc-gw/web build`,或使用 npm 全局安装版本。检查服务启动日志中的静态资源路径。"}]}},about:{title:"关于",description:"查看 cc-gw 的版本信息、构建元数据与运行状态。",app:{title:"应用信息",subtitle:"版本与构建元数据一目了然。",labels:{name:"名称",version:"版本",buildTime:"构建时间",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:"删除",reveal:"显示完整密钥",hide:"隐藏密钥"},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}}",revealFailure:"获取密钥失败",copyFailure:"复制失败"},allowedEndpoints:"允许的端点",allEndpoints:"全部端点(不限制)",editEndpoints:"编辑端点权限",endpointRestricted:"已限制端点",selectEndpoints:"选择此密钥可以访问的端点,不选择则允许访问全部端点。"},endpoints:{title:"自定义端点",description:"管理自定义 API 端点,支持多种协议类型。",createButton:"新增端点",createTitle:"创建端点",editTitle:"编辑端点",emptyTitle:"暂无自定义端点",emptyDescription:'点击"新增端点"按钮创建您的第一个自定义端点。',loadError:"加载端点列表失败",id:"ID",path:"路径",disabled:"已禁用",hasRouting:"已配置路由",protocols:{anthropic:"Anthropic 协议","openai-chat":"OpenAI Chat","openai-responses":"OpenAI Responses"},protocolHints:{anthropic:"Anthropic Messages API 协议(/v1/messages)","openai-chat":"OpenAI Chat Completions API 协议(/v1/chat/completions)","openai-responses":"OpenAI Responses API 协议(/v1/responses)"},form:{id:"端点 ID",idPlaceholder:"如 custom-api",idHint:"ID 创建后不可修改,用于内部标识。",label:"显示名称",labelPlaceholder:"如 我的自定义 API",path:"访问路径",pathPlaceholder:"如 /custom/api",pathHint:"路径需以 / 开头,修改后立即生效。",protocol:"协议类型",enabled:"启用此端点"},routing:{title:"路由配置(可选)",modelRoutes:"模型路由规则",addRoute:"添加规则",noRoutes:"暂无路由规则",sourceModelPlaceholder:"源模型(如 claude-3-5-sonnet-20241022)",targetPlaceholder:"目标(如 anthropic:claude-3-5-sonnet-20241022)",modelRoutesHint:"格式:源模型 → provider:model,支持通配符(如 gpt-* → openai:*)",defaults:"默认模型配置",defaultCompletion:"常规对话默认模型",defaultReasoning:"推理任务默认模型",defaultBackground:"后台任务默认模型",longContextThreshold:"长上下文阈值(tokens)",defaultPlaceholder:"如 anthropic:claude-3-5-sonnet-20241022"},createSuccess:"端点创建成功",createError:"创建失败:{{error}}",updateSuccess:"端点更新成功",updateError:"更新失败:{{error}}",deleteSuccess:"端点删除成功",deleteError:"删除失败:{{error}}",deleteConfirm:'确定要删除端点 "{{label}}" 吗?此操作无法撤销。',validationError:"请填写所有必填字段"}}},en:{translation:{app:{title:"cc-gw Console",skipToContent:"Skip to main content"},nav:{dashboard:"Dashboard",logs:"Logs",events:"Events",models:"Models & Routing",apiKeys:"API Keys",settings:"Settings",help:"Help",about:"About"},language:{zh:"Simplified Chinese",en:"English"},common:{loading:"Loading...",loadingShort:"Loading...",noData:"No data available",languageSelector:"Language selector",yes:"Yes",edit:"Edit",delete:"Delete",create:"Create",save:"Save",saving:"Saving...",cancel:"Cancel",actions:{refresh:"Refresh",refreshing:"Refreshing...",manualRefresh:"Manual refresh",reset:"Reset",close:"Close",openNavigation:"Open navigation",closeNavigation:"Close navigation",save:"Save changes",saving:"Saving...",cancel:"Cancel",copy:"Copy",testConnection:"Test connection",testingConnection:"Testing...",cleanup:"Clean up logs",cleaning:"Cleaning...",checkUpdates:"Check for updates",logout:"Sign out"},theme:{label:"Theme",light:"Light",dark:"Dark",system:"System"},status:{success:"Success",error:"Error"},notifications:{featureInProgress:"Feature under development. Stay tuned!"},units:{request:"req",ms:"ms",token:"tokens",msPerToken:"ms/token"},noMatches:"No matches",unknownError:"Unknown error",filters:{activeCount:"{{count}} active filters",collapse:"Collapse filters",expand:"Expand filters",allRequests:"All requests"}},login:{title:"Sign in to cc-gw",description:"Authentication is required before accessing the console.",fields:{username:"Username",usernamePlaceholder:"Enter your username",password:"Password",passwordPlaceholder:"Enter your password"},actions:{submit:"Sign in"},validation:{required:"Please enter both username and password",failed:"Sign in failed. Check your credentials and try again."},hint:"Forgot your credentials? You can reset the Web UI login settings from the server CLI or by editing the configuration file.",status:"Signed in as {{username}}"},dashboard:{description:"Monitor request volume and runtime health at a glance.",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",todayCacheRead:"Cache Read Today",todayCacheCreation:"Cache Creation Today",todayOutput:"Output Tokens Today",todayCached:"Cached Tokens Today",avgLatency:"Average Latency"},charts:{requestsTitle:"Request Trends",requestsDesc:"Requests and token usage over the last 14 days",modelTitle:"Model Distribution",modelDesc:"Requests and tokens by model in the past 7 days",barRequests:"Requests",lineInput:"Input tokens",lineOutput:"Output tokens",lineCached:"Cached tokens",lineCacheRead:"Cache Read",lineCacheCreation:"Cache Creation",axisTokens:"Tokens",ttftLabel:"TTFT (ms)",tpotLabel:"TPOT (ms/token)",ttftTitle:"TTFT Comparison",ttftDesc:"Compare first-token latency (TTFT) across models",ttftEmpty:"No TTFT data available.",tpotTitle:"TPOT Comparison",tpotDesc:"Compare per-token latency (TPOT) across models",tpotEmpty:"No TPOT data available.",ttftAxis:"TTFT (ms)",tpotAxis:"TPOT (ms/token)",empty:"No data"},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",cacheReadTokens:"Cache Read",cacheCreationTokens:"Cache Creation",outputTokens:"Output Tokens",stream:"Stream",latency:"Latency (ms)",ttft:"TTFT (ms)",tpot:"TPOT (ms/token)",status:"Status",error:"Error",actions:"Actions"},pagination:{perPage:"per page",unit:"items",previous:"Previous",next:"Next",pageLabel:"Page {{page}} / {{total}}"}},endpointAnthropic:"anthropic",endpointOpenAI:"openai",stream:{streaming:"Streaming",single:"Non-streaming"},toast:{listError:{title:"Failed to fetch logs",desc:"Error: {{message}}"},providerError:{title:"Failed to fetch providers",desc:"Error: {{message}}"},exportSuccess:{title:"Export ready",desc:"A compressed log archive is downloading now."},exportError:{title:"Export failed",desc:"Error: {{message}}"}},detail:{title:"Log Detail",id:"ID #{{id}}",infoSection:"Overview",info:{time:"Time",sessionId:"Session ID",endpoint:"Endpoint",provider:"Provider",requestedModel:"Requested model",noRequestedModel:"Not specified",model:"Routed model",stream:"Stream",latency:"Latency",status:"Status",inputTokens:"Input Tokens",cacheReadTokens:"Cache Read",cacheCreationTokens:"Cache Creation",outputTokens:"Output Tokens",ttft:"TTFT (first token latency)",tpot:"TPOT (avg ms/token)",error:"Error"},summary:{route:"{{from}} → {{to}}",latency:"Latency: {{value}}",ttft:"TTFT: {{value}}",tpot:"TPOT: {{value}}",stream:"Stream: {{value}}"},payload:{request:"Request body",response:"Response body",emptyRequest:"No request content",emptyResponse:"No response content"},apiKey:{title:"API key",name:"Key name",identifier:"Key ID",masked:"Masked form",maskedUnavailable:"No mask available",raw:"Raw key",rawUnavailable:"Raw key not stored",rawMasked:"Raw key (masked)",rawMaskedHint:"For security, only the prefix and suffix are shown. Regenerate the key upstream if you need the full value.",missing:"Not recorded",lastUsed:"Last used"},copy:{requestSuccess:"Request body copied to clipboard.",responseSuccess:"Response body copied to clipboard.",keySuccess:"API key copied to clipboard.",empty:"Cannot copy empty {{label}}.",failure:"Copy failed",failureFallback:"Unable to copy content. Please try again later."},loadError:"Unable to load log detail."}},providers:{title:"Model Providers",description:"Manage integrated services and default models.",emptyState:'No providers yet. Click "Add provider" to get started.',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:"Select the API authentication method and fill in the corresponding key.",authModeApiKey:"Default (Anthropic: x-api-key / OpenAI: Bearer)",authModeAuthToken:"Authorization: Bearer",authModeXAuthToken:"X-Auth-Token",models:"Model configuration",showAdvanced:"Show advanced options",hideAdvanced:"Hide advanced options",addModel:"Add model",modelId:"Model ID",modelIdPlaceholder:"e.g. claude-sonnet-4-5-20250929",modelLabel:"Display name (optional)",modelLabelPlaceholder:"e.g. GPT-4 Flagship",setDefault:"Set as default",removeModel:"Remove model"},errors:{idRequired:"Provider ID is required",idDuplicate:"Provider ID already exists",baseUrlInvalid:"Invalid Base URL",modelsRequired:"Configure at least one model",modelInvalid:"Model IDs must be unique and non-empty",defaultInvalid:"Default model must exist in the list"},toast:{saveFailure:"Save failed: {{message}}"},noModelsTitle:"Pass-through Mode Enabled",noModelsHint:"No models are defined. This provider will run in pass-through mode—map routes in model routing or specify models directly in requests.",routeExample:"Route Mapping Example:"},confirm:{delete:"Remove provider “{{name}}”?"}},modelManagement:{title:"Models & Routing",description:"Configure providers, routing rules, and custom endpoints.",tabs:{providers:"Providers",providersDesc:"Manage upstream providers and authentication.",anthropic:"Anthropic Routing",anthropicDesc:"Control mappings for the /anthropic endpoint.",openai:"OpenAI Routing",openaiDesc:"Control mappings for the /openai endpoint.",customEndpoint:"Custom Endpoint"},addEndpoint:"Add Endpoint",createEndpoint:"Create Endpoint",editEndpoint:"Edit Endpoint",deleteEndpointConfirm:'Are you sure you want to delete endpoint "{{label}}"? This action cannot be undone.',deleteEndpointSuccess:"Endpoint deleted successfully",deleteEndpointError:"Failed to delete: {{error}}",createEndpointSuccess:"Endpoint created successfully",createEndpointError:"Failed to create: {{error}}",updateEndpointSuccess:"Endpoint updated successfully",updateEndpointError:"Failed to update: {{error}}",endpointValidationError:"Please fill in all required fields",pathValidationError:"Please fill in all path information",atLeastOnePath:"At least one path is required",endpointId:"Endpoint ID",endpointIdPlaceholder:"e.g. custom-api",endpointIdHint:"ID cannot be changed after creation, used for internal identification.",endpointLabel:"Display Name",endpointLabelPlaceholder:"e.g. My Custom API",endpointPath:"Access Path",endpointPaths:"Access Paths",endpointPathPlaceholder:"e.g. /custom/api",endpointPathHint:"Path must start with /. Changes take effect immediately.",endpointProtocol:"Protocol Type",endpointEnabled:"Enable this endpoint",endpointRoutingHint:"After creation, you can configure routing rules in this endpoint's routing tab.",addPath:"Add Path",removePath:"Remove Path",protocolAnthropic:"Anthropic Protocol",protocolOpenAI:"OpenAI",protocolOpenAIChat:"OpenAI Chat",protocolOpenAIResponses:"OpenAI Responses",protocolHint:{anthropic:"Anthropic Messages API protocol (/v1/messages)","openai-auto":"OpenAI protocol (supports Chat Completions and Responses APIs). Path must end with /v1/chat/completions or /v1/responses.","openai-chat":"OpenAI Chat Completions API protocol (/v1/chat/completions)","openai-responses":"OpenAI Responses API protocol (/v1/responses)"},actions:{saveRoutes:"Save routes"},routing:{selectTarget:"Select provider:model"},claudeValidation:{title:"Claude Code request validation",description:"When enabled, /anthropic requests must follow the Claude Code schema; invalid payloads are rejected with 430.",toggleLabel:"Enable validation",statusEnabled:"Claude Code validation enabled",statusDisabled:"Disabled by default"},toast:{routesSaved:"Model routes updated successfully.",routesSaveFailure:"Failed to save model routes: {{message}}",presetSaved:'Preset "{{name}}" saved.',presetSaveFailure:"Failed to save preset: {{message}}",presetApplySuccess:'Applied preset "{{name}}".',presetApplyFailure:"Failed to apply preset: {{message}}",presetDeleteSuccess:'Preset "{{name}}" deleted.',presetDeleteFailure:"Failed to delete preset: {{message}}",claudeValidationEnabled:"Claude Code request validation enabled.",claudeValidationDisabled:"Claude Code request validation disabled.",claudeValidationFailure:"Failed to update Claude validation: {{message}}"},presets:{title:"Routing presets",description:"Capture the current Anthropic routing map and switch providers with one click.",namePlaceholder:"Preset name, e.g. fox",save:"Save preset",saving:"Saving...",empty:"No presets saved yet.",apply:"Apply",applying:"Applying...",delete:"Delete",deleting:"Deleting...",rulesCount:"{{count}} rules",noRules:"Empty preset",previewTooltip:"Hover to view routing rules",diffTitle:"Confirm preset application",diffDescription:'The following routes will be replaced with preset "{{name}}":',diffAdded:"Added",diffRemoved:"Removed",diffChanged:"Changed",diffConfirm:"Confirm",diffEmpty:"Preset matches current configuration. No changes needed."},validation:{presetName:"Enter a preset name.",presetDuplicate:"Preset {{name}} already exists."},confirm:{deletePreset:'Delete preset "{{name}}"?'}},events:{title:"Security Events",description:"Review validation defenses and system alerts to spot suspicious traffic.",filters:{title:"Filters",allLevels:"All severities",typePlaceholder:"Filter by type (optional)"},actions:{newest:"Newest",older:"Older"},levels:{info:"Info",warn:"Warning",error:"Error"},empty:{title:"No events recorded",subtitle:"There are no security events yet."},details:"View details",defaultTitle:"Untitled event",defaultMessage:"No additional description provided.",toast:{loadFailure:"Failed to load events: {{message}}"}},settings:{title:"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}}",protocolRestartRequired:"Configuration saved. Run cc-gw restart --daemon to apply protocol changes.",copySuccess:"Config path copied to clipboard.",copyFailure:"Copy failed: {{message}}",cleanupSuccess:"{{count}} old logs removed.",cleanupNone:"No logs met the cleanup criteria.",cleanupFailure:"Cleanup failed: {{message}}",clearAllSuccess:"All logs cleared ({{logs}} requests, {{metrics}} daily rows).",clearAllFailure:"Full wipe failed: {{message}}",missingConfig:"Configuration not available. Refresh and try again.",authLoadFailure:"Failed to load security settings: {{message}}"},sections:{basics:"Basic configuration",routing:"Model routing",configFile:"Configuration file",cleanup:"Log cleanup",security:"Access security",protocol:"Protocol Configuration",jump:"Jump to"},fields:{port:"Listen port",host:"Listen host (optional)",hostPlaceholder:"Defaults to 127.0.0.1",retention:"Log retention days",logExportTimeout:"Log export timeout (seconds)",logExportTimeoutHint:"Default is 60 seconds. Increase for larger exports. Range: 5-600 seconds.",bodyLimit:"Request body limit (MB)",bodyLimitHint:"Default is 10 MB. Increase this value if Claude Code /compact returns 413 errors.",defaults:"Default models",storeRequestPayloads:"Store request bodies",storeRequestPayloadsHint:"Keep the full prompt for debugging; disable if payloads are sensitive.",storeResponsePayloads:"Store response bodies",storeResponsePayloadsHint:"Persist the full model output (including streaming chunks). Disable to reduce disk usage.",logLevel:"Log level",logLevelOption:{fatal:"Fatal",error:"Error",warn:"Warn",info:"Info",debug:"Debug",trace:"Trace"},requestLogging:"Emit request logs",requestLoggingHint:"Controls the “incoming request …” lines printed to the console. Helpful for tracing traffic.",responseLogging:"Emit response logs",responseLoggingHint:"Controls the “request completed …” entries (status + latency). Disable for quieter output.",enableRoutingFallback:"Enable routing fallback",enableRoutingFallbackHint:"Automatically fall back to the first available model when no mapping matches. Disabled by default; enable only if you need legacy behavior."},auth:{description:"Require a username and password before accessing the Web UI. Model relay endpoints (/anthropic, /openai) remain publicly accessible.",enable:"Enable Web UI sign-in",enableHint:"Recommended for shared or production instances. The console and all /api/* routes will require authentication.",username:"Username",usernamePlaceholder:"Set the login username",password:"Password",passwordPlaceholder:"At least 6 characters",confirmPassword:"Confirm password",confirmPasswordPlaceholder:"Re-enter the password",status:"Current status",statusEnabled:"Sign-in protection enabled",statusDisabled:"Sign-in protection disabled",passwordHintRequired:"A new password (≥6 characters) is required when enabling auth or changing the username.",passwordHintOptional:"Optional: set a new password. Leave blank to keep the current password.",actions:{save:"Save security settings"},toast:{success:"Security settings updated.",failure:"Failed to save security settings: {{message}}"},validation:{username:"Please enter a username",minLength:"Password must be at least 6 characters",passwordRequired:"Please provide a password",confirmMismatch:"Passwords do not match"}},protocol:{description:"Configure HTTP and HTTPS service ports (both protocols enabled by default)",restartWarning:"⚠️ Service restart required after modifying protocol configuration",restartHint:"After saving, execute the following command to restart:",restartTip:"💡 Tip: Port, protocol enable status, and certificate paths require restart; Provider and routing configs support hot-reload",http:{enable:"Enable HTTP",hint:"Standard HTTP protocol, suitable for local development and internal networks",port:"HTTP Port",host:"HTTP Host"},https:{enable:"Enable HTTPS",hint:"HTTPS encrypted protocol",port:"HTTPS Port",host:"HTTPS Host",keyPath:"Certificate Private Key Path",certPath:"Certificate File Path",caPath:"CA Certificate Path (Optional)",warning:"⚠️ About HTTPS Certificates",invalidCert:"Self-signed certificates are invalid:",invalidCertDetail:"Claude Code and most AI tools cannot trust self-signed certificates, causing connection failures.",recommended:"Recommended:",recommendedDetail:"For local development, use HTTP protocol (127.0.0.1 local access is secure).",tip:"💡 If HTTPS is required, use certificates from trusted CAs (e.g., Let's Encrypt) or configure a reverse proxy (e.g., Nginx/Caddy) to handle HTTPS."}},validation:{port:"Enter a port between 1 and 65535",retention:"Retention days must be between 1 and 365",logExportTimeout:"Log export timeout must be between 5 and 600 seconds",bodyLimit:"Request body limit must be between 1 and 2048 MB",routePair:"Fill both the source and target models.",routeDuplicate:"A route for {{model}} already exists."},defaults:{completion:"Conversation: {{model}}",reasoning:"Reasoning: {{model}}",background:"Background: {{model}}",none:"No defaults configured"},routing:{title:"Model routing map",description:"Override Claude Code model requests with provider:model targets (e.g., map Claude to Kimi). Leave empty to fall back to defaults.",titleByEndpoint:"{{endpoint}} routing",descriptionByEndpoint:{anthropic:"Requests hitting the /anthropic endpoint will use these mappings.",openai:"Requests hitting the /openai endpoint will use these mappings."},wildcardHint:"Source model ids accept '*' wildcards (e.g. claude-*); the most specific match wins, and targets defined as providerId:* forward the original requested model name upstream.",add:"Add route",empty:"No custom routes configured. Default strategy will be used.",source:"Source model",target:"Target provider:model",sourceLabel:"Source model",sourcePlaceholder:"e.g. claude-sonnet-4-5-20250929",targetLabel:"Target provider:model",targetPlaceholder:"e.g. kimi:kimi-k2-0905-preview",customTargetOption:"Custom target…",providerPassthroughOption:"{{provider}} · passthrough (*)",remove:"Remove",suggested:"Anthropic presets"},file:{description:"Configuration is stored locally; edit the file for offline adjustments.",unknown:"Unknown path"},cleanup:{description:"Immediately purge logs older than the retention window.",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\`:
252
252
  \`\`\`toml
253
253
  model = "gpt-5-codex"
254
254
  model_provider = "cc_gw"
@@ -277,4 +277,4 @@ env_key = "cc_gw_key"
277
277
  "protocol": "anthropic"
278
278
  }
279
279
  \`\`\`
280
- After configuration, clients access via \`http://127.0.0.1:4100/claude/v1/messages\` (path auto-expansion).`,'Enable "Store request/response bodies" to copy raw payloads from the log drawer when troubleshooting.',"Turn off request or response logs individually to keep the console quiet while preserving metrics and database records.","Use **routing presets** to save common routing configurations and quickly switch between different provider setups.","If you edit ~/.cc-gw/config.json manually, refresh the Settings page or restart cc-gw so the UI reflects the latest configuration."]}},faq:{title:"Frequently asked questions",items:[{q:"How can I change the default model for each endpoint?",a:'Go to "Model Management → Routing" and choose defaults for /anthropic and /openai. Saving applies the change right away.'},{q:"How do I use custom endpoints?",a:'Create a custom endpoint in the "Model Management" page by configuring a base path (e.g., `/my-endpoint`) and protocol type. The system automatically registers full API paths based on the protocol. For example, after configuring `/claude` + `anthropic` protocol, clients access via `http://127.0.0.1:4100/claude/v1/messages`.\n\nIf you encounter 404 errors, check:\n1) Is the endpoint enabled?\n2) Are clients using the complete path (including protocol subpath)?\n3) Check server logs to confirm route registration'},{q:"Why are cached token numbers missing?",a:"Upstream providers must return cached_tokens or input_tokens_details.cached_tokens. Enable cache metrics on the provider if supported."},{q:"How can I use different models for different clients?",a:'Create separate API keys for each client and configure different routing rules in "Model Management → Routing". You can also create dedicated custom endpoints for different clients.'}]}},apiKeys:{title:"API Keys Management",description:"Create and manage API keys for gateway access",createNew:"Create New Key",createAction:"Create",createDescription:"Create a new API key for authentication and optionally add a description.",descriptionLabel:"Key description (optional)",keyDescriptionPlaceholder:"e.g. Internal staging access only",keyNamePlaceholder:"Enter key name",keyCreated:"API Key Created",saveKeyWarning:"Keep this key secure. You can also reveal the full key anytime from the key list.",wildcard:"Any Key",wildcardHint:"When enabled, any custom key — including an empty key — is accepted. Disable this key to enforce strict authentication.",status:{enabled:"Enabled",disabled:"Disabled"},actions:{enable:"Enable",disable:"Disable",delete:"Delete",reveal:"Reveal key",hide:"Hide key"},created:"Created",lastUsed:"Last Used",requestCount:"Requests",totalTokens:"Total Tokens",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}}",revealFailure:"Failed to reveal key",copyFailure:"Failed to copy"},allowedEndpoints:"Allowed Endpoints",allEndpoints:"All endpoints (unrestricted)",editEndpoints:"Edit Endpoint Access",endpointRestricted:"Restricted",selectEndpoints:"Select which endpoints this key can access. Leave empty to allow all."},about:{title:"About",description:"Review cc-gw version details, build metadata, and current runtime status.",app:{title:"Application",subtitle:"Gateway build metadata at a glance.",labels:{name:"Name",version:"Version",buildTime:"Build time",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."}},endpoints:{title:"Custom Endpoints",description:"Manage custom API endpoints with multiple protocol support.",createButton:"Add Endpoint",createTitle:"Create Endpoint",editTitle:"Edit Endpoint",emptyTitle:"No custom endpoints",emptyDescription:'Click "Add Endpoint" to create your first custom endpoint.',loadError:"Failed to load endpoints",id:"ID",path:"Path",disabled:"Disabled",hasRouting:"Routing configured",protocols:{anthropic:"Anthropic Protocol","openai-chat":"OpenAI Chat","openai-responses":"OpenAI Responses"},protocolHints:{anthropic:"Anthropic Messages API protocol (/v1/messages)","openai-chat":"OpenAI Chat Completions API protocol (/v1/chat/completions)","openai-responses":"OpenAI Responses API protocol (/v1/responses)"},form:{id:"Endpoint ID",idPlaceholder:"e.g. custom-api",idHint:"ID cannot be changed after creation, used for internal identification.",label:"Display Name",labelPlaceholder:"e.g. My Custom API",path:"Access Path",pathPlaceholder:"e.g. /custom/api",pathHint:"Path must start with /. Changes take effect immediately.",protocol:"Protocol Type",enabled:"Enable this endpoint"},routing:{title:"Routing Configuration (Optional)",modelRoutes:"Model Routing Rules",addRoute:"Add Rule",noRoutes:"No routing rules",sourceModelPlaceholder:"Source model (e.g. claude-3-5-sonnet-20241022)",targetPlaceholder:"Target (e.g. anthropic:claude-3-5-sonnet-20241022)",modelRoutesHint:"Format: source model → provider:model, wildcards supported (e.g. gpt-* → openai:*)",defaults:"Default Model Configuration",defaultCompletion:"Default for completion tasks",defaultReasoning:"Default for reasoning tasks",defaultBackground:"Default for background tasks",longContextThreshold:"Long context threshold (tokens)",defaultPlaceholder:"e.g. anthropic:claude-3-5-sonnet-20241022"},createSuccess:"Endpoint created successfully",createError:"Failed to create: {{error}}",updateSuccess:"Endpoint updated successfully",updateError:"Failed to update: {{error}}",deleteSuccess:"Endpoint deleted successfully",deleteError:"Failed to delete: {{error}}",deleteConfirm:'Are you sure you want to delete endpoint "{{label}}"? This action cannot be undone.',validationError:"Please fill in all required fields"}}}};ke.isInitialized||ke.use(_C).init({resources:g2,lng:"zh",fallbackLng:"en",interpolation:{escapeValue:!1}});const I0=p.createContext(void 0);function y2(){return`toast_${Math.random().toString(36).slice(2)}`}function v2({children:e}){const[t,n]=p.useState([]),r=p.useCallback(a=>{n(l=>l.filter(u=>u.id!==a))},[]),o=p.useCallback(a=>{n(l=>l.map(u=>u.id===a?{...u,dismissing:!0}:u)),setTimeout(()=>r(a),200)},[r]),s=p.useCallback(a=>{const l=a.id??y2();n(c=>[...c,{...a,id:l}]);const u=a.durationMs??3e3;u>0&&setTimeout(()=>o(l),u)},[o]),i=p.useMemo(()=>({toasts:t,pushToast:s,dismissToast:o}),[t,o,s]);return C.jsxs(I0.Provider,{value:i,children:[e,C.jsx("div",{"aria-live":"polite","aria-atomic":"false",className:"fixed right-6 top-6 z-50 flex w-80 flex-col gap-3",children:t.map(a=>C.jsx("div",{role:"alert",className:`rounded-md border border-slate-200 bg-white p-4 shadow-lg dark:border-slate-700 dark:bg-slate-800 ${a.dismissing?"animate-toast-out":"animate-toast-in"} ${a.variant==="error"?"border-red-200 bg-red-50 text-red-900 dark:border-red-700 dark:bg-red-900/40 dark:text-red-200":a.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:C.jsxs("div",{className:"flex items-start justify-between gap-4",children:[C.jsxs("div",{children:[C.jsx("p",{className:"text-sm font-semibold",children:a.title}),a.description?C.jsx("p",{className:"mt-1 text-sm opacity-75",children:a.description}):null]}),C.jsx("button",{type:"button","aria-label":"Dismiss",className:"text-sm text-slate-500 hover:text-slate-900 dark:text-slate-400 dark:hover:text-slate-100",onClick:()=>a.id&&o(a.id),children:"×"})]})},a.id))})]})}function oN(){const e=p.useContext(I0);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function w2({children:e}){const[t]=p.useState(()=>new KO);return C.jsx(WO,{client:t,children:C.jsx(UC,{i18n:ke,children:C.jsx(rb,{children:C.jsx(v2,{children:C.jsx(yO,{children:e})})})})})}function M0(){const{t:e}=Er();return C.jsx("div",{className:"flex h-full items-center justify-center p-12",role:"status","aria-live":"polite",children:C.jsxs("div",{className:"flex flex-col items-center gap-4",children:[C.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"}),C.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:e("common.loading")})]})})}function sN(){const{t:e}=Er();return C.jsxs("div",{className:"flex items-center gap-3 text-sm text-slate-500 dark:text-slate-400",children:[C.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-slate-300 border-t-transparent dark:border-slate-600"}),C.jsx("span",{children:e("common.loading")})]})}const x2=p.lazy(()=>fn(()=>import("./Dashboard-B61eM9AQ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]))),S2=p.lazy(()=>fn(()=>import("./Logs-Cy6rL2PL.js"),__vite__mapDeps([8,6,2,3,9,10,11,5,7,12]))),C2=p.lazy(()=>fn(()=>import("./Events-DXUNZen5.js"),__vite__mapDeps([13,3,10,5,7,12]))),Wh=p.lazy(()=>fn(()=>import("./ModelManagement-D2ZQEDua.js"),__vite__mapDeps([14,6,3,10,11,5,15,7,16,12]))),b2=p.lazy(()=>fn(()=>import("./ApiKeys-jnqKcfat.js"),__vite__mapDeps([17,1,6,3,4,5,9,10,11,16,18]))),E2=p.lazy(()=>fn(()=>import("./Settings-Bz_Hag2N.js"),__vite__mapDeps([19,6,3,9,10,11,5,15,7,18]))),k2=p.lazy(()=>fn(()=>import("./About-CE2fqYju.js"),__vite__mapDeps([20,6,3,4,5,21,12]))),P2=p.lazy(()=>fn(()=>import("./Help-DTQVUeCR.js"),__vite__mapDeps([22,3,4,5,9,21]))),R2=p.lazy(()=>fn(()=>import("./Login-BcTP1zb_.js"),__vite__mapDeps([23,10,11,5])));function T2({children:e}){const{authEnabled:t,isAuthenticated:n,loading:r}=C0(),o=Yn();return r?C.jsx(M0,{}):!t||n?e:C.jsx(Py,{to:"/login",replace:!0,state:{from:o}})}function A2(){return C.jsx(w2,{children:C.jsx(gC,{basename:typeof window<"u"&&window.location.pathname.startsWith("/ui")?"/ui":"/",children:C.jsx(p.Suspense,{fallback:C.jsx(M0,{}),children:C.jsxs(lC,{children:[C.jsxs(tt,{path:"/",element:C.jsx(T2,{children:C.jsx(wO,{})}),children:[C.jsx(tt,{index:!0,element:C.jsx(x2,{})}),C.jsx(tt,{path:"logs",element:C.jsx(S2,{})}),C.jsx(tt,{path:"events",element:C.jsx(C2,{})}),C.jsx(tt,{path:"models",element:C.jsx(Wh,{})}),C.jsx(tt,{path:"providers",element:C.jsx(Wh,{})}),C.jsx(tt,{path:"api-keys",element:C.jsx(b2,{})}),C.jsx(tt,{path:"settings",element:C.jsx(E2,{})}),C.jsx(tt,{path:"about",element:C.jsx(k2,{})}),C.jsx(tt,{path:"help",element:C.jsx(P2,{})})]}),C.jsx(tt,{path:"/login",element:C.jsx(R2,{})}),C.jsx(tt,{path:"*",element:C.jsx(Py,{to:"/",replace:!0})})]})})})})}const _0=document.getElementById("root");if(!_0)throw new Error("Root element #root not found");pu.createRoot(_0).render(C.jsx(Yt.StrictMode,{children:C.jsx(A2,{})}));export{nm as $,Rv as A,HC as B,KC as C,yP as D,Vv as E,GC as F,Sa as G,bE as H,rv as I,Ld as J,Tv as K,sN as L,Av as M,XC as N,J2 as O,Ne as P,$T as Q,Pv as R,vl as S,zT as T,BT as U,Yw as V,M0 as W,Tp as X,QC as Y,VC as Z,L2 as _,et as a,zt as a0,Yt as a1,N2 as a2,tb as a3,Kk as a4,ev as a5,Zy as a6,Vn as a7,yT as a8,ln as a9,JC as aa,IO as ab,PO as ac,Ac as ad,wl as ae,EO as af,kO as ag,Tc as ah,P0 as ai,UO as aj,AO as ak,tN as al,hb as am,Cy as an,Yn as ao,C0 as ap,oN as b,Oe as c,kt as d,eo as e,Ja as f,Z2 as g,Ls as h,BO as i,C as j,rN as k,xt as l,nN as m,Be as n,il as o,Nd as p,Oo as q,p as r,eN as s,cu as t,Er as u,Ca as v,Ue as w,G as x,kr as y,$d as z};
280
+ After configuration, clients access via \`http://127.0.0.1:4100/claude/v1/messages\` (path auto-expansion).`,'Enable "Store request/response bodies" to copy raw payloads from the log drawer when troubleshooting.',"Turn off request or response logs individually to keep the console quiet while preserving metrics and database records.","Use **routing presets** to save common routing configurations and quickly switch between different provider setups.","If you edit ~/.cc-gw/config.json manually, refresh the Settings page or restart cc-gw so the UI reflects the latest configuration."]}},faq:{title:"Frequently asked questions",items:[{q:"How can I change the default model for each endpoint?",a:'Go to "Model Management → Routing" and choose defaults for /anthropic and /openai. Saving applies the change right away.'},{q:"How do I use custom endpoints?",a:'Create a custom endpoint in the "Model Management" page by configuring a base path (e.g., `/my-endpoint`) and protocol type. The system automatically registers full API paths based on the protocol. For example, after configuring `/claude` + `anthropic` protocol, clients access via `http://127.0.0.1:4100/claude/v1/messages`.\n\nIf you encounter 404 errors, check:\n1) Is the endpoint enabled?\n2) Are clients using the complete path (including protocol subpath)?\n3) Check server logs to confirm route registration'},{q:"Why are cached token numbers missing?",a:"Upstream providers must return cached_tokens or input_tokens_details.cached_tokens. Enable cache metrics on the provider if supported."},{q:"How can I use different models for different clients?",a:'Create separate API keys for each client and configure different routing rules in "Model Management → Routing". You can also create dedicated custom endpoints for different clients.'}]}},apiKeys:{title:"API Keys Management",description:"Create and manage API keys for gateway access",createNew:"Create New Key",createAction:"Create",createDescription:"Create a new API key for authentication and optionally add a description.",descriptionLabel:"Key description (optional)",keyDescriptionPlaceholder:"e.g. Internal staging access only",keyNamePlaceholder:"Enter key name",keyCreated:"API Key Created",saveKeyWarning:"Keep this key secure. You can also reveal the full key anytime from the key list.",wildcard:"Any Key",wildcardHint:"When enabled, any custom key — including an empty key — is accepted. Disable this key to enforce strict authentication.",status:{enabled:"Enabled",disabled:"Disabled"},actions:{enable:"Enable",disable:"Disable",delete:"Delete",reveal:"Reveal key",hide:"Hide key"},created:"Created",lastUsed:"Last Used",requestCount:"Requests",totalTokens:"Total Tokens",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}}",revealFailure:"Failed to reveal key",copyFailure:"Failed to copy"},allowedEndpoints:"Allowed Endpoints",allEndpoints:"All endpoints (unrestricted)",editEndpoints:"Edit Endpoint Access",endpointRestricted:"Restricted",selectEndpoints:"Select which endpoints this key can access. Leave empty to allow all."},about:{title:"About",description:"Review cc-gw version details, build metadata, and current runtime status.",app:{title:"Application",subtitle:"Gateway build metadata at a glance.",labels:{name:"Name",version:"Version",buildTime:"Build time",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."}},endpoints:{title:"Custom Endpoints",description:"Manage custom API endpoints with multiple protocol support.",createButton:"Add Endpoint",createTitle:"Create Endpoint",editTitle:"Edit Endpoint",emptyTitle:"No custom endpoints",emptyDescription:'Click "Add Endpoint" to create your first custom endpoint.',loadError:"Failed to load endpoints",id:"ID",path:"Path",disabled:"Disabled",hasRouting:"Routing configured",protocols:{anthropic:"Anthropic Protocol","openai-chat":"OpenAI Chat","openai-responses":"OpenAI Responses"},protocolHints:{anthropic:"Anthropic Messages API protocol (/v1/messages)","openai-chat":"OpenAI Chat Completions API protocol (/v1/chat/completions)","openai-responses":"OpenAI Responses API protocol (/v1/responses)"},form:{id:"Endpoint ID",idPlaceholder:"e.g. custom-api",idHint:"ID cannot be changed after creation, used for internal identification.",label:"Display Name",labelPlaceholder:"e.g. My Custom API",path:"Access Path",pathPlaceholder:"e.g. /custom/api",pathHint:"Path must start with /. Changes take effect immediately.",protocol:"Protocol Type",enabled:"Enable this endpoint"},routing:{title:"Routing Configuration (Optional)",modelRoutes:"Model Routing Rules",addRoute:"Add Rule",noRoutes:"No routing rules",sourceModelPlaceholder:"Source model (e.g. claude-3-5-sonnet-20241022)",targetPlaceholder:"Target (e.g. anthropic:claude-3-5-sonnet-20241022)",modelRoutesHint:"Format: source model → provider:model, wildcards supported (e.g. gpt-* → openai:*)",defaults:"Default Model Configuration",defaultCompletion:"Default for completion tasks",defaultReasoning:"Default for reasoning tasks",defaultBackground:"Default for background tasks",longContextThreshold:"Long context threshold (tokens)",defaultPlaceholder:"e.g. anthropic:claude-3-5-sonnet-20241022"},createSuccess:"Endpoint created successfully",createError:"Failed to create: {{error}}",updateSuccess:"Endpoint updated successfully",updateError:"Failed to update: {{error}}",deleteSuccess:"Endpoint deleted successfully",deleteError:"Failed to delete: {{error}}",deleteConfirm:'Are you sure you want to delete endpoint "{{label}}"? This action cannot be undone.',validationError:"Please fill in all required fields"}}}};ke.isInitialized||ke.use(_C).init({resources:g2,lng:"zh",fallbackLng:"en",interpolation:{escapeValue:!1}});const I0=p.createContext(void 0);function y2(){return`toast_${Math.random().toString(36).slice(2)}`}function v2({children:e}){const[t,n]=p.useState([]),r=p.useCallback(a=>{n(l=>l.filter(u=>u.id!==a))},[]),o=p.useCallback(a=>{n(l=>l.map(u=>u.id===a?{...u,dismissing:!0}:u)),setTimeout(()=>r(a),200)},[r]),s=p.useCallback(a=>{const l=a.id??y2();n(c=>[...c,{...a,id:l}]);const u=a.durationMs??3e3;u>0&&setTimeout(()=>o(l),u)},[o]),i=p.useMemo(()=>({toasts:t,pushToast:s,dismissToast:o}),[t,o,s]);return C.jsxs(I0.Provider,{value:i,children:[e,C.jsx("div",{"aria-live":"polite","aria-atomic":"false",className:"fixed right-6 top-6 z-50 flex w-80 flex-col gap-3",children:t.map(a=>C.jsx("div",{role:"alert",className:`rounded-md border border-slate-200 bg-white p-4 shadow-lg dark:border-slate-700 dark:bg-slate-800 ${a.dismissing?"animate-toast-out":"animate-toast-in"} ${a.variant==="error"?"border-red-200 bg-red-50 text-red-900 dark:border-red-700 dark:bg-red-900/40 dark:text-red-200":a.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:C.jsxs("div",{className:"flex items-start justify-between gap-4",children:[C.jsxs("div",{children:[C.jsx("p",{className:"text-sm font-semibold",children:a.title}),a.description?C.jsx("p",{className:"mt-1 text-sm opacity-75",children:a.description}):null]}),C.jsx("button",{type:"button","aria-label":"Dismiss",className:"text-sm text-slate-500 hover:text-slate-900 dark:text-slate-400 dark:hover:text-slate-100",onClick:()=>a.id&&o(a.id),children:"×"})]})},a.id))})]})}function oN(){const e=p.useContext(I0);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function w2({children:e}){const[t]=p.useState(()=>new KO);return C.jsx(WO,{client:t,children:C.jsx(UC,{i18n:ke,children:C.jsx(rb,{children:C.jsx(v2,{children:C.jsx(yO,{children:e})})})})})}function M0(){const{t:e}=Er();return C.jsx("div",{className:"flex h-full items-center justify-center p-12",role:"status","aria-live":"polite",children:C.jsxs("div",{className:"flex flex-col items-center gap-4",children:[C.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"}),C.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:e("common.loading")})]})})}function sN(){const{t:e}=Er();return C.jsxs("div",{className:"flex items-center gap-3 text-sm text-slate-500 dark:text-slate-400",children:[C.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-slate-300 border-t-transparent dark:border-slate-600"}),C.jsx("span",{children:e("common.loading")})]})}const x2=p.lazy(()=>fn(()=>import("./Dashboard-Bv6E5M2u.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]))),S2=p.lazy(()=>fn(()=>import("./Logs-CRnJOy2J.js"),__vite__mapDeps([8,6,2,3,9,10,11,5,7,12]))),C2=p.lazy(()=>fn(()=>import("./Events-DyqUKr1b.js"),__vite__mapDeps([13,3,10,5,7,12]))),Wh=p.lazy(()=>fn(()=>import("./ModelManagement-DAE8AYAE.js"),__vite__mapDeps([14,6,3,10,11,5,15,7,16,12]))),b2=p.lazy(()=>fn(()=>import("./ApiKeys-BHwlIBRG.js"),__vite__mapDeps([17,1,6,3,4,5,9,10,11,16,18]))),E2=p.lazy(()=>fn(()=>import("./Settings-CssUPWdg.js"),__vite__mapDeps([19,6,3,9,10,11,5,15,7,18]))),k2=p.lazy(()=>fn(()=>import("./About-Bjq70P_K.js"),__vite__mapDeps([20,6,3,4,5,21,12]))),P2=p.lazy(()=>fn(()=>import("./Help-BNn_Zuo4.js"),__vite__mapDeps([22,3,4,5,9,21]))),R2=p.lazy(()=>fn(()=>import("./Login-BHXuuVq3.js"),__vite__mapDeps([23,10,11,5])));function T2({children:e}){const{authEnabled:t,isAuthenticated:n,loading:r}=C0(),o=Yn();return r?C.jsx(M0,{}):!t||n?e:C.jsx(Py,{to:"/login",replace:!0,state:{from:o}})}function A2(){return C.jsx(w2,{children:C.jsx(gC,{basename:typeof window<"u"&&window.location.pathname.startsWith("/ui")?"/ui":"/",children:C.jsx(p.Suspense,{fallback:C.jsx(M0,{}),children:C.jsxs(lC,{children:[C.jsxs(tt,{path:"/",element:C.jsx(T2,{children:C.jsx(wO,{})}),children:[C.jsx(tt,{index:!0,element:C.jsx(x2,{})}),C.jsx(tt,{path:"logs",element:C.jsx(S2,{})}),C.jsx(tt,{path:"events",element:C.jsx(C2,{})}),C.jsx(tt,{path:"models",element:C.jsx(Wh,{})}),C.jsx(tt,{path:"providers",element:C.jsx(Wh,{})}),C.jsx(tt,{path:"api-keys",element:C.jsx(b2,{})}),C.jsx(tt,{path:"settings",element:C.jsx(E2,{})}),C.jsx(tt,{path:"about",element:C.jsx(k2,{})}),C.jsx(tt,{path:"help",element:C.jsx(P2,{})})]}),C.jsx(tt,{path:"/login",element:C.jsx(R2,{})}),C.jsx(tt,{path:"*",element:C.jsx(Py,{to:"/",replace:!0})})]})})})})}const _0=document.getElementById("root");if(!_0)throw new Error("Root element #root not found");pu.createRoot(_0).render(C.jsx(Yt.StrictMode,{children:C.jsx(A2,{})}));export{nm as $,Rv as A,HC as B,KC as C,yP as D,Vv as E,GC as F,Sa as G,bE as H,rv as I,Ld as J,Tv as K,sN as L,Av as M,XC as N,J2 as O,Ne as P,$T as Q,Pv as R,vl as S,zT as T,BT as U,Yw as V,M0 as W,Tp as X,QC as Y,VC as Z,L2 as _,et as a,zt as a0,Yt as a1,N2 as a2,tb as a3,Kk as a4,ev as a5,Zy as a6,Vn as a7,yT as a8,ln as a9,JC as aa,IO as ab,PO as ac,Ac as ad,wl as ae,EO as af,kO as ag,Tc as ah,P0 as ai,UO as aj,AO as ak,tN as al,hb as am,Cy as an,Yn as ao,C0 as ap,oN as b,Oe as c,kt as d,eo as e,Ja as f,Z2 as g,Ls as h,BO as i,C as j,rN as k,xt as l,nN as m,Be as n,il as o,Nd as p,Oo as q,p as r,eN as s,cu as t,Er as u,Ca as v,Ue as w,G as x,kr as y,$d as z};