vbss-translator 1.1.0 → 1.1.2

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.
@@ -1,35 +1,9 @@
1
- (function(J,_){typeof exports=="object"&&typeof module<"u"?_(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],_):(J=typeof globalThis<"u"?globalThis:J||self,_(J["vbss/translator"]={},J.React))})(this,function(J,_){"use strict";var Gs=Object.defineProperty;var Xs=(J,_,ue)=>_ in J?Gs(J,_,{enumerable:!0,configurable:!0,writable:!0,value:ue}):J[_]=ue;var ne=(J,_,ue)=>Xs(J,typeof _!="symbol"?_+"":_,ue);var ue={exports:{}},Oe={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var vt;function Cr(){if(vt)return Oe;vt=1;var t=_,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(l,g,f){var u,h={},x=null,j=null;f!==void 0&&(x=""+f),g.key!==void 0&&(x=""+g.key),g.ref!==void 0&&(j=g.ref);for(u in g)n.call(g,u)&&!i.hasOwnProperty(u)&&(h[u]=g[u]);if(l&&l.defaultProps)for(u in g=l.defaultProps,g)h[u]===void 0&&(h[u]=g[u]);return{$$typeof:e,type:l,key:x,ref:j,props:h,_owner:s.current}}return Oe.Fragment=r,Oe.jsx=a,Oe.jsxs=a,Oe}var Ce={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Rt;function Ar(){return Rt||(Rt=1,process.env.NODE_ENV!=="production"&&function(){var t=_,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),j=Symbol.for("react.offscreen"),d=Symbol.iterator,E="@@iterator";function b(o){if(o===null||typeof o!="object")return null;var p=d&&o[d]||o[E];return typeof p=="function"?p:null}var k=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function A(o){{for(var p=arguments.length,m=new Array(p>1?p-1:0),v=1;v<p;v++)m[v-1]=arguments[v];F("error",o,m)}}function F(o,p,m){{var v=k.ReactDebugCurrentFrame,P=v.getStackAddendum();P!==""&&(p+="%s",m=m.concat([P]));var L=m.map(function(C){return String(C)});L.unshift("Warning: "+p),Function.prototype.apply.call(console[o],console,L)}}var D=!1,q=!1,ae=!1,H=!1,ee=!1,te;te=Symbol.for("react.module.reference");function me(o){return!!(typeof o=="string"||typeof o=="function"||o===n||o===i||ee||o===s||o===f||o===u||H||o===j||D||q||ae||typeof o=="object"&&o!==null&&(o.$$typeof===x||o.$$typeof===h||o.$$typeof===a||o.$$typeof===l||o.$$typeof===g||o.$$typeof===te||o.getModuleId!==void 0))}function fe(o,p,m){var v=o.displayName;if(v)return v;var P=p.displayName||p.name||"";return P!==""?m+"("+P+")":m}function ce(o){return o.displayName||"Context"}function K(o){if(o==null)return null;if(typeof o.tag=="number"&&A("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case n:return"Fragment";case r:return"Portal";case i:return"Profiler";case s:return"StrictMode";case f:return"Suspense";case u:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case l:var p=o;return ce(p)+".Consumer";case a:var m=o;return ce(m._context)+".Provider";case g:return fe(o,o.render,"ForwardRef");case h:var v=o.displayName||null;return v!==null?v:K(o.type)||"Memo";case x:{var P=o,L=P._payload,C=P._init;try{return K(C(L))}catch{return null}}}return null}var V=Object.assign,y=0,T,R,w,N,ie,W,I;function Q(){}Q.__reactDisabledLog=!0;function de(){{if(y===0){T=console.log,R=console.info,w=console.warn,N=console.error,ie=console.group,W=console.groupCollapsed,I=console.groupEnd;var o={configurable:!0,enumerable:!0,value:Q,writable:!0};Object.defineProperties(console,{info:o,log:o,warn:o,error:o,group:o,groupCollapsed:o,groupEnd:o})}y++}}function ye(){{if(y--,y===0){var o={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:V({},o,{value:T}),info:V({},o,{value:R}),warn:V({},o,{value:w}),error:V({},o,{value:N}),group:V({},o,{value:ie}),groupCollapsed:V({},o,{value:W}),groupEnd:V({},o,{value:I})})}y<0&&A("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Xe=k.ReactCurrentDispatcher,De;function Te(o,p,m){{if(De===void 0)try{throw Error()}catch(P){var v=P.stack.trim().match(/\n( *(at )?)/);De=v&&v[1]||""}return`
18
- `+De+o}}var re=!1,be;{var $e=typeof WeakMap=="function"?WeakMap:Map;be=new $e}function Se(o,p){if(!o||re)return"";{var m=be.get(o);if(m!==void 0)return m}var v;re=!0;var P=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var L;L=Xe.current,Xe.current=null,de();try{if(p){var C=function(){throw Error()};if(Object.defineProperty(C.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(C,[])}catch(Z){v=Z}Reflect.construct(o,[],C)}else{try{C.call()}catch(Z){v=Z}o.call(C.prototype)}}else{try{throw Error()}catch(Z){v=Z}o()}}catch(Z){if(Z&&v&&typeof Z.stack=="string"){for(var O=Z.stack.split(`
19
- `),Y=v.stack.split(`
20
- `),M=O.length-1,B=Y.length-1;M>=1&&B>=0&&O[M]!==Y[B];)B--;for(;M>=1&&B>=0;M--,B--)if(O[M]!==Y[B]){if(M!==1||B!==1)do if(M--,B--,B<0||O[M]!==Y[B]){var se=`
21
- `+O[M].replace(" at new "," at ");return o.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",o.displayName)),typeof o=="function"&&be.set(o,se),se}while(M>=1&&B>=0);break}}}finally{re=!1,Xe.current=L,ye(),Error.prepareStackTrace=P}var xe=o?o.displayName||o.name:"",Ee=xe?Te(xe):"";return typeof o=="function"&&be.set(o,Ee),Ee}function pt(o,p,m){return Se(o,!1)}function xs(o){var p=o.prototype;return!!(p&&p.isReactComponent)}function Qe(o,p,m){if(o==null)return"";if(typeof o=="function")return Se(o,xs(o));if(typeof o=="string")return Te(o);switch(o){case f:return Te("Suspense");case u:return Te("SuspenseList")}if(typeof o=="object")switch(o.$$typeof){case g:return pt(o.render);case h:return Qe(o.type,p,m);case x:{var v=o,P=v._payload,L=v._init;try{return Qe(L(P),p,m)}catch{}}}return""}var Ne=Object.prototype.hasOwnProperty,gr={},mr=k.ReactDebugCurrentFrame;function Ze(o){if(o){var p=o._owner,m=Qe(o.type,o._source,p?p.type:null);mr.setExtraStackFrame(m)}else mr.setExtraStackFrame(null)}function Os(o,p,m,v,P){{var L=Function.call.bind(Ne);for(var C in o)if(L(o,C)){var O=void 0;try{if(typeof o[C]!="function"){var Y=Error((v||"React class")+": "+m+" type `"+C+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[C]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Y.name="Invariant Violation",Y}O=o[C](p,C,v,m,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(M){O=M}O&&!(O instanceof Error)&&(Ze(P),A("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",v||"React class",m,C,typeof O),Ze(null)),O instanceof Error&&!(O.message in gr)&&(gr[O.message]=!0,Ze(P),A("Failed %s type: %s",m,O.message),Ze(null))}}}var Cs=Array.isArray;function gt(o){return Cs(o)}function As(o){{var p=typeof Symbol=="function"&&Symbol.toStringTag,m=p&&o[Symbol.toStringTag]||o.constructor.name||"Object";return m}}function Ps(o){try{return yr(o),!1}catch{return!0}}function yr(o){return""+o}function br(o){if(Ps(o))return A("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",As(o)),yr(o)}var Ue=k.ReactCurrentOwner,ks={key:!0,ref:!0,__self:!0,__source:!0},Er,wr,mt;mt={};function Ls(o){if(Ne.call(o,"ref")){var p=Object.getOwnPropertyDescriptor(o,"ref").get;if(p&&p.isReactWarning)return!1}return o.ref!==void 0}function Fs(o){if(Ne.call(o,"key")){var p=Object.getOwnPropertyDescriptor(o,"key").get;if(p&&p.isReactWarning)return!1}return o.key!==void 0}function js(o,p){if(typeof o.ref=="string"&&Ue.current&&p&&Ue.current.stateNode!==p){var m=K(Ue.current.type);mt[m]||(A('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',K(Ue.current.type),o.ref),mt[m]=!0)}}function Ds(o,p){{var m=function(){Er||(Er=!0,A("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",p))};m.isReactWarning=!0,Object.defineProperty(o,"key",{get:m,configurable:!0})}}function Ns(o,p){{var m=function(){wr||(wr=!0,A("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",p))};m.isReactWarning=!0,Object.defineProperty(o,"ref",{get:m,configurable:!0})}}var Us=function(o,p,m,v,P,L,C){var O={$$typeof:e,type:o,key:p,ref:m,props:C,_owner:L};return O._store={},Object.defineProperty(O._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(O,"_self",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.defineProperty(O,"_source",{configurable:!1,enumerable:!1,writable:!1,value:P}),Object.freeze&&(Object.freeze(O.props),Object.freeze(O)),O};function Ms(o,p,m,v,P){{var L,C={},O=null,Y=null;m!==void 0&&(br(m),O=""+m),Fs(p)&&(br(p.key),O=""+p.key),Ls(p)&&(Y=p.ref,js(p,P));for(L in p)Ne.call(p,L)&&!ks.hasOwnProperty(L)&&(C[L]=p[L]);if(o&&o.defaultProps){var M=o.defaultProps;for(L in M)C[L]===void 0&&(C[L]=M[L])}if(O||Y){var B=typeof o=="function"?o.displayName||o.name||"Unknown":o;O&&Ds(C,B),Y&&Ns(C,B)}return Us(o,O,Y,P,v,Ue.current,C)}}var yt=k.ReactCurrentOwner,vr=k.ReactDebugCurrentFrame;function _e(o){if(o){var p=o._owner,m=Qe(o.type,o._source,p?p.type:null);vr.setExtraStackFrame(m)}else vr.setExtraStackFrame(null)}var bt;bt=!1;function Et(o){return typeof o=="object"&&o!==null&&o.$$typeof===e}function Rr(){{if(yt.current){var o=K(yt.current.type);if(o)return`
22
-
23
- Check the render method of \``+o+"`."}return""}}function Is(o){return""}var Tr={};function Bs(o){{var p=Rr();if(!p){var m=typeof o=="string"?o:o.displayName||o.name;m&&(p=`
24
-
25
- Check the top-level render call using <`+m+">.")}return p}}function Sr(o,p){{if(!o._store||o._store.validated||o.key!=null)return;o._store.validated=!0;var m=Bs(p);if(Tr[m])return;Tr[m]=!0;var v="";o&&o._owner&&o._owner!==yt.current&&(v=" It was passed a child from "+K(o._owner.type)+"."),_e(o),A('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',m,v),_e(null)}}function _r(o,p){{if(typeof o!="object")return;if(gt(o))for(var m=0;m<o.length;m++){var v=o[m];Et(v)&&Sr(v,p)}else if(Et(o))o._store&&(o._store.validated=!0);else if(o){var P=b(o);if(typeof P=="function"&&P!==o.entries)for(var L=P.call(o),C;!(C=L.next()).done;)Et(C.value)&&Sr(C.value,p)}}}function Ks(o){{var p=o.type;if(p==null||typeof p=="string")return;var m;if(typeof p=="function")m=p.propTypes;else if(typeof p=="object"&&(p.$$typeof===g||p.$$typeof===h))m=p.propTypes;else return;if(m){var v=K(p);Os(m,o.props,"prop",v,o)}else if(p.PropTypes!==void 0&&!bt){bt=!0;var P=K(p);A("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",P||"Unknown")}typeof p.getDefaultProps=="function"&&!p.getDefaultProps.isReactClassApproved&&A("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Hs(o){{for(var p=Object.keys(o.props),m=0;m<p.length;m++){var v=p[m];if(v!=="children"&&v!=="key"){_e(o),A("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),_e(null);break}}o.ref!==null&&(_e(o),A("Invalid attribute `ref` supplied to `React.Fragment`."),_e(null))}}var xr={};function Or(o,p,m,v,P,L){{var C=me(o);if(!C){var O="";(o===void 0||typeof o=="object"&&o!==null&&Object.keys(o).length===0)&&(O+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Y=Is();Y?O+=Y:O+=Rr();var M;o===null?M="null":gt(o)?M="array":o!==void 0&&o.$$typeof===e?(M="<"+(K(o.type)||"Unknown")+" />",O=" Did you accidentally export a JSX literal instead of a component?"):M=typeof o,A("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",M,O)}var B=Ms(o,p,m,P,L);if(B==null)return B;if(C){var se=p.children;if(se!==void 0)if(v)if(gt(se)){for(var xe=0;xe<se.length;xe++)_r(se[xe],o);Object.freeze&&Object.freeze(se)}else A("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else _r(se,o)}if(Ne.call(p,"key")){var Ee=K(o),Z=Object.keys(p).filter(function(Ys){return Ys!=="key"}),wt=Z.length>0?"{key: someKey, "+Z.join(": ..., ")+": ...}":"{key: someKey}";if(!xr[Ee+wt]){var qs=Z.length>0?"{"+Z.join(": ..., ")+": ...}":"{}";A(`A props object containing a "key" prop is being spread into JSX:
26
- let props = %s;
27
- <%s {...props} />
28
- React keys must be passed directly to JSX without using spread:
29
- let props = %s;
30
- <%s key={someKey} {...props} />`,wt,Ee,qs,Ee),xr[Ee+wt]=!0}}return o===n?Hs(B):Ks(B),B}}function Vs(o,p,m){return Or(o,p,m,!0)}function Ws(o,p,m){return Or(o,p,m,!1)}var zs=Ws,Js=Vs;Ce.Fragment=n,Ce.jsx=zs,Ce.jsxs=Js}()),Ce}var Tt;function Pr(){return Tt||(Tt=1,process.env.NODE_ENV==="production"?ue.exports=Cr():ue.exports=Ar()),ue.exports}var kr=Pr();const St=_.createContext(null),Lr=()=>{const t=_.useContext(St);if(!t)throw new Error("useTranslatorContext must be used within a TranslatorProvider");return t};class _t extends Error{constructor(r){super(r);ne(this,"code","timeout");this.name="ExternalTranslationTimeoutError"}}const Fr="auto",Me=t=>typeof t=="number"&&Number.isFinite(t)&&t>0,jr=t=>{const e=Object.entries(t).sort(([r],[n])=>r===n?0:r<n?-1:1);return Object.fromEntries(e)};class Dr{constructor(e){ne(this,"provider");ne(this,"config");ne(this,"cache");ne(this,"logger");ne(this,"inFlight",new Map);this.provider=e.provider,this.config=e.config,this.cache=e.cache,this.logger=e.logger}isEnabled(){return this.config.enabled}async translate(e){if(!this.isEnabled()){this.debug("external_translation_disabled",{key:e.key,targetLanguage:e.targetLanguage});return}const r=this.normalizeRequest(e);if(!await this.shouldTranslate(r.externalRequest)){this.debug("external_translation_skipped",{key:r.externalRequest.key,targetLanguage:r.externalRequest.targetLanguage});return}const n=this.readFromCache(r.cacheKey);if(n)return this.debug("external_translation_cache_hit",{key:r.externalRequest.key,cacheKey:r.cacheKey}),n;const s=this.inFlight.get(r.cacheKey);if(s)return this.debug("external_translation_deduped",{key:r.externalRequest.key,cacheKey:r.cacheKey}),s;const i=this.executeTranslation(r);return this.inFlight.set(r.cacheKey,i),i}normalizeRequest(e){const r=e.sourceLanguage??Fr,n={text:e.text,sourceLanguage:r,targetLanguage:e.targetLanguage,glossary:e.glossary},s=this.createCacheKey(n),i=Me(e.timeoutMs)?e.timeoutMs:this.config.timeoutMs;return{externalRequest:{key:e.key,text:e.text,targetLanguage:e.targetLanguage,sourceLanguage:r},translateRequest:n,cacheKey:s,timeoutMs:i,signal:e.signal}}async shouldTranslate(e){if(!this.config.shouldTranslate)return!0;try{return this.config.shouldTranslate(e)}catch(r){return this.warn("external_translation_should_translate_error",{key:e.key,language:e.targetLanguage,error:r}),!0}}async executeTranslation(e){try{if(!await this.invokeExternalTranslationHook(e.externalRequest)){this.debug("external_translation_vetoed",{key:e.externalRequest.key,targetLanguage:e.externalRequest.targetLanguage});return}this.debug("external_translation_started",{key:e.externalRequest.key,cacheKey:e.cacheKey});const r=await this.translateWithTimeout(e.translateRequest,e.timeoutMs,e.signal);return this.writeToCache(e.cacheKey,r),this.notifyTranslationComplete(r),this.debug("external_translation_succeeded",{key:e.externalRequest.key,cacheKey:e.cacheKey}),r}catch(r){const n=this.normalizeError(r);this.handleTranslationError(e,n);return}finally{this.inFlight.delete(e.cacheKey)}}async invokeExternalTranslationHook(e){const r=this.config.onExternalTranslation;if(!r)return!0;try{const n=await r(e);return typeof n=="boolean"?n:!0}catch(n){return this.warn("external_translation_hook_error",{key:e.key,language:e.targetLanguage,error:n}),!0}}async translateWithTimeout(e,r,n){if(!(typeof AbortController=="function"))return this.provider.translate(e,{timeoutMs:Me(r)?r:void 0,signal:n});const i=new AbortController;let a=!1,l;n&&(n.aborted?i.abort():(l=()=>{i.abort()},n.addEventListener("abort",l,{once:!0})));const g=Me(r)&&r?setTimeout(()=>{a=!0,i.abort()},r):void 0;try{return await this.provider.translate(e,{timeoutMs:Me(r)?r:void 0,signal:i.signal})}catch(f){throw a?new _t(`External translation timed out after ${r}ms`):(i.signal.aborted&&!a,f)}finally{g&&clearTimeout(g),l&&n&&n.removeEventListener("abort",l)}}readFromCache(e){var r;return(r=this.cache)==null?void 0:r.get(e)}writeToCache(e,r){var n;(n=this.cache)==null||n.set(e,r)}handleTranslationError(e,r){const n={key:e.externalRequest.key,language:e.externalRequest.targetLanguage,originalText:e.externalRequest.text,error:r};this.notifyTranslationError(n),this.warn("external_fallback_failed",{provider:this.provider.type,key:n.key,language:n.language,errorCode:r.code,retryable:r.retryable,message:r.message,details:r.details})}normalizeError(e){return this.provider.normalizeError?this.provider.normalizeError(e):e instanceof _t?{code:"timeout",message:e.message,retryable:!0,details:e}:e instanceof Error?{code:e.name||"unknown_error",message:e.message,retryable:!1,details:e}:{code:"unknown_error",message:"Unknown provider error",retryable:!1,details:e}}createCacheKey(e){return[e.sourceLanguage,e.targetLanguage,this.hashText(e.text,e.glossary)].join("|")}hashText(e,r){let n=2166136261;const s=r&&Object.keys(r).length>0?`${e}|${JSON.stringify(jr(r))}`:e;for(let i=0;i<s.length;i+=1)n^=s.charCodeAt(i),n+=(n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24);return(n>>>0).toString(16)}warn(e,r){const n={scope:"translator",event:e,...r};if(this.logger){this.logger.warn(e,n);return}console.warn("[vbss-translator]",n)}debug(e,r){var s;if(!this.config.debug)return;const n={scope:"translator",event:e,...r};if((s=this.logger)!=null&&s.debug){this.logger.debug(e,n);return}console.debug("[vbss-translator]",n)}notifyTranslationComplete(e){const r=this.config.onTranslationComplete;if(r)try{r(e)}catch(n){this.warn("external_translation_complete_callback_error",{provider:this.provider.type,error:n})}}notifyTranslationError(e){const r=this.config.onTranslationError;if(r)try{r(e)}catch(n){this.warn("external_translation_error_callback_error",{provider:this.provider.type,key:e.key,language:e.language,error:n})}}}const et=()=>Date.now(),Ie=t=>typeof t=="number"&&Number.isFinite(t)&&t>0;class Nr{constructor(e){ne(this,"store",new Map);ne(this,"enabled");ne(this,"ttlMs");ne(this,"maxEntries");this.enabled=e.enabled,this.ttlMs=Math.max(0,e.ttlMs),this.maxEntries=e.maxEntries}isEnabled(){return this.enabled}setEnabled(e){e||this.clear(),this.enabled=e}setTtl(e){this.ttlMs=Math.max(0,e)}size(){return this.store.size}clear(){this.store.clear()}get(e){if(!this.enabled)return;const r=this.store.get(e);if(r){if(this.isExpired(r)){this.store.delete(e);return}return r.value}}set(e,r,n){if(!this.enabled)return;const s=Ie(n)?n:this.ttlMs,i=Ie(s)?et()+s:void 0;this.store.set(e,{value:r,expiresAt:i,insertedAt:et()}),this.enforceMaxEntries()}delete(e){this.store.delete(e)}has(e){if(!this.enabled)return!1;const r=this.store.get(e);return r?this.isExpired(r)?(this.store.delete(e),!1):!0:!1}entries(){const e=[];for(const[r,n]of this.store.entries()){if(this.isExpired(n)){this.store.delete(r);continue}e.push({key:r,result:n.value,expiresAt:n.expiresAt})}return e}prune(){for(const[e,r]of this.store.entries())this.isExpired(r)&&this.store.delete(e)}enforceMaxEntries(){if(!Ie(this.maxEntries))return;const e=this.maxEntries;for(;this.store.size>e;){const r=this.findOldestKey();if(!r)break;this.store.delete(r)}}findOldestKey(){let e,r=Number.POSITIVE_INFINITY;for(const[n,s]of this.store.entries())s.insertedAt<r&&(e=n,r=s.insertedAt);return e}isExpired(e){return Ie(e.expiresAt)?e.expiresAt<=et():!1}}function xt(t,e){return function(){return t.apply(e,arguments)}}const{toString:Ur}=Object.prototype,{getPrototypeOf:tt}=Object,{iterator:Be,toStringTag:Ot}=Symbol,Ke=(t=>e=>{const r=Ur.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),oe=t=>(t=t.toLowerCase(),e=>Ke(e)===t),He=t=>e=>typeof e===t,{isArray:we}=Array,ve=He("undefined");function Ae(t){return t!==null&&!ve(t)&&t.constructor!==null&&!ve(t.constructor)&&G(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ct=oe("ArrayBuffer");function Mr(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ct(t.buffer),e}const Ir=He("string"),G=He("function"),At=He("number"),Pe=t=>t!==null&&typeof t=="object",Br=t=>t===!0||t===!1,Ve=t=>{if(Ke(t)!=="object")return!1;const e=tt(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Ot in t)&&!(Be in t)},Kr=t=>{if(!Pe(t)||Ae(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Hr=oe("Date"),Vr=oe("File"),Wr=oe("Blob"),zr=oe("FileList"),Jr=t=>Pe(t)&&G(t.pipe),qr=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||G(t.append)&&((e=Ke(t))==="formdata"||e==="object"&&G(t.toString)&&t.toString()==="[object FormData]"))},Yr=oe("URLSearchParams"),[Gr,Xr,$r,Qr]=["ReadableStream","Request","Response","Headers"].map(oe),Zr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ke(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),we(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{if(Ae(t))return;const i=r?Object.getOwnPropertyNames(t):Object.keys(t),a=i.length;let l;for(n=0;n<a;n++)l=i[n],e.call(null,t[l],l,t)}}function Pt(t,e){if(Ae(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,s;for(;n-- >0;)if(s=r[n],e===s.toLowerCase())return s;return null}const he=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,kt=t=>!ve(t)&&t!==he;function rt(){const{caseless:t,skipUndefined:e}=kt(this)&&this||{},r={},n=(s,i)=>{const a=t&&Pt(r,i)||i;Ve(r[a])&&Ve(s)?r[a]=rt(r[a],s):Ve(s)?r[a]=rt({},s):we(s)?r[a]=s.slice():(!e||!ve(s))&&(r[a]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&ke(arguments[s],n);return r}const en=(t,e,r,{allOwnKeys:n}={})=>(ke(e,(s,i)=>{r&&G(s)?t[i]=xt(s,r):t[i]=s},{allOwnKeys:n}),t),tn=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rn=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},nn=(t,e,r,n)=>{let s,i,a;const l={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)a=s[i],(!n||n(a,t,e))&&!l[a]&&(e[a]=t[a],l[a]=!0);t=r!==!1&&tt(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},sn=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},on=t=>{if(!t)return null;if(we(t))return t;let e=t.length;if(!At(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},an=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&tt(Uint8Array)),ln=(t,e)=>{const n=(t&&t[Be]).call(t);let s;for(;(s=n.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},cn=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},un=oe("HTMLFormElement"),fn=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),Lt=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),dn=oe("RegExp"),Ft=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};ke(r,(s,i)=>{let a;(a=e(s,i,t))!==!1&&(n[i]=a||s)}),Object.defineProperties(t,n)},hn=t=>{Ft(t,(e,r)=>{if(G(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(G(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},pn=(t,e)=>{const r={},n=s=>{s.forEach(i=>{r[i]=!0})};return we(t)?n(t):n(String(t).split(e)),r},gn=()=>{},mn=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function yn(t){return!!(t&&G(t.append)&&t[Ot]==="FormData"&&t[Be])}const bn=t=>{const e=new Array(10),r=(n,s)=>{if(Pe(n)){if(e.indexOf(n)>=0)return;if(Ae(n))return n;if(!("toJSON"in n)){e[s]=n;const i=we(n)?[]:{};return ke(n,(a,l)=>{const g=r(a,s+1);!ve(g)&&(i[l]=g)}),e[s]=void 0,i}}return n};return r(t,0)},En=oe("AsyncFunction"),wn=t=>t&&(Pe(t)||G(t))&&G(t.then)&&G(t.catch),jt=((t,e)=>t?setImmediate:e?((r,n)=>(he.addEventListener("message",({source:s,data:i})=>{s===he&&i===r&&n.length&&n.shift()()},!1),s=>{n.push(s),he.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",G(he.postMessage)),vn=typeof queueMicrotask<"u"?queueMicrotask.bind(he):typeof process<"u"&&process.nextTick||jt,c={isArray:we,isArrayBuffer:Ct,isBuffer:Ae,isFormData:qr,isArrayBufferView:Mr,isString:Ir,isNumber:At,isBoolean:Br,isObject:Pe,isPlainObject:Ve,isEmptyObject:Kr,isReadableStream:Gr,isRequest:Xr,isResponse:$r,isHeaders:Qr,isUndefined:ve,isDate:Hr,isFile:Vr,isBlob:Wr,isRegExp:dn,isFunction:G,isStream:Jr,isURLSearchParams:Yr,isTypedArray:an,isFileList:zr,forEach:ke,merge:rt,extend:en,trim:Zr,stripBOM:tn,inherits:rn,toFlatObject:nn,kindOf:Ke,kindOfTest:oe,endsWith:sn,toArray:on,forEachEntry:ln,matchAll:cn,isHTMLForm:un,hasOwnProperty:Lt,hasOwnProp:Lt,reduceDescriptors:Ft,freezeMethods:hn,toObjectSet:pn,toCamelCase:fn,noop:gn,toFiniteNumber:mn,findKey:Pt,global:he,isContextDefined:kt,isSpecCompliantForm:yn,toJSONObject:bn,isAsyncFn:En,isThenable:wn,setImmediate:jt,asap:vn,isIterable:t=>t!=null&&G(t[Be])};function S(t,e,r,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),s&&(this.response=s,this.status=s.status?s.status:null)}c.inherits(S,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:c.toJSONObject(this.config),code:this.code,status:this.status}}});const Dt=S.prototype,Nt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Nt[t]={value:t}}),Object.defineProperties(S,Nt),Object.defineProperty(Dt,"isAxiosError",{value:!0}),S.from=(t,e,r,n,s,i)=>{const a=Object.create(Dt);c.toFlatObject(t,a,function(u){return u!==Error.prototype},f=>f!=="isAxiosError");const l=t&&t.message?t.message:"Error",g=e==null&&t?t.code:e;return S.call(a,l,g,r,n,s),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",i&&Object.assign(a,i),a};const Rn=null;function nt(t){return c.isPlainObject(t)||c.isArray(t)}function Ut(t){return c.endsWith(t,"[]")?t.slice(0,-2):t}function Mt(t,e,r){return t?t.concat(e).map(function(s,i){return s=Ut(s),!r&&i?"["+s+"]":s}).join(r?".":""):e}function Tn(t){return c.isArray(t)&&!t.some(nt)}const Sn=c.toFlatObject(c,{},null,function(e){return/^is[A-Z]/.test(e)});function We(t,e,r){if(!c.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=c.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(E,b){return!c.isUndefined(b[E])});const n=r.metaTokens,s=r.visitor||u,i=r.dots,a=r.indexes,g=(r.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(e);if(!c.isFunction(s))throw new TypeError("visitor must be a function");function f(d){if(d===null)return"";if(c.isDate(d))return d.toISOString();if(c.isBoolean(d))return d.toString();if(!g&&c.isBlob(d))throw new S("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(d)||c.isTypedArray(d)?g&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function u(d,E,b){let k=d;if(d&&!b&&typeof d=="object"){if(c.endsWith(E,"{}"))E=n?E:E.slice(0,-2),d=JSON.stringify(d);else if(c.isArray(d)&&Tn(d)||(c.isFileList(d)||c.endsWith(E,"[]"))&&(k=c.toArray(d)))return E=Ut(E),k.forEach(function(F,D){!(c.isUndefined(F)||F===null)&&e.append(a===!0?Mt([E],D,i):a===null?E:E+"[]",f(F))}),!1}return nt(d)?!0:(e.append(Mt(b,E,i),f(d)),!1)}const h=[],x=Object.assign(Sn,{defaultVisitor:u,convertValue:f,isVisitable:nt});function j(d,E){if(!c.isUndefined(d)){if(h.indexOf(d)!==-1)throw Error("Circular reference detected in "+E.join("."));h.push(d),c.forEach(d,function(k,A){(!(c.isUndefined(k)||k===null)&&s.call(e,k,c.isString(A)?A.trim():A,E,x))===!0&&j(k,E?E.concat(A):[A])}),h.pop()}}if(!c.isObject(t))throw new TypeError("data must be an object");return j(t),e}function It(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function st(t,e){this._pairs=[],t&&We(t,this,e)}const Bt=st.prototype;Bt.append=function(e,r){this._pairs.push([e,r])},Bt.toString=function(e){const r=e?function(n){return e.call(this,n,It)}:It;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function _n(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Kt(t,e,r){if(!e)return t;const n=r&&r.encode||_n;c.isFunction(r)&&(r={serialize:r});const s=r&&r.serialize;let i;if(s?i=s(e,r):i=c.isURLSearchParams(e)?e.toString():new st(e,r).toString(n),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class Ht{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){c.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Vt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},xn={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:st,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},ot=typeof window<"u"&&typeof document<"u",at=typeof navigator=="object"&&navigator||void 0,On=ot&&(!at||["ReactNative","NativeScript","NS"].indexOf(at.product)<0),Cn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",An=ot&&window.location.href||"http://localhost",z={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ot,hasStandardBrowserEnv:On,hasStandardBrowserWebWorkerEnv:Cn,navigator:at,origin:An},Symbol.toStringTag,{value:"Module"})),...xn};function Pn(t,e){return We(t,new z.classes.URLSearchParams,{visitor:function(r,n,s,i){return z.isNode&&c.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function kn(t){return c.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Ln(t){const e={},r=Object.keys(t);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],e[i]=t[i];return e}function Wt(t){function e(r,n,s,i){let a=r[i++];if(a==="__proto__")return!0;const l=Number.isFinite(+a),g=i>=r.length;return a=!a&&c.isArray(s)?s.length:a,g?(c.hasOwnProp(s,a)?s[a]=[s[a],n]:s[a]=n,!l):((!s[a]||!c.isObject(s[a]))&&(s[a]=[]),e(r,n,s[a],i)&&c.isArray(s[a])&&(s[a]=Ln(s[a])),!l)}if(c.isFormData(t)&&c.isFunction(t.entries)){const r={};return c.forEachEntry(t,(n,s)=>{e(kn(n),s,r,0)}),r}return null}function Fn(t,e,r){if(c.isString(t))try{return(e||JSON.parse)(t),c.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(0,JSON.stringify)(t)}const Le={transitional:Vt,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,i=c.isObject(e);if(i&&c.isHTMLForm(e)&&(e=new FormData(e)),c.isFormData(e))return s?JSON.stringify(Wt(e)):e;if(c.isArrayBuffer(e)||c.isBuffer(e)||c.isStream(e)||c.isFile(e)||c.isBlob(e)||c.isReadableStream(e))return e;if(c.isArrayBufferView(e))return e.buffer;if(c.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Pn(e,this.formSerializer).toString();if((l=c.isFileList(e))||n.indexOf("multipart/form-data")>-1){const g=this.env&&this.env.FormData;return We(l?{"files[]":e}:e,g&&new g,this.formSerializer)}}return i||s?(r.setContentType("application/json",!1),Fn(e)):e}],transformResponse:[function(e){const r=this.transitional||Le.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(c.isResponse(e)||c.isReadableStream(e))return e;if(e&&c.isString(e)&&(n&&!this.responseType||s)){const a=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(l){if(a)throw l.name==="SyntaxError"?S.from(l,S.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:z.classes.FormData,Blob:z.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};c.forEach(["delete","get","head","post","put","patch"],t=>{Le.headers[t]={}});const jn=c.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Dn=t=>{const e={};let r,n,s;return t&&t.split(`
31
- `).forEach(function(a){s=a.indexOf(":"),r=a.substring(0,s).trim().toLowerCase(),n=a.substring(s+1).trim(),!(!r||e[r]&&jn[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},zt=Symbol("internals");function Fe(t){return t&&String(t).trim().toLowerCase()}function ze(t){return t===!1||t==null?t:c.isArray(t)?t.map(ze):String(t)}function Nn(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const Un=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function it(t,e,r,n,s){if(c.isFunction(n))return n.call(this,e,r);if(s&&(e=r),!!c.isString(e)){if(c.isString(n))return e.indexOf(n)!==-1;if(c.isRegExp(n))return n.test(e)}}function Mn(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function In(t,e){const r=c.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(s,i,a){return this[n].call(this,e,s,i,a)},configurable:!0})})}class X{constructor(e){e&&this.set(e)}set(e,r,n){const s=this;function i(l,g,f){const u=Fe(g);if(!u)throw new Error("header name must be a non-empty string");const h=c.findKey(s,u);(!h||s[h]===void 0||f===!0||f===void 0&&s[h]!==!1)&&(s[h||g]=ze(l))}const a=(l,g)=>c.forEach(l,(f,u)=>i(f,u,g));if(c.isPlainObject(e)||e instanceof this.constructor)a(e,r);else if(c.isString(e)&&(e=e.trim())&&!Un(e))a(Dn(e),r);else if(c.isObject(e)&&c.isIterable(e)){let l={},g,f;for(const u of e){if(!c.isArray(u))throw TypeError("Object iterator must return a key-value pair");l[f=u[0]]=(g=l[f])?c.isArray(g)?[...g,u[1]]:[g,u[1]]:u[1]}a(l,r)}else e!=null&&i(r,e,n);return this}get(e,r){if(e=Fe(e),e){const n=c.findKey(this,e);if(n){const s=this[n];if(!r)return s;if(r===!0)return Nn(s);if(c.isFunction(r))return r.call(this,s,n);if(c.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=Fe(e),e){const n=c.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||it(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let s=!1;function i(a){if(a=Fe(a),a){const l=c.findKey(n,a);l&&(!r||it(n,n[l],l,r))&&(delete n[l],s=!0)}}return c.isArray(e)?e.forEach(i):i(e),s}clear(e){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const i=r[n];(!e||it(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const r=this,n={};return c.forEach(this,(s,i)=>{const a=c.findKey(n,i);if(a){r[a]=ze(s),delete r[i];return}const l=e?Mn(i):String(i).trim();l!==i&&delete r[i],r[l]=ze(s),n[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return c.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=e&&c.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
32
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[zt]=this[zt]={accessors:{}}).accessors,s=this.prototype;function i(a){const l=Fe(a);n[l]||(In(s,a),n[l]=!0)}return c.isArray(e)?e.forEach(i):i(e),this}}X.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),c.reduceDescriptors(X.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),c.freezeMethods(X);function lt(t,e){const r=this||Le,n=e||r,s=X.from(n.headers);let i=n.data;return c.forEach(t,function(l){i=l.call(r,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function Jt(t){return!!(t&&t.__CANCEL__)}function Re(t,e,r){S.call(this,t??"canceled",S.ERR_CANCELED,e,r),this.name="CanceledError"}c.inherits(Re,S,{__CANCEL__:!0});function qt(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new S("Request failed with status code "+r.status,[S.ERR_BAD_REQUEST,S.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Bn(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Kn(t,e){t=t||10;const r=new Array(t),n=new Array(t);let s=0,i=0,a;return e=e!==void 0?e:1e3,function(g){const f=Date.now(),u=n[i];a||(a=f),r[s]=g,n[s]=f;let h=i,x=0;for(;h!==s;)x+=r[h++],h=h%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),f-a<e)return;const j=u&&f-u;return j?Math.round(x*1e3/j):void 0}}function Hn(t,e){let r=0,n=1e3/e,s,i;const a=(f,u=Date.now())=>{r=u,s=null,i&&(clearTimeout(i),i=null),t(...f)};return[(...f)=>{const u=Date.now(),h=u-r;h>=n?a(f,u):(s=f,i||(i=setTimeout(()=>{i=null,a(s)},n-h)))},()=>s&&a(s)]}const Je=(t,e,r=3)=>{let n=0;const s=Kn(50,250);return Hn(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,g=a-n,f=s(g),u=a<=l;n=a;const h={loaded:a,total:l,progress:l?a/l:void 0,bytes:g,rate:f||void 0,estimated:f&&l&&u?(l-a)/f:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(h)},r)},Yt=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},Gt=t=>(...e)=>c.asap(()=>t(...e)),Vn=z.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,z.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(z.origin),z.navigator&&/(msie|trident)/i.test(z.navigator.userAgent)):()=>!0,Wn=z.hasStandardBrowserEnv?{write(t,e,r,n,s,i,a){if(typeof document>"u")return;const l=[`${t}=${encodeURIComponent(e)}`];c.isNumber(r)&&l.push(`expires=${new Date(r).toUTCString()}`),c.isString(n)&&l.push(`path=${n}`),c.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),c.isString(a)&&l.push(`SameSite=${a}`),document.cookie=l.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function zn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Jn(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Xt(t,e,r){let n=!zn(e);return t&&(n||r==!1)?Jn(t,e):e}const $t=t=>t instanceof X?{...t}:t;function pe(t,e){e=e||{};const r={};function n(f,u,h,x){return c.isPlainObject(f)&&c.isPlainObject(u)?c.merge.call({caseless:x},f,u):c.isPlainObject(u)?c.merge({},u):c.isArray(u)?u.slice():u}function s(f,u,h,x){if(c.isUndefined(u)){if(!c.isUndefined(f))return n(void 0,f,h,x)}else return n(f,u,h,x)}function i(f,u){if(!c.isUndefined(u))return n(void 0,u)}function a(f,u){if(c.isUndefined(u)){if(!c.isUndefined(f))return n(void 0,f)}else return n(void 0,u)}function l(f,u,h){if(h in e)return n(f,u);if(h in t)return n(void 0,f)}const g={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(f,u,h)=>s($t(f),$t(u),h,!0)};return c.forEach(Object.keys({...t,...e}),function(u){const h=g[u]||s,x=h(t[u],e[u],u);c.isUndefined(x)&&h!==l||(r[u]=x)}),r}const Qt=t=>{const e=pe({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:l}=e;if(e.headers=a=X.from(a),e.url=Kt(Xt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),c.isFormData(r)){if(z.hasStandardBrowserEnv||z.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(c.isFunction(r.getHeaders)){const g=r.getHeaders(),f=["content-type","content-length"];Object.entries(g).forEach(([u,h])=>{f.includes(u.toLowerCase())&&a.set(u,h)})}}if(z.hasStandardBrowserEnv&&(n&&c.isFunction(n)&&(n=n(e)),n||n!==!1&&Vn(e.url))){const g=s&&i&&Wn.read(i);g&&a.set(s,g)}return e},qn=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const s=Qt(t);let i=s.data;const a=X.from(s.headers).normalize();let{responseType:l,onUploadProgress:g,onDownloadProgress:f}=s,u,h,x,j,d;function E(){j&&j(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(s.method.toUpperCase(),s.url,!0),b.timeout=s.timeout;function k(){if(!b)return;const F=X.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),q={data:!l||l==="text"||l==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:F,config:t,request:b};qt(function(H){r(H),E()},function(H){n(H),E()},q),b=null}"onloadend"in b?b.onloadend=k:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(k)},b.onabort=function(){b&&(n(new S("Request aborted",S.ECONNABORTED,t,b)),b=null)},b.onerror=function(D){const q=D&&D.message?D.message:"Network Error",ae=new S(q,S.ERR_NETWORK,t,b);ae.event=D||null,n(ae),b=null},b.ontimeout=function(){let D=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const q=s.transitional||Vt;s.timeoutErrorMessage&&(D=s.timeoutErrorMessage),n(new S(D,q.clarifyTimeoutError?S.ETIMEDOUT:S.ECONNABORTED,t,b)),b=null},i===void 0&&a.setContentType(null),"setRequestHeader"in b&&c.forEach(a.toJSON(),function(D,q){b.setRequestHeader(q,D)}),c.isUndefined(s.withCredentials)||(b.withCredentials=!!s.withCredentials),l&&l!=="json"&&(b.responseType=s.responseType),f&&([x,d]=Je(f,!0),b.addEventListener("progress",x)),g&&b.upload&&([h,j]=Je(g),b.upload.addEventListener("progress",h),b.upload.addEventListener("loadend",j)),(s.cancelToken||s.signal)&&(u=F=>{b&&(n(!F||F.type?new Re(null,t,b):F),b.abort(),b=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const A=Bn(s.url);if(A&&z.protocols.indexOf(A)===-1){n(new S("Unsupported protocol "+A+":",S.ERR_BAD_REQUEST,t));return}b.send(i||null)})},Yn=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,s;const i=function(f){if(!s){s=!0,l();const u=f instanceof Error?f:this.reason;n.abort(u instanceof S?u:new Re(u instanceof Error?u.message:u))}};let a=e&&setTimeout(()=>{a=null,i(new S(`timeout ${e} of ms exceeded`,S.ETIMEDOUT))},e);const l=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(f=>{f.unsubscribe?f.unsubscribe(i):f.removeEventListener("abort",i)}),t=null)};t.forEach(f=>f.addEventListener("abort",i));const{signal:g}=n;return g.unsubscribe=()=>c.asap(l),g}},Gn=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,s;for(;n<r;)s=n+e,yield t.slice(n,s),n=s},Xn=async function*(t,e){for await(const r of $n(t))yield*Gn(r,e)},$n=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Zt=(t,e,r,n)=>{const s=Xn(t,e);let i=0,a,l=g=>{a||(a=!0,n&&n(g))};return new ReadableStream({async pull(g){try{const{done:f,value:u}=await s.next();if(f){l(),g.close();return}let h=u.byteLength;if(r){let x=i+=h;r(x)}g.enqueue(new Uint8Array(u))}catch(f){throw l(f),f}},cancel(g){return l(g),s.return()}},{highWaterMark:2})},er=64*1024,{isFunction:qe}=c,Qn=(({Request:t,Response:e})=>({Request:t,Response:e}))(c.global),{ReadableStream:tr,TextEncoder:rr}=c.global,nr=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Zn=t=>{t=c.merge.call({skipUndefined:!0},Qn,t);const{fetch:e,Request:r,Response:n}=t,s=e?qe(e):typeof fetch=="function",i=qe(r),a=qe(n);if(!s)return!1;const l=s&&qe(tr),g=s&&(typeof rr=="function"?(d=>E=>d.encode(E))(new rr):async d=>new Uint8Array(await new r(d).arrayBuffer())),f=i&&l&&nr(()=>{let d=!1;const E=new r(z.origin,{body:new tr,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!E}),u=a&&l&&nr(()=>c.isReadableStream(new n("").body)),h={stream:u&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!h[d]&&(h[d]=(E,b)=>{let k=E&&E[d];if(k)return k.call(E);throw new S(`Response type '${d}' is not supported`,S.ERR_NOT_SUPPORT,b)})});const x=async d=>{if(d==null)return 0;if(c.isBlob(d))return d.size;if(c.isSpecCompliantForm(d))return(await new r(z.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(c.isArrayBufferView(d)||c.isArrayBuffer(d))return d.byteLength;if(c.isURLSearchParams(d)&&(d=d+""),c.isString(d))return(await g(d)).byteLength},j=async(d,E)=>{const b=c.toFiniteNumber(d.getContentLength());return b??x(E)};return async d=>{let{url:E,method:b,data:k,signal:A,cancelToken:F,timeout:D,onDownloadProgress:q,onUploadProgress:ae,responseType:H,headers:ee,withCredentials:te="same-origin",fetchOptions:me}=Qt(d),fe=e||fetch;H=H?(H+"").toLowerCase():"text";let ce=Yn([A,F&&F.toAbortSignal()],D),K=null;const V=ce&&ce.unsubscribe&&(()=>{ce.unsubscribe()});let y;try{if(ae&&f&&b!=="get"&&b!=="head"&&(y=await j(ee,k))!==0){let W=new r(E,{method:"POST",body:k,duplex:"half"}),I;if(c.isFormData(k)&&(I=W.headers.get("content-type"))&&ee.setContentType(I),W.body){const[Q,de]=Yt(y,Je(Gt(ae)));k=Zt(W.body,er,Q,de)}}c.isString(te)||(te=te?"include":"omit");const T=i&&"credentials"in r.prototype,R={...me,signal:ce,method:b.toUpperCase(),headers:ee.normalize().toJSON(),body:k,duplex:"half",credentials:T?te:void 0};K=i&&new r(E,R);let w=await(i?fe(K,me):fe(E,R));const N=u&&(H==="stream"||H==="response");if(u&&(q||N&&V)){const W={};["status","statusText","headers"].forEach(ye=>{W[ye]=w[ye]});const I=c.toFiniteNumber(w.headers.get("content-length")),[Q,de]=q&&Yt(I,Je(Gt(q),!0))||[];w=new n(Zt(w.body,er,Q,()=>{de&&de(),V&&V()}),W)}H=H||"text";let ie=await h[c.findKey(h,H)||"text"](w,d);return!N&&V&&V(),await new Promise((W,I)=>{qt(W,I,{data:ie,headers:X.from(w.headers),status:w.status,statusText:w.statusText,config:d,request:K})})}catch(T){throw V&&V(),T&&T.name==="TypeError"&&/Load failed|fetch/i.test(T.message)?Object.assign(new S("Network Error",S.ERR_NETWORK,d,K),{cause:T.cause||T}):S.from(T,T&&T.code,d,K)}}},es=new Map,sr=t=>{let e=t&&t.env||{};const{fetch:r,Request:n,Response:s}=e,i=[n,s,r];let a=i.length,l=a,g,f,u=es;for(;l--;)g=i[l],f=u.get(g),f===void 0&&u.set(g,f=l?new Map:Zn(e)),u=f;return f};sr();const ct={http:Rn,xhr:qn,fetch:{get:sr}};c.forEach(ct,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const or=t=>`- ${t}`,ts=t=>c.isFunction(t)||t===null||t===!1;function rs(t,e){t=c.isArray(t)?t:[t];const{length:r}=t;let n,s;const i={};for(let a=0;a<r;a++){n=t[a];let l;if(s=n,!ts(n)&&(s=ct[(l=String(n)).toLowerCase()],s===void 0))throw new S(`Unknown adapter '${l}'`);if(s&&(c.isFunction(s)||(s=s.get(e))))break;i[l||"#"+a]=s}if(!s){const a=Object.entries(i).map(([g,f])=>`adapter ${g} `+(f===!1?"is not supported by the environment":"is not available in the build"));let l=r?a.length>1?`since :
33
- `+a.map(or).join(`
34
- `):" "+or(a[0]):"as no adapter specified";throw new S("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const ar={getAdapter:rs,adapters:ct};function ut(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Re(null,t)}function ir(t){return ut(t),t.headers=X.from(t.headers),t.data=lt.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),ar.getAdapter(t.adapter||Le.adapter,t)(t).then(function(n){return ut(t),n.data=lt.call(t,t.transformResponse,n),n.headers=X.from(n.headers),n},function(n){return Jt(n)||(ut(t),n&&n.response&&(n.response.data=lt.call(t,t.transformResponse,n.response),n.response.headers=X.from(n.response.headers))),Promise.reject(n)})}const lr="1.13.2",Ye={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Ye[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const cr={};Ye.transitional=function(e,r,n){function s(i,a){return"[Axios v"+lr+"] Transitional option '"+i+"'"+a+(n?". "+n:"")}return(i,a,l)=>{if(e===!1)throw new S(s(a," has been removed"+(r?" in "+r:"")),S.ERR_DEPRECATED);return r&&!cr[a]&&(cr[a]=!0,console.warn(s(a," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(i,a,l):!0}},Ye.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function ns(t,e,r){if(typeof t!="object")throw new S("options must be an object",S.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let s=n.length;for(;s-- >0;){const i=n[s],a=e[i];if(a){const l=t[i],g=l===void 0||a(l,i,t);if(g!==!0)throw new S("option "+i+" must be "+g,S.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new S("Unknown option "+i,S.ERR_BAD_OPTION)}}const Ge={assertOptions:ns,validators:Ye},le=Ge.validators;class ge{constructor(e){this.defaults=e||{},this.interceptors={request:new Ht,response:new Ht}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=`
35
- `+i):n.stack=i}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=pe(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:i}=r;n!==void 0&&Ge.assertOptions(n,{silentJSONParsing:le.transitional(le.boolean),forcedJSONParsing:le.transitional(le.boolean),clarifyTimeoutError:le.transitional(le.boolean)},!1),s!=null&&(c.isFunction(s)?r.paramsSerializer={serialize:s}:Ge.assertOptions(s,{encode:le.function,serialize:le.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Ge.assertOptions(r,{baseUrl:le.spelling("baseURL"),withXsrfToken:le.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let a=i&&c.merge(i.common,i[r.method]);i&&c.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),r.headers=X.concat(a,i);const l=[];let g=!0;this.interceptors.request.forEach(function(E){typeof E.runWhen=="function"&&E.runWhen(r)===!1||(g=g&&E.synchronous,l.unshift(E.fulfilled,E.rejected))});const f=[];this.interceptors.response.forEach(function(E){f.push(E.fulfilled,E.rejected)});let u,h=0,x;if(!g){const d=[ir.bind(this),void 0];for(d.unshift(...l),d.push(...f),x=d.length,u=Promise.resolve(r);h<x;)u=u.then(d[h++],d[h++]);return u}x=l.length;let j=r;for(;h<x;){const d=l[h++],E=l[h++];try{j=d(j)}catch(b){E.call(this,b);break}}try{u=ir.call(this,j)}catch(d){return Promise.reject(d)}for(h=0,x=f.length;h<x;)u=u.then(f[h++],f[h++]);return u}getUri(e){e=pe(this.defaults,e);const r=Xt(e.baseURL,e.url,e.allowAbsoluteUrls);return Kt(r,e.params,e.paramsSerializer)}}c.forEach(["delete","get","head","options"],function(e){ge.prototype[e]=function(r,n){return this.request(pe(n||{},{method:e,url:r,data:(n||{}).data}))}}),c.forEach(["post","put","patch"],function(e){function r(n){return function(i,a,l){return this.request(pe(l||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}ge.prototype[e]=r(),ge.prototype[e+"Form"]=r(!0)});class ft{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(l=>{n.subscribe(l),i=l}).then(s);return a.cancel=function(){n.unsubscribe(i)},a},e(function(i,a,l){n.reason||(n.reason=new Re(i,a,l),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new ft(function(s){e=s}),cancel:e}}}function ss(t){return function(r){return t.apply(null,r)}}function os(t){return c.isObject(t)&&t.isAxiosError===!0}const dt={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(dt).forEach(([t,e])=>{dt[e]=t});function ur(t){const e=new ge(t),r=xt(ge.prototype.request,e);return c.extend(r,ge.prototype,e,{allOwnKeys:!0}),c.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return ur(pe(t,s))},r}const U=ur(Le);U.Axios=ge,U.CanceledError=Re,U.CancelToken=ft,U.isCancel=Jt,U.VERSION=lr,U.toFormData=We,U.AxiosError=S,U.Cancel=U.CanceledError,U.all=function(e){return Promise.all(e)},U.spread=ss,U.isAxiosError=os,U.mergeConfig=pe,U.AxiosHeaders=X,U.formToJSON=t=>Wt(c.isHTMLForm(t)?new FormData(t):t),U.getAdapter=ar.getAdapter,U.HttpStatusCode=dt,U.default=U;const fr="https://translation.googleapis.com/language/translate/v2",as=new Set([408,425,429,500,502,503,504]),is=t=>!!t,ls=t=>U.isAxiosError(t);class cs{constructor(e){ne(this,"type","google");ne(this,"axios");this.config=e,this.axios=U.create({baseURL:e.endpoint??fr,headers:{"Content-Type":"application/json",...e.headers}})}isAvailable(){return this.config.apiKey||is(this.config.headers)?{available:!0}:{available:!0}}async translate(e,r){var g,f,u;const n={q:e.text,target:e.targetLanguage,format:"text"};e.sourceLanguage&&e.sourceLanguage!=="auto"&&(n.source=e.sourceLanguage),e.glossary&&Object.keys(e.glossary).length>0&&(n.glossaryConfig={glossaryData:{languagePair:{sourceLanguageCode:e.sourceLanguage??"auto",targetLanguageCode:e.targetLanguage},terms:Object.entries(e.glossary).map(([h,x])=>({sourceText:h,targetText:x}))}});const s={...this.config.headers,...r==null?void 0:r.headers},a=(u=(f=(g=(await this.axios.post("",n,{headers:s,params:this.createQueryParams(),timeout:r==null?void 0:r.timeoutMs,signal:r==null?void 0:r.signal})).data)==null?void 0:g.data)==null?void 0:f.translations)==null?void 0:u[0];if(!(a!=null&&a.translatedText))throw new Error("Google Translate response did not include translatedText");const l={endpoint:this.config.endpoint??fr};return a.model&&(l.model=a.model),this.config.projectId&&(l.projectId=this.config.projectId),this.config.region&&(l.region=this.config.region),{translatedText:a.translatedText,detectedSourceLanguage:a.detectedSourceLanguage,providerMetadata:l}}normalizeError(e){var r,n,s,i,a;if(ls(e)){const l=(r=e.response)==null?void 0:r.status,g=((n=e.response)==null?void 0:n.data)??{},f=((s=g.error)==null?void 0:s.message)??e.message??"Google Translate request failed";return{code:String(((i=g.error)==null?void 0:i.code)??l??"E_GOOGLE"),message:f,retryable:l?as.has(l):!1,details:{status:l,data:g,headers:(a=e.response)==null?void 0:a.headers}}}return e instanceof Error?{code:e.name||"unknown_error",message:e.message,retryable:!1,details:e}:{code:"unknown_error",message:"Unknown provider error",retryable:!1,details:e}}createQueryParams(){if(this.config.apiKey)return{key:this.config.apiKey}}}const ht=t=>{if(!t)throw new Error("Provider instance is null or undefined");if(!t.type)throw new Error("Provider missing required 'type' property");if(typeof t.translate!="function")throw new Error("Provider missing required 'translate' method");if(t.isAvailable&&typeof t.isAvailable!="function")throw new Error("Provider 'isAvailable' must be a function");if(t.normalizeError&&typeof t.normalizeError!="function")throw new Error("Provider 'normalizeError' must be a function")},dr=t=>{if(t.id==="google"){const e=new cs(t);return ht(e),e}if(t.implementation)return ht(t.implementation),t.implementation;if(t.factory){const e=t.factory();return ht(e),e}throw new Error("Custom provider configuration must include either 'implementation' or 'factory'")},us="translator",fs=5e3,hr=3e4,ds="::",hs=t=>{var r,n;return((n=(r=navigator==null?void 0:navigator.language)==null?void 0:r.split("-"))==null?void 0:n[0])||t},ps=t=>localStorage.getItem(t),gs=(t,e)=>{localStorage.setItem(t,e)},ms=t=>t?t instanceof Set?new Set(t):new Set(t):new Set,pr=(t,e)=>({scope:us,event:t,...e}),je=(t,e)=>{console.warn("[vbss-translator]",pr(t,e))},$=(t,e)=>{console.debug("[vbss-translator]",pr(t,e))},ys=()=>({warn:(t,e)=>{je(t,e??{})},debug:(t,e)=>{$(t,e??{})}}),bs=t=>{const{provider:e,cache:r,alwaysExternalKeys:n,enabled:s,timeoutMs:i,debug:a,...l}=t??{};return{enabled:s??!1,timeoutMs:i??fs,debug:a??!1,provider:{...Es,...e},cache:{...ws,...r},alwaysExternalKeys:ms(n),...l}},Es={id:"google"},ws={enabled:!1,ttlMs:36e5},vs=(t,e)=>`${t}${ds}${e}`,Rs=t=>t?new Map(t):new Map,Ts=(t,e)=>{const r=t.toLocaleLowerCase();return e.find(n=>Object.values(n).some(s=>s.toLocaleLowerCase()===r))},Ss=({children:t,translations:e,defaultLanguage:r="en",persist:n=!1,persistKey:s="language",autoDetectLanguage:i=!1,externalTranslation:a})=>{const l=_.useMemo(()=>bs(a),[a]),[g,f]=_.useState(()=>new Set(l.alwaysExternalKeys));_.useEffect(()=>{f(y=>{const T=new Set(l.alwaysExternalKeys);return y.forEach(R=>T.add(R)),T})},[l]);const u=_.useCallback(y=>{f(T=>{if(T.has(y))return T;const R=new Set(T);return R.add(y),R})},[]),h=_.useMemo(()=>({...l,alwaysExternalKeys:g}),[l,g]),x=n?ps(s):null,j=i?hs(r):null,[d,E]=_.useState(x??j??r);_.useEffect(()=>{n&&gs(s,d)},[d,n,s]);const b=_.useMemo(()=>Object.keys(e[0]||{}),[e]),k=_.useMemo(()=>ys(),[]),A=_.useMemo(()=>new Nr(h.cache),[h.cache]),F=_.useMemo(()=>{let y;try{if(y=dr(h.provider),h.debug&&$("TranslatorProvider_provider_created",{providerType:y.type,providerId:h.provider.id,timestamp:Date.now()}),y.isAvailable){const T=y.isAvailable();T.available?h.debug&&$("TranslatorProvider_provider_available",{providerType:y.type,providerId:h.provider.id,timestamp:Date.now()}):je("TranslatorProvider_provider_unavailable",{providerType:y.type,providerId:h.provider.id,reason:T.reason,timestamp:Date.now()})}}catch(T){throw je("TranslatorProvider_provider_creation_failed",{providerId:h.provider.id,error:T instanceof Error?T.message:"Unknown error",timestamp:Date.now()}),T}return new Dr({provider:y,config:h,cache:h.cache.enabled?A:void 0,logger:k})},[h,k,A]),[D,q]=_.useState(()=>new Map),[ae,H]=_.useState(0),ee=_.useRef(!0);_.useEffect(()=>(h.debug&&$("TranslatorProvider_mounted",{timestamp:Date.now()}),ee.current=!0,()=>{h.debug&&$("TranslatorProvider_unmounting",{timestamp:Date.now()}),ee.current=!1}),[h]);const te=_.useCallback((y,T,R)=>{var ie;h.debug&&R&&$("setExternalStateEntry_called",{targetLanguage:y,key:T,status:R.status,value:R.value,isMounted:ee.current});const w=()=>{q(W=>{const I=new Map(W),Q=Rs(I.get(y));return R?(Q.set(T,R),I.set(y,Q)):(Q.delete(T),Q.size>0?I.set(y,Q):I.delete(y)),I}),(R==null?void 0:R.status)==="resolved"&&(h.debug&&$("forceUpdate_triggered",{targetLanguage:y,key:T}),H(W=>W+1))};typeof process<"u"&&((ie=process.env)==null?void 0:ie.NODE_ENV)==="test"?w():_.startTransition(()=>{w()})},[h,H]),me=_.useCallback(y=>{var T;F.isEnabled()&&(te(y.targetLanguage,y.key,{status:"pending",value:y.displayValue}),F.translate({key:y.key,text:y.originalText,targetLanguage:y.targetLanguage,sourceLanguage:y.sourceLanguage,signal:(T=y.options)==null?void 0:T.signal}).then(R=>{if(h.debug&&$("translation_promise_resolved",{key:y.key,targetLanguage:y.targetLanguage,isMounted:ee.current,hasResult:!!R,hasTranslatedText:!!(R&&R.translatedText),translatedText:R==null?void 0:R.translatedText}),R&&R.translatedText){h.debug&&$("translation_applying_resolved",{key:y.key,targetLanguage:y.targetLanguage,isMounted:ee.current,translatedText:R.translatedText}),te(y.targetLanguage,y.key,{status:"resolved",value:R.translatedText});return}h.debug&&$("translation_invalid_result",{key:y.key,result:R}),te(y.targetLanguage,y.key,{status:"error",value:y.displayValue,retryAt:Date.now()+hr})}).catch(R=>{h.debug&&$("translation_promise_rejected",{key:y.key,targetLanguage:y.targetLanguage,isMounted:ee.current,error:(R==null?void 0:R.message)||String(R)}),je("external_translation_unexpected_rejection",{key:y.key,language:y.targetLanguage,error:R,isMounted:ee.current}),te(y.targetLanguage,y.key,{status:"error",value:y.displayValue,error:R,retryAt:Date.now()+hr})}))},[h,te,F]),fe=_.useMemo(()=>{const y={};return D.forEach((T,R)=>{T.forEach((w,N)=>{y[vs(N,R)]=w.status==="pending"})}),h.debug&&$("isTranslatingRecord_recalculated",{recordSize:Object.keys(y).length,record:{...y}}),y},[D,h]),ce=_.useMemo(()=>Object.values(fe).some(Boolean),[fe]),K=_.useCallback((y,T={})=>{var be;const R=D.get(d),w=R==null?void 0:R.get(y);if(h.debug&&T.preferExternal&&$("t_called",{text:y,language:d,hasStateForLanguage:!!R,existingStateStatus:w==null?void 0:w.status,existingStateValue:w==null?void 0:w.value,preferExternal:T.preferExternal}),(w==null?void 0:w.status)==="resolved"&&w.value)return h.debug&&$("t_returning_resolved",{text:y,value:w.value}),w.value;const N=Ts(y,e),ie=N==null?void 0:N[d],W=N?Object.values(N).find($e=>!!$e):void 0,I=T.fallbackValue??(w==null?void 0:w.value)??ie??W??y,Q=T.preferExternal===!0||h.alwaysExternalKeys.has(y),de=F.isEnabled(),ye=typeof ie=="string";if(ye||je("missing_translation",{key:y,language:d}),!(de&&(Q||!ye)))return(w==null?void 0:w.status)==="pending"&&w.value?w.value:ie??I;const De=Date.now(),Te=(w==null?void 0:w.status)==="error"&&(!w.retryAt||w.retryAt<=De);if(!w||Te){const Se=T.sourceLanguage??(N&&N[r]?r:void 0),pt=(Se&&(N==null?void 0:N[Se]))??(N==null?void 0:N[r])??y;me({key:y,targetLanguage:d,originalText:pt,displayValue:(w==null?void 0:w.value)??I,sourceLanguage:Se,options:T})}const re=((be=D.get(d))==null?void 0:be.get(y))??w;return(re==null?void 0:re.status)==="resolved"&&re.value?re.value:(re==null?void 0:re.status)==="pending"?re.value??I:I},[r,h.alwaysExternalKeys,D,d,me,F,e]),V=_.useMemo(()=>({t:K,language:d,languages:b,setLanguage:E,isTranslating:fe,isTranslatingAny:ce,registerExternalKey:u,externalConfig:h}),[K,d,b,E,fe,ce,u,h,ae]);return kr.jsx(St.Provider,{value:V,children:t})},_s=()=>Lr();J.TranslatorProvider=Ss,J.createTranslationProvider=dr,J.useTranslator=_s,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})});
1
+ (function(k,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],j):(k=typeof globalThis<"u"?globalThis:k||self,j(k["vbss/translator"]={},k.ReactJSXRuntime,k.React))})(this,(function(k,j,T){"use strict";var Ir=Object.defineProperty;var Hr=(k,j,T)=>j in k?Ir(k,j,{enumerable:!0,configurable:!0,writable:!0,value:T}):k[j]=T;var I=(k,j,T)=>Hr(k,typeof j!="symbol"?j+"":j,T);const Ke=T.createContext(null),Ut=()=>{const t=T.useContext(Ke);if(!t)throw new Error("useTranslatorContext must be used within a TranslatorProvider");return t};class $e extends Error{constructor(n){super(n);I(this,"code","timeout");this.name="ExternalTranslationTimeoutError"}}const Mt="auto",ge=t=>typeof t=="number"&&Number.isFinite(t)&&t>0,jt=t=>{const e=Object.entries(t).sort(([n],[r])=>n===r?0:n<r?-1:1);return Object.fromEntries(e)};class Bt{constructor(e){I(this,"provider");I(this,"config");I(this,"cache");I(this,"logger");I(this,"inFlight",new Map);this.provider=e.provider,this.config=e.config,this.cache=e.cache,this.logger=e.logger}isEnabled(){return this.config.enabled}async translate(e){if(!this.isEnabled()){this.debug("external_translation_disabled",{key:e.key,targetLanguage:e.targetLanguage});return}const n=this.normalizeRequest(e);if(!await this.shouldTranslate(n.externalRequest)){this.debug("external_translation_skipped",{key:n.externalRequest.key,targetLanguage:n.externalRequest.targetLanguage});return}const r=this.readFromCache(n.cacheKey);if(r)return this.debug("external_translation_cache_hit",{key:n.externalRequest.key,cacheKey:n.cacheKey}),r;const s=this.inFlight.get(n.cacheKey);if(s)return this.debug("external_translation_deduped",{key:n.externalRequest.key,cacheKey:n.cacheKey}),s;const o=this.executeTranslation(n);return this.inFlight.set(n.cacheKey,o),o}normalizeRequest(e){const n=e.sourceLanguage??Mt,r={text:e.text,sourceLanguage:n,targetLanguage:e.targetLanguage,glossary:e.glossary},s=this.createCacheKey(r),o=ge(e.timeoutMs)?e.timeoutMs:this.config.timeoutMs;return{externalRequest:{key:e.key,text:e.text,targetLanguage:e.targetLanguage,sourceLanguage:n},translateRequest:r,cacheKey:s,timeoutMs:o,signal:e.signal}}async shouldTranslate(e){if(!this.config.shouldTranslate)return!0;try{return this.config.shouldTranslate(e)}catch(n){return this.warn("external_translation_should_translate_error",{key:e.key,language:e.targetLanguage,error:n}),!0}}async executeTranslation(e){try{if(!await this.invokeExternalTranslationHook(e.externalRequest)){this.debug("external_translation_vetoed",{key:e.externalRequest.key,targetLanguage:e.externalRequest.targetLanguage});return}this.debug("external_translation_started",{key:e.externalRequest.key,cacheKey:e.cacheKey});const n=await this.translateWithTimeout(e.translateRequest,e.timeoutMs,e.signal);return this.writeToCache(e.cacheKey,n),this.notifyTranslationComplete(n),this.debug("external_translation_succeeded",{key:e.externalRequest.key,cacheKey:e.cacheKey}),n}catch(n){const r=this.normalizeError(n);this.handleTranslationError(e,r);return}finally{this.inFlight.delete(e.cacheKey)}}async invokeExternalTranslationHook(e){const n=this.config.onExternalTranslation;if(!n)return!0;try{const r=await n(e);return typeof r=="boolean"?r:!0}catch(r){return this.warn("external_translation_hook_error",{key:e.key,language:e.targetLanguage,error:r}),!0}}async translateWithTimeout(e,n,r){if(!(typeof AbortController=="function"))return this.provider.translate(e,{timeoutMs:ge(n)?n:void 0,signal:r});const o=new AbortController;let i=!1,l;r&&(r.aborted?o.abort():(l=()=>{o.abort()},r.addEventListener("abort",l,{once:!0})));const f=ge(n)&&n?setTimeout(()=>{i=!0,o.abort()},n):void 0;try{return await this.provider.translate(e,{timeoutMs:ge(n)?n:void 0,signal:o.signal})}catch(u){throw i?new $e(`External translation timed out after ${n}ms`):(o.signal.aborted&&!i,u)}finally{f&&clearTimeout(f),l&&r&&r.removeEventListener("abort",l)}}readFromCache(e){var n;return(n=this.cache)==null?void 0:n.get(e)}writeToCache(e,n){var r;(r=this.cache)==null||r.set(e,n)}handleTranslationError(e,n){const r={key:e.externalRequest.key,language:e.externalRequest.targetLanguage,originalText:e.externalRequest.text,error:n};this.notifyTranslationError(r),this.warn("external_fallback_failed",{provider:this.provider.type,key:r.key,language:r.language,errorCode:n.code,retryable:n.retryable,message:n.message,details:n.details})}normalizeError(e){return this.provider.normalizeError?this.provider.normalizeError(e):e instanceof $e?{code:"timeout",message:e.message,retryable:!0,details:e}:e instanceof Error?{code:e.name||"unknown_error",message:e.message,retryable:!1,details:e}:{code:"unknown_error",message:"Unknown provider error",retryable:!1,details:e}}createCacheKey(e){return[e.sourceLanguage,e.targetLanguage,this.hashText(e.text,e.glossary)].join("|")}hashText(e,n){let r=2166136261;const s=n&&Object.keys(n).length>0?`${e}|${JSON.stringify(jt(n))}`:e;for(let o=0;o<s.length;o+=1)r^=s.charCodeAt(o),r+=(r<<1)+(r<<4)+(r<<7)+(r<<8)+(r<<24);return(r>>>0).toString(16)}warn(e,n){const r={scope:"translator",event:e,...n};if(this.logger){this.logger.warn(e,r);return}console.warn("[vbss-translator]",r)}debug(e,n){var s;if(!this.config.debug)return;const r={scope:"translator",event:e,...n};if((s=this.logger)!=null&&s.debug){this.logger.debug(e,r);return}console.debug("[vbss-translator]",r)}notifyTranslationComplete(e){const n=this.config.onTranslationComplete;if(n)try{n(e)}catch(r){this.warn("external_translation_complete_callback_error",{provider:this.provider.type,error:r})}}notifyTranslationError(e){const n=this.config.onTranslationError;if(n)try{n(e)}catch(r){this.warn("external_translation_error_callback_error",{provider:this.provider.type,key:e.key,language:e.language,error:r})}}}const Ce=()=>Date.now(),me=t=>typeof t=="number"&&Number.isFinite(t)&&t>0;class It{constructor(e){I(this,"store",new Map);I(this,"enabled");I(this,"ttlMs");I(this,"maxEntries");this.enabled=e.enabled,this.ttlMs=Math.max(0,e.ttlMs),this.maxEntries=e.maxEntries}isEnabled(){return this.enabled}setEnabled(e){e||this.clear(),this.enabled=e}setTtl(e){this.ttlMs=Math.max(0,e)}size(){return this.store.size}clear(){this.store.clear()}get(e){if(!this.enabled)return;const n=this.store.get(e);if(n){if(this.isExpired(n)){this.store.delete(e);return}return n.value}}set(e,n,r){if(!this.enabled)return;const s=me(r)?r:this.ttlMs,o=me(s)?Ce()+s:void 0;this.store.set(e,{value:n,expiresAt:o,insertedAt:Ce()}),this.enforceMaxEntries()}delete(e){this.store.delete(e)}has(e){if(!this.enabled)return!1;const n=this.store.get(e);return n?this.isExpired(n)?(this.store.delete(e),!1):!0:!1}entries(){const e=[];for(const[n,r]of this.store.entries()){if(this.isExpired(r)){this.store.delete(n);continue}e.push({key:n,result:r.value,expiresAt:r.expiresAt})}return e}prune(){for(const[e,n]of this.store.entries())this.isExpired(n)&&this.store.delete(e)}enforceMaxEntries(){if(!me(this.maxEntries))return;const e=this.maxEntries;for(;this.store.size>e;){const n=this.findOldestKey();if(!n)break;this.store.delete(n)}}findOldestKey(){let e,n=Number.POSITIVE_INFINITY;for(const[r,s]of this.store.entries())s.insertedAt<n&&(e=r,n=s.insertedAt);return e}isExpired(e){return me(e.expiresAt)?e.expiresAt<=Ce():!1}}function Ve(t,e){return function(){return t.apply(e,arguments)}}const{toString:Ht}=Object.prototype,{getPrototypeOf:ye}=Object,{iterator:be,toStringTag:ze}=Symbol,Ee=(t=>e=>{const n=Ht.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),K=t=>(t=t.toLowerCase(),e=>Ee(e)===t),we=t=>e=>typeof e===t,{isArray:ne}=Array,re=we("undefined");function ie(t){return t!==null&&!re(t)&&t.constructor!==null&&!re(t.constructor)&&F(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Je=K("ArrayBuffer");function qt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Je(t.buffer),e}const Kt=we("string"),F=we("function"),We=we("number"),ae=t=>t!==null&&typeof t=="object",$t=t=>t===!0||t===!1,Re=t=>{if(Ee(t)!=="object")return!1;const e=ye(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(ze in t)&&!(be in t)},Vt=t=>{if(!ae(t)||ie(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},zt=K("Date"),Jt=K("File"),Wt=t=>!!(t&&typeof t.uri<"u"),Xt=t=>t&&typeof t.getParts<"u",Gt=K("Blob"),Qt=K("FileList"),Yt=t=>ae(t)&&F(t.pipe);function Zt(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Xe=Zt(),Ge=typeof Xe.FormData<"u"?Xe.FormData:void 0,en=t=>{if(!t)return!1;if(Ge&&t instanceof Ge)return!0;const e=ye(t);if(!e||e===Object.prototype||!F(t.append))return!1;const n=Ee(t);return n==="formdata"||n==="object"&&F(t.toString)&&t.toString()==="[object FormData]"},tn=K("URLSearchParams"),[nn,rn,sn,on]=["ReadableStream","Request","Response","Headers"].map(K),an=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function le(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),ne(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{if(ie(t))return;const o=n?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let l;for(r=0;r<i;r++)l=o[r],e.call(null,t[l],l,t)}}function Qe(t,e){if(ie(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}const Q=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ye=t=>!re(t)&&t!==Q;function Pe(){const{caseless:t,skipUndefined:e}=Ye(this)&&this||{},n={},r=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=t&&Qe(n,o)||o;Re(n[i])&&Re(s)?n[i]=Pe(n[i],s):Re(s)?n[i]=Pe({},s):ne(s)?n[i]=s.slice():(!e||!re(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&le(arguments[s],r);return n}const ln=(t,e,n,{allOwnKeys:r}={})=>(le(e,(s,o)=>{n&&F(s)?Object.defineProperty(t,o,{value:Ve(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),cn=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),un=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},dn=(t,e,n,r)=>{let s,o,i;const l={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),o=s.length;o-- >0;)i=s[o],(!r||r(i,t,e))&&!l[i]&&(e[i]=t[i],l[i]=!0);t=n!==!1&&ye(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},fn=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},hn=t=>{if(!t)return null;if(ne(t))return t;let e=t.length;if(!We(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},pn=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&ye(Uint8Array)),gn=(t,e)=>{const r=(t&&t[be]).call(t);let s;for(;(s=r.next())&&!s.done;){const o=s.value;e.call(t,o[0],o[1])}},mn=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},yn=K("HTMLFormElement"),bn=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Ze=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),En=K("RegExp"),et=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};le(n,(s,o)=>{let i;(i=e(s,o,t))!==!1&&(r[o]=i||s)}),Object.defineProperties(t,r)},wn=t=>{et(t,(e,n)=>{if(F(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(F(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Rn=(t,e)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return ne(t)?r(t):r(String(t).split(e)),n},Tn=()=>{},xn=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Sn(t){return!!(t&&F(t.append)&&t[ze]==="FormData"&&t[be])}const On=t=>{const e=new Array(10),n=(r,s)=>{if(ae(r)){if(e.indexOf(r)>=0)return;if(ie(r))return r;if(!("toJSON"in r)){e[s]=r;const o=ne(r)?[]:{};return le(r,(i,l)=>{const f=n(i,s+1);!re(f)&&(o[l]=f)}),e[s]=void 0,o}}return r};return n(t,0)},_n=K("AsyncFunction"),An=t=>t&&(ae(t)||F(t))&&F(t.then)&&F(t.catch),tt=((t,e)=>t?setImmediate:e?((n,r)=>(Q.addEventListener("message",({source:s,data:o})=>{s===Q&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),Q.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",F(Q.postMessage)),Cn=typeof queueMicrotask<"u"?queueMicrotask.bind(Q):typeof process<"u"&&process.nextTick||tt,a={isArray:ne,isArrayBuffer:Je,isBuffer:ie,isFormData:en,isArrayBufferView:qt,isString:Kt,isNumber:We,isBoolean:$t,isObject:ae,isPlainObject:Re,isEmptyObject:Vt,isReadableStream:nn,isRequest:rn,isResponse:sn,isHeaders:on,isUndefined:re,isDate:zt,isFile:Jt,isReactNativeBlob:Wt,isReactNative:Xt,isBlob:Gt,isRegExp:En,isFunction:F,isStream:Yt,isURLSearchParams:tn,isTypedArray:pn,isFileList:Qt,forEach:le,merge:Pe,extend:ln,trim:an,stripBOM:cn,inherits:un,toFlatObject:dn,kindOf:Ee,kindOfTest:K,endsWith:fn,toArray:hn,forEachEntry:gn,matchAll:mn,isHTMLForm:yn,hasOwnProperty:Ze,hasOwnProp:Ze,reduceDescriptors:et,freezeMethods:wn,toObjectSet:Rn,toCamelCase:bn,noop:Tn,toFiniteNumber:xn,findKey:Qe,global:Q,isContextDefined:Ye,isSpecCompliantForm:Sn,toJSONObject:On,isAsyncFn:_n,isThenable:An,setImmediate:tt,asap:Cn,isIterable:t=>t!=null&&F(t[be])};let y=class Dt extends Error{static from(e,n,r,s,o,i){const l=new Dt(e.message,n||e.code,r,s,o);return l.cause=e,l.name=e.name,e.status!=null&&l.status==null&&(l.status=e.status),i&&Object.assign(l,i),l}constructor(e,n,r,s,o){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}};y.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",y.ERR_BAD_OPTION="ERR_BAD_OPTION",y.ECONNABORTED="ECONNABORTED",y.ETIMEDOUT="ETIMEDOUT",y.ERR_NETWORK="ERR_NETWORK",y.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",y.ERR_DEPRECATED="ERR_DEPRECATED",y.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",y.ERR_BAD_REQUEST="ERR_BAD_REQUEST",y.ERR_CANCELED="ERR_CANCELED",y.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",y.ERR_INVALID_URL="ERR_INVALID_URL",y.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Pn=null;function Le(t){return a.isPlainObject(t)||a.isArray(t)}function nt(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function ke(t,e,n){return t?t.concat(e).map(function(s,o){return s=nt(s),!n&&o?"["+s+"]":s}).join(n?".":""):e}function Ln(t){return a.isArray(t)&&!t.some(Le)}const kn=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function Te(t,e,n){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,S){return!a.isUndefined(S[h])});const r=n.metaTokens,s=n.visitor||d,o=n.dots,i=n.indexes,l=n.Blob||typeof Blob<"u"&&Blob,f=n.maxDepth===void 0?100:n.maxDepth,u=l&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function c(g){if(g===null)return"";if(a.isDate(g))return g.toISOString();if(a.isBoolean(g))return g.toString();if(!u&&a.isBlob(g))throw new y("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(g)||a.isTypedArray(g)?u&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function d(g,h,S){let q=g;if(a.isReactNative(e)&&a.isReactNativeBlob(g))return e.append(ke(S,h,o),c(g)),!1;if(g&&!S&&typeof g=="object"){if(a.endsWith(h,"{}"))h=r?h:h.slice(0,-2),g=JSON.stringify(g);else if(a.isArray(g)&&Ln(g)||(a.isFileList(g)||a.endsWith(h,"[]"))&&(q=a.toArray(g)))return h=nt(h),q.forEach(function(x,N){!(a.isUndefined(x)||x===null)&&e.append(i===!0?ke([h],N,o):i===null?h:h+"[]",c(x))}),!1}return Le(g)?!0:(e.append(ke(S,h,o),c(g)),!1)}const R=[],_=Object.assign(kn,{defaultVisitor:d,convertValue:c,isVisitable:Le});function p(g,h,S=0){if(!a.isUndefined(g)){if(S>f)throw new y("Object is too deeply nested ("+S+" levels). Max depth: "+f,y.ERR_FORM_DATA_DEPTH_EXCEEDED);if(R.indexOf(g)!==-1)throw Error("Circular reference detected in "+h.join("."));R.push(g),a.forEach(g,function(O,x){(!(a.isUndefined(O)||O===null)&&s.call(e,O,a.isString(x)?x.trim():x,h,_))===!0&&p(O,h?h.concat(x):[x],S+1)}),R.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return p(t),e}function rt(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(t).replace(/[!'()~]|%20/g,function(r){return e[r]})}function ve(t,e){this._pairs=[],t&&Te(t,this,e)}const st=ve.prototype;st.append=function(e,n){this._pairs.push([e,n])},st.toString=function(e){const n=e?function(r){return e.call(this,r,rt)}:rt;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function vn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ot(t,e,n){if(!e)return t;const r=n&&n.encode||vn,s=a.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(o?i=o(e,s):i=a.isURLSearchParams(e)?e.toString():new ve(e,s).toString(r),i){const l=t.indexOf("#");l!==-1&&(t=t.slice(0,l)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class it{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(r){r!==null&&e(r)})}}const Ne={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Nn={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ve,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},De=typeof window<"u"&&typeof document<"u",Fe=typeof navigator=="object"&&navigator||void 0,Dn=De&&(!Fe||["ReactNative","NativeScript","NS"].indexOf(Fe.product)<0),Fn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Un=De&&window.location.href||"http://localhost",v={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:De,hasStandardBrowserEnv:Dn,hasStandardBrowserWebWorkerEnv:Fn,navigator:Fe,origin:Un},Symbol.toStringTag,{value:"Module"})),...Nn};function Mn(t,e){return Te(t,new v.classes.URLSearchParams,{visitor:function(n,r,s,o){return v.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function jn(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Bn(t){const e={},n=Object.keys(t);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],e[o]=t[o];return e}function at(t){function e(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const l=Number.isFinite(+i),f=o>=n.length;return i=!i&&a.isArray(s)?s.length:i,f?(a.hasOwnProp(s,i)?s[i]=a.isArray(s[i])?s[i].concat(r):[s[i],r]:s[i]=r,!l):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),e(n,r,s[i],o)&&a.isArray(s[i])&&(s[i]=Bn(s[i])),!l)}if(a.isFormData(t)&&a.isFunction(t.entries)){const n={};return a.forEachEntry(t,(r,s)=>{e(jn(r),s,n,0)}),n}return null}const se=(t,e)=>t!=null&&a.hasOwnProp(t,e)?t[e]:void 0;function In(t,e,n){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const ce={transitional:Ne,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=a.isObject(e);if(o&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(at(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(o){const f=se(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Mn(e,f).toString();if((l=a.isFileList(e))||r.indexOf("multipart/form-data")>-1){const u=se(this,"env"),c=u&&u.FormData;return Te(l?{"files[]":e}:e,c&&new c,f)}}return o||s?(n.setContentType("application/json",!1),In(e)):e}],transformResponse:[function(e){const n=se(this,"transitional")||ce.transitional,r=n&&n.forcedJSONParsing,s=se(this,"responseType"),o=s==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(r&&!s||o)){const l=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(e,se(this,"parseReviver"))}catch(f){if(l)throw f.name==="SyntaxError"?y.from(f,y.ERR_BAD_RESPONSE,this,null,se(this,"response")):f}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:v.classes.FormData,Blob:v.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{ce.headers[t]={}});const Hn=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),qn=t=>{const e={};let n,r,s;return t&&t.split(`
2
+ `).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||e[n]&&Hn[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},lt=Symbol("internals"),Kn=/[^\x09\x20-\x7E\x80-\xFF]/g;function $n(t){let e=0,n=t.length;for(;e<n;){const r=t.charCodeAt(e);if(r!==9&&r!==32)break;e+=1}for(;n>e;){const r=t.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return e===0&&n===t.length?t:t.slice(e,n)}function ue(t){return t&&String(t).trim().toLowerCase()}function Vn(t){return $n(t.replace(Kn,""))}function xe(t){return t===!1||t==null?t:a.isArray(t)?t.map(xe):Vn(String(t))}function zn(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const Jn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Ue(t,e,n,r,s){if(a.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!a.isString(e)){if(a.isString(r))return e.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(e)}}function Wn(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function Xn(t,e){const n=a.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,o,i){return this[r].call(this,e,s,o,i)},configurable:!0})})}let U=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function o(l,f,u){const c=ue(f);if(!c)throw new Error("header name must be a non-empty string");const d=a.findKey(s,c);(!d||s[d]===void 0||u===!0||u===void 0&&s[d]!==!1)&&(s[d||f]=xe(l))}const i=(l,f)=>a.forEach(l,(u,c)=>o(u,c,f));if(a.isPlainObject(e)||e instanceof this.constructor)i(e,n);else if(a.isString(e)&&(e=e.trim())&&!Jn(e))i(qn(e),n);else if(a.isObject(e)&&a.isIterable(e)){let l={},f,u;for(const c of e){if(!a.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[u=c[0]]=(f=l[u])?a.isArray(f)?[...f,c[1]]:[f,c[1]]:c[1]}i(l,n)}else e!=null&&o(n,e,r);return this}get(e,n){if(e=ue(e),e){const r=a.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return zn(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=ue(e),e){const r=a.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Ue(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function o(i){if(i=ue(i),i){const l=a.findKey(r,i);l&&(!n||Ue(r,r[l],l,n))&&(delete r[l],s=!0)}}return a.isArray(e)?e.forEach(o):o(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!e||Ue(this,this[o],o,e,!0))&&(delete this[o],s=!0)}return s}normalize(e){const n=this,r={};return a.forEach(this,(s,o)=>{const i=a.findKey(r,o);if(i){n[i]=xe(s),delete n[o];return}const l=e?Wn(o):String(o).trim();l!==o&&delete n[o],n[l]=xe(s),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[lt]=this[lt]={accessors:{}}).accessors,s=this.prototype;function o(i){const l=ue(i);r[l]||(Xn(s,i),r[l]=!0)}return a.isArray(e)?e.forEach(o):o(e),this}};U.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(U.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}}),a.freezeMethods(U);function Me(t,e){const n=this||ce,r=e||n,s=U.from(r.headers);let o=r.data;return a.forEach(t,function(l){o=l.call(n,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function ct(t){return!!(t&&t.__CANCEL__)}let de=class extends y{constructor(e,n,r){super(e??"canceled",y.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function ut(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new y("Request failed with status code "+n.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Gn(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Qn(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,o=0,i;return e=e!==void 0?e:1e3,function(f){const u=Date.now(),c=r[o];i||(i=u),n[s]=f,r[s]=u;let d=o,R=0;for(;d!==s;)R+=n[d++],d=d%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),u-i<e)return;const _=c&&u-c;return _?Math.round(R*1e3/_):void 0}}function Yn(t,e){let n=0,r=1e3/e,s,o;const i=(u,c=Date.now())=>{n=c,s=null,o&&(clearTimeout(o),o=null),t(...u)};return[(...u)=>{const c=Date.now(),d=c-n;d>=r?i(u,c):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},r-d)))},()=>s&&i(s)]}const Se=(t,e,n=3)=>{let r=0;const s=Qn(50,250);return Yn(o=>{const i=o.loaded,l=o.lengthComputable?o.total:void 0,f=l!=null?Math.min(i,l):i,u=Math.max(0,f-r),c=s(u);r=Math.max(r,f);const d={loaded:f,total:l,progress:l?f/l:void 0,bytes:u,rate:c||void 0,estimated:c&&l?(l-f)/c:void 0,event:o,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(d)},n)},dt=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},ft=t=>(...e)=>a.asap(()=>t(...e)),Zn=v.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,v.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(v.origin),v.navigator&&/(msie|trident)/i.test(v.navigator.userAgent)):()=>!0,er=v.hasStandardBrowserEnv?{write(t,e,n,r,s,o,i){if(typeof document>"u")return;const l=[`${t}=${encodeURIComponent(e)}`];a.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&l.push(`path=${r}`),a.isString(s)&&l.push(`domain=${s}`),o===!0&&l.push("secure"),a.isString(i)&&l.push(`SameSite=${i}`),document.cookie=l.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function tr(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function nr(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function ht(t,e,n){let r=!tr(e);return t&&(r||n===!1)?nr(t,e):e}const pt=t=>t instanceof U?{...t}:t;function Y(t,e){e=e||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(u,c,d,R){return a.isPlainObject(u)&&a.isPlainObject(c)?a.merge.call({caseless:R},u,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function s(u,c,d,R){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u,d,R)}else return r(u,c,d,R)}function o(u,c){if(!a.isUndefined(c))return r(void 0,c)}function i(u,c){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u)}else return r(void 0,c)}function l(u,c,d){if(a.hasOwnProp(e,d))return r(u,c);if(a.hasOwnProp(t,d))return r(void 0,u)}const f={url:o,method:o,data:o,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,allowedSocketPaths:i,responseEncoding:i,validateStatus:l,headers:(u,c,d)=>s(pt(u),pt(c),d,!0)};return a.forEach(Object.keys({...t,...e}),function(c){if(c==="__proto__"||c==="constructor"||c==="prototype")return;const d=a.hasOwnProp(f,c)?f[c]:s,R=a.hasOwnProp(t,c)?t[c]:void 0,_=a.hasOwnProp(e,c)?e[c]:void 0,p=d(R,_,c);a.isUndefined(p)&&d!==l||(n[c]=p)}),n}const gt=t=>{const e=Y({},t),n=R=>a.hasOwnProp(e,R)?e[R]:void 0,r=n("data");let s=n("withXSRFToken");const o=n("xsrfHeaderName"),i=n("xsrfCookieName");let l=n("headers");const f=n("auth"),u=n("baseURL"),c=n("allowAbsoluteUrls"),d=n("url");if(e.headers=l=U.from(l),e.url=ot(ht(u,d,c),t.params,t.paramsSerializer),f&&l.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?unescape(encodeURIComponent(f.password)):""))),a.isFormData(r)){if(v.hasStandardBrowserEnv||v.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const R=r.getHeaders(),_=["content-type","content-length"];Object.entries(R).forEach(([p,g])=>{_.includes(p.toLowerCase())&&l.set(p,g)})}}if(v.hasStandardBrowserEnv&&(a.isFunction(s)&&(s=s(e)),s===!0||s==null&&Zn(e.url))){const _=o&&i&&er.read(i);_&&l.set(o,_)}return e},rr=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,r){const s=gt(t);let o=s.data;const i=U.from(s.headers).normalize();let{responseType:l,onUploadProgress:f,onDownloadProgress:u}=s,c,d,R,_,p;function g(){_&&_(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(c),s.signal&&s.signal.removeEventListener("abort",c)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function S(){if(!h)return;const O=U.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),N={data:!l||l==="text"||l==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:O,config:t,request:h};ut(function(D){n(D),g()},function(D){r(D),g()},N),h=null}"onloadend"in h?h.onloadend=S:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(S)},h.onabort=function(){h&&(r(new y("Request aborted",y.ECONNABORTED,t,h)),h=null)},h.onerror=function(x){const N=x&&x.message?x.message:"Network Error",z=new y(N,y.ERR_NETWORK,t,h);z.event=x||null,r(z),h=null},h.ontimeout=function(){let x=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const N=s.transitional||Ne;s.timeoutErrorMessage&&(x=s.timeoutErrorMessage),r(new y(x,N.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,t,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(x,N){h.setRequestHeader(N,x)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),l&&l!=="json"&&(h.responseType=s.responseType),u&&([R,p]=Se(u,!0),h.addEventListener("progress",R)),f&&h.upload&&([d,_]=Se(f),h.upload.addEventListener("progress",d),h.upload.addEventListener("loadend",_)),(s.cancelToken||s.signal)&&(c=O=>{h&&(r(!O||O.type?new de(null,t,h):O),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));const q=Gn(s.url);if(q&&v.protocols.indexOf(q)===-1){r(new y("Unsupported protocol "+q+":",y.ERR_BAD_REQUEST,t));return}h.send(o||null)})},sr=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const o=function(u){if(!s){s=!0,l();const c=u instanceof Error?u:this.reason;r.abort(c instanceof y?c:new de(c instanceof Error?c.message:c))}};let i=e&&setTimeout(()=>{i=null,o(new y(`timeout of ${e}ms exceeded`,y.ETIMEDOUT))},e);const l=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),t=null)};t.forEach(u=>u.addEventListener("abort",o));const{signal:f}=r;return f.unsubscribe=()=>a.asap(l),f}},or=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,s;for(;r<n;)s=r+e,yield t.slice(r,s),r=s},ir=async function*(t,e){for await(const n of ar(t))yield*or(n,e)},ar=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},mt=(t,e,n,r)=>{const s=ir(t,e);let o=0,i,l=f=>{i||(i=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:u,value:c}=await s.next();if(u){l(),f.close();return}let d=c.byteLength;if(n){let R=o+=d;n(R)}f.enqueue(new Uint8Array(c))}catch(u){throw l(u),u}},cancel(f){return l(f),s.return()}},{highWaterMark:2})},yt=64*1024,{isFunction:Oe}=a,lr=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:bt,TextEncoder:Et}=a.global,wt=(t,...e)=>{try{return!!t(...e)}catch{return!1}},cr=t=>{t=a.merge.call({skipUndefined:!0},lr,t);const{fetch:e,Request:n,Response:r}=t,s=e?Oe(e):typeof fetch=="function",o=Oe(n),i=Oe(r);if(!s)return!1;const l=s&&Oe(bt),f=s&&(typeof Et=="function"?(p=>g=>p.encode(g))(new Et):async p=>new Uint8Array(await new n(p).arrayBuffer())),u=o&&l&&wt(()=>{let p=!1;const g=new n(v.origin,{body:new bt,method:"POST",get duplex(){return p=!0,"half"}}),h=g.headers.has("Content-Type");return g.body!=null&&g.body.cancel(),p&&!h}),c=i&&l&&wt(()=>a.isReadableStream(new r("").body)),d={stream:c&&(p=>p.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!d[p]&&(d[p]=(g,h)=>{let S=g&&g[p];if(S)return S.call(g);throw new y(`Response type '${p}' is not supported`,y.ERR_NOT_SUPPORT,h)})});const R=async p=>{if(p==null)return 0;if(a.isBlob(p))return p.size;if(a.isSpecCompliantForm(p))return(await new n(v.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(a.isArrayBufferView(p)||a.isArrayBuffer(p))return p.byteLength;if(a.isURLSearchParams(p)&&(p=p+""),a.isString(p))return(await f(p)).byteLength},_=async(p,g)=>{const h=a.toFiniteNumber(p.getContentLength());return h??R(g)};return async p=>{let{url:g,method:h,data:S,signal:q,cancelToken:O,timeout:x,onDownloadProgress:N,onUploadProgress:z,responseType:D,headers:B,withCredentials:V="same-origin",fetchOptions:he}=gt(p),ee=e||fetch;D=D?(D+"").toLowerCase():"text";let te=sr([q,O&&O.toAbortSignal()],x),X=null;const J=te&&te.unsubscribe&&(()=>{te.unsubscribe()});let m;try{if(z&&u&&h!=="get"&&h!=="head"&&(m=await _(B,S))!==0){let P=new n(g,{method:"POST",body:S,duplex:"half"}),L;if(a.isFormData(S)&&(L=P.headers.get("content-type"))&&B.setContentType(L),P.body){const[$,oe]=dt(m,Se(ft(z)));S=mt(P.body,yt,$,oe)}}a.isString(V)||(V=V?"include":"omit");const b=o&&"credentials"in n.prototype;if(a.isFormData(S)){const P=B.getContentType();P&&/^multipart\/form-data/i.test(P)&&!/boundary=/i.test(P)&&B.delete("content-type")}const w={...he,signal:te,method:h.toUpperCase(),headers:B.normalize().toJSON(),body:S,duplex:"half",credentials:b?V:void 0};X=o&&new n(g,w);let E=await(o?ee(X,he):ee(g,w));const C=c&&(D==="stream"||D==="response");if(c&&(N||C&&J)){const P={};["status","statusText","headers"].forEach(pe=>{P[pe]=E[pe]});const L=a.toFiniteNumber(E.headers.get("content-length")),[$,oe]=N&&dt(L,Se(ft(N),!0))||[];E=new r(mt(E.body,yt,$,()=>{oe&&oe(),J&&J()}),P)}D=D||"text";let G=await d[a.findKey(d,D)||"text"](E,p);return!C&&J&&J(),await new Promise((P,L)=>{ut(P,L,{data:G,headers:U.from(E.headers),status:E.status,statusText:E.statusText,config:p,request:X})})}catch(b){throw J&&J(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new y("Network Error",y.ERR_NETWORK,p,X,b&&b.response),{cause:b.cause||b}):y.from(b,b&&b.code,p,X,b&&b.response)}}},ur=new Map,Rt=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,o=[r,s,n];let i=o.length,l=i,f,u,c=ur;for(;l--;)f=o[l],u=c.get(f),u===void 0&&c.set(f,u=l?new Map:cr(e)),c=u;return u};Rt();const je={http:Pn,xhr:rr,fetch:{get:Rt}};a.forEach(je,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Tt=t=>`- ${t}`,dr=t=>a.isFunction(t)||t===null||t===!1;function fr(t,e){t=a.isArray(t)?t:[t];const{length:n}=t;let r,s;const o={};for(let i=0;i<n;i++){r=t[i];let l;if(s=r,!dr(r)&&(s=je[(l=String(r)).toLowerCase()],s===void 0))throw new y(`Unknown adapter '${l}'`);if(s&&(a.isFunction(s)||(s=s.get(e))))break;o[l||"#"+i]=s}if(!s){const i=Object.entries(o).map(([f,u])=>`adapter ${f} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?i.length>1?`since :
4
+ `+i.map(Tt).join(`
5
+ `):" "+Tt(i[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const xt={getAdapter:fr,adapters:je};function Be(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new de(null,t)}function St(t){return Be(t),t.headers=U.from(t.headers),t.data=Me.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),xt.getAdapter(t.adapter||ce.adapter,t)(t).then(function(r){return Be(t),r.data=Me.call(t,t.transformResponse,r),r.headers=U.from(r.headers),r},function(r){return ct(r)||(Be(t),r&&r.response&&(r.response.data=Me.call(t,t.transformResponse,r.response),r.response.headers=U.from(r.response.headers))),Promise.reject(r)})}const Ot="1.15.2",_e={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{_e[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const _t={};_e.transitional=function(e,n,r){function s(o,i){return"[Axios v"+Ot+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,l)=>{if(e===!1)throw new y(s(i," has been removed"+(n?" in "+n:"")),y.ERR_DEPRECATED);return n&&!_t[i]&&(_t[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,i,l):!0}},_e.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function hr(t,e,n){if(typeof t!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const o=r[s],i=Object.prototype.hasOwnProperty.call(e,o)?e[o]:void 0;if(i){const l=t[o],f=l===void 0||i(l,o,t);if(f!==!0)throw new y("option "+o+" must be "+f,y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new y("Unknown option "+o,y.ERR_BAD_OPTION)}}const Ae={assertOptions:hr,validators:_e},H=Ae.validators;let Z=class{constructor(e){this.defaults=e||{},this.interceptors={request:new it,response:new it}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=(()=>{if(!s.stack)return"";const i=s.stack.indexOf(`
6
+ `);return i===-1?"":s.stack.slice(i+1)})();try{if(!r.stack)r.stack=o;else if(o){const i=o.indexOf(`
7
+ `),l=i===-1?-1:o.indexOf(`
8
+ `,i+1),f=l===-1?"":o.slice(l+1);String(r.stack).endsWith(f)||(r.stack+=`
9
+ `+o)}}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Y(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Ae.assertOptions(r,{silentJSONParsing:H.transitional(H.boolean),forcedJSONParsing:H.transitional(H.boolean),clarifyTimeoutError:H.transitional(H.boolean),legacyInterceptorReqResOrdering:H.transitional(H.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:Ae.assertOptions(s,{encode:H.function,serialize:H.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ae.assertOptions(n,{baseUrl:H.spelling("baseURL"),withXsrfToken:H.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[n.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),n.headers=U.concat(i,o);const l=[];let f=!0;this.interceptors.request.forEach(function(g){if(typeof g.runWhen=="function"&&g.runWhen(n)===!1)return;f=f&&g.synchronous;const h=n.transitional||Ne;h&&h.legacyInterceptorReqResOrdering?l.unshift(g.fulfilled,g.rejected):l.push(g.fulfilled,g.rejected)});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let c,d=0,R;if(!f){const p=[St.bind(this),void 0];for(p.unshift(...l),p.push(...u),R=p.length,c=Promise.resolve(n);d<R;)c=c.then(p[d++],p[d++]);return c}R=l.length;let _=n;for(;d<R;){const p=l[d++],g=l[d++];try{_=p(_)}catch(h){g.call(this,h);break}}try{c=St.call(this,_)}catch(p){return Promise.reject(p)}for(d=0,R=u.length;d<R;)c=c.then(u[d++],u[d++]);return c}getUri(e){e=Y(this.defaults,e);const n=ht(e.baseURL,e.url,e.allowAbsoluteUrls);return ot(n,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){Z.prototype[e]=function(n,r){return this.request(Y(r||{},{method:e,url:n,data:(r||{}).data}))}}),a.forEach(["post","put","patch"],function(e){function n(r){return function(o,i,l){return this.request(Y(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}Z.prototype[e]=n(),Z.prototype[e+"Form"]=n(!0)});let pr=class Ft{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(l=>{r.subscribe(l),o=l}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},e(function(o,i,l){r.reason||(r.reason=new de(o,i,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new Ft(function(s){e=s}),cancel:e}}};function gr(t){return function(n){return t.apply(null,n)}}function mr(t){return a.isObject(t)&&t.isAxiosError===!0}const Ie={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ie).forEach(([t,e])=>{Ie[e]=t});function At(t){const e=new Z(t),n=Ve(Z.prototype.request,e);return a.extend(n,Z.prototype,e,{allOwnKeys:!0}),a.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return At(Y(t,s))},n}const A=At(ce);A.Axios=Z,A.CanceledError=de,A.CancelToken=pr,A.isCancel=ct,A.VERSION=Ot,A.toFormData=Te,A.AxiosError=y,A.Cancel=A.CanceledError,A.all=function(e){return Promise.all(e)},A.spread=gr,A.isAxiosError=mr,A.mergeConfig=Y,A.AxiosHeaders=U,A.formToJSON=t=>at(a.isHTMLForm(t)?new FormData(t):t),A.getAdapter=xt.getAdapter,A.HttpStatusCode=Ie,A.default=A;const{Axios:Wr,AxiosError:Xr,CanceledError:Gr,isCancel:Qr,CancelToken:Yr,VERSION:Zr,all:es,Cancel:ts,isAxiosError:ns,spread:rs,toFormData:ss,AxiosHeaders:os,HttpStatusCode:is,formToJSON:as,getAdapter:ls,mergeConfig:cs}=A,Ct="https://translation.googleapis.com/language/translate/v2",yr=new Set([408,425,429,500,502,503,504]),br=t=>!!t,Er=t=>A.isAxiosError(t);class wr{constructor(e){I(this,"type","google");I(this,"axios");this.config=e,this.axios=A.create({baseURL:e.endpoint??Ct,headers:{"Content-Type":"application/json",...e.headers}})}isAvailable(){return this.config.apiKey||br(this.config.headers)?{available:!0}:{available:!0}}async translate(e,n){var f,u,c;const r={q:e.text,target:e.targetLanguage,format:"text"};e.sourceLanguage&&e.sourceLanguage!=="auto"&&(r.source=e.sourceLanguage),e.glossary&&Object.keys(e.glossary).length>0&&(r.glossaryConfig={glossaryData:{languagePair:{sourceLanguageCode:e.sourceLanguage??"auto",targetLanguageCode:e.targetLanguage},terms:Object.entries(e.glossary).map(([d,R])=>({sourceText:d,targetText:R}))}});const s={...this.config.headers,...n==null?void 0:n.headers},i=(c=(u=(f=(await this.axios.post("",r,{headers:s,params:this.createQueryParams(),timeout:n==null?void 0:n.timeoutMs,signal:n==null?void 0:n.signal})).data)==null?void 0:f.data)==null?void 0:u.translations)==null?void 0:c[0];if(!(i!=null&&i.translatedText))throw new Error("Google Translate response did not include translatedText");const l={endpoint:this.config.endpoint??Ct};return i.model&&(l.model=i.model),this.config.projectId&&(l.projectId=this.config.projectId),this.config.region&&(l.region=this.config.region),{translatedText:i.translatedText,detectedSourceLanguage:i.detectedSourceLanguage,providerMetadata:l}}normalizeError(e){var n,r,s,o,i;if(Er(e)){const l=(n=e.response)==null?void 0:n.status,f=((r=e.response)==null?void 0:r.data)??{},u=((s=f.error)==null?void 0:s.message)??e.message??"Google Translate request failed";return{code:String(((o=f.error)==null?void 0:o.code)??l??"E_GOOGLE"),message:u,retryable:l?yr.has(l):!1,details:{status:l,data:f,headers:(i=e.response)==null?void 0:i.headers}}}return e instanceof Error?{code:e.name||"unknown_error",message:e.message,retryable:!1,details:e}:{code:"unknown_error",message:"Unknown provider error",retryable:!1,details:e}}createQueryParams(){if(this.config.apiKey)return{key:this.config.apiKey}}}const He=t=>{if(!t)throw new Error("Provider instance is null or undefined");if(!t.type)throw new Error("Provider missing required 'type' property");if(typeof t.translate!="function")throw new Error("Provider missing required 'translate' method");if(t.isAvailable&&typeof t.isAvailable!="function")throw new Error("Provider 'isAvailable' must be a function");if(t.normalizeError&&typeof t.normalizeError!="function")throw new Error("Provider 'normalizeError' must be a function")},Pt=t=>{if(t.id==="google"){const e=new wr(t);return He(e),e}if(t.implementation)return He(t.implementation),t.implementation;if(t.factory){const e=t.factory();return He(e),e}throw new Error("Custom provider configuration must include either 'implementation' or 'factory'")},Rr="translator",Tr=5e3,Lt=3e4,xr="::",Sr=t=>{var n,r;return((r=(n=navigator==null?void 0:navigator.language)==null?void 0:n.split("-"))==null?void 0:r[0])||t},Or=t=>localStorage.getItem(t),_r=(t,e)=>{localStorage.setItem(t,e)},Ar=t=>t?t instanceof Set?new Set(t):new Set(t):new Set,kt=(t,e)=>({scope:Rr,event:t,...e}),fe=(t,e)=>{console.warn("[vbss-translator]",kt(t,e))},M=(t,e)=>{console.debug("[vbss-translator]",kt(t,e))},Cr=()=>({warn:(t,e)=>{fe(t,e??{})},debug:(t,e)=>{M(t,e??{})}}),Pr=t=>{const{provider:e,cache:n,alwaysExternalKeys:r,enabled:s,timeoutMs:o,debug:i,...l}=t??{};return{enabled:s??!1,timeoutMs:o??Tr,debug:i??!1,provider:{...Lr,...e},cache:{...kr,...n},alwaysExternalKeys:Ar(r),...l}},Lr={id:"google"},kr={enabled:!1,ttlMs:36e5},vr=(t,e)=>`${t}${xr}${e}`,Nr=t=>t?new Map(t):new Map,Dr=(t,e)=>{const n=t.toLocaleLowerCase();return e.find(r=>Object.values(r).some(s=>s.toLocaleLowerCase()===n))},Fr=({children:t,translations:e,defaultLanguage:n="en",persist:r=!1,persistKey:s="language",autoDetectLanguage:o=!1,externalTranslation:i})=>{const l=T.useMemo(()=>Pr(i),[i]),[f,u]=T.useState(()=>new Set(l.alwaysExternalKeys));T.useEffect(()=>{u(m=>{const b=new Set(l.alwaysExternalKeys);return m.forEach(w=>b.add(w)),b})},[l]);const c=T.useCallback(m=>{u(b=>{if(b.has(m))return b;const w=new Set(b);return w.add(m),w})},[]),d=T.useMemo(()=>({...l,alwaysExternalKeys:f}),[l,f]),R=r?Or(s):null,_=o?Sr(n):null,[p,g]=T.useState(R??_??n);T.useEffect(()=>{r&&_r(s,p)},[p,r,s]);const h=T.useMemo(()=>Object.keys(e[0]||{}),[e]),S=T.useMemo(()=>Cr(),[]),q=T.useMemo(()=>new It(d.cache),[d.cache]),O=T.useMemo(()=>{let m;try{if(m=Pt(d.provider),d.debug&&M("TranslatorProvider_provider_created",{providerType:m.type,providerId:d.provider.id,timestamp:Date.now()}),m.isAvailable){const b=m.isAvailable();b.available?d.debug&&M("TranslatorProvider_provider_available",{providerType:m.type,providerId:d.provider.id,timestamp:Date.now()}):fe("TranslatorProvider_provider_unavailable",{providerType:m.type,providerId:d.provider.id,reason:b.reason,timestamp:Date.now()})}}catch(b){throw fe("TranslatorProvider_provider_creation_failed",{providerId:d.provider.id,error:b instanceof Error?b.message:"Unknown error",timestamp:Date.now()}),b}return new Bt({provider:m,config:d,cache:d.cache.enabled?q:void 0,logger:S})},[d,S,q]),[x,N]=T.useState(()=>new Map),[z,D]=T.useState(0),B=T.useRef(!0);T.useEffect(()=>(d.debug&&M("TranslatorProvider_mounted",{timestamp:Date.now()}),B.current=!0,()=>{d.debug&&M("TranslatorProvider_unmounting",{timestamp:Date.now()}),B.current=!1}),[d]);const V=T.useCallback((m,b,w)=>{var G;d.debug&&w&&M("setExternalStateEntry_called",{targetLanguage:m,key:b,status:w.status,value:w.value,isMounted:B.current});const E=()=>{N(P=>{const L=new Map(P),$=Nr(L.get(m));return w?($.set(b,w),L.set(m,$)):($.delete(b),$.size>0?L.set(m,$):L.delete(m)),L}),(w==null?void 0:w.status)==="resolved"&&(d.debug&&M("forceUpdate_triggered",{targetLanguage:m,key:b}),D(P=>P+1))};typeof process<"u"&&((G=process.env)==null?void 0:G.NODE_ENV)==="test"?E():T.startTransition(()=>{E()})},[d,D]),he=T.useCallback(m=>{var b;O.isEnabled()&&(V(m.targetLanguage,m.key,{status:"pending",value:m.displayValue}),O.translate({key:m.key,text:m.originalText,targetLanguage:m.targetLanguage,sourceLanguage:m.sourceLanguage,signal:(b=m.options)==null?void 0:b.signal}).then(w=>{if(d.debug&&M("translation_promise_resolved",{key:m.key,targetLanguage:m.targetLanguage,isMounted:B.current,hasResult:!!w,hasTranslatedText:!!(w&&w.translatedText),translatedText:w==null?void 0:w.translatedText}),w&&w.translatedText){d.debug&&M("translation_applying_resolved",{key:m.key,targetLanguage:m.targetLanguage,isMounted:B.current,translatedText:w.translatedText}),V(m.targetLanguage,m.key,{status:"resolved",value:w.translatedText});return}d.debug&&M("translation_invalid_result",{key:m.key,result:w}),V(m.targetLanguage,m.key,{status:"error",value:m.displayValue,retryAt:Date.now()+Lt})}).catch(w=>{d.debug&&M("translation_promise_rejected",{key:m.key,targetLanguage:m.targetLanguage,isMounted:B.current,error:(w==null?void 0:w.message)||String(w)}),fe("external_translation_unexpected_rejection",{key:m.key,language:m.targetLanguage,error:w,isMounted:B.current}),V(m.targetLanguage,m.key,{status:"error",value:m.displayValue,error:w,retryAt:Date.now()+Lt})}))},[d,V,O]),ee=T.useMemo(()=>{const m={};return x.forEach((b,w)=>{b.forEach((E,C)=>{m[vr(C,w)]=E.status==="pending"})}),d.debug&&M("isTranslatingRecord_recalculated",{recordSize:Object.keys(m).length,record:{...m}}),m},[x,d]),te=T.useMemo(()=>Object.values(ee).some(Boolean),[ee]),X=T.useCallback((m,b={})=>{var vt;const w=x.get(p),E=w==null?void 0:w.get(m);if(d.debug&&b.preferExternal&&M("t_called",{text:m,language:p,hasStateForLanguage:!!w,existingStateStatus:E==null?void 0:E.status,existingStateValue:E==null?void 0:E.value,preferExternal:b.preferExternal}),(E==null?void 0:E.status)==="resolved"&&E.value)return d.debug&&M("t_returning_resolved",{text:m,value:E.value}),E.value;const C=Dr(m,e),G=C==null?void 0:C[p],P=C?Object.values(C).find(Nt=>!!Nt):void 0,L=b.fallbackValue??(E==null?void 0:E.value)??G??P??m,$=b.preferExternal===!0||d.alwaysExternalKeys.has(m),oe=O.isEnabled(),pe=typeof G=="string";if(pe||fe("missing_translation",{key:m,language:p}),!(oe&&($||!pe)))return(E==null?void 0:E.status)==="pending"&&E.value?E.value:G??L;const Mr=Date.now(),jr=(E==null?void 0:E.status)==="error"&&(!E.retryAt||E.retryAt<=Mr);if(!E||jr){const qe=b.sourceLanguage??(C&&C[n]?n:void 0),Br=(qe&&(C==null?void 0:C[qe]))??(C==null?void 0:C[n])??m;he({key:m,targetLanguage:p,originalText:Br,displayValue:(E==null?void 0:E.value)??L,sourceLanguage:qe,options:b})}const W=((vt=x.get(p))==null?void 0:vt.get(m))??E;return(W==null?void 0:W.status)==="resolved"&&W.value?W.value:(W==null?void 0:W.status)==="pending"?W.value??L:L},[n,d.alwaysExternalKeys,x,p,he,O,e]),J=T.useMemo(()=>({t:X,language:p,languages:h,setLanguage:g,isTranslating:ee,isTranslatingAny:te,registerExternalKey:c,externalConfig:d}),[X,p,h,g,ee,te,c,d,z]);return j.jsx(Ke.Provider,{value:J,children:t})},Ur=()=>Ut();k.TranslatorProvider=Fr,k.createTranslationProvider=Pt,k.useTranslator=Ur,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,90 +1,111 @@
1
- {
2
- "name": "vbss-translator",
3
- "version": "1.1.0",
4
- "description": "A lightweight React translation toolkit focused on ergonomics, sensible defaults, and escape hatches when local dictionaries are not enough",
5
- "keywords": [
6
- "react",
7
- "translation",
8
- "i18n",
9
- "internationalization",
10
- "translator",
11
- "react-hooks",
12
- "context",
13
- "cli",
14
- "google-translate",
15
- "typescript"
16
- ],
17
- "private": false,
18
- "type": "module",
19
- "license": "MIT",
20
- "files": [
21
- "dist"
22
- ],
23
- "main": "dist/vbss-translator-umd.cjs",
24
- "module": "dist/vbss-translator.js",
25
- "exports": {
26
- ".": {
27
- "types": "./dist/vbss-translator.d.ts",
28
- "import": "./dist/vbss-translator.js",
29
- "require": "./dist/vbss-translator-umd.cjs"
30
- },
31
- "./generator": {
32
- "types": "./dist/generator.d.ts",
33
- "import": "./dist/generator.js",
34
- "require": "./dist/generator.cjs"
35
- }
36
- },
37
- "types": "./dist/vbss-translator.d.ts",
38
- "sideEffects": false,
39
- "bin": {
40
- "vbss-translator": "./dist/cli/index.js"
41
- },
42
- "repository": {
43
- "type": "git",
44
- "url": "git+https://github.com/vbss-io/vbss-translator.git"
45
- },
46
- "author": "Vitor Bastos <vitor@vbss.io> (https://vbss.io/)",
47
- "homepage": "https://ui.vbss.io/tools/vbss-translator",
48
- "scripts": {
49
- "dev": "vite",
50
- "build": "tsc && vite build && vite build --mode generator && vite build --mode cli",
51
- "lint": "eslint . --report-unused-disable-directives --max-warnings 0",
52
- "test": "jest",
53
- "test:watch": "jest --watch",
54
- "coverage": "jest --coverage",
55
- "generate-translations": "node dist/cli/index.js",
56
- "typecheck": "tsc --noEmit",
57
- "patch-deploy": "npm version patch && npm publish",
58
- "minor-deploy": "npm version minor && npm publish",
59
- "major-deploy": "npm version major && npm publish"
60
- },
61
- "dependencies": {
62
- "axios": "^1.7.7",
63
- "glob": "^10.0.0",
64
- "react": "^18.3.1",
65
- "react-dom": "^18.3.1"
66
- },
67
- "devDependencies": {
68
- "@eslint/js": "^9.15.0",
69
- "@testing-library/jest-dom": "^6.9.1",
70
- "@testing-library/react": "^16.3.0",
71
- "@types/jest": "^30.0.0",
72
- "@types/node": "^22.10.2",
73
- "@types/react": "^18.3.12",
74
- "@types/react-dom": "^18.3.1",
75
- "@vitejs/plugin-react": "^4.3.4",
76
- "eslint": "^9.15.0",
77
- "eslint-plugin-react-hooks": "^5.0.0",
78
- "eslint-plugin-react-refresh": "^0.4.14",
79
- "globals": "^15.12.0",
80
- "jest": "^30.2.0",
81
- "jest-environment-jsdom": "^30.2.0",
82
- "ts-jest": "^29.4.5",
83
- "ts-node": "^10.9.2",
84
- "typescript": "~5.6.2",
85
- "typescript-eslint": "^8.15.0",
86
- "vite": "^6.0.1",
87
- "vite-plugin-dts": "^4.3.0",
88
- "vite-tsconfig-paths": "^5.1.4"
89
- }
90
- }
1
+ {
2
+ "name": "vbss-translator",
3
+ "version": "1.1.2",
4
+ "description": "A lightweight React translation toolkit focused on ergonomics, sensible defaults, and escape hatches when local dictionaries are not enough",
5
+ "keywords": [
6
+ "react",
7
+ "translation",
8
+ "i18n",
9
+ "internationalization",
10
+ "translator",
11
+ "react-hooks",
12
+ "context",
13
+ "cli",
14
+ "google-translate",
15
+ "typescript"
16
+ ],
17
+ "private": false,
18
+ "type": "module",
19
+ "license": "MIT",
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "main": "dist/vbss-translator.umd.cjs",
24
+ "module": "dist/vbss-translator.js",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/vbss-translator.d.ts",
28
+ "import": "./dist/vbss-translator.js",
29
+ "require": "./dist/vbss-translator.umd.cjs"
30
+ },
31
+ "./generator": {
32
+ "types": "./dist/generator.d.ts",
33
+ "import": "./dist/generator.js",
34
+ "require": "./dist/generator.cjs"
35
+ }
36
+ },
37
+ "types": "./dist/vbss-translator.d.ts",
38
+ "sideEffects": false,
39
+ "bin": {
40
+ "vbss-translator": "./dist/cli/index.js"
41
+ },
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/vbss-io/vbss-translator.git"
45
+ },
46
+ "author": "Vitor Bastos <vitor@vbss.io> (https://vbss.io/)",
47
+ "homepage": "https://ui.vbss.io/tools/vbss-translator",
48
+ "scripts": {
49
+ "dev": "vite",
50
+ "build": "tsc && vite build && vite build --mode generator && vite build --mode cli",
51
+ "lint": "eslint . --report-unused-disable-directives --max-warnings 0",
52
+ "test": "jest",
53
+ "test:watch": "jest --watch",
54
+ "coverage": "jest --coverage",
55
+ "generate-translations": "node dist/cli/index.js",
56
+ "typecheck": "tsc --noEmit",
57
+ "patch-deploy": "npm version patch && npm publish",
58
+ "minor-deploy": "npm version minor && npm publish",
59
+ "major-deploy": "npm version major && npm publish"
60
+ },
61
+ "dependencies": {
62
+ "axios": "^1.15.0",
63
+ "glob": "^10.5.0",
64
+ "react": "^18.3.1",
65
+ "react-dom": "^18.3.1"
66
+ },
67
+ "overrides": {
68
+ "@eslint/plugin-kit": "^0.3.4",
69
+ "ajv@^6": "^6.14.0",
70
+ "ajv@^8": "^8.18.0",
71
+ "brace-expansion@1": "^1.1.12",
72
+ "brace-expansion@2": "^2.0.3",
73
+ "diff": "^4.0.4",
74
+ "esbuild": "^0.25.0",
75
+ "fast-uri": "^3.1.2",
76
+ "flatted": "^3.4.2",
77
+ "follow-redirects": "^1.16.0",
78
+ "handlebars": "^4.7.9",
79
+ "js-yaml": "^4.1.1",
80
+ "lodash": "^4.18.0",
81
+ "minimatch@^3": "^3.1.4",
82
+ "minimatch@^9": "^9.0.7",
83
+ "picomatch@^2": "^2.3.2",
84
+ "picomatch@^4": "^4.0.4",
85
+ "postcss": "^8.5.10",
86
+ "rollup": "^4.59.0"
87
+ },
88
+ "devDependencies": {
89
+ "@eslint/js": "^9.15.0",
90
+ "@testing-library/jest-dom": "^6.9.1",
91
+ "@testing-library/react": "^16.3.0",
92
+ "@types/jest": "^30.0.0",
93
+ "@types/node": "^22.10.2",
94
+ "@types/react": "^18.3.12",
95
+ "@types/react-dom": "^18.3.1",
96
+ "@vitejs/plugin-react": "^4.3.4",
97
+ "eslint": "^9.15.0",
98
+ "eslint-plugin-react-hooks": "^5.0.0",
99
+ "eslint-plugin-react-refresh": "^0.4.14",
100
+ "globals": "^15.12.0",
101
+ "jest": "^30.2.0",
102
+ "jest-environment-jsdom": "^30.2.0",
103
+ "ts-jest": "^29.4.5",
104
+ "ts-node": "^10.9.2",
105
+ "typescript": "~5.6.2",
106
+ "typescript-eslint": "^8.15.0",
107
+ "vite": "^6.4.2",
108
+ "vite-plugin-dts": "^4.3.0",
109
+ "vite-tsconfig-paths": "^5.1.4"
110
+ }
111
+ }