@bynlk/codeomnivis 0.0.0-bootstrap.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +77 -0
- package/README.md +62 -0
- package/bin/codeomnivis.js +19 -0
- package/dist/chunk-D2FE2QSJ.js +10271 -0
- package/dist/dist-YNCI4IFF.js +462 -0
- package/dist/index.js +2219 -0
- package/dist/ui/assets/index-BlLl2ApB.css +1 -0
- package/dist/ui/assets/index-RYkt2Yk8.js +1 -0
- package/dist/ui/assets/vendor-cytoscape-CUqq0XTU.js +331 -0
- package/dist/ui/assets/vendor-i18n-DMayGKXS.js +1 -0
- package/dist/ui/assets/vendor-l0sNRNKZ.js +1 -0
- package/dist/ui/assets/vendor-query-CdMHRlIH.js +1 -0
- package/dist/ui/assets/vendor-react-CHCXY0b5.js +48 -0
- package/dist/ui/brand/favicon.svg +4 -0
- package/dist/ui/brand/logo-mark-dark.svg +5 -0
- package/dist/ui/brand/logo-mark-light.svg +5 -0
- package/dist/ui/brand/logo-mark-mono.svg +5 -0
- package/dist/ui/index.html +18 -0
- package/dist/wasm/tree-sitter-kotlin.wasm +0 -0
- package/package.json +87 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const p=o=>typeof o=="string",K=()=>{let o,e;const t=new Promise((i,s)=>{o=i,e=s});return t.resolve=o,t.reject=e,t},ne=o=>o==null?"":String(o),be=(o,e,t)=>{o.forEach(i=>{e[i]&&(t[i]=e[i])})},Oe=/###/g,re=o=>o&&o.includes("###")?o.replace(Oe,"."):o,ae=o=>!o||p(o),U=(o,e,t)=>{const i=p(e)?e.split("."):e;let s=0;for(;s<i.length-1;){if(ae(o))return{};const n=re(i[s]);!o[n]&&t&&(o[n]=new t),Object.prototype.hasOwnProperty.call(o,n)?o=o[n]:o={},++s}return ae(o)?{}:{obj:o,k:re(i[s])}},oe=(o,e,t)=>{const{obj:i,k:s}=U(o,e,Object);if(i!==void 0||e.length===1){i[s]=t;return}let n=e[e.length-1],r=e.slice(0,e.length-1),a=U(o,r,Object);for(;a.obj===void 0&&r.length;)n=`${r[r.length-1]}.${n}`,r=r.slice(0,r.length-1),a=U(o,r,Object),a!=null&&a.obj&&typeof a.obj[`${a.k}.${n}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${n}`]=t},we=(o,e,t,i)=>{const{obj:s,k:n}=U(o,e,Object);s[n]=s[n]||[],s[n].push(t)},W=(o,e)=>{const{obj:t,k:i}=U(o,e);if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i]},Ce=(o,e,t)=>{const i=W(o,t);return i!==void 0?i:W(e,t)},me=(o,e,t)=>{for(const i in e)i!=="__proto__"&&i!=="constructor"&&(i in o?p(o[i])||o[i]instanceof String||p(e[i])||e[i]instanceof String?t&&(o[i]=e[i]):me(o[i],e[i],t):o[i]=e[i]);return o},k=o=>o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),$e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},ve=o=>p(o)?o.replace(/[&<>"'\/]/g,e=>$e[e]):o;class Re{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const i=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,i),this.regExpQueue.push(e),i}}const Pe=[" ",",","?","!",";"],Ne=new Re(20),Fe=(o,e,t)=>{e=e||"",t=t||"";const i=Pe.filter(r=>!e.includes(r)&&!t.includes(r));if(i.length===0)return!0;const s=Ne.getRegExp(`(${i.map(r=>r==="?"?"\\?":r).join("|")})`);let n=!s.test(o);if(!n){const r=o.indexOf(t);r>0&&!s.test(o.substring(0,r))&&(n=!0)}return n},q=(o,e,t=".")=>{if(!o)return;if(o[e])return Object.prototype.hasOwnProperty.call(o,e)?o[e]:void 0;const i=e.split(t);let s=o;for(let n=0;n<i.length;){if(!s||typeof s!="object")return;let r,a="";for(let u=n;u<i.length;++u)if(u!==n&&(a+=t),a+=i[u],r=s[a],r!==void 0){if(["string","number","boolean"].includes(typeof r)&&u<i.length-1)continue;n+=u-n+1;break}s=r}return s},M=o=>o==null?void 0:o.replace(/_/g,"-"),je={type:"logger",log(o){this.output("log",o)},warn(o){this.output("warn",o)},error(o){this.output("error",o)},output(o,e){var t,i;(i=(t=console==null?void 0:console[o])==null?void 0:t.apply)==null||i.call(t,console,e)}};class Y{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||je,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,i,s){return s&&!this.debug?null:(e=e.map(n=>p(n)?n.replace(/[\r\n\x00-\x1F\x7F]/g," "):n),p(e[0])&&(e[0]=`${i}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Y(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Y(this.logger,e)}}var N=new Y;class G{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(i=>{this.observers[i]||(this.observers[i]=new Map);const s=this.observers[i].get(t)||0;this.observers[i].set(t,s+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){const i=(...s)=>{t(...s),this.off(e,i)};return this.on(e,i),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([s,n])=>{for(let r=0;r<n;r++)s(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([s,n])=>{for(let r=0;r<n;r++)s(e,...t)})}}class le extends G{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,i,s={}){var l,c;const n=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,r=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.includes(".")?a=e.split("."):(a=[e,t],i&&(Array.isArray(i)?a.push(...i):p(i)&&n?a.push(...i.split(n)):a.push(i)));const u=W(this.data,a);return!u&&!t&&!i&&e.includes(".")&&(e=a[0],t=a[1],i=a.slice(2).join(".")),u||!r||!p(i)?u:q((c=(l=this.data)==null?void 0:l[e])==null?void 0:c[t],i,n)}addResource(e,t,i,s,n={silent:!1}){const r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let a=[e,t];i&&(a=a.concat(r?i.split(r):i)),e.includes(".")&&(a=e.split("."),s=t,t=a[1]),this.addNamespaces(t),oe(this.data,a,s),n.silent||this.emit("added",e,t,i,s)}addResources(e,t,i,s={silent:!1}){for(const n in i)(p(i[n])||Array.isArray(i[n]))&&this.addResource(e,t,n,i[n],{silent:!0});s.silent||this.emit("added",e,t,i)}addResourceBundle(e,t,i,s,n,r={silent:!1,skipCopy:!1}){let a=[e,t];e.includes(".")&&(a=e.split("."),s=i,i=t,t=a[1]),this.addNamespaces(t);let u=W(this.data,a)||{};r.skipCopy||(i=JSON.parse(JSON.stringify(i))),s?me(u,i,n):u={...u,...i},oe(this.data,a,u),r.silent||this.emit("added",e,t,i)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(s=>t[s]&&Object.keys(t[s]).length>0)}toJSON(){return this.data}}var ye={processors:{},addPostProcessor(o){this.processors[o.name]=o},handle(o,e,t,i,s){return o.forEach(n=>{var r;e=((r=this.processors[n])==null?void 0:r.process(e,t,i,s))??e}),e}};const xe=Symbol("i18next/PATH_KEY");function ke(){const o=[],e=Object.create(null);let t;return e.get=(i,s)=>{var n;return(n=t==null?void 0:t.revoke)==null||n.call(t),s===xe?o:(o.push(s),t=Proxy.revocable(i,e),t.proxy)},Proxy.revocable(Object.create(null),e).proxy}function I(o,e){const{[xe]:t}=o(ke()),i=(e==null?void 0:e.keySeparator)??".",s=(e==null?void 0:e.nsSeparator)??":",n=(e==null?void 0:e.enableSelector)==="strict";if(t.length>1&&s){const r=e==null?void 0:e.ns,a=n?Array.isArray(r)?r:r?[r]:null:Array.isArray(r)?r:null;if(a&&(n?a:a.length>1?a.slice(1):[]).includes(t[0]))return`${t[0]}${s}${t.slice(1).join(i)}`}return t.join(i)}const Q=o=>!p(o)&&typeof o!="boolean"&&typeof o!="number";class _ extends G{constructor(e,t={}){super(),be(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=N.create("translator"),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const i={...t};if(e==null)return!1;const s=this.resolve(e,i);if((s==null?void 0:s.res)===void 0)return!1;const n=Q(s.res);return!(i.returnObjects===!1&&n)}extractFromKey(e,t){let i=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const r=i&&e.includes(i),a=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Fe(e,i,s);if(r&&!a){const u=e.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:e,namespaces:p(n)?[n]:n};const l=e.split(i);(i!==s||i===s&&this.options.ns.includes(l[0]))&&(n=l.shift()),e=l.join(s)}return{key:e,namespaces:p(n)?[n]:n}}translate(e,t,i){let s=typeof t=="object"?{...t}:t;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),e==null)return"";typeof e=="function"&&(e=I(e,{...this.options,...s})),Array.isArray(e)||(e=[String(e)]),e=e.map(L=>typeof L=="function"?I(L,{...this.options,...s}):String(L));const n=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,r=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:a,namespaces:u}=this.extractFromKey(e[e.length-1],s),l=u[u.length-1];let c=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;c===void 0&&(c=":");const f=s.lng||this.language,d=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((f==null?void 0:f.toLowerCase())==="cimode")return d?n?{res:`${l}${c}${a}`,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:l,usedParams:this.getUsedParamsDetails(s)}:`${l}${c}${a}`:n?{res:a,usedKey:a,exactUsedKey:a,usedLng:f,usedNS:l,usedParams:this.getUsedParamsDetails(s)}:a;const g=this.resolve(e,s);let h=g==null?void 0:g.res;const m=(g==null?void 0:g.usedKey)||a,y=(g==null?void 0:g.exactUsedKey)||a,$=["[object Number]","[object Function]","[object RegExp]"],C=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,E=!this.i18nFormat||this.i18nFormat.handleAsObject,x=s.count!==void 0&&!p(s.count),F=_.hasDefaultValue(s),B=x?this.pluralResolver.getSuffix(f,s.count,s):"",j=s.ordinal&&x?this.pluralResolver.getSuffix(f,s.count,{ordinal:!1}):"",V=x&&!s.ordinal&&s.count===0,O=V&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${B}`]||s[`defaultValue${j}`]||s.defaultValue;let S=h;E&&!h&&F&&(S=O);const Se=Q(S),Le=Object.prototype.toString.apply(S);if(E&&S&&Se&&!$.includes(Le)&&!(p(C)&&Array.isArray(S))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const L=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,S,{...s,ns:u}):`key '${a} (${this.language})' returned an object instead of string.`;return n?(g.res=L,g.usedParams=this.getUsedParamsDetails(s),g):L}if(r){const L=Array.isArray(S),v=L?[]:{},ee=L?y:m;for(const R in S)if(Object.prototype.hasOwnProperty.call(S,R)){const P=`${ee}${r}${R}`;F&&!h?v[R]=this.translate(P,{...s,defaultValue:Q(O)?O[R]:void 0,joinArrays:!1,ns:u}):v[R]=this.translate(P,{...s,joinArrays:!1,ns:u}),v[R]===P&&(v[R]=S[R])}h=v}}else if(E&&p(C)&&Array.isArray(h))h=h.join(C),h&&(h=this.extendTranslation(h,e,s,i));else{let L=!1,v=!1;!this.isValidLookup(h)&&F&&(L=!0,h=O),this.isValidLookup(h)||(v=!0,h=a);const R=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&v?void 0:h,P=F&&O!==h&&this.options.updateMissing;if(v||L||P){if(this.logger.log(P?"updateKey":"missingKey",f,l,x&&!P?`${a}${this.pluralResolver.getSuffix(f,s.count,s)}`:a,P?O:h),r){const w=this.resolve(a,{...s,keySeparator:!1});w&&w.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let A=[];const z=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&z&&z[0])for(let w=0;w<z.length;w++)A.push(z[w]);else this.options.saveMissingTo==="all"?A=this.languageUtils.toResolveHierarchy(s.lng||this.language):A.push(s.lng||this.language);const te=(w,T,D)=>{var ie;const se=F&&D!==h?D:R;this.options.missingKeyHandler?this.options.missingKeyHandler(w,l,T,se,P,s):(ie=this.backendConnector)!=null&&ie.saveMissing&&this.backendConnector.saveMissing(w,l,T,se,P,s),this.emit("missingKey",w,l,T,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&x?A.forEach(w=>{const T=this.pluralResolver.getSuffixes(w,s);V&&s[`defaultValue${this.options.pluralSeparator}zero`]&&!T.includes(`${this.options.pluralSeparator}zero`)&&T.push(`${this.options.pluralSeparator}zero`),T.forEach(D=>{te([w],a+D,s[`defaultValue${D}`]||O)})}):te(A,a,O))}h=this.extendTranslation(h,e,s,g,i),v&&h===a&&this.options.appendNamespaceToMissingKey&&(h=`${l}${c}${a}`),(v||L)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${c}${a}`:a,L?h:void 0,s))}return n?(g.res=h,g.usedParams=this.getUsedParamsDetails(s),g):h}extendTranslation(e,t,i,s,n){var u,l;if((u=this.i18nFormat)!=null&&u.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const c=p(e)&&(((l=i==null?void 0:i.interpolation)==null?void 0:l.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(c){const g=e.match(this.interpolator.nestingRegexp);f=g&&g.length}let d=i.replace&&!p(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,i.lng||this.language||s.usedLng,i),c){const g=e.match(this.interpolator.nestingRegexp),h=g&&g.length;f<h&&(i.nest=!1)}!i.lng&&s&&s.res&&(i.lng=this.language||s.usedLng),i.nest!==!1&&(e=this.interpolator.nest(e,(...g)=>(n==null?void 0:n[0])===g[0]&&!i.context?(this.logger.warn(`It seems you are nesting recursively key: ${g[0]} in key: ${t[0]}`),null):this.translate(...g,t),i)),i.interpolation&&this.interpolator.reset()}const r=i.postProcess||this.options.postProcess,a=p(r)?[r]:r;return e!=null&&(a!=null&&a.length)&&i.applyPostProcessor!==!1&&(e=ye.handle(a,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(i)},...i}:i,this)),e}resolve(e,t={}){let i,s,n,r,a;return p(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(u=>typeof u=="function"?I(u,{...this.options,...t}):u)),e.forEach(u=>{if(this.isValidLookup(i))return;const l=this.extractFromKey(u,t),c=l.key;s=c;let f=l.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const d=t.count!==void 0&&!p(t.count),g=d&&!t.ordinal&&t.count===0,h=t.context!==void 0&&(p(t.context)||typeof t.context=="number")&&t.context!=="",m=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);f.forEach(y=>{var $,C;this.isValidLookup(i)||(a=y,!this.checkedLoadedFor[`${m[0]}-${y}`]&&(($=this.utils)!=null&&$.hasLoadedNamespace)&&!((C=this.utils)!=null&&C.hasLoadedNamespace(a))&&(this.checkedLoadedFor[`${m[0]}-${y}`]=!0,this.logger.warn(`key "${s}" for languages "${m.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(E=>{var B;if(this.isValidLookup(i))return;r=E;const x=[c];if((B=this.i18nFormat)!=null&&B.addLookupKeys)this.i18nFormat.addLookupKeys(x,c,E,y,t);else{let j;d&&(j=this.pluralResolver.getSuffix(E,t.count,t));const V=`${this.options.pluralSeparator}zero`,O=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(t.ordinal&&j.startsWith(O)&&x.push(c+j.replace(O,this.options.pluralSeparator)),x.push(c+j),g&&x.push(c+V)),h){const S=`${c}${this.options.contextSeparator||"_"}${t.context}`;x.push(S),d&&(t.ordinal&&j.startsWith(O)&&x.push(S+j.replace(O,this.options.pluralSeparator)),x.push(S+j),g&&x.push(S+V))}}let F;for(;F=x.pop();)this.isValidLookup(i)||(n=F,i=this.getResource(E,y,F,t))}))})}),{res:i,usedKey:s,exactUsedKey:n,usedLng:r,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,i,s={}){var n;return(n=this.i18nFormat)!=null&&n.getResource?this.i18nFormat.getResource(e,t,i,s):this.resourceStore.getResource(e,t,i,s)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!p(e.replace);let s=i?e.replace:e;if(i&&typeof e.count<"u"&&(s.count=e.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!i){s={...s};for(const n of t)delete s[n]}return s}static hasDefaultValue(e){const t="defaultValue";for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&i.startsWith(t)&&e[i]!==void 0)return!0;return!1}}class ue{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=N.create("languageUtils")}getScriptPartFromCode(e){if(e=M(e),!e||!e.includes("-"))return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=M(e),!e||!e.includes("-"))return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(p(e)&&e.includes("-")){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(i=>{if(t)return;const s=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(s))&&(t=s)}),!t&&this.options.supportedLngs&&e.forEach(i=>{if(t)return;const s=this.getScriptPartFromCode(i);if(this.isSupportedCode(s))return t=s;const n=this.getLanguagePartFromCode(i);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(r=>r===n?!0:!r.includes("-")&&!n.includes("-")?!1:!!(r.includes("-")&&!n.includes("-")&&r.slice(0,r.indexOf("-"))===n||r.startsWith(n)&&n.length>1))}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),p(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let i=e[t];return i||(i=e[this.getScriptPartFromCode(t)]),i||(i=e[this.formatLanguageCode(t)]),i||(i=e[this.getLanguagePartFromCode(t)]),i||(i=e.default),i||[]}toResolveHierarchy(e,t){const i=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),s=[],n=r=>{r&&(this.isSupportedCode(r)?s.push(r):this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`))};return p(e)&&(e.includes("-")||e.includes("_"))?(this.options.load!=="languageOnly"&&n(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&n(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&n(this.getLanguagePartFromCode(e))):p(e)&&n(this.formatLanguageCode(e)),i.forEach(r=>{s.includes(r)||n(this.formatLanguageCode(r))}),s}}const ce={zero:0,one:1,two:2,few:3,many:4,other:5},fe={select:o=>o===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Ee{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=N.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const i=M(e==="dev"?"en":e),s=t.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:i,type:s});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];let r;try{r=new Intl.PluralRules(i,{type:s})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),fe;if(!e.match(/-|_/))return fe;const u=this.languageUtils.getLanguagePartFromCode(e);r=this.getRule(u,t)}return this.pluralRulesCache[n]=r,r}needsPlural(e,t={}){let i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),(i==null?void 0:i.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,i={}){return this.getSuffixes(e,i).map(s=>`${t}${s}`)}getSuffixes(e,t={}){let i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),i?i.resolvedOptions().pluralCategories.sort((s,n)=>ce[s]-ce[n]).map(s=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(e,t,i={}){const s=this.getRule(e,i);return s?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${s.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,i))}}const he=(o,e,t,i=".",s=!0)=>{let n=Ce(o,e,t);return!n&&s&&p(t)&&(n=q(o,t,i),n===void 0&&(n=q(e,t,i))),n},Z=o=>o.replace(/\$/g,"$$$$");class de{constructor(e={}){var t;this.logger=N.create("interpolator"),this.options=e,this.format=((t=e==null?void 0:e.interpolation)==null?void 0:t.format)||(i=>i),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:i,useRawValueToEscape:s,prefix:n,prefixEscaped:r,suffix:a,suffixEscaped:u,formatSeparator:l,unescapeSuffix:c,unescapePrefix:f,nestingPrefix:d,nestingPrefixEscaped:g,nestingSuffix:h,nestingSuffixEscaped:m,nestingOptionsSeparator:y,maxReplaces:$,alwaysFormat:C}=e.interpolation;this.escape=t!==void 0?t:ve,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=n?k(n):r||"{{",this.suffix=a?k(a):u||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":f?k(f):"-",this.unescapeSuffix=this.unescapePrefix?"":c?k(c):"",this.nestingPrefix=d?k(d):g||k("$t("),this.nestingSuffix=h?k(h):m||k(")"),this.nestingOptionsSeparator=y||",",this.maxReplaces=$||1e3,this.alwaysFormat=C!==void 0?C:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,i)=>(t==null?void 0:t.source)===i?(t.lastIndex=0,t):new RegExp(i,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,i,s){var g;let n,r,a;const u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=h=>{if(!h.includes(this.formatSeparator)){const C=he(t,u,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(C,void 0,i,{...s,...t,interpolationkey:h}):C}const m=h.split(this.formatSeparator),y=m.shift().trim(),$=m.join(this.formatSeparator).trim();return this.format(he(t,u,y,this.options.keySeparator,this.options.ignoreJSONStructure),$,i,{...s,...t,interpolationkey:y})};this.resetRegExp(),!this.escapeValue&&typeof e=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const c=(s==null?void 0:s.missingInterpolationHandler)||this.options.missingInterpolationHandler,f=((g=s==null?void 0:s.interpolation)==null?void 0:g.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Z(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Z(this.escape(h)):Z(h)}].forEach(h=>{for(a=0;n=h.regex.exec(e);){const m=n[1].trim();if(r=l(m),r===void 0)if(typeof c=="function"){const $=c(e,n,s);r=p($)?$:""}else if(s&&Object.prototype.hasOwnProperty.call(s,m))r="";else if(f){r=n[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`),r="";else!p(r)&&!this.useRawValueToEscape&&(r=ne(r));const y=h.safeValue(r);if(e=e.replace(n[0],y),f?(h.regex.lastIndex+=r.length,h.regex.lastIndex-=n[0].length):h.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t,i={}){let s,n,r;const a=(u,l)=>{const c=this.nestingOptionsSeparator;if(!u.includes(c))return u;const f=u.split(new RegExp(`${k(c)}[ ]*{`));let d=`{${f[1]}`;u=f[0],d=this.interpolate(d,r);const g=d.match(/'/g),h=d.match(/"/g);(((g==null?void 0:g.length)??0)%2===0&&!h||((h==null?void 0:h.length)??0)%2!==0)&&(d=d.replace(/'/g,'"'));try{r=JSON.parse(d),l&&(r={...l,...r})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${u}`,m),`${u}${c}${d}`}return r.defaultValue&&r.defaultValue.includes(this.prefix)&&delete r.defaultValue,u};for(;s=this.nestingRegexp.exec(e);){let u=[];r={...i},r=r.replace&&!p(r.replace)?r.replace:r,r.applyPostProcessor=!1,delete r.defaultValue;const l=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(l!==-1&&(u=s[1].slice(l).split(this.formatSeparator).map(c=>c.trim()).filter(Boolean),s[1]=s[1].slice(0,l)),n=t(a.call(this,s[1].trim(),r),r),n&&s[0]===e&&!p(n))return n;p(n)||(n=ne(n)),n||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`),n=""),u.length&&(n=u.reduce((c,f)=>this.format(c,f,i.lng,{...i,interpolationkey:s[1].trim()}),n.trim())),e=e.replace(s[0],n),this.regexp.lastIndex=0}return e}}const Te=o=>{let e=o.toLowerCase().trim();const t={};if(o.includes("(")){const i=o.split("(");e=i[0].toLowerCase().trim();const s=i[1].slice(0,-1);e==="currency"&&!s.includes(":")?t.currency||(t.currency=s.trim()):e==="relativetime"&&!s.includes(":")?t.range||(t.range=s.trim()):s.split(";").forEach(r=>{if(r){const[a,...u]=r.split(":"),l=u.join(":").trim().replace(/^'+|'+$/g,""),c=a.trim();t[c]||(t[c]=l),l==="false"&&(t[c]=!1),l==="true"&&(t[c]=!0),isNaN(l)||(t[c]=parseInt(l,10))}})}return{formatName:e,formatOptions:t}},ge=o=>{const e={};return(t,i,s)=>{let n=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(n={...n,[s.interpolationkey]:void 0});const r=i+JSON.stringify(n);let a=e[r];return a||(a=o(M(i),s),e[r]=a),a(t)}},Ie=o=>(e,t,i)=>o(M(t),i)(e);class Ve{constructor(e={}){this.logger=N.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const i=t.cacheInBuiltFormats?ge:Ie;this.formats={number:i((s,n)=>{const r=new Intl.NumberFormat(s,{...n});return a=>r.format(a)}),currency:i((s,n)=>{const r=new Intl.NumberFormat(s,{...n,style:"currency"});return a=>r.format(a)}),datetime:i((s,n)=>{const r=new Intl.DateTimeFormat(s,{...n});return a=>r.format(a)}),relativetime:i((s,n)=>{const r=new Intl.RelativeTimeFormat(s,{...n});return a=>r.format(a,n.range||"day")}),list:i((s,n)=>{const r=new Intl.ListFormat(s,{...n});return a=>r.format(a)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=ge(t)}format(e,t,i,s={}){if(!t||e==null)return e;const n=t.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&!n[0].includes(")")&&n.find(a=>a.includes(")"))){const a=n.findIndex(u=>u.includes(")"));n[0]=[n[0],...n.splice(1,a)].join(this.formatSeparator)}return n.reduce((a,u)=>{var f;const{formatName:l,formatOptions:c}=Te(u);if(this.formats[l]){let d=a;try{const g=((f=s==null?void 0:s.formatParams)==null?void 0:f[s.interpolationkey])||{},h=g.locale||g.lng||s.locale||s.lng||i;d=this.formats[l](a,h,{...c,...s,...g})}catch(g){this.logger.warn(g)}return d}else this.logger.warn(`there was no format function for ${l}`);return a},e)}}const Ae=(o,e)=>{o.pending[e]!==void 0&&(delete o.pending[e],o.pendingCount--)};class De extends G{constructor(e,t,i,s={}){var n,r;super(),this.backend=e,this.store=t,this.services=i,this.languageUtils=i.languageUtils,this.options=s,this.logger=N.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],(r=(n=this.backend)==null?void 0:n.init)==null||r.call(n,i,s.backend,s)}queueLoad(e,t,i,s){const n={},r={},a={},u={};return e.forEach(l=>{let c=!0;t.forEach(f=>{const d=`${l}|${f}`;!i.reload&&this.store.hasResourceBundle(l,f)?this.state[d]=2:this.state[d]<0||(this.state[d]===1?r[d]===void 0&&(r[d]=!0):(this.state[d]=1,c=!1,r[d]===void 0&&(r[d]=!0),n[d]===void 0&&(n[d]=!0),u[f]===void 0&&(u[f]=!0)))}),c||(a[l]=!0)}),(Object.keys(n).length||Object.keys(r).length)&&this.queue.push({pending:r,pendingCount:Object.keys(r).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(n),pending:Object.keys(r),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(u)}}loaded(e,t,i){const s=e.split("|"),n=s[0],r=s[1];t&&this.emit("failedLoading",n,r,t),!t&&i&&this.store.addResourceBundle(n,r,i,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&i&&(this.state[e]=0);const a={};this.queue.forEach(u=>{we(u.loaded,[n],r),Ae(u,e),t&&u.errors.push(t),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(l=>{a[l]||(a[l]={});const c=u.loaded[l];c.length&&c.forEach(f=>{a[l][f]===void 0&&(a[l][f]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(u=>!u.done)}read(e,t,i,s=0,n=this.retryTimeout,r){if(!e.length)return r(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:i,tried:s,wait:n,callback:r});return}this.readingCalls++;const a=(l,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(l&&c&&s<this.maxRetries){setTimeout(()=>{this.read(e,t,i,s+1,n*2,r)},n);return}r(l,c)},u=this.backend[i].bind(this.backend);if(u.length===2){try{const l=u(e,t);l&&typeof l.then=="function"?l.then(c=>a(null,c)).catch(a):a(null,l)}catch(l){a(l)}return}return u(e,t,a)}prepareLoading(e,t,i={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();p(e)&&(e=this.languageUtils.toResolveHierarchy(e)),p(t)&&(t=[t]);const n=this.queueLoad(e,t,i,s);if(!n.toLoad.length)return n.pending.length||s(),null;n.toLoad.forEach(r=>{this.loadOne(r)})}load(e,t,i){this.prepareLoading(e,t,{},i)}reload(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}loadOne(e,t=""){const i=e.split("|"),s=i[0],n=i[1];this.read(s,n,"read",void 0,void 0,(r,a)=>{r&&this.logger.warn(`${t}loading namespace ${n} for language ${s} failed`,r),!r&&a&&this.logger.log(`${t}loaded namespace ${n} for language ${s}`,a),this.loaded(e,r,a)})}saveMissing(e,t,i,s,n,r={},a=()=>{}){var u,l,c,f,d;if((l=(u=this.services)==null?void 0:u.utils)!=null&&l.hasLoadedNamespace&&!((f=(c=this.services)==null?void 0:c.utils)!=null&&f.hasLoadedNamespace(t))){this.logger.warn(`did not save key "${i}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(i==null||i==="")){if((d=this.backend)!=null&&d.create){const g={...r,isUpdate:n},h=this.backend.create.bind(this.backend);if(h.length<6)try{let m;h.length===5?m=h(e,t,i,s,g):m=h(e,t,i,s),m&&typeof m.then=="function"?m.then(y=>a(null,y)).catch(a):a(null,m)}catch(m){a(m)}else h(e,t,i,s,a,g)}!e||!e[0]||this.store.addResource(e[0],t,i,s)}}}const X=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:o=>{let e={};if(typeof o[1]=="object"&&(e=o[1]),p(o[1])&&(e.defaultValue=o[1]),p(o[2])&&(e.tDescription=o[2]),typeof o[2]=="object"||typeof o[3]=="object"){const t=o[3]||o[2];Object.keys(t).forEach(i=>{e[i]=t[i]})}return e},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),pe=o=>(p(o.ns)&&(o.ns=[o.ns]),p(o.fallbackLng)&&(o.fallbackLng=[o.fallbackLng]),p(o.fallbackNS)&&(o.fallbackNS=[o.fallbackNS]),o.supportedLngs&&!o.supportedLngs.includes("cimode")&&(o.supportedLngs=o.supportedLngs.concat(["cimode"])),o),J=()=>{},Ke=o=>{Object.getOwnPropertyNames(Object.getPrototypeOf(o)).forEach(t=>{typeof o[t]=="function"&&(o[t]=o[t].bind(o))})};class H extends G{constructor(e={},t){if(super(),this.options=pe(e),this.services={},this.logger=N,this.modules={external:[]},Ke(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e=="function"&&(t=e,e={}),e.defaultNS==null&&e.ns&&(p(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));const i=X();this.options={...i,...this.options,...pe(e)},this.options.interpolation={...i.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=i.overloadTranslationOptionHandler);const s=l=>l?typeof l=="function"?new l:l:null;if(!this.options.isClone){this.modules.logger?N.init(s(this.modules.logger),this.options):N.init(null,this.options);let l;this.modules.formatter?l=this.modules.formatter:l=Ve;const c=new ue(this.options);this.store=new le(this.options.resources,this.options);const f=this.services;f.logger=N,f.resourceStore=this.store,f.languageUtils=c,f.pluralResolver=new Ee(c,{prepend:this.options.pluralSeparator}),l&&(f.formatter=s(l),f.formatter.init&&f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new de(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new De(s(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",(d,...g)=>{this.emit(d,...g)}),this.modules.languageDetector&&(f.languageDetector=s(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=s(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new _(this.services,this.options),this.translator.on("*",(d,...g)=>{this.emit(d,...g)}),this.modules.external.forEach(d=>{d.init&&d.init(this)})}if(this.format=this.options.interpolation.format,t||(t=J),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&l[0]!=="dev"&&(this.options.lng=l[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(l=>{this[l]=(...c)=>this.store[l](...c)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(l=>{this[l]=(...c)=>(this.store[l](...c),this)});const a=K(),u=()=>{const l=(c,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(f),t(c,f)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return l(null,this.t.bind(this));this.changeLanguage(this.options.lng,l)};return this.options.resources||!this.options.initAsync?u():setTimeout(u,0),a}loadResources(e,t=J){var n,r;let i=t;const s=p(e)?e:this.language;if(typeof e=="function"&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if((s==null?void 0:s.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const a=[],u=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(f=>{f!=="cimode"&&(a.includes(f)||a.push(f))})};s?u(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>u(c)),(r=(n=this.options.preload)==null?void 0:n.forEach)==null||r.call(n,l=>u(l)),this.services.backendConnector.load(a,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(l)})}else i(null)}reloadResources(e,t,i){const s=K();return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),i||(i=J),this.services.backendConnector.reload(e,t,n=>{s.resolve(),i(n)}),s}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&ye.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!["cimode","dev"].includes(e)){for(let t=0;t<this.languages.length;t++){const i=this.languages[t];if(!["cimode","dev"].includes(i)&&this.store.hasLanguageSomeTranslations(i)){this.resolvedLanguage=i;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const i=K();this.emit("languageChanging",e);const s=a=>{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},n=(a,u)=>{u?this.isLanguageChangingTo===e&&(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve((...l)=>this.t(...l)),t&&t(a,(...l)=>this.t(...l))},r=a=>{var c,f;!e&&!a&&this.services.languageDetector&&(a=[]);const u=p(a)?a:a&&a[0],l=this.store.hasLanguageSomeTranslations(u)?u:this.services.languageUtils.getBestMatchFromCodes(p(a)?[a]:a);l&&(this.language||s(l),this.translator.language||this.translator.changeLanguage(l),(f=(c=this.services.languageDetector)==null?void 0:c.cacheUserLanguage)==null||f.call(c,l)),this.loadResources(l,d=>{n(d,l)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?r(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(r):this.services.languageDetector.detect(r):r(e),i}getFixedT(e,t,i,s){const n=s==null?void 0:s.scopeNs,r=(a,u,...l)=>{let c;typeof u!="object"?c=this.options.overloadTranslationOptionHandler([a,u].concat(l)):c={...u},c.lng=c.lng||r.lng,c.lngs=c.lngs||r.lngs;const f=c.ns!==void 0&&c.ns!==null;c.ns=c.ns||r.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||i||r.keyPrefix);const d={...this.options,...c};Array.isArray(n)&&!f&&(d.ns=n),typeof c.keyPrefix=="function"&&(c.keyPrefix=I(c.keyPrefix,d));const g=this.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(a)?h=a.map(m=>(typeof m=="function"&&(m=I(m,d)),`${c.keyPrefix}${g}${m}`)):(typeof a=="function"&&(a=I(a,d)),h=c.keyPrefix?`${c.keyPrefix}${g}${a}`:a),this.t(h,c)};return p(e)?r.lng=e:r.lngs=e,r.ns=t,r.keyPrefix=i,r}t(...e){var t;return(t=this.translator)==null?void 0:t.translate(...e)}exists(...e){var t;return(t=this.translator)==null?void 0:t.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const i=t.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,n=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const r=(a,u)=>{const l=this.services.backendConnector.state[`${a}|${u}`];return l===-1||l===0||l===2};if(t.precheck){const a=t.precheck(this,r);if(a!==void 0)return a}return!!(this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||r(i,e)&&(!s||r(n,e)))}loadNamespaces(e,t){const i=K();return this.options.ns?(p(e)&&(e=[e]),e.forEach(s=>{this.options.ns.includes(s)||this.options.ns.push(s)}),this.loadResources(s=>{i.resolve(),t&&t(s)}),i):(t&&t(),Promise.resolve())}loadLanguages(e,t){const i=K();p(e)&&(e=[e]);const s=this.options.preload||[],n=e.filter(r=>!s.includes(r)&&this.services.languageUtils.isSupportedCode(r));return n.length?(this.options.preload=s.concat(n),this.loadResources(r=>{i.resolve(),t&&t(r)}),i):(t&&t(),Promise.resolve())}dir(e){var s,n;if(e||(e=this.resolvedLanguage||(((s=this.languages)==null?void 0:s.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const r=new Intl.Locale(e);if(r&&r.getTextInfo){const a=r.getTextInfo();if(a&&a.direction)return a.direction}}catch{}const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],i=((n=this.services)==null?void 0:n.languageUtils)||new ue(X());return e.toLowerCase().indexOf("-latn")>1?"ltr":t.includes(i.getLanguagePartFromCode(e))||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){const i=new H(e,t);return i.createInstance=H.createInstance,i}cloneInstance(e={},t=J){const i=e.forkResourceStore;i&&delete e.forkResourceStore;const s={...this.options,...e,isClone:!0},n=new H(s);if((e.debug!==void 0||e.prefix!==void 0)&&(n.logger=n.logger.clone(e)),["store","services","language"].forEach(a=>{n[a]=this[a]}),n.services={...this.services},n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},i){const a=Object.keys(this.store.data).reduce((u,l)=>(u[l]={...this.store.data[l]},u[l]=Object.keys(u[l]).reduce((c,f)=>(c[f]={...u[l][f]},c),u[l]),u),{});n.store=new le(a,s),n.services.resourceStore=n.store}if(e.interpolation){const u={...X().interpolation,...this.options.interpolation,...e.interpolation},l={...s,interpolation:u};n.services.interpolator=new de(l)}return n.translator=new _(n.services,s),n.translator.on("*",(a,...u)=>{n.emit(a,...u)}),n.init(s,t),n.translator.options=s,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const b=H.createInstance();b.createInstance;b.dir;b.init;b.loadResources;b.reloadResources;b.use;b.changeLanguage;b.getFixedT;b.t;b.exists;b.setDefaultNamespace;b.hasLoadedNamespace;b.loadNamespaces;b.loadLanguages;export{b as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var ye=e=>{throw TypeError(e)};var Vt=(e,t,s)=>t.has(e)||ye("Cannot "+s);var r=(e,t,s)=>(Vt(e,t,"read from private field"),s?s.call(e):t.get(e)),h=(e,t,s)=>t.has(e)?ye("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),o=(e,t,s,i)=>(Vt(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),p=(e,t,s)=>(Vt(e,t,"access private method"),s);var Gt=(e,t,s,i)=>({set _(n){o(e,t,n,s)},get _(){return r(e,t,i)}});import{r as H,j as Ve}from"./vendor-react-CHCXY0b5.js";var Lt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ht,Y,gt,Re,We=(Re=class extends Lt{constructor(){super();h(this,ht);h(this,Y);h(this,gt);o(this,gt,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){r(this,Y)||this.setEventListener(r(this,gt))}onUnsubscribe(){var t;this.hasListeners()||((t=r(this,Y))==null||t.call(this),o(this,Y,void 0))}setEventListener(t){var s;o(this,gt,t),(s=r(this,Y))==null||s.call(this),o(this,Y,t(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(t){r(this,ht)!==t&&(o(this,ht,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof r(this,ht)=="boolean"?r(this,ht):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ht=new WeakMap,Y=new WeakMap,gt=new WeakMap,Re),he=new We,$e={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},tt,ue,Fe,Je=(Fe=class{constructor(){h(this,tt,$e);h(this,ue,!1)}setTimeoutProvider(e){o(this,tt,e)}setTimeout(e,t){return r(this,tt).setTimeout(e,t)}clearTimeout(e){r(this,tt).clearTimeout(e)}setInterval(e,t){return r(this,tt).setInterval(e,t)}clearInterval(e){r(this,tt).clearInterval(e)}},tt=new WeakMap,ue=new WeakMap,Fe),ut=new Je;function Ze(e){setTimeout(e,0)}var Xe=typeof window>"u"||"Deno"in globalThis;function _(){}function Ye(e,t){return typeof e=="function"?e(t):e}function Wt(e){return typeof e=="number"&&e>=0&&e!==1/0}function je(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ot(e,t){return typeof e=="function"?e(t):e}function L(e,t){return typeof e=="function"?e(t):e}function pe(e,t){const{type:s="all",exact:i,fetchStatus:n,predicate:a,queryKey:c,stale:u}=e;if(c){if(i){if(t.queryHash!==ce(c,t.options))return!1}else if(!xt(t.queryKey,c))return!1}if(s!=="all"){const y=t.isActive();if(s==="active"&&!y||s==="inactive"&&y)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||n&&n!==t.state.fetchStatus||a&&!a(t))}function ve(e,t){const{exact:s,status:i,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(s){if(Dt(t.options.mutationKey)!==Dt(a))return!1}else if(!xt(t.options.mutationKey,a))return!1}return!(i&&t.state.status!==i||n&&!n(t))}function ce(e,t){return((t==null?void 0:t.queryKeyHashFn)||Dt)(e)}function Dt(e){return JSON.stringify(e,(t,s)=>Jt(s)?Object.keys(s).sort().reduce((i,n)=>(i[n]=s[n],i),{}):s)}function xt(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(s=>xt(e[s],t[s])):!1}var ts=Object.prototype.hasOwnProperty;function Ue(e,t,s=0){if(e===t)return e;if(s>500)return t;const i=me(e)&&me(t);if(!i&&!(Jt(e)&&Jt(t)))return t;const a=(i?e:Object.keys(e)).length,c=i?t:Object.keys(t),u=c.length,y=i?new Array(u):{};let F=0;for(let g=0;g<u;g++){const d=i?g:c[g],O=e[d],f=t[d];if(O===f){y[d]=O,(i?g<a:ts.call(e,d))&&F++;continue}if(O===null||f===null||typeof O!="object"||typeof f!="object"){y[d]=f;continue}const E=Ue(O,f,s+1);y[d]=E,E===O&&F++}return a===u&&F===a?e:y}function $t(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}function me(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Jt(e){if(!ge(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!ge(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ge(e){return Object.prototype.toString.call(e)==="[object Object]"}function es(e){return new Promise(t=>{ut.setTimeout(t,e)})}function Zt(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?Ue(e,t):t}function ss(e,t,s=0){const i=[...e,t];return s&&i.length>s?i.slice(1):i}function is(e,t,s=0){const i=[t,...e];return s&&i.length>s?i.slice(0,-1):i}var le=Symbol();function qe(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===le?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function _e(e,t){return typeof e=="function"?e(...t):!!e}function rs(e,t,s){let i=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??(n=t()),i||(i=!0,n.aborted?s():n.addEventListener("abort",s,{once:!0})),n)}),e}var At=(()=>{let e=()=>Xe;return{isServer(){return e()},setIsServer(t){e=t}}})();function Xt(){let e,t;const s=new Promise((n,a)=>{e=n,t=a});s.status="pending",s.catch(()=>{});function i(n){Object.assign(s,n),delete s.resolve,delete s.reject}return s.resolve=n=>{i({status:"fulfilled",value:n}),e(n)},s.reject=n=>{i({status:"rejected",reason:n}),t(n)},s}var ns=Ze;function as(){let e=[],t=0,s=u=>{u()},i=u=>{u()},n=ns;const a=u=>{t?e.push(u):n(()=>{s(u)})},c=()=>{const u=e;e=[],u.length&&n(()=>{i(()=>{u.forEach(y=>{s(y)})})})};return{batch:u=>{let y;t++;try{y=u()}finally{t--,t||c()}return y},batchCalls:u=>(...y)=>{a(()=>{u(...y)})},schedule:a,setNotifyFunction:u=>{s=u},setBatchNotifyFunction:u=>{i=u},setScheduler:u=>{n=u}}}var D=as(),bt,et,St,Ee,os=(Ee=class extends Lt{constructor(){super();h(this,bt,!0);h(this,et);h(this,St);o(this,St,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t(!0),i=()=>t(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",i)}}})}onSubscribe(){r(this,et)||this.setEventListener(r(this,St))}onUnsubscribe(){var t;this.hasListeners()||((t=r(this,et))==null||t.call(this),o(this,et,void 0))}setEventListener(t){var s;o(this,St,t),(s=r(this,et))==null||s.call(this),o(this,et,t(this.setOnline.bind(this)))}setOnline(t){r(this,bt)!==t&&(o(this,bt,t),this.listeners.forEach(i=>{i(t)}))}isOnline(){return r(this,bt)}},bt=new WeakMap,et=new WeakMap,St=new WeakMap,Ee),zt=new os;function us(e){return Math.min(1e3*2**e,3e4)}function ke(e){return(e??"online")==="online"?zt.isOnline():!0}var Yt=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Le(e){let t=!1,s=0,i;const n=Xt(),a=()=>n.status!=="pending",c=m=>{var S;if(!a()){const w=new Yt(m);O(w),(S=e.onCancel)==null||S.call(e,w)}},u=()=>{t=!0},y=()=>{t=!1},F=()=>he.isFocused()&&(e.networkMode==="always"||zt.isOnline())&&e.canRun(),g=()=>ke(e.networkMode)&&e.canRun(),d=m=>{a()||(i==null||i(),n.resolve(m))},O=m=>{a()||(i==null||i(),n.reject(m))},f=()=>new Promise(m=>{var S;i=w=>{(a()||F())&&m(w)},(S=e.onPause)==null||S.call(e)}).then(()=>{var m;i=void 0,a()||(m=e.onContinue)==null||m.call(e)}),E=()=>{if(a())return;let m;const S=s===0?e.initialPromise:void 0;try{m=S??e.fn()}catch(w){m=Promise.reject(w)}Promise.resolve(m).then(d).catch(w=>{var U;if(a())return;const Q=e.retry??(At.isServer()?0:3),P=e.retryDelay??us,l=typeof P=="function"?P(s,w):P,M=Q===!0||typeof Q=="number"&&s<Q||typeof Q=="function"&&Q(s,w);if(t||!M){O(w);return}s++,(U=e.onFail)==null||U.call(e,s,w),es(l).then(()=>F()?void 0:f()).then(()=>{t?O(w):E()})})};return{promise:n,status:()=>n.status,cancel:c,continue:()=>(i==null||i(),n),cancelRetry:u,continueRetry:y,canStart:g,start:()=>(g()?E():f().then(E),n)}}var ct,Qe,Ke=(Qe=class{constructor(){h(this,ct)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Wt(this.gcTime)&&o(this,ct,ut.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(At.isServer()?1/0:5*60*1e3))}clearGcTimeout(){r(this,ct)!==void 0&&(ut.clearTimeout(r(this,ct)),o(this,ct,void 0))}},ct=new WeakMap,Qe);function hs(e){return{onFetch:(t,s)=>{var g,d,O,f,E;const i=t.options,n=(O=(d=(g=t.fetchOptions)==null?void 0:g.meta)==null?void 0:d.fetchMore)==null?void 0:O.direction,a=((f=t.state.data)==null?void 0:f.pages)||[],c=((E=t.state.data)==null?void 0:E.pageParams)||[];let u={pages:[],pageParams:[]},y=0;const F=async()=>{let m=!1;const S=P=>{rs(P,()=>t.signal,()=>m=!0)},w=qe(t.options,t.fetchOptions),Q=async(P,l,M)=>{if(m)return Promise.reject(t.signal.reason);if(l==null&&P.pages.length)return Promise.resolve(P);const J=(()=>{const Z={client:t.client,queryKey:t.queryKey,pageParam:l,direction:M?"backward":"forward",meta:t.options.meta};return S(Z),Z})(),C=await w(J),{maxPages:I}=t.options,A=M?is:ss;return{pages:A(P.pages,C,I),pageParams:A(P.pageParams,l,I)}};if(n&&a.length){const P=n==="backward",l=P?cs:be,M={pages:a,pageParams:c},U=l(i,M);u=await Q(M,U,P)}else{const P=e??a.length;do{const l=y===0?c[0]??i.initialPageParam:be(i,u);if(y>0&&l==null)break;u=await Q(u,l),y++}while(y<P)}return u};t.options.persister?t.fetchFn=()=>{var m,S;return(S=(m=t.options).persister)==null?void 0:S.call(m,F,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=F}}}function be(e,{pages:t,pageParams:s}){const i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,s[i],s):void 0}function cs(e,{pages:t,pageParams:s}){var i;return t.length>0?(i=e.getPreviousPageParam)==null?void 0:i.call(e,t[0],t,s[0],s):void 0}var wt,lt,Ct,K,dt,T,jt,ft,k,He,V,Me,ls=(Me=class extends Ke{constructor(t){super();h(this,k);h(this,wt);h(this,lt);h(this,Ct);h(this,K);h(this,dt);h(this,T);h(this,jt);h(this,ft);o(this,ft,!1),o(this,jt,t.defaultOptions),this.setOptions(t.options),this.observers=[],o(this,dt,t.client),o(this,K,r(this,dt).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,o(this,lt,we(this.options)),this.state=t.state??r(this,lt),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return r(this,wt)}get promise(){var t;return(t=r(this,T))==null?void 0:t.promise}setOptions(t){if(this.options={...r(this,jt),...t},t!=null&&t._type&&o(this,wt,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=we(this.options);s.data!==void 0&&(this.setState(Se(s.data,s.dataUpdatedAt)),o(this,lt,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&r(this,K).remove(this)}setData(t,s){const i=Zt(this.state.data,t,this.options);return p(this,k,V).call(this,{data:i,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),i}setState(t){p(this,k,V).call(this,{type:"setState",state:t})}cancel(t){var i,n;const s=(i=r(this,T))==null?void 0:i.promise;return(n=r(this,T))==null||n.cancel(t),s?s.then(_).catch(_):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return r(this,lt)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>L(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===le||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ot(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!je(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(i=>i.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=r(this,T))==null||s.continue()}onOnline(){var s;const t=this.observers.find(i=>i.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=r(this,T))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),r(this,K).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(r(this,T)&&(r(this,ft)||p(this,k,He).call(this)?r(this,T).cancel({revert:!0}):r(this,T).cancelRetry()),this.scheduleGc()),r(this,K).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||p(this,k,V).call(this,{type:"invalidate"})}async fetch(t,s){var F,g,d,O,f,E,m,S,w,Q,P;if(this.state.fetchStatus!=="idle"&&((F=r(this,T))==null?void 0:F.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(r(this,T))return r(this,T).continueRetry(),r(this,T).promise}if(t&&this.setOptions(t),!this.options.queryFn){const l=this.observers.find(M=>M.options.queryFn);l&&this.setOptions(l.options)}const i=new AbortController,n=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(o(this,ft,!0),i.signal)})},a=()=>{const l=qe(this.options,s),U=(()=>{const J={client:r(this,dt),queryKey:this.queryKey,meta:this.meta};return n(J),J})();return o(this,ft,!1),this.options.persister?this.options.persister(l,U,this):l(U)},u=(()=>{const l={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:r(this,dt),state:this.state,fetchFn:a};return n(l),l})(),y=r(this,wt)==="infinite"?hs(this.options.pages):this.options.behavior;y==null||y.onFetch(u,this),o(this,Ct,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=u.fetchOptions)==null?void 0:g.meta))&&p(this,k,V).call(this,{type:"fetch",meta:(d=u.fetchOptions)==null?void 0:d.meta}),o(this,T,Le({initialPromise:s==null?void 0:s.initialPromise,fn:u.fetchFn,onCancel:l=>{l instanceof Yt&&l.revert&&this.setState({...r(this,Ct),fetchStatus:"idle"}),i.abort()},onFail:(l,M)=>{p(this,k,V).call(this,{type:"failed",failureCount:l,error:M})},onPause:()=>{p(this,k,V).call(this,{type:"pause"})},onContinue:()=>{p(this,k,V).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const l=await r(this,T).start();if(l===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(l),(f=(O=r(this,K).config).onSuccess)==null||f.call(O,l,this),(m=(E=r(this,K).config).onSettled)==null||m.call(E,l,this.state.error,this),l}catch(l){if(l instanceof Yt){if(l.silent)return r(this,T).promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw p(this,k,V).call(this,{type:"error",error:l}),(w=(S=r(this,K).config).onError)==null||w.call(S,l,this),(P=(Q=r(this,K).config).onSettled)==null||P.call(Q,this.state.data,l,this),l}finally{this.scheduleGc()}}},wt=new WeakMap,lt=new WeakMap,Ct=new WeakMap,K=new WeakMap,dt=new WeakMap,T=new WeakMap,jt=new WeakMap,ft=new WeakMap,k=new WeakSet,He=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},V=function(t){const s=i=>{switch(t.type){case"failed":return{...i,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...Ne(i.data,this.options),fetchMeta:t.meta??null};case"success":const n={...i,...Se(t.data,t.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return o(this,Ct,t.manual?n:void 0),n;case"error":const a=t.error;return{...i,error:a,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...t.state}}};this.state=s(this.state),D.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),r(this,K).notify({query:this,type:"updated",action:t})})},Me);function Ne(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ke(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Se(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function we(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,s=t!==void 0,i=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var q,v,Ut,j,yt,Ot,W,st,qt,Pt,Rt,pt,vt,it,Ft,b,Tt,te,ee,se,ie,re,ne,ae,Ge,Ie,ds=(Ie=class extends Lt{constructor(t,s){super();h(this,b);h(this,q);h(this,v);h(this,Ut);h(this,j);h(this,yt);h(this,Ot);h(this,W);h(this,st);h(this,qt);h(this,Pt);h(this,Rt);h(this,pt);h(this,vt);h(this,it);h(this,Ft,new Set);this.options=s,o(this,q,t),o(this,st,null),o(this,W,Xt()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(r(this,v).addObserver(this),Ce(r(this,v),this.options)?p(this,b,Tt).call(this):this.updateResult(),p(this,b,ie).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return oe(r(this,v),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return oe(r(this,v),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,p(this,b,re).call(this),p(this,b,ne).call(this),r(this,v).removeObserver(this)}setOptions(t){const s=this.options,i=r(this,v);if(this.options=r(this,q).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof L(this.options.enabled,r(this,v))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");p(this,b,ae).call(this),r(this,v).setOptions(this.options),s._defaulted&&!$t(this.options,s)&&r(this,q).getQueryCache().notify({type:"observerOptionsUpdated",query:r(this,v),observer:this});const n=this.hasListeners();n&&Oe(r(this,v),i,this.options,s)&&p(this,b,Tt).call(this),this.updateResult(),n&&(r(this,v)!==i||L(this.options.enabled,r(this,v))!==L(s.enabled,r(this,v))||ot(this.options.staleTime,r(this,v))!==ot(s.staleTime,r(this,v)))&&p(this,b,te).call(this);const a=p(this,b,ee).call(this);n&&(r(this,v)!==i||L(this.options.enabled,r(this,v))!==L(s.enabled,r(this,v))||a!==r(this,it))&&p(this,b,se).call(this,a)}getOptimisticResult(t){const s=r(this,q).getQueryCache().build(r(this,q),t),i=this.createResult(s,t);return ys(this,i)&&(o(this,j,i),o(this,Ot,this.options),o(this,yt,r(this,v).state)),i}getCurrentResult(){return r(this,j)}trackResult(t,s){return new Proxy(t,{get:(i,n)=>(this.trackProp(n),s==null||s(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&r(this,W).status==="pending"&&r(this,W).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,n))})}trackProp(t){r(this,Ft).add(t)}getCurrentQuery(){return r(this,v)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=r(this,q).defaultQueryOptions(t),i=r(this,q).getQueryCache().build(r(this,q),s);return i.fetch().then(()=>this.createResult(i,s))}fetch(t){return p(this,b,Tt).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),r(this,j)))}createResult(t,s){var I;const i=r(this,v),n=this.options,a=r(this,j),c=r(this,yt),u=r(this,Ot),F=t!==i?t.state:r(this,Ut),{state:g}=t;let d={...g},O=!1,f;if(s._optimisticResults){const A=this.hasListeners(),Z=!A&&Ce(t,s),Kt=A&&Oe(t,i,s,n);(Z||Kt)&&(d={...d,...Ne(g.data,t.options)}),s._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:E,errorUpdatedAt:m,status:S}=d;f=d.data;let w=!1;if(s.placeholderData!==void 0&&f===void 0&&S==="pending"){let A;a!=null&&a.isPlaceholderData&&s.placeholderData===(u==null?void 0:u.placeholderData)?(A=a.data,w=!0):A=typeof s.placeholderData=="function"?s.placeholderData((I=r(this,Rt))==null?void 0:I.state.data,r(this,Rt)):s.placeholderData,A!==void 0&&(S="success",f=Zt(a==null?void 0:a.data,A,s),O=!0)}if(s.select&&f!==void 0&&!w)if(a&&f===(c==null?void 0:c.data)&&s.select===r(this,qt))f=r(this,Pt);else try{o(this,qt,s.select),f=s.select(f),f=Zt(a==null?void 0:a.data,f,s),o(this,Pt,f),o(this,st,null)}catch(A){o(this,st,A)}r(this,st)&&(E=r(this,st),f=r(this,Pt),m=Date.now(),S="error");const Q=d.fetchStatus==="fetching",P=S==="pending",l=S==="error",M=P&&Q,U=f!==void 0,C={status:S,fetchStatus:d.fetchStatus,isPending:P,isSuccess:S==="success",isError:l,isInitialLoading:M,isLoading:M,data:f,dataUpdatedAt:d.dataUpdatedAt,error:E,errorUpdatedAt:m,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:d.dataUpdateCount>F.dataUpdateCount||d.errorUpdateCount>F.errorUpdateCount,isFetching:Q,isRefetching:Q&&!P,isLoadingError:l&&!U,isPaused:d.fetchStatus==="paused",isPlaceholderData:O,isRefetchError:l&&U,isStale:de(t,s),refetch:this.refetch,promise:r(this,W),isEnabled:L(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const A=C.data!==void 0,Z=C.status==="error"&&!A,Kt=Nt=>{Z?Nt.reject(C.error):A&&Nt.resolve(C.data)},fe=()=>{const Nt=o(this,W,C.promise=Xt());Kt(Nt)},Ht=r(this,W);switch(Ht.status){case"pending":t.queryHash===i.queryHash&&Kt(Ht);break;case"fulfilled":(Z||C.data!==Ht.value)&&fe();break;case"rejected":(!Z||C.error!==Ht.reason)&&fe();break}}return C}updateResult(){const t=r(this,j),s=this.createResult(r(this,v),this.options);if(o(this,yt,r(this,v).state),o(this,Ot,this.options),r(this,yt).data!==void 0&&o(this,Rt,r(this,v)),$t(s,t))return;o(this,j,s);const i=()=>{if(!t)return!0;const{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!r(this,Ft).size)return!0;const c=new Set(a??r(this,Ft));return this.options.throwOnError&&c.add("error"),Object.keys(r(this,j)).some(u=>{const y=u;return r(this,j)[y]!==t[y]&&c.has(y)})};p(this,b,Ge).call(this,{listeners:i()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&p(this,b,ie).call(this)}},q=new WeakMap,v=new WeakMap,Ut=new WeakMap,j=new WeakMap,yt=new WeakMap,Ot=new WeakMap,W=new WeakMap,st=new WeakMap,qt=new WeakMap,Pt=new WeakMap,Rt=new WeakMap,pt=new WeakMap,vt=new WeakMap,it=new WeakMap,Ft=new WeakMap,b=new WeakSet,Tt=function(t){p(this,b,ae).call(this);let s=r(this,v).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(_)),s},te=function(){p(this,b,re).call(this);const t=ot(this.options.staleTime,r(this,v));if(At.isServer()||r(this,j).isStale||!Wt(t))return;const i=je(r(this,j).dataUpdatedAt,t)+1;o(this,pt,ut.setTimeout(()=>{r(this,j).isStale||this.updateResult()},i))},ee=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(r(this,v)):this.options.refetchInterval)??!1},se=function(t){p(this,b,ne).call(this),o(this,it,t),!(At.isServer()||L(this.options.enabled,r(this,v))===!1||!Wt(r(this,it))||r(this,it)===0)&&o(this,vt,ut.setInterval(()=>{(this.options.refetchIntervalInBackground||he.isFocused())&&p(this,b,Tt).call(this)},r(this,it)))},ie=function(){p(this,b,te).call(this),p(this,b,se).call(this,p(this,b,ee).call(this))},re=function(){r(this,pt)!==void 0&&(ut.clearTimeout(r(this,pt)),o(this,pt,void 0))},ne=function(){r(this,vt)!==void 0&&(ut.clearInterval(r(this,vt)),o(this,vt,void 0))},ae=function(){const t=r(this,q).getQueryCache().build(r(this,q),this.options);if(t===r(this,v))return;const s=r(this,v);o(this,v,t),o(this,Ut,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},Ge=function(t){D.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(r(this,j))}),r(this,q).getQueryCache().notify({query:r(this,v),type:"observerResultsUpdated"})})},Ie);function fs(e,t){return L(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&L(t.retryOnMount,e)===!1)}function Ce(e,t){return fs(e,t)||e.state.data!==void 0&&oe(e,t,t.refetchOnMount)}function oe(e,t,s){if(L(t.enabled,e)!==!1&&ot(t.staleTime,e)!=="static"){const i=typeof s=="function"?s(e):s;return i==="always"||i!==!1&&de(e,t)}return!1}function Oe(e,t,s,i){return(e!==t||L(i.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&de(e,s)}function de(e,t){return L(t.enabled,e)!==!1&&e.isStaleByTime(ot(t.staleTime,e))}function ys(e,t){return!$t(e.getCurrentResult(),t)}var _t,G,x,mt,B,X,Te,ps=(Te=class extends Ke{constructor(t){super();h(this,B);h(this,_t);h(this,G);h(this,x);h(this,mt);o(this,_t,t.client),this.mutationId=t.mutationId,o(this,x,t.mutationCache),o(this,G,[]),this.state=t.state||vs(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){r(this,G).includes(t)||(r(this,G).push(t),this.clearGcTimeout(),r(this,x).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){o(this,G,r(this,G).filter(s=>s!==t)),this.scheduleGc(),r(this,x).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){r(this,G).length||(this.state.status==="pending"?this.scheduleGc():r(this,x).remove(this))}continue(){var t;return((t=r(this,mt))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,u,y,F,g,d,O,f,E,m,S,w,Q,P,l,M,U,J;const s=()=>{p(this,B,X).call(this,{type:"continue"})},i={client:r(this,_t),meta:this.options.meta,mutationKey:this.options.mutationKey};o(this,mt,Le({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(new Error("No mutationFn found")),onFail:(C,I)=>{p(this,B,X).call(this,{type:"failed",failureCount:C,error:I})},onPause:()=>{p(this,B,X).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>r(this,x).canRun(this)}));const n=this.state.status==="pending",a=!r(this,mt).canStart();try{if(n)s();else{p(this,B,X).call(this,{type:"pending",variables:t,isPaused:a}),r(this,x).config.onMutate&&await r(this,x).config.onMutate(t,this,i);const I=await((u=(c=this.options).onMutate)==null?void 0:u.call(c,t,i));I!==this.state.context&&p(this,B,X).call(this,{type:"pending",context:I,variables:t,isPaused:a})}const C=await r(this,mt).start();return await((F=(y=r(this,x).config).onSuccess)==null?void 0:F.call(y,C,t,this.state.context,this,i)),await((d=(g=this.options).onSuccess)==null?void 0:d.call(g,C,t,this.state.context,i)),await((f=(O=r(this,x).config).onSettled)==null?void 0:f.call(O,C,null,this.state.variables,this.state.context,this,i)),await((m=(E=this.options).onSettled)==null?void 0:m.call(E,C,null,t,this.state.context,i)),p(this,B,X).call(this,{type:"success",data:C}),C}catch(C){try{await((w=(S=r(this,x).config).onError)==null?void 0:w.call(S,C,t,this.state.context,this,i))}catch(I){Promise.reject(I)}try{await((P=(Q=this.options).onError)==null?void 0:P.call(Q,C,t,this.state.context,i))}catch(I){Promise.reject(I)}try{await((M=(l=r(this,x).config).onSettled)==null?void 0:M.call(l,void 0,C,this.state.variables,this.state.context,this,i))}catch(I){Promise.reject(I)}try{await((J=(U=this.options).onSettled)==null?void 0:J.call(U,void 0,C,t,this.state.context,i))}catch(I){Promise.reject(I)}throw p(this,B,X).call(this,{type:"error",error:C}),C}finally{r(this,x).runNext(this)}}},_t=new WeakMap,G=new WeakMap,x=new WeakMap,mt=new WeakMap,B=new WeakSet,X=function(t){const s=i=>{switch(t.type){case"failed":return{...i,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...i,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:t.error,failureCount:i.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=s(this.state),D.batch(()=>{r(this,G).forEach(i=>{i.onMutationUpdate(t)}),r(this,x).notify({mutation:this,type:"updated",action:t})})},Te);function vs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var $,N,kt,De,ms=(De=class extends Lt{constructor(t={}){super();h(this,$);h(this,N);h(this,kt);this.config=t,o(this,$,new Set),o(this,N,new Map),o(this,kt,0)}build(t,s,i){const n=new ps({client:t,mutationCache:this,mutationId:++Gt(this,kt)._,options:t.defaultMutationOptions(s),state:i});return this.add(n),n}add(t){r(this,$).add(t);const s=Bt(t);if(typeof s=="string"){const i=r(this,N).get(s);i?i.push(t):r(this,N).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(r(this,$).delete(t)){const s=Bt(t);if(typeof s=="string"){const i=r(this,N).get(s);if(i)if(i.length>1){const n=i.indexOf(t);n!==-1&&i.splice(n,1)}else i[0]===t&&r(this,N).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=Bt(t);if(typeof s=="string"){const i=r(this,N).get(s),n=i==null?void 0:i.find(a=>a.state.status==="pending");return!n||n===t}else return!0}runNext(t){var i;const s=Bt(t);if(typeof s=="string"){const n=(i=r(this,N).get(s))==null?void 0:i.find(a=>a!==t&&a.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){D.batch(()=>{r(this,$).forEach(t=>{this.notify({type:"removed",mutation:t})}),r(this,$).clear(),r(this,N).clear()})}getAll(){return Array.from(r(this,$))}find(t){const s={exact:!0,...t};return this.getAll().find(i=>ve(s,i))}findAll(t={}){return this.getAll().filter(s=>ve(t,s))}notify(t){D.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return D.batch(()=>Promise.all(t.map(s=>s.continue().catch(_))))}},$=new WeakMap,N=new WeakMap,kt=new WeakMap,De);function Bt(e){var t;return(t=e.options.scope)==null?void 0:t.id}var z,xe,gs=(xe=class extends Lt{constructor(t={}){super();h(this,z);this.config=t,o(this,z,new Map)}build(t,s,i){const n=s.queryKey,a=s.queryHash??ce(n,s);let c=this.get(a);return c||(c=new ls({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(s),state:i,defaultOptions:t.getQueryDefaults(n)}),this.add(c)),c}add(t){r(this,z).has(t.queryHash)||(r(this,z).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=r(this,z).get(t.queryHash);s&&(t.destroy(),s===t&&r(this,z).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){D.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return r(this,z).get(t)}getAll(){return[...r(this,z).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(i=>pe(s,i))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(i=>pe(t,i)):s}notify(t){D.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){D.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){D.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},z=new WeakMap,xe),R,rt,nt,Et,Qt,at,Mt,It,Ae,xs=(Ae=class{constructor(e={}){h(this,R);h(this,rt);h(this,nt);h(this,Et);h(this,Qt);h(this,at);h(this,Mt);h(this,It);o(this,R,e.queryCache||new gs),o(this,rt,e.mutationCache||new ms),o(this,nt,e.defaultOptions||{}),o(this,Et,new Map),o(this,Qt,new Map),o(this,at,0)}mount(){Gt(this,at)._++,r(this,at)===1&&(o(this,Mt,he.subscribe(async e=>{e&&(await this.resumePausedMutations(),r(this,R).onFocus())})),o(this,It,zt.subscribe(async e=>{e&&(await this.resumePausedMutations(),r(this,R).onOnline())})))}unmount(){var e,t;Gt(this,at)._--,r(this,at)===0&&((e=r(this,Mt))==null||e.call(this),o(this,Mt,void 0),(t=r(this,It))==null||t.call(this),o(this,It,void 0))}isFetching(e){return r(this,R).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return r(this,rt).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=r(this,R).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=r(this,R).build(this,t),i=s.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(ot(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return r(this,R).findAll(e).map(({queryKey:t,state:s})=>{const i=s.data;return[t,i]})}setQueryData(e,t,s){const i=this.defaultQueryOptions({queryKey:e}),n=r(this,R).get(i.queryHash),a=n==null?void 0:n.state.data,c=Ye(t,a);if(c!==void 0)return r(this,R).build(this,i).setData(c,{...s,manual:!0})}setQueriesData(e,t,s){return D.batch(()=>r(this,R).findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,t,s)]))}getQueryState(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=r(this,R).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=r(this,R);D.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=r(this,R);return D.batch(()=>(s.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},i=D.batch(()=>r(this,R).findAll(e).map(n=>n.cancel(s)));return Promise.all(i).then(_).catch(_)}invalidateQueries(e,t={}){return D.batch(()=>(r(this,R).findAll(e).forEach(s=>{s.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const s={...t,cancelRefetch:t.cancelRefetch??!0},i=D.batch(()=>r(this,R).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,s);return s.throwOnError||(a=a.catch(_)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(i).then(_)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=r(this,R).build(this,t);return s.isStaleByTime(ot(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_).catch(_)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_).catch(_)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return zt.isOnline()?r(this,rt).resumePausedMutations():Promise.resolve()}getQueryCache(){return r(this,R)}getMutationCache(){return r(this,rt)}getDefaultOptions(){return r(this,nt)}setDefaultOptions(e){o(this,nt,e)}setQueryDefaults(e,t){r(this,Et).set(Dt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...r(this,Et).values()],s={};return t.forEach(i=>{xt(e,i.queryKey)&&Object.assign(s,i.defaultOptions)}),s}setMutationDefaults(e,t){r(this,Qt).set(Dt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...r(this,Qt).values()],s={};return t.forEach(i=>{xt(e,i.mutationKey)&&Object.assign(s,i.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...r(this,nt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ce(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===le&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...r(this,nt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){r(this,R).clear(),r(this,rt).clear()}},R=new WeakMap,rt=new WeakMap,nt=new WeakMap,Et=new WeakMap,Qt=new WeakMap,at=new WeakMap,Mt=new WeakMap,It=new WeakMap,Ae),Be=H.createContext(void 0),bs=e=>{const t=H.useContext(Be);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},As=({client:e,children:t})=>(H.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),Ve.jsx(Be.Provider,{value:e,children:t})),ze=H.createContext(!1),Ss=()=>H.useContext(ze);ze.Provider;function ws(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Cs=H.createContext(ws()),Os=()=>H.useContext(Cs),Ps=(e,t,s)=>{const i=s!=null&&s.state.error&&typeof e.throwOnError=="function"?_e(e.throwOnError,[s.state.error,s]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||i)&&(t.isReset()||(e.retryOnMount=!1))},Rs=e=>{H.useEffect(()=>{e.clearReset()},[e])},Fs=({result:e,errorResetBoundary:t,throwOnError:s,query:i,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(n&&e.data===void 0||_e(s,[e.error,i])),Es=e=>{if(e.suspense){const s=n=>n==="static"?n:Math.max(n??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...n)=>s(i(...n)):s(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Qs=(e,t)=>e.isLoading&&e.isFetching&&!t,Ms=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Pe=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function Is(e,t,s){var f,E,m,S;const i=Ss(),n=Os(),a=bs(),c=a.defaultQueryOptions(e);(E=(f=a.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||E.call(f,c);const u=a.getQueryCache().get(c.queryHash),y=e.subscribed!==!1;c._optimisticResults=i?"isRestoring":y?"optimistic":void 0,Es(c),Ps(c,n,u),Rs(n);const F=!a.getQueryCache().get(c.queryHash),[g]=H.useState(()=>new t(a,c)),d=g.getOptimisticResult(c),O=!i&&y;if(H.useSyncExternalStore(H.useCallback(w=>{const Q=O?g.subscribe(D.batchCalls(w)):_;return g.updateResult(),Q},[g,O]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),H.useEffect(()=>{g.setOptions(c)},[c,g]),Ms(c,d))throw Pe(c,g,n);if(Fs({result:d,errorResetBoundary:n,throwOnError:c.throwOnError,query:u,suspense:c.suspense}))throw d.error;if((S=(m=a.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||S.call(m,c,d),c.experimental_prefetchInRender&&!At.isServer()&&Qs(d,i)){const w=F?Pe(c,g,n):u==null?void 0:u.promise;w==null||w.catch(_).finally(()=>{g.updateResult()})}return c.notifyOnChangeProps?d:g.trackResult(d)}function js(e,t){return Is(e,ds)}export{xs as Q,bs as a,As as b,js as u};
|