shopify-chatbot-widget 0.6.5 → 0.6.6

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.
@@ -321,7 +321,7 @@ You might need to use a local HTTP server (instead of file://): https://react.de
321
321
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...a){const r=new this(t);return a.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[YM]=this[YM]={accessors:{}}).accessors,o=this.prototype;function c(f){const m=Av(f);r[m]||(TV(o,f),r[m]=!0)}return Xe.isArray(t)?t.forEach(c):c(t),this}};go.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Xe.reduceDescriptors(go.prototype,({value:e},t)=>{let a=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[a]=r}}}),Xe.freezeMethods(go);function SE(e,t){const a=this||Rv,r=t||a,o=go.from(r.headers);let c=r.data;return Xe.forEach(e,function(m){c=m.call(a,c,o.normalize(),t?t.status:void 0)}),o.normalize(),c}function WM(e){return!!(e&&e.__CANCEL__)}function bm(e,t,a){Cn.call(this,e??"canceled",Cn.ERR_CANCELED,t,a),this.name="CanceledError"}Xe.inherits(bm,Cn,{__CANCEL__:!0});function ZM(e,t,a){const r=a.config.validateStatus;!a.status||!r||r(a.status)?e(a):t(new Cn("Request failed with status code "+a.status,[Cn.ERR_BAD_REQUEST,Cn.ERR_BAD_RESPONSE][Math.floor(a.status/100)-4],a.config,a.request,a))}function OV(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function RV(e,t){e=e||10;const a=new Array(e),r=new Array(e);let o=0,c=0,f;return t=t!==void 0?t:1e3,function(g){const p=Date.now(),y=r[c];f||(f=p),a[o]=g,r[o]=p;let S=c,E=0;for(;S!==o;)E+=a[S++],S=S%e;if(o=(o+1)%e,o===c&&(c=(c+1)%e),p-f<t)return;const T=y&&p-y;return T?Math.round(E*1e3/T):void 0}}function AV(e,t){let a=0,r=1e3/t,o,c;const f=(p,y=Date.now())=>{a=y,o=null,c&&(clearTimeout(c),c=null),e.apply(null,p)};return[(...p)=>{const y=Date.now(),S=y-a;S>=r?f(p,y):(o=p,c||(c=setTimeout(()=>{c=null,f(o)},r-S)))},()=>o&&f(o)]}const zS=(e,t,a=3)=>{let r=0;const o=RV(50,250);return AV(c=>{const f=c.loaded,m=c.lengthComputable?c.total:void 0,g=f-r,p=o(g),y=f<=m;r=f;const S={loaded:f,total:m,progress:m?f/m:void 0,bytes:g,rate:p||void 0,estimated:p&&m&&y?(m-f)/p:void 0,event:c,lengthComputable:m!=null,[t?"download":"upload"]:!0};e(S)},a)},KM=(e,t)=>{const a=e!=null;return[r=>t[0]({lengthComputable:a,total:e,loaded:r}),t[1]]},QM=e=>(...t)=>Xe.asap(()=>e(...t)),MV=yi.hasStandardBrowserEnv?((e,t)=>a=>(a=new URL(a,yi.origin),e.protocol===a.protocol&&e.host===a.host&&(t||e.port===a.port)))(new URL(yi.origin),yi.navigator&&/(msie|trident)/i.test(yi.navigator.userAgent)):()=>!0,_V=yi.hasStandardBrowserEnv?{write(e,t,a,r,o,c){const f=[e+"="+encodeURIComponent(t)];Xe.isNumber(a)&&f.push("expires="+new Date(a).toGMTString()),Xe.isString(r)&&f.push("path="+r),Xe.isString(o)&&f.push("domain="+o),c===!0&&f.push("secure"),document.cookie=f.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function DV(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function NV(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function JM(e,t,a){let r=!DV(t);return e&&(r||a==!1)?NV(e,t):t}const e_=e=>e instanceof go?{...e}:e;function Td(e,t){t=t||{};const a={};function r(p,y,S,E){return Xe.isPlainObject(p)&&Xe.isPlainObject(y)?Xe.merge.call({caseless:E},p,y):Xe.isPlainObject(y)?Xe.merge({},y):Xe.isArray(y)?y.slice():y}function o(p,y,S,E){if(Xe.isUndefined(y)){if(!Xe.isUndefined(p))return r(void 0,p,S,E)}else return r(p,y,S,E)}function c(p,y){if(!Xe.isUndefined(y))return r(void 0,y)}function f(p,y){if(Xe.isUndefined(y)){if(!Xe.isUndefined(p))return r(void 0,p)}else return r(void 0,y)}function m(p,y,S){if(S in t)return r(p,y);if(S in e)return r(void 0,p)}const g={url:c,method:c,data:c,baseURL:f,transformRequest:f,transformResponse:f,paramsSerializer:f,timeout:f,timeoutMessage:f,withCredentials:f,withXSRFToken:f,adapter:f,responseType:f,xsrfCookieName:f,xsrfHeaderName:f,onUploadProgress:f,onDownloadProgress:f,decompress:f,maxContentLength:f,maxBodyLength:f,beforeRedirect:f,transport:f,httpAgent:f,httpsAgent:f,cancelToken:f,socketPath:f,responseEncoding:f,validateStatus:m,headers:(p,y,S)=>o(e_(p),e_(y),S,!0)};return Xe.forEach(Object.keys(Object.assign({},e,t)),function(y){const S=g[y]||o,E=S(e[y],t[y],y);Xe.isUndefined(E)&&S!==m||(a[y]=E)}),a}const t_=e=>{const t=Td({},e);let{data:a,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:c,headers:f,auth:m}=t;t.headers=f=go.from(f),t.url=FM(JM(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),m&&f.set("Authorization","Basic "+btoa((m.username||"")+":"+(m.password?unescape(encodeURIComponent(m.password)):"")));let g;if(Xe.isFormData(a)){if(yi.hasStandardBrowserEnv||yi.hasStandardBrowserWebWorkerEnv)f.setContentType(void 0);else if((g=f.getContentType())!==!1){const[p,...y]=g?g.split(";").map(S=>S.trim()).filter(Boolean):[];f.setContentType([p||"multipart/form-data",...y].join("; "))}}if(yi.hasStandardBrowserEnv&&(r&&Xe.isFunction(r)&&(r=r(t)),r||r!==!1&&MV(t.url))){const p=o&&c&&_V.read(c);p&&f.set(o,p)}return t},$V=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(a,r){const o=t_(e);let c=o.data;const f=go.from(o.headers).normalize();let{responseType:m,onUploadProgress:g,onDownloadProgress:p}=o,y,S,E,T,O;function M(){T&&T(),O&&O(),o.cancelToken&&o.cancelToken.unsubscribe(y),o.signal&&o.signal.removeEventListener("abort",y)}let A=new XMLHttpRequest;A.open(o.method.toUpperCase(),o.url,!0),A.timeout=o.timeout;function D(){if(!A)return;const j=go.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),N={data:!m||m==="text"||m==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:j,config:e,request:A};ZM(function(H){a(H),M()},function(H){r(H),M()},N),A=null}"onloadend"in A?A.onloadend=D:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(D)},A.onabort=function(){A&&(r(new Cn("Request aborted",Cn.ECONNABORTED,e,A)),A=null)},A.onerror=function(){r(new Cn("Network Error",Cn.ERR_NETWORK,e,A)),A=null},A.ontimeout=function(){let V=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const N=o.transitional||GM;o.timeoutErrorMessage&&(V=o.timeoutErrorMessage),r(new Cn(V,N.clarifyTimeoutError?Cn.ETIMEDOUT:Cn.ECONNABORTED,e,A)),A=null},c===void 0&&f.setContentType(null),"setRequestHeader"in A&&Xe.forEach(f.toJSON(),function(V,N){A.setRequestHeader(N,V)}),Xe.isUndefined(o.withCredentials)||(A.withCredentials=!!o.withCredentials),m&&m!=="json"&&(A.responseType=o.responseType),p&&([E,O]=zS(p,!0),A.addEventListener("progress",E)),g&&A.upload&&([S,T]=zS(g),A.upload.addEventListener("progress",S),A.upload.addEventListener("loadend",T)),(o.cancelToken||o.signal)&&(y=j=>{A&&(r(!j||j.type?new bm(null,e,A):j),A.abort(),A=null)},o.cancelToken&&o.cancelToken.subscribe(y),o.signal&&(o.signal.aborted?y():o.signal.addEventListener("abort",y)));const _=OV(o.url);if(_&&yi.protocols.indexOf(_)===-1){r(new Cn("Unsupported protocol "+_+":",Cn.ERR_BAD_REQUEST,e));return}A.send(c||null)})},zV=(e,t)=>{const{length:a}=e=e?e.filter(Boolean):[];if(t||a){let r=new AbortController,o;const c=function(p){if(!o){o=!0,m();const y=p instanceof Error?p:this.reason;r.abort(y instanceof Cn?y:new bm(y instanceof Error?y.message:y))}};let f=t&&setTimeout(()=>{f=null,c(new Cn(`timeout ${t} of ms exceeded`,Cn.ETIMEDOUT))},t);const m=()=>{e&&(f&&clearTimeout(f),f=null,e.forEach(p=>{p.unsubscribe?p.unsubscribe(c):p.removeEventListener("abort",c)}),e=null)};e.forEach(p=>p.addEventListener("abort",c));const{signal:g}=r;return g.unsubscribe=()=>Xe.asap(m),g}},jV=function*(e,t){let a=e.byteLength;if(a<t){yield e;return}let r=0,o;for(;r<a;)o=r+t,yield e.slice(r,o),r=o},LV=async function*(e,t){for await(const a of VV(e))yield*jV(a,t)},VV=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:a,value:r}=await t.read();if(a)break;yield r}}finally{await t.cancel()}},n_=(e,t,a,r)=>{const o=LV(e,t);let c=0,f,m=g=>{f||(f=!0,r&&r(g))};return new ReadableStream({async pull(g){try{const{done:p,value:y}=await o.next();if(p){m(),g.close();return}let S=y.byteLength;if(a){let E=c+=S;a(E)}g.enqueue(new Uint8Array(y))}catch(p){throw m(p),p}},cancel(g){return m(g),o.return()}},{highWaterMark:2})},jS=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",a_=jS&&typeof ReadableStream=="function",HV=jS&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),r_=(e,...t)=>{try{return!!e(...t)}catch{return!1}},BV=a_&&r_(()=>{let e=!1;const t=new Request(yi.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),i_=64*1024,xE=a_&&r_(()=>Xe.isReadableStream(new Response("").body)),LS={stream:xE&&(e=>e.body)};jS&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!LS[t]&&(LS[t]=Xe.isFunction(e[t])?a=>a[t]():(a,r)=>{throw new Cn(`Response type '${t}' is not supported`,Cn.ERR_NOT_SUPPORT,r)})})})(new Response);const PV=async e=>{if(e==null)return 0;if(Xe.isBlob(e))return e.size;if(Xe.isSpecCompliantForm(e))return(await new Request(yi.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(Xe.isArrayBufferView(e)||Xe.isArrayBuffer(e))return e.byteLength;if(Xe.isURLSearchParams(e)&&(e=e+""),Xe.isString(e))return(await HV(e)).byteLength},UV=async(e,t)=>{const a=Xe.toFiniteNumber(e.getContentLength());return a??PV(t)},CE={http:sV,xhr:$V,fetch:jS&&(async e=>{let{url:t,method:a,data:r,signal:o,cancelToken:c,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:p,headers:y,withCredentials:S="same-origin",fetchOptions:E}=t_(e);p=p?(p+"").toLowerCase():"text";let T=zV([o,c&&c.toAbortSignal()],f),O;const M=T&&T.unsubscribe&&(()=>{T.unsubscribe()});let A;try{if(g&&BV&&a!=="get"&&a!=="head"&&(A=await UV(y,r))!==0){let N=new Request(t,{method:"POST",body:r,duplex:"half"}),L;if(Xe.isFormData(r)&&(L=N.headers.get("content-type"))&&y.setContentType(L),N.body){const[H,z]=KM(A,zS(QM(g)));r=n_(N.body,i_,H,z)}}Xe.isString(S)||(S=S?"include":"omit");const D="credentials"in Request.prototype;O=new Request(t,{...E,signal:T,method:a.toUpperCase(),headers:y.normalize().toJSON(),body:r,duplex:"half",credentials:D?S:void 0});let _=await fetch(O,E);const j=xE&&(p==="stream"||p==="response");if(xE&&(m||j&&M)){const N={};["status","statusText","headers"].forEach(U=>{N[U]=_[U]});const L=Xe.toFiniteNumber(_.headers.get("content-length")),[H,z]=m&&KM(L,zS(QM(m),!0))||[];_=new Response(n_(_.body,i_,H,()=>{z&&z(),M&&M()}),N)}p=p||"text";let V=await LS[Xe.findKey(LS,p)||"text"](_,e);return!j&&M&&M(),await new Promise((N,L)=>{ZM(N,L,{data:V,headers:go.from(_.headers),status:_.status,statusText:_.statusText,config:e,request:O})})}catch(D){throw M&&M(),D&&D.name==="TypeError"&&/Load failed|fetch/i.test(D.message)?Object.assign(new Cn("Network Error",Cn.ERR_NETWORK,e,O),{cause:D.cause||D}):Cn.from(D,D&&D.code,e,O)}})};Xe.forEach(CE,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const o_=e=>`- ${e}`,IV=e=>Xe.isFunction(e)||e===null||e===!1,l_={getAdapter:e=>{e=Xe.isArray(e)?e:[e];const{length:t}=e;let a,r;const o={};for(let c=0;c<t;c++){a=e[c];let f;if(r=a,!IV(a)&&(r=CE[(f=String(a)).toLowerCase()],r===void 0))throw new Cn(`Unknown adapter '${f}'`);if(r)break;o[f||"#"+c]=r}if(!r){const c=Object.entries(o).map(([m,g])=>`adapter ${m} `+(g===!1?"is not supported by the environment":"is not available in the build"));let f=t?c.length>1?`since :
322
322
  `+c.map(o_).join(`
323
323
  `):" "+o_(c[0]):"as no adapter specified";throw new Cn("There is no suitable adapter to dispatch the request "+f,"ERR_NOT_SUPPORT")}return r},adapters:CE};function EE(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new bm(null,e)}function s_(e){return EE(e),e.headers=go.from(e.headers),e.data=SE.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),l_.getAdapter(e.adapter||Rv.adapter)(e).then(function(r){return EE(e),r.data=SE.call(e,e.transformResponse,r),r.headers=go.from(r.headers),r},function(r){return WM(r)||(EE(e),r&&r.response&&(r.response.data=SE.call(e,e.transformResponse,r.response),r.response.headers=go.from(r.response.headers))),Promise.reject(r)})}const u_="1.10.0",VS={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{VS[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const c_={};VS.transitional=function(t,a,r){function o(c,f){return"[Axios v"+u_+"] Transitional option '"+c+"'"+f+(r?". "+r:"")}return(c,f,m)=>{if(t===!1)throw new Cn(o(f," has been removed"+(a?" in "+a:"")),Cn.ERR_DEPRECATED);return a&&!c_[f]&&(c_[f]=!0,console.warn(o(f," has been deprecated since v"+a+" and will be removed in the near future"))),t?t(c,f,m):!0}},VS.spelling=function(t){return(a,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function kV(e,t,a){if(typeof e!="object")throw new Cn("options must be an object",Cn.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const c=r[o],f=t[c];if(f){const m=e[c],g=m===void 0||f(m,c,e);if(g!==!0)throw new Cn("option "+c+" must be "+g,Cn.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new Cn("Unknown option "+c,Cn.ERR_BAD_OPTION)}}const HS={assertOptions:kV,validators:VS},Fs=HS.validators;let Od=class{constructor(t){this.defaults=t||{},this.interceptors={request:new qM,response:new qM}}async request(t,a){try{return await this._request(t,a)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const c=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?c&&!String(r.stack).endsWith(c.replace(/^.+\n.+\n/,""))&&(r.stack+=`
324
- `+c):r.stack=c}catch{}}throw r}}_request(t,a){typeof t=="string"?(a=a||{},a.url=t):a=t||{},a=Td(this.defaults,a);const{transitional:r,paramsSerializer:o,headers:c}=a;r!==void 0&&HS.assertOptions(r,{silentJSONParsing:Fs.transitional(Fs.boolean),forcedJSONParsing:Fs.transitional(Fs.boolean),clarifyTimeoutError:Fs.transitional(Fs.boolean)},!1),o!=null&&(Xe.isFunction(o)?a.paramsSerializer={serialize:o}:HS.assertOptions(o,{encode:Fs.function,serialize:Fs.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),HS.assertOptions(a,{baseUrl:Fs.spelling("baseURL"),withXsrfToken:Fs.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let f=c&&Xe.merge(c.common,c[a.method]);c&&Xe.forEach(["delete","get","head","post","put","patch","common"],O=>{delete c[O]}),a.headers=go.concat(f,c);const m=[];let g=!0;this.interceptors.request.forEach(function(M){typeof M.runWhen=="function"&&M.runWhen(a)===!1||(g=g&&M.synchronous,m.unshift(M.fulfilled,M.rejected))});const p=[];this.interceptors.response.forEach(function(M){p.push(M.fulfilled,M.rejected)});let y,S=0,E;if(!g){const O=[s_.bind(this),void 0];for(O.unshift.apply(O,m),O.push.apply(O,p),E=O.length,y=Promise.resolve(a);S<E;)y=y.then(O[S++],O[S++]);return y}E=m.length;let T=a;for(S=0;S<E;){const O=m[S++],M=m[S++];try{T=O(T)}catch(A){M.call(this,A);break}}try{y=s_.call(this,T)}catch(O){return Promise.reject(O)}for(S=0,E=p.length;S<E;)y=y.then(p[S++],p[S++]);return y}getUri(t){t=Td(this.defaults,t);const a=JM(t.baseURL,t.url,t.allowAbsoluteUrls);return FM(a,t.params,t.paramsSerializer)}};Xe.forEach(["delete","get","head","options"],function(t){Od.prototype[t]=function(a,r){return this.request(Td(r||{},{method:t,url:a,data:(r||{}).data}))}}),Xe.forEach(["post","put","patch"],function(t){function a(r){return function(c,f,m){return this.request(Td(m||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:f}))}}Od.prototype[t]=a(),Od.prototype[t+"Form"]=a(!0)});let FV=class u8{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(c){a=c});const r=this;this.promise.then(o=>{if(!r._listeners)return;let c=r._listeners.length;for(;c-- >0;)r._listeners[c](o);r._listeners=null}),this.promise.then=o=>{let c;const f=new Promise(m=>{r.subscribe(m),c=m}).then(o);return f.cancel=function(){r.unsubscribe(c)},f},t(function(c,f,m){r.reason||(r.reason=new bm(c,f,m),a(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const a=this._listeners.indexOf(t);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){const t=new AbortController,a=r=>{t.abort(r)};return this.subscribe(a),t.signal.unsubscribe=()=>this.unsubscribe(a),t.signal}static source(){let t;return{token:new u8(function(o){t=o}),cancel:t}}};function qV(e){return function(a){return e.apply(null,a)}}function GV(e){return Xe.isObject(e)&&e.isAxiosError===!0}const wE={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(wE).forEach(([e,t])=>{wE[t]=e});function f_(e){const t=new Od(e),a=MM(Od.prototype.request,t);return Xe.extend(a,Od.prototype,t,{allOwnKeys:!0}),Xe.extend(a,t,null,{allOwnKeys:!0}),a.create=function(o){return f_(Td(e,o))},a}const $a=f_(Rv);$a.Axios=Od,$a.CanceledError=bm,$a.CancelToken=FV,$a.isCancel=WM,$a.VERSION=u_,$a.toFormData=NS,$a.AxiosError=Cn,$a.Cancel=$a.CanceledError,$a.all=function(t){return Promise.all(t)},$a.spread=qV,$a.isAxiosError=GV,$a.mergeConfig=Td,$a.AxiosHeaders=go,$a.formToJSON=e=>XM(Xe.isHTMLForm(e)?new FormData(e):e),$a.getAdapter=l_.getAdapter,$a.HttpStatusCode=wE,$a.default=$a;const{Axios:Uie,AxiosError:Iie,CanceledError:kie,isCancel:Fie,CancelToken:qie,VERSION:Gie,all:Xie,Cancel:Yie,isAxiosError:Wie,spread:Zie,toFormData:Kie,AxiosHeaders:Qie,HttpStatusCode:Jie,formToJSON:eoe,getAdapter:toe,mergeConfig:noe}=$a,bi={apiUrl:"http://localhost:8000/api/",websocketUrl:"ws://localhost:8000/ws"},sn=e=>typeof e=="string",Mv=()=>{let e,t;const a=new Promise((r,o)=>{e=r,t=o});return a.resolve=e,a.reject=t,a},d_=e=>e==null?"":""+e,XV=(e,t,a)=>{e.forEach(r=>{t[r]&&(a[r]=t[r])})},YV=/###/g,h_=e=>e&&e.indexOf("###")>-1?e.replace(YV,"."):e,m_=e=>!e||sn(e),_v=(e,t,a)=>{const r=sn(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(m_(e))return{};const c=h_(r[o]);!e[c]&&a&&(e[c]=new a),Object.prototype.hasOwnProperty.call(e,c)?e=e[c]:e={},++o}return m_(e)?{}:{obj:e,k:h_(r[o])}},p_=(e,t,a)=>{const{obj:r,k:o}=_v(e,t,Object);if(r!==void 0||t.length===1){r[o]=a;return}let c=t[t.length-1],f=t.slice(0,t.length-1),m=_v(e,f,Object);for(;m.obj===void 0&&f.length;)c=`${f[f.length-1]}.${c}`,f=f.slice(0,f.length-1),m=_v(e,f,Object),m?.obj&&typeof m.obj[`${m.k}.${c}`]<"u"&&(m.obj=void 0);m.obj[`${m.k}.${c}`]=a},WV=(e,t,a,r)=>{const{obj:o,k:c}=_v(e,t,Object);o[c]=o[c]||[],o[c].push(a)},BS=(e,t)=>{const{obj:a,k:r}=_v(e,t);if(a&&Object.prototype.hasOwnProperty.call(a,r))return a[r]},ZV=(e,t,a)=>{const r=BS(e,a);return r!==void 0?r:BS(t,a)},g_=(e,t,a)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?sn(e[r])||e[r]instanceof String||sn(t[r])||t[r]instanceof String?a&&(e[r]=t[r]):g_(e[r],t[r],a):e[r]=t[r]);return e},Sm=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var KV={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const QV=e=>sn(e)?e.replace(/[&<>"'\/]/g,t=>KV[t]):e;class JV{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const a=this.regExpMap.get(t);if(a!==void 0)return a;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const eH=[" ",",","?","!",";"],tH=new JV(20),nH=(e,t,a)=>{t=t||"",a=a||"";const r=eH.filter(f=>t.indexOf(f)<0&&a.indexOf(f)<0);if(r.length===0)return!0;const o=tH.getRegExp(`(${r.map(f=>f==="?"?"\\?":f).join("|")})`);let c=!o.test(e);if(!c){const f=e.indexOf(a);f>0&&!o.test(e.substring(0,f))&&(c=!0)}return c},TE=(e,t,a=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(a);let o=e;for(let c=0;c<r.length;){if(!o||typeof o!="object")return;let f,m="";for(let g=c;g<r.length;++g)if(g!==c&&(m+=a),m+=r[g],f=o[m],f!==void 0){if(["string","number","boolean"].indexOf(typeof f)>-1&&g<r.length-1)continue;c+=g-c+1;break}o=f}return o},Dv=e=>e?.replace("_","-"),aH={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class PS{constructor(t,a={}){this.init(t,a)}init(t,a={}){this.prefix=a.prefix||"i18next:",this.logger=t||aH,this.options=a,this.debug=a.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,a,r,o){return o&&!this.debug?null:(sn(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[a](t))}create(t){return new PS(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new PS(this.logger,t)}}var qs=new PS;class US{constructor(){this.observers={}}on(t,a){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(a)||0;this.observers[r].set(a,o+1)}),this}off(t,a){if(this.observers[t]){if(!a){delete this.observers[t];return}this.observers[t].delete(a)}}emit(t,...a){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o(...a)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o.apply(o,[t,...a])})}}class v_ extends US{constructor(t,a={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const a=this.options.ns.indexOf(t);a>-1&&this.options.ns.splice(a,1)}getResource(t,a,r,o={}){const c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,f=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let m;t.indexOf(".")>-1?m=t.split("."):(m=[t,a],r&&(Array.isArray(r)?m.push(...r):sn(r)&&c?m.push(...r.split(c)):m.push(r)));const g=BS(this.data,m);return!g&&!a&&!r&&t.indexOf(".")>-1&&(t=m[0],a=m[1],r=m.slice(2).join(".")),g||!f||!sn(r)?g:TE(this.data?.[t]?.[a],r,c)}addResource(t,a,r,o,c={silent:!1}){const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator;let m=[t,a];r&&(m=m.concat(f?r.split(f):r)),t.indexOf(".")>-1&&(m=t.split("."),o=a,a=m[1]),this.addNamespaces(a),p_(this.data,m,o),c.silent||this.emit("added",t,a,r,o)}addResources(t,a,r,o={silent:!1}){for(const c in r)(sn(r[c])||Array.isArray(r[c]))&&this.addResource(t,a,c,r[c],{silent:!0});o.silent||this.emit("added",t,a,r)}addResourceBundle(t,a,r,o,c,f={silent:!1,skipCopy:!1}){let m=[t,a];t.indexOf(".")>-1&&(m=t.split("."),o=r,r=a,a=m[1]),this.addNamespaces(a);let g=BS(this.data,m)||{};f.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?g_(g,r,c):g={...g,...r},p_(this.data,m,g),f.silent||this.emit("added",t,a,r)}removeResourceBundle(t,a){this.hasResourceBundle(t,a)&&delete this.data[t][a],this.removeNamespaces(a),this.emit("removed",t,a)}hasResourceBundle(t,a){return this.getResource(t,a)!==void 0}getResourceBundle(t,a){return a||(a=this.options.defaultNS),this.getResource(t,a)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const a=this.getDataByLanguage(t);return!!(a&&Object.keys(a)||[]).find(o=>a[o]&&Object.keys(a[o]).length>0)}toJSON(){return this.data}}var y_={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,a,r,o){return e.forEach(c=>{t=this.processors[c]?.process(t,a,r,o)??t}),t}};const b_={},S_=e=>!sn(e)&&typeof e!="boolean"&&typeof e!="number";class IS extends US{constructor(t,a={}){super(),XV(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=qs.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,a={interpolation:{}}){const r={...a};return t==null?!1:this.resolve(t,r)?.res!==void 0}extractFromKey(t,a){let r=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let c=a.ns||this.options.defaultNS||[];const f=r&&t.indexOf(r)>-1,m=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!nH(t,r,o);if(f&&!m){const g=t.match(this.interpolator.nestingRegexp);if(g&&g.length>0)return{key:t,namespaces:sn(c)?[c]:c};const p=t.split(r);(r!==o||r===o&&this.options.ns.indexOf(p[0])>-1)&&(c=p.shift()),t=p.join(o)}return{key:t,namespaces:sn(c)?[c]:c}}translate(t,a,r){let o=typeof a=="object"?{...a}:a;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(o={...o}),o||(o={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const c=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,f=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:m,namespaces:g}=this.extractFromKey(t[t.length-1],o),p=g[g.length-1];let y=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;y===void 0&&(y=":");const S=o.lng||this.language,E=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(S?.toLowerCase()==="cimode")return E?c?{res:`${p}${y}${m}`,usedKey:m,exactUsedKey:m,usedLng:S,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:`${p}${y}${m}`:c?{res:m,usedKey:m,exactUsedKey:m,usedLng:S,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:m;const T=this.resolve(t,o);let O=T?.res;const M=T?.usedKey||m,A=T?.exactUsedKey||m,D=["[object Number]","[object Function]","[object RegExp]"],_=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,j=!this.i18nFormat||this.i18nFormat.handleAsObject,V=o.count!==void 0&&!sn(o.count),N=IS.hasDefaultValue(o),L=V?this.pluralResolver.getSuffix(S,o.count,o):"",H=o.ordinal&&V?this.pluralResolver.getSuffix(S,o.count,{ordinal:!1}):"",z=V&&!o.ordinal&&o.count===0,U=z&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${L}`]||o[`defaultValue${H}`]||o.defaultValue;let B=O;j&&!O&&N&&(B=U);const te=S_(B),Y=Object.prototype.toString.apply(B);if(j&&B&&te&&D.indexOf(Y)<0&&!(sn(_)&&Array.isArray(B))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Z=this.options.returnedObjectHandler?this.options.returnedObjectHandler(M,B,{...o,ns:g}):`key '${m} (${this.language})' returned an object instead of string.`;return c?(T.res=Z,T.usedParams=this.getUsedParamsDetails(o),T):Z}if(f){const Z=Array.isArray(B),W=Z?[]:{},ie=Z?A:M;for(const q in B)if(Object.prototype.hasOwnProperty.call(B,q)){const F=`${ie}${f}${q}`;N&&!O?W[q]=this.translate(F,{...o,defaultValue:S_(U)?U[q]:void 0,joinArrays:!1,ns:g}):W[q]=this.translate(F,{...o,joinArrays:!1,ns:g}),W[q]===F&&(W[q]=B[q])}O=W}}else if(j&&sn(_)&&Array.isArray(O))O=O.join(_),O&&(O=this.extendTranslation(O,t,o,r));else{let Z=!1,W=!1;!this.isValidLookup(O)&&N&&(Z=!0,O=U),this.isValidLookup(O)||(W=!0,O=m);const q=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&W?void 0:O,F=N&&U!==O&&this.options.updateMissing;if(W||Z||F){if(this.logger.log(F?"updateKey":"missingKey",S,p,m,F?U:O),f){const G=this.resolve(m,{...o,keySeparator:!1});G&&G.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 K=[];const se=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&se&&se[0])for(let G=0;G<se.length;G++)K.push(se[G]);else this.options.saveMissingTo==="all"?K=this.languageUtils.toResolveHierarchy(o.lng||this.language):K.push(o.lng||this.language);const k=(G,J,ne)=>{const oe=N&&ne!==O?ne:q;this.options.missingKeyHandler?this.options.missingKeyHandler(G,p,J,oe,F,o):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(G,p,J,oe,F,o),this.emit("missingKey",G,p,J,O)};this.options.saveMissing&&(this.options.saveMissingPlurals&&V?K.forEach(G=>{const J=this.pluralResolver.getSuffixes(G,o);z&&o[`defaultValue${this.options.pluralSeparator}zero`]&&J.indexOf(`${this.options.pluralSeparator}zero`)<0&&J.push(`${this.options.pluralSeparator}zero`),J.forEach(ne=>{k([G],m+ne,o[`defaultValue${ne}`]||U)})}):k(K,m,U))}O=this.extendTranslation(O,t,o,T,r),W&&O===m&&this.options.appendNamespaceToMissingKey&&(O=`${p}${y}${m}`),(W||Z)&&this.options.parseMissingKeyHandler&&(O=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${p}${y}${m}`:m,Z?O:void 0,o))}return c?(T.res=O,T.usedParams=this.getUsedParamsDetails(o),T):O}extendTranslation(t,a,r,o,c){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const g=sn(t)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(g){const S=t.match(this.interpolator.nestingRegexp);p=S&&S.length}let y=r.replace&&!sn(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(y={...this.options.interpolation.defaultVariables,...y}),t=this.interpolator.interpolate(t,y,r.lng||this.language||o.usedLng,r),g){const S=t.match(this.interpolator.nestingRegexp),E=S&&S.length;p<E&&(r.nest=!1)}!r.lng&&o&&o.res&&(r.lng=this.language||o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...S)=>c?.[0]===S[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${S[0]} in key: ${a[0]}`),null):this.translate(...S,a),r)),r.interpolation&&this.interpolator.reset()}const f=r.postProcess||this.options.postProcess,m=sn(f)?[f]:f;return t!=null&&m?.length&&r.applyPostProcessor!==!1&&(t=y_.handle(m,t,a,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,a={}){let r,o,c,f,m;return sn(t)&&(t=[t]),t.forEach(g=>{if(this.isValidLookup(r))return;const p=this.extractFromKey(g,a),y=p.key;o=y;let S=p.namespaces;this.options.fallbackNS&&(S=S.concat(this.options.fallbackNS));const E=a.count!==void 0&&!sn(a.count),T=E&&!a.ordinal&&a.count===0,O=a.context!==void 0&&(sn(a.context)||typeof a.context=="number")&&a.context!=="",M=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);S.forEach(A=>{this.isValidLookup(r)||(m=A,!b_[`${M[0]}-${A}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(m)&&(b_[`${M[0]}-${A}`]=!0,this.logger.warn(`key "${o}" for languages "${M.join(", ")}" won't get resolved as namespace "${m}" 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(D=>{if(this.isValidLookup(r))return;f=D;const _=[y];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(_,y,D,A,a);else{let V;E&&(V=this.pluralResolver.getSuffix(D,a.count,a));const N=`${this.options.pluralSeparator}zero`,L=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(E&&(_.push(y+V),a.ordinal&&V.indexOf(L)===0&&_.push(y+V.replace(L,this.options.pluralSeparator)),T&&_.push(y+N)),O){const H=`${y}${this.options.contextSeparator}${a.context}`;_.push(H),E&&(_.push(H+V),a.ordinal&&V.indexOf(L)===0&&_.push(H+V.replace(L,this.options.pluralSeparator)),T&&_.push(H+N))}}let j;for(;j=_.pop();)this.isValidLookup(r)||(c=j,r=this.getResource(D,A,j,a))}))})}),{res:r,usedKey:o,exactUsedKey:c,usedLng:f,usedNS:m}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,a,r,o={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,a,r,o):this.resourceStore.getResource(t,a,r,o)}getUsedParamsDetails(t={}){const a=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!sn(t.replace);let o=r?t.replace:t;if(r&&typeof t.count<"u"&&(o.count=t.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!r){o={...o};for(const c of a)delete o[c]}return o}static hasDefaultValue(t){const a="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&a===r.substring(0,a.length)&&t[r]!==void 0)return!0;return!1}}class x_{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=qs.create("languageUtils")}getScriptPartFromCode(t){if(t=Dv(t),!t||t.indexOf("-")<0)return null;const a=t.split("-");return a.length===2||(a.pop(),a[a.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(a.join("-"))}getLanguagePartFromCode(t){if(t=Dv(t),!t||t.indexOf("-")<0)return t;const a=t.split("-");return this.formatLanguageCode(a[0])}formatLanguageCode(t){if(sn(t)&&t.indexOf("-")>-1){let a;try{a=Intl.getCanonicalLocales(t)[0]}catch{}return a&&this.options.lowerCaseLng&&(a=a.toLowerCase()),a||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let a;return t.forEach(r=>{if(a)return;const o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(a=o)}),!a&&this.options.supportedLngs&&t.forEach(r=>{if(a)return;const o=this.getScriptPartFromCode(r);if(this.isSupportedCode(o))return a=o;const c=this.getLanguagePartFromCode(r);if(this.isSupportedCode(c))return a=c;a=this.options.supportedLngs.find(f=>{if(f===c)return f;if(!(f.indexOf("-")<0&&c.indexOf("-")<0)&&(f.indexOf("-")>0&&c.indexOf("-")<0&&f.substring(0,f.indexOf("-"))===c||f.indexOf(c)===0&&c.length>1))return f})}),a||(a=this.getFallbackCodes(this.options.fallbackLng)[0]),a}getFallbackCodes(t,a){if(!t)return[];if(typeof t=="function"&&(t=t(a)),sn(t)&&(t=[t]),Array.isArray(t))return t;if(!a)return t.default||[];let r=t[a];return r||(r=t[this.getScriptPartFromCode(a)]),r||(r=t[this.formatLanguageCode(a)]),r||(r=t[this.getLanguagePartFromCode(a)]),r||(r=t.default),r||[]}toResolveHierarchy(t,a){const r=this.getFallbackCodes((a===!1?[]:a)||this.options.fallbackLng||[],t),o=[],c=f=>{f&&(this.isSupportedCode(f)?o.push(f):this.logger.warn(`rejecting language code not found in supportedLngs: ${f}`))};return sn(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&c(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&c(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&c(this.getLanguagePartFromCode(t))):sn(t)&&c(this.formatLanguageCode(t)),r.forEach(f=>{o.indexOf(f)<0&&c(this.formatLanguageCode(f))}),o}}const C_={zero:0,one:1,two:2,few:3,many:4,other:5},E_={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class rH{constructor(t,a={}){this.languageUtils=t,this.options=a,this.logger=qs.create("pluralResolver"),this.pluralRulesCache={}}addRule(t,a){this.rules[t]=a}clearCache(){this.pluralRulesCache={}}getRule(t,a={}){const r=Dv(t==="dev"?"en":t),o=a.ordinal?"ordinal":"cardinal",c=JSON.stringify({cleanedCode:r,type:o});if(c in this.pluralRulesCache)return this.pluralRulesCache[c];let f;try{f=new Intl.PluralRules(r,{type:o})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),E_;if(!t.match(/-|_/))return E_;const g=this.languageUtils.getLanguagePartFromCode(t);f=this.getRule(g,a)}return this.pluralRulesCache[c]=f,f}needsPlural(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,a,r={}){return this.getSuffixes(t,r).map(o=>`${a}${o}`)}getSuffixes(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),r?r.resolvedOptions().pluralCategories.sort((o,c)=>C_[o]-C_[c]).map(o=>`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(t,a,r={}){const o=this.getRule(t,r);return o?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(a)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",a,r))}}const w_=(e,t,a,r=".",o=!0)=>{let c=ZV(e,t,a);return!c&&o&&sn(a)&&(c=TE(e,a,r),c===void 0&&(c=TE(t,a,r))),c},OE=e=>e.replace(/\$/g,"$$$$");class iH{constructor(t={}){this.logger=qs.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(a=>a),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:a,escapeValue:r,useRawValueToEscape:o,prefix:c,prefixEscaped:f,suffix:m,suffixEscaped:g,formatSeparator:p,unescapeSuffix:y,unescapePrefix:S,nestingPrefix:E,nestingPrefixEscaped:T,nestingSuffix:O,nestingSuffixEscaped:M,nestingOptionsSeparator:A,maxReplaces:D,alwaysFormat:_}=t.interpolation;this.escape=a!==void 0?a:QV,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=c?Sm(c):f||"{{",this.suffix=m?Sm(m):g||"}}",this.formatSeparator=p||",",this.unescapePrefix=y?"":S||"-",this.unescapeSuffix=this.unescapePrefix?"":y||"",this.nestingPrefix=E?Sm(E):T||Sm("$t("),this.nestingSuffix=O?Sm(O):M||Sm(")"),this.nestingOptionsSeparator=A||",",this.maxReplaces=D||1e3,this.alwaysFormat=_!==void 0?_:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(a,r)=>a?.source===r?(a.lastIndex=0,a):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,a,r,o){let c,f,m;const g=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=T=>{if(T.indexOf(this.formatSeparator)<0){const D=w_(a,g,T,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(D,void 0,r,{...o,...a,interpolationkey:T}):D}const O=T.split(this.formatSeparator),M=O.shift().trim(),A=O.join(this.formatSeparator).trim();return this.format(w_(a,g,M,this.options.keySeparator,this.options.ignoreJSONStructure),A,r,{...o,...a,interpolationkey:M})};this.resetRegExp();const y=o?.missingInterpolationHandler||this.options.missingInterpolationHandler,S=o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:T=>OE(T)},{regex:this.regexp,safeValue:T=>this.escapeValue?OE(this.escape(T)):OE(T)}].forEach(T=>{for(m=0;c=T.regex.exec(t);){const O=c[1].trim();if(f=p(O),f===void 0)if(typeof y=="function"){const A=y(t,c,o);f=sn(A)?A:""}else if(o&&Object.prototype.hasOwnProperty.call(o,O))f="";else if(S){f=c[0];continue}else this.logger.warn(`missed to pass in variable ${O} for interpolating ${t}`),f="";else!sn(f)&&!this.useRawValueToEscape&&(f=d_(f));const M=T.safeValue(f);if(t=t.replace(c[0],M),S?(T.regex.lastIndex+=f.length,T.regex.lastIndex-=c[0].length):T.regex.lastIndex=0,m++,m>=this.maxReplaces)break}}),t}nest(t,a,r={}){let o,c,f;const m=(g,p)=>{const y=this.nestingOptionsSeparator;if(g.indexOf(y)<0)return g;const S=g.split(new RegExp(`${y}[ ]*{`));let E=`{${S[1]}`;g=S[0],E=this.interpolate(E,f);const T=E.match(/'/g),O=E.match(/"/g);((T?.length??0)%2===0&&!O||O.length%2!==0)&&(E=E.replace(/'/g,'"'));try{f=JSON.parse(E),p&&(f={...p,...f})}catch(M){return this.logger.warn(`failed parsing options string in nesting for key ${g}`,M),`${g}${y}${E}`}return f.defaultValue&&f.defaultValue.indexOf(this.prefix)>-1&&delete f.defaultValue,g};for(;o=this.nestingRegexp.exec(t);){let g=[];f={...r},f=f.replace&&!sn(f.replace)?f.replace:f,f.applyPostProcessor=!1,delete f.defaultValue;const p=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(p!==-1&&(g=o[1].slice(p).split(this.formatSeparator).map(y=>y.trim()).filter(Boolean),o[1]=o[1].slice(0,p)),c=a(m.call(this,o[1].trim(),f),f),c&&o[0]===t&&!sn(c))return c;sn(c)||(c=d_(c)),c||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),c=""),g.length&&(c=g.reduce((y,S)=>this.format(y,S,r.lng,{...r,interpolationkey:o[1].trim()}),c.trim())),t=t.replace(o[0],c),this.regexp.lastIndex=0}return t}}const oH=e=>{let t=e.toLowerCase().trim();const a={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);t==="currency"&&o.indexOf(":")<0?a.currency||(a.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?a.range||(a.range=o.trim()):o.split(";").forEach(f=>{if(f){const[m,...g]=f.split(":"),p=g.join(":").trim().replace(/^'+|'+$/g,""),y=m.trim();a[y]||(a[y]=p),p==="false"&&(a[y]=!1),p==="true"&&(a[y]=!0),isNaN(p)||(a[y]=parseInt(p,10))}})}return{formatName:t,formatOptions:a}},T_=e=>{const t={};return(a,r,o)=>{let c=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(c={...c,[o.interpolationkey]:void 0});const f=r+JSON.stringify(c);let m=t[f];return m||(m=e(Dv(r),o),t[f]=m),m(a)}},lH=e=>(t,a,r)=>e(Dv(a),r)(t);class sH{constructor(t={}){this.logger=qs.create("formatter"),this.options=t,this.init(t)}init(t,a={interpolation:{}}){this.formatSeparator=a.interpolation.formatSeparator||",";const r=a.cacheInBuiltFormats?T_:lH;this.formats={number:r((o,c)=>{const f=new Intl.NumberFormat(o,{...c});return m=>f.format(m)}),currency:r((o,c)=>{const f=new Intl.NumberFormat(o,{...c,style:"currency"});return m=>f.format(m)}),datetime:r((o,c)=>{const f=new Intl.DateTimeFormat(o,{...c});return m=>f.format(m)}),relativetime:r((o,c)=>{const f=new Intl.RelativeTimeFormat(o,{...c});return m=>f.format(m,c.range||"day")}),list:r((o,c)=>{const f=new Intl.ListFormat(o,{...c});return m=>f.format(m)})}}add(t,a){this.formats[t.toLowerCase().trim()]=a}addCached(t,a){this.formats[t.toLowerCase().trim()]=T_(a)}format(t,a,r,o={}){const c=a.split(this.formatSeparator);if(c.length>1&&c[0].indexOf("(")>1&&c[0].indexOf(")")<0&&c.find(m=>m.indexOf(")")>-1)){const m=c.findIndex(g=>g.indexOf(")")>-1);c[0]=[c[0],...c.splice(1,m)].join(this.formatSeparator)}return c.reduce((m,g)=>{const{formatName:p,formatOptions:y}=oH(g);if(this.formats[p]){let S=m;try{const E=o?.formatParams?.[o.interpolationkey]||{},T=E.locale||E.lng||o.locale||o.lng||r;S=this.formats[p](m,T,{...y,...o,...E})}catch(E){this.logger.warn(E)}return S}else this.logger.warn(`there was no format function for ${p}`);return m},t)}}const uH=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class cH extends US{constructor(t,a,r,o={}){super(),this.backend=t,this.store=a,this.services=r,this.languageUtils=r.languageUtils,this.options=o,this.logger=qs.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,o.backend,o)}queueLoad(t,a,r,o){const c={},f={},m={},g={};return t.forEach(p=>{let y=!0;a.forEach(S=>{const E=`${p}|${S}`;!r.reload&&this.store.hasResourceBundle(p,S)?this.state[E]=2:this.state[E]<0||(this.state[E]===1?f[E]===void 0&&(f[E]=!0):(this.state[E]=1,y=!1,f[E]===void 0&&(f[E]=!0),c[E]===void 0&&(c[E]=!0),g[S]===void 0&&(g[S]=!0)))}),y||(m[p]=!0)}),(Object.keys(c).length||Object.keys(f).length)&&this.queue.push({pending:f,pendingCount:Object.keys(f).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(c),pending:Object.keys(f),toLoadLanguages:Object.keys(m),toLoadNamespaces:Object.keys(g)}}loaded(t,a,r){const o=t.split("|"),c=o[0],f=o[1];a&&this.emit("failedLoading",c,f,a),!a&&r&&this.store.addResourceBundle(c,f,r,void 0,void 0,{skipCopy:!0}),this.state[t]=a?-1:2,a&&r&&(this.state[t]=0);const m={};this.queue.forEach(g=>{WV(g.loaded,[c],f),uH(g,t),a&&g.errors.push(a),g.pendingCount===0&&!g.done&&(Object.keys(g.loaded).forEach(p=>{m[p]||(m[p]={});const y=g.loaded[p];y.length&&y.forEach(S=>{m[p][S]===void 0&&(m[p][S]=!0)})}),g.done=!0,g.errors.length?g.callback(g.errors):g.callback())}),this.emit("loaded",m),this.queue=this.queue.filter(g=>!g.done)}read(t,a,r,o=0,c=this.retryTimeout,f){if(!t.length)return f(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:a,fcName:r,tried:o,wait:c,callback:f});return}this.readingCalls++;const m=(p,y)=>{if(this.readingCalls--,this.waitingReads.length>0){const S=this.waitingReads.shift();this.read(S.lng,S.ns,S.fcName,S.tried,S.wait,S.callback)}if(p&&y&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,a,r,o+1,c*2,f)},c);return}f(p,y)},g=this.backend[r].bind(this.backend);if(g.length===2){try{const p=g(t,a);p&&typeof p.then=="function"?p.then(y=>m(null,y)).catch(m):m(null,p)}catch(p){m(p)}return}return g(t,a,m)}prepareLoading(t,a,r={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();sn(t)&&(t=this.languageUtils.toResolveHierarchy(t)),sn(a)&&(a=[a]);const c=this.queueLoad(t,a,r,o);if(!c.toLoad.length)return c.pending.length||o(),null;c.toLoad.forEach(f=>{this.loadOne(f)})}load(t,a,r){this.prepareLoading(t,a,{},r)}reload(t,a,r){this.prepareLoading(t,a,{reload:!0},r)}loadOne(t,a=""){const r=t.split("|"),o=r[0],c=r[1];this.read(o,c,"read",void 0,void 0,(f,m)=>{f&&this.logger.warn(`${a}loading namespace ${c} for language ${o} failed`,f),!f&&m&&this.logger.log(`${a}loaded namespace ${c} for language ${o}`,m),this.loaded(t,f,m)})}saveMissing(t,a,r,o,c,f={},m=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(a)){this.logger.warn(`did not save key "${r}" as the 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!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const g={...f,isUpdate:c},p=this.backend.create.bind(this.backend);if(p.length<6)try{let y;p.length===5?y=p(t,a,r,o,g):y=p(t,a,r,o),y&&typeof y.then=="function"?y.then(S=>m(null,S)).catch(m):m(null,y)}catch(y){m(y)}else p(t,a,r,o,m,g)}!t||!t[0]||this.store.addResource(t[0],a,r,o)}}}const O_=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),sn(e[1])&&(t.defaultValue=e[1]),sn(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const a=e[3]||e[2];Object.keys(a).forEach(r=>{t[r]=a[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),R_=e=>(sn(e.ns)&&(e.ns=[e.ns]),sn(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),sn(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),kS=()=>{},fH=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(a=>{typeof e[a]=="function"&&(e[a]=e[a].bind(e))})};class Nv extends US{constructor(t={},a){if(super(),this.options=R_(t),this.services={},this.logger=qs,this.modules={external:[]},fH(this),a&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,a),this;setTimeout(()=>{this.init(t,a)},0)}}init(t={},a){this.isInitializing=!0,typeof t=="function"&&(a=t,t={}),t.defaultNS==null&&t.ns&&(sn(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=O_();this.options={...r,...this.options,...R_(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const o=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?qs.init(o(this.modules.logger),this.options):qs.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=sH;const y=new x_(this.options);this.store=new v_(this.options.resources,this.options);const S=this.services;S.logger=qs,S.resourceStore=this.store,S.languageUtils=y,S.pluralResolver=new rH(y,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.warn("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),p&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(S.formatter=o(p),S.formatter.init&&S.formatter.init(S,this.options),this.options.interpolation.format=S.formatter.format.bind(S.formatter)),S.interpolator=new iH(this.options),S.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},S.backendConnector=new cH(o(this.modules.backend),S.resourceStore,S,this.options),S.backendConnector.on("*",(T,...O)=>{this.emit(T,...O)}),this.modules.languageDetector&&(S.languageDetector=o(this.modules.languageDetector),S.languageDetector.init&&S.languageDetector.init(S,this.options.detection,this.options)),this.modules.i18nFormat&&(S.i18nFormat=o(this.modules.i18nFormat),S.i18nFormat.init&&S.i18nFormat.init(this)),this.translator=new IS(this.services,this.options),this.translator.on("*",(T,...O)=>{this.emit(T,...O)}),this.modules.external.forEach(T=>{T.init&&T.init(this)})}if(this.format=this.options.interpolation.format,a||(a=kS),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[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(p=>{this[p]=(...y)=>this.store[p](...y)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=(...y)=>(this.store[p](...y),this)});const m=Mv(),g=()=>{const p=(y,S)=>{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),m.resolve(S),a(y,S)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?g():setTimeout(g,0),m}loadResources(t,a=kS){let r=a;const o=sn(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(o?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const c=[],f=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(p=>{p!=="cimode"&&c.indexOf(p)<0&&c.push(p)})};o?f(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(g=>f(g)),this.options.preload?.forEach?.(m=>f(m)),this.services.backendConnector.load(c,this.options.ns,m=>{!m&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(m)})}else r(null)}reloadResources(t,a,r){const o=Mv();return typeof t=="function"&&(r=t,t=void 0),typeof a=="function"&&(r=a,a=void 0),t||(t=this.languages),a||(a=this.options.ns),r||(r=kS),this.services.backendConnector.reload(t,a,c=>{o.resolve(),r(c)}),o}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&y_.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let a=0;a<this.languages.length;a++){const r=this.languages[a];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,a){this.isLanguageChangingTo=t;const r=Mv();this.emit("languageChanging",t);const o=m=>{this.language=m,this.languages=this.services.languageUtils.toResolveHierarchy(m),this.resolvedLanguage=void 0,this.setResolvedLanguage(m)},c=(m,g)=>{g?this.isLanguageChangingTo===t&&(o(g),this.translator.changeLanguage(g),this.isLanguageChangingTo=void 0,this.emit("languageChanged",g),this.logger.log("languageChanged",g)):this.isLanguageChangingTo=void 0,r.resolve((...p)=>this.t(...p)),a&&a(m,(...p)=>this.t(...p))},f=m=>{!t&&!m&&this.services.languageDetector&&(m=[]);const g=sn(m)?m:m&&m[0],p=this.store.hasLanguageSomeTranslations(g)?g:this.services.languageUtils.getBestMatchFromCodes(sn(m)?[m]:m);p&&(this.language||o(p),this.translator.language||this.translator.changeLanguage(p),this.services.languageDetector?.cacheUserLanguage?.(p)),this.loadResources(p,y=>{c(y,p)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?f(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(f):this.services.languageDetector.detect(f):f(t),r}getFixedT(t,a,r){const o=(c,f,...m)=>{let g;typeof f!="object"?g=this.options.overloadTranslationOptionHandler([c,f].concat(m)):g={...f},g.lng=g.lng||o.lng,g.lngs=g.lngs||o.lngs,g.ns=g.ns||o.ns,g.keyPrefix!==""&&(g.keyPrefix=g.keyPrefix||r||o.keyPrefix);const p=this.options.keySeparator||".";let y;return g.keyPrefix&&Array.isArray(c)?y=c.map(S=>`${g.keyPrefix}${p}${S}`):y=g.keyPrefix?`${g.keyPrefix}${p}${c}`:c,this.t(y,g)};return sn(t)?o.lng=t:o.lngs=t,o.ns=a,o.keyPrefix=r,o}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,a={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=a.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const f=(m,g)=>{const p=this.services.backendConnector.state[`${m}|${g}`];return p===-1||p===0||p===2};if(a.precheck){const m=a.precheck(this,f);if(m!==void 0)return m}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||f(r,t)&&(!o||f(c,t)))}loadNamespaces(t,a){const r=Mv();return this.options.ns?(sn(t)&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),a&&a(o)}),r):(a&&a(),Promise.resolve())}loadLanguages(t,a){const r=Mv();sn(t)&&(t=[t]);const o=this.options.preload||[],c=t.filter(f=>o.indexOf(f)<0&&this.services.languageUtils.isSupportedCode(f));return c.length?(this.options.preload=o.concat(c),this.loadResources(f=>{r.resolve(),a&&a(f)}),r):(a&&a(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const o=new Intl.Locale(t);if(o&&o.getTextInfo){const c=o.getTextInfo();if(c&&c.direction)return c.direction}}catch{}const a=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new x_(O_());return t.toLowerCase().indexOf("-latn")>1?"ltr":a.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},a){return new Nv(t,a)}cloneInstance(t={},a=kS){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},c=new Nv(o);if((t.debug!==void 0||t.prefix!==void 0)&&(c.logger=c.logger.clone(t)),["store","services","language"].forEach(m=>{c[m]=this[m]}),c.services={...this.services},c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},r){const m=Object.keys(this.store.data).reduce((g,p)=>(g[p]={...this.store.data[p]},g[p]=Object.keys(g[p]).reduce((y,S)=>(y[S]={...g[p][S]},y),g[p]),g),{});c.store=new v_(m,o),c.services.resourceStore=c.store}return c.translator=new IS(c.services,o),c.translator.on("*",(m,...g)=>{c.emit(m,...g)}),c.init(o,a),c.translator.options=o,c.translator.backendConnector.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Wr=Nv.createInstance();Wr.createInstance=Nv.createInstance,Wr.createInstance,Wr.dir,Wr.init,Wr.loadResources,Wr.reloadResources,Wr.use,Wr.changeLanguage,Wr.getFixedT,Wr.t,Wr.exists,Wr.setDefaultNamespace,Wr.hasLoadedNamespace,Wr.loadNamespaces,Wr.loadLanguages;const dH=(e,t,a,r)=>{const o=[a,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(o,"warn","react-i18next::",!0);Rd(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...o):console?.warn&&console.warn(...o)},A_={},RE=(e,t,a,r)=>{Rd(a)&&A_[a]||(Rd(a)&&(A_[a]=new Date),dH(e,t,a,r))},M_=(e,t)=>()=>{if(e.isInitialized)t();else{const a=()=>{setTimeout(()=>{e.off("initialized",a)},0),t()};e.on("initialized",a)}},AE=(e,t,a)=>{e.loadNamespaces(t,M_(e,a))},__=(e,t,a,r)=>{if(Rd(a)&&(a=[a]),e.options.preload&&e.options.preload.indexOf(t)>-1)return AE(e,a,r);a.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,M_(e,r))},hH=(e,t,a={})=>!t.languages||!t.languages.length?(RE(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:a.lng,precheck:(r,o)=>{if(a.bindI18n?.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!o(r.isLanguageChangingTo,e))return!1}}),Rd=e=>typeof e=="string",mH=e=>typeof e=="object"&&e!==null,pH=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,gH={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},vH=e=>gH[e];let ME={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(pH,vH)};const yH=(e={})=>{ME={...ME,...e}},bH=()=>ME;let D_;const SH=e=>{D_=e},xH=()=>D_,CH={type:"3rdParty",init(e){yH(e.options.react),SH(e)}},EH=x.createContext();class wH{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(a=>{this.usedNamespaces[a]||(this.usedNamespaces[a]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const TH=(e,t)=>{const a=x.useRef();return x.useEffect(()=>{a.current=e},[e,t]),a.current},N_=(e,t,a,r)=>e.getFixedT(t,a,r),OH=(e,t,a,r)=>x.useCallback(N_(e,t,a,r),[e,t,a,r]),RH=(e,t={})=>{const{i18n:a}=t,{i18n:r,defaultNS:o}=x.useContext(EH)||{},c=a||r||xH();if(c&&!c.reportNamespaces&&(c.reportNamespaces=new wH),!c){RE(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const V=(L,H)=>Rd(H)?H:mH(H)&&Rd(H.defaultValue)?H.defaultValue:Array.isArray(L)?L[L.length-1]:L,N=[V,{},!1];return N.t=V,N.i18n={},N.ready=!1,N}c.options.react?.wait&&RE(c,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const f={...bH(),...c.options.react,...t},{useSuspense:m,keyPrefix:g}=f;let p=o||c.options?.defaultNS;p=Rd(p)?[p]:p||["translation"],c.reportNamespaces.addUsedNamespaces?.(p);const y=(c.isInitialized||c.initializedStoreOnce)&&p.every(V=>hH(V,c,f)),S=OH(c,t.lng||null,f.nsMode==="fallback"?p:p[0],g),E=()=>S,T=()=>N_(c,t.lng||null,f.nsMode==="fallback"?p:p[0],g),[O,M]=x.useState(E);let A=p.join();t.lng&&(A=`${t.lng}${A}`);const D=TH(A),_=x.useRef(!0);x.useEffect(()=>{const{bindI18n:V,bindI18nStore:N}=f;_.current=!0,!y&&!m&&(t.lng?__(c,t.lng,p,()=>{_.current&&M(T)}):AE(c,p,()=>{_.current&&M(T)})),y&&D&&D!==A&&_.current&&M(T);const L=()=>{_.current&&M(T)};return V&&c?.on(V,L),N&&c?.store.on(N,L),()=>{_.current=!1,c&&V?.split(" ").forEach(H=>c.off(H,L)),N&&c&&N.split(" ").forEach(H=>c.store.off(H,L))}},[c,A]),x.useEffect(()=>{_.current&&y&&M(E)},[c,g,y]);const j=[O,c,y];if(j.t=O,j.i18n=c,j.ready=y,y||!y&&!m)return j;throw new Promise(V=>{t.lng?__(c,t.lng,p,()=>V()):AE(c,p,()=>V())})},AH={en:{translation:{welcome:"Hi there, you’re speaking with Jaweb AI Assistant."}},ar:{translation:{welcome:"مرحبًا، أنت تتحدث إلى مساعد Jaweb AI."}}};Wr.use(CH).init({resources:AH,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const MH=3,_H=3e3,DH=()=>{const[e,t]=x.useState(!0),[a,r]=x.useState(!1),[o,c]=x.useState(""),[f,m]=x.useState(""),[g,p]=x.useState(!1),[y,S]=x.useState(!1),[E,T]=x.useState(""),[O,M]=x.useState(""),[A,D]=x.useState(null),[_,j]=x.useState(""),[V,N]=x.useState([]),[L,H]=x.useState([]),[z,U]=x.useState(""),[B,te]=x.useState(!1),Y=async(Z=0)=>{const W=localStorage.getItem("company_username");console.log(W),t(!0);const ie={headers:{"Content-Type":"application/json",Accept:"application/json"},params:{username:W}};try{const F=(await $a.get(`${bi.apiUrl}chatbot-details/`,ie)).data.data;F.language==="Arabic"?Wr.changeLanguage("ar"):Wr.changeLanguage("en"),r(F.chatbot_form),c(F.chatbot_color),m(F.chatbot_logo),p(F.disable_chatbot_globally),S(F.remove_powered_by_jaweb),T(F.chatbot_initial_msg),M(F.status),U(F.mode),D(F.calendly_link??null),te(F.disable_checkout),console.log(F),F.calendly_link&&D(F.calendly_link),F.phone_number_id&&j(`+${F.phone_number_id}`);const K=await $a.get(`${bi.apiUrl}chatbot-plugin-suggestions/`,ie);let se=[];Array.isArray(K.data.data)?se=K.data.data:Array.isArray(K.data.user_questions)&&(se=K.data.user_questions),se.length>0?(N(se.slice(0,3)),H(se.slice(3))):(N([]),H([])),t(!1)}catch(q){console.error("Error fetching data:",q),Z<MH?setTimeout(()=>Y(Z+1),_H):console.error("Max retries reached. Could not fetch data.")}};return x.useEffect(()=>{Y()},[]),{isFetchingDetails:e,disableForm:a,colorCode:o,chatbotLogo:f,disableChatbotGlobally:g,removePoweredByJaweb:y,initialMessageText:E,subscription:O,calendly:A,merchantPhone:_,messagesSuggestions:V,restSuggestions:L,userType:z,disbleCheckout:B}};var _E={exports:{}};/*!
324
+ `+c):r.stack=c}catch{}}throw r}}_request(t,a){typeof t=="string"?(a=a||{},a.url=t):a=t||{},a=Td(this.defaults,a);const{transitional:r,paramsSerializer:o,headers:c}=a;r!==void 0&&HS.assertOptions(r,{silentJSONParsing:Fs.transitional(Fs.boolean),forcedJSONParsing:Fs.transitional(Fs.boolean),clarifyTimeoutError:Fs.transitional(Fs.boolean)},!1),o!=null&&(Xe.isFunction(o)?a.paramsSerializer={serialize:o}:HS.assertOptions(o,{encode:Fs.function,serialize:Fs.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),HS.assertOptions(a,{baseUrl:Fs.spelling("baseURL"),withXsrfToken:Fs.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let f=c&&Xe.merge(c.common,c[a.method]);c&&Xe.forEach(["delete","get","head","post","put","patch","common"],O=>{delete c[O]}),a.headers=go.concat(f,c);const m=[];let g=!0;this.interceptors.request.forEach(function(M){typeof M.runWhen=="function"&&M.runWhen(a)===!1||(g=g&&M.synchronous,m.unshift(M.fulfilled,M.rejected))});const p=[];this.interceptors.response.forEach(function(M){p.push(M.fulfilled,M.rejected)});let y,S=0,E;if(!g){const O=[s_.bind(this),void 0];for(O.unshift.apply(O,m),O.push.apply(O,p),E=O.length,y=Promise.resolve(a);S<E;)y=y.then(O[S++],O[S++]);return y}E=m.length;let T=a;for(S=0;S<E;){const O=m[S++],M=m[S++];try{T=O(T)}catch(A){M.call(this,A);break}}try{y=s_.call(this,T)}catch(O){return Promise.reject(O)}for(S=0,E=p.length;S<E;)y=y.then(p[S++],p[S++]);return y}getUri(t){t=Td(this.defaults,t);const a=JM(t.baseURL,t.url,t.allowAbsoluteUrls);return FM(a,t.params,t.paramsSerializer)}};Xe.forEach(["delete","get","head","options"],function(t){Od.prototype[t]=function(a,r){return this.request(Td(r||{},{method:t,url:a,data:(r||{}).data}))}}),Xe.forEach(["post","put","patch"],function(t){function a(r){return function(c,f,m){return this.request(Td(m||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:f}))}}Od.prototype[t]=a(),Od.prototype[t+"Form"]=a(!0)});let FV=class u8{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(c){a=c});const r=this;this.promise.then(o=>{if(!r._listeners)return;let c=r._listeners.length;for(;c-- >0;)r._listeners[c](o);r._listeners=null}),this.promise.then=o=>{let c;const f=new Promise(m=>{r.subscribe(m),c=m}).then(o);return f.cancel=function(){r.unsubscribe(c)},f},t(function(c,f,m){r.reason||(r.reason=new bm(c,f,m),a(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const a=this._listeners.indexOf(t);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){const t=new AbortController,a=r=>{t.abort(r)};return this.subscribe(a),t.signal.unsubscribe=()=>this.unsubscribe(a),t.signal}static source(){let t;return{token:new u8(function(o){t=o}),cancel:t}}};function qV(e){return function(a){return e.apply(null,a)}}function GV(e){return Xe.isObject(e)&&e.isAxiosError===!0}const wE={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(wE).forEach(([e,t])=>{wE[t]=e});function f_(e){const t=new Od(e),a=MM(Od.prototype.request,t);return Xe.extend(a,Od.prototype,t,{allOwnKeys:!0}),Xe.extend(a,t,null,{allOwnKeys:!0}),a.create=function(o){return f_(Td(e,o))},a}const $a=f_(Rv);$a.Axios=Od,$a.CanceledError=bm,$a.CancelToken=FV,$a.isCancel=WM,$a.VERSION=u_,$a.toFormData=NS,$a.AxiosError=Cn,$a.Cancel=$a.CanceledError,$a.all=function(t){return Promise.all(t)},$a.spread=qV,$a.isAxiosError=GV,$a.mergeConfig=Td,$a.AxiosHeaders=go,$a.formToJSON=e=>XM(Xe.isHTMLForm(e)?new FormData(e):e),$a.getAdapter=l_.getAdapter,$a.HttpStatusCode=wE,$a.default=$a;const{Axios:Uie,AxiosError:Iie,CanceledError:kie,isCancel:Fie,CancelToken:qie,VERSION:Gie,all:Xie,Cancel:Yie,isAxiosError:Wie,spread:Zie,toFormData:Kie,AxiosHeaders:Qie,HttpStatusCode:Jie,formToJSON:eoe,getAdapter:toe,mergeConfig:noe}=$a,bi={apiUrl:"https://jawebcrm.onrender.com/api/",websocketUrl:"wss://jawebcrm.onrender.com/ws"},sn=e=>typeof e=="string",Mv=()=>{let e,t;const a=new Promise((r,o)=>{e=r,t=o});return a.resolve=e,a.reject=t,a},d_=e=>e==null?"":""+e,XV=(e,t,a)=>{e.forEach(r=>{t[r]&&(a[r]=t[r])})},YV=/###/g,h_=e=>e&&e.indexOf("###")>-1?e.replace(YV,"."):e,m_=e=>!e||sn(e),_v=(e,t,a)=>{const r=sn(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(m_(e))return{};const c=h_(r[o]);!e[c]&&a&&(e[c]=new a),Object.prototype.hasOwnProperty.call(e,c)?e=e[c]:e={},++o}return m_(e)?{}:{obj:e,k:h_(r[o])}},p_=(e,t,a)=>{const{obj:r,k:o}=_v(e,t,Object);if(r!==void 0||t.length===1){r[o]=a;return}let c=t[t.length-1],f=t.slice(0,t.length-1),m=_v(e,f,Object);for(;m.obj===void 0&&f.length;)c=`${f[f.length-1]}.${c}`,f=f.slice(0,f.length-1),m=_v(e,f,Object),m?.obj&&typeof m.obj[`${m.k}.${c}`]<"u"&&(m.obj=void 0);m.obj[`${m.k}.${c}`]=a},WV=(e,t,a,r)=>{const{obj:o,k:c}=_v(e,t,Object);o[c]=o[c]||[],o[c].push(a)},BS=(e,t)=>{const{obj:a,k:r}=_v(e,t);if(a&&Object.prototype.hasOwnProperty.call(a,r))return a[r]},ZV=(e,t,a)=>{const r=BS(e,a);return r!==void 0?r:BS(t,a)},g_=(e,t,a)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?sn(e[r])||e[r]instanceof String||sn(t[r])||t[r]instanceof String?a&&(e[r]=t[r]):g_(e[r],t[r],a):e[r]=t[r]);return e},Sm=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var KV={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const QV=e=>sn(e)?e.replace(/[&<>"'\/]/g,t=>KV[t]):e;class JV{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const a=this.regExpMap.get(t);if(a!==void 0)return a;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const eH=[" ",",","?","!",";"],tH=new JV(20),nH=(e,t,a)=>{t=t||"",a=a||"";const r=eH.filter(f=>t.indexOf(f)<0&&a.indexOf(f)<0);if(r.length===0)return!0;const o=tH.getRegExp(`(${r.map(f=>f==="?"?"\\?":f).join("|")})`);let c=!o.test(e);if(!c){const f=e.indexOf(a);f>0&&!o.test(e.substring(0,f))&&(c=!0)}return c},TE=(e,t,a=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(a);let o=e;for(let c=0;c<r.length;){if(!o||typeof o!="object")return;let f,m="";for(let g=c;g<r.length;++g)if(g!==c&&(m+=a),m+=r[g],f=o[m],f!==void 0){if(["string","number","boolean"].indexOf(typeof f)>-1&&g<r.length-1)continue;c+=g-c+1;break}o=f}return o},Dv=e=>e?.replace("_","-"),aH={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class PS{constructor(t,a={}){this.init(t,a)}init(t,a={}){this.prefix=a.prefix||"i18next:",this.logger=t||aH,this.options=a,this.debug=a.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,a,r,o){return o&&!this.debug?null:(sn(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[a](t))}create(t){return new PS(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new PS(this.logger,t)}}var qs=new PS;class US{constructor(){this.observers={}}on(t,a){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(a)||0;this.observers[r].set(a,o+1)}),this}off(t,a){if(this.observers[t]){if(!a){delete this.observers[t];return}this.observers[t].delete(a)}}emit(t,...a){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o(...a)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o.apply(o,[t,...a])})}}class v_ extends US{constructor(t,a={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const a=this.options.ns.indexOf(t);a>-1&&this.options.ns.splice(a,1)}getResource(t,a,r,o={}){const c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,f=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let m;t.indexOf(".")>-1?m=t.split("."):(m=[t,a],r&&(Array.isArray(r)?m.push(...r):sn(r)&&c?m.push(...r.split(c)):m.push(r)));const g=BS(this.data,m);return!g&&!a&&!r&&t.indexOf(".")>-1&&(t=m[0],a=m[1],r=m.slice(2).join(".")),g||!f||!sn(r)?g:TE(this.data?.[t]?.[a],r,c)}addResource(t,a,r,o,c={silent:!1}){const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator;let m=[t,a];r&&(m=m.concat(f?r.split(f):r)),t.indexOf(".")>-1&&(m=t.split("."),o=a,a=m[1]),this.addNamespaces(a),p_(this.data,m,o),c.silent||this.emit("added",t,a,r,o)}addResources(t,a,r,o={silent:!1}){for(const c in r)(sn(r[c])||Array.isArray(r[c]))&&this.addResource(t,a,c,r[c],{silent:!0});o.silent||this.emit("added",t,a,r)}addResourceBundle(t,a,r,o,c,f={silent:!1,skipCopy:!1}){let m=[t,a];t.indexOf(".")>-1&&(m=t.split("."),o=r,r=a,a=m[1]),this.addNamespaces(a);let g=BS(this.data,m)||{};f.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?g_(g,r,c):g={...g,...r},p_(this.data,m,g),f.silent||this.emit("added",t,a,r)}removeResourceBundle(t,a){this.hasResourceBundle(t,a)&&delete this.data[t][a],this.removeNamespaces(a),this.emit("removed",t,a)}hasResourceBundle(t,a){return this.getResource(t,a)!==void 0}getResourceBundle(t,a){return a||(a=this.options.defaultNS),this.getResource(t,a)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const a=this.getDataByLanguage(t);return!!(a&&Object.keys(a)||[]).find(o=>a[o]&&Object.keys(a[o]).length>0)}toJSON(){return this.data}}var y_={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,a,r,o){return e.forEach(c=>{t=this.processors[c]?.process(t,a,r,o)??t}),t}};const b_={},S_=e=>!sn(e)&&typeof e!="boolean"&&typeof e!="number";class IS extends US{constructor(t,a={}){super(),XV(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=qs.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,a={interpolation:{}}){const r={...a};return t==null?!1:this.resolve(t,r)?.res!==void 0}extractFromKey(t,a){let r=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let c=a.ns||this.options.defaultNS||[];const f=r&&t.indexOf(r)>-1,m=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!nH(t,r,o);if(f&&!m){const g=t.match(this.interpolator.nestingRegexp);if(g&&g.length>0)return{key:t,namespaces:sn(c)?[c]:c};const p=t.split(r);(r!==o||r===o&&this.options.ns.indexOf(p[0])>-1)&&(c=p.shift()),t=p.join(o)}return{key:t,namespaces:sn(c)?[c]:c}}translate(t,a,r){let o=typeof a=="object"?{...a}:a;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(o={...o}),o||(o={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const c=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,f=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:m,namespaces:g}=this.extractFromKey(t[t.length-1],o),p=g[g.length-1];let y=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;y===void 0&&(y=":");const S=o.lng||this.language,E=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(S?.toLowerCase()==="cimode")return E?c?{res:`${p}${y}${m}`,usedKey:m,exactUsedKey:m,usedLng:S,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:`${p}${y}${m}`:c?{res:m,usedKey:m,exactUsedKey:m,usedLng:S,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:m;const T=this.resolve(t,o);let O=T?.res;const M=T?.usedKey||m,A=T?.exactUsedKey||m,D=["[object Number]","[object Function]","[object RegExp]"],_=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,j=!this.i18nFormat||this.i18nFormat.handleAsObject,V=o.count!==void 0&&!sn(o.count),N=IS.hasDefaultValue(o),L=V?this.pluralResolver.getSuffix(S,o.count,o):"",H=o.ordinal&&V?this.pluralResolver.getSuffix(S,o.count,{ordinal:!1}):"",z=V&&!o.ordinal&&o.count===0,U=z&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${L}`]||o[`defaultValue${H}`]||o.defaultValue;let B=O;j&&!O&&N&&(B=U);const te=S_(B),Y=Object.prototype.toString.apply(B);if(j&&B&&te&&D.indexOf(Y)<0&&!(sn(_)&&Array.isArray(B))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Z=this.options.returnedObjectHandler?this.options.returnedObjectHandler(M,B,{...o,ns:g}):`key '${m} (${this.language})' returned an object instead of string.`;return c?(T.res=Z,T.usedParams=this.getUsedParamsDetails(o),T):Z}if(f){const Z=Array.isArray(B),W=Z?[]:{},ie=Z?A:M;for(const q in B)if(Object.prototype.hasOwnProperty.call(B,q)){const F=`${ie}${f}${q}`;N&&!O?W[q]=this.translate(F,{...o,defaultValue:S_(U)?U[q]:void 0,joinArrays:!1,ns:g}):W[q]=this.translate(F,{...o,joinArrays:!1,ns:g}),W[q]===F&&(W[q]=B[q])}O=W}}else if(j&&sn(_)&&Array.isArray(O))O=O.join(_),O&&(O=this.extendTranslation(O,t,o,r));else{let Z=!1,W=!1;!this.isValidLookup(O)&&N&&(Z=!0,O=U),this.isValidLookup(O)||(W=!0,O=m);const q=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&W?void 0:O,F=N&&U!==O&&this.options.updateMissing;if(W||Z||F){if(this.logger.log(F?"updateKey":"missingKey",S,p,m,F?U:O),f){const G=this.resolve(m,{...o,keySeparator:!1});G&&G.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 K=[];const se=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&se&&se[0])for(let G=0;G<se.length;G++)K.push(se[G]);else this.options.saveMissingTo==="all"?K=this.languageUtils.toResolveHierarchy(o.lng||this.language):K.push(o.lng||this.language);const k=(G,J,ne)=>{const oe=N&&ne!==O?ne:q;this.options.missingKeyHandler?this.options.missingKeyHandler(G,p,J,oe,F,o):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(G,p,J,oe,F,o),this.emit("missingKey",G,p,J,O)};this.options.saveMissing&&(this.options.saveMissingPlurals&&V?K.forEach(G=>{const J=this.pluralResolver.getSuffixes(G,o);z&&o[`defaultValue${this.options.pluralSeparator}zero`]&&J.indexOf(`${this.options.pluralSeparator}zero`)<0&&J.push(`${this.options.pluralSeparator}zero`),J.forEach(ne=>{k([G],m+ne,o[`defaultValue${ne}`]||U)})}):k(K,m,U))}O=this.extendTranslation(O,t,o,T,r),W&&O===m&&this.options.appendNamespaceToMissingKey&&(O=`${p}${y}${m}`),(W||Z)&&this.options.parseMissingKeyHandler&&(O=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${p}${y}${m}`:m,Z?O:void 0,o))}return c?(T.res=O,T.usedParams=this.getUsedParamsDetails(o),T):O}extendTranslation(t,a,r,o,c){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const g=sn(t)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(g){const S=t.match(this.interpolator.nestingRegexp);p=S&&S.length}let y=r.replace&&!sn(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(y={...this.options.interpolation.defaultVariables,...y}),t=this.interpolator.interpolate(t,y,r.lng||this.language||o.usedLng,r),g){const S=t.match(this.interpolator.nestingRegexp),E=S&&S.length;p<E&&(r.nest=!1)}!r.lng&&o&&o.res&&(r.lng=this.language||o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...S)=>c?.[0]===S[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${S[0]} in key: ${a[0]}`),null):this.translate(...S,a),r)),r.interpolation&&this.interpolator.reset()}const f=r.postProcess||this.options.postProcess,m=sn(f)?[f]:f;return t!=null&&m?.length&&r.applyPostProcessor!==!1&&(t=y_.handle(m,t,a,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,a={}){let r,o,c,f,m;return sn(t)&&(t=[t]),t.forEach(g=>{if(this.isValidLookup(r))return;const p=this.extractFromKey(g,a),y=p.key;o=y;let S=p.namespaces;this.options.fallbackNS&&(S=S.concat(this.options.fallbackNS));const E=a.count!==void 0&&!sn(a.count),T=E&&!a.ordinal&&a.count===0,O=a.context!==void 0&&(sn(a.context)||typeof a.context=="number")&&a.context!=="",M=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);S.forEach(A=>{this.isValidLookup(r)||(m=A,!b_[`${M[0]}-${A}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(m)&&(b_[`${M[0]}-${A}`]=!0,this.logger.warn(`key "${o}" for languages "${M.join(", ")}" won't get resolved as namespace "${m}" 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(D=>{if(this.isValidLookup(r))return;f=D;const _=[y];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(_,y,D,A,a);else{let V;E&&(V=this.pluralResolver.getSuffix(D,a.count,a));const N=`${this.options.pluralSeparator}zero`,L=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(E&&(_.push(y+V),a.ordinal&&V.indexOf(L)===0&&_.push(y+V.replace(L,this.options.pluralSeparator)),T&&_.push(y+N)),O){const H=`${y}${this.options.contextSeparator}${a.context}`;_.push(H),E&&(_.push(H+V),a.ordinal&&V.indexOf(L)===0&&_.push(H+V.replace(L,this.options.pluralSeparator)),T&&_.push(H+N))}}let j;for(;j=_.pop();)this.isValidLookup(r)||(c=j,r=this.getResource(D,A,j,a))}))})}),{res:r,usedKey:o,exactUsedKey:c,usedLng:f,usedNS:m}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,a,r,o={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,a,r,o):this.resourceStore.getResource(t,a,r,o)}getUsedParamsDetails(t={}){const a=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!sn(t.replace);let o=r?t.replace:t;if(r&&typeof t.count<"u"&&(o.count=t.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!r){o={...o};for(const c of a)delete o[c]}return o}static hasDefaultValue(t){const a="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&a===r.substring(0,a.length)&&t[r]!==void 0)return!0;return!1}}class x_{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=qs.create("languageUtils")}getScriptPartFromCode(t){if(t=Dv(t),!t||t.indexOf("-")<0)return null;const a=t.split("-");return a.length===2||(a.pop(),a[a.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(a.join("-"))}getLanguagePartFromCode(t){if(t=Dv(t),!t||t.indexOf("-")<0)return t;const a=t.split("-");return this.formatLanguageCode(a[0])}formatLanguageCode(t){if(sn(t)&&t.indexOf("-")>-1){let a;try{a=Intl.getCanonicalLocales(t)[0]}catch{}return a&&this.options.lowerCaseLng&&(a=a.toLowerCase()),a||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let a;return t.forEach(r=>{if(a)return;const o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(a=o)}),!a&&this.options.supportedLngs&&t.forEach(r=>{if(a)return;const o=this.getScriptPartFromCode(r);if(this.isSupportedCode(o))return a=o;const c=this.getLanguagePartFromCode(r);if(this.isSupportedCode(c))return a=c;a=this.options.supportedLngs.find(f=>{if(f===c)return f;if(!(f.indexOf("-")<0&&c.indexOf("-")<0)&&(f.indexOf("-")>0&&c.indexOf("-")<0&&f.substring(0,f.indexOf("-"))===c||f.indexOf(c)===0&&c.length>1))return f})}),a||(a=this.getFallbackCodes(this.options.fallbackLng)[0]),a}getFallbackCodes(t,a){if(!t)return[];if(typeof t=="function"&&(t=t(a)),sn(t)&&(t=[t]),Array.isArray(t))return t;if(!a)return t.default||[];let r=t[a];return r||(r=t[this.getScriptPartFromCode(a)]),r||(r=t[this.formatLanguageCode(a)]),r||(r=t[this.getLanguagePartFromCode(a)]),r||(r=t.default),r||[]}toResolveHierarchy(t,a){const r=this.getFallbackCodes((a===!1?[]:a)||this.options.fallbackLng||[],t),o=[],c=f=>{f&&(this.isSupportedCode(f)?o.push(f):this.logger.warn(`rejecting language code not found in supportedLngs: ${f}`))};return sn(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&c(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&c(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&c(this.getLanguagePartFromCode(t))):sn(t)&&c(this.formatLanguageCode(t)),r.forEach(f=>{o.indexOf(f)<0&&c(this.formatLanguageCode(f))}),o}}const C_={zero:0,one:1,two:2,few:3,many:4,other:5},E_={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class rH{constructor(t,a={}){this.languageUtils=t,this.options=a,this.logger=qs.create("pluralResolver"),this.pluralRulesCache={}}addRule(t,a){this.rules[t]=a}clearCache(){this.pluralRulesCache={}}getRule(t,a={}){const r=Dv(t==="dev"?"en":t),o=a.ordinal?"ordinal":"cardinal",c=JSON.stringify({cleanedCode:r,type:o});if(c in this.pluralRulesCache)return this.pluralRulesCache[c];let f;try{f=new Intl.PluralRules(r,{type:o})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),E_;if(!t.match(/-|_/))return E_;const g=this.languageUtils.getLanguagePartFromCode(t);f=this.getRule(g,a)}return this.pluralRulesCache[c]=f,f}needsPlural(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,a,r={}){return this.getSuffixes(t,r).map(o=>`${a}${o}`)}getSuffixes(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),r?r.resolvedOptions().pluralCategories.sort((o,c)=>C_[o]-C_[c]).map(o=>`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(t,a,r={}){const o=this.getRule(t,r);return o?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(a)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",a,r))}}const w_=(e,t,a,r=".",o=!0)=>{let c=ZV(e,t,a);return!c&&o&&sn(a)&&(c=TE(e,a,r),c===void 0&&(c=TE(t,a,r))),c},OE=e=>e.replace(/\$/g,"$$$$");class iH{constructor(t={}){this.logger=qs.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(a=>a),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:a,escapeValue:r,useRawValueToEscape:o,prefix:c,prefixEscaped:f,suffix:m,suffixEscaped:g,formatSeparator:p,unescapeSuffix:y,unescapePrefix:S,nestingPrefix:E,nestingPrefixEscaped:T,nestingSuffix:O,nestingSuffixEscaped:M,nestingOptionsSeparator:A,maxReplaces:D,alwaysFormat:_}=t.interpolation;this.escape=a!==void 0?a:QV,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=c?Sm(c):f||"{{",this.suffix=m?Sm(m):g||"}}",this.formatSeparator=p||",",this.unescapePrefix=y?"":S||"-",this.unescapeSuffix=this.unescapePrefix?"":y||"",this.nestingPrefix=E?Sm(E):T||Sm("$t("),this.nestingSuffix=O?Sm(O):M||Sm(")"),this.nestingOptionsSeparator=A||",",this.maxReplaces=D||1e3,this.alwaysFormat=_!==void 0?_:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(a,r)=>a?.source===r?(a.lastIndex=0,a):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,a,r,o){let c,f,m;const g=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=T=>{if(T.indexOf(this.formatSeparator)<0){const D=w_(a,g,T,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(D,void 0,r,{...o,...a,interpolationkey:T}):D}const O=T.split(this.formatSeparator),M=O.shift().trim(),A=O.join(this.formatSeparator).trim();return this.format(w_(a,g,M,this.options.keySeparator,this.options.ignoreJSONStructure),A,r,{...o,...a,interpolationkey:M})};this.resetRegExp();const y=o?.missingInterpolationHandler||this.options.missingInterpolationHandler,S=o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:T=>OE(T)},{regex:this.regexp,safeValue:T=>this.escapeValue?OE(this.escape(T)):OE(T)}].forEach(T=>{for(m=0;c=T.regex.exec(t);){const O=c[1].trim();if(f=p(O),f===void 0)if(typeof y=="function"){const A=y(t,c,o);f=sn(A)?A:""}else if(o&&Object.prototype.hasOwnProperty.call(o,O))f="";else if(S){f=c[0];continue}else this.logger.warn(`missed to pass in variable ${O} for interpolating ${t}`),f="";else!sn(f)&&!this.useRawValueToEscape&&(f=d_(f));const M=T.safeValue(f);if(t=t.replace(c[0],M),S?(T.regex.lastIndex+=f.length,T.regex.lastIndex-=c[0].length):T.regex.lastIndex=0,m++,m>=this.maxReplaces)break}}),t}nest(t,a,r={}){let o,c,f;const m=(g,p)=>{const y=this.nestingOptionsSeparator;if(g.indexOf(y)<0)return g;const S=g.split(new RegExp(`${y}[ ]*{`));let E=`{${S[1]}`;g=S[0],E=this.interpolate(E,f);const T=E.match(/'/g),O=E.match(/"/g);((T?.length??0)%2===0&&!O||O.length%2!==0)&&(E=E.replace(/'/g,'"'));try{f=JSON.parse(E),p&&(f={...p,...f})}catch(M){return this.logger.warn(`failed parsing options string in nesting for key ${g}`,M),`${g}${y}${E}`}return f.defaultValue&&f.defaultValue.indexOf(this.prefix)>-1&&delete f.defaultValue,g};for(;o=this.nestingRegexp.exec(t);){let g=[];f={...r},f=f.replace&&!sn(f.replace)?f.replace:f,f.applyPostProcessor=!1,delete f.defaultValue;const p=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(p!==-1&&(g=o[1].slice(p).split(this.formatSeparator).map(y=>y.trim()).filter(Boolean),o[1]=o[1].slice(0,p)),c=a(m.call(this,o[1].trim(),f),f),c&&o[0]===t&&!sn(c))return c;sn(c)||(c=d_(c)),c||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),c=""),g.length&&(c=g.reduce((y,S)=>this.format(y,S,r.lng,{...r,interpolationkey:o[1].trim()}),c.trim())),t=t.replace(o[0],c),this.regexp.lastIndex=0}return t}}const oH=e=>{let t=e.toLowerCase().trim();const a={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);t==="currency"&&o.indexOf(":")<0?a.currency||(a.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?a.range||(a.range=o.trim()):o.split(";").forEach(f=>{if(f){const[m,...g]=f.split(":"),p=g.join(":").trim().replace(/^'+|'+$/g,""),y=m.trim();a[y]||(a[y]=p),p==="false"&&(a[y]=!1),p==="true"&&(a[y]=!0),isNaN(p)||(a[y]=parseInt(p,10))}})}return{formatName:t,formatOptions:a}},T_=e=>{const t={};return(a,r,o)=>{let c=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(c={...c,[o.interpolationkey]:void 0});const f=r+JSON.stringify(c);let m=t[f];return m||(m=e(Dv(r),o),t[f]=m),m(a)}},lH=e=>(t,a,r)=>e(Dv(a),r)(t);class sH{constructor(t={}){this.logger=qs.create("formatter"),this.options=t,this.init(t)}init(t,a={interpolation:{}}){this.formatSeparator=a.interpolation.formatSeparator||",";const r=a.cacheInBuiltFormats?T_:lH;this.formats={number:r((o,c)=>{const f=new Intl.NumberFormat(o,{...c});return m=>f.format(m)}),currency:r((o,c)=>{const f=new Intl.NumberFormat(o,{...c,style:"currency"});return m=>f.format(m)}),datetime:r((o,c)=>{const f=new Intl.DateTimeFormat(o,{...c});return m=>f.format(m)}),relativetime:r((o,c)=>{const f=new Intl.RelativeTimeFormat(o,{...c});return m=>f.format(m,c.range||"day")}),list:r((o,c)=>{const f=new Intl.ListFormat(o,{...c});return m=>f.format(m)})}}add(t,a){this.formats[t.toLowerCase().trim()]=a}addCached(t,a){this.formats[t.toLowerCase().trim()]=T_(a)}format(t,a,r,o={}){const c=a.split(this.formatSeparator);if(c.length>1&&c[0].indexOf("(")>1&&c[0].indexOf(")")<0&&c.find(m=>m.indexOf(")")>-1)){const m=c.findIndex(g=>g.indexOf(")")>-1);c[0]=[c[0],...c.splice(1,m)].join(this.formatSeparator)}return c.reduce((m,g)=>{const{formatName:p,formatOptions:y}=oH(g);if(this.formats[p]){let S=m;try{const E=o?.formatParams?.[o.interpolationkey]||{},T=E.locale||E.lng||o.locale||o.lng||r;S=this.formats[p](m,T,{...y,...o,...E})}catch(E){this.logger.warn(E)}return S}else this.logger.warn(`there was no format function for ${p}`);return m},t)}}const uH=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class cH extends US{constructor(t,a,r,o={}){super(),this.backend=t,this.store=a,this.services=r,this.languageUtils=r.languageUtils,this.options=o,this.logger=qs.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,o.backend,o)}queueLoad(t,a,r,o){const c={},f={},m={},g={};return t.forEach(p=>{let y=!0;a.forEach(S=>{const E=`${p}|${S}`;!r.reload&&this.store.hasResourceBundle(p,S)?this.state[E]=2:this.state[E]<0||(this.state[E]===1?f[E]===void 0&&(f[E]=!0):(this.state[E]=1,y=!1,f[E]===void 0&&(f[E]=!0),c[E]===void 0&&(c[E]=!0),g[S]===void 0&&(g[S]=!0)))}),y||(m[p]=!0)}),(Object.keys(c).length||Object.keys(f).length)&&this.queue.push({pending:f,pendingCount:Object.keys(f).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(c),pending:Object.keys(f),toLoadLanguages:Object.keys(m),toLoadNamespaces:Object.keys(g)}}loaded(t,a,r){const o=t.split("|"),c=o[0],f=o[1];a&&this.emit("failedLoading",c,f,a),!a&&r&&this.store.addResourceBundle(c,f,r,void 0,void 0,{skipCopy:!0}),this.state[t]=a?-1:2,a&&r&&(this.state[t]=0);const m={};this.queue.forEach(g=>{WV(g.loaded,[c],f),uH(g,t),a&&g.errors.push(a),g.pendingCount===0&&!g.done&&(Object.keys(g.loaded).forEach(p=>{m[p]||(m[p]={});const y=g.loaded[p];y.length&&y.forEach(S=>{m[p][S]===void 0&&(m[p][S]=!0)})}),g.done=!0,g.errors.length?g.callback(g.errors):g.callback())}),this.emit("loaded",m),this.queue=this.queue.filter(g=>!g.done)}read(t,a,r,o=0,c=this.retryTimeout,f){if(!t.length)return f(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:a,fcName:r,tried:o,wait:c,callback:f});return}this.readingCalls++;const m=(p,y)=>{if(this.readingCalls--,this.waitingReads.length>0){const S=this.waitingReads.shift();this.read(S.lng,S.ns,S.fcName,S.tried,S.wait,S.callback)}if(p&&y&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,a,r,o+1,c*2,f)},c);return}f(p,y)},g=this.backend[r].bind(this.backend);if(g.length===2){try{const p=g(t,a);p&&typeof p.then=="function"?p.then(y=>m(null,y)).catch(m):m(null,p)}catch(p){m(p)}return}return g(t,a,m)}prepareLoading(t,a,r={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();sn(t)&&(t=this.languageUtils.toResolveHierarchy(t)),sn(a)&&(a=[a]);const c=this.queueLoad(t,a,r,o);if(!c.toLoad.length)return c.pending.length||o(),null;c.toLoad.forEach(f=>{this.loadOne(f)})}load(t,a,r){this.prepareLoading(t,a,{},r)}reload(t,a,r){this.prepareLoading(t,a,{reload:!0},r)}loadOne(t,a=""){const r=t.split("|"),o=r[0],c=r[1];this.read(o,c,"read",void 0,void 0,(f,m)=>{f&&this.logger.warn(`${a}loading namespace ${c} for language ${o} failed`,f),!f&&m&&this.logger.log(`${a}loaded namespace ${c} for language ${o}`,m),this.loaded(t,f,m)})}saveMissing(t,a,r,o,c,f={},m=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(a)){this.logger.warn(`did not save key "${r}" as the 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!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const g={...f,isUpdate:c},p=this.backend.create.bind(this.backend);if(p.length<6)try{let y;p.length===5?y=p(t,a,r,o,g):y=p(t,a,r,o),y&&typeof y.then=="function"?y.then(S=>m(null,S)).catch(m):m(null,y)}catch(y){m(y)}else p(t,a,r,o,m,g)}!t||!t[0]||this.store.addResource(t[0],a,r,o)}}}const O_=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),sn(e[1])&&(t.defaultValue=e[1]),sn(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const a=e[3]||e[2];Object.keys(a).forEach(r=>{t[r]=a[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),R_=e=>(sn(e.ns)&&(e.ns=[e.ns]),sn(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),sn(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),kS=()=>{},fH=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(a=>{typeof e[a]=="function"&&(e[a]=e[a].bind(e))})};class Nv extends US{constructor(t={},a){if(super(),this.options=R_(t),this.services={},this.logger=qs,this.modules={external:[]},fH(this),a&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,a),this;setTimeout(()=>{this.init(t,a)},0)}}init(t={},a){this.isInitializing=!0,typeof t=="function"&&(a=t,t={}),t.defaultNS==null&&t.ns&&(sn(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=O_();this.options={...r,...this.options,...R_(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const o=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?qs.init(o(this.modules.logger),this.options):qs.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=sH;const y=new x_(this.options);this.store=new v_(this.options.resources,this.options);const S=this.services;S.logger=qs,S.resourceStore=this.store,S.languageUtils=y,S.pluralResolver=new rH(y,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.warn("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),p&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(S.formatter=o(p),S.formatter.init&&S.formatter.init(S,this.options),this.options.interpolation.format=S.formatter.format.bind(S.formatter)),S.interpolator=new iH(this.options),S.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},S.backendConnector=new cH(o(this.modules.backend),S.resourceStore,S,this.options),S.backendConnector.on("*",(T,...O)=>{this.emit(T,...O)}),this.modules.languageDetector&&(S.languageDetector=o(this.modules.languageDetector),S.languageDetector.init&&S.languageDetector.init(S,this.options.detection,this.options)),this.modules.i18nFormat&&(S.i18nFormat=o(this.modules.i18nFormat),S.i18nFormat.init&&S.i18nFormat.init(this)),this.translator=new IS(this.services,this.options),this.translator.on("*",(T,...O)=>{this.emit(T,...O)}),this.modules.external.forEach(T=>{T.init&&T.init(this)})}if(this.format=this.options.interpolation.format,a||(a=kS),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[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(p=>{this[p]=(...y)=>this.store[p](...y)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=(...y)=>(this.store[p](...y),this)});const m=Mv(),g=()=>{const p=(y,S)=>{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),m.resolve(S),a(y,S)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?g():setTimeout(g,0),m}loadResources(t,a=kS){let r=a;const o=sn(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(o?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const c=[],f=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(p=>{p!=="cimode"&&c.indexOf(p)<0&&c.push(p)})};o?f(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(g=>f(g)),this.options.preload?.forEach?.(m=>f(m)),this.services.backendConnector.load(c,this.options.ns,m=>{!m&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(m)})}else r(null)}reloadResources(t,a,r){const o=Mv();return typeof t=="function"&&(r=t,t=void 0),typeof a=="function"&&(r=a,a=void 0),t||(t=this.languages),a||(a=this.options.ns),r||(r=kS),this.services.backendConnector.reload(t,a,c=>{o.resolve(),r(c)}),o}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&y_.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let a=0;a<this.languages.length;a++){const r=this.languages[a];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,a){this.isLanguageChangingTo=t;const r=Mv();this.emit("languageChanging",t);const o=m=>{this.language=m,this.languages=this.services.languageUtils.toResolveHierarchy(m),this.resolvedLanguage=void 0,this.setResolvedLanguage(m)},c=(m,g)=>{g?this.isLanguageChangingTo===t&&(o(g),this.translator.changeLanguage(g),this.isLanguageChangingTo=void 0,this.emit("languageChanged",g),this.logger.log("languageChanged",g)):this.isLanguageChangingTo=void 0,r.resolve((...p)=>this.t(...p)),a&&a(m,(...p)=>this.t(...p))},f=m=>{!t&&!m&&this.services.languageDetector&&(m=[]);const g=sn(m)?m:m&&m[0],p=this.store.hasLanguageSomeTranslations(g)?g:this.services.languageUtils.getBestMatchFromCodes(sn(m)?[m]:m);p&&(this.language||o(p),this.translator.language||this.translator.changeLanguage(p),this.services.languageDetector?.cacheUserLanguage?.(p)),this.loadResources(p,y=>{c(y,p)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?f(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(f):this.services.languageDetector.detect(f):f(t),r}getFixedT(t,a,r){const o=(c,f,...m)=>{let g;typeof f!="object"?g=this.options.overloadTranslationOptionHandler([c,f].concat(m)):g={...f},g.lng=g.lng||o.lng,g.lngs=g.lngs||o.lngs,g.ns=g.ns||o.ns,g.keyPrefix!==""&&(g.keyPrefix=g.keyPrefix||r||o.keyPrefix);const p=this.options.keySeparator||".";let y;return g.keyPrefix&&Array.isArray(c)?y=c.map(S=>`${g.keyPrefix}${p}${S}`):y=g.keyPrefix?`${g.keyPrefix}${p}${c}`:c,this.t(y,g)};return sn(t)?o.lng=t:o.lngs=t,o.ns=a,o.keyPrefix=r,o}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,a={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=a.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const f=(m,g)=>{const p=this.services.backendConnector.state[`${m}|${g}`];return p===-1||p===0||p===2};if(a.precheck){const m=a.precheck(this,f);if(m!==void 0)return m}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||f(r,t)&&(!o||f(c,t)))}loadNamespaces(t,a){const r=Mv();return this.options.ns?(sn(t)&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),a&&a(o)}),r):(a&&a(),Promise.resolve())}loadLanguages(t,a){const r=Mv();sn(t)&&(t=[t]);const o=this.options.preload||[],c=t.filter(f=>o.indexOf(f)<0&&this.services.languageUtils.isSupportedCode(f));return c.length?(this.options.preload=o.concat(c),this.loadResources(f=>{r.resolve(),a&&a(f)}),r):(a&&a(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const o=new Intl.Locale(t);if(o&&o.getTextInfo){const c=o.getTextInfo();if(c&&c.direction)return c.direction}}catch{}const a=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new x_(O_());return t.toLowerCase().indexOf("-latn")>1?"ltr":a.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},a){return new Nv(t,a)}cloneInstance(t={},a=kS){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},c=new Nv(o);if((t.debug!==void 0||t.prefix!==void 0)&&(c.logger=c.logger.clone(t)),["store","services","language"].forEach(m=>{c[m]=this[m]}),c.services={...this.services},c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},r){const m=Object.keys(this.store.data).reduce((g,p)=>(g[p]={...this.store.data[p]},g[p]=Object.keys(g[p]).reduce((y,S)=>(y[S]={...g[p][S]},y),g[p]),g),{});c.store=new v_(m,o),c.services.resourceStore=c.store}return c.translator=new IS(c.services,o),c.translator.on("*",(m,...g)=>{c.emit(m,...g)}),c.init(o,a),c.translator.options=o,c.translator.backendConnector.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Wr=Nv.createInstance();Wr.createInstance=Nv.createInstance,Wr.createInstance,Wr.dir,Wr.init,Wr.loadResources,Wr.reloadResources,Wr.use,Wr.changeLanguage,Wr.getFixedT,Wr.t,Wr.exists,Wr.setDefaultNamespace,Wr.hasLoadedNamespace,Wr.loadNamespaces,Wr.loadLanguages;const dH=(e,t,a,r)=>{const o=[a,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(o,"warn","react-i18next::",!0);Rd(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...o):console?.warn&&console.warn(...o)},A_={},RE=(e,t,a,r)=>{Rd(a)&&A_[a]||(Rd(a)&&(A_[a]=new Date),dH(e,t,a,r))},M_=(e,t)=>()=>{if(e.isInitialized)t();else{const a=()=>{setTimeout(()=>{e.off("initialized",a)},0),t()};e.on("initialized",a)}},AE=(e,t,a)=>{e.loadNamespaces(t,M_(e,a))},__=(e,t,a,r)=>{if(Rd(a)&&(a=[a]),e.options.preload&&e.options.preload.indexOf(t)>-1)return AE(e,a,r);a.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,M_(e,r))},hH=(e,t,a={})=>!t.languages||!t.languages.length?(RE(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:a.lng,precheck:(r,o)=>{if(a.bindI18n?.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!o(r.isLanguageChangingTo,e))return!1}}),Rd=e=>typeof e=="string",mH=e=>typeof e=="object"&&e!==null,pH=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,gH={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},vH=e=>gH[e];let ME={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(pH,vH)};const yH=(e={})=>{ME={...ME,...e}},bH=()=>ME;let D_;const SH=e=>{D_=e},xH=()=>D_,CH={type:"3rdParty",init(e){yH(e.options.react),SH(e)}},EH=x.createContext();class wH{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(a=>{this.usedNamespaces[a]||(this.usedNamespaces[a]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const TH=(e,t)=>{const a=x.useRef();return x.useEffect(()=>{a.current=e},[e,t]),a.current},N_=(e,t,a,r)=>e.getFixedT(t,a,r),OH=(e,t,a,r)=>x.useCallback(N_(e,t,a,r),[e,t,a,r]),RH=(e,t={})=>{const{i18n:a}=t,{i18n:r,defaultNS:o}=x.useContext(EH)||{},c=a||r||xH();if(c&&!c.reportNamespaces&&(c.reportNamespaces=new wH),!c){RE(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const V=(L,H)=>Rd(H)?H:mH(H)&&Rd(H.defaultValue)?H.defaultValue:Array.isArray(L)?L[L.length-1]:L,N=[V,{},!1];return N.t=V,N.i18n={},N.ready=!1,N}c.options.react?.wait&&RE(c,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const f={...bH(),...c.options.react,...t},{useSuspense:m,keyPrefix:g}=f;let p=o||c.options?.defaultNS;p=Rd(p)?[p]:p||["translation"],c.reportNamespaces.addUsedNamespaces?.(p);const y=(c.isInitialized||c.initializedStoreOnce)&&p.every(V=>hH(V,c,f)),S=OH(c,t.lng||null,f.nsMode==="fallback"?p:p[0],g),E=()=>S,T=()=>N_(c,t.lng||null,f.nsMode==="fallback"?p:p[0],g),[O,M]=x.useState(E);let A=p.join();t.lng&&(A=`${t.lng}${A}`);const D=TH(A),_=x.useRef(!0);x.useEffect(()=>{const{bindI18n:V,bindI18nStore:N}=f;_.current=!0,!y&&!m&&(t.lng?__(c,t.lng,p,()=>{_.current&&M(T)}):AE(c,p,()=>{_.current&&M(T)})),y&&D&&D!==A&&_.current&&M(T);const L=()=>{_.current&&M(T)};return V&&c?.on(V,L),N&&c?.store.on(N,L),()=>{_.current=!1,c&&V?.split(" ").forEach(H=>c.off(H,L)),N&&c&&N.split(" ").forEach(H=>c.store.off(H,L))}},[c,A]),x.useEffect(()=>{_.current&&y&&M(E)},[c,g,y]);const j=[O,c,y];if(j.t=O,j.i18n=c,j.ready=y,y||!y&&!m)return j;throw new Promise(V=>{t.lng?__(c,t.lng,p,()=>V()):AE(c,p,()=>V())})},AH={en:{translation:{welcome:"Hi there, you’re speaking with Jaweb AI Assistant."}},ar:{translation:{welcome:"مرحبًا، أنت تتحدث إلى مساعد Jaweb AI."}}};Wr.use(CH).init({resources:AH,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const MH=3,_H=3e3,DH=()=>{const[e,t]=x.useState(!0),[a,r]=x.useState(!1),[o,c]=x.useState(""),[f,m]=x.useState(""),[g,p]=x.useState(!1),[y,S]=x.useState(!1),[E,T]=x.useState(""),[O,M]=x.useState(""),[A,D]=x.useState(null),[_,j]=x.useState(""),[V,N]=x.useState([]),[L,H]=x.useState([]),[z,U]=x.useState(""),[B,te]=x.useState(!1),Y=async(Z=0)=>{const W=localStorage.getItem("company_username");console.log(W),t(!0);const ie={headers:{"Content-Type":"application/json",Accept:"application/json"},params:{username:W}};try{const F=(await $a.get(`${bi.apiUrl}chatbot-details/`,ie)).data.data;F.language==="Arabic"?Wr.changeLanguage("ar"):Wr.changeLanguage("en"),r(F.chatbot_form),c(F.chatbot_color),m(F.chatbot_logo),p(F.disable_chatbot_globally),S(F.remove_powered_by_jaweb),T(F.chatbot_initial_msg),M(F.status),U(F.mode),D(F.calendly_link??null),te(F.disable_checkout),console.log(F),F.calendly_link&&D(F.calendly_link),F.phone_number_id&&j(`+${F.phone_number_id}`);const K=await $a.get(`${bi.apiUrl}chatbot-plugin-suggestions/`,ie);let se=[];Array.isArray(K.data.data)?se=K.data.data:Array.isArray(K.data.user_questions)&&(se=K.data.user_questions),se.length>0?(N(se.slice(0,3)),H(se.slice(3))):(N([]),H([])),t(!1)}catch(q){console.error("Error fetching data:",q),Z<MH?setTimeout(()=>Y(Z+1),_H):console.error("Max retries reached. Could not fetch data.")}};return x.useEffect(()=>{Y()},[]),{isFetchingDetails:e,disableForm:a,colorCode:o,chatbotLogo:f,disableChatbotGlobally:g,removePoweredByJaweb:y,initialMessageText:E,subscription:O,calendly:A,merchantPhone:_,messagesSuggestions:V,restSuggestions:L,userType:z,disbleCheckout:B}};var _E={exports:{}};/*!
325
325
  Copyright (c) 2018 Jed Watson.
326
326
  Licensed under the MIT License (MIT), see
327
327
  http://jedwatson.github.io/classnames
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shopify-chatbot-widget",
3
3
  "private": false,
4
- "version": "0.6.5",
4
+ "version": "0.6.6",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",