@leatcom/portal-sessions 0.0.81 → 0.0.83
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.
|
@@ -48,7 +48,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
48
48
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[N1]=this[N1]={accessors:{}}).accessors,o=this.prototype;function i(s){const a=ea(s);r[a]||(i3(o,s),r[a]=!0)}return fe.isArray(t)?t.forEach(i):i(t),this}}Jn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(Jn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),fe.freezeMethods(Jn);function Id(e,t){const n=this||Zs,r=t||n,o=Jn.from(r.headers);let i=r.data;return fe.forEach(e,function(a){i=a.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function B1(e){return!!(e&&e.__CANCEL__)}function Yi(e,t,n){Xe.call(this,e??"canceled",Xe.ERR_CANCELED,t,n),this.name="CanceledError"}fe.inherits(Yi,Xe,{__CANCEL__:!0});function M1(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Xe("Request failed with status code "+n.status,[Xe.ERR_BAD_REQUEST,Xe.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function s3(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function a3(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,i=0,s;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[i];s||(s=u),n[o]=c,r[o]=u;let h=i,f=0;for(;h!==o;)f+=n[h++],h=h%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),u-s<t)return;const p=d&&u-d;return p?Math.round(f*1e3/p):void 0}}function c3(e,t){let n=0,r=1e3/t,o,i;const s=(u,d=Date.now())=>{n=d,o=null,i&&(clearTimeout(i),i=null),e.apply(null,u)};return[(...u)=>{const d=Date.now(),h=d-n;h>=r?s(u,d):(o=u,i||(i=setTimeout(()=>{i=null,s(o)},r-h)))},()=>o&&s(o)]}const Oc=(e,t,n=3)=>{let r=0;const o=a3(50,250);return c3(i=>{const s=i.loaded,a=i.lengthComputable?i.total:void 0,c=s-r,u=o(c),d=s<=a;r=s;const h={loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a&&d?(a-s)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(h)},n)},D1=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},L1=e=>(...t)=>fe.asap(()=>e(...t)),u3=Lr.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function o(i){let s=i;return t&&(n.setAttribute("href",s),s=n.href),n.setAttribute("href",s),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(s){const a=fe.isString(s)?o(s):s;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}(),l3=Lr.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const s=[e+"="+encodeURIComponent(t)];fe.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),fe.isString(r)&&s.push("path="+r),fe.isString(o)&&s.push("domain="+o),i===!0&&s.push("secure"),document.cookie=s.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 d3(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function f3(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function F1(e,t){return e&&!d3(t)?f3(e,t):t}const j1=e=>e instanceof Jn?{...e}:e;function gi(e,t){t=t||{};const n={};function r(u,d,h){return fe.isPlainObject(u)&&fe.isPlainObject(d)?fe.merge.call({caseless:h},u,d):fe.isPlainObject(d)?fe.merge({},d):fe.isArray(d)?d.slice():d}function o(u,d,h){if(fe.isUndefined(d)){if(!fe.isUndefined(u))return r(void 0,u,h)}else return r(u,d,h)}function i(u,d){if(!fe.isUndefined(d))return r(void 0,d)}function s(u,d){if(fe.isUndefined(d)){if(!fe.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function a(u,d,h){if(h in t)return r(u,d);if(h in e)return r(void 0,u)}const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(u,d)=>o(j1(u),j1(d),!0)};return fe.forEach(Object.keys(Object.assign({},e,t)),function(d){const h=c[d]||o,f=h(e[d],t[d],d);fe.isUndefined(f)&&h!==a||(n[d]=f)}),n}const V1=e=>{const t=gi({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:a}=t;t.headers=s=Jn.from(s),t.url=k1(F1(t.baseURL,t.url),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(fe.isFormData(n)){if(Lr.hasStandardBrowserEnv||Lr.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((c=s.getContentType())!==!1){const[u,...d]=c?c.split(";").map(h=>h.trim()).filter(Boolean):[];s.setContentType([u||"multipart/form-data",...d].join("; "))}}if(Lr.hasStandardBrowserEnv&&(r&&fe.isFunction(r)&&(r=r(t)),r||r!==!1&&u3(t.url))){const u=o&&i&&l3.read(i);u&&s.set(o,u)}return t},h3=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const o=V1(e);let i=o.data;const s=Jn.from(o.headers).normalize();let{responseType:a,onUploadProgress:c,onDownloadProgress:u}=o,d,h,f,p,l;function m(){p&&p(),l&&l(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,!0),y.timeout=o.timeout;function g(){if(!y)return;const b=Jn.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:b,config:e,request:y};M1(function(T){n(T),m()},function(T){r(T),m()},C),y=null}"onloadend"in y?y.onloadend=g:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(g)},y.onabort=function(){y&&(r(new Xe("Request aborted",Xe.ECONNABORTED,e,y)),y=null)},y.onerror=function(){r(new Xe("Network Error",Xe.ERR_NETWORK,e,y)),y=null},y.ontimeout=function(){let E=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const C=o.transitional||P1;o.timeoutErrorMessage&&(E=o.timeoutErrorMessage),r(new Xe(E,C.clarifyTimeoutError?Xe.ETIMEDOUT:Xe.ECONNABORTED,e,y)),y=null},i===void 0&&s.setContentType(null),"setRequestHeader"in y&&fe.forEach(s.toJSON(),function(E,C){y.setRequestHeader(C,E)}),fe.isUndefined(o.withCredentials)||(y.withCredentials=!!o.withCredentials),a&&a!=="json"&&(y.responseType=o.responseType),u&&([f,l]=Oc(u,!0),y.addEventListener("progress",f)),c&&y.upload&&([h,p]=Oc(c),y.upload.addEventListener("progress",h),y.upload.addEventListener("loadend",p)),(o.cancelToken||o.signal)&&(d=b=>{y&&(r(!b||b.type?new Yi(null,e,y):b),y.abort(),y=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const v=s3(o.url);if(v&&Lr.protocols.indexOf(v)===-1){r(new Xe("Unsupported protocol "+v+":",Xe.ERR_BAD_REQUEST,e));return}y.send(i||null)})},p3=(e,t)=>{let n=new AbortController,r;const o=function(c){if(!r){r=!0,s();const u=c instanceof Error?c:this.reason;n.abort(u instanceof Xe?u:new Yi(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{o(new Xe(`timeout ${t} of ms exceeded`,Xe.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c&&(c.removeEventListener?c.removeEventListener("abort",o):c.unsubscribe(o))}),e=null)};e.forEach(c=>c&&c.addEventListener&&c.addEventListener("abort",o));const{signal:a}=n;return a.unsubscribe=s,[a,()=>{i&&clearTimeout(i),i=null}]},m3=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,o;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},g3=async function*(e,t,n){for await(const r of e)yield*m3(ArrayBuffer.isView(r)?r:await n(String(r)),t)},U1=(e,t,n,r,o)=>{const i=g3(e,t,o);let s=0,a,c=u=>{a||(a=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:d,value:h}=await i.next();if(d){c(),u.close();return}let f=h.byteLength;if(n){let p=s+=f;n(p)}u.enqueue(new Uint8Array(h))}catch(d){throw c(d),d}},cancel(u){return c(u),i.return()}},{highWaterMark:2})},Pc=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",H1=Pc&&typeof ReadableStream=="function",Td=Pc&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),G1=(e,...t)=>{try{return!!e(...t)}catch{return!1}},y3=H1&&G1(()=>{let e=!1;const t=new Request(Lr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),q1=64*1024,xd=H1&&G1(()=>fe.isReadableStream(new Response("").body)),Rc={stream:xd&&(e=>e.body)};Pc&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Rc[t]&&(Rc[t]=fe.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new Xe(`Response type '${t}' is not supported`,Xe.ERR_NOT_SUPPORT,r)})})})(new Response);const v3=async e=>{if(e==null)return 0;if(fe.isBlob(e))return e.size;if(fe.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(fe.isArrayBufferView(e)||fe.isArrayBuffer(e))return e.byteLength;if(fe.isURLSearchParams(e)&&(e=e+""),fe.isString(e))return(await Td(e)).byteLength},w3=async(e,t)=>{const n=fe.toFiniteNumber(e.getContentLength());return n??v3(t)},kd={http:H4,xhr:h3,fetch:Pc&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:i,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:d,withCredentials:h="same-origin",fetchOptions:f}=V1(e);u=u?(u+"").toLowerCase():"text";let[p,l]=o||i||s?p3([o,i],s):[],m,y;const g=()=>{!m&&setTimeout(()=>{p&&p.unsubscribe()}),m=!0};let v;try{if(c&&y3&&n!=="get"&&n!=="head"&&(v=await w3(d,r))!==0){let A=new Request(t,{method:"POST",body:r,duplex:"half"}),T;if(fe.isFormData(r)&&(T=A.headers.get("content-type"))&&d.setContentType(T),A.body){const[x,R]=D1(v,Oc(L1(c)));r=U1(A.body,q1,x,R,Td)}}fe.isString(h)||(h=h?"include":"omit"),y=new Request(t,{...f,signal:p,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:h});let b=await fetch(y);const E=xd&&(u==="stream"||u==="response");if(xd&&(a||E)){const A={};["status","statusText","headers"].forEach(B=>{A[B]=b[B]});const T=fe.toFiniteNumber(b.headers.get("content-length")),[x,R]=a&&D1(T,Oc(L1(a),!0))||[];b=new Response(U1(b.body,q1,x,()=>{R&&R(),E&&g()},Td),A)}u=u||"text";let C=await Rc[fe.findKey(Rc,u)||"text"](b,e);return!E&&g(),l&&l(),await new Promise((A,T)=>{M1(A,T,{data:C,headers:Jn.from(b.headers),status:b.status,statusText:b.statusText,config:e,request:y})})}catch(b){throw g(),b&&b.name==="TypeError"&&/fetch/i.test(b.message)?Object.assign(new Xe("Network Error",Xe.ERR_NETWORK,e,y),{cause:b.cause||b}):Xe.from(b,b&&b.code,e,y)}})};fe.forEach(kd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const $1=e=>`- ${e}`,b3=e=>fe.isFunction(e)||e===null||e===!1,W1={getAdapter:e=>{e=fe.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let i=0;i<t;i++){n=e[i];let s;if(r=n,!b3(n)&&(r=kd[(s=String(n)).toLowerCase()],r===void 0))throw new Xe(`Unknown adapter '${s}'`);if(r)break;o[s||"#"+i]=r}if(!r){const i=Object.entries(o).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let s=t?i.length>1?`since :
|
|
49
49
|
`+i.map($1).join(`
|
|
50
50
|
`):" "+$1(i[0]):"as no adapter specified";throw new Xe("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:kd};function Od(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Yi(null,e)}function Y1(e){return Od(e),e.headers=Jn.from(e.headers),e.data=Id.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),W1.getAdapter(e.adapter||Zs.adapter)(e).then(function(r){return Od(e),r.data=Id.call(e,e.transformResponse,r),r.headers=Jn.from(r.headers),r},function(r){return B1(r)||(Od(e),r&&r.response&&(r.response.data=Id.call(e,e.transformResponse,r.response),r.response.headers=Jn.from(r.response.headers))),Promise.reject(r)})}const z1="1.7.4",Pd={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Pd[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const K1={};Pd.transitional=function(t,n,r){function o(i,s){return"[Axios v"+z1+"] Transitional option '"+i+"'"+s+(r?". "+r:"")}return(i,s,a)=>{if(t===!1)throw new Xe(o(s," has been removed"+(n?" in "+n:"")),Xe.ERR_DEPRECATED);return n&&!K1[s]&&(K1[s]=!0,console.warn(o(s," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,s,a):!0}};function E3(e,t,n){if(typeof e!="object")throw new Xe("options must be an object",Xe.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const a=e[i],c=a===void 0||s(a,i,e);if(c!==!0)throw new Xe("option "+i+" must be "+c,Xe.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Xe("Unknown option "+i,Xe.ERR_BAD_OPTION)}}const Rd={assertOptions:E3,validators:Pd},Do=Rd.validators;class yi{constructor(t){this.defaults=t,this.interceptors={request:new O1,response:new O1}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
51
|
-
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=gi(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Rd.assertOptions(r,{silentJSONParsing:Do.transitional(Do.boolean),forcedJSONParsing:Do.transitional(Do.boolean),clarifyTimeoutError:Do.transitional(Do.boolean)},!1),o!=null&&(fe.isFunction(o)?n.paramsSerializer={serialize:o}:Rd.assertOptions(o,{encode:Do.function,serialize:Do.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=i&&fe.merge(i.common,i[n.method]);i&&fe.forEach(["delete","get","head","post","put","patch","common"],l=>{delete i[l]}),n.headers=Jn.concat(s,i);const a=[];let c=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(c=c&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,h=0,f;if(!c){const l=[Y1.bind(this),void 0];for(l.unshift.apply(l,a),l.push.apply(l,u),f=l.length,d=Promise.resolve(n);h<f;)d=d.then(l[h++],l[h++]);return d}f=a.length;let p=n;for(h=0;h<f;){const l=a[h++],m=a[h++];try{p=l(p)}catch(y){m.call(this,y);break}}try{d=Y1.call(this,p)}catch(l){return Promise.reject(l)}for(h=0,f=u.length;h<f;)d=d.then(u[h++],u[h++]);return d}getUri(t){t=gi(this.defaults,t);const n=F1(t.baseURL,t.url);return k1(n,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){yi.prototype[t]=function(n,r){return this.request(gi(r||{},{method:t,url:n,data:(r||{}).data}))}}),fe.forEach(["post","put","patch"],function(t){function n(r){return function(i,s,a){return this.request(gi(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}yi.prototype[t]=n(),yi.prototype[t+"Form"]=n(!0)});class Nd{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const s=new Promise(a=>{r.subscribe(a),i=a}).then(o);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i,s,a){r.reason||(r.reason=new Yi(i,s,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new Nd(function(o){t=o}),cancel:t}}}function C3(e){return function(n){return e.apply(null,n)}}function _3(e){return fe.isObject(e)&&e.isAxiosError===!0}const Bd={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(Bd).forEach(([e,t])=>{Bd[t]=e});function X1(e){const t=new yi(e),n=h1(yi.prototype.request,t);return fe.extend(n,yi.prototype,t,{allOwnKeys:!0}),fe.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return X1(gi(e,o))},n}const en=X1(Zs);en.Axios=yi,en.CanceledError=Yi,en.CancelToken=Nd,en.isCancel=B1,en.VERSION=z1,en.toFormData=xc,en.AxiosError=Xe,en.Cancel=en.CanceledError,en.all=function(t){return Promise.all(t)},en.spread=C3,en.isAxiosError=_3,en.mergeConfig=gi,en.AxiosHeaders=Jn,en.formToJSON=e=>R1(fe.isHTMLForm(e)?new FormData(e):e),en.getAdapter=W1.getAdapter,en.HttpStatusCode=Bd,en.default=en;const S3={UNAUTHORIZED:401,MAINTENANCE_MODE:503},A3=e=>{var n,r;const t=(n=e.response)==null?void 0:n.status;if(t&&t!==S3.UNAUTHORIZED){const o=(r=e.response)==null?void 0:r.data;console.table(o)}return Promise.reject(e)};function I3(){const e=k.useContext(rd);if(!e)throw new Error("Only use 'useApiContext' within a ApiContext Provider");return e}function Gt(){const{apiKey:e,host:t}=I3(),n=(a,c={},u={})=>s("GET",a,c,u),r=(a,c={},u={})=>s("POST",a,c,u),o=(a,c={},u={})=>s("PUT",a,c,u),i=(a,c={})=>s("DELETE",a,c),s=(a,c,u={},d={})=>{const h=en.create({baseURL:`${t??"https://api.piggy.eu"}/api/v1/portal-sessions`,headers:{Authorization:`Bearer ${e}`},...d});return h.interceptors.response.use(void 0,A3),h.request({method:a,url:c,params:a=="GET"?u:{},data:u})};return{get:n,post:r,put:o,destroy:i}}function Q1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Q1(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Lo(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Q1(e))&&(r&&(r+=" "),r+=t);return r}const ta=e=>typeof e=="number"&&!isNaN(e),vi=e=>typeof e=="string",fr=e=>typeof e=="function",Nc=e=>vi(e)||fr(e)?e:null,Md=e=>k.isValidElement(e)||vi(e)||fr(e)||ta(e);function T3(e,t,n){n===void 0&&(n=300);const{scrollHeight:r,style:o}=e;requestAnimationFrame(()=>{o.minHeight="initial",o.height=r+"px",o.transition=`all ${n}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,n)})})}function Bc(e){let{enter:t,exit:n,appendPosition:r=!1,collapse:o=!0,collapseDuration:i=300}=e;return function(s){let{children:a,position:c,preventExitTransition:u,done:d,nodeRef:h,isIn:f,playToast:p}=s;const l=r?`${t}--${c}`:t,m=r?`${n}--${c}`:n,y=k.useRef(0);return k.useLayoutEffect(()=>{const g=h.current,v=l.split(" "),b=E=>{E.target===h.current&&(p(),g.removeEventListener("animationend",b),g.removeEventListener("animationcancel",b),y.current===0&&E.type!=="animationcancel"&&g.classList.remove(...v))};g.classList.add(...v),g.addEventListener("animationend",b),g.addEventListener("animationcancel",b)},[]),k.useEffect(()=>{const g=h.current,v=()=>{g.removeEventListener("animationend",v),o?T3(g,d,i):d()};f||(u?v():(y.current=1,g.className+=` ${m}`,g.addEventListener("animationend",v)))},[f]),k.createElement(k.Fragment,null,a)}}function J1(e,t){return e!=null?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const jn=new Map;let na=[];const Dd=new Set,x3=e=>Dd.forEach(t=>t(e)),Z1=()=>jn.size>0;function e0(e,t){var n;if(t)return!((n=jn.get(t))==null||!n.isToastActive(e));let r=!1;return jn.forEach(o=>{o.isToastActive(e)&&(r=!0)}),r}function t0(e,t){Md(e)&&(Z1()||na.push({content:e,options:t}),jn.forEach(n=>{n.buildToast(e,t)}))}function n0(e,t){jn.forEach(n=>{t!=null&&t!=null&&t.containerId?(t==null?void 0:t.containerId)===n.id&&n.toggle(e,t==null?void 0:t.id):n.toggle(e,t==null?void 0:t.id)})}function k3(e){const{subscribe:t,getSnapshot:n,setProps:r}=k.useRef(function(i){const s=i.containerId||1;return{subscribe(a){const c=function(d,h,f){let p=1,l=0,m=[],y=[],g=[],v=h;const b=new Map,E=new Set,C=()=>{g=Array.from(b.values()),E.forEach(x=>x())},A=x=>{y=x==null?[]:y.filter(R=>R!==x),C()},T=x=>{const{toastId:R,onOpen:B,updateId:F,children:j}=x.props,G=F==null;x.staleId&&b.delete(x.staleId),b.set(R,x),y=[...y,x.props.toastId].filter(H=>H!==x.staleId),C(),f(J1(x,G?"added":"updated")),G&&fr(B)&&B(k.isValidElement(j)&&j.props)};return{id:d,props:v,observe:x=>(E.add(x),()=>E.delete(x)),toggle:(x,R)=>{b.forEach(B=>{R!=null&&R!==B.props.toastId||fr(B.toggle)&&B.toggle(x)})},removeToast:A,toasts:b,clearQueue:()=>{l-=m.length,m=[]},buildToast:(x,R)=>{if((we=>{let{containerId:de,toastId:Ee,updateId:ve}=we;const $=de?de!==d:d!==1,W=b.has(Ee)&&ve==null;return $||W})(R))return;const{toastId:B,updateId:F,data:j,staleId:G,delay:H}=R,P=()=>{A(B)},V=F==null;V&&l++;const z={...v,style:v.toastStyle,key:p++,...Object.fromEntries(Object.entries(R).filter(we=>{let[de,Ee]=we;return Ee!=null})),toastId:B,updateId:F,data:j,closeToast:P,isIn:!1,className:Nc(R.className||v.toastClassName),bodyClassName:Nc(R.bodyClassName||v.bodyClassName),progressClassName:Nc(R.progressClassName||v.progressClassName),autoClose:!R.isLoading&&(X=R.autoClose,re=v.autoClose,X===!1||ta(X)&&X>0?X:re),deleteToast(){const we=b.get(B),{onClose:de,children:Ee}=we.props;fr(de)&&de(k.isValidElement(Ee)&&Ee.props),f(J1(we,"removed")),b.delete(B),l--,l<0&&(l=0),m.length>0?T(m.shift()):C()}};var X,re;z.closeButton=v.closeButton,R.closeButton===!1||Md(R.closeButton)?z.closeButton=R.closeButton:R.closeButton===!0&&(z.closeButton=!Md(v.closeButton)||v.closeButton);let oe=x;k.isValidElement(x)&&!vi(x.type)?oe=k.cloneElement(x,{closeToast:P,toastProps:z,data:j}):fr(x)&&(oe=x({closeToast:P,toastProps:z,data:j}));const ce={content:oe,props:z,staleId:G};v.limit&&v.limit>0&&l>v.limit&&V?m.push(ce):ta(H)?setTimeout(()=>{T(ce)},H):T(ce)},setProps(x){v=x},setToggle:(x,R)=>{b.get(x).toggle=R},isToastActive:x=>y.some(R=>R===x),getSnapshot:()=>v.newestOnTop?g.reverse():g}}(s,i,x3);jn.set(s,c);const u=c.observe(a);return na.forEach(d=>t0(d.content,d.options)),na=[],()=>{u(),jn.delete(s)}},setProps(a){var c;(c=jn.get(s))==null||c.setProps(a)},getSnapshot(){var a;return(a=jn.get(s))==null?void 0:a.getSnapshot()}}}(e)).current;r(e);const o=k.useSyncExternalStore(t,n,n);return{getToastToRender:function(i){if(!o)return[];const s=new Map;return o.forEach(a=>{const{position:c}=a.props;s.has(c)||s.set(c,[]),s.get(c).push(a)}),Array.from(s,a=>i(a[0],a[1]))},isToastActive:e0,count:o==null?void 0:o.length}}function O3(e){const[t,n]=k.useState(!1),[r,o]=k.useState(!1),i=k.useRef(null),s=k.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:a,pauseOnHover:c,closeToast:u,onClick:d,closeOnClick:h}=e;var f,p;function l(){n(!0)}function m(){n(!1)}function y(b){const E=i.current;s.canDrag&&E&&(s.didMove=!0,t&&m(),s.delta=e.draggableDirection==="x"?b.clientX-s.start:b.clientY-s.start,s.start!==b.clientX&&(s.canCloseOnClick=!1),E.style.transform=`translate3d(${e.draggableDirection==="x"?`${s.delta}px, var(--y)`:`0, calc(${s.delta}px + var(--y))`},0)`,E.style.opacity=""+(1-Math.abs(s.delta/s.removalDistance)))}function g(){document.removeEventListener("pointermove",y),document.removeEventListener("pointerup",g);const b=i.current;if(s.canDrag&&s.didMove&&b){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance)return o(!0),e.closeToast(),void e.collapseAll();b.style.transition="transform 0.2s, opacity 0.2s",b.style.removeProperty("transform"),b.style.removeProperty("opacity")}}(p=jn.get((f={id:e.toastId,containerId:e.containerId,fn:n}).containerId||1))==null||p.setToggle(f.id,f.fn),k.useEffect(()=>{if(e.pauseOnFocusLoss)return document.hasFocus()||m(),window.addEventListener("focus",l),window.addEventListener("blur",m),()=>{window.removeEventListener("focus",l),window.removeEventListener("blur",m)}},[e.pauseOnFocusLoss]);const v={onPointerDown:function(b){if(e.draggable===!0||e.draggable===b.pointerType){s.didMove=!1,document.addEventListener("pointermove",y),document.addEventListener("pointerup",g);const E=i.current;s.canCloseOnClick=!0,s.canDrag=!0,E.style.transition="none",e.draggableDirection==="x"?(s.start=b.clientX,s.removalDistance=E.offsetWidth*(e.draggablePercent/100)):(s.start=b.clientY,s.removalDistance=E.offsetHeight*(e.draggablePercent===80?1.5*e.draggablePercent:e.draggablePercent)/100)}},onPointerUp:function(b){const{top:E,bottom:C,left:A,right:T}=i.current.getBoundingClientRect();b.nativeEvent.type!=="touchend"&&e.pauseOnHover&&b.clientX>=A&&b.clientX<=T&&b.clientY>=E&&b.clientY<=C?m():l()}};return a&&c&&(v.onMouseEnter=m,e.stacked||(v.onMouseLeave=l)),h&&(v.onClick=b=>{d&&d(b),s.canCloseOnClick&&u()}),{playToast:l,pauseToast:m,isRunning:t,preventExitTransition:r,toastRef:i,eventHandlers:v}}function P3(e){let{delay:t,isRunning:n,closeToast:r,type:o="default",hide:i,className:s,style:a,controlledProgress:c,progress:u,rtl:d,isIn:h,theme:f}=e;const p=i||c&&u===0,l={...a,animationDuration:`${t}ms`,animationPlayState:n?"running":"paused"};c&&(l.transform=`scaleX(${u})`);const m=Lo("Toastify__progress-bar",c?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${f}`,`Toastify__progress-bar--${o}`,{"Toastify__progress-bar--rtl":d}),y=fr(s)?s({rtl:d,type:o,defaultClassName:m}):Lo(m,s),g={[c&&u>=1?"onTransitionEnd":"onAnimationEnd"]:c&&u<1?null:()=>{h&&r()}};return k.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":p},k.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${f} Toastify__progress-bar--${o}`}),k.createElement("div",{role:"progressbar","aria-hidden":p?"true":"false","aria-label":"notification timer",className:y,style:l,...g}))}let R3=1;const r0=()=>""+R3++;function N3(e){return e&&(vi(e.toastId)||ta(e.toastId))?e.toastId:r0()}function ra(e,t){return t0(e,t),t.toastId}function Mc(e,t){return{...t,type:t&&t.type||e,toastId:N3(t)}}function Dc(e){return(t,n)=>ra(t,Mc(e,n))}function Tt(e,t){return ra(e,Mc("default",t))}Tt.loading=(e,t)=>ra(e,Mc("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),Tt.promise=function(e,t,n){let r,{pending:o,error:i,success:s}=t;o&&(r=vi(o)?Tt.loading(o,n):Tt.loading(o.render,{...n,...o}));const a={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},c=(d,h,f)=>{if(h==null)return void Tt.dismiss(r);const p={type:d,...a,...n,data:f},l=vi(h)?{render:h}:h;return r?Tt.update(r,{...p,...l}):Tt(l.render,{...p,...l}),f},u=fr(e)?e():e;return u.then(d=>c("success",s,d)).catch(d=>c("error",i,d)),u},Tt.success=Dc("success"),Tt.info=Dc("info"),Tt.error=Dc("error"),Tt.warning=Dc("warning"),Tt.warn=Tt.warning,Tt.dark=(e,t)=>ra(e,Mc("default",{theme:"dark",...t})),Tt.dismiss=function(e){(function(t){var n;if(Z1()){if(t==null||vi(n=t)||ta(n))jn.forEach(r=>{r.removeToast(t)});else if(t&&("containerId"in t||"id"in t)){const r=jn.get(t.containerId);r?r.removeToast(t.id):jn.forEach(o=>{o.removeToast(t.id)})}}else na=na.filter(r=>t!=null&&r.options.toastId!==t)})(e)},Tt.clearWaitingQueue=function(e){e===void 0&&(e={}),jn.forEach(t=>{!t.props.limit||e.containerId&&t.id!==e.containerId||t.clearQueue()})},Tt.isActive=e0,Tt.update=function(e,t){t===void 0&&(t={});const n=((r,o)=>{var i;let{containerId:s}=o;return(i=jn.get(s||1))==null?void 0:i.toasts.get(r)})(e,t);if(n){const{props:r,content:o}=n,i={delay:100,...r,...t,toastId:t.toastId||e,updateId:r0()};i.toastId!==e&&(i.staleId=e);const s=i.render||o;delete i.render,ra(s,i)}},Tt.done=e=>{Tt.update(e,{progress:1})},Tt.onChange=function(e){return Dd.add(e),()=>{Dd.delete(e)}},Tt.play=e=>n0(!0,e),Tt.pause=e=>n0(!1,e);const B3=typeof window<"u"?k.useLayoutEffect:k.useEffect,Lc=e=>{let{theme:t,type:n,isLoading:r,...o}=e;return k.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:t==="colored"?"currentColor":`var(--toastify-icon-color-${n})`,...o})},Ld={info:function(e){return k.createElement(Lc,{...e},k.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return k.createElement(Lc,{...e},k.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return k.createElement(Lc,{...e},k.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return k.createElement(Lc,{...e},k.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return k.createElement("div",{className:"Toastify__spinner"})}},M3=e=>{const{isRunning:t,preventExitTransition:n,toastRef:r,eventHandlers:o,playToast:i}=O3(e),{closeButton:s,children:a,autoClose:c,onClick:u,type:d,hideProgressBar:h,closeToast:f,transition:p,position:l,className:m,style:y,bodyClassName:g,bodyStyle:v,progressClassName:b,progressStyle:E,updateId:C,role:A,progress:T,rtl:x,toastId:R,deleteToast:B,isIn:F,isLoading:j,closeOnClick:G,theme:H}=e,P=Lo("Toastify__toast",`Toastify__toast-theme--${H}`,`Toastify__toast--${d}`,{"Toastify__toast--rtl":x},{"Toastify__toast--close-on-click":G}),V=fr(m)?m({rtl:x,position:l,type:d,defaultClassName:P}):Lo(P,m),z=function(ce){let{theme:we,type:de,isLoading:Ee,icon:ve}=ce,$=null;const W={theme:we,type:de};return ve===!1||(fr(ve)?$=ve({...W,isLoading:Ee}):k.isValidElement(ve)?$=k.cloneElement(ve,W):Ee?$=Ld.spinner():(Z=>Z in Ld)(de)&&($=Ld[de](W))),$}(e),X=!!T||!c,re={closeToast:f,type:d,theme:H};let oe=null;return s===!1||(oe=fr(s)?s(re):k.isValidElement(s)?k.cloneElement(s,re):function(ce){let{closeToast:we,theme:de,ariaLabel:Ee="close"}=ce;return k.createElement("button",{className:`Toastify__close-button Toastify__close-button--${de}`,type:"button",onClick:ve=>{ve.stopPropagation(),we(ve)},"aria-label":Ee},k.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},k.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}(re)),k.createElement(p,{isIn:F,done:B,position:l,preventExitTransition:n,nodeRef:r,playToast:i},k.createElement("div",{id:R,onClick:u,"data-in":F,className:V,...o,style:y,ref:r},k.createElement("div",{...F&&{role:A},className:fr(g)?g({type:d}):Lo("Toastify__toast-body",g),style:v},z!=null&&k.createElement("div",{className:Lo("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!j})},z),k.createElement("div",null,a)),oe,k.createElement(P3,{...C&&!X?{key:`pb-${C}`}:{},rtl:x,theme:H,delay:c,isRunning:t,isIn:F,closeToast:f,hide:h,type:d,style:E,className:b,controlledProgress:X,progress:T||0})))},Fc=function(e,t){return t===void 0&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},D3=Bc(Fc("bounce",!0));Bc(Fc("slide",!0)),Bc(Fc("zoom")),Bc(Fc("flip"));const L3={position:"top-right",transition:D3,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function F3(e){let t={...L3,...e};const n=e.stacked,[r,o]=k.useState(!0),i=k.useRef(null),{getToastToRender:s,isToastActive:a,count:c}=k3(t),{className:u,style:d,rtl:h,containerId:f}=t;function p(m){const y=Lo("Toastify__toast-container",`Toastify__toast-container--${m}`,{"Toastify__toast-container--rtl":h});return fr(u)?u({position:m,rtl:h,defaultClassName:y}):Lo(y,Nc(u))}function l(){n&&(o(!0),Tt.play())}return B3(()=>{if(n){var m;const y=i.current.querySelectorAll('[data-in="true"]'),g=12,v=(m=t.position)==null?void 0:m.includes("top");let b=0,E=0;Array.from(y).reverse().forEach((C,A)=>{const T=C;T.classList.add("Toastify__toast--stacked"),A>0&&(T.dataset.collapsed=`${r}`),T.dataset.pos||(T.dataset.pos=v?"top":"bot");const x=b*(r?.2:1)+(r?0:g*A);T.style.setProperty("--y",`${v?x:-1*x}px`),T.style.setProperty("--g",`${g}`),T.style.setProperty("--s",""+(1-(r?E:0))),b+=T.offsetHeight,E+=.025})}},[r,c,n]),k.createElement("div",{ref:i,className:"Toastify",id:f,onMouseEnter:()=>{n&&(o(!1),Tt.pause())},onMouseLeave:l},s((m,y)=>{const g=y.length?{...d}:{...d,pointerEvents:"none"};return k.createElement("div",{className:p(m),style:g,key:`container-${m}`},y.map(v=>{let{content:b,props:E}=v;return k.createElement(M3,{...E,stacked:n,collapseAll:l,isIn:a(E.toastId,E.containerId),style:E.style,key:`toast-${E.key}`},b)}))}))}const j3="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_15_20)'%3e%3crect%20width='32'%20height='32'%20rx='4'%20fill='%23E7FBF4'/%3e%3cpath%20d='M10.6668%2017.3333L14.6668%2020L21.3335%2012'%20stroke='%23039855'%20stroke-width='1.6875'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_15_20'%3e%3cpath%20d='M0%2016C0%207.16344%207.16344%200%2016%200V0C24.8366%200%2032%207.16344%2032%2016V16C32%2024.8366%2024.8366%2032%2016%2032V32C7.16344%2032%200%2024.8366%200%2016V16Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",V3="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_17_95)'%3e%3crect%20width='32'%20height='32'%20rx='4'%20fill='%23FEF3F2'/%3e%3cpath%20d='M12.0003%2012L20.0003%2020M12.0003%2020L20.0003%2012'%20stroke='%23E02731'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_17_95'%3e%3cpath%20d='M0%2016C0%207.16344%207.16344%200%2016%200V0C24.8366%200%2032%207.16344%2032%2016V16C32%2024.8366%2024.8366%2032%2016%2032V32C7.16344%2032%200%2024.8366%200%2016V16Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",U3="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_17_99)'%3e%3crect%20width='32'%20height='32'%20rx='4'%20fill='%23FFFAEB'/%3e%3cpath%20d='M16.0002%2017.3333V13.3333M16.0002%2020V20.0067M23.0353%2019.3333L17.942%2010.456C17.0833%208.95867%2014.9167%208.95867%2014.058%2010.456L8.96533%2019.3333C8.11266%2020.8187%209.18933%2022.6667%2010.9073%2022.6667H21.0933C22.8107%2022.6667%2023.8873%2020.8187%2023.0353%2019.3333Z'%20stroke='%23CFAA25'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_17_99'%3e%3cpath%20d='M0%2016C0%207.16344%207.16344%200%2016%200C24.8366%200%2032%207.16344%2032%2016C32%2024.8366%2024.8366%2032%2016%2032C7.16344%2032%200%2024.8366%200%2016Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";function H3(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&(t[0]=`react-i18next:: ${t[0]}`),console.warn(...t)}}const o0={};function Fd(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&o0[t[0]]||(typeof t[0]=="string"&&(o0[t[0]]=new Date),H3(...t))}const i0=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function s0(e,t,n){e.loadNamespaces(t,i0(e,n))}function a0(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,i0(e,r))}function G3(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],o=t.options?t.options.fallbackLng:!1,i=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const s=(a,c)=>{const u=t.services.backendConnector.state[`${a}|${c}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!s(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||s(r,e)&&(!o||s(i,e)))}function q3(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(Fd("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(o,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!i(o.isLanguageChangingTo,e))return!1}}):G3(e,t,n)}const $3=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,W3={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Y3=e=>W3[e];let jd={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace($3,Y3)};function z3(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};jd={...jd,...e}}function K3(){return jd}let c0;function X3(e){c0=e}function Q3(){return c0}const J3={type:"3rdParty",init(e){z3(e.options.react),X3(e)}},Z3=k.createContext();class eC{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const tC=(e,t)=>{const n=k.useRef();return k.useEffect(()=>{n.current=e},[e,t]),n.current};function u0(e,t,n,r){return e.getFixedT(t,n,r)}function nC(e,t,n,r){return k.useCallback(u0(e,t,n,r),[e,t,n,r])}function $e(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:o}=k.useContext(Z3)||{},i=n||r||Q3();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new eC),!i){Fd("You will need to pass in an i18next instance by using initReactI18next");const E=(A,T)=>typeof T=="string"?T:T&&typeof T=="object"&&typeof T.defaultValue=="string"?T.defaultValue:Array.isArray(A)?A[A.length-1]:A,C=[E,{},!1];return C.t=E,C.i18n={},C.ready=!1,C}i.options.react&&i.options.react.wait!==void 0&&Fd("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...K3(),...i.options.react,...t},{useSuspense:a,keyPrefix:c}=s;let u=o||i.options&&i.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(u);const d=(i.isInitialized||i.initializedStoreOnce)&&u.every(E=>q3(E,i,s)),h=nC(i,t.lng||null,s.nsMode==="fallback"?u:u[0],c),f=()=>h,p=()=>u0(i,t.lng||null,s.nsMode==="fallback"?u:u[0],c),[l,m]=k.useState(f);let y=u.join();t.lng&&(y=`${t.lng}${y}`);const g=tC(y),v=k.useRef(!0);k.useEffect(()=>{const{bindI18n:E,bindI18nStore:C}=s;v.current=!0,!d&&!a&&(t.lng?a0(i,t.lng,u,()=>{v.current&&m(p)}):s0(i,u,()=>{v.current&&m(p)})),d&&g&&g!==y&&v.current&&m(p);function A(){v.current&&m(p)}return E&&i&&i.on(E,A),C&&i&&i.store.on(C,A),()=>{v.current=!1,E&&i&&E.split(" ").forEach(T=>i.off(T,A)),C&&i&&C.split(" ").forEach(T=>i.store.off(T,A))}},[i,y]),k.useEffect(()=>{v.current&&d&&m(f)},[i,c,d]);const b=[l,i,d];if(b.t=l,b.i18n=i,b.ready=d,d||!d&&!a)return b;throw new Promise(E=>{t.lng?a0(i,t.lng,u,()=>E()):s0(i,u,()=>E())})}function tn(){const{t:e}=$e(),n={closeButton:!1,icon:a=>a.type==="success"?w.jsx("img",{src:j3,alt:"success"}):a.type==="error"?w.jsx("img",{src:V3,alt:"error"}):w.jsx("img",{src:U3,alt:"warning"})},r=(a,c)=>{if(a==="success")return o(c);s(c)},o=(a=e("success"),c={})=>{Tt.success(a,{...n,...c})},i=(a=e("warning"))=>{Tt.warning(a,n)},s=(a=e("somethingWentWrong"))=>{var d,h;const c=(d=a.response)==null?void 0:d.data.errors,u=w.jsxs("div",{children:[w.jsx("p",{children:(h=a.response)==null?void 0:h.data.message}),c&&Object.keys(c).map(f=>c[f].map(p=>w.jsx("li",{children:p},p)))]});Tt.error(u,n)};return{toast:r,successToast:o,warningToast:i,errorToast:s}}const _r=e=>{const t=Gt(),{errorToast:n}=tn(),r=u=>t.get(u,e.params),{data:o,error:i,isLoading:s,isValidating:a,mutate:c}=n4(e.url,r,{shouldRetryOnError:!1,revalidateIfStale:!1});return k.useEffect(()=>{o&&e.onData&&e.onData(o==null?void 0:o.data.data,o==null?void 0:o.data.meta)},[o]),k.useEffect(()=>{i&&n(i)},[i]),{data:o,pending:a,error:i,isLoading:s,isValidating:a,mutate:c}};var l0=(e=>(e[e.CREDIT_RECEPTION=1]="CREDIT_RECEPTION",e[e.PHYSICAL_REWARD_RECEPTION=2]="PHYSICAL_REWARD_RECEPTION",e[e.DIGITAL_REWARD_RECEPTION=3]="DIGITAL_REWARD_RECEPTION",e))(l0||{}),zi=(e=>(e.IDENTIFIER="identifier",e.EMAIL="email",e))(zi||{}),d0=(e=>(e.OPT_OUT="OPT_OUT",e.OPT_IN="OPT_IN",e.DOUBLE_OPT_IN="DOUBLE_OPT_IN",e.FUNCTIONAL="FUNCTIONAL",e))(d0||{}),oa=(e=>(e.INACTIVE="INACTIVE",e.ACTIVE="ACTIVE",e.EXPIRED="EXPIRED",e.LOCKED="LOCKED",e.REDEEMED="REDEEMED",e.DEACTIVATED="DEACTIVATED",e))(oa||{});function f0({uuid:e,children:t}){const[n,r]=k.useState(new bc),{mutate:o,error:i}=_r({url:e,onData:a=>{const c=new bc;c.type=a.type,c.uuid=a.uuid,c.contact=a.contact,c.currency=a.currency,c.events=a.events,c.inputData=a.input_data,c.loyaltyProgram=a.loyalty_program,c.results=a.results,r(c)}}),s=k.useMemo(()=>({uuid:e,portalSession:n,mutate:o,error:i}),[n,o,i]);return w.jsx(Zp.Provider,{value:s,children:t})}var nn=(e=>(e.GENERIC="GENERIC",e.GIFTCARD="GIFTCARD",e.REDEEM_GIFTCARD="REDEEM_GIFTCARD",e.TOP_UP_GIFTCARD="TOP_UP_GIFTCARD",e.PORTAL="PORTAL",e.PREPAID="PREPAID",e.PAY_PREPAID="PAY_PREPAID",e.TOP_UP_PREPAID="TOP_UP_PREPAID",e.POINTS_TRANSACTION="POINTS_TRANSACTION",e.VOUCHER="VOUCHER",e))(nn||{}),je=(e=>(e.GENERIC="/generic",e.GIFTCARD="/giftcard",e.PORTAL="/portal",e.PREPAID="/prepaid",e.PAY_PREPAID="/pay-prepaid",e.TOP_UP_PREPAID="/top-up-prepaid",e.POINTS_TRANSACTION="/points-transaction",e.VOUCHER="/voucher",e))(je||{}),Fo=(e=>(e.CREDIT_RECEPTION="credit_reception",e.GIFTCARD_TRANSACTION="giftcard_transaction",e.VOUCHER_REDEEMED="voucher_redeemed",e.REWARD_RECEPTION="reward_reception",e.PREPAID_TRANSACTION="prepaid_transaction",e))(Fo||{}),jc=(e=>(e[e.INPUT_INVALID=1003]="INPUT_INVALID",e[e.CONTACT_NOT_FOUND=55031]="CONTACT_NOT_FOUND",e))(jc||{}),Zn=(e=>(e.USER="user",e.ENVIRONMENT="environment",e))(Zn||{});const rC={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class Vc{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||rC,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,o){return o&&!this.debug?null:(typeof t[0]=="string"&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Vc(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Vc(this.logger,t)}}var Qr=new Vc;class Uc{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(n)||0;this.observers[r].set(n,o+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(s=>{let[a,c]=s;for(let u=0;u<c;u++)a(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(s=>{let[a,c]=s;for(let u=0;u<c;u++)a.apply(a,[t,...r])})}}function ia(){let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n}function h0(e){return e==null?"":""+e}function oC(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}const iC=/###/g;function sa(e,t,n){function r(a){return a&&a.indexOf("###")>-1?a.replace(iC,"."):a}function o(){return!e||typeof e=="string"}const i=typeof t!="string"?t:t.split(".");let s=0;for(;s<i.length-1;){if(o())return{};const a=r(i[s]);!e[a]&&n&&(e[a]=new n),Object.prototype.hasOwnProperty.call(e,a)?e=e[a]:e={},++s}return o()?{}:{obj:e,k:r(i[s])}}function p0(e,t,n){const{obj:r,k:o}=sa(e,t,Object);if(r!==void 0||t.length===1){r[o]=n;return}let i=t[t.length-1],s=t.slice(0,t.length-1),a=sa(e,s,Object);for(;a.obj===void 0&&s.length;)i=`${s[s.length-1]}.${i}`,s=s.slice(0,s.length-1),a=sa(e,s,Object),a&&a.obj&&typeof a.obj[`${a.k}.${i}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${i}`]=n}function sC(e,t,n,r){const{obj:o,k:i}=sa(e,t,Object);o[i]=o[i]||[],o[i].push(n)}function Hc(e,t){const{obj:n,k:r}=sa(e,t);if(n)return n[r]}function aC(e,t,n){const r=Hc(e,n);return r!==void 0?r:Hc(t,n)}function m0(e,t,n){for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):m0(e[r],t[r],n):e[r]=t[r]);return e}function Ki(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var cC={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function uC(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>cC[t]):e}class lC{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const dC=[" ",",","?","!",";"],fC=new lC(20);function hC(e,t,n){t=t||"",n=n||"";const r=dC.filter(s=>t.indexOf(s)<0&&n.indexOf(s)<0);if(r.length===0)return!0;const o=fC.getRegExp(`(${r.map(s=>s==="?"?"\\?":s).join("|")})`);let i=!o.test(e);if(!i){const s=e.indexOf(n);s>0&&!o.test(e.substring(0,s))&&(i=!0)}return i}function Vd(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let o=e;for(let i=0;i<r.length;){if(!o||typeof o!="object")return;let s,a="";for(let c=i;c<r.length;++c)if(c!==i&&(a+=n),a+=r[c],s=o[a],s!==void 0){if(["string","number","boolean"].indexOf(typeof s)>-1&&c<r.length-1)continue;i+=c-i+1;break}o=s}return o}function Gc(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class g0 extends Uc{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,s=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;t.indexOf(".")>-1?a=t.split("."):(a=[t,n],r&&(Array.isArray(r)?a.push(...r):typeof r=="string"&&i?a.push(...r.split(i)):a.push(r)));const c=Hc(this.data,a);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=a[0],n=a[1],r=a.slice(2).join(".")),c||!s||typeof r!="string"?c:Vd(this.data&&this.data[t]&&this.data[t][n],r,i)}addResource(t,n,r,o){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(s?r.split(s):r)),t.indexOf(".")>-1&&(a=t.split("."),o=n,n=a[1]),this.addNamespaces(n),p0(this.data,a,o),i.silent||this.emit("added",t,n,r,o)}addResources(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in r)(typeof r[i]=="string"||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});o.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,o,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),o=r,r=n,n=a[1]),this.addNamespaces(n);let c=Hc(this.data,a)||{};s.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?m0(c,r,i):c={...c,...r},p0(this.data,a,c),s.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(o=>n[o]&&Object.keys(n[o]).length>0)}toJSON(){return this.data}}var y0={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(i=>{this.processors[i]&&(t=this.processors[i].process(t,n,r,o))}),t}};const v0={};class qc extends Uc{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),oC(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Qr.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const s=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!hC(t,r,o);if(s&&!a){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:i};const u=t.split(r);(r!==o||r===o&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),t=u.join(o)}return typeof i=="string"&&(i=[i]),{key:t,namespaces:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const o=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:s,namespaces:a}=this.extractFromKey(t[t.length-1],n),c=a[a.length-1],u=n.lng||this.language,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(d){const E=n.nsSeparator||this.options.nsSeparator;return o?{res:`${c}${E}${s}`,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${E}${s}`}return o?{res:s,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:s}const h=this.resolve(t,n);let f=h&&h.res;const p=h&&h.usedKey||s,l=h&&h.exactUsedKey||s,m=Object.prototype.toString.apply(f),y=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&y.indexOf(m)<0&&!(typeof g=="string"&&Array.isArray(f))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const E=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,f,{...n,ns:a}):`key '${s} (${this.language})' returned an object instead of string.`;return o?(h.res=E,h.usedParams=this.getUsedParamsDetails(n),h):E}if(i){const E=Array.isArray(f),C=E?[]:{},A=E?l:p;for(const T in f)if(Object.prototype.hasOwnProperty.call(f,T)){const x=`${A}${i}${T}`;C[T]=this.translate(x,{...n,joinArrays:!1,ns:a}),C[T]===x&&(C[T]=f[T])}f=C}}else if(v&&typeof g=="string"&&Array.isArray(f))f=f.join(g),f&&(f=this.extendTranslation(f,t,n,r));else{let E=!1,C=!1;const A=n.count!==void 0&&typeof n.count!="string",T=qc.hasDefaultValue(n),x=A?this.pluralResolver.getSuffix(u,n.count,n):"",R=n.ordinal&&A?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",B=A&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),F=B&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${x}`]||n[`defaultValue${R}`]||n.defaultValue;!this.isValidLookup(f)&&T&&(E=!0,f=F),this.isValidLookup(f)||(C=!0,f=s);const G=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:f,H=T&&F!==f&&this.options.updateMissing;if(C||E||H){if(this.logger.log(H?"updateKey":"missingKey",u,c,s,H?F:f),i){const X=this.resolve(s,{...n,keySeparator:!1});X&&X.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 P=[];const V=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&V&&V[0])for(let X=0;X<V.length;X++)P.push(V[X]);else this.options.saveMissingTo==="all"?P=this.languageUtils.toResolveHierarchy(n.lng||this.language):P.push(n.lng||this.language);const z=(X,re,oe)=>{const ce=T&&oe!==f?oe:G;this.options.missingKeyHandler?this.options.missingKeyHandler(X,c,re,ce,H,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(X,c,re,ce,H,n),this.emit("missingKey",X,c,re,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&A?P.forEach(X=>{const re=this.pluralResolver.getSuffixes(X,n);B&&n[`defaultValue${this.options.pluralSeparator}zero`]&&re.indexOf(`${this.options.pluralSeparator}zero`)<0&&re.push(`${this.options.pluralSeparator}zero`),re.forEach(oe=>{z([X],s+oe,n[`defaultValue${oe}`]||F)})}):z(P,s,F))}f=this.extendTranslation(f,t,n,h,r),C&&f===s&&this.options.appendNamespaceToMissingKey&&(f=`${c}:${s}`),(C||E)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${s}`:s,E?f:void 0):f=this.options.parseMissingKeyHandler(f))}return o?(h.res=f,h.usedParams=this.getUsedParamsDetails(n),h):f}extendTranslation(t,n,r,o,i){var s=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(u){const f=t.match(this.interpolator.nestingRegexp);d=f&&f.length}let h=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(h={...this.options.interpolation.defaultVariables,...h}),t=this.interpolator.interpolate(t,h,r.lng||this.language,r),u){const f=t.match(this.interpolator.nestingRegexp),p=f&&f.length;d<p&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&o&&o.res&&(r.lng=o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var f=arguments.length,p=new Array(f),l=0;l<f;l++)p[l]=arguments[l];return i&&i[0]===p[0]&&!r.context?(s.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${n[0]}`),null):s.translate(...p,n)},r)),r.interpolation&&this.interpolator.reset()}const a=r.postProcess||this.options.postProcess,c=typeof a=="string"?[a]:a;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=y0.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,o,i,s,a;return typeof t=="string"&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(c,n),d=u.key;o=d;let h=u.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",p=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),l=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(y=>{this.isValidLookup(r)||(a=y,!v0[`${m[0]}-${y}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(v0[`${m[0]}-${y}`]=!0,this.logger.warn(`key "${o}" for languages "${m.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(g=>{if(this.isValidLookup(r))return;s=g;const v=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,d,g,y,n);else{let E;f&&(E=this.pluralResolver.getSuffix(g,n.count,n));const C=`${this.options.pluralSeparator}zero`,A=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(d+E),n.ordinal&&E.indexOf(A)===0&&v.push(d+E.replace(A,this.options.pluralSeparator)),p&&v.push(d+C)),l){const T=`${d}${this.options.contextSeparator}${n.context}`;v.push(T),f&&(v.push(T+E),n.ordinal&&E.indexOf(A)===0&&v.push(T+E.replace(A,this.options.pluralSeparator)),p&&v.push(T+C))}}let b;for(;b=v.pop();)this.isValidLookup(r)||(i=b,r=this.getResource(g,y,b,n))}))})}),{res:r,usedKey:o,exactUsedKey:i,usedLng:s,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,o):this.resourceStore.getResource(t,n,r,o)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&typeof t.replace!="string";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 i of n)delete o[i]}return o}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function Ud(e){return e.charAt(0).toUpperCase()+e.slice(1)}class w0{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Qr.create("languageUtils")}getScriptPartFromCode(t){if(t=Gc(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Gc(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(o=>o.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Ud(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Ud(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Ud(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(n=o)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const o=this.getLanguagePartFromCode(r);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(i=>{if(i===o)return i;if(!(i.indexOf("-")<0&&o.indexOf("-")<0)&&(i.indexOf("-")>0&&o.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===o||i.indexOf(o)===0&&o.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),o=[],i=s=>{s&&(this.isSupportedCode(s)?o.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):typeof t=="string"&&i(this.formatLanguageCode(t)),r.forEach(s=>{o.indexOf(s)<0&&i(this.formatLanguageCode(s))}),o}}let pC=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],mC={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const gC=["v1","v2","v3"],yC=["v4"],b0={zero:0,one:1,two:2,few:3,many:4,other:5};function vC(){const e={};return pC.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:mC[t.fc]}})}),e}class wC{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Qr.create("pluralResolver"),(!this.options.compatibilityJSON||yC.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=vC()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(Gc(t==="dev"?"en":t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(o=>`${n}${o}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((o,i)=>b0[o]-b0[i]).map(o=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${o}`):r.numbers.map(o=>this.getSuffix(t,o,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const o=this.getRule(t,r);return o?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(n)}`:this.getSuffixRetroCompatible(o,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let o=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(o===2?o="plural":o===1&&(o=""));const i=()=>this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString();return this.options.compatibilityJSON==="v1"?o===1?"":typeof o=="number"?`_plural_${o.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?i():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!gC.includes(this.options.compatibilityJSON)}}function E0(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=aC(e,t,n);return!i&&o&&typeof n=="string"&&(i=Vd(e,n,r),i===void 0&&(i=Vd(t,n,r))),i}class bC{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Qr.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:o,prefix:i,prefixEscaped:s,suffix:a,suffixEscaped:c,formatSeparator:u,unescapeSuffix:d,unescapePrefix:h,nestingPrefix:f,nestingPrefixEscaped:p,nestingSuffix:l,nestingSuffixEscaped:m,nestingOptionsSeparator:y,maxReplaces:g,alwaysFormat:v}=t.interpolation;this.escape=n!==void 0?n:uC,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=i?Ki(i):s||"{{",this.suffix=a?Ki(a):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=d?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=f?Ki(f):p||Ki("$t("),this.nestingSuffix=l?Ki(l):m||Ki(")"),this.nestingOptionsSeparator=y||",",this.maxReplaces=g||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,o){let i,s,a;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(l){return l.replace(/\$/g,"$$$$")}const d=l=>{if(l.indexOf(this.formatSeparator)<0){const v=E0(n,c,l,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(v,void 0,r,{...o,...n,interpolationkey:l}):v}const m=l.split(this.formatSeparator),y=m.shift().trim(),g=m.join(this.formatSeparator).trim();return this.format(E0(n,c,y,this.options.keySeparator,this.options.ignoreJSONStructure),g,r,{...o,...n,interpolationkey:y})};this.resetRegExp();const h=o&&o.missingInterpolationHandler||this.options.missingInterpolationHandler,f=o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:l=>u(l)},{regex:this.regexp,safeValue:l=>this.escapeValue?u(this.escape(l)):u(l)}].forEach(l=>{for(a=0;i=l.regex.exec(t);){const m=i[1].trim();if(s=d(m),s===void 0)if(typeof h=="function"){const g=h(t,i,o);s=typeof g=="string"?g:""}else if(o&&Object.prototype.hasOwnProperty.call(o,m))s="";else if(f){s=i[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),s="";else typeof s!="string"&&!this.useRawValueToEscape&&(s=h0(s));const y=l.safeValue(s);if(t=t.replace(i[0],y),f?(l.regex.lastIndex+=s.length,l.regex.lastIndex-=i[0].length):l.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,i,s;function a(c,u){const d=this.nestingOptionsSeparator;if(c.indexOf(d)<0)return c;const h=c.split(new RegExp(`${d}[ ]*{`));let f=`{${h[1]}`;c=h[0],f=this.interpolate(f,s);const p=f.match(/'/g),l=f.match(/"/g);(p&&p.length%2===0&&!l||l.length%2!==0)&&(f=f.replace(/'/g,'"'));try{s=JSON.parse(f),u&&(s={...u,...s})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,m),`${c}${d}${f}`}return s.defaultValue&&s.defaultValue.indexOf(this.prefix)>-1&&delete s.defaultValue,c}for(;o=this.nestingRegexp.exec(t);){let c=[];s={...r},s=s.replace&&typeof s.replace!="string"?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let u=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){const d=o[1].split(this.formatSeparator).map(h=>h.trim());o[1]=d.shift(),c=d,u=!0}if(i=n(a.call(this,o[1].trim(),s),s),i&&o[0]===t&&typeof i!="string")return i;typeof i!="string"&&(i=h0(i)),i||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),i=""),u&&(i=c.reduce((d,h)=>this.format(d,h,r.lng,{...r,interpolationkey:o[1].trim()}),i.trim())),t=t.replace(o[0],i),this.regexp.lastIndex=0}return t}}function EC(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);t==="currency"&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(s=>{if(s){const[a,...c]=s.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),d=a.trim();n[d]||(n[d]=u),u==="false"&&(n[d]=!1),u==="true"&&(n[d]=!0),isNaN(u)||(n[d]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}}function Xi(e){const t={};return function(r,o,i){const s=o+JSON.stringify(i);let a=t[s];return a||(a=e(Gc(o),i),t[s]=a),a(r)}}class CC{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Qr.create("formatter"),this.options=t,this.formats={number:Xi((n,r)=>{const o=new Intl.NumberFormat(n,{...r});return i=>o.format(i)}),currency:Xi((n,r)=>{const o=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>o.format(i)}),datetime:Xi((n,r)=>{const o=new Intl.DateTimeFormat(n,{...r});return i=>o.format(i)}),relativetime:Xi((n,r)=>{const o=new Intl.RelativeTimeFormat(n,{...r});return i=>o.format(i,r.range||"day")}),list:Xi((n,r)=>{const o=new Intl.ListFormat(n,{...r});return i=>o.format(i)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Xi(n)}format(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((a,c)=>{const{formatName:u,formatOptions:d}=EC(c);if(this.formats[u]){let h=a;try{const f=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},p=f.locale||f.lng||o.locale||o.lng||r;h=this.formats[u](a,p,{...d,...o,...f})}catch(f){this.logger.warn(f)}return h}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}function _C(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class SC extends Uc{constructor(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=o,this.logger=Qr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,o.backend,o)}queueLoad(t,n,r,o){const i={},s={},a={},c={};return t.forEach(u=>{let d=!0;n.forEach(h=>{const f=`${u}|${h}`;!r.reload&&this.store.hasResourceBundle(u,h)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?s[f]===void 0&&(s[f]=!0):(this.state[f]=1,d=!1,s[f]===void 0&&(s[f]=!0),i[f]===void 0&&(i[f]=!0),c[h]===void 0&&(c[h]=!0)))}),d||(a[u]=!0)}),(Object.keys(i).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(i),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const o=t.split("|"),i=o[0],s=o[1];n&&this.emit("failedLoading",i,s,n),r&&this.store.addResourceBundle(i,s,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2;const a={};this.queue.forEach(c=>{sC(c.loaded,[i],s),_C(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{a[u]||(a[u]={});const d=c.loaded[u];d.length&&d.forEach(h=>{a[u][h]===void 0&&(a[u][h]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;if(!t.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:o,wait:i,callback:s});return}this.readingCalls++;const a=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(u&&d&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,o+1,i*2,s)},i);return}s(u,d)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const u=c(t,n);u&&typeof u.then=="function"?u.then(d=>a(null,d)).catch(a):a(null,u)}catch(u){a(u)}return}return c(t,n,a)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const i=this.queueLoad(t,n,r,o);if(!i.toLoad.length)return i.pending.length||o(),null;i.toLoad.forEach(s=>{this.loadOne(s)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),o=r[0],i=r[1];this.read(o,i,"read",void 0,void 0,(s,a)=>{s&&this.logger.warn(`${n}loading namespace ${i} for language ${o} failed`,s),!s&&a&&this.logger.log(`${n}loaded namespace ${i} for language ${o}`,a),this.loaded(t,s,a)})}saveMissing(t,n,r,o,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const c={...s,isUpdate:i},u=this.backend.create.bind(this.backend);if(u.length<6)try{let d;u.length===5?d=u(t,n,r,o,c):d=u(t,n,r,o),d&&typeof d.then=="function"?d.then(h=>a(null,h)).catch(a):a(null,d)}catch(d){a(d)}else u(t,n,r,o,a,c)}!t||!t[0]||this.store.addResource(t[0],n,r,o)}}}function C0(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(o=>{n[o]=r[o]})}return n},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function _0(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function $c(){}function AC(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class aa extends Uc{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=_0(t),this.services={},this.logger=Qr,this.modules={external:[]},AC(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const o=C0();this.options={...o,...this.options,..._0(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...o.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function i(d){return d?typeof d=="function"?new d:d:null}if(!this.options.isClone){this.modules.logger?Qr.init(i(this.modules.logger),this.options):Qr.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=CC);const h=new w0(this.options);this.store=new g0(this.options.resources,this.options);const f=this.services;f.logger=Qr,f.resourceStore=this.store,f.languageUtils=h,f.pluralResolver=new wC(h,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(f.formatter=i(d),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new bC(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new SC(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(p){for(var l=arguments.length,m=new Array(l>1?l-1:0),y=1;y<l;y++)m[y-1]=arguments[y];t.emit(p,...m)}),this.modules.languageDetector&&(f.languageDetector=i(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=i(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new qc(this.services,this.options),this.translator.on("*",function(p){for(var l=arguments.length,m=new Array(l>1?l-1:0),y=1;y<l;y++)m[y-1]=arguments[y];t.emit(p,...m)}),this.modules.external.forEach(p=>{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,r||(r=$c),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[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(d=>{this[d]=function(){return t.store[d](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=function(){return t.store[d](...arguments),t}});const c=ia(),u=()=>{const d=(h,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(f),r(h,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$c;const o=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(o&&o.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],s=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{u!=="cimode"&&i.indexOf(u)<0&&i.push(u)})};o?s(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>s(c)),this.options.preload&&this.options.preload.forEach(a=>s(a)),this.services.backendConnector.load(i,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const o=ia();return t||(t=this.languages),n||(n=this.options.ns),r||(r=$c),this.services.backendConnector.reload(t,n,i=>{o.resolve(),r(i)}),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"&&y0.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const o=ia();this.emit("languageChanging",t);const i=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},s=(c,u)=>{u?(i(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,o.resolve(function(){return r.t(...arguments)}),n&&n(c,function(){return r.t(...arguments)})},a=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const u=typeof c=="string"?c:this.services.languageUtils.getBestMatchFromCodes(c);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,d=>{s(d,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),o}getFixedT(t,n,r){var o=this;const i=function(s,a){let c;if(typeof a!="object"){for(var u=arguments.length,d=new Array(u>2?u-2:0),h=2;h<u;h++)d[h-2]=arguments[h];c=o.options.overloadTranslationOptionHandler([s,a].concat(d))}else c={...a};c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix=c.keyPrefix||r||i.keyPrefix;const f=o.options.keySeparator||".";let p;return c.keyPrefix&&Array.isArray(s)?p=s.map(l=>`${c.keyPrefix}${f}${l}`):p=c.keyPrefix?`${c.keyPrefix}${f}${s}`:s,o.t(p,c)};return typeof t=="string"?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const s=(a,c)=>{const u=this.services.backendConnector.state[`${a}|${c}`];return u===-1||u===2};if(n.precheck){const a=n.precheck(this,s);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(r,t)&&(!o||s(i,t)))}loadNamespaces(t,n){const r=ia();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=ia();typeof t=="string"&&(t=[t]);const o=this.options.preload||[],i=t.filter(s=>o.indexOf(s)<0&&this.services.languageUtils.isSupportedCode(s));return i.length?(this.options.preload=o.concat(i),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new w0(C0());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new aa(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$c;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},i=new aa(o);return(t.debug!==void 0||t.prefix!==void 0)&&(i.logger=i.logger.clone(t)),["store","services","language"].forEach(a=>{i[a]=this[a]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r&&(i.store=new g0(this.store.data,o),i.services.resourceStore=i.store),i.translator=new qc(i.services,o),i.translator.on("*",function(a){for(var c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];i.emit(a,...u)}),i.init(o,n),i.translator.options=o,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ln=aa.createInstance();ln.createInstance=aa.createInstance,ln.createInstance,ln.dir,ln.init,ln.loadResources,ln.reloadResources,ln.use,ln.changeLanguage,ln.getFixedT,ln.t,ln.exists,ln.setDefaultNamespace,ln.hasLoadedNamespace,ln.loadNamespaces,ln.loadLanguages;const Qi=(e,t="EUR")=>new Intl.NumberFormat(ln.language,{style:"currency",currency:t??"EUR"}).format(e/100),IC=e=>0 .toLocaleString(ln.language,{style:"currency",currency:e??"EUR",minimumFractionDigits:0,maximumFractionDigits:0}).replace(/\d/g,"").trim(),TC=e=>{window.parent.postMessage(e,"*")},S0=(e,t)=>Math.abs(Math.round((t.getTime()-e.getTime())/(1e3*3600*24))),A0=(e,t)=>Math.abs(Math.round((t.getTime()-e.getTime())/(1e3*3600*24*7))),I0=(e,t)=>Math.abs(Math.round((t.getTime()-e.getTime())/(1e3*3600*24*365.25)));function xC(e){const{errorToast:t}=tn(),[n,r]=k.useState(),o=Gt(),i=()=>{const a={type:e.type??nn.PORTAL,api_key:e.apiKey,shop_uuid:e.shopUuid,contact_uuid:e.contactUuid};return e.cameraService&&(a.camera_service=e.cameraService),e.cameraFacingMode&&(a.camera_facing_mode=e.cameraFacingMode),e.amountInCents&&(a.amount_in_cents=e.amountInCents),e.allowMultipleGiftcards&&(a.allow_multiple_giftcards=e.allowMultipleGiftcards),e.enableRegistration&&(a.enable_registration=e.enableRegistration),e.enableEmailIdentification&&(a.enable_email_identification=e.enableEmailIdentification),e.enableOnScreenKeyboard&&(a.enable_on_screen_keyboard=e.enableOnScreenKeyboard),e.primaryIdentificationMethod&&(a.primary_identification_method=e.primaryIdentificationMethod),a},s=()=>{o.post("/",i(),{baseURL:`${e.host}/api/v1/portal-sessions`,headers:{Authorization:`Bearer ${e.apiKey}`}}).then(a=>{const c=new bc;c.type=a.data.data.type,c.uuid=a.data.data.uuid,c.contact=a.data.data.contact,c.currency=a.data.data.currency,c.events=a.data.data.events,c.inputData=a.data.data.input_data,c.loyaltyProgram=a.data.data.loyalty_program,c.results=a.data.data.results,r(c)}).catch(t)};return k.useEffect(()=>s(),[]),{portalSession:n}}var T0={exports:{}};/*!
|
|
51
|
+
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=gi(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Rd.assertOptions(r,{silentJSONParsing:Do.transitional(Do.boolean),forcedJSONParsing:Do.transitional(Do.boolean),clarifyTimeoutError:Do.transitional(Do.boolean)},!1),o!=null&&(fe.isFunction(o)?n.paramsSerializer={serialize:o}:Rd.assertOptions(o,{encode:Do.function,serialize:Do.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=i&&fe.merge(i.common,i[n.method]);i&&fe.forEach(["delete","get","head","post","put","patch","common"],l=>{delete i[l]}),n.headers=Jn.concat(s,i);const a=[];let c=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(c=c&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,h=0,f;if(!c){const l=[Y1.bind(this),void 0];for(l.unshift.apply(l,a),l.push.apply(l,u),f=l.length,d=Promise.resolve(n);h<f;)d=d.then(l[h++],l[h++]);return d}f=a.length;let p=n;for(h=0;h<f;){const l=a[h++],m=a[h++];try{p=l(p)}catch(y){m.call(this,y);break}}try{d=Y1.call(this,p)}catch(l){return Promise.reject(l)}for(h=0,f=u.length;h<f;)d=d.then(u[h++],u[h++]);return d}getUri(t){t=gi(this.defaults,t);const n=F1(t.baseURL,t.url);return k1(n,t.params,t.paramsSerializer)}}fe.forEach(["delete","get","head","options"],function(t){yi.prototype[t]=function(n,r){return this.request(gi(r||{},{method:t,url:n,data:(r||{}).data}))}}),fe.forEach(["post","put","patch"],function(t){function n(r){return function(i,s,a){return this.request(gi(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}yi.prototype[t]=n(),yi.prototype[t+"Form"]=n(!0)});class Nd{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const s=new Promise(a=>{r.subscribe(a),i=a}).then(o);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i,s,a){r.reason||(r.reason=new Yi(i,s,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new Nd(function(o){t=o}),cancel:t}}}function C3(e){return function(n){return e.apply(null,n)}}function _3(e){return fe.isObject(e)&&e.isAxiosError===!0}const Bd={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(Bd).forEach(([e,t])=>{Bd[t]=e});function X1(e){const t=new yi(e),n=h1(yi.prototype.request,t);return fe.extend(n,yi.prototype,t,{allOwnKeys:!0}),fe.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return X1(gi(e,o))},n}const en=X1(Zs);en.Axios=yi,en.CanceledError=Yi,en.CancelToken=Nd,en.isCancel=B1,en.VERSION=z1,en.toFormData=xc,en.AxiosError=Xe,en.Cancel=en.CanceledError,en.all=function(t){return Promise.all(t)},en.spread=C3,en.isAxiosError=_3,en.mergeConfig=gi,en.AxiosHeaders=Jn,en.formToJSON=e=>R1(fe.isHTMLForm(e)?new FormData(e):e),en.getAdapter=W1.getAdapter,en.HttpStatusCode=Bd,en.default=en;const S3={UNAUTHORIZED:401,MAINTENANCE_MODE:503},A3=e=>{var n,r;const t=(n=e.response)==null?void 0:n.status;if(t&&t!==S3.UNAUTHORIZED){const o=(r=e.response)==null?void 0:r.data;console.table(o)}return Promise.reject(e)};function I3(){const e=k.useContext(rd);if(!e)throw new Error("Only use 'useApiContext' within a ApiContext Provider");return e}function Gt(){const{apiKey:e,host:t}=I3(),n=(a,c={},u={})=>s("GET",a,c,u),r=(a,c={},u={})=>s("POST",a,c,u),o=(a,c={},u={})=>s("PUT",a,c,u),i=(a,c={})=>s("DELETE",a,c),s=(a,c,u={},d={})=>{const h=en.create({baseURL:`${t??"https://api.piggy.eu"}/api/v1/portal-sessions`,headers:{Authorization:`Bearer ${e}`},...d});return h.interceptors.response.use(void 0,A3),h.request({method:a,url:c,params:a=="GET"?u:{},data:u})};return{get:n,post:r,put:o,destroy:i}}function Q1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Q1(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Lo(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Q1(e))&&(r&&(r+=" "),r+=t);return r}const ta=e=>typeof e=="number"&&!isNaN(e),vi=e=>typeof e=="string",fr=e=>typeof e=="function",Nc=e=>vi(e)||fr(e)?e:null,Md=e=>k.isValidElement(e)||vi(e)||fr(e)||ta(e);function T3(e,t,n){n===void 0&&(n=300);const{scrollHeight:r,style:o}=e;requestAnimationFrame(()=>{o.minHeight="initial",o.height=r+"px",o.transition=`all ${n}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,n)})})}function Bc(e){let{enter:t,exit:n,appendPosition:r=!1,collapse:o=!0,collapseDuration:i=300}=e;return function(s){let{children:a,position:c,preventExitTransition:u,done:d,nodeRef:h,isIn:f,playToast:p}=s;const l=r?`${t}--${c}`:t,m=r?`${n}--${c}`:n,y=k.useRef(0);return k.useLayoutEffect(()=>{const g=h.current,v=l.split(" "),b=E=>{E.target===h.current&&(p(),g.removeEventListener("animationend",b),g.removeEventListener("animationcancel",b),y.current===0&&E.type!=="animationcancel"&&g.classList.remove(...v))};g.classList.add(...v),g.addEventListener("animationend",b),g.addEventListener("animationcancel",b)},[]),k.useEffect(()=>{const g=h.current,v=()=>{g.removeEventListener("animationend",v),o?T3(g,d,i):d()};f||(u?v():(y.current=1,g.className+=` ${m}`,g.addEventListener("animationend",v)))},[f]),k.createElement(k.Fragment,null,a)}}function J1(e,t){return e!=null?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const jn=new Map;let na=[];const Dd=new Set,x3=e=>Dd.forEach(t=>t(e)),Z1=()=>jn.size>0;function e0(e,t){var n;if(t)return!((n=jn.get(t))==null||!n.isToastActive(e));let r=!1;return jn.forEach(o=>{o.isToastActive(e)&&(r=!0)}),r}function t0(e,t){Md(e)&&(Z1()||na.push({content:e,options:t}),jn.forEach(n=>{n.buildToast(e,t)}))}function n0(e,t){jn.forEach(n=>{t!=null&&t!=null&&t.containerId?(t==null?void 0:t.containerId)===n.id&&n.toggle(e,t==null?void 0:t.id):n.toggle(e,t==null?void 0:t.id)})}function k3(e){const{subscribe:t,getSnapshot:n,setProps:r}=k.useRef(function(i){const s=i.containerId||1;return{subscribe(a){const c=function(d,h,f){let p=1,l=0,m=[],y=[],g=[],v=h;const b=new Map,E=new Set,C=()=>{g=Array.from(b.values()),E.forEach(x=>x())},A=x=>{y=x==null?[]:y.filter(R=>R!==x),C()},T=x=>{const{toastId:R,onOpen:B,updateId:F,children:j}=x.props,G=F==null;x.staleId&&b.delete(x.staleId),b.set(R,x),y=[...y,x.props.toastId].filter(H=>H!==x.staleId),C(),f(J1(x,G?"added":"updated")),G&&fr(B)&&B(k.isValidElement(j)&&j.props)};return{id:d,props:v,observe:x=>(E.add(x),()=>E.delete(x)),toggle:(x,R)=>{b.forEach(B=>{R!=null&&R!==B.props.toastId||fr(B.toggle)&&B.toggle(x)})},removeToast:A,toasts:b,clearQueue:()=>{l-=m.length,m=[]},buildToast:(x,R)=>{if((we=>{let{containerId:de,toastId:Ee,updateId:ve}=we;const $=de?de!==d:d!==1,W=b.has(Ee)&&ve==null;return $||W})(R))return;const{toastId:B,updateId:F,data:j,staleId:G,delay:H}=R,P=()=>{A(B)},V=F==null;V&&l++;const z={...v,style:v.toastStyle,key:p++,...Object.fromEntries(Object.entries(R).filter(we=>{let[de,Ee]=we;return Ee!=null})),toastId:B,updateId:F,data:j,closeToast:P,isIn:!1,className:Nc(R.className||v.toastClassName),bodyClassName:Nc(R.bodyClassName||v.bodyClassName),progressClassName:Nc(R.progressClassName||v.progressClassName),autoClose:!R.isLoading&&(X=R.autoClose,re=v.autoClose,X===!1||ta(X)&&X>0?X:re),deleteToast(){const we=b.get(B),{onClose:de,children:Ee}=we.props;fr(de)&&de(k.isValidElement(Ee)&&Ee.props),f(J1(we,"removed")),b.delete(B),l--,l<0&&(l=0),m.length>0?T(m.shift()):C()}};var X,re;z.closeButton=v.closeButton,R.closeButton===!1||Md(R.closeButton)?z.closeButton=R.closeButton:R.closeButton===!0&&(z.closeButton=!Md(v.closeButton)||v.closeButton);let oe=x;k.isValidElement(x)&&!vi(x.type)?oe=k.cloneElement(x,{closeToast:P,toastProps:z,data:j}):fr(x)&&(oe=x({closeToast:P,toastProps:z,data:j}));const ce={content:oe,props:z,staleId:G};v.limit&&v.limit>0&&l>v.limit&&V?m.push(ce):ta(H)?setTimeout(()=>{T(ce)},H):T(ce)},setProps(x){v=x},setToggle:(x,R)=>{b.get(x).toggle=R},isToastActive:x=>y.some(R=>R===x),getSnapshot:()=>v.newestOnTop?g.reverse():g}}(s,i,x3);jn.set(s,c);const u=c.observe(a);return na.forEach(d=>t0(d.content,d.options)),na=[],()=>{u(),jn.delete(s)}},setProps(a){var c;(c=jn.get(s))==null||c.setProps(a)},getSnapshot(){var a;return(a=jn.get(s))==null?void 0:a.getSnapshot()}}}(e)).current;r(e);const o=k.useSyncExternalStore(t,n,n);return{getToastToRender:function(i){if(!o)return[];const s=new Map;return o.forEach(a=>{const{position:c}=a.props;s.has(c)||s.set(c,[]),s.get(c).push(a)}),Array.from(s,a=>i(a[0],a[1]))},isToastActive:e0,count:o==null?void 0:o.length}}function O3(e){const[t,n]=k.useState(!1),[r,o]=k.useState(!1),i=k.useRef(null),s=k.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:a,pauseOnHover:c,closeToast:u,onClick:d,closeOnClick:h}=e;var f,p;function l(){n(!0)}function m(){n(!1)}function y(b){const E=i.current;s.canDrag&&E&&(s.didMove=!0,t&&m(),s.delta=e.draggableDirection==="x"?b.clientX-s.start:b.clientY-s.start,s.start!==b.clientX&&(s.canCloseOnClick=!1),E.style.transform=`translate3d(${e.draggableDirection==="x"?`${s.delta}px, var(--y)`:`0, calc(${s.delta}px + var(--y))`},0)`,E.style.opacity=""+(1-Math.abs(s.delta/s.removalDistance)))}function g(){document.removeEventListener("pointermove",y),document.removeEventListener("pointerup",g);const b=i.current;if(s.canDrag&&s.didMove&&b){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance)return o(!0),e.closeToast(),void e.collapseAll();b.style.transition="transform 0.2s, opacity 0.2s",b.style.removeProperty("transform"),b.style.removeProperty("opacity")}}(p=jn.get((f={id:e.toastId,containerId:e.containerId,fn:n}).containerId||1))==null||p.setToggle(f.id,f.fn),k.useEffect(()=>{if(e.pauseOnFocusLoss)return document.hasFocus()||m(),window.addEventListener("focus",l),window.addEventListener("blur",m),()=>{window.removeEventListener("focus",l),window.removeEventListener("blur",m)}},[e.pauseOnFocusLoss]);const v={onPointerDown:function(b){if(e.draggable===!0||e.draggable===b.pointerType){s.didMove=!1,document.addEventListener("pointermove",y),document.addEventListener("pointerup",g);const E=i.current;s.canCloseOnClick=!0,s.canDrag=!0,E.style.transition="none",e.draggableDirection==="x"?(s.start=b.clientX,s.removalDistance=E.offsetWidth*(e.draggablePercent/100)):(s.start=b.clientY,s.removalDistance=E.offsetHeight*(e.draggablePercent===80?1.5*e.draggablePercent:e.draggablePercent)/100)}},onPointerUp:function(b){const{top:E,bottom:C,left:A,right:T}=i.current.getBoundingClientRect();b.nativeEvent.type!=="touchend"&&e.pauseOnHover&&b.clientX>=A&&b.clientX<=T&&b.clientY>=E&&b.clientY<=C?m():l()}};return a&&c&&(v.onMouseEnter=m,e.stacked||(v.onMouseLeave=l)),h&&(v.onClick=b=>{d&&d(b),s.canCloseOnClick&&u()}),{playToast:l,pauseToast:m,isRunning:t,preventExitTransition:r,toastRef:i,eventHandlers:v}}function P3(e){let{delay:t,isRunning:n,closeToast:r,type:o="default",hide:i,className:s,style:a,controlledProgress:c,progress:u,rtl:d,isIn:h,theme:f}=e;const p=i||c&&u===0,l={...a,animationDuration:`${t}ms`,animationPlayState:n?"running":"paused"};c&&(l.transform=`scaleX(${u})`);const m=Lo("Toastify__progress-bar",c?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${f}`,`Toastify__progress-bar--${o}`,{"Toastify__progress-bar--rtl":d}),y=fr(s)?s({rtl:d,type:o,defaultClassName:m}):Lo(m,s),g={[c&&u>=1?"onTransitionEnd":"onAnimationEnd"]:c&&u<1?null:()=>{h&&r()}};return k.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":p},k.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${f} Toastify__progress-bar--${o}`}),k.createElement("div",{role:"progressbar","aria-hidden":p?"true":"false","aria-label":"notification timer",className:y,style:l,...g}))}let R3=1;const r0=()=>""+R3++;function N3(e){return e&&(vi(e.toastId)||ta(e.toastId))?e.toastId:r0()}function ra(e,t){return t0(e,t),t.toastId}function Mc(e,t){return{...t,type:t&&t.type||e,toastId:N3(t)}}function Dc(e){return(t,n)=>ra(t,Mc(e,n))}function Tt(e,t){return ra(e,Mc("default",t))}Tt.loading=(e,t)=>ra(e,Mc("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),Tt.promise=function(e,t,n){let r,{pending:o,error:i,success:s}=t;o&&(r=vi(o)?Tt.loading(o,n):Tt.loading(o.render,{...n,...o}));const a={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},c=(d,h,f)=>{if(h==null)return void Tt.dismiss(r);const p={type:d,...a,...n,data:f},l=vi(h)?{render:h}:h;return r?Tt.update(r,{...p,...l}):Tt(l.render,{...p,...l}),f},u=fr(e)?e():e;return u.then(d=>c("success",s,d)).catch(d=>c("error",i,d)),u},Tt.success=Dc("success"),Tt.info=Dc("info"),Tt.error=Dc("error"),Tt.warning=Dc("warning"),Tt.warn=Tt.warning,Tt.dark=(e,t)=>ra(e,Mc("default",{theme:"dark",...t})),Tt.dismiss=function(e){(function(t){var n;if(Z1()){if(t==null||vi(n=t)||ta(n))jn.forEach(r=>{r.removeToast(t)});else if(t&&("containerId"in t||"id"in t)){const r=jn.get(t.containerId);r?r.removeToast(t.id):jn.forEach(o=>{o.removeToast(t.id)})}}else na=na.filter(r=>t!=null&&r.options.toastId!==t)})(e)},Tt.clearWaitingQueue=function(e){e===void 0&&(e={}),jn.forEach(t=>{!t.props.limit||e.containerId&&t.id!==e.containerId||t.clearQueue()})},Tt.isActive=e0,Tt.update=function(e,t){t===void 0&&(t={});const n=((r,o)=>{var i;let{containerId:s}=o;return(i=jn.get(s||1))==null?void 0:i.toasts.get(r)})(e,t);if(n){const{props:r,content:o}=n,i={delay:100,...r,...t,toastId:t.toastId||e,updateId:r0()};i.toastId!==e&&(i.staleId=e);const s=i.render||o;delete i.render,ra(s,i)}},Tt.done=e=>{Tt.update(e,{progress:1})},Tt.onChange=function(e){return Dd.add(e),()=>{Dd.delete(e)}},Tt.play=e=>n0(!0,e),Tt.pause=e=>n0(!1,e);const B3=typeof window<"u"?k.useLayoutEffect:k.useEffect,Lc=e=>{let{theme:t,type:n,isLoading:r,...o}=e;return k.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:t==="colored"?"currentColor":`var(--toastify-icon-color-${n})`,...o})},Ld={info:function(e){return k.createElement(Lc,{...e},k.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return k.createElement(Lc,{...e},k.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return k.createElement(Lc,{...e},k.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return k.createElement(Lc,{...e},k.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return k.createElement("div",{className:"Toastify__spinner"})}},M3=e=>{const{isRunning:t,preventExitTransition:n,toastRef:r,eventHandlers:o,playToast:i}=O3(e),{closeButton:s,children:a,autoClose:c,onClick:u,type:d,hideProgressBar:h,closeToast:f,transition:p,position:l,className:m,style:y,bodyClassName:g,bodyStyle:v,progressClassName:b,progressStyle:E,updateId:C,role:A,progress:T,rtl:x,toastId:R,deleteToast:B,isIn:F,isLoading:j,closeOnClick:G,theme:H}=e,P=Lo("Toastify__toast",`Toastify__toast-theme--${H}`,`Toastify__toast--${d}`,{"Toastify__toast--rtl":x},{"Toastify__toast--close-on-click":G}),V=fr(m)?m({rtl:x,position:l,type:d,defaultClassName:P}):Lo(P,m),z=function(ce){let{theme:we,type:de,isLoading:Ee,icon:ve}=ce,$=null;const W={theme:we,type:de};return ve===!1||(fr(ve)?$=ve({...W,isLoading:Ee}):k.isValidElement(ve)?$=k.cloneElement(ve,W):Ee?$=Ld.spinner():(Z=>Z in Ld)(de)&&($=Ld[de](W))),$}(e),X=!!T||!c,re={closeToast:f,type:d,theme:H};let oe=null;return s===!1||(oe=fr(s)?s(re):k.isValidElement(s)?k.cloneElement(s,re):function(ce){let{closeToast:we,theme:de,ariaLabel:Ee="close"}=ce;return k.createElement("button",{className:`Toastify__close-button Toastify__close-button--${de}`,type:"button",onClick:ve=>{ve.stopPropagation(),we(ve)},"aria-label":Ee},k.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},k.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}(re)),k.createElement(p,{isIn:F,done:B,position:l,preventExitTransition:n,nodeRef:r,playToast:i},k.createElement("div",{id:R,onClick:u,"data-in":F,className:V,...o,style:y,ref:r},k.createElement("div",{...F&&{role:A},className:fr(g)?g({type:d}):Lo("Toastify__toast-body",g),style:v},z!=null&&k.createElement("div",{className:Lo("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!j})},z),k.createElement("div",null,a)),oe,k.createElement(P3,{...C&&!X?{key:`pb-${C}`}:{},rtl:x,theme:H,delay:c,isRunning:t,isIn:F,closeToast:f,hide:h,type:d,style:E,className:b,controlledProgress:X,progress:T||0})))},Fc=function(e,t){return t===void 0&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},D3=Bc(Fc("bounce",!0));Bc(Fc("slide",!0)),Bc(Fc("zoom")),Bc(Fc("flip"));const L3={position:"top-right",transition:D3,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function F3(e){let t={...L3,...e};const n=e.stacked,[r,o]=k.useState(!0),i=k.useRef(null),{getToastToRender:s,isToastActive:a,count:c}=k3(t),{className:u,style:d,rtl:h,containerId:f}=t;function p(m){const y=Lo("Toastify__toast-container",`Toastify__toast-container--${m}`,{"Toastify__toast-container--rtl":h});return fr(u)?u({position:m,rtl:h,defaultClassName:y}):Lo(y,Nc(u))}function l(){n&&(o(!0),Tt.play())}return B3(()=>{if(n){var m;const y=i.current.querySelectorAll('[data-in="true"]'),g=12,v=(m=t.position)==null?void 0:m.includes("top");let b=0,E=0;Array.from(y).reverse().forEach((C,A)=>{const T=C;T.classList.add("Toastify__toast--stacked"),A>0&&(T.dataset.collapsed=`${r}`),T.dataset.pos||(T.dataset.pos=v?"top":"bot");const x=b*(r?.2:1)+(r?0:g*A);T.style.setProperty("--y",`${v?x:-1*x}px`),T.style.setProperty("--g",`${g}`),T.style.setProperty("--s",""+(1-(r?E:0))),b+=T.offsetHeight,E+=.025})}},[r,c,n]),k.createElement("div",{ref:i,className:"Toastify",id:f,onMouseEnter:()=>{n&&(o(!1),Tt.pause())},onMouseLeave:l},s((m,y)=>{const g=y.length?{...d}:{...d,pointerEvents:"none"};return k.createElement("div",{className:p(m),style:g,key:`container-${m}`},y.map(v=>{let{content:b,props:E}=v;return k.createElement(M3,{...E,stacked:n,collapseAll:l,isIn:a(E.toastId,E.containerId),style:E.style,key:`toast-${E.key}`},b)}))}))}const j3="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_15_20)'%3e%3crect%20width='32'%20height='32'%20rx='4'%20fill='%23E7FBF4'/%3e%3cpath%20d='M10.6668%2017.3333L14.6668%2020L21.3335%2012'%20stroke='%23039855'%20stroke-width='1.6875'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_15_20'%3e%3cpath%20d='M0%2016C0%207.16344%207.16344%200%2016%200V0C24.8366%200%2032%207.16344%2032%2016V16C32%2024.8366%2024.8366%2032%2016%2032V32C7.16344%2032%200%2024.8366%200%2016V16Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",V3="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_17_95)'%3e%3crect%20width='32'%20height='32'%20rx='4'%20fill='%23FEF3F2'/%3e%3cpath%20d='M12.0003%2012L20.0003%2020M12.0003%2020L20.0003%2012'%20stroke='%23E02731'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_17_95'%3e%3cpath%20d='M0%2016C0%207.16344%207.16344%200%2016%200V0C24.8366%200%2032%207.16344%2032%2016V16C32%2024.8366%2024.8366%2032%2016%2032V32C7.16344%2032%200%2024.8366%200%2016V16Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",U3="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_17_99)'%3e%3crect%20width='32'%20height='32'%20rx='4'%20fill='%23FFFAEB'/%3e%3cpath%20d='M16.0002%2017.3333V13.3333M16.0002%2020V20.0067M23.0353%2019.3333L17.942%2010.456C17.0833%208.95867%2014.9167%208.95867%2014.058%2010.456L8.96533%2019.3333C8.11266%2020.8187%209.18933%2022.6667%2010.9073%2022.6667H21.0933C22.8107%2022.6667%2023.8873%2020.8187%2023.0353%2019.3333Z'%20stroke='%23CFAA25'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_17_99'%3e%3cpath%20d='M0%2016C0%207.16344%207.16344%200%2016%200C24.8366%200%2032%207.16344%2032%2016C32%2024.8366%2024.8366%2032%2016%2032C7.16344%2032%200%2024.8366%200%2016Z'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";function H3(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&(t[0]=`react-i18next:: ${t[0]}`),console.warn(...t)}}const o0={};function Fd(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&o0[t[0]]||(typeof t[0]=="string"&&(o0[t[0]]=new Date),H3(...t))}const i0=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function s0(e,t,n){e.loadNamespaces(t,i0(e,n))}function a0(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,i0(e,r))}function G3(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],o=t.options?t.options.fallbackLng:!1,i=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const s=(a,c)=>{const u=t.services.backendConnector.state[`${a}|${c}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!s(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||s(r,e)&&(!o||s(i,e)))}function q3(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(Fd("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(o,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!i(o.isLanguageChangingTo,e))return!1}}):G3(e,t,n)}const $3=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,W3={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Y3=e=>W3[e];let jd={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace($3,Y3)};function z3(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};jd={...jd,...e}}function K3(){return jd}let c0;function X3(e){c0=e}function Q3(){return c0}const J3={type:"3rdParty",init(e){z3(e.options.react),X3(e)}},Z3=k.createContext();class eC{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const tC=(e,t)=>{const n=k.useRef();return k.useEffect(()=>{n.current=e},[e,t]),n.current};function u0(e,t,n,r){return e.getFixedT(t,n,r)}function nC(e,t,n,r){return k.useCallback(u0(e,t,n,r),[e,t,n,r])}function $e(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:o}=k.useContext(Z3)||{},i=n||r||Q3();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new eC),!i){Fd("You will need to pass in an i18next instance by using initReactI18next");const E=(A,T)=>typeof T=="string"?T:T&&typeof T=="object"&&typeof T.defaultValue=="string"?T.defaultValue:Array.isArray(A)?A[A.length-1]:A,C=[E,{},!1];return C.t=E,C.i18n={},C.ready=!1,C}i.options.react&&i.options.react.wait!==void 0&&Fd("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...K3(),...i.options.react,...t},{useSuspense:a,keyPrefix:c}=s;let u=o||i.options&&i.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(u);const d=(i.isInitialized||i.initializedStoreOnce)&&u.every(E=>q3(E,i,s)),h=nC(i,t.lng||null,s.nsMode==="fallback"?u:u[0],c),f=()=>h,p=()=>u0(i,t.lng||null,s.nsMode==="fallback"?u:u[0],c),[l,m]=k.useState(f);let y=u.join();t.lng&&(y=`${t.lng}${y}`);const g=tC(y),v=k.useRef(!0);k.useEffect(()=>{const{bindI18n:E,bindI18nStore:C}=s;v.current=!0,!d&&!a&&(t.lng?a0(i,t.lng,u,()=>{v.current&&m(p)}):s0(i,u,()=>{v.current&&m(p)})),d&&g&&g!==y&&v.current&&m(p);function A(){v.current&&m(p)}return E&&i&&i.on(E,A),C&&i&&i.store.on(C,A),()=>{v.current=!1,E&&i&&E.split(" ").forEach(T=>i.off(T,A)),C&&i&&C.split(" ").forEach(T=>i.store.off(T,A))}},[i,y]),k.useEffect(()=>{v.current&&d&&m(f)},[i,c,d]);const b=[l,i,d];if(b.t=l,b.i18n=i,b.ready=d,d||!d&&!a)return b;throw new Promise(E=>{t.lng?a0(i,t.lng,u,()=>E()):s0(i,u,()=>E())})}function tn(){const{t:e}=$e(),n={closeButton:!1,icon:a=>a.type==="success"?w.jsx("img",{src:j3,alt:"success"}):a.type==="error"?w.jsx("img",{src:V3,alt:"error"}):w.jsx("img",{src:U3,alt:"warning"})},r=(a,c)=>{if(a==="success")return o(c);s(c)},o=(a=e("success"),c={})=>{Tt.success(a,{...n,...c})},i=(a=e("warning"))=>{Tt.warning(a,n)},s=(a=e("somethingWentWrong"))=>{var d,h;const c=(d=a.response)==null?void 0:d.data.errors,u=w.jsxs("div",{children:[w.jsx("p",{children:(h=a.response)==null?void 0:h.data.message}),c&&Object.keys(c).map(f=>c[f].map(p=>w.jsx("li",{children:p},p)))]});Tt.error(u,n)};return{toast:r,successToast:o,warningToast:i,errorToast:s}}const _r=e=>{const t=Gt(),{errorToast:n}=tn(),r=u=>t.get(u,e.params),{data:o,error:i,isLoading:s,isValidating:a,mutate:c}=n4(e.url,r,{shouldRetryOnError:!1,revalidateIfStale:!1});return k.useEffect(()=>{o&&e.onData&&e.onData(o==null?void 0:o.data.data,o==null?void 0:o.data.meta)},[o]),k.useEffect(()=>{i&&n(i)},[i]),{data:o,pending:a,error:i,isLoading:s,isValidating:a,mutate:c}};var l0=(e=>(e[e.CREDIT_RECEPTION=1]="CREDIT_RECEPTION",e[e.PHYSICAL_REWARD_RECEPTION=2]="PHYSICAL_REWARD_RECEPTION",e[e.DIGITAL_REWARD_RECEPTION=3]="DIGITAL_REWARD_RECEPTION",e))(l0||{}),zi=(e=>(e.IDENTIFIER="identifier",e.EMAIL="email",e))(zi||{}),d0=(e=>(e.OPT_OUT="OPT_OUT",e.OPT_IN="OPT_IN",e.DOUBLE_OPT_IN="DOUBLE_OPT_IN",e.FUNCTIONAL="FUNCTIONAL",e))(d0||{}),oa=(e=>(e.INACTIVE="INACTIVE",e.ACTIVE="ACTIVE",e.EXPIRED="EXPIRED",e.LOCKED="LOCKED",e.REDEEMED="REDEEMED",e.DEACTIVATED="DEACTIVATED",e))(oa||{});function f0({uuid:e,children:t}){const[n,r]=k.useState(new bc),{mutate:o,error:i}=_r({url:e,onData:a=>{const c=new bc;c.type=a.type,c.uuid=a.uuid,c.contact=a.contact,c.currency=a.currency,c.events=a.events,c.inputData=a.input_data,c.loyaltyProgram=a.loyalty_program,c.results=a.results,r(c)}}),s=k.useMemo(()=>({uuid:e,portalSession:n,mutate:o,error:i}),[n,o,i]);return w.jsx(Zp.Provider,{value:s,children:t})}var nn=(e=>(e.GENERIC="GENERIC",e.GIFTCARD="GIFTCARD",e.REDEEM_GIFTCARD="REDEEM_GIFTCARD",e.TOP_UP_GIFTCARD="TOP_UP_GIFTCARD",e.PORTAL="PORTAL",e.PREPAID="PREPAID",e.PAY_PREPAID="PAY_PREPAID",e.TOP_UP_PREPAID="TOP_UP_PREPAID",e.POINTS_TRANSACTION="POINTS_TRANSACTION",e.VOUCHER="VOUCHER",e))(nn||{}),je=(e=>(e.GENERIC="/generic",e.GIFTCARD="/giftcard",e.PORTAL="/portal",e.PREPAID="/prepaid",e.PAY_PREPAID="/pay-prepaid",e.TOP_UP_PREPAID="/top-up-prepaid",e.POINTS_TRANSACTION="/points-transaction",e.VOUCHER="/voucher",e))(je||{}),Fo=(e=>(e.CREDIT_RECEPTION="credit_reception",e.GIFTCARD_TRANSACTION="giftcard_transaction",e.VOUCHER_REDEEMED="voucher_redeemed",e.REWARD_RECEPTION="reward_reception",e.PREPAID_TRANSACTION="prepaid_transaction",e))(Fo||{}),jc=(e=>(e[e.INPUT_INVALID=1003]="INPUT_INVALID",e[e.CONTACT_NOT_FOUND=55031]="CONTACT_NOT_FOUND",e))(jc||{}),Zn=(e=>(e.USER="user",e.ENVIRONMENT="environment",e))(Zn||{});const rC={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class Vc{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||rC,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,o){return o&&!this.debug?null:(typeof t[0]=="string"&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Vc(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Vc(this.logger,t)}}var Qr=new Vc;class Uc{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(n)||0;this.observers[r].set(n,o+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(s=>{let[a,c]=s;for(let u=0;u<c;u++)a(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(s=>{let[a,c]=s;for(let u=0;u<c;u++)a.apply(a,[t,...r])})}}function ia(){let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n}function h0(e){return e==null?"":""+e}function oC(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}const iC=/###/g;function sa(e,t,n){function r(a){return a&&a.indexOf("###")>-1?a.replace(iC,"."):a}function o(){return!e||typeof e=="string"}const i=typeof t!="string"?t:t.split(".");let s=0;for(;s<i.length-1;){if(o())return{};const a=r(i[s]);!e[a]&&n&&(e[a]=new n),Object.prototype.hasOwnProperty.call(e,a)?e=e[a]:e={},++s}return o()?{}:{obj:e,k:r(i[s])}}function p0(e,t,n){const{obj:r,k:o}=sa(e,t,Object);if(r!==void 0||t.length===1){r[o]=n;return}let i=t[t.length-1],s=t.slice(0,t.length-1),a=sa(e,s,Object);for(;a.obj===void 0&&s.length;)i=`${s[s.length-1]}.${i}`,s=s.slice(0,s.length-1),a=sa(e,s,Object),a&&a.obj&&typeof a.obj[`${a.k}.${i}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${i}`]=n}function sC(e,t,n,r){const{obj:o,k:i}=sa(e,t,Object);o[i]=o[i]||[],o[i].push(n)}function Hc(e,t){const{obj:n,k:r}=sa(e,t);if(n)return n[r]}function aC(e,t,n){const r=Hc(e,n);return r!==void 0?r:Hc(t,n)}function m0(e,t,n){for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):m0(e[r],t[r],n):e[r]=t[r]);return e}function Ki(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var cC={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function uC(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>cC[t]):e}class lC{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const dC=[" ",",","?","!",";"],fC=new lC(20);function hC(e,t,n){t=t||"",n=n||"";const r=dC.filter(s=>t.indexOf(s)<0&&n.indexOf(s)<0);if(r.length===0)return!0;const o=fC.getRegExp(`(${r.map(s=>s==="?"?"\\?":s).join("|")})`);let i=!o.test(e);if(!i){const s=e.indexOf(n);s>0&&!o.test(e.substring(0,s))&&(i=!0)}return i}function Vd(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let o=e;for(let i=0;i<r.length;){if(!o||typeof o!="object")return;let s,a="";for(let c=i;c<r.length;++c)if(c!==i&&(a+=n),a+=r[c],s=o[a],s!==void 0){if(["string","number","boolean"].indexOf(typeof s)>-1&&c<r.length-1)continue;i+=c-i+1;break}o=s}return o}function Gc(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class g0 extends Uc{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,s=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;t.indexOf(".")>-1?a=t.split("."):(a=[t,n],r&&(Array.isArray(r)?a.push(...r):typeof r=="string"&&i?a.push(...r.split(i)):a.push(r)));const c=Hc(this.data,a);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=a[0],n=a[1],r=a.slice(2).join(".")),c||!s||typeof r!="string"?c:Vd(this.data&&this.data[t]&&this.data[t][n],r,i)}addResource(t,n,r,o){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(s?r.split(s):r)),t.indexOf(".")>-1&&(a=t.split("."),o=n,n=a[1]),this.addNamespaces(n),p0(this.data,a,o),i.silent||this.emit("added",t,n,r,o)}addResources(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in r)(typeof r[i]=="string"||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});o.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,o,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),o=r,r=n,n=a[1]),this.addNamespaces(n);let c=Hc(this.data,a)||{};s.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?m0(c,r,i):c={...c,...r},p0(this.data,a,c),s.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(o=>n[o]&&Object.keys(n[o]).length>0)}toJSON(){return this.data}}var y0={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,o){return e.forEach(i=>{this.processors[i]&&(t=this.processors[i].process(t,n,r,o))}),t}};const v0={};class qc extends Uc{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),oC(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Qr.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const s=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!hC(t,r,o);if(s&&!a){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:i};const u=t.split(r);(r!==o||r===o&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),t=u.join(o)}return typeof i=="string"&&(i=[i]),{key:t,namespaces:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const o=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:s,namespaces:a}=this.extractFromKey(t[t.length-1],n),c=a[a.length-1],u=n.lng||this.language,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(d){const E=n.nsSeparator||this.options.nsSeparator;return o?{res:`${c}${E}${s}`,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${E}${s}`}return o?{res:s,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:s}const h=this.resolve(t,n);let f=h&&h.res;const p=h&&h.usedKey||s,l=h&&h.exactUsedKey||s,m=Object.prototype.toString.apply(f),y=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&y.indexOf(m)<0&&!(typeof g=="string"&&Array.isArray(f))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const E=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,f,{...n,ns:a}):`key '${s} (${this.language})' returned an object instead of string.`;return o?(h.res=E,h.usedParams=this.getUsedParamsDetails(n),h):E}if(i){const E=Array.isArray(f),C=E?[]:{},A=E?l:p;for(const T in f)if(Object.prototype.hasOwnProperty.call(f,T)){const x=`${A}${i}${T}`;C[T]=this.translate(x,{...n,joinArrays:!1,ns:a}),C[T]===x&&(C[T]=f[T])}f=C}}else if(v&&typeof g=="string"&&Array.isArray(f))f=f.join(g),f&&(f=this.extendTranslation(f,t,n,r));else{let E=!1,C=!1;const A=n.count!==void 0&&typeof n.count!="string",T=qc.hasDefaultValue(n),x=A?this.pluralResolver.getSuffix(u,n.count,n):"",R=n.ordinal&&A?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",B=A&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),F=B&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${x}`]||n[`defaultValue${R}`]||n.defaultValue;!this.isValidLookup(f)&&T&&(E=!0,f=F),this.isValidLookup(f)||(C=!0,f=s);const G=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:f,H=T&&F!==f&&this.options.updateMissing;if(C||E||H){if(this.logger.log(H?"updateKey":"missingKey",u,c,s,H?F:f),i){const X=this.resolve(s,{...n,keySeparator:!1});X&&X.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 P=[];const V=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&V&&V[0])for(let X=0;X<V.length;X++)P.push(V[X]);else this.options.saveMissingTo==="all"?P=this.languageUtils.toResolveHierarchy(n.lng||this.language):P.push(n.lng||this.language);const z=(X,re,oe)=>{const ce=T&&oe!==f?oe:G;this.options.missingKeyHandler?this.options.missingKeyHandler(X,c,re,ce,H,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(X,c,re,ce,H,n),this.emit("missingKey",X,c,re,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&A?P.forEach(X=>{const re=this.pluralResolver.getSuffixes(X,n);B&&n[`defaultValue${this.options.pluralSeparator}zero`]&&re.indexOf(`${this.options.pluralSeparator}zero`)<0&&re.push(`${this.options.pluralSeparator}zero`),re.forEach(oe=>{z([X],s+oe,n[`defaultValue${oe}`]||F)})}):z(P,s,F))}f=this.extendTranslation(f,t,n,h,r),C&&f===s&&this.options.appendNamespaceToMissingKey&&(f=`${c}:${s}`),(C||E)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${s}`:s,E?f:void 0):f=this.options.parseMissingKeyHandler(f))}return o?(h.res=f,h.usedParams=this.getUsedParamsDetails(n),h):f}extendTranslation(t,n,r,o,i){var s=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(u){const f=t.match(this.interpolator.nestingRegexp);d=f&&f.length}let h=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(h={...this.options.interpolation.defaultVariables,...h}),t=this.interpolator.interpolate(t,h,r.lng||this.language,r),u){const f=t.match(this.interpolator.nestingRegexp),p=f&&f.length;d<p&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&o&&o.res&&(r.lng=o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var f=arguments.length,p=new Array(f),l=0;l<f;l++)p[l]=arguments[l];return i&&i[0]===p[0]&&!r.context?(s.logger.warn(`It seems you are nesting recursively key: ${p[0]} in key: ${n[0]}`),null):s.translate(...p,n)},r)),r.interpolation&&this.interpolator.reset()}const a=r.postProcess||this.options.postProcess,c=typeof a=="string"?[a]:a;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=y0.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,o,i,s,a;return typeof t=="string"&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(c,n),d=u.key;o=d;let h=u.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",p=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),l=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);h.forEach(y=>{this.isValidLookup(r)||(a=y,!v0[`${m[0]}-${y}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(v0[`${m[0]}-${y}`]=!0,this.logger.warn(`key "${o}" for languages "${m.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(g=>{if(this.isValidLookup(r))return;s=g;const v=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,d,g,y,n);else{let E;f&&(E=this.pluralResolver.getSuffix(g,n.count,n));const C=`${this.options.pluralSeparator}zero`,A=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(d+E),n.ordinal&&E.indexOf(A)===0&&v.push(d+E.replace(A,this.options.pluralSeparator)),p&&v.push(d+C)),l){const T=`${d}${this.options.contextSeparator}${n.context}`;v.push(T),f&&(v.push(T+E),n.ordinal&&E.indexOf(A)===0&&v.push(T+E.replace(A,this.options.pluralSeparator)),p&&v.push(T+C))}}let b;for(;b=v.pop();)this.isValidLookup(r)||(i=b,r=this.getResource(g,y,b,n))}))})}),{res:r,usedKey:o,exactUsedKey:i,usedLng:s,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,o):this.resourceStore.getResource(t,n,r,o)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&typeof t.replace!="string";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 i of n)delete o[i]}return o}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function Ud(e){return e.charAt(0).toUpperCase()+e.slice(1)}class w0{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Qr.create("languageUtils")}getScriptPartFromCode(t){if(t=Gc(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Gc(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(o=>o.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Ud(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Ud(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Ud(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(n=o)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const o=this.getLanguagePartFromCode(r);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(i=>{if(i===o)return i;if(!(i.indexOf("-")<0&&o.indexOf("-")<0)&&(i.indexOf("-")>0&&o.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===o||i.indexOf(o)===0&&o.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),o=[],i=s=>{s&&(this.isSupportedCode(s)?o.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):typeof t=="string"&&i(this.formatLanguageCode(t)),r.forEach(s=>{o.indexOf(s)<0&&i(this.formatLanguageCode(s))}),o}}let pC=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],mC={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const gC=["v1","v2","v3"],yC=["v4"],b0={zero:0,one:1,two:2,few:3,many:4,other:5};function vC(){const e={};return pC.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:mC[t.fc]}})}),e}class wC{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Qr.create("pluralResolver"),(!this.options.compatibilityJSON||yC.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=vC()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(Gc(t==="dev"?"en":t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(o=>`${n}${o}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((o,i)=>b0[o]-b0[i]).map(o=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${o}`):r.numbers.map(o=>this.getSuffix(t,o,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const o=this.getRule(t,r);return o?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(n)}`:this.getSuffixRetroCompatible(o,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let o=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(o===2?o="plural":o===1&&(o=""));const i=()=>this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString();return this.options.compatibilityJSON==="v1"?o===1?"":typeof o=="number"?`_plural_${o.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?i():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!gC.includes(this.options.compatibilityJSON)}}function E0(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=aC(e,t,n);return!i&&o&&typeof n=="string"&&(i=Vd(e,n,r),i===void 0&&(i=Vd(t,n,r))),i}class bC{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Qr.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:o,prefix:i,prefixEscaped:s,suffix:a,suffixEscaped:c,formatSeparator:u,unescapeSuffix:d,unescapePrefix:h,nestingPrefix:f,nestingPrefixEscaped:p,nestingSuffix:l,nestingSuffixEscaped:m,nestingOptionsSeparator:y,maxReplaces:g,alwaysFormat:v}=t.interpolation;this.escape=n!==void 0?n:uC,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=i?Ki(i):s||"{{",this.suffix=a?Ki(a):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=d?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=f?Ki(f):p||Ki("$t("),this.nestingSuffix=l?Ki(l):m||Ki(")"),this.nestingOptionsSeparator=y||",",this.maxReplaces=g||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,o){let i,s,a;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(l){return l.replace(/\$/g,"$$$$")}const d=l=>{if(l.indexOf(this.formatSeparator)<0){const v=E0(n,c,l,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(v,void 0,r,{...o,...n,interpolationkey:l}):v}const m=l.split(this.formatSeparator),y=m.shift().trim(),g=m.join(this.formatSeparator).trim();return this.format(E0(n,c,y,this.options.keySeparator,this.options.ignoreJSONStructure),g,r,{...o,...n,interpolationkey:y})};this.resetRegExp();const h=o&&o.missingInterpolationHandler||this.options.missingInterpolationHandler,f=o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:l=>u(l)},{regex:this.regexp,safeValue:l=>this.escapeValue?u(this.escape(l)):u(l)}].forEach(l=>{for(a=0;i=l.regex.exec(t);){const m=i[1].trim();if(s=d(m),s===void 0)if(typeof h=="function"){const g=h(t,i,o);s=typeof g=="string"?g:""}else if(o&&Object.prototype.hasOwnProperty.call(o,m))s="";else if(f){s=i[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),s="";else typeof s!="string"&&!this.useRawValueToEscape&&(s=h0(s));const y=l.safeValue(s);if(t=t.replace(i[0],y),f?(l.regex.lastIndex+=s.length,l.regex.lastIndex-=i[0].length):l.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,i,s;function a(c,u){const d=this.nestingOptionsSeparator;if(c.indexOf(d)<0)return c;const h=c.split(new RegExp(`${d}[ ]*{`));let f=`{${h[1]}`;c=h[0],f=this.interpolate(f,s);const p=f.match(/'/g),l=f.match(/"/g);(p&&p.length%2===0&&!l||l.length%2!==0)&&(f=f.replace(/'/g,'"'));try{s=JSON.parse(f),u&&(s={...u,...s})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,m),`${c}${d}${f}`}return s.defaultValue&&s.defaultValue.indexOf(this.prefix)>-1&&delete s.defaultValue,c}for(;o=this.nestingRegexp.exec(t);){let c=[];s={...r},s=s.replace&&typeof s.replace!="string"?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let u=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){const d=o[1].split(this.formatSeparator).map(h=>h.trim());o[1]=d.shift(),c=d,u=!0}if(i=n(a.call(this,o[1].trim(),s),s),i&&o[0]===t&&typeof i!="string")return i;typeof i!="string"&&(i=h0(i)),i||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),i=""),u&&(i=c.reduce((d,h)=>this.format(d,h,r.lng,{...r,interpolationkey:o[1].trim()}),i.trim())),t=t.replace(o[0],i),this.regexp.lastIndex=0}return t}}function EC(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);t==="currency"&&o.indexOf(":")<0?n.currency||(n.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?n.range||(n.range=o.trim()):o.split(";").forEach(s=>{if(s){const[a,...c]=s.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),d=a.trim();n[d]||(n[d]=u),u==="false"&&(n[d]=!1),u==="true"&&(n[d]=!0),isNaN(u)||(n[d]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}}function Xi(e){const t={};return function(r,o,i){const s=o+JSON.stringify(i);let a=t[s];return a||(a=e(Gc(o),i),t[s]=a),a(r)}}class CC{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Qr.create("formatter"),this.options=t,this.formats={number:Xi((n,r)=>{const o=new Intl.NumberFormat(n,{...r});return i=>o.format(i)}),currency:Xi((n,r)=>{const o=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>o.format(i)}),datetime:Xi((n,r)=>{const o=new Intl.DateTimeFormat(n,{...r});return i=>o.format(i)}),relativetime:Xi((n,r)=>{const o=new Intl.RelativeTimeFormat(n,{...r});return i=>o.format(i,r.range||"day")}),list:Xi((n,r)=>{const o=new Intl.ListFormat(n,{...r});return i=>o.format(i)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Xi(n)}format(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((a,c)=>{const{formatName:u,formatOptions:d}=EC(c);if(this.formats[u]){let h=a;try{const f=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},p=f.locale||f.lng||o.locale||o.lng||r;h=this.formats[u](a,p,{...d,...o,...f})}catch(f){this.logger.warn(f)}return h}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}function _C(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class SC extends Uc{constructor(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=o,this.logger=Qr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,o.backend,o)}queueLoad(t,n,r,o){const i={},s={},a={},c={};return t.forEach(u=>{let d=!0;n.forEach(h=>{const f=`${u}|${h}`;!r.reload&&this.store.hasResourceBundle(u,h)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?s[f]===void 0&&(s[f]=!0):(this.state[f]=1,d=!1,s[f]===void 0&&(s[f]=!0),i[f]===void 0&&(i[f]=!0),c[h]===void 0&&(c[h]=!0)))}),d||(a[u]=!0)}),(Object.keys(i).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(i),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const o=t.split("|"),i=o[0],s=o[1];n&&this.emit("failedLoading",i,s,n),r&&this.store.addResourceBundle(i,s,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2;const a={};this.queue.forEach(c=>{sC(c.loaded,[i],s),_C(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{a[u]||(a[u]={});const d=c.loaded[u];d.length&&d.forEach(h=>{a[u][h]===void 0&&(a[u][h]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;if(!t.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:o,wait:i,callback:s});return}this.readingCalls++;const a=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(u&&d&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,o+1,i*2,s)},i);return}s(u,d)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const u=c(t,n);u&&typeof u.then=="function"?u.then(d=>a(null,d)).catch(a):a(null,u)}catch(u){a(u)}return}return c(t,n,a)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const i=this.queueLoad(t,n,r,o);if(!i.toLoad.length)return i.pending.length||o(),null;i.toLoad.forEach(s=>{this.loadOne(s)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),o=r[0],i=r[1];this.read(o,i,"read",void 0,void 0,(s,a)=>{s&&this.logger.warn(`${n}loading namespace ${i} for language ${o} failed`,s),!s&&a&&this.logger.log(`${n}loaded namespace ${i} for language ${o}`,a),this.loaded(t,s,a)})}saveMissing(t,n,r,o,i){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const c={...s,isUpdate:i},u=this.backend.create.bind(this.backend);if(u.length<6)try{let d;u.length===5?d=u(t,n,r,o,c):d=u(t,n,r,o),d&&typeof d.then=="function"?d.then(h=>a(null,h)).catch(a):a(null,d)}catch(d){a(d)}else u(t,n,r,o,a,c)}!t||!t[0]||this.store.addResource(t[0],n,r,o)}}}function C0(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(o=>{n[o]=r[o]})}return n},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function _0(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function $c(){}function AC(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class aa extends Uc{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=_0(t),this.services={},this.logger=Qr,this.modules={external:[]},AC(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const o=C0();this.options={...o,...this.options,..._0(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...o.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function i(d){return d?typeof d=="function"?new d:d:null}if(!this.options.isClone){this.modules.logger?Qr.init(i(this.modules.logger),this.options):Qr.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=CC);const h=new w0(this.options);this.store=new g0(this.options.resources,this.options);const f=this.services;f.logger=Qr,f.resourceStore=this.store,f.languageUtils=h,f.pluralResolver=new wC(h,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(f.formatter=i(d),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new bC(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new SC(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(p){for(var l=arguments.length,m=new Array(l>1?l-1:0),y=1;y<l;y++)m[y-1]=arguments[y];t.emit(p,...m)}),this.modules.languageDetector&&(f.languageDetector=i(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=i(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new qc(this.services,this.options),this.translator.on("*",function(p){for(var l=arguments.length,m=new Array(l>1?l-1:0),y=1;y<l;y++)m[y-1]=arguments[y];t.emit(p,...m)}),this.modules.external.forEach(p=>{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,r||(r=$c),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[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(d=>{this[d]=function(){return t.store[d](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=function(){return t.store[d](...arguments),t}});const c=ia(),u=()=>{const d=(h,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(f),r(h,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$c;const o=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(o&&o.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],s=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{u!=="cimode"&&i.indexOf(u)<0&&i.push(u)})};o?s(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>s(c)),this.options.preload&&this.options.preload.forEach(a=>s(a)),this.services.backendConnector.load(i,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const o=ia();return t||(t=this.languages),n||(n=this.options.ns),r||(r=$c),this.services.backendConnector.reload(t,n,i=>{o.resolve(),r(i)}),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"&&y0.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const o=ia();this.emit("languageChanging",t);const i=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},s=(c,u)=>{u?(i(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,o.resolve(function(){return r.t(...arguments)}),n&&n(c,function(){return r.t(...arguments)})},a=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const u=typeof c=="string"?c:this.services.languageUtils.getBestMatchFromCodes(c);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,d=>{s(d,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),o}getFixedT(t,n,r){var o=this;const i=function(s,a){let c;if(typeof a!="object"){for(var u=arguments.length,d=new Array(u>2?u-2:0),h=2;h<u;h++)d[h-2]=arguments[h];c=o.options.overloadTranslationOptionHandler([s,a].concat(d))}else c={...a};c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix=c.keyPrefix||r||i.keyPrefix;const f=o.options.keySeparator||".";let p;return c.keyPrefix&&Array.isArray(s)?p=s.map(l=>`${c.keyPrefix}${f}${l}`):p=c.keyPrefix?`${c.keyPrefix}${f}${s}`:s,o.t(p,c)};return typeof t=="string"?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const s=(a,c)=>{const u=this.services.backendConnector.state[`${a}|${c}`];return u===-1||u===2};if(n.precheck){const a=n.precheck(this,s);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(r,t)&&(!o||s(i,t)))}loadNamespaces(t,n){const r=ia();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=ia();typeof t=="string"&&(t=[t]);const o=this.options.preload||[],i=t.filter(s=>o.indexOf(s)<0&&this.services.languageUtils.isSupportedCode(s));return i.length?(this.options.preload=o.concat(i),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new w0(C0());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new aa(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$c;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},i=new aa(o);return(t.debug!==void 0||t.prefix!==void 0)&&(i.logger=i.logger.clone(t)),["store","services","language"].forEach(a=>{i[a]=this[a]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r&&(i.store=new g0(this.store.data,o),i.services.resourceStore=i.store),i.translator=new qc(i.services,o),i.translator.on("*",function(a){for(var c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];i.emit(a,...u)}),i.init(o,n),i.translator.options=o,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ln=aa.createInstance();ln.createInstance=aa.createInstance,ln.createInstance,ln.dir,ln.init,ln.loadResources,ln.reloadResources,ln.use,ln.changeLanguage,ln.getFixedT,ln.t,ln.exists,ln.setDefaultNamespace,ln.hasLoadedNamespace,ln.loadNamespaces,ln.loadLanguages;const Qi=(e,t="EUR")=>new Intl.NumberFormat(ln.language,{style:"currency",currency:t??"EUR"}).format(e/100),IC=e=>0 .toLocaleString(ln.language,{style:"currency",currency:e??"EUR",minimumFractionDigits:0,maximumFractionDigits:0}).replace(/\d/g,"").trim(),TC=e=>{window.parent.postMessage(e,"*")},S0=(e,t)=>Math.abs(Math.round((t.getTime()-e.getTime())/(1e3*3600*24))),A0=(e,t)=>Math.abs(Math.round((t.getTime()-e.getTime())/(1e3*3600*24*7))),I0=(e,t)=>Math.abs(Math.round((t.getTime()-e.getTime())/(1e3*3600*24*365.25)));function xC(e){const{errorToast:t}=tn(),[n,r]=k.useState(),o=Gt(),i=()=>{const a={type:e.type??nn.PORTAL,api_key:e.apiKey,shop_uuid:e.shopUuid,contact_uuid:e.contactUuid};return e.cameraService&&(a.camera_service=e.cameraService),e.cameraFacingMode&&(a.facing_mode=e.cameraFacingMode),e.amountInCents&&(a.amount_in_cents=e.amountInCents),e.allowMultipleGiftcards&&(a.allow_multiple_giftcards=e.allowMultipleGiftcards),e.enableRegistration&&(a.enable_registration=e.enableRegistration),e.enableEmailIdentification&&(a.enable_email_identification=e.enableEmailIdentification),e.enableOnScreenKeyboard&&(a.enable_on_screen_keyboard=e.enableOnScreenKeyboard),e.primaryIdentificationMethod&&(a.primary_identification_method=e.primaryIdentificationMethod),a},s=()=>{o.post("/",i(),{baseURL:`${e.host}/api/v1/portal-sessions`,headers:{Authorization:`Bearer ${e.apiKey}`}}).then(a=>{const c=new bc;c.type=a.data.data.type,c.uuid=a.data.data.uuid,c.contact=a.data.data.contact,c.currency=a.data.data.currency,c.events=a.data.data.events,c.inputData=a.data.data.input_data,c.loyaltyProgram=a.data.data.loyalty_program,c.results=a.data.data.results,r(c)}).catch(t)};return k.useEffect(()=>s(),[]),{portalSession:n}}var T0={exports:{}};/*!
|
|
52
52
|
Copyright (c) 2018 Jed Watson.
|
|
53
53
|
Licensed under the MIT License (MIT), see
|
|
54
54
|
http://jedwatson.github.io/classnames
|
|
@@ -154,7 +154,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
154
154
|
matrix: null
|
|
155
155
|
`),t.append(`>>
|
|
156
156
|
`),t.toString()},e.prototype.setMode=function(t){this.mode=t},e.prototype.setECLevel=function(t){this.ecLevel=t},e.prototype.setVersion=function(t){this.version=t},e.prototype.setMaskPattern=function(t){this.maskPattern=t},e.prototype.setMatrix=function(t){this.matrix=t},e.isValidMaskPattern=function(t){return t>=0&&t<e.NUM_MASK_PATTERNS},e.NUM_MASK_PATTERNS=8,e}(),cB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ji=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return cB(t,e),t.kind="WriterException",t}(or);(function(){function e(){}return e.clearMatrix=function(t){t.clear(255)},e.buildMatrix=function(t,n,r,o,i){e.clearMatrix(i),e.embedBasicPatterns(r,i),e.embedTypeInfo(n,o,i),e.maybeEmbedVersionInfo(r,i),e.embedDataBits(t,o,i)},e.embedBasicPatterns=function(t,n){e.embedPositionDetectionPatternsAndSeparators(n),e.embedDarkDotAtLeftBottomCorner(n),e.maybeEmbedPositionAdjustmentPatterns(t,n),e.embedTimingPatterns(n)},e.embedTypeInfo=function(t,n,r){var o=new ao;e.makeTypeInfoBits(t,n,o);for(var i=0,s=o.getSize();i<s;++i){var a=o.get(o.getSize()-1-i),c=e.TYPE_INFO_COORDINATES[i],u=c[0],d=c[1];if(r.setBoolean(u,d,a),i<8){var h=r.getWidth()-i-1,f=8;r.setBoolean(h,f,a)}else h=8,f=r.getHeight()-7+(i-8),r.setBoolean(h,f,a)}},e.maybeEmbedVersionInfo=function(t,n){if(!(t.getVersionNumber()<7)){var r=new ao;e.makeVersionInfoBits(t,r);for(var o=17,i=0;i<6;++i)for(var s=0;s<3;++s){var a=r.get(o);o--,n.setBoolean(i,n.getHeight()-11+s,a),n.setBoolean(n.getHeight()-11+s,i,a)}}},e.embedDataBits=function(t,n,r){for(var o=0,i=-1,s=r.getWidth()-1,a=r.getHeight()-1;s>0;){for(s===6&&(s-=1);a>=0&&a<r.getHeight();){for(var c=0;c<2;++c){var u=s-c;if(e.isEmpty(r.get(u,a))){var d=void 0;o<t.getSize()?(d=t.get(o),++o):d=!1,n!==255&&sB.getDataMaskBit(n,u,a)&&(d=!d),r.setBoolean(u,a,d)}}a+=i}a+=i=-i,s-=2}if(o!==t.getSize())throw new ji("Not all bits consumed: "+o+"/"+t.getSize())},e.findMSBSet=function(t){return 32-Rn.numberOfLeadingZeros(t)},e.calculateBCHCode=function(t,n){if(n===0)throw new Ge("0 polynomial");var r=e.findMSBSet(n);for(t<<=r-1;e.findMSBSet(t)>=r;)t^=n<<e.findMSBSet(t)-r;return t},e.makeTypeInfoBits=function(t,n,r){if(!aB.isValidMaskPattern(n))throw new ji("Invalid mask pattern");var o=t.getBits()<<3|n;r.appendBits(o,5);var i=e.calculateBCHCode(o,e.TYPE_INFO_POLY);r.appendBits(i,10);var s=new ao;if(s.appendBits(e.TYPE_INFO_MASK_PATTERN,15),r.xor(s),r.getSize()!==15)throw new ji("should not happen but we got: "+r.getSize())},e.makeVersionInfoBits=function(t,n){n.appendBits(t.getVersionNumber(),6);var r=e.calculateBCHCode(t.getVersionNumber(),e.VERSION_INFO_POLY);if(n.appendBits(r,12),n.getSize()!==18)throw new ji("should not happen but we got: "+n.getSize())},e.isEmpty=function(t){return t===255},e.embedTimingPatterns=function(t){for(var n=8;n<t.getWidth()-8;++n){var r=(n+1)%2;e.isEmpty(t.get(n,6))&&t.setNumber(n,6,r),e.isEmpty(t.get(6,n))&&t.setNumber(6,n,r)}},e.embedDarkDotAtLeftBottomCorner=function(t){if(t.get(8,t.getHeight()-8)===0)throw new ji;t.setNumber(8,t.getHeight()-8,1)},e.embedHorizontalSeparationPattern=function(t,n,r){for(var o=0;o<8;++o){if(!e.isEmpty(r.get(t+o,n)))throw new ji;r.setNumber(t+o,n,0)}},e.embedVerticalSeparationPattern=function(t,n,r){for(var o=0;o<7;++o){if(!e.isEmpty(r.get(t,n+o)))throw new ji;r.setNumber(t,n+o,0)}},e.embedPositionAdjustmentPattern=function(t,n,r){for(var o=0;o<5;++o)for(var i=e.POSITION_ADJUSTMENT_PATTERN[o],s=0;s<5;++s)r.setNumber(t+s,n+o,i[s])},e.embedPositionDetectionPattern=function(t,n,r){for(var o=0;o<7;++o)for(var i=e.POSITION_DETECTION_PATTERN[o],s=0;s<7;++s)r.setNumber(t+s,n+o,i[s])},e.embedPositionDetectionPatternsAndSeparators=function(t){var n=e.POSITION_DETECTION_PATTERN[0].length;e.embedPositionDetectionPattern(0,0,t),e.embedPositionDetectionPattern(t.getWidth()-n,0,t),e.embedPositionDetectionPattern(0,t.getWidth()-n,t),e.embedHorizontalSeparationPattern(0,7,t),e.embedHorizontalSeparationPattern(t.getWidth()-8,7,t),e.embedHorizontalSeparationPattern(0,t.getWidth()-8,t),e.embedVerticalSeparationPattern(7,0,t),e.embedVerticalSeparationPattern(t.getHeight()-7-1,0,t),e.embedVerticalSeparationPattern(7,t.getHeight()-7,t)},e.maybeEmbedPositionAdjustmentPatterns=function(t,n){if(!(t.getVersionNumber()<2))for(var r=t.getVersionNumber()-1,o=e.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[r],i=0,s=o.length;i!==s;i++){var a=o[i];if(a>=0)for(var c=0;c!==s;c++){var u=o[c];u>=0&&e.isEmpty(n.get(u,a))&&e.embedPositionAdjustmentPattern(u-2,a-2,n)}}},e.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),e.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),e.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),e.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),e.VERSION_INFO_POLY=7973,e.TYPE_INFO_POLY=1335,e.TYPE_INFO_MASK_PATTERN=21522,e})(),function(){Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),ir.UTF8.getName()}();var uB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r,o,i,s,a,c,u){var d=e.call(this,a,c)||this;if(d.yuvData=n,d.dataWidth=r,d.dataHeight=o,d.left=i,d.top=s,i+a>r||s+c>o)throw new Ge("Crop rectangle does not fit within image data.");return u&&d.reverseHorizontal(a,c),d}uB(t,e),t.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ge("Requested row is outside the image: "+n);var o=this.getWidth();(r==null||r.length<o)&&(r=new Uint8ClampedArray(o));var i=(n+this.top)*this.dataWidth+this.left;return Ut.arraycopy(this.yuvData,i,r,0,o),r},t.prototype.getMatrix=function(){var n=this.getWidth(),r=this.getHeight();if(n===this.dataWidth&&r===this.dataHeight)return this.yuvData;var o=n*r,i=new Uint8ClampedArray(o),s=this.top*this.dataWidth+this.left;if(n===this.dataWidth)return Ut.arraycopy(this.yuvData,s,i,0,o),i;for(var a=0;a<r;a++){var c=a*n;Ut.arraycopy(this.yuvData,s,i,c,n),s+=this.dataWidth}return i},t.prototype.isCropSupported=function(){return!0},t.prototype.crop=function(n,r,o,i){return new t(this.yuvData,this.dataWidth,this.dataHeight,this.left+n,this.top+r,o,i,!1)},t.prototype.renderThumbnail=function(){for(var n=this.getWidth()/t.THUMBNAIL_SCALE_FACTOR,r=this.getHeight()/t.THUMBNAIL_SCALE_FACTOR,o=new Int32Array(n*r),i=this.yuvData,s=this.top*this.dataWidth+this.left,a=0;a<r;a++){for(var c=a*n,u=0;u<n;u++){var d=255&i[s+u*t.THUMBNAIL_SCALE_FACTOR];o[c+u]=4278190080|65793*d}s+=this.dataWidth*t.THUMBNAIL_SCALE_FACTOR}return o},t.prototype.getThumbnailWidth=function(){return this.getWidth()/t.THUMBNAIL_SCALE_FACTOR},t.prototype.getThumbnailHeight=function(){return this.getHeight()/t.THUMBNAIL_SCALE_FACTOR},t.prototype.reverseHorizontal=function(n,r){for(var o=this.yuvData,i=0,s=this.top*this.dataWidth+this.left;i<r;i++,s+=this.dataWidth)for(var a=s+n/2,c=s,u=s+n-1;c<a;c++,u--){var d=o[c];o[c]=o[u],o[u]=d}},t.prototype.invert=function(){return new Al(this)},t.THUMBNAIL_SCALE_FACTOR=2})(oc);var lB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r,o,i,s,a,c){var u=e.call(this,r,o)||this;if(u.dataWidth=i,u.dataHeight=s,u.left=a,u.top=c,n.BYTES_PER_ELEMENT===4){for(var d=r*o,h=new Uint8ClampedArray(d),f=0;f<d;f++){var p=n[f],l=p>>16&255,m=p>>7&510,y=255&p;h[f]=(l+m+y)/4&255}u.luminances=h}else u.luminances=n;if(i===void 0&&(u.dataWidth=r),s===void 0&&(u.dataHeight=o),a===void 0&&(u.left=0),c===void 0&&(u.top=0),u.left+r>u.dataWidth||u.top+o>u.dataHeight)throw new Ge("Crop rectangle does not fit within image data.");return u}lB(t,e),t.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ge("Requested row is outside the image: "+n);var o=this.getWidth();(r==null||r.length<o)&&(r=new Uint8ClampedArray(o));var i=(n+this.top)*this.dataWidth+this.left;return Ut.arraycopy(this.luminances,i,r,0,o),r},t.prototype.getMatrix=function(){var n=this.getWidth(),r=this.getHeight();if(n===this.dataWidth&&r===this.dataHeight)return this.luminances;var o=n*r,i=new Uint8ClampedArray(o),s=this.top*this.dataWidth+this.left;if(n===this.dataWidth)return Ut.arraycopy(this.luminances,s,i,0,o),i;for(var a=0;a<r;a++){var c=a*n;Ut.arraycopy(this.luminances,s,i,c,n),s+=this.dataWidth}return i},t.prototype.isCropSupported=function(){return!0},t.prototype.crop=function(n,r,o,i){return new t(this.luminances,o,i,this.dataWidth,this.dataHeight,this.left+n,this.top+r)},t.prototype.invert=function(){return new Al(this)}})(oc);var dB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(){return e!==null&&e.apply(this,arguments)||this}dB(t,e),t.forName=function(n){return this.getCharacterSetECIByName(n)}})(ir);var fB=function(){function e(t){this.previous=t}return e.prototype.getPrevious=function(){return this.previous},e}(),hB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),mb=function(e){function t(n,r,o){var i=e.call(this,n)||this;return i.value=r,i.bitCount=o,i}return hB(t,e),t.prototype.appendTo=function(n,r){n.appendBits(this.value,this.bitCount)},t.prototype.add=function(n,r){return new t(this,n,r)},t.prototype.addBinaryShift=function(n,r){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new t(this,n,r)},t.prototype.toString=function(){var n=this.value&(1<<this.bitCount)-1;return n|=1<<this.bitCount,"<"+Rn.toBinaryString(n|1<<this.bitCount).substring(1)+">"},t}(fB),pB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r,o){var i=e.call(this,n,0,0)||this;return i.binaryShiftStart=r,i.binaryShiftByteCount=o,i}pB(t,e),t.prototype.appendTo=function(n,r){for(var o=0;o<this.binaryShiftByteCount;o++)(o===0||o===31&&this.binaryShiftByteCount<=62)&&(n.appendBits(31,5),this.binaryShiftByteCount>62?n.appendBits(this.binaryShiftByteCount-31,16):o===0?n.appendBits(Math.min(this.binaryShiftByteCount,31),5):n.appendBits(this.binaryShiftByteCount-31,5)),n.appendBits(r[this.binaryShiftStart+o],8)},t.prototype.addBinaryShift=function(n,r){return new t(this,n,r)},t.prototype.toString=function(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}})(mb),new mb(null,0,0);var mB=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};(function(e){var t,n;try{for(var r=mB(e),o=r.next();!o.done;o=r.next()){var i=o.value;wr.fill(i,-1)}}catch(s){t={error:s}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e[0][4]=0,e[1][4]=0,e[1][0]=28,e[3][4]=0,e[2][4]=0,e[2][0]=15})(wr.createInt32Array(6,6)),function(e){var t=Sn.getCharCode(" "),n=Sn.getCharCode("."),r=Sn.getCharCode(",");e[0][t]=1;for(var o=Sn.getCharCode("Z"),i=Sn.getCharCode("A"),s=i;s<=o;s++)e[0][s]=s-i+2;e[1][t]=1;var a=Sn.getCharCode("z"),c=Sn.getCharCode("a");for(s=c;s<=a;s++)e[1][s]=s-c+2;e[2][t]=1;var u=Sn.getCharCode("9"),d=Sn.getCharCode("0");for(s=d;s<=u;s++)e[2][s]=s-d+2;e[2][r]=12,e[2][n]=13;for(var h=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
157
|
-
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],f=0;f<h.length;f++)e[3][Sn.getCharCode(h[f])]=f;var p=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(f=0;f<p.length;f++)Sn.getCharCode(p[f])>0&&(e[4][Sn.getCharCode(p[f])]=f)}(wr.createInt32Array(5,256));var gB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),yB=function(e){function t(n){var r=e.call(this,n.width,n.height)||this;return r.canvas=n,r.buffer=t.makeBufferFromCanvasImageData(n),r}return gB(t,e),t.makeBufferFromCanvasImageData=function(n){var r=n.getContext("2d");if(!r)throw new Error("Couldn't get canvas context.");var o=r.getImageData(0,0,n.width,n.height);return t.toGrayscaleBuffer(o.data,n.width,n.height)},t.toGrayscaleBuffer=function(n,r,o){for(var i=new Uint8ClampedArray(r*o),s=0,a=0,c=n.length;s<c;s+=4,a++){var u=void 0;n[s+3]===0?u=255:u=306*n[s]+601*n[s+1]+117*n[s+2]+512>>10,i[a]=u}return i},t.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ge("Requested row is outside the image: "+n);var o=this.getWidth(),i=n*o;return r===null?r=this.buffer.slice(i,i+o):(r.length<o&&(r=new Uint8ClampedArray(o)),r.set(this.buffer.slice(i,i+o))),r},t.prototype.getMatrix=function(){return this.buffer},t.prototype.isCropSupported=function(){return!0},t.prototype.crop=function(n,r,o,i){return e.prototype.crop.call(this,n,r,o,i),this},t.prototype.isRotateSupported=function(){return!0},t.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},t.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},t.prototype.invert=function(){return new Al(this)},t.prototype.getTempCanvasElement=function(){if(this.tempCanvasElement===null){var n=this.canvas.ownerDocument.createElement("canvas");n.width=this.canvas.width,n.height=this.canvas.height,this.tempCanvasElement=n}return this.tempCanvasElement},t.prototype.rotate=function(n){var r=this.getTempCanvasElement();if(!r)throw new Error("Could not create a Canvas element.");var o=n*t.DEGREE_TO_RADIANS,i=this.canvas.width,s=this.canvas.height,a=Math.ceil(Math.abs(Math.cos(o))*i+Math.abs(Math.sin(o))*s),c=Math.ceil(Math.abs(Math.sin(o))*i+Math.abs(Math.cos(o))*s);r.width=a,r.height=c;var u=r.getContext("2d");if(!u)throw new Error("Could not create a Convas Context element.");return u.translate(a/2,c/2),u.rotate(o),u.drawImage(this.canvas,i/-2,s/-2),this.buffer=t.makeBufferFromCanvasImageData(r),this},t.DEGREE_TO_RADIANS=Math.PI/180,t}(oc);function gb(){return typeof navigator<"u"}function vB(){return!!(gb()&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)}var Us=function(){return Us=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Us.apply(this,arguments)},Jt=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(u){try{c(r.next(u))}catch(d){i(d)}}function a(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){var d;u.done?o(u.value):(d=u.value,d instanceof n?d:new n(function(h){h(d)})).then(s,a)}c((r=r.apply(e,[])).next())})},Zt=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(c){return function(u){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&d[0]?r.return:d[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,d[1])).done)return o;switch(r=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,r=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!((o=o.length>0&&o[o.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){s.label=d[1];break}if(d[0]===6&&s.label<o[1]){s.label=o[1],o=d;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(d);break}o[2]&&s.ops.pop(),s.trys.pop();continue}d=t.call(e,s)}catch(h){d=[6,h],r=0}finally{n=o=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([c,u])}}},Vl=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},wB={delayBetweenScanAttempts:500,delayBetweenScanSuccess:500,tryPlayVideoTimeout:5e3},Hs=function(){function e(t,n,r){n===void 0&&(n=new Map),r===void 0&&(r={}),this.reader=t,this.hints=n,this.options=Us(Us({},wB),r)}return Object.defineProperty(e.prototype,"possibleFormats",{set:function(t){this.hints.set(Lt.POSSIBLE_FORMATS,t)},enumerable:!1,configurable:!0}),e.addVideoSource=function(t,n){try{t.srcObject=n}catch{t.src=URL.createObjectURL(n)}},e.mediaStreamSetTorch=function(t,n){return Jt(this,void 0,void 0,function(){return Zt(this,function(r){switch(r.label){case 0:return[4,t.applyConstraints({advanced:[{fillLightMode:n?"flash":"off",torch:!!n}]})];case 1:return r.sent(),[2]}})})},e.mediaStreamIsTorchCompatible=function(t){var n,r,o=t.getVideoTracks();try{for(var i=Vl(o),s=i.next();!s.done;s=i.next()){var a=s.value;if(e.mediaStreamIsTorchCompatibleTrack(a))return!0}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},e.mediaStreamIsTorchCompatibleTrack=function(t){try{return"torch"in t.getCapabilities()}catch(n){return console.error(n),console.warn("Your browser may be not fully compatible with WebRTC and/or ImageCapture specs. Torch will not be available."),!1}},e.isVideoPlaying=function(t){return t.currentTime>0&&!t.paused&&t.readyState>2},e.getMediaElement=function(t,n){var r=document.getElementById(t);if(!r)throw new Qt("element with id '"+t+"' not found");if(r.nodeName.toLowerCase()!==n.toLowerCase())throw new Qt("element with id '"+t+"' must be an "+n+" element");return r},e.createVideoElement=function(t){if(t instanceof HTMLVideoElement)return t;if(typeof t=="string")return e.getMediaElement(t,"video");if(!t&&typeof document<"u"){var n=document.createElement("video");return n.width=200,n.height=200,n}throw new Error("Couldn't get videoElement from videoSource!")},e.prepareImageElement=function(t){if(t instanceof HTMLImageElement)return t;if(typeof t=="string")return e.getMediaElement(t,"img");if(t===void 0){var n=document.createElement("img");return n.width=200,n.height=200,n}throw new Error("Couldn't get imageElement from imageSource!")},e.prepareVideoElement=function(t){var n=e.createVideoElement(t);return n.setAttribute("autoplay","true"),n.setAttribute("muted","true"),n.setAttribute("playsinline","true"),n},e.isImageLoaded=function(t){return!!t.complete&&t.naturalWidth!==0},e.createBinaryBitmapFromCanvas=function(t){var n=new yB(t),r=new Mw(n);return new Nw(r)},e.drawImageOnCanvas=function(t,n){t.drawImage(n,0,0)},e.getMediaElementDimensions=function(t){if(t instanceof HTMLVideoElement)return{height:t.videoHeight,width:t.videoWidth};if(t instanceof HTMLImageElement)return{height:t.naturalHeight||t.height,width:t.naturalWidth||t.width};throw new Error("Couldn't find the Source's dimentions!")},e.createCaptureCanvas=function(t){if(!t)throw new Qt("Cannot create a capture canvas without a media element.");if(typeof document>"u")throw new Error(`The page "Document" is undefined, make sure you're running in a browser.`);var n=document.createElement("canvas"),r=e.getMediaElementDimensions(t),o=r.width,i=r.height;return n.style.width=o+"px",n.style.height=i+"px",n.width=o,n.height=i,n},e.tryPlayVideo=function(t){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:if(t!=null&&t.ended)return console.error("Trying to play video that has ended."),[2,!1];if(e.isVideoPlaying(t))return console.warn("Trying to play video that is already playing."),[2,!0];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.play()];case 2:return r.sent(),[2,!0];case 3:return n=r.sent(),console.warn("It was not possible to play the video.",n),[2,!1];case 4:return[2]}})})},e.createCanvasFromMediaElement=function(t){var n=e.createCaptureCanvas(t),r=n.getContext("2d");if(!r)throw new Error("Couldn't find Canvas 2D Context.");return e.drawImageOnCanvas(r,t),n},e.createBinaryBitmapFromMediaElem=function(t){var n=e.createCanvasFromMediaElement(t);return e.createBinaryBitmapFromCanvas(n)},e.destroyImageElement=function(t){t.src="",t.removeAttribute("src"),t=void 0},e.listVideoInputDevices=function(){return Jt(this,void 0,void 0,function(){var t,n,r,o,i,s,a,c,u,d,h,f;return Zt(this,function(p){switch(p.label){case 0:if(!gb())throw new Error("Can't enumerate devices, navigator is not present.");if(!vB())throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:t=p.sent(),n=[];try{for(r=Vl(t),o=r.next();!o.done;o=r.next())i=o.value,(s=i.kind==="video"?"videoinput":i.kind)==="videoinput"&&(a=i.deviceId||i.id,c=i.label||"Video device "+(n.length+1),u=i.groupId,d={deviceId:a,label:c,kind:s,groupId:u},n.push(d))}catch(l){h={error:l}}finally{try{o&&!o.done&&(f=r.return)&&f.call(r)}finally{if(h)throw h.error}}return[2,n]}})})},e.findDeviceById=function(t){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:return[4,e.listVideoInputDevices()];case 1:return(n=r.sent())?[2,n.find(function(o){return o.deviceId===t})]:[2]}})})},e.cleanVideoSource=function(t){if(t){try{t.srcObject=null}catch{t.src=""}t&&t.removeAttribute("src")}},e.playVideoOnLoadAsync=function(t,n){return Jt(this,void 0,void 0,function(){return Zt(this,function(r){switch(r.label){case 0:return[4,e.tryPlayVideo(t)];case 1:return r.sent()?[2,!0]:[2,new Promise(function(o,i){var s=setTimeout(function(){e.isVideoPlaying(t)||(i(!1),t.removeEventListener("canplay",a))},n),a=function(){e.tryPlayVideo(t).then(function(c){clearTimeout(s),t.removeEventListener("canplay",a),o(c)})};t.addEventListener("canplay",a)})]}})})},e.attachStreamToVideo=function(t,n,r){return r===void 0&&(r=5e3),Jt(this,void 0,void 0,function(){var o;return Zt(this,function(i){switch(i.label){case 0:return o=e.prepareVideoElement(n),e.addVideoSource(o,t),[4,e.playVideoOnLoadAsync(o,r)];case 1:return i.sent(),[2,o]}})})},e._waitImageLoad=function(t){return new Promise(function(n,r){var o=setTimeout(function(){e.isImageLoaded(t)||(t.removeEventListener("load",i),r())},1e4),i=function(){clearTimeout(o),t.removeEventListener("load",i),n()};t.addEventListener("load",i)})},e.checkCallbackFnOrThrow=function(t){if(!t)throw new Qt("`callbackFn` is a required parameter, you cannot capture results without it.")},e.disposeMediaStream=function(t){t.getVideoTracks().forEach(function(n){return n.stop()}),t=void 0},e.prototype.decode=function(t){var n=e.createCanvasFromMediaElement(t);return this.decodeFromCanvas(n)},e.prototype.decodeBitmap=function(t){return this.reader.decode(t,this.hints)},e.prototype.decodeFromCanvas=function(t){var n=e.createBinaryBitmapFromCanvas(t);return this.decodeBitmap(n)},e.prototype.decodeFromImageElement=function(t){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:if(!t)throw new Qt("An image element must be provided.");return n=e.prepareImageElement(t),[4,this._decodeOnLoadImage(n)];case 1:return[2,r.sent()]}})})},e.prototype.decodeFromImageUrl=function(t){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:if(!t)throw new Qt("An URL must be provided.");(n=e.prepareImageElement()).src=t,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.decodeFromImageElement(n)];case 2:return[2,r.sent()];case 3:return e.destroyImageElement(n),[7];case 4:return[2]}})})},e.prototype.decodeFromConstraints=function(t,n,r){return Jt(this,void 0,void 0,function(){var o,i;return Zt(this,function(s){switch(s.label){case 0:return e.checkCallbackFnOrThrow(r),[4,navigator.mediaDevices.getUserMedia(t)];case 1:o=s.sent(),s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this.decodeFromStream(o,n,r)];case 3:return[2,s.sent()];case 4:throw i=s.sent(),e.disposeMediaStream(o),i;case 5:return[2]}})})},e.prototype.decodeFromStream=function(t,n,r){return Jt(this,void 0,void 0,function(){var o,i,s,a,c,u,d,h,f,p,l=this;return Zt(this,function(m){switch(m.label){case 0:return e.checkCallbackFnOrThrow(r),o=this.options.tryPlayVideoTimeout,[4,e.attachStreamToVideo(t,n,o)];case 1:return i=m.sent(),s=function(){var y,g;try{for(var v=Vl(t.getVideoTracks()),b=v.next();!b.done;b=v.next())b.value.stop()}catch(E){y={error:E}}finally{try{b&&!b.done&&(g=v.return)&&g.call(v)}finally{if(y)throw y.error}}t=void 0},a=function(){s(),e.cleanVideoSource(i)},c=this.scan(i,r,a),u=t.getVideoTracks(),d=Us(Us({},c),{stop:function(){c.stop()},streamVideoConstraintsApply:function(y,g){return Jt(this,void 0,void 0,function(){var v,b,E,C,A,T;return Zt(this,function(x){switch(x.label){case 0:v=g?u.filter(g):u,x.label=1;case 1:x.trys.push([1,6,7,8]),b=Vl(v),E=b.next(),x.label=2;case 2:return E.done?[3,5]:[4,E.value.applyConstraints(y)];case 3:x.sent(),x.label=4;case 4:return E=b.next(),[3,2];case 5:return[3,8];case 6:return C=x.sent(),A={error:C},[3,8];case 7:try{E&&!E.done&&(T=b.return)&&T.call(b)}finally{if(A)throw A.error}return[7];case 8:return[2]}})})},streamVideoConstraintsGet:function(y){return u.find(y).getConstraints()},streamVideoSettingsGet:function(y){return u.find(y).getSettings()},streamVideoCapabilitiesGet:function(y){return u.find(y).getCapabilities()}}),e.mediaStreamIsTorchCompatible(t)&&(h=u==null?void 0:u.find(function(y){return e.mediaStreamIsTorchCompatibleTrack(y)}),f=function(y){return Jt(l,void 0,void 0,function(){return Zt(this,function(g){switch(g.label){case 0:return[4,e.mediaStreamSetTorch(h,y)];case 1:return g.sent(),[2]}})})},d.switchTorch=f,p=function(){c.stop(),f(!1)},d.stop=p),[2,d]}})})},e.prototype.decodeFromVideoDevice=function(t,n,r){return Jt(this,void 0,void 0,function(){var o;return Zt(this,function(i){switch(i.label){case 0:return e.checkCallbackFnOrThrow(r),o={video:t?{deviceId:{exact:t}}:{facingMode:"environment"}},[4,this.decodeFromConstraints(o,n,r)];case 1:return[2,i.sent()]}})})},e.prototype.decodeFromVideoElement=function(t,n){return Jt(this,void 0,void 0,function(){var r,o;return Zt(this,function(i){switch(i.label){case 0:if(e.checkCallbackFnOrThrow(n),!t)throw new Qt("A video element must be provided.");return r=e.prepareVideoElement(t),o=this.options.tryPlayVideoTimeout,[4,e.playVideoOnLoadAsync(r,o)];case 1:return i.sent(),[2,this.scan(r,n)]}})})},e.prototype.decodeFromVideoUrl=function(t,n){return Jt(this,void 0,void 0,function(){var r,o,i;return Zt(this,function(s){switch(s.label){case 0:if(e.checkCallbackFnOrThrow(n),!t)throw new Qt("An URL must be provided.");return(r=e.prepareVideoElement()).src=t,o=function(){e.cleanVideoSource(r)},i=this.options.tryPlayVideoTimeout,[4,e.playVideoOnLoadAsync(r,i)];case 1:return s.sent(),[2,this.scan(r,n,o)]}})})},e.prototype.decodeOnceFromConstraints=function(t,n){return Jt(this,void 0,void 0,function(){var r;return Zt(this,function(o){switch(o.label){case 0:return[4,navigator.mediaDevices.getUserMedia(t)];case 1:return r=o.sent(),[4,this.decodeOnceFromStream(r,n)];case 2:return[2,o.sent()]}})})},e.prototype.decodeOnceFromStream=function(t,n){return Jt(this,void 0,void 0,function(){var r,o;return Zt(this,function(i){switch(i.label){case 0:return r=!!n,[4,e.attachStreamToVideo(t,n)];case 1:o=i.sent(),i.label=2;case 2:return i.trys.push([2,,4,5]),[4,this.scanOneResult(o)];case 3:return[2,i.sent()];case 4:return r||e.cleanVideoSource(o),[7];case 5:return[2]}})})},e.prototype.decodeOnceFromVideoDevice=function(t,n){return Jt(this,void 0,void 0,function(){var r;return Zt(this,function(o){switch(o.label){case 0:return r={video:t?{deviceId:{exact:t}}:{facingMode:"environment"}},[4,this.decodeOnceFromConstraints(r,n)];case 1:return[2,o.sent()]}})})},e.prototype.decodeOnceFromVideoElement=function(t){return Jt(this,void 0,void 0,function(){var n,r;return Zt(this,function(o){switch(o.label){case 0:if(!t)throw new Qt("A video element must be provided.");return n=e.prepareVideoElement(t),r=this.options.tryPlayVideoTimeout,[4,e.playVideoOnLoadAsync(n,r)];case 1:return o.sent(),[4,this.scanOneResult(n)];case 2:return[2,o.sent()]}})})},e.prototype.decodeOnceFromVideoUrl=function(t){return Jt(this,void 0,void 0,function(){var n,r;return Zt(this,function(o){switch(o.label){case 0:if(!t)throw new Qt("An URL must be provided.");(n=e.prepareVideoElement()).src=t,r=this.decodeOnceFromVideoElement(n),o.label=1;case 1:return o.trys.push([1,,3,4]),[4,r];case 2:return[2,o.sent()];case 3:return e.cleanVideoSource(n),[7];case 4:return[2]}})})},e.prototype.scanOneResult=function(t,n,r,o){var i=this;return n===void 0&&(n=!0),r===void 0&&(r=!0),o===void 0&&(o=!0),new Promise(function(s,a){i.scan(t,function(c,u,d){if(c)return s(c),void d.stop();if(u){if(u instanceof ge&&n||u instanceof gn&&r||u instanceof xe&&o)return;d.stop(),a(u)}})})},e.prototype.scan=function(t,n,r){var o=this;e.checkCallbackFnOrThrow(n);var i=e.createCaptureCanvas(t),s=i.getContext("2d");if(!s)throw new Error("Couldn't create canvas for visual element scan.");var a,c=function(){s=void 0,i=void 0},u=!1,d={stop:function(){u=!0,clearTimeout(a),c(),r&&r()}},h=function(){if(!u)try{e.drawImageOnCanvas(s,t);var f=o.decodeFromCanvas(i);n(f,void 0,d),a=setTimeout(h,o.options.delayBetweenScanSuccess)}catch(p){if(n(void 0,p,d),p instanceof gn||p instanceof xe||p instanceof ge)return void(a=setTimeout(h,o.options.delayBetweenScanAttempts));c(),r&&r(p)}};return h(),d},e.prototype._decodeOnLoadImage=function(t){return Jt(this,void 0,void 0,function(){return Zt(this,function(n){switch(n.label){case 0:return e.isImageLoaded(t)?[3,2]:[4,e._waitImageLoad(t)];case 1:n.sent(),n.label=2;case 2:return[2,this.decode(t)]}})})},e}(),bB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new kl,n,r)||this}bB(t,e)})(Hs);var EB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new js(n),n,r)||this}EB(t,e)})(Hs);var CB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new Ml,n,r)||this}CB(t,e)})(Hs);var _B=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){var o=this,i=new hb;return i.setHints(n),(o=e.call(this,i,n,r)||this).reader=i,o}_B(t,e),Object.defineProperty(t.prototype,"possibleFormats",{set:function(n){this.hints.set(Lt.POSSIBLE_FORMATS,n),this.reader.setHints(this.hints)},enumerable:!1,configurable:!0}),t.prototype.decodeBitmap=function(n){return this.reader.decodeWithState(n)},t.prototype.setHints=function(n){this.hints=n,this.reader.setHints(this.hints)}})(Hs);var SB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new jl,n,r)||this}SB(t,e)})(Hs);var AB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),IB=function(e){function t(n,r){return e.call(this,new Fl,n,r)||this}return AB(t,e),t}(Hs),Ul=function(e,t,n){var r=typeof e===n;return r||console.warn('[ReactQrReader]: Expected "'.concat(t,'" to be a of type "').concat(n,'".')),r},TB=function(e){var t=e.scanDelay,n=e.constraints,r=e.onResult,o=e.videoId,i=k.useRef(null);k.useEffect(function(){var s=new IB(null,{delayBetweenScanAttempts:t});return!function(){var a=typeof navigator<"u"&&!!navigator.mediaDevices;return a||console.warn('[ReactQrReader]: MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),a}()&&Ul(r,"onResult","function")&&r(null,new Error('MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),s),Ul(n,"constraints","object")&&s.decodeFromConstraints({video:n},o,function(a,c){Ul(r,"onResult","function")&&r(a,c,s)}).then(function(a){return i.current=a}).catch(function(a){Ul(r,"onResult","function")&&r(null,a,s)}),function(){var a;(a=i.current)===null||a===void 0||a.stop()}},[])},Vi=function(){return Vi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Vi.apply(this,arguments)},yb={container:{width:"100%",paddingTop:"100%",overflow:"hidden",position:"relative"},video:{top:0,left:0,width:"100%",height:"100%",display:"block",overflow:"hidden",position:"absolute",transform:void 0}},Ip=function(e){var t=e.videoContainerStyle,n=e.containerStyle,r=e.videoStyle,o=e.constraints,i=e.ViewFinder,s=e.scanDelay,a=e.className,c=e.onResult,u=e.videoId;return TB({constraints:o,scanDelay:s,onResult:c,videoId:u}),ue.createElement("section",{className:a,style:n},ue.createElement("div",{style:Vi(Vi({},yb.container),t)},!!i&&ue.createElement(i,null),ue.createElement("video",{muted:!0,id:u,style:Vi(Vi(Vi({},yb.video),r),{transform:(o==null?void 0:o.facingMode)==="user"&&"scaleX(-1)"})})))};Ip.displayName="QrReader",Ip.defaultProps={constraints:{facingMode:"user"},videoId:"video",scanDelay:500};function xB({onScan:e}){const{cameraFacingMode:t}=mn(),[n,r]=k.useState(t??Zn.USER);return w.jsxs("div",{className:"relative w-full",children:[w.jsx(Ip,{onResult:o=>{o&&e(o.getText())},constraints:{facingMode:n},videoStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem",objectFit:"cover"},videoContainerStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem"}}),w.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>n===Zn.USER?r(Zn.ENVIRONMENT):r(Zn.USER),children:w.jsx("img",{src:up,alt:"camera-switch"})})]})}class rt{constructor(t,n,r,o,i){this._legacyCanvasSize=rt.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=t,this.$canvas=document.createElement("canvas"),r&&typeof r=="object"?this._onDecode=n:(console.warn(r||o||i?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=n),n=typeof r=="object"?r:{},this._onDecodeError=n.onDecodeError||(typeof r=="function"?r:this._onDecodeError),this._calculateScanRegion=n.calculateScanRegion||(typeof o=="function"?o:this._calculateScanRegion),this._preferredCamera=n.preferredCamera||i||this._preferredCamera,this._legacyCanvasSize=typeof r=="number"?r:typeof o=="number"?o:this._legacyCanvasSize,this._maxScansPerSecond=n.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),t.disablePictureInPicture=!0,t.playsInline=!0,t.muted=!0;let s=!1;if(t.hidden&&(t.hidden=!1,s=!0),document.body.contains(t)||(document.body.appendChild(t),s=!0),r=t.parentElement,n.highlightScanRegion||n.highlightCodeOutline){if(o=!!n.overlay,this.$overlay=n.overlay||document.createElement("div"),i=this.$overlay.style,i.position="absolute",i.display="none",i.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!o&&n.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}r.insertBefore(this.$overlay,this.$video.nextSibling)}n.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(t),requestAnimationFrame(()=>{let a=window.getComputedStyle(t);a.display==="none"&&(t.style.setProperty("display","block","important"),s=!0),a.visibility!=="visible"&&(t.style.setProperty("visibility","visible","important"),s=!0),s&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),t.style.opacity="0",t.style.width="0",t.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),t.addEventListener("play",this._onPlay),t.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=rt.createQrEngine()}static set WORKER_PATH(t){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.")}static async hasCamera(){try{return!!(await rt.listCameras(!1)).length}catch{return!1}}static async listCameras(t=!1){if(!navigator.mediaDevices)return[];let n=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),r;try{t&&(await n()).every(o=>!o.label)&&(r=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await n()).map((o,i)=>({id:o.deviceId,label:o.label||(i===0?"Default Camera":`Camera ${i+1}`)}))}finally{r&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),rt._stopVideoStream(r))}}async hasFlash(){let t;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;t=this.$video.srcObject}else t=(await this._getCameraStream()).stream;return"torch"in t.getVideoTracks()[0].getSettings()}catch{return!1}finally{t&&t!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),rt._stopVideoStream(t))}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn()}async turnFlashOn(){if(!this._flashOn&&!this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw"No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]})}catch(t){throw this._flashOn=!1,t}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream())}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._updateOverlay),this._destroyed=!0,this._flashOn=!1,this.stop(),rt._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:t,facingMode:n}=await this._getCameraStream();!this._active||this._paused?rt._stopVideoStream(t):(this._setVideoMirror(n),this.$video.srcObject=t,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(t){if(!this._paused)throw this._active=!1,t}}stop(){this.pause(),this._active=!1}async pause(t=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let n=()=>{this.$video.srcObject instanceof MediaStream&&(rt._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return t?(n(),!0):(await new Promise(r=>setTimeout(r,300)),this._paused?(n(),!0):!1)}async setCamera(t){t!==this._preferredCamera&&(this._preferredCamera=t,await this._restartVideoStream())}static async scanImage(t,n,r,o,i=!1,s=!1){let a,c=!1;n&&("scanRegion"in n||"qrEngine"in n||"canvas"in n||"disallowCanvasResizing"in n||"alsoTryWithoutScanRegion"in n||"returnDetailedScanResult"in n)?(a=n.scanRegion,r=n.qrEngine,o=n.canvas,i=n.disallowCanvasResizing||!1,s=n.alsoTryWithoutScanRegion||!1,c=!0):console.warn(n||r||o||i||s?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),n=!!r;try{let u,d;[r,u]=await Promise.all([r||rt.createQrEngine(),rt._loadImage(t)]),[o,d]=rt._drawToCanvas(u,a,o,i);let h;if(r instanceof Worker){let f=r;n||rt._postWorkerMessageSync(f,"inversionMode","both"),h=await new Promise((p,l)=>{let m,y,g,v=-1;y=E=>{E.data.id===v&&(f.removeEventListener("message",y),f.removeEventListener("error",g),clearTimeout(m),E.data.data!==null?p({data:E.data.data,cornerPoints:rt._convertPoints(E.data.cornerPoints,a)}):l(rt.NO_QR_CODE_FOUND))},g=E=>{f.removeEventListener("message",y),f.removeEventListener("error",g),clearTimeout(m),l("Scanner error: "+(E?E.message||E:"Unknown Error"))},f.addEventListener("message",y),f.addEventListener("error",g),m=setTimeout(()=>g("timeout"),1e4);let b=d.getImageData(0,0,o.width,o.height);v=rt._postWorkerMessageSync(f,"decode",b,[b.data.buffer])})}else h=await Promise.race([new Promise((f,p)=>window.setTimeout(()=>p("Scanner error: timeout"),1e4)),(async()=>{try{var[f]=await r.detect(o);if(!f)throw rt.NO_QR_CODE_FOUND;return{data:f.rawValue,cornerPoints:rt._convertPoints(f.cornerPoints,a)}}catch(p){if(f=p.message||p,/not implemented|service unavailable/.test(f))return rt._disableBarcodeDetector=!0,rt.scanImage(t,{scanRegion:a,canvas:o,disallowCanvasResizing:i,alsoTryWithoutScanRegion:s});throw`Scanner error: ${f}`}})()]);return c?h:h.data}catch(u){if(!a||!s)throw u;let d=await rt.scanImage(t,{qrEngine:r,canvas:o,disallowCanvasResizing:i});return c?d:d.data}finally{n||rt._postWorkerMessage(r,"close")}}setGrayscaleWeights(t,n,r,o=!0){rt._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:t,green:n,blue:r,useIntegerApproximation:o})}setInversionMode(t){rt._postWorkerMessage(this._qrEnginePromise,"inversionMode",t)}static async createQrEngine(t){if(t&&console.warn("Specifying a worker path is not required and not supported anymore."),t=()=>Promise.resolve().then(()=>SD).then(r=>r.createWorker()),!(!rt._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return t();let n=navigator.userAgentData;return n&&n.brands.some(({brand:r})=>/Chromium/i.test(r))&&/mac ?OS/i.test(n.platform)&&await n.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:r,platformVersion:o})=>/arm/i.test(r||"arm")&&13<=parseInt(o||"13")).catch(()=>!0)?t():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay(),this.$overlay&&(this.$overlay.style.display=""),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay()}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(t){let n=Math.round(.6666666666666666*Math.min(t.videoWidth,t.videoHeight));return{x:Math.round((t.videoWidth-n)/2),y:Math.round((t.videoHeight-n)/2),width:n,height:n,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var t=this.$video,n=t.videoWidth,r=t.videoHeight,o=t.offsetWidth,i=t.offsetHeight,s=t.offsetLeft,a=t.offsetTop,c=window.getComputedStyle(t),u=c.objectFit,d=n/r,h=o/i;switch(u){case"none":var f=n,p=r;break;case"fill":f=o,p=i;break;default:(u==="cover"?d>h:d<h)?(p=i,f=p*d):(f=o,p=f/d),u==="scale-down"&&(f=Math.min(f,n),p=Math.min(p,r))}var[l,m]=c.objectPosition.split(" ").map((g,v)=>{const b=parseFloat(g);return g.endsWith("%")?(v?i-p:o-f)*b/100:b});c=this._scanRegion.width||n,h=this._scanRegion.height||r,u=this._scanRegion.x||0;var y=this._scanRegion.y||0;d=this.$overlay.style,d.width=`${c/n*f}px`,d.height=`${h/r*p}px`,d.top=`${a+m+y/r*p}px`,r=/scaleX\(-1\)/.test(t.style.transform),d.left=`${s+(r?o-l-f:l)+(r?n-u-c:u)/n*f}px`,d.transform=t.style.transform}})}static _convertPoints(t,n){if(!n)return t;let r=n.x||0,o=n.y||0,i=n.width&&n.downScaledWidth?n.width/n.downScaledWidth:1;n=n.height&&n.downScaledHeight?n.height/n.downScaledHeight:1;for(let s of t)s.x=s.x*i+r,s.y=s.y*n+o;return t}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var t=Date.now()-this._lastScanTimestamp,n=1e3/this._maxScansPerSecond;t<n&&await new Promise(o=>setTimeout(o,n-t)),this._lastScanTimestamp=Date.now();try{var r=await rt.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!rt._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=rt.createQrEngine()),r?(this._onDecode?this._onDecode(r):this._legacyOnDecode&&this._legacyOnDecode(r.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} ${this._scanRegion.y||0} ${this._scanRegion.width||this.$video.videoWidth} ${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",r.cornerPoints.map(({x:o,y:i})=>`${o},${i}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(t){t!==rt.NO_QR_CODE_FOUND&&console.log(t)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let t=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",n=[{width:{min:1024}},{width:{min:768}},{}],r=n.map(o=>Object.assign({},o,{[t]:{exact:this._preferredCamera}}));for(let o of[...r,...n])try{let i=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),s=this._getFacingMode(i)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:i,facingMode:s}}catch{}throw"Camera not found."}async _restartVideoStream(){let t=this._paused;await this.pause(!0)&&!t&&this._active&&await this.start()}static _stopVideoStream(t){for(let n of t.getTracks())n.stop(),t.removeTrack(n)}_setVideoMirror(t){this.$video.style.transform="scaleX("+(t==="user"?-1:1)+")"}_getFacingMode(t){return(t=t.getVideoTracks()[0])?/rear|back|environment/i.test(t.label)?"environment":/front|user|face/i.test(t.label)?"user":null:null}static _drawToCanvas(t,n,r,o=!1){r=r||document.createElement("canvas");let i=n&&n.x?n.x:0,s=n&&n.y?n.y:0,a=n&&n.width?n.width:t.videoWidth||t.width,c=n&&n.height?n.height:t.videoHeight||t.height;return o||(o=n&&n.downScaledWidth?n.downScaledWidth:a,n=n&&n.downScaledHeight?n.downScaledHeight:c,r.width!==o&&(r.width=o),r.height!==n&&(r.height=n)),n=r.getContext("2d",{alpha:!1}),n.imageSmoothingEnabled=!1,n.drawImage(t,i,s,a,c,0,0,r.width,r.height),[r,n]}static async _loadImage(t){if(t instanceof Image)return await rt._awaitImageLoad(t),t;if(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGImageElement||"OffscreenCanvas"in window&&t instanceof OffscreenCanvas||"ImageBitmap"in window&&t instanceof ImageBitmap)return t;if(t instanceof File||t instanceof Blob||t instanceof URL||typeof t=="string"){let n=new Image;n.src=t instanceof File||t instanceof Blob?URL.createObjectURL(t):t.toString();try{return await rt._awaitImageLoad(n),n}finally{(t instanceof File||t instanceof Blob)&&URL.revokeObjectURL(n.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(t){t.complete&&t.naturalWidth!==0||await new Promise((n,r)=>{let o=i=>{t.removeEventListener("load",o),t.removeEventListener("error",o),i instanceof ErrorEvent?r("Image load error"):n()};t.addEventListener("load",o),t.addEventListener("error",o)})}static async _postWorkerMessage(t,n,r,o){return rt._postWorkerMessageSync(await t,n,r,o)}static _postWorkerMessageSync(t,n,r,o){if(!(t instanceof Worker))return-1;let i=rt._workerMessageId++;return t.postMessage({id:i,type:n,data:r},o),i}}rt.DEFAULT_CANVAS_SIZE=400,rt.NO_QR_CODE_FOUND="No QR code found",rt._disableBarcodeDetector=!1,rt._workerMessageId=0;function kB({onScan:e}){const{cameraFacingMode:t}=mn(),[n,r]=k.useState(t),o=k.useRef(),i=k.useRef(null),[s,a]=k.useState(!0),c=d=>{e(d==null?void 0:d.data)},u=d=>{};return k.useEffect(()=>{var d;return i!=null&&i.current&&!o.current&&(o.current=new rt(i==null?void 0:i.current,c,{onDecodeError:u,preferredCamera:n}),(d=o==null?void 0:o.current)==null||d.start().then(()=>a(!0)).catch(h=>{h&&a(!1)})),()=>{var h;i!=null&&i.current||(h=o==null?void 0:o.current)==null||h.stop()}},[]),k.useEffect(()=>{s||alert("Camera is blocked or not accessible. Please allow camera in your browser permissions and reload.")},[s]),w.jsxs("div",{className:"relative",children:[w.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:i}),w.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>n===Zn.USER?r(Zn.ENVIRONMENT):r(Zn.USER),children:w.jsx("img",{src:up,alt:"camera-switch"})})]})}function Gs({data:e,dataSetter:t,setDefer:n,label:r=""}){const o=k.useRef(null),i=IP(),[s,a]=gx()??[0,0],{subscribe:c,unsubscribe:u}=Da(),{cameraService:d}=mn(),h=p=>{t(p)};k.useEffect(()=>{a&&a<=332&&o.current&&o.current.scrollIntoView({behavior:"smooth",block:"end"});const p=l=>{t(l.detail.code)};return c("onCodeScan",p),()=>{u("onCodeScan",p)}},[a]);const f=()=>{switch(+d){case 1:return w.jsx(Rw,{onScan:h});case 2:return w.jsx(kB,{onScan:h});case 3:return w.jsx(xB,{onScan:h});default:return w.jsx(Rw,{onScan:h})}};return w.jsxs("div",{ref:o,children:[!!i.length&&w.jsxs("div",{className:"mb-4 flex flex-col gap-4",children:[f(),w.jsx("hr",{})]}),w.jsx(Oi,{label:r,value:e,autoFocus:!0,placeholder:"CDE2341S",onChange:p=>{n&&n(!0),t(p.target.value)}})]})}function OB(){const{t:e}=$e(),{errorToast:t}=tn(),{uuid:n,portalSession:r}=He(),[o,i]=k.useState(""),[s,a]=k.useState(!1),[c,u]=k.useState(!1),d=rn(),h=Gt(),f=()=>{u(!0),h.get(`${n}/check-code/${o}`).then(p=>{if(p.data.identifier)return d(`identifier/${p.data.identifier.value}`);if(p.data.voucher)return d(`voucher/${p.data.voucher.code}`);if(p.data.giftcard)return d(`giftcard/${p.data.giftcard.hash}`);t(e("unknownCode",{code:o}))}).catch(t).finally(()=>u(!1))};return k.useEffect(()=>{o&&!s&&f()},[o]),w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanOrEnterX",{x:"code"})})})}),w.jsx(jt,{children:w.jsx(Ni,{onSubmit:f,children:w.jsx(Gs,{data:o,dataSetter:i,setDefer:a,label:e("contactIdentifier")})})}),w.jsx(pn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:e("continue"),onClick:f,pending:c}),r.inputData.enable_email_identification&&w.jsx(dt,{label:e("useEmail"),variant:"secondary",onClick:()=>d("email")})]})})]})})}function PB(){const{hash:e}=_o();return w.jsx(kr,{to:`${je.GIFTCARD}/select/${e}`})}function RB(){const{identifierValue:e}=_o(),{errorToast:t}=tn(),{uuid:n,mutate:r}=He(),{onContactLink:o}=mn(),[i,s]=k.useState(!1),a=Gt(),c=d=>a.get(`${n}/contacts`,{contact_uuid:d}),u=()=>{a.put(n,{contact_identifier_value:e}).then(d=>{o&&c(d.data.data.contact.uuid).then(h=>{o==null||o(h.data.data)}),r().then(()=>s(!0))}).catch(t)};return k.useEffect(()=>{u()},[]),i?w.jsx(kr,{to:`${je.PORTAL}/overview`}):w.jsx(Fr,{})}function vb(e){const{portalSession:t}=He(),[n,r]=k.useState(),{isLoading:o,pending:i,mutate:s}=_r({url:`${t.uuid}/vouchers/${e}`,onData:r});return{voucher:n,isLoading:o,pending:i,mutate:s}}function NB(){const{t:e}=$e(),{code:t}=_o(),{voucher:n}=vb(t),{portalSession:r}=He(),[o,i]=k.useState(!1),[s,a]=k.useState(!1),c=rn(),u=()=>{n!=null&&n.contact||r.contact?i(!0):a(!0)};return k.useEffect(()=>{n&&u()},[n]),n?w.jsxs(w.Fragment,{children:[o?w.jsx(kr,{to:`${je.VOUCHER}/${n.code}/redeem`}):w.jsx(Fr,{}),w.jsx(ni,{title:e("noContactLinkedToVoucherTitle"),isOpen:s,onClose:()=>a(!1),primaryAction:{label:e("linkToContact"),action:()=>c(`${je.VOUCHER}/${n.code}/identifier`)},secondaryAction:{label:e("cancel"),action:()=>a(!1)},children:w.jsx("p",{children:e("linkVoucherWithCodeToContact",{code:n.code})})})]}):w.jsx(Fr,{})}function Hl({redirectRoute:e}){const{state:t}=yr(),{t:n}=$e(),{onContactLink:r}=mn(),{portalSession:o,mutate:i}=He(),{publish:s}=Da(),[a,c]=k.useState(""),[u,d]=k.useState(!1),[h,f]=k.useState(!1),p=rn(),l=Gt(),m=v=>l.get(`${o.uuid}/contacts`,{contact_uuid:v}),y=()=>{d(!0),l.put(o.uuid,{email:a}).then(v=>{r&&m(v.data.data.contact.uuid).then(b=>{r==null||r(b.data.data)}),i().then(()=>p(e))}).catch(v=>{v.response.data.code===jc.CONTACT_NOT_FOUND&&f(!0)}).finally(()=>d(!1))},g=()=>{d(!0),l.post(`${o.uuid}/contacts`,{email:a}).then(y).finally(()=>d(!1))};return k.useEffect(()=>{s("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),w.jsxs(w.Fragment,{children:[w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:n("fillInXBelow",{x:n("emailAddress").toLowerCase()})})})}),w.jsx(jt,{children:w.jsx(Ni,{onSubmit:()=>a&&!u&&y(),children:w.jsx(Oi,{id:"via-email-address-input",label:n("emailAddress"),autoFocus:!0,onChange:v=>c(v.target.value),beforeIcon:"mail"})})}),w.jsx(pn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:n("continue"),className:"w-full",onClick:y,disabled:!a,pending:u}),w.jsx(dt,{label:n("useIdentifier"),variant:"secondary",onClick:()=>p("../identifier",{state:t})})]})})]})}),w.jsx(ni,{title:`${n("new")} ${n("emailAddress").toLowerCase()}`,isOpen:h,onClose:()=>f(!1),primaryAction:{label:n("confirm"),action:g,disabled:u},secondaryAction:{label:n("cancel"),action:()=>f(!1)},children:w.jsx("p",{children:n("continueWithEmail",{email:a})})})]})}function BB(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/*",element:w.jsx(OB,{})}),w.jsx(Je,{path:"/giftcard/:hash",element:w.jsx(PB,{})}),w.jsx(Je,{path:"/identifier/:identifierValue",element:w.jsx(RB,{})}),w.jsx(Je,{path:"/voucher/:code",element:w.jsx(NB,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.PORTAL})})]})}const MB={[nn.GIFTCARD]:`${je.GIFTCARD}/select`,[nn.REDEEM_GIFTCARD]:`${je.GIFTCARD}/redeem`,[nn.TOP_UP_GIFTCARD]:`${je.GIFTCARD}/top-up`};function DB(){const{t:e}=$e(),{portalSession:t}=He(),{errorToast:n}=tn(),[r,o]=k.useState(""),[i,s]=k.useState(!1),[a,c]=k.useState(!1),u=Gt(),d=rn(),h=()=>{s(!0),u.get(`${t.uuid}/giftcards/${r}`).then(f=>{const p=t.type;d(`${MB[p]}/${f.data.data.hash}`)}).catch(f=>{n(f),o("")}).finally(()=>s(!1))};return k.useEffect(()=>{!a&&r&&h()},[r]),w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanGiftcard")})})}),w.jsx(jt,{children:w.jsx(Gs,{data:r,dataSetter:o,setDefer:c,label:e("hash")})}),w.jsx(pn,{children:w.jsx(dt,{label:e("submit"),className:"w-full",onClick:h,disabled:!r,pending:i})})]})})}function LB(){const{t:e}=$e(),{hash:t}=_o(),n=rn();return w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("Choose type")})})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex gap-2",children:[w.jsx(dt,{className:"grow",label:"Redeem",onClick:()=>n(`${je.GIFTCARD}/redeem/${t}`)}),w.jsx(dt,{className:"grow",label:"Top up",onClick:()=>n(`${je.GIFTCARD}/top-up/${t}`)})]})})]})})}function wb(e){const{portalSession:t}=He(),[n,r]=k.useState(),{isLoading:o,pending:i,mutate:s}=_r({url:`${t.uuid}/giftcards/${e}`,onData:r});return{giftcard:n,isLoading:o,pending:i,mutate:s}}function dc(){const{mutate:e}=He();return{get:()=>e().then(r=>r.data.data.events),post:()=>{e().then(r=>{TC(r.data.data.events)})}}}function FB(){const{t:e}=$e(),{errorToast:t}=tn(),{hash:n}=_o(),{giftcard:r,mutate:o}=wb(n),{portalSession:i,mutate:s}=He(),{onUseGiftcard:a}=mn(),{post:c}=dc(),[u]=k.useState(i.results.remaining_amount?+i.results.remaining_amount:+i.inputData.amount_in_cents),[d,h]=k.useState(!1),f=i.inputData.allow_multiple_giftcards??!0,p=rn(),l=Gt(),m=()=>{h(!0),l.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:-y()}).then(E=>{o(),s(),c(),a==null||a(E.data.data)}).catch(t).finally(()=>h(!1))},y=()=>Math.min(g(),r.amount_in_cents),g=()=>i.results.remaining_amount??i.inputData.amount_in_cents,v=()=>{let E=0;return i.events.filter(A=>A.type===Fo.GIFTCARD_TRANSACTION).forEach(A=>{A.data.giftcard.uuid===r.uuid&&(E+=A.data.amount_in_cents)}),E},b=()=>{if(y())return{label:e("confirmAndPay",{amount:Qi(y(),i.currency)}),onClick:m};if(f&&g())return{label:e("useAnotherGiftcard"),onClick:()=>p(je.GIFTCARD),variant:"secondary"}};return r?w.jsx(Fn,{children:w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:`${e("giftcard")} ${r.hash}`})})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex h-full flex-col gap-4",children:[w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:e("balance")}),w.jsx(ti,{value:r.amount_in_cents,start:r.amount_in_cents-v(),currency:i.currency,asCurrency:!0})]})}),w.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:w.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[w.jsx("p",{className:"font-light text-gray-500",children:e("amountToPay")}),w.jsx("div",{className:"text-5xl font-bold",children:w.jsx(ti,{value:u+v(),start:u,currency:i.currency,asCurrency:!0})})]})})]})}),b()&&w.jsx(pn,{children:w.jsx(dt,{label:"",className:"w-full",...b(),pending:d})})]})}):w.jsx(Fr,{})}function jB({value:e,valueSetter:t,enabled:n}){const[r,o]=k.useState(!1),i=k.useRef(null),s=k.useRef(null);k.useEffect(()=>{u(e?e.toString():"")},[]);const a=d=>{t(d?parseInt(d):0),u(d)},c=d=>{const{key:h}=d;if(e===0&&!/^[1-9]$/.test(h)||e!==0&&!/^[0-9]$/.test(h)&&h!=="Backspace")return;let f;if(h!=="Backspace")f=parseInt(e===0?h:`${e}${h}`);else{const p=e.toString().slice(0,-1);f=p.length?parseInt(p,10):0}t(f),u(f?f.toString():"")},u=d=>{s&&s.current&&(d?s.current.style.width=`${Math.max(d.length,3)*3}rem`:s.current.style.width="calc(3rem + 14px)")};return w.jsxs(w.Fragment,{children:[w.jsx("input",{ref:s,className:"h-full w-[65px] rounded border-gray-200 border-transparent text-5xl [appearance:textfield] focus:border-transparent focus:ring-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",type:"number",pattern:"[0-9]*",inputMode:"numeric",placeholder:"0",autoFocus:!0,value:e?(e/100).toFixed(2):"",onKeyDown:c,onChange:()=>{},onFocus:()=>o(!0),onBlur:()=>o(!1)}),n&&w.jsx("div",{className:`mobile:hidden bottom-2 left-2 right-2 z-50 mx-auto w-[98vw] max-w-[1200px] ${!r&&"hidden"} absolute`,children:w.jsx(Hy,{keyboardRef:i,layout:{default:["1 2 3","4 5 6","7 8 9","00 0 {bksp}"]},theme:"hg-theme-default hg-layout-numeric numeric-theme",onChange:a})})]})}function bb({title:e,balance:t,balanceName:n,transaction:r,pending:o}){const{t:i}=$e(),[s,a]=k.useState(0),{portalSession:c}=He(),u=()=>{let d=0;return c.events.filter(f=>Object.values(Fo).includes(f.type)).forEach(f=>{d+=f.data.amount_in_cents}),d};return w.jsxs(qt,{children:[e&&w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e})})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex h-full flex-col gap-4",children:[w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),w.jsx(ti,{value:t??0,start:t??0,currency:c.currency,asCurrency:!0})]})}),w.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:w.jsx("div",{className:"flex items-center justify-center gap-1 p-4 text-5xl font-bold",children:u()?w.jsx(ti,{value:0,start:s,currency:c.currency,asCurrency:!0}):w.jsxs("div",{className:"flex items-center justify-center gap-1 ",children:[w.jsx("p",{children:IC(c.currency)}),w.jsx(jB,{value:s,valueSetter:a,enabled:c.inputData.enable_on_screen_keyboard})]})})})]})}),w.jsx(pn,{children:w.jsx(dt,{label:i("confirmAndPay",{amount:Qi(s,c.currency)}),className:"w-full",onClick:r&&(()=>r(s)),disabled:!s||!!u(),pending:o})})]})}function VB(){const{t:e}=$e(),{errorToast:t}=tn(),{hash:n}=_o(),{giftcard:r,mutate:o}=wb(n),{portalSession:i,mutate:s}=He(),{post:a}=dc(),{onUseGiftcard:c}=mn(),[u,d]=k.useState(!1),h=Gt(),f=p=>{d(!0),h.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:p}).then(l=>{o(),s(),a(),c==null||c(l.data.data),Tt.success(`${e("transactionSuccessful")}! ${e("totalUpgradedAmount")}: ${Qi(l.data.data.amount_in_cents)}`)}).catch(t).finally(()=>d(!1))};return r?w.jsx(Fn,{children:w.jsx(bb,{title:`${e("giftcard")} ${r.hash}`,balance:r.amount_in_cents,transaction:f,pending:u})}):w.jsx(Fr,{})}function UB(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(DB,{})}),w.jsx(Je,{path:"/select/:hash",element:w.jsx(LB,{})}),w.jsx(Je,{path:"/redeem/:hash",element:w.jsx(FB,{})}),w.jsx(Je,{path:"/top-up/:hash",element:w.jsx(VB,{})})]})}class Tp{constructor(){lr(this,"uuid");lr(this,"email");lr(this,"credit_balance");lr(this,"prepaid_balance");lr(this,"current_display_values")}getDisplayName(){return this.current_display_values.firstname||this.current_display_values.lastname?`${this.current_display_values.firstname} ${this.current_display_values.lastname}`:this.current_display_values.email}}const Eb=k.createContext({contact:new Tp,mutate:async()=>{}});function xp({children:e}){const{uuid:t}=He(),[n,r]=k.useState(new Tp),{mutate:o}=_r({url:`${t}/contacts`,onData:s=>{const a=new Tp;a.uuid=s.uuid,a.email=s.email,a.credit_balance=s.credit_balance,a.prepaid_balance=s.prepaid_balance,a.current_display_values=s.current_display_values,r(a)}}),i=k.useMemo(()=>({contact:n,mutate:o}),[n,o]);return n.uuid?w.jsx(Eb.Provider,{value:i,children:e}):w.jsx(Fr,{})}function Er(){const e=k.useContext(Eb);if(!e)throw new Error("Only use 'useContactContext' within a ContactProvider");return e}function Gl({message:e=""}){return w.jsxs("div",{className:"flex items-center justify-center gap-4 text-core-primary-500",children:[w.jsx(Hd,{className:"h-[32px] w-[32px]"}),e&&w.jsx("p",{className:"text-sm",children:e})]})}function HB(){const{t:e}=$e(),{errorToast:t}=tn(),{contact:n,mutate:r}=Er(),{uuid:o,portalSession:i,mutate:s}=He(),a=Gt(),c=()=>{a.post(`${o}/credit-receptions/create`,{unit_value:i.inputData.amount_in_cents/100}).then(()=>{r(),s()}).catch(t)},u=()=>{const d=i.events.filter(h=>h.type===Fo.CREDIT_RECEPTION);return d.length?d[0]:null};return k.useEffect(()=>{u()||c()},[]),w.jsx(Fn,{children:w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:n.getDisplayName()})})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[w.jsx("div",{className:"flex h-full flex-col items-center gap-2 p-6",children:i.inputData.amount_in_cents?w.jsx("div",{className:"flex h-full items-center justify-center gap-1 text-4xl font-bold",children:u()?w.jsxs(w.Fragment,{children:["+",w.jsx(ti,{value:u().data.credits,start:0})]}):w.jsx(Gl,{})}):w.jsx("p",{className:"text-core-red-500",children:e("xIsRequired",{x:"Amount in cents"})+"."})}),w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:`${e("new")} ${e("balance").toLowerCase()}`}),w.jsx(ti,{value:n.credit_balance.balance??0,start:n.credit_balance.balance-(u()?u().data.credits:0)})]})})]})})]})})}function GB(){const{portalSession:e}=He();return e.contact?w.jsx(xp,{children:w.jsx(HB,{})}):e.inputData.primary_identification_method&&e.inputData.primary_identification_method===zi.EMAIL?w.jsx(kr,{to:`${je.POINTS_TRANSACTION}/email`}):w.jsx(kr,{to:`${je.POINTS_TRANSACTION}/identifier`})}function kp({redirectRoute:e}){const{t}=$e(),{state:n}=yr(),{portalSession:r,mutate:o}=He(),{onContactLink:i}=mn(),[s,a]=k.useState(""),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=rn(),p=Gt();k.useEffect(()=>{!d&&s&&l()},[s]);const l=()=>{u(!0),p.put(r.uuid,{contact_identifier_value:s}).then(y=>{i&&m(y.data.data.contact.uuid).then(g=>{i==null||i(g.data.data)}),o().then(()=>f(e,{state:{contactIdentifier:s}}))}).catch(()=>f("link",{state:{contactIdentifier:s}})).finally(()=>u(!1))},m=y=>p.get(`${r.uuid}/contacts`,{contact_uuid:y});return w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:t("scanOrEnterX",{x:"identifier"})})})}),w.jsx(jt,{children:w.jsx(Ni,{onSubmit:()=>s&&l(),children:w.jsx(Gs,{data:s,dataSetter:a,setDefer:h,label:t("contactIdentifier")})})}),w.jsx(pn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:t("continue"),onClick:l,disabled:!s,pending:c}),r.inputData.enable_email_identification&&w.jsx(dt,{label:t("useEmail"),variant:"secondary",onClick:()=>f("../email",{state:n})})]})})]})})}function Op({redirectRoute:e}){const{t}=$e(),{errorToast:n}=tn(),{uuid:r,mutate:o}=He(),{onContactLink:i}=mn(),{state:s}=yr(),{publish:a}=Da(),[c,u]=k.useState(""),[d,h]=k.useState(!1),[f,p]=k.useState(!1),l=rn(),m=Gt();if(!s||!s.contactIdentifier)return w.jsx(kr,{to:"../"});const y=()=>{h(!0),m.post(`${r}/contacts/link-identifier`,{contact_identifier_value:s.contactIdentifier,email:c}).then(v).catch(E=>{E.response.data.code===jc.CONTACT_NOT_FOUND?p(!0):n(E)}).finally(()=>h(!1))},g=()=>{h(!0),m.post(`${r}/contacts`,{email:c}).then(y).catch(n).finally(()=>h(!1))},v=()=>{m.put(r,{email:c}).then(E=>{i&&b(E.data.data.contact.uuid).then(C=>{i==null||i(C.data.data)}),o().then(()=>l(e))}).catch(n).finally(()=>h(!1))},b=E=>m.get(`${r}/contacts`,{contact_uuid:E});return k.useEffect(()=>{a("openKeyboard",{inputId:"new-contact-identifier-input",inputValue:""})},[]),w.jsxs(Fn,{children:[w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:t("linkContact")})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx(dx,{body:t("noEmailAddressLinkedToIdentifier")}),w.jsx(Ni,{onSubmit:y,children:w.jsx(Oi,{id:"new-contact-identifier-input",label:t("emailAddress"),autoFocus:!0,onChange:E=>u(E.target.value),beforeIcon:"mail"})})]})}),w.jsx(pn,{children:w.jsx(dt,{label:t("continue"),className:"w-full",onClick:y,disabled:!c||d})})]}),w.jsx(ni,{title:`${t("new")} ${t("emailAddress").toLowerCase()}`,isOpen:f,onClose:()=>p(!1),primaryAction:{label:t("confirm"),action:g,loading:d},secondaryAction:{label:t("cancel"),action:()=>p(!1)},children:w.jsx("p",{children:t("continueWithEmail",{email:c})})})]})}function qB(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(GB,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.POINTS_TRANSACTION})}),w.jsx(Je,{path:"/identifier",element:w.jsx(kp,{redirectRoute:je.POINTS_TRANSACTION})}),w.jsx(Je,{path:"/identifier/link",element:w.jsx(Op,{redirectRoute:je.POINTS_TRANSACTION})})]})}function $B(){const{portalSession:e}=He(),{primaryIdentificationMethod:t}=mn();return e.contact?w.jsx(kr,{to:`${je.PORTAL}/overview`}):t&&t===zi.EMAIL?w.jsx(kr,{to:`${je.PORTAL}/email`}):w.jsx(kr,{to:`${je.PORTAL}/identifier`})}function WB({children:e}){return w.jsx("div",{className:"h-screen w-screen pb-[70px] md:px-4 md:pb-[86px] md:pt-4 lg:pb-4 lg:pt-[66px]",children:w.jsx("div",{className:"h-full max-h-full",children:e})})}function YB({contact:e}){const{t}=$e(),n=rn();return w.jsxs("div",{className:"inline-grid w-full items-center gap-4 py-4 lg:grid-cols-2",children:[w.jsxs("div",{className:"flex items-center gap-4",children:[w.jsx(Sh,{src:e.current_display_values.avatar,size:"2xl"}),w.jsxs("div",{className:"flex flex-col gap-1",children:[w.jsxs("div",{className:"flex gap-2",children:[w.jsx("p",{className:"text-lg",children:e.getDisplayName()}),e.current_display_values.tier&&w.jsx(Ah,{label:e.current_display_values.tier,size:"sm",stroke:!0})]}),w.jsx("p",{className:"text-sm text-core-gray-500 ",children:t("joinedAtDate",{date:new Date(e.current_display_values.created_at).toLocaleDateString(ln.language,{month:"long",year:"numeric"})})})]})]}),w.jsxs("div",{className:"inline-grid gap-2 lg:grid-cols-2",children:[w.jsx(dt,{label:t("goToX",{x:"identifiers"}),variant:"secondary",size:"md",onClick:()=>n("contact-identifiers")}),w.jsx(dt,{before:w.jsx(Pn,{icon:"edit"}),label:t("editProfile"),variant:"secondary",size:"md",onClick:()=>n("contact-attributes")})]})]})}function fc({children:e}){return w.jsx("div",{className:"flex-grow rounded-lg border p-4",children:e})}function zB(){const{t:e}=$e(),{contact:t}=Er(),{portalSession:n}=He();return w.jsxs("div",{className:"flex gap-2 lg:flex-col",children:[w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[w.jsx("p",{className:"text-2xl leading-8",children:t.current_display_values.loyalty_balance}),w.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})}),w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[w.jsx("p",{className:"text-2xl leading-8",children:Qi(t.prepaid_balance.balance_in_cents,n.currency)}),w.jsx("p",{className:"text-sm text-core-gray-500",children:e("prepaidCredit")})]})})]})}function KB(){const{t:e}=$e(),{contact:t}=Er(),{portalSession:n}=He(),r=(o,i)=>I0(o,i)?`${I0(o,i)} ${e("yearsAgo")}`:A0(o,i)?`${A0(o,i)} ${e("weeksAgo")}`:S0(o,i)?`${S0(o,i)} ${e("daysAgo")}`:e("today");return w.jsx(fc,{children:w.jsxs("div",{className:"h-full justify-between",children:[w.jsx("p",{className:"mb-4 text-lg font-semibold leading-7",children:"Stats"}),w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Pn,{icon:"calendar"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-xs font-semibold",children:r(new Date,new Date(t.current_display_values.loyalty_last_transaction_date))}),w.jsx("p",{className:"text-xs text-core-gray-500",children:e("lastVisit")})]})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Pn,{icon:"shopping-bag"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-xs font-semibold",children:`${t.current_display_values.loyalty_number_of_transactions} ${e("visits")}`}),w.jsx("p",{className:"text-xs text-core-gray-500",children:e("totalVisits")})]})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Pn,{icon:"dollar"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-xs font-semibold",children:`${t.current_display_values.loyalty_total_credits_received} ${n.loyaltyProgram.custom_credit_name}`}),w.jsx("p",{className:"text-xs text-core-gray-500",children:e("totalCredits")})]})]})]})]})})}function Cb(){const{uuid:e}=He(),[t,n]=k.useState([]),{data:r,isLoading:o,pending:i,mutate:s}=_r({url:`${e}/loyalty-transactions`});return k.useEffect(()=>{r&&n(r.data)},[r]),{loyaltyTransactions:t,isLoading:o,pending:i,mutate:s}}function _b({loyaltyTransaction:e}){const{t}=$e();return w.jsxs("div",{className:"mb-2 flex justify-between",children:[w.jsx("p",{className:"text-xs text-core-gray-500",children:e.type===l0.CREDIT_RECEPTION?t("transaction"):`${t("isRedeemed")} '${e.loyalty_transaction_data.title}'`}),w.jsx("p",{className:"text-xs font-semibold",children:e.credits>0?"+"+e.credits:e.credits})]})}function XB(){const{t:e}=$e(),t=rn(),{loyaltyTransactions:n}=Cb();return n?w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx("p",{className:"text-lg font-semibold leading-7",children:e("activities")}),n&&n.length?w.jsx("div",{children:n.slice(0,5).map(r=>w.jsx(_b,{loyaltyTransaction:r},r.uuid))}):w.jsx("p",{className:"text-sm text-core-gray-500",children:e("noActivity")})]}),w.jsx(dt,{label:`${e("all")} ${e("activities").toLowerCase()}`,variant:"secondary",onClick:()=>t("activity")})]})}):w.jsx(Gl,{})}function Sb(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/subscriptions/contact`,onData:n});return{subscriptions:t,isLoading:r,pending:o,mutate:i}}function Ab({subscription:e,onChange:t,editable:n=!1}){const{t:r}=$e();return w.jsxs("div",{className:"mb-2 flex justify-between",children:[w.jsx("p",{className:"text-xs font-semibold",children:e.subscription_type.name}),n?w.jsx(op,{defaultChecked:e.is_subscribed,disabled:e.subscription_type.strategy===d0.FUNCTIONAL,onChange:t&&(()=>t(e.subscription_type.name))}):w.jsx(Ah,{label:r(e.status.toLowerCase()),size:"sm",color:e.is_subscribed?"primary":"gray"})]})}function QB(){const{t:e}=$e(),{subscriptions:t}=Sb(),n=rn();return t?w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col justify-between",children:[w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx("p",{className:"text-lg font-semibold leading-7",children:e("subscriptions")}),w.jsx("div",{children:t.map(r=>w.jsx(Ab,{subscription:r},r.subscription_type.uuid))})]}),w.jsx(dt,{label:e("change"),before:w.jsx(Pn,{icon:"edit"}),variant:"secondary",onClick:()=>n("subscriptions")})]})}):w.jsx(Gl,{})}function JB(){const{contact:e}=Er();return w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(YB,{contact:e})}),w.jsx(jt,{children:w.jsxs("div",{className:"grid grid-cols-1 gap-x-2 gap-y-2 lg:grid-cols-4",children:[w.jsx(zB,{}),w.jsx(KB,{}),w.jsx(XB,{}),w.jsx(QB,{})]})})]})}function hc({label:e,path:t}){const n=rn();return w.jsx("div",{className:"flex h-16 items-center text-base text-core-gray-900",children:w.jsx(dt,{label:e,variant:"link-gray",before:w.jsx(Pn,{icon:"caret-left",size:"md"}),onClick:()=>n(t)})})}function ZB(){const{t:e}=$e(),{loyaltyTransactions:t}=Cb(),{contact:n}=Er();return w.jsx("div",{className:"h-full md:container",children:w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(jt,{children:w.jsxs("div",{className:"md:max-h-[528px]",children:[w.jsx("p",{className:"text-sm font-medium",children:e("allActivities")}),w.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:e("checkOutAllActivitiesOfName",{name:n.getDisplayName()})}),w.jsx("div",{className:"overflow-auto",children:t==null?void 0:t.map(r=>w.jsx(_b,{loyaltyTransaction:r},r.uuid))})]})})]})})}function eM(){const{t:e}=$e(),{errorToast:t}=tn(),{uuid:n}=He(),{subscriptions:r,mutate:o}=Sb(),[i,s]=k.useState({}),[a,c]=k.useState(!1),u=Gt();k.useEffect(()=>{if(r&&!Object.keys(i).length){const p=r.reduce((l,m)=>({...l,[m.subscription_type.name]:m.is_subscribed}),{});s(p)}},[]);const d=p=>{Object.hasOwn(i,p)?s({...i,[p]:!i[p]}):s({...i,[p]:!0})},h=()=>{c(!0),u.put(`${n}/subscriptions`,{values:i}).then(()=>o()).catch(t).finally(()=>c(!1))},f=()=>r&&r.some(p=>i[p.subscription_type.name]!==p.is_subscribed);return r?w.jsx("div",{className:"h-full md:container",children:w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(jt,{children:w.jsx("div",{className:"md:max-h-[528px]",children:w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium",children:e("subscriptions")}),w.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:e("manageEmailPreferences")}),r.map(p=>w.jsx(Ab,{subscription:p,onChange:d,editable:!0},p.subscription_type.uuid))]})})}),w.jsx(pn,{children:w.jsx(dt,{label:e("saveChanges"),className:"w-full",onClick:h,pending:a,disabled:!f()||a})})]})}):w.jsx(Gl,{})}function tM(){const{t:e}=$e(),{errorToast:t}=tn(),{uuid:n}=He(),{contact:r,mutate:o}=Er(),[i,s]=k.useState(),[a,c]=k.useState(!1),[u,d]=k.useState(),h=Gt();_r({url:`${n}/contact-attributes`,onData:m=>s(m.elements)});const f=m=>{d({...u,[m.target.name]:m.target.value})},p=(m,y)=>{d({...u,[m]:y})},l=async()=>{c(!0),h.put(`${n}/contact-attributes`,u).then(()=>{o(),d(void 0)}).catch(t).finally(()=>c(!1))};return w.jsx("div",{className:"h-full md:container",children:w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(jt,{children:w.jsxs("div",{className:"md:max-h-[528px]",children:[w.jsxs("div",{className:"mb-4 flex flex-row items-center gap-4 border-b border-b-core-gray-200 px-1 pb-4",children:[w.jsx(Sh,{src:r.current_display_values.avatar,size:"2xl"}),w.jsxs("div",{children:[w.jsx("div",{className:"flex flex-row items-center gap-2 ",children:w.jsxs("h1",{className:"text-lg text-core-gray-900",children:[r.current_display_values.firstname," ",r.current_display_values.lastname]})}),w.jsx("p",{className:"text-sm text-core-gray-500",children:r.current_display_values.email})]})]}),i?i.map(m=>{if(!(m.type==="media_upload"||m.type==="email"))return m.type==="select"?w.jsx(Ax,{name:m.name,label:m.label,value:u&&u[m.name]?u[m.name]:r.current_display_values[m.name],onChange:y=>p(m.name,y),disabled:m.disabled,children:m.options.map(y=>w.jsx(Th,{label:y.label,value:y.value},y.value))},m.id):m.type==="multi_select"?w.jsx(Ex,{name:m.name,value:u&&u[m.name]?u[m.name]:m.defaultValue,label:m.label,onChange:p,disabled:m.disabled,options:m.options},m.id):m.type==="birth_date"||m.type==="date_time"?w.jsx(qy,{id:m.id,name:m.name,label:m.label,type:m.type==="date_time"?"date_time":"date",value:u&&u[m.name]?u[m.name]:r.current_display_values[m.name],disabled:m.disabled,onChange:f},m.id):w.jsx(Oi,{disabled:m.disabled,label:m.label,name:m.name,value:u&&u[m.name]!=="undefined"?u[m.name]:r.current_display_values[m.name],onChange:f},m.id)}):w.jsx(vl,{rows:10})]})}),w.jsx(pn,{children:w.jsx(dt,{label:e("saveChanges"),className:"w-full",onClick:l,disabled:!u,pending:a})})]})})}function Ib(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/contact-identifiers`,onData:n});return{contactIdentifiers:t,isLoading:r,pending:o,mutate:i}}function nM({identifier:e,onClear:t}){const{t:n}=$e();return w.jsxs("div",{className:"flex items-center justify-between rounded-lg border text-xs",children:[w.jsxs("div",{className:"flex-col pl-4",children:[w.jsx("p",{className:"font-semibold",children:e.value}),w.jsx("p",{className:"text-core-gray-500",children:n("contactIdentifier")})]}),w.jsx("div",{className:"h-full border-l p-4 hover:cursor-pointer hover:bg-core-gray-50",onClick:()=>t&&t(e.value),children:w.jsx(Pn,{className:"h-full",icon:"close"})})]})}function rM(){const{t:e}=$e(),{errorToast:t}=tn(),{uuid:n}=He(),{contactIdentifiers:r,isLoading:o,mutate:i}=Ib(),[s,a]=k.useState(""),[c,u]=k.useState(!1),d=rn(),h=Gt(),f=l=>{a(l),u(!0)},p=async()=>{h.destroy(`${n}/contact-identifiers`,{value:s}).then(()=>i()).catch(t).finally(()=>u(!1))};return w.jsxs("div",{className:"h-full md:container",children:[w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(jt,{children:w.jsx("div",{className:"md:max-h-[528px]",children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium",children:e("contactIdentifiers")}),w.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:e("contactIdentifierDescription")})]}),o?w.jsx(vl,{rows:10}):r==null?void 0:r.map(l=>w.jsx(nM,{identifier:l,onClear:f},l.value))]})})}),w.jsx(pn,{children:w.jsx(dt,{label:e("addIdentifier"),className:"w-full",variant:"secondary",onClick:()=>d("create")})})]}),w.jsx(ni,{title:e("confirmClearContactIdentifier"),isOpen:c,primaryAction:{label:e("confirm"),action:p},secondaryAction:{label:e("cancel"),action:()=>u(!1)},onClose:()=>u(!1),children:w.jsx("p",{children:e("clearContactIdentifier",{value:s})})})]})}function oM(){const{t:e}=$e(),{errorToast:t}=tn(),{uuid:n}=He(),{contact:r}=Er(),{mutate:o}=Ib(),[i,s]=k.useState(""),[a,c]=k.useState(!1),[u,d]=k.useState(!1),h=rn(),f=Gt(),p=()=>{c(!0),f.post(`${n}/contacts/link-identifier`,{contact_identifier_value:i,email:r.email}).then(()=>{o(),h("../profile/contact-identifiers")}).catch(t).finally(()=>{s(""),c(!1)})};return k.useEffect(()=>{!u&&i&&p()},[i]),w.jsx("div",{className:"h-full md:container",children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx(hc,{label:e("back"),path:"../profile/contact-identifiers"})}),w.jsx(jt,{children:w.jsx(Ni,{onSubmit:()=>i&&p(),children:w.jsx(Gs,{data:i,dataSetter:s,setDefer:d,label:e("contactIdentifier")})})}),w.jsx(pn,{children:w.jsx(dt,{label:e("addIdentifier"),className:"w-full",onClick:p,pending:a,disabled:!i})})]})})}function iM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/profile",element:w.jsx(JB,{})}),w.jsx(Je,{path:"/profile/activity",element:w.jsx(ZB,{})}),w.jsx(Je,{path:"/profile/subscriptions",element:w.jsx(eM,{})}),w.jsx(Je,{path:"/profile/contact-identifiers",element:w.jsx(rM,{})}),w.jsx(Je,{path:"/profile/contact-identifiers/create",element:w.jsx(oM,{})}),w.jsx(Je,{path:"/profile/contact-attributes",element:w.jsx(tM,{})})]})}function sM(){const{t:e}=$e(),{contact:t}=Er(),{portalSession:n}=He();return w.jsxs("div",{className:"flex h-16 items-center justify-between",children:[w.jsx("h1",{children:e("rewards")}),w.jsxs("div",{className:"flex flex-col items-center",children:[w.jsx("p",{children:t.credit_balance.balance}),w.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})]})}function Tb(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/rewards`,onData:n});return{rewards:t,isLoading:r,pending:o,mutate:i}}function Pp({reward:e,selected:t,setSelected:n,disabled:r,readOnly:o}){const{portalSession:i}=He(),{contact:s}=Er();return w.jsxs("div",{className:`max-h-[48px] rounded-lg border ${r?"pointer-events-none opacity-40":!o&&"cursor-pointer"}`,children:[w.jsxs("div",{className:`flex items-center justify-between rounded-lg text-xs ${r?"px-2 pt-2":"p-2"}`,onClick:o?void 0:()=>(t==null?void 0:t.uuid)===e.uuid?n(void 0):n(e),children:[w.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[w.jsx("img",{src:e.media&&e.media.value?e.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),w.jsx("p",{className:"truncate",children:e.title??e.description})]}),w.jsxs("p",{className:"whitespace-nowrap text-core-primary-500",children:[e.required_credits," ",i.loyaltyProgram.custom_credit_name]})]}),e.required_credits-s.credit_balance.balance>0&&w.jsx(Cx,{value:s.credit_balance.balance,max:e.required_credits})]})}function aM({selected:e,setSelected:t}){const{t:n}=$e(),{contact:r}=Er(),{rewards:o,isLoading:i}=Tb(),s=o==null?void 0:o.filter(c=>c.required_credits<=r.credit_balance.balance),a=o==null?void 0:o.filter(c=>c.required_credits>r.credit_balance.balance);return w.jsx(w.Fragment,{children:i?w.jsx(vl,{rows:1}):w.jsxs("div",{className:"flex flex-col gap-3 md:max-h-[528px]",children:[w.jsx("div",{className:"flex flex-col gap-1",children:(s==null?void 0:s.length)>0&&w.jsxs(w.Fragment,{children:[w.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("redeemableRewards")}),s.map(c=>w.jsx(Pp,{reward:c,selected:e,setSelected:t},c.uuid))]})}),w.jsx("div",{className:"flex flex-col gap-1",children:(a==null?void 0:a.length)>0&&w.jsxs(w.Fragment,{children:[w.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("saveABitMore")}),a.map(c=>w.jsx(Pp,{reward:c,selected:e,setSelected:t,disabled:!0},c.uuid))]})})]})})}function cM(){const{portalSession:e}=He(),{rewards:t}=Tb(),n=()=>e.events.filter(r=>r.type===Fo.REWARD_RECEPTION).map(r=>t.find(o=>o.uuid===r.data.reward.uuid)).filter(r=>r);return t?w.jsx("div",{children:w.jsx(Yv,{children:n().map((r,o)=>w.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-core-primary-100 bg-core-primary-50 p-2 text-xs",children:[w.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[w.jsx("img",{src:r.media&&r.media.value?r.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-8 w-8 rounded object-cover object-center"}),w.jsx("p",{className:"truncate",children:r.title??r.description})]}),w.jsxs("p",{className:"text-core-primary-500",children:[r.required_credits," ",e.loyaltyProgram.custom_credit_name]})]},`${o}-${r.uuid}`))},n().length)}):w.jsx(w.Fragment,{})}function uM(){const{t:e}=$e(),{errorToast:t,successToast:n}=tn(),{portalSession:r,mutate:o}=He(),{mutate:i}=Er(),{onClaimReward:s}=mn(),[a,c]=k.useState(),[u,d]=k.useState(!1),[h,f]=k.useState(!1),{post:p}=dc(),l=Gt();k.useEffect(()=>{a&&f(!0)},[a]);const m=g=>{o().then(v=>{const E=v.data.data.events.filter(C=>C.type===Fo.REWARD_RECEPTION&&C.data.reward.uuid===a.uuid).reduce((C,A)=>new Date(C.created_at)>new Date(A.created_at)?C:A);s==null||s(g,E.data.uuid)})},y=()=>{d(!0),l.post(`${r.uuid}/rewards/claim`,{uuid:a.uuid}).then(g=>{p(),i(),m(g.data.data),n(e("rewardClaimed",{name:g.data.data.title}))}).catch(t).finally(()=>{f(!1),c(void 0),d(!1)})};return w.jsxs("div",{className:"h-full md:container",children:[w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(sM,{})}),w.jsx(jt,{children:w.jsx(aM,{selected:a,setSelected:c})}),w.jsx(pn,{children:w.jsx(cM,{})})]}),w.jsx(ni,{title:e("confirmRewardRedemption"),isOpen:h,primaryAction:{label:e("confirm"),action:y,loading:u},secondaryAction:{label:e("cancel"),action:()=>f(!1)},onClose:()=>f(!1),children:w.jsx("div",{className:"flex flex-col gap-4",children:a&&w.jsx(Pp,{reward:a,selected:a,setSelected:c,readOnly:!0})})})]})}function Rp(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/vouchers`,onData:n});return{vouchers:t,isLoading:r,pending:o,mutate:i}}function lM(){const{t:e}=$e();return w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("vouchers")})})}function Np({voucher:e,selected:t,setSelected:n}){const{t:r}=$e();return w.jsxs("div",{className:`flex cursor-pointer items-center justify-between gap-4 rounded-lg ${e.status===oa.REDEEMED?"border border-core-primary-100 bg-core-primary-50":"border bg-white"} p-2 text-xs`,onClick:()=>(t==null?void 0:t.code)===e.code?n(void 0):n(e),children:[w.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[w.jsx("img",{src:e.promotion.image?e.promotion.image.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),w.jsxs("div",{className:"overflow-hidden overflow-ellipsis ",children:[w.jsx("p",{className:"font-semibold",children:e.name}),e.status===oa.REDEEMED?w.jsx("p",{className:"text-core-gray-500",children:r("redeemed")}):w.jsx("p",{className:"text-core-primary-500",children:e.expiration_date?`Valid until ${new Date(e.expiration_date).toLocaleDateString()}`:r("nonExpiring")})]})]}),w.jsx("p",{className:`text-core-${e.status===oa.REDEEMED?"gray":"primary"}-500`,children:e.code})]})}function dM({selected:e,setSelected:t}){const{t:n}=$e(),{vouchers:r,isLoading:o}=Rp();return w.jsx(w.Fragment,{children:o?w.jsx(vl,{rows:1}):w.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:w.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:r&&r.length?r.map(i=>w.jsx(Np,{voucher:i,selected:e,setSelected:t},i.code)):w.jsx("p",{className:"text-center text-sm text-core-gray-500",children:n("vouchersEmptyState")})})})})}function fM(){const{t:e}=$e(),{portalSession:t}=He(),{vouchers:n}=Rp(),r=()=>t.events.filter(o=>o.type===Fo.VOUCHER_REDEEMED);return n?w.jsx("div",{children:w.jsx(Yv,{children:r().map((o,i)=>w.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-core-primary-100 bg-core-primary-50 p-2",children:w.jsx("div",{className:"flex h-full flex-col justify-between text-xs",children:w.jsxs("div",{className:"overflow-hidden",children:[w.jsx("p",{className:"font-semibold",children:o.data.name}),w.jsxs("p",{className:"overflow-ellipsis text-core-gray-500",children:[o.data.code," - ",e("applied")]})]})})},`${i}-${o.data.uuid}`))},r().length)}):w.jsx(w.Fragment,{})}function hM(){const{t:e}=$e(),{errorToast:t,successToast:n}=tn(),{uuid:r}=He(),{onRedeemVoucher:o}=mn(),{post:i}=dc(),{mutate:s}=Rp(),[a,c]=k.useState(),[u,d]=k.useState(!1),[h,f]=k.useState(!1),p=Gt();k.useEffect(()=>{a&&f(!0)},[a]);const l=()=>{d(!0),p.post(`${r}/vouchers/redeem`,{code:a.code}).then(y=>{i(),o&&o(y.data.data),n(e("voucherSuccessfullyRedeemed")),s()}).catch(t).finally(()=>{m(),d(!1)})},m=()=>{f(!1),c(void 0)};return w.jsxs("div",{className:"h-full md:container",children:[w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(lM,{})}),w.jsx(jt,{children:w.jsx(dM,{selected:a,setSelected:c})}),w.jsx(pn,{children:w.jsx(fM,{})})]}),w.jsx(ni,{title:e("confirmVoucherRedemption"),isOpen:h,primaryAction:{label:e("confirm"),action:l,loading:u},secondaryAction:{label:e("cancel"),action:m},onClose:m,children:w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx("p",{children:e("redeemTitle",{title:a==null?void 0:a.name})}),a&&w.jsx(Np,{voucher:a,setSelected:c})]})})]})}function pM(){const{t:e}=$e(),[t,n]=k.useState(1),r=rn(),o=[{id:0,label:e("profile"),icon:"user",pathname:"profile"},{id:1,label:e("rewards"),icon:"edit",pathname:"rewards"},{id:2,label:e("vouchers"),icon:"mail",pathname:"vouchers"}];return k.useEffect(()=>{r(o[t].pathname)},[]),w.jsx(xp,{children:w.jsxs("div",{className:"relative h-full w-full select-none overflow-auto",children:[w.jsx(eO,{children:o.map(i=>w.jsx(tO,{id:i.id,label:i.label,icon:i.icon,activeTab:t,setActiveTab:n,pathname:i.pathname},i.id))}),w.jsxs(WB,{children:[w.jsx(iM,{}),w.jsxs(So,{children:[w.jsx(Je,{path:"/rewards",element:w.jsx(uM,{})}),w.jsx(Je,{path:"/vouchers",element:w.jsx(hM,{})})]})]})]})})}function mM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx($B,{})}),w.jsx(Je,{path:"/overview/*",element:w.jsx(pM,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.PORTAL})}),w.jsx(Je,{path:"/identifier",element:w.jsx(kp,{redirectRoute:je.PORTAL})}),w.jsx(Je,{path:"/identifier/link",element:w.jsx(Op,{redirectRoute:je.PORTAL})})]})}function xb(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/prepaid`,onData:n});return{prepaidBalance:t,isLoading:r,pending:o,mutate:i}}function gM(){const{t:e}=$e(),{state:t}=yr(),{errorToast:n,successToast:r}=tn(),{uuid:o,mutate:i}=He(),{contact:s}=Er(),{onCreatePrepaidTransaction:a}=mn(),{prepaidBalance:c,mutate:u}=xb(),[d,h]=k.useState(!1),f=Gt(),p=l=>{h(!0),f.post(`${o}/prepaid/transaction`,{amount_in_cents:l,contact_identifier_value:(t==null?void 0:t.contactIdentifier)??void 0}).then(m=>{u(),i(),a(m.data.data),r(e("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?w.jsx(Fn,{children:w.jsx(bb,{title:s.getDisplayName(),balance:(c==null?void 0:c.balance_in_cents)??0,balanceName:e("prepaidBalance"),transaction:p,pending:d})}):w.jsx(Fr,{})}function yM({title:e,balance:t,balanceName:n,transaction:r,pending:o}){const{t:i}=$e(),{portalSession:s}=He(),a=s.inputData.amount_in_cents??0,c=()=>{let d=0;return s.events.filter(f=>Object.values(Fo).includes(f.type)).forEach(f=>{d+=f.data.amount_in_cents}),d},u=()=>Math.min(a+c(),t);return w.jsxs(qt,{children:[e&&w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e})})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex h-full flex-col gap-4",children:[w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),w.jsx(ti,{value:t,start:t+c(),currency:s.currency,asCurrency:!0})]})}),w.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:w.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[w.jsx("p",{className:"text-sm font-light text-gray-500",children:i("amountToPay")}),w.jsx("div",{className:"text-5xl font-bold",children:w.jsx(ti,{value:u(),start:a,currency:s.currency,asCurrency:!0})})]})})]})}),w.jsx(pn,{children:w.jsx(dt,{label:i("confirmAndPay",{amount:Qi(u(),s.currency)}),className:"w-full",onClick:()=>r==null?void 0:r(-u()),disabled:!a||!!c(),pending:o})})]})}function vM(){const{t:e}=$e(),{state:t}=yr(),{errorToast:n,successToast:r}=tn(),{uuid:o,mutate:i}=He(),{contact:s}=Er(),{onCreatePrepaidTransaction:a}=mn(),{prepaidBalance:c,mutate:u}=xb(),[d,h]=k.useState(!1),f=Gt(),p=l=>{h(!0),f.post(`${o}/prepaid/transaction`,{amount_in_cents:l,contact_identifier_value:(t==null?void 0:t.contactIdentifier)??void 0}).then(m=>{u(),i(),a(m.data.data),r(e("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?w.jsx(Fn,{children:w.jsx(yM,{title:s.getDisplayName(),balance:c.balance_in_cents,balanceName:e("prepaidBalance"),transaction:p,pending:d})}):w.jsx(Fr,{})}function wM({setType:e}){const{t}=$e();return w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:t("Choose type")})})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex gap-2",children:[w.jsx(dt,{className:"grow",label:t("pay"),onClick:()=>e(nn.PAY_PREPAID)}),w.jsx(dt,{className:"grow",label:t("topUp"),onClick:()=>e(nn.TOP_UP_PREPAID)})]})})]})})}function bM(){const{portalSession:e}=He(),{primaryIdentificationMethod:t}=mn(),[n,r]=k.useState(e.type);if(!e.contact)return t&&t===zi.EMAIL?w.jsx(kr,{to:`${je.PREPAID}/email`}):w.jsx(kr,{to:`${je.PREPAID}/identifier`});const o=()=>n===nn.TOP_UP_PREPAID?w.jsx(gM,{}):n===nn.PAY_PREPAID?w.jsx(vM,{}):w.jsx(wM,{setType:r});return w.jsx(xp,{children:o()})}function EM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(bM,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.PREPAID})}),w.jsx(Je,{path:"/identifier",element:w.jsx(kp,{redirectRoute:je.PREPAID})}),w.jsx(Je,{path:"/identifier/link",element:w.jsx(Op,{redirectRoute:je.PREPAID})})]})}function CM(){const{t:e}=$e(),{errorToast:t}=tn(),{uuid:n,portalSession:r}=He(),[o,i]=k.useState(""),[s,a]=k.useState(!1),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=rn(),p=Gt(),l=()=>{a(!0),p.get(`${n}/vouchers/check/${o}`).then(m=>{m.data.data.contact||r.contact?f(`${o}/redeem`):h(!0)}).catch(t).finally(()=>a(!1))};return k.useEffect(()=>{!c&&o&&l()},[o]),w.jsxs(w.Fragment,{children:[w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanOrEnterX",{x:e("voucherCode").toLowerCase()})})})}),w.jsx(jt,{children:w.jsx(Gs,{data:o,dataSetter:i,setDefer:u,label:e("code")})}),w.jsx(pn,{children:w.jsx(dt,{label:e("submit"),className:"w-full",onClick:l,pending:s})})]})}),w.jsx(ni,{title:e("noContactLinkedToVoucherTitle"),isOpen:d,onClose:()=>h(!1),primaryAction:{label:e("linkToContact"),action:()=>f(`${o}/identifier`)},secondaryAction:{label:e("cancel"),action:()=>h(!1)},children:w.jsx("p",{children:e("linkVoucherWithCodeToContact",{code:o})})})]})}function _M(){const{t:e}=$e(),{errorToast:t}=tn(),{code:n}=_o(),{uuid:r}=He(),{onRedeemVoucher:o}=mn(),{post:i}=dc(),{voucher:s,mutate:a}=vb(n),[c,u]=k.useState(!1),d=Gt(),h=()=>{u(!0),d.post(`${r}/vouchers/redeem`,{code:n}).then(f=>{o==null||o(f.data.data),i(),a()}).catch(t).finally(()=>u(!1))};return s?w.jsx(Fn,{children:w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:"Voucher"})})}),w.jsx(jt,{children:w.jsx("div",{children:w.jsx(Np,{voucher:s,setSelected:()=>{}})})}),w.jsx(pn,{children:w.jsx(dt,{label:e("redeemVoucher"),className:"w-full",onClick:h,disabled:s.status!==oa.ACTIVE||c,pending:c})})]})}):w.jsx(Fr,{})}function SM(){const{t:e}=$e(),{errorToast:t}=tn(),{code:n}=_o(),{portalSession:r,mutate:o}=He(),{onContactLink:i}=mn(),[s,a]=k.useState(""),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=rn(),p=Gt(),l=y=>p.get(`${r.uuid}/contacts`,{contact_uuid:y}),m=()=>{u(!0),p.put(r.uuid,{contact_identifier_value:s}).then(y=>{i&&l(y.data.data.contact.uuid).then(g=>{i==null||i(g.data.data)}),o().then(()=>f(`${je.VOUCHER}/${n}/redeem`))}).catch(t).finally(()=>u(!1))};return k.useEffect(()=>{!d&&s&&m()},[s]),w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanOrEnterX",{x:"identifier"})})})}),w.jsx(jt,{children:w.jsx(Ni,{onSubmit:m,children:w.jsx(Gs,{data:s,dataSetter:a,setDefer:h,label:e("contactIdentifier")})})}),w.jsx(pn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:e("continue"),onClick:m,pending:c}),r.inputData.enable_email_identification&&w.jsx(dt,{label:e("useEmail"),variant:"secondary",onClick:()=>f(`../${n}/email`)})]})})]})})}function AM(){const{t:e}=$e(),{code:t}=_o(),{onContactLink:n}=mn(),{portalSession:r,mutate:o}=He(),{publish:i}=Da(),[s,a]=k.useState(""),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=rn(),p=Gt(),l=g=>p.get(`${r.uuid}/contacts`,{contact_uuid:g}),m=()=>{u(!0),p.put(r.uuid,{email:s}).then(g=>{n&&l(g.data.data.contact.uuid).then(v=>{n==null||n(v.data.data)}),o().then(()=>f(`${je.VOUCHER}/${t}/redeem`))}).catch(g=>{g.response.data.code===jc.CONTACT_NOT_FOUND&&h(!0)}).finally(()=>u(!1))},y=()=>{u(!0),p.post(`${r.uuid}/contacts`,{email:s}).then(m).finally(()=>u(!1))};return k.useEffect(()=>{i("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),w.jsxs(w.Fragment,{children:[w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("fillInXBelow",{x:e("emailAddress").toLowerCase()})})})}),w.jsx(jt,{children:w.jsx(Ni,{onSubmit:()=>s&&!c&&m(),children:w.jsx(Oi,{id:"via-email-address-input",label:e("emailAddress"),autoFocus:!0,onChange:g=>a(g.target.value),beforeIcon:"mail"})})}),w.jsx(pn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:e("continue"),className:"w-full",onClick:m,pending:c,disabled:!s||c}),w.jsx(dt,{label:e("useIdentifier"),variant:"secondary",onClick:()=>f(`../${t}/identifier`)})]})})]})}),w.jsx(ni,{title:`${e("new")} ${e("emailAddress").toLowerCase()}`,isOpen:d,onClose:()=>h(!1),primaryAction:{label:e("confirm"),action:y,disabled:c},secondaryAction:{label:e("cancel"),action:()=>h(!1)},children:w.jsx("p",{children:e("continueWithEmail",{email:s})})})]})}function IM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(CM,{})}),w.jsx(Je,{path:":code/redeem",element:w.jsx(_M,{})}),w.jsx(Je,{path:":code/email",element:w.jsx(AM,{})}),w.jsx(Je,{path:":code/identifier",element:w.jsx(SM,{})})]})}function TM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(tx,{})}),w.jsx(Je,{path:`${je.GENERIC}/*`,element:w.jsx(BB,{})}),w.jsx(Je,{path:`${je.GIFTCARD}/*`,element:w.jsx(UB,{})}),w.jsx(Je,{path:`${je.POINTS_TRANSACTION}/*`,element:w.jsx(qB,{})}),w.jsx(Je,{path:`${je.PORTAL}/*`,element:w.jsx(mM,{})}),w.jsx(Je,{path:`${je.PREPAID}/*`,element:w.jsx(EM,{})}),w.jsx(Je,{path:`${je.VOUCHER}/*`,element:w.jsx(IM,{})})]})}function xM(){const{t:e}=$e(),[t,n]=k.useState(!1);return w.jsx("div",{className:"default-bg-colors flex h-screen items-center justify-center",children:w.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-300 bg-white shadow-lg",children:[w.jsx("div",{className:"border-b border-gray-200 bg-gray-50 px-6 pb-3 pt-4 shadow",children:w.jsx("h2",{className:"text-3xl",children:"Oops!"})}),w.jsx("p",{className:"mt-4 px-6 text-gray-900",children:e("sorrySomethingWentWrong")}),w.jsx("div",{className:"mt-10 p-6",children:w.jsx(dt,{onClick:()=>{n(!0),window.location.replace("/")},pending:t,label:e("back")})})]})})}function Bp(e){"@babel/helpers - typeof";return Bp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bp(e)}function kb(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Bp(XMLHttpRequest))==="object"}function kM(e){return!!e&&typeof e.then=="function"}function OM(e){return kM(e)?e:Promise.resolve(e)}function PM(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Mp={exports:{}},ql={exports:{}},Ob;function RM(){return Ob||(Ob=1,function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof $i<"u"&&$i,r=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(s){var a=typeof i<"u"&&i||typeof self<"u"&&self||typeof a<"u"&&a,c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function u(P){return P&&DataView.prototype.isPrototypeOf(P)}if(c.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(P){return P&&d.indexOf(Object.prototype.toString.call(P))>-1};function f(P){if(typeof P!="string"&&(P=String(P)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(P)||P==="")throw new TypeError('Invalid character in header field name: "'+P+'"');return P.toLowerCase()}function p(P){return typeof P!="string"&&(P=String(P)),P}function l(P){var V={next:function(){var z=P.shift();return{done:z===void 0,value:z}}};return c.iterable&&(V[Symbol.iterator]=function(){return V}),V}function m(P){this.map={},P instanceof m?P.forEach(function(V,z){this.append(z,V)},this):Array.isArray(P)?P.forEach(function(V){this.append(V[0],V[1])},this):P&&Object.getOwnPropertyNames(P).forEach(function(V){this.append(V,P[V])},this)}m.prototype.append=function(P,V){P=f(P),V=p(V);var z=this.map[P];this.map[P]=z?z+", "+V:V},m.prototype.delete=function(P){delete this.map[f(P)]},m.prototype.get=function(P){return P=f(P),this.has(P)?this.map[P]:null},m.prototype.has=function(P){return this.map.hasOwnProperty(f(P))},m.prototype.set=function(P,V){this.map[f(P)]=p(V)},m.prototype.forEach=function(P,V){for(var z in this.map)this.map.hasOwnProperty(z)&&P.call(V,this.map[z],z,this)},m.prototype.keys=function(){var P=[];return this.forEach(function(V,z){P.push(z)}),l(P)},m.prototype.values=function(){var P=[];return this.forEach(function(V){P.push(V)}),l(P)},m.prototype.entries=function(){var P=[];return this.forEach(function(V,z){P.push([z,V])}),l(P)},c.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function y(P){if(P.bodyUsed)return Promise.reject(new TypeError("Already read"));P.bodyUsed=!0}function g(P){return new Promise(function(V,z){P.onload=function(){V(P.result)},P.onerror=function(){z(P.error)}})}function v(P){var V=new FileReader,z=g(V);return V.readAsArrayBuffer(P),z}function b(P){var V=new FileReader,z=g(V);return V.readAsText(P),z}function E(P){for(var V=new Uint8Array(P),z=new Array(V.length),X=0;X<V.length;X++)z[X]=String.fromCharCode(V[X]);return z.join("")}function C(P){if(P.slice)return P.slice(0);var V=new Uint8Array(P.byteLength);return V.set(new Uint8Array(P)),V.buffer}function A(){return this.bodyUsed=!1,this._initBody=function(P){this.bodyUsed=this.bodyUsed,this._bodyInit=P,P?typeof P=="string"?this._bodyText=P:c.blob&&Blob.prototype.isPrototypeOf(P)?this._bodyBlob=P:c.formData&&FormData.prototype.isPrototypeOf(P)?this._bodyFormData=P:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(P)?this._bodyText=P.toString():c.arrayBuffer&&c.blob&&u(P)?(this._bodyArrayBuffer=C(P.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(P)||h(P))?this._bodyArrayBuffer=C(P):this._bodyText=P=Object.prototype.toString.call(P):this._bodyText="",this.headers.get("content-type")||(typeof P=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(P)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var P=y(this);if(P)return P;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var P=y(this);return P||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(v)}),this.text=function(){var P=y(this);if(P)return P;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(E(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(B)}),this.json=function(){return this.text().then(JSON.parse)},this}var T=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function x(P){var V=P.toUpperCase();return T.indexOf(V)>-1?V:P}function R(P,V){if(!(this instanceof R))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');V=V||{};var z=V.body;if(P instanceof R){if(P.bodyUsed)throw new TypeError("Already read");this.url=P.url,this.credentials=P.credentials,V.headers||(this.headers=new m(P.headers)),this.method=P.method,this.mode=P.mode,this.signal=P.signal,!z&&P._bodyInit!=null&&(z=P._bodyInit,P.bodyUsed=!0)}else this.url=String(P);if(this.credentials=V.credentials||this.credentials||"same-origin",(V.headers||!this.headers)&&(this.headers=new m(V.headers)),this.method=x(V.method||this.method||"GET"),this.mode=V.mode||this.mode||null,this.signal=V.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&z)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(z),(this.method==="GET"||this.method==="HEAD")&&(V.cache==="no-store"||V.cache==="no-cache")){var X=/([?&])_=[^&]*/;if(X.test(this.url))this.url=this.url.replace(X,"$1_="+new Date().getTime());else{var re=/\?/;this.url+=(re.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}R.prototype.clone=function(){return new R(this,{body:this._bodyInit})};function B(P){var V=new FormData;return P.trim().split("&").forEach(function(z){if(z){var X=z.split("="),re=X.shift().replace(/\+/g," "),oe=X.join("=").replace(/\+/g," ");V.append(decodeURIComponent(re),decodeURIComponent(oe))}}),V}function F(P){var V=new m,z=P.replace(/\r?\n[\t ]+/g," ");return z.split("\r").map(function(X){return X.indexOf(`
|
|
157
|
+
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],f=0;f<h.length;f++)e[3][Sn.getCharCode(h[f])]=f;var p=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(f=0;f<p.length;f++)Sn.getCharCode(p[f])>0&&(e[4][Sn.getCharCode(p[f])]=f)}(wr.createInt32Array(5,256));var gB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),yB=function(e){function t(n){var r=e.call(this,n.width,n.height)||this;return r.canvas=n,r.buffer=t.makeBufferFromCanvasImageData(n),r}return gB(t,e),t.makeBufferFromCanvasImageData=function(n){var r=n.getContext("2d");if(!r)throw new Error("Couldn't get canvas context.");var o=r.getImageData(0,0,n.width,n.height);return t.toGrayscaleBuffer(o.data,n.width,n.height)},t.toGrayscaleBuffer=function(n,r,o){for(var i=new Uint8ClampedArray(r*o),s=0,a=0,c=n.length;s<c;s+=4,a++){var u=void 0;n[s+3]===0?u=255:u=306*n[s]+601*n[s+1]+117*n[s+2]+512>>10,i[a]=u}return i},t.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ge("Requested row is outside the image: "+n);var o=this.getWidth(),i=n*o;return r===null?r=this.buffer.slice(i,i+o):(r.length<o&&(r=new Uint8ClampedArray(o)),r.set(this.buffer.slice(i,i+o))),r},t.prototype.getMatrix=function(){return this.buffer},t.prototype.isCropSupported=function(){return!0},t.prototype.crop=function(n,r,o,i){return e.prototype.crop.call(this,n,r,o,i),this},t.prototype.isRotateSupported=function(){return!0},t.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},t.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},t.prototype.invert=function(){return new Al(this)},t.prototype.getTempCanvasElement=function(){if(this.tempCanvasElement===null){var n=this.canvas.ownerDocument.createElement("canvas");n.width=this.canvas.width,n.height=this.canvas.height,this.tempCanvasElement=n}return this.tempCanvasElement},t.prototype.rotate=function(n){var r=this.getTempCanvasElement();if(!r)throw new Error("Could not create a Canvas element.");var o=n*t.DEGREE_TO_RADIANS,i=this.canvas.width,s=this.canvas.height,a=Math.ceil(Math.abs(Math.cos(o))*i+Math.abs(Math.sin(o))*s),c=Math.ceil(Math.abs(Math.sin(o))*i+Math.abs(Math.cos(o))*s);r.width=a,r.height=c;var u=r.getContext("2d");if(!u)throw new Error("Could not create a Convas Context element.");return u.translate(a/2,c/2),u.rotate(o),u.drawImage(this.canvas,i/-2,s/-2),this.buffer=t.makeBufferFromCanvasImageData(r),this},t.DEGREE_TO_RADIANS=Math.PI/180,t}(oc);function gb(){return typeof navigator<"u"}function vB(){return!!(gb()&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)}var Us=function(){return Us=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Us.apply(this,arguments)},Jt=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(u){try{c(r.next(u))}catch(d){i(d)}}function a(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){var d;u.done?o(u.value):(d=u.value,d instanceof n?d:new n(function(h){h(d)})).then(s,a)}c((r=r.apply(e,[])).next())})},Zt=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(c){return function(u){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&d[0]?r.return:d[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,d[1])).done)return o;switch(r=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,r=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!((o=o.length>0&&o[o.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){s.label=d[1];break}if(d[0]===6&&s.label<o[1]){s.label=o[1],o=d;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(d);break}o[2]&&s.ops.pop(),s.trys.pop();continue}d=t.call(e,s)}catch(h){d=[6,h],r=0}finally{n=o=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([c,u])}}},Vl=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},wB={delayBetweenScanAttempts:500,delayBetweenScanSuccess:500,tryPlayVideoTimeout:5e3},Hs=function(){function e(t,n,r){n===void 0&&(n=new Map),r===void 0&&(r={}),this.reader=t,this.hints=n,this.options=Us(Us({},wB),r)}return Object.defineProperty(e.prototype,"possibleFormats",{set:function(t){this.hints.set(Lt.POSSIBLE_FORMATS,t)},enumerable:!1,configurable:!0}),e.addVideoSource=function(t,n){try{t.srcObject=n}catch{t.src=URL.createObjectURL(n)}},e.mediaStreamSetTorch=function(t,n){return Jt(this,void 0,void 0,function(){return Zt(this,function(r){switch(r.label){case 0:return[4,t.applyConstraints({advanced:[{fillLightMode:n?"flash":"off",torch:!!n}]})];case 1:return r.sent(),[2]}})})},e.mediaStreamIsTorchCompatible=function(t){var n,r,o=t.getVideoTracks();try{for(var i=Vl(o),s=i.next();!s.done;s=i.next()){var a=s.value;if(e.mediaStreamIsTorchCompatibleTrack(a))return!0}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},e.mediaStreamIsTorchCompatibleTrack=function(t){try{return"torch"in t.getCapabilities()}catch(n){return console.error(n),console.warn("Your browser may be not fully compatible with WebRTC and/or ImageCapture specs. Torch will not be available."),!1}},e.isVideoPlaying=function(t){return t.currentTime>0&&!t.paused&&t.readyState>2},e.getMediaElement=function(t,n){var r=document.getElementById(t);if(!r)throw new Qt("element with id '"+t+"' not found");if(r.nodeName.toLowerCase()!==n.toLowerCase())throw new Qt("element with id '"+t+"' must be an "+n+" element");return r},e.createVideoElement=function(t){if(t instanceof HTMLVideoElement)return t;if(typeof t=="string")return e.getMediaElement(t,"video");if(!t&&typeof document<"u"){var n=document.createElement("video");return n.width=200,n.height=200,n}throw new Error("Couldn't get videoElement from videoSource!")},e.prepareImageElement=function(t){if(t instanceof HTMLImageElement)return t;if(typeof t=="string")return e.getMediaElement(t,"img");if(t===void 0){var n=document.createElement("img");return n.width=200,n.height=200,n}throw new Error("Couldn't get imageElement from imageSource!")},e.prepareVideoElement=function(t){var n=e.createVideoElement(t);return n.setAttribute("autoplay","true"),n.setAttribute("muted","true"),n.setAttribute("playsinline","true"),n},e.isImageLoaded=function(t){return!!t.complete&&t.naturalWidth!==0},e.createBinaryBitmapFromCanvas=function(t){var n=new yB(t),r=new Mw(n);return new Nw(r)},e.drawImageOnCanvas=function(t,n){t.drawImage(n,0,0)},e.getMediaElementDimensions=function(t){if(t instanceof HTMLVideoElement)return{height:t.videoHeight,width:t.videoWidth};if(t instanceof HTMLImageElement)return{height:t.naturalHeight||t.height,width:t.naturalWidth||t.width};throw new Error("Couldn't find the Source's dimentions!")},e.createCaptureCanvas=function(t){if(!t)throw new Qt("Cannot create a capture canvas without a media element.");if(typeof document>"u")throw new Error(`The page "Document" is undefined, make sure you're running in a browser.`);var n=document.createElement("canvas"),r=e.getMediaElementDimensions(t),o=r.width,i=r.height;return n.style.width=o+"px",n.style.height=i+"px",n.width=o,n.height=i,n},e.tryPlayVideo=function(t){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:if(t!=null&&t.ended)return console.error("Trying to play video that has ended."),[2,!1];if(e.isVideoPlaying(t))return console.warn("Trying to play video that is already playing."),[2,!0];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.play()];case 2:return r.sent(),[2,!0];case 3:return n=r.sent(),console.warn("It was not possible to play the video.",n),[2,!1];case 4:return[2]}})})},e.createCanvasFromMediaElement=function(t){var n=e.createCaptureCanvas(t),r=n.getContext("2d");if(!r)throw new Error("Couldn't find Canvas 2D Context.");return e.drawImageOnCanvas(r,t),n},e.createBinaryBitmapFromMediaElem=function(t){var n=e.createCanvasFromMediaElement(t);return e.createBinaryBitmapFromCanvas(n)},e.destroyImageElement=function(t){t.src="",t.removeAttribute("src"),t=void 0},e.listVideoInputDevices=function(){return Jt(this,void 0,void 0,function(){var t,n,r,o,i,s,a,c,u,d,h,f;return Zt(this,function(p){switch(p.label){case 0:if(!gb())throw new Error("Can't enumerate devices, navigator is not present.");if(!vB())throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:t=p.sent(),n=[];try{for(r=Vl(t),o=r.next();!o.done;o=r.next())i=o.value,(s=i.kind==="video"?"videoinput":i.kind)==="videoinput"&&(a=i.deviceId||i.id,c=i.label||"Video device "+(n.length+1),u=i.groupId,d={deviceId:a,label:c,kind:s,groupId:u},n.push(d))}catch(l){h={error:l}}finally{try{o&&!o.done&&(f=r.return)&&f.call(r)}finally{if(h)throw h.error}}return[2,n]}})})},e.findDeviceById=function(t){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:return[4,e.listVideoInputDevices()];case 1:return(n=r.sent())?[2,n.find(function(o){return o.deviceId===t})]:[2]}})})},e.cleanVideoSource=function(t){if(t){try{t.srcObject=null}catch{t.src=""}t&&t.removeAttribute("src")}},e.playVideoOnLoadAsync=function(t,n){return Jt(this,void 0,void 0,function(){return Zt(this,function(r){switch(r.label){case 0:return[4,e.tryPlayVideo(t)];case 1:return r.sent()?[2,!0]:[2,new Promise(function(o,i){var s=setTimeout(function(){e.isVideoPlaying(t)||(i(!1),t.removeEventListener("canplay",a))},n),a=function(){e.tryPlayVideo(t).then(function(c){clearTimeout(s),t.removeEventListener("canplay",a),o(c)})};t.addEventListener("canplay",a)})]}})})},e.attachStreamToVideo=function(t,n,r){return r===void 0&&(r=5e3),Jt(this,void 0,void 0,function(){var o;return Zt(this,function(i){switch(i.label){case 0:return o=e.prepareVideoElement(n),e.addVideoSource(o,t),[4,e.playVideoOnLoadAsync(o,r)];case 1:return i.sent(),[2,o]}})})},e._waitImageLoad=function(t){return new Promise(function(n,r){var o=setTimeout(function(){e.isImageLoaded(t)||(t.removeEventListener("load",i),r())},1e4),i=function(){clearTimeout(o),t.removeEventListener("load",i),n()};t.addEventListener("load",i)})},e.checkCallbackFnOrThrow=function(t){if(!t)throw new Qt("`callbackFn` is a required parameter, you cannot capture results without it.")},e.disposeMediaStream=function(t){t.getVideoTracks().forEach(function(n){return n.stop()}),t=void 0},e.prototype.decode=function(t){var n=e.createCanvasFromMediaElement(t);return this.decodeFromCanvas(n)},e.prototype.decodeBitmap=function(t){return this.reader.decode(t,this.hints)},e.prototype.decodeFromCanvas=function(t){var n=e.createBinaryBitmapFromCanvas(t);return this.decodeBitmap(n)},e.prototype.decodeFromImageElement=function(t){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:if(!t)throw new Qt("An image element must be provided.");return n=e.prepareImageElement(t),[4,this._decodeOnLoadImage(n)];case 1:return[2,r.sent()]}})})},e.prototype.decodeFromImageUrl=function(t){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:if(!t)throw new Qt("An URL must be provided.");(n=e.prepareImageElement()).src=t,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.decodeFromImageElement(n)];case 2:return[2,r.sent()];case 3:return e.destroyImageElement(n),[7];case 4:return[2]}})})},e.prototype.decodeFromConstraints=function(t,n,r){return Jt(this,void 0,void 0,function(){var o,i;return Zt(this,function(s){switch(s.label){case 0:return e.checkCallbackFnOrThrow(r),[4,navigator.mediaDevices.getUserMedia(t)];case 1:o=s.sent(),s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this.decodeFromStream(o,n,r)];case 3:return[2,s.sent()];case 4:throw i=s.sent(),e.disposeMediaStream(o),i;case 5:return[2]}})})},e.prototype.decodeFromStream=function(t,n,r){return Jt(this,void 0,void 0,function(){var o,i,s,a,c,u,d,h,f,p,l=this;return Zt(this,function(m){switch(m.label){case 0:return e.checkCallbackFnOrThrow(r),o=this.options.tryPlayVideoTimeout,[4,e.attachStreamToVideo(t,n,o)];case 1:return i=m.sent(),s=function(){var y,g;try{for(var v=Vl(t.getVideoTracks()),b=v.next();!b.done;b=v.next())b.value.stop()}catch(E){y={error:E}}finally{try{b&&!b.done&&(g=v.return)&&g.call(v)}finally{if(y)throw y.error}}t=void 0},a=function(){s(),e.cleanVideoSource(i)},c=this.scan(i,r,a),u=t.getVideoTracks(),d=Us(Us({},c),{stop:function(){c.stop()},streamVideoConstraintsApply:function(y,g){return Jt(this,void 0,void 0,function(){var v,b,E,C,A,T;return Zt(this,function(x){switch(x.label){case 0:v=g?u.filter(g):u,x.label=1;case 1:x.trys.push([1,6,7,8]),b=Vl(v),E=b.next(),x.label=2;case 2:return E.done?[3,5]:[4,E.value.applyConstraints(y)];case 3:x.sent(),x.label=4;case 4:return E=b.next(),[3,2];case 5:return[3,8];case 6:return C=x.sent(),A={error:C},[3,8];case 7:try{E&&!E.done&&(T=b.return)&&T.call(b)}finally{if(A)throw A.error}return[7];case 8:return[2]}})})},streamVideoConstraintsGet:function(y){return u.find(y).getConstraints()},streamVideoSettingsGet:function(y){return u.find(y).getSettings()},streamVideoCapabilitiesGet:function(y){return u.find(y).getCapabilities()}}),e.mediaStreamIsTorchCompatible(t)&&(h=u==null?void 0:u.find(function(y){return e.mediaStreamIsTorchCompatibleTrack(y)}),f=function(y){return Jt(l,void 0,void 0,function(){return Zt(this,function(g){switch(g.label){case 0:return[4,e.mediaStreamSetTorch(h,y)];case 1:return g.sent(),[2]}})})},d.switchTorch=f,p=function(){c.stop(),f(!1)},d.stop=p),[2,d]}})})},e.prototype.decodeFromVideoDevice=function(t,n,r){return Jt(this,void 0,void 0,function(){var o;return Zt(this,function(i){switch(i.label){case 0:return e.checkCallbackFnOrThrow(r),o={video:t?{deviceId:{exact:t}}:{facingMode:"environment"}},[4,this.decodeFromConstraints(o,n,r)];case 1:return[2,i.sent()]}})})},e.prototype.decodeFromVideoElement=function(t,n){return Jt(this,void 0,void 0,function(){var r,o;return Zt(this,function(i){switch(i.label){case 0:if(e.checkCallbackFnOrThrow(n),!t)throw new Qt("A video element must be provided.");return r=e.prepareVideoElement(t),o=this.options.tryPlayVideoTimeout,[4,e.playVideoOnLoadAsync(r,o)];case 1:return i.sent(),[2,this.scan(r,n)]}})})},e.prototype.decodeFromVideoUrl=function(t,n){return Jt(this,void 0,void 0,function(){var r,o,i;return Zt(this,function(s){switch(s.label){case 0:if(e.checkCallbackFnOrThrow(n),!t)throw new Qt("An URL must be provided.");return(r=e.prepareVideoElement()).src=t,o=function(){e.cleanVideoSource(r)},i=this.options.tryPlayVideoTimeout,[4,e.playVideoOnLoadAsync(r,i)];case 1:return s.sent(),[2,this.scan(r,n,o)]}})})},e.prototype.decodeOnceFromConstraints=function(t,n){return Jt(this,void 0,void 0,function(){var r;return Zt(this,function(o){switch(o.label){case 0:return[4,navigator.mediaDevices.getUserMedia(t)];case 1:return r=o.sent(),[4,this.decodeOnceFromStream(r,n)];case 2:return[2,o.sent()]}})})},e.prototype.decodeOnceFromStream=function(t,n){return Jt(this,void 0,void 0,function(){var r,o;return Zt(this,function(i){switch(i.label){case 0:return r=!!n,[4,e.attachStreamToVideo(t,n)];case 1:o=i.sent(),i.label=2;case 2:return i.trys.push([2,,4,5]),[4,this.scanOneResult(o)];case 3:return[2,i.sent()];case 4:return r||e.cleanVideoSource(o),[7];case 5:return[2]}})})},e.prototype.decodeOnceFromVideoDevice=function(t,n){return Jt(this,void 0,void 0,function(){var r;return Zt(this,function(o){switch(o.label){case 0:return r={video:t?{deviceId:{exact:t}}:{facingMode:"environment"}},[4,this.decodeOnceFromConstraints(r,n)];case 1:return[2,o.sent()]}})})},e.prototype.decodeOnceFromVideoElement=function(t){return Jt(this,void 0,void 0,function(){var n,r;return Zt(this,function(o){switch(o.label){case 0:if(!t)throw new Qt("A video element must be provided.");return n=e.prepareVideoElement(t),r=this.options.tryPlayVideoTimeout,[4,e.playVideoOnLoadAsync(n,r)];case 1:return o.sent(),[4,this.scanOneResult(n)];case 2:return[2,o.sent()]}})})},e.prototype.decodeOnceFromVideoUrl=function(t){return Jt(this,void 0,void 0,function(){var n,r;return Zt(this,function(o){switch(o.label){case 0:if(!t)throw new Qt("An URL must be provided.");(n=e.prepareVideoElement()).src=t,r=this.decodeOnceFromVideoElement(n),o.label=1;case 1:return o.trys.push([1,,3,4]),[4,r];case 2:return[2,o.sent()];case 3:return e.cleanVideoSource(n),[7];case 4:return[2]}})})},e.prototype.scanOneResult=function(t,n,r,o){var i=this;return n===void 0&&(n=!0),r===void 0&&(r=!0),o===void 0&&(o=!0),new Promise(function(s,a){i.scan(t,function(c,u,d){if(c)return s(c),void d.stop();if(u){if(u instanceof ge&&n||u instanceof gn&&r||u instanceof xe&&o)return;d.stop(),a(u)}})})},e.prototype.scan=function(t,n,r){var o=this;e.checkCallbackFnOrThrow(n);var i=e.createCaptureCanvas(t),s=i.getContext("2d");if(!s)throw new Error("Couldn't create canvas for visual element scan.");var a,c=function(){s=void 0,i=void 0},u=!1,d={stop:function(){u=!0,clearTimeout(a),c(),r&&r()}},h=function(){if(!u)try{e.drawImageOnCanvas(s,t);var f=o.decodeFromCanvas(i);n(f,void 0,d),a=setTimeout(h,o.options.delayBetweenScanSuccess)}catch(p){if(n(void 0,p,d),p instanceof gn||p instanceof xe||p instanceof ge)return void(a=setTimeout(h,o.options.delayBetweenScanAttempts));c(),r&&r(p)}};return h(),d},e.prototype._decodeOnLoadImage=function(t){return Jt(this,void 0,void 0,function(){return Zt(this,function(n){switch(n.label){case 0:return e.isImageLoaded(t)?[3,2]:[4,e._waitImageLoad(t)];case 1:n.sent(),n.label=2;case 2:return[2,this.decode(t)]}})})},e}(),bB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new kl,n,r)||this}bB(t,e)})(Hs);var EB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new js(n),n,r)||this}EB(t,e)})(Hs);var CB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new Ml,n,r)||this}CB(t,e)})(Hs);var _B=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){var o=this,i=new hb;return i.setHints(n),(o=e.call(this,i,n,r)||this).reader=i,o}_B(t,e),Object.defineProperty(t.prototype,"possibleFormats",{set:function(n){this.hints.set(Lt.POSSIBLE_FORMATS,n),this.reader.setHints(this.hints)},enumerable:!1,configurable:!0}),t.prototype.decodeBitmap=function(n){return this.reader.decodeWithState(n)},t.prototype.setHints=function(n){this.hints=n,this.reader.setHints(this.hints)}})(Hs);var SB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new jl,n,r)||this}SB(t,e)})(Hs);var AB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),IB=function(e){function t(n,r){return e.call(this,new Fl,n,r)||this}return AB(t,e),t}(Hs),Ul=function(e,t,n){var r=typeof e===n;return r||console.warn('[ReactQrReader]: Expected "'.concat(t,'" to be a of type "').concat(n,'".')),r},TB=function(e){var t=e.scanDelay,n=e.constraints,r=e.onResult,o=e.videoId,i=k.useRef(null);k.useEffect(function(){var s=new IB(null,{delayBetweenScanAttempts:t});return!function(){var a=typeof navigator<"u"&&!!navigator.mediaDevices;return a||console.warn('[ReactQrReader]: MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),a}()&&Ul(r,"onResult","function")&&r(null,new Error('MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),s),Ul(n,"constraints","object")&&s.decodeFromConstraints({video:n},o,function(a,c){Ul(r,"onResult","function")&&r(a,c,s)}).then(function(a){return i.current=a}).catch(function(a){Ul(r,"onResult","function")&&r(null,a,s)}),function(){var a;(a=i.current)===null||a===void 0||a.stop()}},[])},Vi=function(){return Vi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Vi.apply(this,arguments)},yb={container:{width:"100%",paddingTop:"100%",overflow:"hidden",position:"relative"},video:{top:0,left:0,width:"100%",height:"100%",display:"block",overflow:"hidden",position:"absolute",transform:void 0}},Ip=function(e){var t=e.videoContainerStyle,n=e.containerStyle,r=e.videoStyle,o=e.constraints,i=e.ViewFinder,s=e.scanDelay,a=e.className,c=e.onResult,u=e.videoId;return TB({constraints:o,scanDelay:s,onResult:c,videoId:u}),ue.createElement("section",{className:a,style:n},ue.createElement("div",{style:Vi(Vi({},yb.container),t)},!!i&&ue.createElement(i,null),ue.createElement("video",{muted:!0,id:u,style:Vi(Vi(Vi({},yb.video),r),{transform:(o==null?void 0:o.facingMode)==="user"&&"scaleX(-1)"})})))};Ip.displayName="QrReader",Ip.defaultProps={constraints:{facingMode:"user"},videoId:"video",scanDelay:500};function xB({onScan:e}){const{cameraFacingMode:t}=mn(),[n,r]=k.useState(t??Zn.USER);return w.jsxs("div",{className:"relative w-full",children:[w.jsx(Ip,{onResult:o=>{o&&e(o.getText())},constraints:{advanced:[{facingMode:n}]},videoStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem",objectFit:"cover"},videoContainerStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem"}}),w.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>n===Zn.USER?r(Zn.ENVIRONMENT):r(Zn.USER),children:w.jsx("img",{src:up,alt:"camera-switch"})})]})}class rt{constructor(t,n,r,o,i){this._legacyCanvasSize=rt.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=t,this.$canvas=document.createElement("canvas"),r&&typeof r=="object"?this._onDecode=n:(console.warn(r||o||i?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=n),n=typeof r=="object"?r:{},this._onDecodeError=n.onDecodeError||(typeof r=="function"?r:this._onDecodeError),this._calculateScanRegion=n.calculateScanRegion||(typeof o=="function"?o:this._calculateScanRegion),this._preferredCamera=n.preferredCamera||i||this._preferredCamera,this._legacyCanvasSize=typeof r=="number"?r:typeof o=="number"?o:this._legacyCanvasSize,this._maxScansPerSecond=n.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),t.disablePictureInPicture=!0,t.playsInline=!0,t.muted=!0;let s=!1;if(t.hidden&&(t.hidden=!1,s=!0),document.body.contains(t)||(document.body.appendChild(t),s=!0),r=t.parentElement,n.highlightScanRegion||n.highlightCodeOutline){if(o=!!n.overlay,this.$overlay=n.overlay||document.createElement("div"),i=this.$overlay.style,i.position="absolute",i.display="none",i.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!o&&n.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}r.insertBefore(this.$overlay,this.$video.nextSibling)}n.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(t),requestAnimationFrame(()=>{let a=window.getComputedStyle(t);a.display==="none"&&(t.style.setProperty("display","block","important"),s=!0),a.visibility!=="visible"&&(t.style.setProperty("visibility","visible","important"),s=!0),s&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),t.style.opacity="0",t.style.width="0",t.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),t.addEventListener("play",this._onPlay),t.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=rt.createQrEngine()}static set WORKER_PATH(t){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.")}static async hasCamera(){try{return!!(await rt.listCameras(!1)).length}catch{return!1}}static async listCameras(t=!1){if(!navigator.mediaDevices)return[];let n=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),r;try{t&&(await n()).every(o=>!o.label)&&(r=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await n()).map((o,i)=>({id:o.deviceId,label:o.label||(i===0?"Default Camera":`Camera ${i+1}`)}))}finally{r&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),rt._stopVideoStream(r))}}async hasFlash(){let t;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;t=this.$video.srcObject}else t=(await this._getCameraStream()).stream;return"torch"in t.getVideoTracks()[0].getSettings()}catch{return!1}finally{t&&t!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),rt._stopVideoStream(t))}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn()}async turnFlashOn(){if(!this._flashOn&&!this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw"No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]})}catch(t){throw this._flashOn=!1,t}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream())}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._updateOverlay),this._destroyed=!0,this._flashOn=!1,this.stop(),rt._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:t,facingMode:n}=await this._getCameraStream();!this._active||this._paused?rt._stopVideoStream(t):(this._setVideoMirror(n),this.$video.srcObject=t,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(t){if(!this._paused)throw this._active=!1,t}}stop(){this.pause(),this._active=!1}async pause(t=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let n=()=>{this.$video.srcObject instanceof MediaStream&&(rt._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return t?(n(),!0):(await new Promise(r=>setTimeout(r,300)),this._paused?(n(),!0):!1)}async setCamera(t){t!==this._preferredCamera&&(this._preferredCamera=t,await this._restartVideoStream())}static async scanImage(t,n,r,o,i=!1,s=!1){let a,c=!1;n&&("scanRegion"in n||"qrEngine"in n||"canvas"in n||"disallowCanvasResizing"in n||"alsoTryWithoutScanRegion"in n||"returnDetailedScanResult"in n)?(a=n.scanRegion,r=n.qrEngine,o=n.canvas,i=n.disallowCanvasResizing||!1,s=n.alsoTryWithoutScanRegion||!1,c=!0):console.warn(n||r||o||i||s?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),n=!!r;try{let u,d;[r,u]=await Promise.all([r||rt.createQrEngine(),rt._loadImage(t)]),[o,d]=rt._drawToCanvas(u,a,o,i);let h;if(r instanceof Worker){let f=r;n||rt._postWorkerMessageSync(f,"inversionMode","both"),h=await new Promise((p,l)=>{let m,y,g,v=-1;y=E=>{E.data.id===v&&(f.removeEventListener("message",y),f.removeEventListener("error",g),clearTimeout(m),E.data.data!==null?p({data:E.data.data,cornerPoints:rt._convertPoints(E.data.cornerPoints,a)}):l(rt.NO_QR_CODE_FOUND))},g=E=>{f.removeEventListener("message",y),f.removeEventListener("error",g),clearTimeout(m),l("Scanner error: "+(E?E.message||E:"Unknown Error"))},f.addEventListener("message",y),f.addEventListener("error",g),m=setTimeout(()=>g("timeout"),1e4);let b=d.getImageData(0,0,o.width,o.height);v=rt._postWorkerMessageSync(f,"decode",b,[b.data.buffer])})}else h=await Promise.race([new Promise((f,p)=>window.setTimeout(()=>p("Scanner error: timeout"),1e4)),(async()=>{try{var[f]=await r.detect(o);if(!f)throw rt.NO_QR_CODE_FOUND;return{data:f.rawValue,cornerPoints:rt._convertPoints(f.cornerPoints,a)}}catch(p){if(f=p.message||p,/not implemented|service unavailable/.test(f))return rt._disableBarcodeDetector=!0,rt.scanImage(t,{scanRegion:a,canvas:o,disallowCanvasResizing:i,alsoTryWithoutScanRegion:s});throw`Scanner error: ${f}`}})()]);return c?h:h.data}catch(u){if(!a||!s)throw u;let d=await rt.scanImage(t,{qrEngine:r,canvas:o,disallowCanvasResizing:i});return c?d:d.data}finally{n||rt._postWorkerMessage(r,"close")}}setGrayscaleWeights(t,n,r,o=!0){rt._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:t,green:n,blue:r,useIntegerApproximation:o})}setInversionMode(t){rt._postWorkerMessage(this._qrEnginePromise,"inversionMode",t)}static async createQrEngine(t){if(t&&console.warn("Specifying a worker path is not required and not supported anymore."),t=()=>Promise.resolve().then(()=>SD).then(r=>r.createWorker()),!(!rt._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return t();let n=navigator.userAgentData;return n&&n.brands.some(({brand:r})=>/Chromium/i.test(r))&&/mac ?OS/i.test(n.platform)&&await n.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:r,platformVersion:o})=>/arm/i.test(r||"arm")&&13<=parseInt(o||"13")).catch(()=>!0)?t():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay(),this.$overlay&&(this.$overlay.style.display=""),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay()}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(t){let n=Math.round(.6666666666666666*Math.min(t.videoWidth,t.videoHeight));return{x:Math.round((t.videoWidth-n)/2),y:Math.round((t.videoHeight-n)/2),width:n,height:n,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var t=this.$video,n=t.videoWidth,r=t.videoHeight,o=t.offsetWidth,i=t.offsetHeight,s=t.offsetLeft,a=t.offsetTop,c=window.getComputedStyle(t),u=c.objectFit,d=n/r,h=o/i;switch(u){case"none":var f=n,p=r;break;case"fill":f=o,p=i;break;default:(u==="cover"?d>h:d<h)?(p=i,f=p*d):(f=o,p=f/d),u==="scale-down"&&(f=Math.min(f,n),p=Math.min(p,r))}var[l,m]=c.objectPosition.split(" ").map((g,v)=>{const b=parseFloat(g);return g.endsWith("%")?(v?i-p:o-f)*b/100:b});c=this._scanRegion.width||n,h=this._scanRegion.height||r,u=this._scanRegion.x||0;var y=this._scanRegion.y||0;d=this.$overlay.style,d.width=`${c/n*f}px`,d.height=`${h/r*p}px`,d.top=`${a+m+y/r*p}px`,r=/scaleX\(-1\)/.test(t.style.transform),d.left=`${s+(r?o-l-f:l)+(r?n-u-c:u)/n*f}px`,d.transform=t.style.transform}})}static _convertPoints(t,n){if(!n)return t;let r=n.x||0,o=n.y||0,i=n.width&&n.downScaledWidth?n.width/n.downScaledWidth:1;n=n.height&&n.downScaledHeight?n.height/n.downScaledHeight:1;for(let s of t)s.x=s.x*i+r,s.y=s.y*n+o;return t}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var t=Date.now()-this._lastScanTimestamp,n=1e3/this._maxScansPerSecond;t<n&&await new Promise(o=>setTimeout(o,n-t)),this._lastScanTimestamp=Date.now();try{var r=await rt.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!rt._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=rt.createQrEngine()),r?(this._onDecode?this._onDecode(r):this._legacyOnDecode&&this._legacyOnDecode(r.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} ${this._scanRegion.y||0} ${this._scanRegion.width||this.$video.videoWidth} ${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",r.cornerPoints.map(({x:o,y:i})=>`${o},${i}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(t){t!==rt.NO_QR_CODE_FOUND&&console.log(t)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let t=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",n=[{width:{min:1024}},{width:{min:768}},{}],r=n.map(o=>Object.assign({},o,{[t]:{exact:this._preferredCamera}}));for(let o of[...r,...n])try{let i=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),s=this._getFacingMode(i)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:i,facingMode:s}}catch{}throw"Camera not found."}async _restartVideoStream(){let t=this._paused;await this.pause(!0)&&!t&&this._active&&await this.start()}static _stopVideoStream(t){for(let n of t.getTracks())n.stop(),t.removeTrack(n)}_setVideoMirror(t){this.$video.style.transform="scaleX("+(t==="user"?-1:1)+")"}_getFacingMode(t){return(t=t.getVideoTracks()[0])?/rear|back|environment/i.test(t.label)?"environment":/front|user|face/i.test(t.label)?"user":null:null}static _drawToCanvas(t,n,r,o=!1){r=r||document.createElement("canvas");let i=n&&n.x?n.x:0,s=n&&n.y?n.y:0,a=n&&n.width?n.width:t.videoWidth||t.width,c=n&&n.height?n.height:t.videoHeight||t.height;return o||(o=n&&n.downScaledWidth?n.downScaledWidth:a,n=n&&n.downScaledHeight?n.downScaledHeight:c,r.width!==o&&(r.width=o),r.height!==n&&(r.height=n)),n=r.getContext("2d",{alpha:!1}),n.imageSmoothingEnabled=!1,n.drawImage(t,i,s,a,c,0,0,r.width,r.height),[r,n]}static async _loadImage(t){if(t instanceof Image)return await rt._awaitImageLoad(t),t;if(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGImageElement||"OffscreenCanvas"in window&&t instanceof OffscreenCanvas||"ImageBitmap"in window&&t instanceof ImageBitmap)return t;if(t instanceof File||t instanceof Blob||t instanceof URL||typeof t=="string"){let n=new Image;n.src=t instanceof File||t instanceof Blob?URL.createObjectURL(t):t.toString();try{return await rt._awaitImageLoad(n),n}finally{(t instanceof File||t instanceof Blob)&&URL.revokeObjectURL(n.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(t){t.complete&&t.naturalWidth!==0||await new Promise((n,r)=>{let o=i=>{t.removeEventListener("load",o),t.removeEventListener("error",o),i instanceof ErrorEvent?r("Image load error"):n()};t.addEventListener("load",o),t.addEventListener("error",o)})}static async _postWorkerMessage(t,n,r,o){return rt._postWorkerMessageSync(await t,n,r,o)}static _postWorkerMessageSync(t,n,r,o){if(!(t instanceof Worker))return-1;let i=rt._workerMessageId++;return t.postMessage({id:i,type:n,data:r},o),i}}rt.DEFAULT_CANVAS_SIZE=400,rt.NO_QR_CODE_FOUND="No QR code found",rt._disableBarcodeDetector=!1,rt._workerMessageId=0;function kB({onScan:e}){const{cameraFacingMode:t}=mn(),[n,r]=k.useState(t),o=k.useRef(),i=k.useRef(null),[s,a]=k.useState(!0),c=f=>{e(f==null?void 0:f.data)},u=f=>{},d=()=>{var f;i!=null&&i.current&&!o.current&&(o.current=new rt(i==null?void 0:i.current,c,{onDecodeError:u,preferredCamera:n}),(f=o==null?void 0:o.current)==null||f.start().then(()=>a(!0)).catch(p=>{p&&a(!1)}))},h=()=>{var f;i!=null&&i.current||(f=o==null?void 0:o.current)==null||f.stop()};return k.useEffect(()=>(d(),()=>{h()}),[n]),k.useEffect(()=>{s||alert("Camera is blocked or not accessible. Please allow camera in your browser permissions and reload.")},[s]),w.jsxs("div",{className:"relative",children:[w.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:i}),w.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>{n===Zn.USER?r(Zn.ENVIRONMENT):r(Zn.USER)},children:w.jsx("img",{src:up,alt:"camera-switch"})})]})}function Gs({data:e,dataSetter:t,setDefer:n,label:r=""}){const o=k.useRef(null),i=IP(),[s,a]=gx()??[0,0],{subscribe:c,unsubscribe:u}=Da(),{cameraService:d}=mn(),h=p=>{t(p)};k.useEffect(()=>{a&&a<=332&&o.current&&o.current.scrollIntoView({behavior:"smooth",block:"end"});const p=l=>{t(l.detail.code)};return c("onCodeScan",p),()=>{u("onCodeScan",p)}},[a]);const f=()=>{switch(+d){case 1:return w.jsx(Rw,{onScan:h});case 2:return w.jsx(kB,{onScan:h});case 3:return w.jsx(xB,{onScan:h});default:return w.jsx(Rw,{onScan:h})}};return w.jsxs("div",{ref:o,children:[!!i.length&&w.jsxs("div",{className:"mb-4 flex flex-col gap-4",children:[f(),w.jsx("hr",{})]}),w.jsx(Oi,{label:r,value:e,autoFocus:!0,placeholder:"CDE2341S",onChange:p=>{n&&n(!0),t(p.target.value)}})]})}function OB(){const{t:e}=$e(),{errorToast:t}=tn(),{uuid:n,portalSession:r}=He(),[o,i]=k.useState(""),[s,a]=k.useState(!1),[c,u]=k.useState(!1),d=rn(),h=Gt(),f=()=>{u(!0),h.get(`${n}/check-code/${o}`).then(p=>{if(p.data.identifier)return d(`identifier/${p.data.identifier.value}`);if(p.data.voucher)return d(`voucher/${p.data.voucher.code}`);if(p.data.giftcard)return d(`giftcard/${p.data.giftcard.hash}`);t(e("unknownCode",{code:o}))}).catch(t).finally(()=>u(!1))};return k.useEffect(()=>{o&&!s&&f()},[o]),w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanOrEnterX",{x:"code"})})})}),w.jsx(jt,{children:w.jsx(Ni,{onSubmit:f,children:w.jsx(Gs,{data:o,dataSetter:i,setDefer:a,label:e("contactIdentifier")})})}),w.jsx(pn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:e("continue"),onClick:f,pending:c}),r.inputData.enable_email_identification&&w.jsx(dt,{label:e("useEmail"),variant:"secondary",onClick:()=>d("email")})]})})]})})}function PB(){const{hash:e}=_o();return w.jsx(kr,{to:`${je.GIFTCARD}/select/${e}`})}function RB(){const{identifierValue:e}=_o(),{errorToast:t}=tn(),{uuid:n,mutate:r}=He(),{onContactLink:o}=mn(),[i,s]=k.useState(!1),a=Gt(),c=d=>a.get(`${n}/contacts`,{contact_uuid:d}),u=()=>{a.put(n,{contact_identifier_value:e}).then(d=>{o&&c(d.data.data.contact.uuid).then(h=>{o==null||o(h.data.data)}),r().then(()=>s(!0))}).catch(t)};return k.useEffect(()=>{u()},[]),i?w.jsx(kr,{to:`${je.PORTAL}/overview`}):w.jsx(Fr,{})}function vb(e){const{portalSession:t}=He(),[n,r]=k.useState(),{isLoading:o,pending:i,mutate:s}=_r({url:`${t.uuid}/vouchers/${e}`,onData:r});return{voucher:n,isLoading:o,pending:i,mutate:s}}function NB(){const{t:e}=$e(),{code:t}=_o(),{voucher:n}=vb(t),{portalSession:r}=He(),[o,i]=k.useState(!1),[s,a]=k.useState(!1),c=rn(),u=()=>{n!=null&&n.contact||r.contact?i(!0):a(!0)};return k.useEffect(()=>{n&&u()},[n]),n?w.jsxs(w.Fragment,{children:[o?w.jsx(kr,{to:`${je.VOUCHER}/${n.code}/redeem`}):w.jsx(Fr,{}),w.jsx(ni,{title:e("noContactLinkedToVoucherTitle"),isOpen:s,onClose:()=>a(!1),primaryAction:{label:e("linkToContact"),action:()=>c(`${je.VOUCHER}/${n.code}/identifier`)},secondaryAction:{label:e("cancel"),action:()=>a(!1)},children:w.jsx("p",{children:e("linkVoucherWithCodeToContact",{code:n.code})})})]}):w.jsx(Fr,{})}function Hl({redirectRoute:e}){const{state:t}=yr(),{t:n}=$e(),{onContactLink:r}=mn(),{portalSession:o,mutate:i}=He(),{publish:s}=Da(),[a,c]=k.useState(""),[u,d]=k.useState(!1),[h,f]=k.useState(!1),p=rn(),l=Gt(),m=v=>l.get(`${o.uuid}/contacts`,{contact_uuid:v}),y=()=>{d(!0),l.put(o.uuid,{email:a}).then(v=>{r&&m(v.data.data.contact.uuid).then(b=>{r==null||r(b.data.data)}),i().then(()=>p(e))}).catch(v=>{v.response.data.code===jc.CONTACT_NOT_FOUND&&f(!0)}).finally(()=>d(!1))},g=()=>{d(!0),l.post(`${o.uuid}/contacts`,{email:a}).then(y).finally(()=>d(!1))};return k.useEffect(()=>{s("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),w.jsxs(w.Fragment,{children:[w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:n("fillInXBelow",{x:n("emailAddress").toLowerCase()})})})}),w.jsx(jt,{children:w.jsx(Ni,{onSubmit:()=>a&&!u&&y(),children:w.jsx(Oi,{id:"via-email-address-input",label:n("emailAddress"),autoFocus:!0,onChange:v=>c(v.target.value),beforeIcon:"mail"})})}),w.jsx(pn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:n("continue"),className:"w-full",onClick:y,disabled:!a,pending:u}),w.jsx(dt,{label:n("useIdentifier"),variant:"secondary",onClick:()=>p("../identifier",{state:t})})]})})]})}),w.jsx(ni,{title:`${n("new")} ${n("emailAddress").toLowerCase()}`,isOpen:h,onClose:()=>f(!1),primaryAction:{label:n("confirm"),action:g,disabled:u},secondaryAction:{label:n("cancel"),action:()=>f(!1)},children:w.jsx("p",{children:n("continueWithEmail",{email:a})})})]})}function BB(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/*",element:w.jsx(OB,{})}),w.jsx(Je,{path:"/giftcard/:hash",element:w.jsx(PB,{})}),w.jsx(Je,{path:"/identifier/:identifierValue",element:w.jsx(RB,{})}),w.jsx(Je,{path:"/voucher/:code",element:w.jsx(NB,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.PORTAL})})]})}const MB={[nn.GIFTCARD]:`${je.GIFTCARD}/select`,[nn.REDEEM_GIFTCARD]:`${je.GIFTCARD}/redeem`,[nn.TOP_UP_GIFTCARD]:`${je.GIFTCARD}/top-up`};function DB(){const{t:e}=$e(),{portalSession:t}=He(),{errorToast:n}=tn(),[r,o]=k.useState(""),[i,s]=k.useState(!1),[a,c]=k.useState(!1),u=Gt(),d=rn(),h=()=>{s(!0),u.get(`${t.uuid}/giftcards/${r}`).then(f=>{const p=t.type;d(`${MB[p]}/${f.data.data.hash}`)}).catch(f=>{n(f),o("")}).finally(()=>s(!1))};return k.useEffect(()=>{!a&&r&&h()},[r]),w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanGiftcard")})})}),w.jsx(jt,{children:w.jsx(Gs,{data:r,dataSetter:o,setDefer:c,label:e("hash")})}),w.jsx(pn,{children:w.jsx(dt,{label:e("submit"),className:"w-full",onClick:h,disabled:!r,pending:i})})]})})}function LB(){const{t:e}=$e(),{hash:t}=_o(),n=rn();return w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("Choose type")})})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex gap-2",children:[w.jsx(dt,{className:"grow",label:"Redeem",onClick:()=>n(`${je.GIFTCARD}/redeem/${t}`)}),w.jsx(dt,{className:"grow",label:"Top up",onClick:()=>n(`${je.GIFTCARD}/top-up/${t}`)})]})})]})})}function wb(e){const{portalSession:t}=He(),[n,r]=k.useState(),{isLoading:o,pending:i,mutate:s}=_r({url:`${t.uuid}/giftcards/${e}`,onData:r});return{giftcard:n,isLoading:o,pending:i,mutate:s}}function dc(){const{mutate:e}=He();return{get:()=>e().then(r=>r.data.data.events),post:()=>{e().then(r=>{TC(r.data.data.events)})}}}function FB(){const{t:e}=$e(),{errorToast:t}=tn(),{hash:n}=_o(),{giftcard:r,mutate:o}=wb(n),{portalSession:i,mutate:s}=He(),{onUseGiftcard:a}=mn(),{post:c}=dc(),[u]=k.useState(i.results.remaining_amount?+i.results.remaining_amount:+i.inputData.amount_in_cents),[d,h]=k.useState(!1),f=i.inputData.allow_multiple_giftcards??!0,p=rn(),l=Gt(),m=()=>{h(!0),l.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:-y()}).then(E=>{o(),s(),c(),a==null||a(E.data.data)}).catch(t).finally(()=>h(!1))},y=()=>Math.min(g(),r.amount_in_cents),g=()=>i.results.remaining_amount??i.inputData.amount_in_cents,v=()=>{let E=0;return i.events.filter(A=>A.type===Fo.GIFTCARD_TRANSACTION).forEach(A=>{A.data.giftcard.uuid===r.uuid&&(E+=A.data.amount_in_cents)}),E},b=()=>{if(y())return{label:e("confirmAndPay",{amount:Qi(y(),i.currency)}),onClick:m};if(f&&g())return{label:e("useAnotherGiftcard"),onClick:()=>p(je.GIFTCARD),variant:"secondary"}};return r?w.jsx(Fn,{children:w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:`${e("giftcard")} ${r.hash}`})})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex h-full flex-col gap-4",children:[w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:e("balance")}),w.jsx(ti,{value:r.amount_in_cents,start:r.amount_in_cents-v(),currency:i.currency,asCurrency:!0})]})}),w.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:w.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[w.jsx("p",{className:"font-light text-gray-500",children:e("amountToPay")}),w.jsx("div",{className:"text-5xl font-bold",children:w.jsx(ti,{value:u+v(),start:u,currency:i.currency,asCurrency:!0})})]})})]})}),b()&&w.jsx(pn,{children:w.jsx(dt,{label:"",className:"w-full",...b(),pending:d})})]})}):w.jsx(Fr,{})}function jB({value:e,valueSetter:t,enabled:n}){const[r,o]=k.useState(!1),i=k.useRef(null),s=k.useRef(null);k.useEffect(()=>{u(e?e.toString():"")},[]);const a=d=>{t(d?parseInt(d):0),u(d)},c=d=>{const{key:h}=d;if(e===0&&!/^[1-9]$/.test(h)||e!==0&&!/^[0-9]$/.test(h)&&h!=="Backspace")return;let f;if(h!=="Backspace")f=parseInt(e===0?h:`${e}${h}`);else{const p=e.toString().slice(0,-1);f=p.length?parseInt(p,10):0}t(f),u(f?f.toString():"")},u=d=>{s&&s.current&&(d?s.current.style.width=`${Math.max(d.length,3)*3}rem`:s.current.style.width="calc(3rem + 14px)")};return w.jsxs(w.Fragment,{children:[w.jsx("input",{ref:s,className:"h-full w-[65px] rounded border-gray-200 border-transparent text-5xl [appearance:textfield] focus:border-transparent focus:ring-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",type:"number",pattern:"[0-9]*",inputMode:"numeric",placeholder:"0",autoFocus:!0,value:e?(e/100).toFixed(2):"",onKeyDown:c,onChange:()=>{},onFocus:()=>o(!0),onBlur:()=>o(!1)}),n&&w.jsx("div",{className:`mobile:hidden bottom-2 left-2 right-2 z-50 mx-auto w-[98vw] max-w-[1200px] ${!r&&"hidden"} absolute`,children:w.jsx(Hy,{keyboardRef:i,layout:{default:["1 2 3","4 5 6","7 8 9","00 0 {bksp}"]},theme:"hg-theme-default hg-layout-numeric numeric-theme",onChange:a})})]})}function bb({title:e,balance:t,balanceName:n,transaction:r,pending:o}){const{t:i}=$e(),[s,a]=k.useState(0),{portalSession:c}=He(),u=()=>{let d=0;return c.events.filter(f=>Object.values(Fo).includes(f.type)).forEach(f=>{d+=f.data.amount_in_cents}),d};return w.jsxs(qt,{children:[e&&w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e})})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex h-full flex-col gap-4",children:[w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),w.jsx(ti,{value:t??0,start:t??0,currency:c.currency,asCurrency:!0})]})}),w.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:w.jsx("div",{className:"flex items-center justify-center gap-1 p-4 text-5xl font-bold",children:u()?w.jsx(ti,{value:0,start:s,currency:c.currency,asCurrency:!0}):w.jsxs("div",{className:"flex items-center justify-center gap-1 ",children:[w.jsx("p",{children:IC(c.currency)}),w.jsx(jB,{value:s,valueSetter:a,enabled:c.inputData.enable_on_screen_keyboard})]})})})]})}),w.jsx(pn,{children:w.jsx(dt,{label:i("confirmAndPay",{amount:Qi(s,c.currency)}),className:"w-full",onClick:r&&(()=>r(s)),disabled:!s||!!u(),pending:o})})]})}function VB(){const{t:e}=$e(),{errorToast:t}=tn(),{hash:n}=_o(),{giftcard:r,mutate:o}=wb(n),{portalSession:i,mutate:s}=He(),{post:a}=dc(),{onUseGiftcard:c}=mn(),[u,d]=k.useState(!1),h=Gt(),f=p=>{d(!0),h.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:p}).then(l=>{o(),s(),a(),c==null||c(l.data.data),Tt.success(`${e("transactionSuccessful")}! ${e("totalUpgradedAmount")}: ${Qi(l.data.data.amount_in_cents)}`)}).catch(t).finally(()=>d(!1))};return r?w.jsx(Fn,{children:w.jsx(bb,{title:`${e("giftcard")} ${r.hash}`,balance:r.amount_in_cents,transaction:f,pending:u})}):w.jsx(Fr,{})}function UB(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(DB,{})}),w.jsx(Je,{path:"/select/:hash",element:w.jsx(LB,{})}),w.jsx(Je,{path:"/redeem/:hash",element:w.jsx(FB,{})}),w.jsx(Je,{path:"/top-up/:hash",element:w.jsx(VB,{})})]})}class Tp{constructor(){lr(this,"uuid");lr(this,"email");lr(this,"credit_balance");lr(this,"prepaid_balance");lr(this,"current_display_values")}getDisplayName(){return this.current_display_values.firstname||this.current_display_values.lastname?`${this.current_display_values.firstname} ${this.current_display_values.lastname}`:this.current_display_values.email}}const Eb=k.createContext({contact:new Tp,mutate:async()=>{}});function xp({children:e}){const{uuid:t}=He(),[n,r]=k.useState(new Tp),{mutate:o}=_r({url:`${t}/contacts`,onData:s=>{const a=new Tp;a.uuid=s.uuid,a.email=s.email,a.credit_balance=s.credit_balance,a.prepaid_balance=s.prepaid_balance,a.current_display_values=s.current_display_values,r(a)}}),i=k.useMemo(()=>({contact:n,mutate:o}),[n,o]);return n.uuid?w.jsx(Eb.Provider,{value:i,children:e}):w.jsx(Fr,{})}function Er(){const e=k.useContext(Eb);if(!e)throw new Error("Only use 'useContactContext' within a ContactProvider");return e}function Gl({message:e=""}){return w.jsxs("div",{className:"flex items-center justify-center gap-4 text-core-primary-500",children:[w.jsx(Hd,{className:"h-[32px] w-[32px]"}),e&&w.jsx("p",{className:"text-sm",children:e})]})}function HB(){const{t:e}=$e(),{errorToast:t}=tn(),{contact:n,mutate:r}=Er(),{uuid:o,portalSession:i,mutate:s}=He(),a=Gt(),c=()=>{a.post(`${o}/credit-receptions/create`,{unit_value:i.inputData.amount_in_cents/100}).then(()=>{r(),s()}).catch(t)},u=()=>{const d=i.events.filter(h=>h.type===Fo.CREDIT_RECEPTION);return d.length?d[0]:null};return k.useEffect(()=>{u()||c()},[]),w.jsx(Fn,{children:w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:n.getDisplayName()})})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[w.jsx("div",{className:"flex h-full flex-col items-center gap-2 p-6",children:i.inputData.amount_in_cents?w.jsx("div",{className:"flex h-full items-center justify-center gap-1 text-4xl font-bold",children:u()?w.jsxs(w.Fragment,{children:["+",w.jsx(ti,{value:u().data.credits,start:0})]}):w.jsx(Gl,{})}):w.jsx("p",{className:"text-core-red-500",children:e("xIsRequired",{x:"Amount in cents"})+"."})}),w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:`${e("new")} ${e("balance").toLowerCase()}`}),w.jsx(ti,{value:n.credit_balance.balance??0,start:n.credit_balance.balance-(u()?u().data.credits:0)})]})})]})})]})})}function GB(){const{portalSession:e}=He();return e.contact?w.jsx(xp,{children:w.jsx(HB,{})}):e.inputData.primary_identification_method&&e.inputData.primary_identification_method===zi.EMAIL?w.jsx(kr,{to:`${je.POINTS_TRANSACTION}/email`}):w.jsx(kr,{to:`${je.POINTS_TRANSACTION}/identifier`})}function kp({redirectRoute:e}){const{t}=$e(),{state:n}=yr(),{portalSession:r,mutate:o}=He(),{onContactLink:i}=mn(),[s,a]=k.useState(""),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=rn(),p=Gt();k.useEffect(()=>{!d&&s&&l()},[s]);const l=()=>{u(!0),p.put(r.uuid,{contact_identifier_value:s}).then(y=>{i&&m(y.data.data.contact.uuid).then(g=>{i==null||i(g.data.data)}),o().then(()=>f(e,{state:{contactIdentifier:s}}))}).catch(()=>f("link",{state:{contactIdentifier:s}})).finally(()=>u(!1))},m=y=>p.get(`${r.uuid}/contacts`,{contact_uuid:y});return w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:t("scanOrEnterX",{x:"identifier"})})})}),w.jsx(jt,{children:w.jsx(Ni,{onSubmit:()=>s&&l(),children:w.jsx(Gs,{data:s,dataSetter:a,setDefer:h,label:t("contactIdentifier")})})}),w.jsx(pn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:t("continue"),onClick:l,disabled:!s,pending:c}),r.inputData.enable_email_identification&&w.jsx(dt,{label:t("useEmail"),variant:"secondary",onClick:()=>f("../email",{state:n})})]})})]})})}function Op({redirectRoute:e}){const{t}=$e(),{errorToast:n}=tn(),{uuid:r,mutate:o}=He(),{onContactLink:i}=mn(),{state:s}=yr(),{publish:a}=Da(),[c,u]=k.useState(""),[d,h]=k.useState(!1),[f,p]=k.useState(!1),l=rn(),m=Gt();if(!s||!s.contactIdentifier)return w.jsx(kr,{to:"../"});const y=()=>{h(!0),m.post(`${r}/contacts/link-identifier`,{contact_identifier_value:s.contactIdentifier,email:c}).then(v).catch(E=>{E.response.data.code===jc.CONTACT_NOT_FOUND?p(!0):n(E)}).finally(()=>h(!1))},g=()=>{h(!0),m.post(`${r}/contacts`,{email:c}).then(y).catch(n).finally(()=>h(!1))},v=()=>{m.put(r,{email:c}).then(E=>{i&&b(E.data.data.contact.uuid).then(C=>{i==null||i(C.data.data)}),o().then(()=>l(e))}).catch(n).finally(()=>h(!1))},b=E=>m.get(`${r}/contacts`,{contact_uuid:E});return k.useEffect(()=>{a("openKeyboard",{inputId:"new-contact-identifier-input",inputValue:""})},[]),w.jsxs(Fn,{children:[w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:t("linkContact")})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx(dx,{body:t("noEmailAddressLinkedToIdentifier")}),w.jsx(Ni,{onSubmit:y,children:w.jsx(Oi,{id:"new-contact-identifier-input",label:t("emailAddress"),autoFocus:!0,onChange:E=>u(E.target.value),beforeIcon:"mail"})})]})}),w.jsx(pn,{children:w.jsx(dt,{label:t("continue"),className:"w-full",onClick:y,disabled:!c||d})})]}),w.jsx(ni,{title:`${t("new")} ${t("emailAddress").toLowerCase()}`,isOpen:f,onClose:()=>p(!1),primaryAction:{label:t("confirm"),action:g,loading:d},secondaryAction:{label:t("cancel"),action:()=>p(!1)},children:w.jsx("p",{children:t("continueWithEmail",{email:c})})})]})}function qB(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(GB,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.POINTS_TRANSACTION})}),w.jsx(Je,{path:"/identifier",element:w.jsx(kp,{redirectRoute:je.POINTS_TRANSACTION})}),w.jsx(Je,{path:"/identifier/link",element:w.jsx(Op,{redirectRoute:je.POINTS_TRANSACTION})})]})}function $B(){const{portalSession:e}=He(),{primaryIdentificationMethod:t}=mn();return e.contact?w.jsx(kr,{to:`${je.PORTAL}/overview`}):t&&t===zi.EMAIL?w.jsx(kr,{to:`${je.PORTAL}/email`}):w.jsx(kr,{to:`${je.PORTAL}/identifier`})}function WB({children:e}){return w.jsx("div",{className:"h-screen w-screen pb-[70px] md:px-4 md:pb-[86px] md:pt-4 lg:pb-4 lg:pt-[66px]",children:w.jsx("div",{className:"h-full max-h-full",children:e})})}function YB({contact:e}){const{t}=$e(),n=rn();return w.jsxs("div",{className:"inline-grid w-full items-center gap-4 py-4 lg:grid-cols-2",children:[w.jsxs("div",{className:"flex items-center gap-4",children:[w.jsx(Sh,{src:e.current_display_values.avatar,size:"2xl"}),w.jsxs("div",{className:"flex flex-col gap-1",children:[w.jsxs("div",{className:"flex gap-2",children:[w.jsx("p",{className:"text-lg",children:e.getDisplayName()}),e.current_display_values.tier&&w.jsx(Ah,{label:e.current_display_values.tier,size:"sm",stroke:!0})]}),w.jsx("p",{className:"text-sm text-core-gray-500 ",children:t("joinedAtDate",{date:new Date(e.current_display_values.created_at).toLocaleDateString(ln.language,{month:"long",year:"numeric"})})})]})]}),w.jsxs("div",{className:"inline-grid gap-2 lg:grid-cols-2",children:[w.jsx(dt,{label:t("goToX",{x:"identifiers"}),variant:"secondary",size:"md",onClick:()=>n("contact-identifiers")}),w.jsx(dt,{before:w.jsx(Pn,{icon:"edit"}),label:t("editProfile"),variant:"secondary",size:"md",onClick:()=>n("contact-attributes")})]})]})}function fc({children:e}){return w.jsx("div",{className:"flex-grow rounded-lg border p-4",children:e})}function zB(){const{t:e}=$e(),{contact:t}=Er(),{portalSession:n}=He();return w.jsxs("div",{className:"flex gap-2 lg:flex-col",children:[w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[w.jsx("p",{className:"text-2xl leading-8",children:t.current_display_values.loyalty_balance}),w.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})}),w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[w.jsx("p",{className:"text-2xl leading-8",children:Qi(t.prepaid_balance.balance_in_cents,n.currency)}),w.jsx("p",{className:"text-sm text-core-gray-500",children:e("prepaidCredit")})]})})]})}function KB(){const{t:e}=$e(),{contact:t}=Er(),{portalSession:n}=He(),r=(o,i)=>I0(o,i)?`${I0(o,i)} ${e("yearsAgo")}`:A0(o,i)?`${A0(o,i)} ${e("weeksAgo")}`:S0(o,i)?`${S0(o,i)} ${e("daysAgo")}`:e("today");return w.jsx(fc,{children:w.jsxs("div",{className:"h-full justify-between",children:[w.jsx("p",{className:"mb-4 text-lg font-semibold leading-7",children:"Stats"}),w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Pn,{icon:"calendar"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-xs font-semibold",children:r(new Date,new Date(t.current_display_values.loyalty_last_transaction_date))}),w.jsx("p",{className:"text-xs text-core-gray-500",children:e("lastVisit")})]})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Pn,{icon:"shopping-bag"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-xs font-semibold",children:`${t.current_display_values.loyalty_number_of_transactions} ${e("visits")}`}),w.jsx("p",{className:"text-xs text-core-gray-500",children:e("totalVisits")})]})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Pn,{icon:"dollar"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-xs font-semibold",children:`${t.current_display_values.loyalty_total_credits_received} ${n.loyaltyProgram.custom_credit_name}`}),w.jsx("p",{className:"text-xs text-core-gray-500",children:e("totalCredits")})]})]})]})]})})}function Cb(){const{uuid:e}=He(),[t,n]=k.useState([]),{data:r,isLoading:o,pending:i,mutate:s}=_r({url:`${e}/loyalty-transactions`});return k.useEffect(()=>{r&&n(r.data)},[r]),{loyaltyTransactions:t,isLoading:o,pending:i,mutate:s}}function _b({loyaltyTransaction:e}){const{t}=$e();return w.jsxs("div",{className:"mb-2 flex justify-between",children:[w.jsx("p",{className:"text-xs text-core-gray-500",children:e.type===l0.CREDIT_RECEPTION?t("transaction"):`${t("isRedeemed")} '${e.loyalty_transaction_data.title}'`}),w.jsx("p",{className:"text-xs font-semibold",children:e.credits>0?"+"+e.credits:e.credits})]})}function XB(){const{t:e}=$e(),t=rn(),{loyaltyTransactions:n}=Cb();return n?w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx("p",{className:"text-lg font-semibold leading-7",children:e("activities")}),n&&n.length?w.jsx("div",{children:n.slice(0,5).map(r=>w.jsx(_b,{loyaltyTransaction:r},r.uuid))}):w.jsx("p",{className:"text-sm text-core-gray-500",children:e("noActivity")})]}),w.jsx(dt,{label:`${e("all")} ${e("activities").toLowerCase()}`,variant:"secondary",onClick:()=>t("activity")})]})}):w.jsx(Gl,{})}function Sb(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/subscriptions/contact`,onData:n});return{subscriptions:t,isLoading:r,pending:o,mutate:i}}function Ab({subscription:e,onChange:t,editable:n=!1}){const{t:r}=$e();return w.jsxs("div",{className:"mb-2 flex justify-between",children:[w.jsx("p",{className:"text-xs font-semibold",children:e.subscription_type.name}),n?w.jsx(op,{defaultChecked:e.is_subscribed,disabled:e.subscription_type.strategy===d0.FUNCTIONAL,onChange:t&&(()=>t(e.subscription_type.name))}):w.jsx(Ah,{label:r(e.status.toLowerCase()),size:"sm",color:e.is_subscribed?"primary":"gray"})]})}function QB(){const{t:e}=$e(),{subscriptions:t}=Sb(),n=rn();return t?w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col justify-between",children:[w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx("p",{className:"text-lg font-semibold leading-7",children:e("subscriptions")}),w.jsx("div",{children:t.map(r=>w.jsx(Ab,{subscription:r},r.subscription_type.uuid))})]}),w.jsx(dt,{label:e("change"),before:w.jsx(Pn,{icon:"edit"}),variant:"secondary",onClick:()=>n("subscriptions")})]})}):w.jsx(Gl,{})}function JB(){const{contact:e}=Er();return w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(YB,{contact:e})}),w.jsx(jt,{children:w.jsxs("div",{className:"grid grid-cols-1 gap-x-2 gap-y-2 lg:grid-cols-4",children:[w.jsx(zB,{}),w.jsx(KB,{}),w.jsx(XB,{}),w.jsx(QB,{})]})})]})}function hc({label:e,path:t}){const n=rn();return w.jsx("div",{className:"flex h-16 items-center text-base text-core-gray-900",children:w.jsx(dt,{label:e,variant:"link-gray",before:w.jsx(Pn,{icon:"caret-left",size:"md"}),onClick:()=>n(t)})})}function ZB(){const{t:e}=$e(),{loyaltyTransactions:t}=Cb(),{contact:n}=Er();return w.jsx("div",{className:"h-full md:container",children:w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(jt,{children:w.jsxs("div",{className:"md:max-h-[528px]",children:[w.jsx("p",{className:"text-sm font-medium",children:e("allActivities")}),w.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:e("checkOutAllActivitiesOfName",{name:n.getDisplayName()})}),w.jsx("div",{className:"overflow-auto",children:t==null?void 0:t.map(r=>w.jsx(_b,{loyaltyTransaction:r},r.uuid))})]})})]})})}function eM(){const{t:e}=$e(),{errorToast:t}=tn(),{uuid:n}=He(),{subscriptions:r,mutate:o}=Sb(),[i,s]=k.useState({}),[a,c]=k.useState(!1),u=Gt();k.useEffect(()=>{if(r&&!Object.keys(i).length){const p=r.reduce((l,m)=>({...l,[m.subscription_type.name]:m.is_subscribed}),{});s(p)}},[]);const d=p=>{Object.hasOwn(i,p)?s({...i,[p]:!i[p]}):s({...i,[p]:!0})},h=()=>{c(!0),u.put(`${n}/subscriptions`,{values:i}).then(()=>o()).catch(t).finally(()=>c(!1))},f=()=>r&&r.some(p=>i[p.subscription_type.name]!==p.is_subscribed);return r?w.jsx("div",{className:"h-full md:container",children:w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(jt,{children:w.jsx("div",{className:"md:max-h-[528px]",children:w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium",children:e("subscriptions")}),w.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:e("manageEmailPreferences")}),r.map(p=>w.jsx(Ab,{subscription:p,onChange:d,editable:!0},p.subscription_type.uuid))]})})}),w.jsx(pn,{children:w.jsx(dt,{label:e("saveChanges"),className:"w-full",onClick:h,pending:a,disabled:!f()||a})})]})}):w.jsx(Gl,{})}function tM(){const{t:e}=$e(),{errorToast:t}=tn(),{uuid:n}=He(),{contact:r,mutate:o}=Er(),[i,s]=k.useState(),[a,c]=k.useState(!1),[u,d]=k.useState(),h=Gt();_r({url:`${n}/contact-attributes`,onData:m=>s(m.elements)});const f=m=>{d({...u,[m.target.name]:m.target.value})},p=(m,y)=>{d({...u,[m]:y})},l=async()=>{c(!0),h.put(`${n}/contact-attributes`,u).then(()=>{o(),d(void 0)}).catch(t).finally(()=>c(!1))};return w.jsx("div",{className:"h-full md:container",children:w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(jt,{children:w.jsxs("div",{className:"md:max-h-[528px]",children:[w.jsxs("div",{className:"mb-4 flex flex-row items-center gap-4 border-b border-b-core-gray-200 px-1 pb-4",children:[w.jsx(Sh,{src:r.current_display_values.avatar,size:"2xl"}),w.jsxs("div",{children:[w.jsx("div",{className:"flex flex-row items-center gap-2 ",children:w.jsxs("h1",{className:"text-lg text-core-gray-900",children:[r.current_display_values.firstname," ",r.current_display_values.lastname]})}),w.jsx("p",{className:"text-sm text-core-gray-500",children:r.current_display_values.email})]})]}),i?i.map(m=>{if(!(m.type==="media_upload"||m.type==="email"))return m.type==="select"?w.jsx(Ax,{name:m.name,label:m.label,value:u&&u[m.name]?u[m.name]:r.current_display_values[m.name],onChange:y=>p(m.name,y),disabled:m.disabled,children:m.options.map(y=>w.jsx(Th,{label:y.label,value:y.value},y.value))},m.id):m.type==="multi_select"?w.jsx(Ex,{name:m.name,value:u&&u[m.name]?u[m.name]:m.defaultValue,label:m.label,onChange:p,disabled:m.disabled,options:m.options},m.id):m.type==="birth_date"||m.type==="date_time"?w.jsx(qy,{id:m.id,name:m.name,label:m.label,type:m.type==="date_time"?"date_time":"date",value:u&&u[m.name]?u[m.name]:r.current_display_values[m.name],disabled:m.disabled,onChange:f},m.id):w.jsx(Oi,{disabled:m.disabled,label:m.label,name:m.name,value:u&&u[m.name]!=="undefined"?u[m.name]:r.current_display_values[m.name],onChange:f},m.id)}):w.jsx(vl,{rows:10})]})}),w.jsx(pn,{children:w.jsx(dt,{label:e("saveChanges"),className:"w-full",onClick:l,disabled:!u,pending:a})})]})})}function Ib(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/contact-identifiers`,onData:n});return{contactIdentifiers:t,isLoading:r,pending:o,mutate:i}}function nM({identifier:e,onClear:t}){const{t:n}=$e();return w.jsxs("div",{className:"flex items-center justify-between rounded-lg border text-xs",children:[w.jsxs("div",{className:"flex-col pl-4",children:[w.jsx("p",{className:"font-semibold",children:e.value}),w.jsx("p",{className:"text-core-gray-500",children:n("contactIdentifier")})]}),w.jsx("div",{className:"h-full border-l p-4 hover:cursor-pointer hover:bg-core-gray-50",onClick:()=>t&&t(e.value),children:w.jsx(Pn,{className:"h-full",icon:"close"})})]})}function rM(){const{t:e}=$e(),{errorToast:t}=tn(),{uuid:n}=He(),{contactIdentifiers:r,isLoading:o,mutate:i}=Ib(),[s,a]=k.useState(""),[c,u]=k.useState(!1),d=rn(),h=Gt(),f=l=>{a(l),u(!0)},p=async()=>{h.destroy(`${n}/contact-identifiers`,{value:s}).then(()=>i()).catch(t).finally(()=>u(!1))};return w.jsxs("div",{className:"h-full md:container",children:[w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(jt,{children:w.jsx("div",{className:"md:max-h-[528px]",children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium",children:e("contactIdentifiers")}),w.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:e("contactIdentifierDescription")})]}),o?w.jsx(vl,{rows:10}):r==null?void 0:r.map(l=>w.jsx(nM,{identifier:l,onClear:f},l.value))]})})}),w.jsx(pn,{children:w.jsx(dt,{label:e("addIdentifier"),className:"w-full",variant:"secondary",onClick:()=>d("create")})})]}),w.jsx(ni,{title:e("confirmClearContactIdentifier"),isOpen:c,primaryAction:{label:e("confirm"),action:p},secondaryAction:{label:e("cancel"),action:()=>u(!1)},onClose:()=>u(!1),children:w.jsx("p",{children:e("clearContactIdentifier",{value:s})})})]})}function oM(){const{t:e}=$e(),{errorToast:t}=tn(),{uuid:n}=He(),{contact:r}=Er(),{mutate:o}=Ib(),[i,s]=k.useState(""),[a,c]=k.useState(!1),[u,d]=k.useState(!1),h=rn(),f=Gt(),p=()=>{c(!0),f.post(`${n}/contacts/link-identifier`,{contact_identifier_value:i,email:r.email}).then(()=>{o(),h("../profile/contact-identifiers")}).catch(t).finally(()=>{s(""),c(!1)})};return k.useEffect(()=>{!u&&i&&p()},[i]),w.jsx("div",{className:"h-full md:container",children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx(hc,{label:e("back"),path:"../profile/contact-identifiers"})}),w.jsx(jt,{children:w.jsx(Ni,{onSubmit:()=>i&&p(),children:w.jsx(Gs,{data:i,dataSetter:s,setDefer:d,label:e("contactIdentifier")})})}),w.jsx(pn,{children:w.jsx(dt,{label:e("addIdentifier"),className:"w-full",onClick:p,pending:a,disabled:!i})})]})})}function iM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/profile",element:w.jsx(JB,{})}),w.jsx(Je,{path:"/profile/activity",element:w.jsx(ZB,{})}),w.jsx(Je,{path:"/profile/subscriptions",element:w.jsx(eM,{})}),w.jsx(Je,{path:"/profile/contact-identifiers",element:w.jsx(rM,{})}),w.jsx(Je,{path:"/profile/contact-identifiers/create",element:w.jsx(oM,{})}),w.jsx(Je,{path:"/profile/contact-attributes",element:w.jsx(tM,{})})]})}function sM(){const{t:e}=$e(),{contact:t}=Er(),{portalSession:n}=He();return w.jsxs("div",{className:"flex h-16 items-center justify-between",children:[w.jsx("h1",{children:e("rewards")}),w.jsxs("div",{className:"flex flex-col items-center",children:[w.jsx("p",{children:t.credit_balance.balance}),w.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})]})}function Tb(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/rewards`,onData:n});return{rewards:t,isLoading:r,pending:o,mutate:i}}function Pp({reward:e,selected:t,setSelected:n,disabled:r,readOnly:o}){const{portalSession:i}=He(),{contact:s}=Er();return w.jsxs("div",{className:`max-h-[48px] rounded-lg border ${r?"pointer-events-none opacity-40":!o&&"cursor-pointer"}`,children:[w.jsxs("div",{className:`flex items-center justify-between rounded-lg text-xs ${r?"px-2 pt-2":"p-2"}`,onClick:o?void 0:()=>(t==null?void 0:t.uuid)===e.uuid?n(void 0):n(e),children:[w.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[w.jsx("img",{src:e.media&&e.media.value?e.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),w.jsx("p",{className:"truncate",children:e.title??e.description})]}),w.jsxs("p",{className:"whitespace-nowrap text-core-primary-500",children:[e.required_credits," ",i.loyaltyProgram.custom_credit_name]})]}),e.required_credits-s.credit_balance.balance>0&&w.jsx(Cx,{value:s.credit_balance.balance,max:e.required_credits})]})}function aM({selected:e,setSelected:t}){const{t:n}=$e(),{contact:r}=Er(),{rewards:o,isLoading:i}=Tb(),s=o==null?void 0:o.filter(c=>c.required_credits<=r.credit_balance.balance),a=o==null?void 0:o.filter(c=>c.required_credits>r.credit_balance.balance);return w.jsx(w.Fragment,{children:i?w.jsx(vl,{rows:1}):w.jsxs("div",{className:"flex flex-col gap-3 md:max-h-[528px]",children:[w.jsx("div",{className:"flex flex-col gap-1",children:(s==null?void 0:s.length)>0&&w.jsxs(w.Fragment,{children:[w.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("redeemableRewards")}),s.map(c=>w.jsx(Pp,{reward:c,selected:e,setSelected:t},c.uuid))]})}),w.jsx("div",{className:"flex flex-col gap-1",children:(a==null?void 0:a.length)>0&&w.jsxs(w.Fragment,{children:[w.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("saveABitMore")}),a.map(c=>w.jsx(Pp,{reward:c,selected:e,setSelected:t,disabled:!0},c.uuid))]})})]})})}function cM(){const{portalSession:e}=He(),{rewards:t}=Tb(),n=()=>e.events.filter(r=>r.type===Fo.REWARD_RECEPTION).map(r=>t.find(o=>o.uuid===r.data.reward.uuid)).filter(r=>r);return t?w.jsx("div",{children:w.jsx(Yv,{children:n().map((r,o)=>w.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-core-primary-100 bg-core-primary-50 p-2 text-xs",children:[w.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[w.jsx("img",{src:r.media&&r.media.value?r.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-8 w-8 rounded object-cover object-center"}),w.jsx("p",{className:"truncate",children:r.title??r.description})]}),w.jsxs("p",{className:"text-core-primary-500",children:[r.required_credits," ",e.loyaltyProgram.custom_credit_name]})]},`${o}-${r.uuid}`))},n().length)}):w.jsx(w.Fragment,{})}function uM(){const{t:e}=$e(),{errorToast:t,successToast:n}=tn(),{portalSession:r,mutate:o}=He(),{mutate:i}=Er(),{onClaimReward:s}=mn(),[a,c]=k.useState(),[u,d]=k.useState(!1),[h,f]=k.useState(!1),{post:p}=dc(),l=Gt();k.useEffect(()=>{a&&f(!0)},[a]);const m=g=>{o().then(v=>{const E=v.data.data.events.filter(C=>C.type===Fo.REWARD_RECEPTION&&C.data.reward.uuid===a.uuid).reduce((C,A)=>new Date(C.created_at)>new Date(A.created_at)?C:A);s==null||s(g,E.data.uuid)})},y=()=>{d(!0),l.post(`${r.uuid}/rewards/claim`,{uuid:a.uuid}).then(g=>{p(),i(),m(g.data.data),n(e("rewardClaimed",{name:g.data.data.title}))}).catch(t).finally(()=>{f(!1),c(void 0),d(!1)})};return w.jsxs("div",{className:"h-full md:container",children:[w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(sM,{})}),w.jsx(jt,{children:w.jsx(aM,{selected:a,setSelected:c})}),w.jsx(pn,{children:w.jsx(cM,{})})]}),w.jsx(ni,{title:e("confirmRewardRedemption"),isOpen:h,primaryAction:{label:e("confirm"),action:y,loading:u},secondaryAction:{label:e("cancel"),action:()=>f(!1)},onClose:()=>f(!1),children:w.jsx("div",{className:"flex flex-col gap-4",children:a&&w.jsx(Pp,{reward:a,selected:a,setSelected:c,readOnly:!0})})})]})}function Rp(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/vouchers`,onData:n});return{vouchers:t,isLoading:r,pending:o,mutate:i}}function lM(){const{t:e}=$e();return w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("vouchers")})})}function Np({voucher:e,selected:t,setSelected:n}){const{t:r}=$e();return w.jsxs("div",{className:`flex cursor-pointer items-center justify-between gap-4 rounded-lg ${e.status===oa.REDEEMED?"border border-core-primary-100 bg-core-primary-50":"border bg-white"} p-2 text-xs`,onClick:()=>(t==null?void 0:t.code)===e.code?n(void 0):n(e),children:[w.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[w.jsx("img",{src:e.promotion.image?e.promotion.image.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),w.jsxs("div",{className:"overflow-hidden overflow-ellipsis ",children:[w.jsx("p",{className:"font-semibold",children:e.name}),e.status===oa.REDEEMED?w.jsx("p",{className:"text-core-gray-500",children:r("redeemed")}):w.jsx("p",{className:"text-core-primary-500",children:e.expiration_date?`Valid until ${new Date(e.expiration_date).toLocaleDateString()}`:r("nonExpiring")})]})]}),w.jsx("p",{className:`text-core-${e.status===oa.REDEEMED?"gray":"primary"}-500`,children:e.code})]})}function dM({selected:e,setSelected:t}){const{t:n}=$e(),{vouchers:r,isLoading:o}=Rp();return w.jsx(w.Fragment,{children:o?w.jsx(vl,{rows:1}):w.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:w.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:r&&r.length?r.map(i=>w.jsx(Np,{voucher:i,selected:e,setSelected:t},i.code)):w.jsx("p",{className:"text-center text-sm text-core-gray-500",children:n("vouchersEmptyState")})})})})}function fM(){const{t:e}=$e(),{portalSession:t}=He(),{vouchers:n}=Rp(),r=()=>t.events.filter(o=>o.type===Fo.VOUCHER_REDEEMED);return n?w.jsx("div",{children:w.jsx(Yv,{children:r().map((o,i)=>w.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-core-primary-100 bg-core-primary-50 p-2",children:w.jsx("div",{className:"flex h-full flex-col justify-between text-xs",children:w.jsxs("div",{className:"overflow-hidden",children:[w.jsx("p",{className:"font-semibold",children:o.data.name}),w.jsxs("p",{className:"overflow-ellipsis text-core-gray-500",children:[o.data.code," - ",e("applied")]})]})})},`${i}-${o.data.uuid}`))},r().length)}):w.jsx(w.Fragment,{})}function hM(){const{t:e}=$e(),{errorToast:t,successToast:n}=tn(),{uuid:r}=He(),{onRedeemVoucher:o}=mn(),{post:i}=dc(),{mutate:s}=Rp(),[a,c]=k.useState(),[u,d]=k.useState(!1),[h,f]=k.useState(!1),p=Gt();k.useEffect(()=>{a&&f(!0)},[a]);const l=()=>{d(!0),p.post(`${r}/vouchers/redeem`,{code:a.code}).then(y=>{i(),o&&o(y.data.data),n(e("voucherSuccessfullyRedeemed")),s()}).catch(t).finally(()=>{m(),d(!1)})},m=()=>{f(!1),c(void 0)};return w.jsxs("div",{className:"h-full md:container",children:[w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx(lM,{})}),w.jsx(jt,{children:w.jsx(dM,{selected:a,setSelected:c})}),w.jsx(pn,{children:w.jsx(fM,{})})]}),w.jsx(ni,{title:e("confirmVoucherRedemption"),isOpen:h,primaryAction:{label:e("confirm"),action:l,loading:u},secondaryAction:{label:e("cancel"),action:m},onClose:m,children:w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx("p",{children:e("redeemTitle",{title:a==null?void 0:a.name})}),a&&w.jsx(Np,{voucher:a,setSelected:c})]})})]})}function pM(){const{t:e}=$e(),[t,n]=k.useState(1),r=rn(),o=[{id:0,label:e("profile"),icon:"user",pathname:"profile"},{id:1,label:e("rewards"),icon:"edit",pathname:"rewards"},{id:2,label:e("vouchers"),icon:"mail",pathname:"vouchers"}];return k.useEffect(()=>{r(o[t].pathname)},[]),w.jsx(xp,{children:w.jsxs("div",{className:"relative h-full w-full select-none overflow-auto",children:[w.jsx(eO,{children:o.map(i=>w.jsx(tO,{id:i.id,label:i.label,icon:i.icon,activeTab:t,setActiveTab:n,pathname:i.pathname},i.id))}),w.jsxs(WB,{children:[w.jsx(iM,{}),w.jsxs(So,{children:[w.jsx(Je,{path:"/rewards",element:w.jsx(uM,{})}),w.jsx(Je,{path:"/vouchers",element:w.jsx(hM,{})})]})]})]})})}function mM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx($B,{})}),w.jsx(Je,{path:"/overview/*",element:w.jsx(pM,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.PORTAL})}),w.jsx(Je,{path:"/identifier",element:w.jsx(kp,{redirectRoute:je.PORTAL})}),w.jsx(Je,{path:"/identifier/link",element:w.jsx(Op,{redirectRoute:je.PORTAL})})]})}function xb(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/prepaid`,onData:n});return{prepaidBalance:t,isLoading:r,pending:o,mutate:i}}function gM(){const{t:e}=$e(),{state:t}=yr(),{errorToast:n,successToast:r}=tn(),{uuid:o,mutate:i}=He(),{contact:s}=Er(),{onCreatePrepaidTransaction:a}=mn(),{prepaidBalance:c,mutate:u}=xb(),[d,h]=k.useState(!1),f=Gt(),p=l=>{h(!0),f.post(`${o}/prepaid/transaction`,{amount_in_cents:l,contact_identifier_value:(t==null?void 0:t.contactIdentifier)??void 0}).then(m=>{u(),i(),a(m.data.data),r(e("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?w.jsx(Fn,{children:w.jsx(bb,{title:s.getDisplayName(),balance:(c==null?void 0:c.balance_in_cents)??0,balanceName:e("prepaidBalance"),transaction:p,pending:d})}):w.jsx(Fr,{})}function yM({title:e,balance:t,balanceName:n,transaction:r,pending:o}){const{t:i}=$e(),{portalSession:s}=He(),a=s.inputData.amount_in_cents??0,c=()=>{let d=0;return s.events.filter(f=>Object.values(Fo).includes(f.type)).forEach(f=>{d+=f.data.amount_in_cents}),d},u=()=>Math.min(a+c(),t);return w.jsxs(qt,{children:[e&&w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e})})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex h-full flex-col gap-4",children:[w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),w.jsx(ti,{value:t,start:t+c(),currency:s.currency,asCurrency:!0})]})}),w.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:w.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[w.jsx("p",{className:"text-sm font-light text-gray-500",children:i("amountToPay")}),w.jsx("div",{className:"text-5xl font-bold",children:w.jsx(ti,{value:u(),start:a,currency:s.currency,asCurrency:!0})})]})})]})}),w.jsx(pn,{children:w.jsx(dt,{label:i("confirmAndPay",{amount:Qi(u(),s.currency)}),className:"w-full",onClick:()=>r==null?void 0:r(-u()),disabled:!a||!!c(),pending:o})})]})}function vM(){const{t:e}=$e(),{state:t}=yr(),{errorToast:n,successToast:r}=tn(),{uuid:o,mutate:i}=He(),{contact:s}=Er(),{onCreatePrepaidTransaction:a}=mn(),{prepaidBalance:c,mutate:u}=xb(),[d,h]=k.useState(!1),f=Gt(),p=l=>{h(!0),f.post(`${o}/prepaid/transaction`,{amount_in_cents:l,contact_identifier_value:(t==null?void 0:t.contactIdentifier)??void 0}).then(m=>{u(),i(),a(m.data.data),r(e("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?w.jsx(Fn,{children:w.jsx(yM,{title:s.getDisplayName(),balance:c.balance_in_cents,balanceName:e("prepaidBalance"),transaction:p,pending:d})}):w.jsx(Fr,{})}function wM({setType:e}){const{t}=$e();return w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:t("Choose type")})})}),w.jsx(jt,{children:w.jsxs("div",{className:"flex gap-2",children:[w.jsx(dt,{className:"grow",label:t("pay"),onClick:()=>e(nn.PAY_PREPAID)}),w.jsx(dt,{className:"grow",label:t("topUp"),onClick:()=>e(nn.TOP_UP_PREPAID)})]})})]})})}function bM(){const{portalSession:e}=He(),{primaryIdentificationMethod:t}=mn(),[n,r]=k.useState(e.type);if(!e.contact)return t&&t===zi.EMAIL?w.jsx(kr,{to:`${je.PREPAID}/email`}):w.jsx(kr,{to:`${je.PREPAID}/identifier`});const o=()=>n===nn.TOP_UP_PREPAID?w.jsx(gM,{}):n===nn.PAY_PREPAID?w.jsx(vM,{}):w.jsx(wM,{setType:r});return w.jsx(xp,{children:o()})}function EM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(bM,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.PREPAID})}),w.jsx(Je,{path:"/identifier",element:w.jsx(kp,{redirectRoute:je.PREPAID})}),w.jsx(Je,{path:"/identifier/link",element:w.jsx(Op,{redirectRoute:je.PREPAID})})]})}function CM(){const{t:e}=$e(),{errorToast:t}=tn(),{uuid:n,portalSession:r}=He(),[o,i]=k.useState(""),[s,a]=k.useState(!1),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=rn(),p=Gt(),l=()=>{a(!0),p.get(`${n}/vouchers/check/${o}`).then(m=>{m.data.data.contact||r.contact?f(`${o}/redeem`):h(!0)}).catch(t).finally(()=>a(!1))};return k.useEffect(()=>{!c&&o&&l()},[o]),w.jsxs(w.Fragment,{children:[w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanOrEnterX",{x:e("voucherCode").toLowerCase()})})})}),w.jsx(jt,{children:w.jsx(Gs,{data:o,dataSetter:i,setDefer:u,label:e("code")})}),w.jsx(pn,{children:w.jsx(dt,{label:e("submit"),className:"w-full",onClick:l,pending:s})})]})}),w.jsx(ni,{title:e("noContactLinkedToVoucherTitle"),isOpen:d,onClose:()=>h(!1),primaryAction:{label:e("linkToContact"),action:()=>f(`${o}/identifier`)},secondaryAction:{label:e("cancel"),action:()=>h(!1)},children:w.jsx("p",{children:e("linkVoucherWithCodeToContact",{code:o})})})]})}function _M(){const{t:e}=$e(),{errorToast:t}=tn(),{code:n}=_o(),{uuid:r}=He(),{onRedeemVoucher:o}=mn(),{post:i}=dc(),{voucher:s,mutate:a}=vb(n),[c,u]=k.useState(!1),d=Gt(),h=()=>{u(!0),d.post(`${r}/vouchers/redeem`,{code:n}).then(f=>{o==null||o(f.data.data),i(),a()}).catch(t).finally(()=>u(!1))};return s?w.jsx(Fn,{children:w.jsxs(qt,{children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:"Voucher"})})}),w.jsx(jt,{children:w.jsx("div",{children:w.jsx(Np,{voucher:s,setSelected:()=>{}})})}),w.jsx(pn,{children:w.jsx(dt,{label:e("redeemVoucher"),className:"w-full",onClick:h,disabled:s.status!==oa.ACTIVE||c,pending:c})})]})}):w.jsx(Fr,{})}function SM(){const{t:e}=$e(),{errorToast:t}=tn(),{code:n}=_o(),{portalSession:r,mutate:o}=He(),{onContactLink:i}=mn(),[s,a]=k.useState(""),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=rn(),p=Gt(),l=y=>p.get(`${r.uuid}/contacts`,{contact_uuid:y}),m=()=>{u(!0),p.put(r.uuid,{contact_identifier_value:s}).then(y=>{i&&l(y.data.data.contact.uuid).then(g=>{i==null||i(g.data.data)}),o().then(()=>f(`${je.VOUCHER}/${n}/redeem`))}).catch(t).finally(()=>u(!1))};return k.useEffect(()=>{!d&&s&&m()},[s]),w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanOrEnterX",{x:"identifier"})})})}),w.jsx(jt,{children:w.jsx(Ni,{onSubmit:m,children:w.jsx(Gs,{data:s,dataSetter:a,setDefer:h,label:e("contactIdentifier")})})}),w.jsx(pn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:e("continue"),onClick:m,pending:c}),r.inputData.enable_email_identification&&w.jsx(dt,{label:e("useEmail"),variant:"secondary",onClick:()=>f(`../${n}/email`)})]})})]})})}function AM(){const{t:e}=$e(),{code:t}=_o(),{onContactLink:n}=mn(),{portalSession:r,mutate:o}=He(),{publish:i}=Da(),[s,a]=k.useState(""),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=rn(),p=Gt(),l=g=>p.get(`${r.uuid}/contacts`,{contact_uuid:g}),m=()=>{u(!0),p.put(r.uuid,{email:s}).then(g=>{n&&l(g.data.data.contact.uuid).then(v=>{n==null||n(v.data.data)}),o().then(()=>f(`${je.VOUCHER}/${t}/redeem`))}).catch(g=>{g.response.data.code===jc.CONTACT_NOT_FOUND&&h(!0)}).finally(()=>u(!1))},y=()=>{u(!0),p.post(`${r.uuid}/contacts`,{email:s}).then(m).finally(()=>u(!1))};return k.useEffect(()=>{i("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),w.jsxs(w.Fragment,{children:[w.jsx(Fn,{children:w.jsxs(qt,{id:Or,children:[w.jsx(Vt,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("fillInXBelow",{x:e("emailAddress").toLowerCase()})})})}),w.jsx(jt,{children:w.jsx(Ni,{onSubmit:()=>s&&!c&&m(),children:w.jsx(Oi,{id:"via-email-address-input",label:e("emailAddress"),autoFocus:!0,onChange:g=>a(g.target.value),beforeIcon:"mail"})})}),w.jsx(pn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:e("continue"),className:"w-full",onClick:m,pending:c,disabled:!s||c}),w.jsx(dt,{label:e("useIdentifier"),variant:"secondary",onClick:()=>f(`../${t}/identifier`)})]})})]})}),w.jsx(ni,{title:`${e("new")} ${e("emailAddress").toLowerCase()}`,isOpen:d,onClose:()=>h(!1),primaryAction:{label:e("confirm"),action:y,disabled:c},secondaryAction:{label:e("cancel"),action:()=>h(!1)},children:w.jsx("p",{children:e("continueWithEmail",{email:s})})})]})}function IM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(CM,{})}),w.jsx(Je,{path:":code/redeem",element:w.jsx(_M,{})}),w.jsx(Je,{path:":code/email",element:w.jsx(AM,{})}),w.jsx(Je,{path:":code/identifier",element:w.jsx(SM,{})})]})}function TM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(tx,{})}),w.jsx(Je,{path:`${je.GENERIC}/*`,element:w.jsx(BB,{})}),w.jsx(Je,{path:`${je.GIFTCARD}/*`,element:w.jsx(UB,{})}),w.jsx(Je,{path:`${je.POINTS_TRANSACTION}/*`,element:w.jsx(qB,{})}),w.jsx(Je,{path:`${je.PORTAL}/*`,element:w.jsx(mM,{})}),w.jsx(Je,{path:`${je.PREPAID}/*`,element:w.jsx(EM,{})}),w.jsx(Je,{path:`${je.VOUCHER}/*`,element:w.jsx(IM,{})})]})}function xM(){const{t:e}=$e(),[t,n]=k.useState(!1);return w.jsx("div",{className:"default-bg-colors flex h-screen items-center justify-center",children:w.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-300 bg-white shadow-lg",children:[w.jsx("div",{className:"border-b border-gray-200 bg-gray-50 px-6 pb-3 pt-4 shadow",children:w.jsx("h2",{className:"text-3xl",children:"Oops!"})}),w.jsx("p",{className:"mt-4 px-6 text-gray-900",children:e("sorrySomethingWentWrong")}),w.jsx("div",{className:"mt-10 p-6",children:w.jsx(dt,{onClick:()=>{n(!0),window.location.replace("/")},pending:t,label:e("back")})})]})})}function Bp(e){"@babel/helpers - typeof";return Bp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bp(e)}function kb(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Bp(XMLHttpRequest))==="object"}function kM(e){return!!e&&typeof e.then=="function"}function OM(e){return kM(e)?e:Promise.resolve(e)}function PM(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Mp={exports:{}},ql={exports:{}},Ob;function RM(){return Ob||(Ob=1,function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof $i<"u"&&$i,r=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(s){var a=typeof i<"u"&&i||typeof self<"u"&&self||typeof a<"u"&&a,c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function u(P){return P&&DataView.prototype.isPrototypeOf(P)}if(c.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(P){return P&&d.indexOf(Object.prototype.toString.call(P))>-1};function f(P){if(typeof P!="string"&&(P=String(P)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(P)||P==="")throw new TypeError('Invalid character in header field name: "'+P+'"');return P.toLowerCase()}function p(P){return typeof P!="string"&&(P=String(P)),P}function l(P){var V={next:function(){var z=P.shift();return{done:z===void 0,value:z}}};return c.iterable&&(V[Symbol.iterator]=function(){return V}),V}function m(P){this.map={},P instanceof m?P.forEach(function(V,z){this.append(z,V)},this):Array.isArray(P)?P.forEach(function(V){this.append(V[0],V[1])},this):P&&Object.getOwnPropertyNames(P).forEach(function(V){this.append(V,P[V])},this)}m.prototype.append=function(P,V){P=f(P),V=p(V);var z=this.map[P];this.map[P]=z?z+", "+V:V},m.prototype.delete=function(P){delete this.map[f(P)]},m.prototype.get=function(P){return P=f(P),this.has(P)?this.map[P]:null},m.prototype.has=function(P){return this.map.hasOwnProperty(f(P))},m.prototype.set=function(P,V){this.map[f(P)]=p(V)},m.prototype.forEach=function(P,V){for(var z in this.map)this.map.hasOwnProperty(z)&&P.call(V,this.map[z],z,this)},m.prototype.keys=function(){var P=[];return this.forEach(function(V,z){P.push(z)}),l(P)},m.prototype.values=function(){var P=[];return this.forEach(function(V){P.push(V)}),l(P)},m.prototype.entries=function(){var P=[];return this.forEach(function(V,z){P.push([z,V])}),l(P)},c.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function y(P){if(P.bodyUsed)return Promise.reject(new TypeError("Already read"));P.bodyUsed=!0}function g(P){return new Promise(function(V,z){P.onload=function(){V(P.result)},P.onerror=function(){z(P.error)}})}function v(P){var V=new FileReader,z=g(V);return V.readAsArrayBuffer(P),z}function b(P){var V=new FileReader,z=g(V);return V.readAsText(P),z}function E(P){for(var V=new Uint8Array(P),z=new Array(V.length),X=0;X<V.length;X++)z[X]=String.fromCharCode(V[X]);return z.join("")}function C(P){if(P.slice)return P.slice(0);var V=new Uint8Array(P.byteLength);return V.set(new Uint8Array(P)),V.buffer}function A(){return this.bodyUsed=!1,this._initBody=function(P){this.bodyUsed=this.bodyUsed,this._bodyInit=P,P?typeof P=="string"?this._bodyText=P:c.blob&&Blob.prototype.isPrototypeOf(P)?this._bodyBlob=P:c.formData&&FormData.prototype.isPrototypeOf(P)?this._bodyFormData=P:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(P)?this._bodyText=P.toString():c.arrayBuffer&&c.blob&&u(P)?(this._bodyArrayBuffer=C(P.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(P)||h(P))?this._bodyArrayBuffer=C(P):this._bodyText=P=Object.prototype.toString.call(P):this._bodyText="",this.headers.get("content-type")||(typeof P=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(P)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var P=y(this);if(P)return P;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var P=y(this);return P||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(v)}),this.text=function(){var P=y(this);if(P)return P;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(E(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(B)}),this.json=function(){return this.text().then(JSON.parse)},this}var T=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function x(P){var V=P.toUpperCase();return T.indexOf(V)>-1?V:P}function R(P,V){if(!(this instanceof R))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');V=V||{};var z=V.body;if(P instanceof R){if(P.bodyUsed)throw new TypeError("Already read");this.url=P.url,this.credentials=P.credentials,V.headers||(this.headers=new m(P.headers)),this.method=P.method,this.mode=P.mode,this.signal=P.signal,!z&&P._bodyInit!=null&&(z=P._bodyInit,P.bodyUsed=!0)}else this.url=String(P);if(this.credentials=V.credentials||this.credentials||"same-origin",(V.headers||!this.headers)&&(this.headers=new m(V.headers)),this.method=x(V.method||this.method||"GET"),this.mode=V.mode||this.mode||null,this.signal=V.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&z)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(z),(this.method==="GET"||this.method==="HEAD")&&(V.cache==="no-store"||V.cache==="no-cache")){var X=/([?&])_=[^&]*/;if(X.test(this.url))this.url=this.url.replace(X,"$1_="+new Date().getTime());else{var re=/\?/;this.url+=(re.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}R.prototype.clone=function(){return new R(this,{body:this._bodyInit})};function B(P){var V=new FormData;return P.trim().split("&").forEach(function(z){if(z){var X=z.split("="),re=X.shift().replace(/\+/g," "),oe=X.join("=").replace(/\+/g," ");V.append(decodeURIComponent(re),decodeURIComponent(oe))}}),V}function F(P){var V=new m,z=P.replace(/\r?\n[\t ]+/g," ");return z.split("\r").map(function(X){return X.indexOf(`
|
|
158
158
|
`)===0?X.substr(1,X.length):X}).forEach(function(X){var re=X.split(":"),oe=re.shift().trim();if(oe){var ce=re.join(":").trim();V.append(oe,ce)}}),V}A.call(R.prototype);function j(P,V){if(!(this instanceof j))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');V||(V={}),this.type="default",this.status=V.status===void 0?200:V.status,this.ok=this.status>=200&&this.status<300,this.statusText=V.statusText===void 0?"":""+V.statusText,this.headers=new m(V.headers),this.url=V.url||"",this._initBody(P)}A.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},j.error=function(){var P=new j(null,{status:0,statusText:""});return P.type="error",P};var G=[301,302,303,307,308];j.redirect=function(P,V){if(G.indexOf(V)===-1)throw new RangeError("Invalid status code");return new j(null,{status:V,headers:{location:P}})},s.DOMException=a.DOMException;try{new s.DOMException}catch{s.DOMException=function(V,z){this.message=V,this.name=z;var X=Error(V);this.stack=X.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function H(P,V){return new Promise(function(z,X){var re=new R(P,V);if(re.signal&&re.signal.aborted)return X(new s.DOMException("Aborted","AbortError"));var oe=new XMLHttpRequest;function ce(){oe.abort()}oe.onload=function(){var de={status:oe.status,statusText:oe.statusText,headers:F(oe.getAllResponseHeaders()||"")};de.url="responseURL"in oe?oe.responseURL:de.headers.get("X-Request-URL");var Ee="response"in oe?oe.response:oe.responseText;setTimeout(function(){z(new j(Ee,de))},0)},oe.onerror=function(){setTimeout(function(){X(new TypeError("Network request failed"))},0)},oe.ontimeout=function(){setTimeout(function(){X(new TypeError("Network request failed"))},0)},oe.onabort=function(){setTimeout(function(){X(new s.DOMException("Aborted","AbortError"))},0)};function we(de){try{return de===""&&a.location.href?a.location.href:de}catch{return de}}oe.open(re.method,we(re.url),!0),re.credentials==="include"?oe.withCredentials=!0:re.credentials==="omit"&&(oe.withCredentials=!1),"responseType"in oe&&(c.blob?oe.responseType="blob":c.arrayBuffer&&re.headers.get("Content-Type")&&re.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(oe.responseType="arraybuffer")),V&&typeof V.headers=="object"&&!(V.headers instanceof m)?Object.getOwnPropertyNames(V.headers).forEach(function(de){oe.setRequestHeader(de,p(V.headers[de]))}):re.headers.forEach(function(de,Ee){oe.setRequestHeader(Ee,de)}),re.signal&&(re.signal.addEventListener("abort",ce),oe.onreadystatechange=function(){oe.readyState===4&&re.signal.removeEventListener("abort",ce)}),oe.send(typeof re._bodyInit>"u"?null:re._bodyInit)})}return H.polyfill=!0,a.fetch||(a.fetch=H,a.Headers=m,a.Request=R,a.Response=j),s.Headers=m,s.Request=R,s.Response=j,s.fetch=H,s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var o=n.fetch?n:r;t=o.fetch,t.default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(ql,ql.exports)),ql.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof $i<"u"&&$i.fetch?n=$i.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof PM<"u"&&typeof window>"u"){var r=n||RM();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(Mp,Mp.exports);var Pb=Mp.exports;const Rb=td(Pb),Nb=_E({__proto__:null,default:Rb},[Pb]);function Bb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Mb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bb(Object(n),!0).forEach(function(r){NM(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bb(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function NM(e,t,n){return t=BM(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BM(e){var t=MM(e,"string");return Ui(t)=="symbol"?t:t+""}function MM(e,t){if(Ui(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Ui(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ui(e){"@babel/helpers - typeof";return Ui=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ui(e)}var To;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?To=global.fetch:typeof window<"u"&&window.fetch?To=window.fetch:To=fetch);var pc;kb()&&(typeof global<"u"&&global.XMLHttpRequest?pc=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(pc=window.XMLHttpRequest));var $l;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?$l=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&($l=window.ActiveXObject)),!To&&Nb&&!pc&&!$l&&(To=Rb||Nb),typeof To!="function"&&(To=void 0);var Dp=function(t,n){if(n&&Ui(n)==="object"){var r="";for(var o in n)r+="&"+encodeURIComponent(o)+"="+encodeURIComponent(n[o]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},Db=function(t,n,r,o){var i=function(c){if(!c.ok)return r(c.statusText||"Error",{status:c.status});c.text().then(function(u){r(null,{status:c.status,data:u})}).catch(r)};if(o){var s=o(t,n);if(s instanceof Promise){s.then(i).catch(r);return}}typeof fetch=="function"?fetch(t,n).then(i).catch(r):To(t,n).then(i).catch(r)},Lb=!1,DM=function(t,n,r,o){t.queryStringParams&&(n=Dp(n,t.queryStringParams));var i=Mb({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(i["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),r&&(i["Content-Type"]="application/json");var s=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,a=Mb({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:i},Lb?{}:s),c=typeof t.alternateFetch=="function"&&t.alternateFetch.length>=1?t.alternateFetch:void 0;try{Db(n,a,o,c)}catch(u){if(!s||Object.keys(s).length===0||!u.message||u.message.indexOf("not implemented")<0)return o(u);try{Object.keys(s).forEach(function(d){delete a[d]}),Db(n,a,o,c),Lb=!0}catch(d){o(d)}}},LM=function(t,n,r,o){r&&Ui(r)==="object"&&(r=Dp("",r).slice(1)),t.queryStringParams&&(n=Dp(n,t.queryStringParams));try{var i;pc?i=new pc:i=new $l("MSXML2.XMLHTTP.3.0"),i.open(r?"POST":"GET",n,1),t.crossDomain||i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.withCredentials=!!t.withCredentials,r&&i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.overrideMimeType&&i.overrideMimeType("application/json");var s=t.customHeaders;if(s=typeof s=="function"?s():s,s)for(var a in s)i.setRequestHeader(a,s[a]);i.onreadystatechange=function(){i.readyState>3&&o(i.status>=400?i.statusText:null,{status:i.status,data:i.responseText})},i.send(r)}catch(c){console&&console.log(c)}},FM=function(t,n,r,o){if(typeof r=="function"&&(o=r,r=void 0),o=o||function(){},To&&n.indexOf("file:")!==0)return DM(t,n,r,o);if(kb()||typeof ActiveXObject=="function")return LM(t,n,r,o);o(new Error("No fetch and no xhr implementation found!"))};function qs(e){"@babel/helpers - typeof";return qs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qs(e)}function Fb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Lp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Fb(Object(n),!0).forEach(function(r){jb(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fb(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function jM(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VM(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Vb(r.key),r)}}function UM(e,t,n){return t&&VM(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function jb(e,t,n){return t=Vb(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vb(e){var t=HM(e,"string");return qs(t)=="symbol"?t:t+""}function HM(e,t){if(qs(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(qs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var GM=function(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",parse:function(n){return JSON.parse(n)},stringify:JSON.stringify,parsePayload:function(n,r,o){return jb({},r,o||"")},parseLoadPayload:function(n,r){},request:FM,reloadInterval:typeof window<"u"?!1:60*60*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},Ub=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};jM(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return UM(e,[{key:"init",value:function(n){var r=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=n,this.options=Lp(Lp(Lp({},GM()),this.options||{}),o),this.allOptions=i,this.services&&this.options.reloadInterval){var s=setInterval(function(){return r.reload()},this.options.reloadInterval);qs(s)==="object"&&typeof s.unref=="function"&&s.unref()}}},{key:"readMulti",value:function(n,r,o){this._readAny(n,n,r,r,o)}},{key:"read",value:function(n,r,o){this._readAny([n],n,[r],r,o)}},{key:"_readAny",value:function(n,r,o,i,s){var a=this,c=this.options.loadPath;typeof this.options.loadPath=="function"&&(c=this.options.loadPath(n,o)),c=OM(c),c.then(function(u){if(!u)return s(null,{});var d=a.services.interpolator.interpolate(u,{lng:n.join("+"),ns:o.join("+")});a.loadUrl(d,s,r,i)})}},{key:"loadUrl",value:function(n,r,o,i){var s=this,a=typeof o=="string"?[o]:o,c=typeof i=="string"?[i]:i,u=this.options.parseLoadPayload(a,c);this.options.request(this.options,n,u,function(d,h){if(h&&(h.status>=500&&h.status<600||!h.status))return r("failed loading "+n+"; status code: "+h.status,!0);if(h&&h.status>=400&&h.status<500)return r("failed loading "+n+"; status code: "+h.status,!1);if(!h&&d&&d.message&&d.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+d.message,!0);if(d)return r(d,!1);var f,p;try{typeof h.data=="string"?f=s.options.parse(h.data,o,i):f=h.data}catch{p="failed parsing "+n+" to json"}if(p)return r(p,!1);r(null,f)})}},{key:"create",value:function(n,r,o,i,s){var a=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var c=this.options.parsePayload(r,o,i),u=0,d=[],h=[];n.forEach(function(f){var p=a.options.addPath;typeof a.options.addPath=="function"&&(p=a.options.addPath(f,r));var l=a.services.interpolator.interpolate(p,{lng:f,ns:r});a.options.request(a.options,l,c,function(m,y){u+=1,d.push(m),h.push(y),u===n.length&&typeof s=="function"&&s(d,h)})})}}},{key:"reload",value:function(){var n=this,r=this.services,o=r.backendConnector,i=r.languageUtils,s=r.logger,a=o.language;if(!(a&&a.toLowerCase()==="cimode")){var c=[],u=function(h){var f=i.toResolveHierarchy(h);f.forEach(function(p){c.indexOf(p)<0&&c.push(p)})};u(a),this.allOptions.preload&&this.allOptions.preload.forEach(function(d){return u(d)}),c.forEach(function(d){n.allOptions.ns.forEach(function(h){o.read(d,h,"read",null,null,function(f,p){f&&s.warn("loading namespace ".concat(h," for language ").concat(d," failed"),f),!f&&p&&s.log("loaded namespace ".concat(h," for language ").concat(d),p),o.loaded("".concat(d,"|").concat(h),f,p)})})})}}}])}();Ub.type="backend";const{slice:qM,forEach:$M}=[];function WM(e){return $M.call(qM.call(arguments,1),t=>{if(t)for(const n in t)e[n]===void 0&&(e[n]=t[n])}),e}const Hb=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,YM=(e,t,n)=>{const r=n||{};r.path=r.path||"/";const o=encodeURIComponent(t);let i=`${e}=${o}`;if(r.maxAge>0){const s=r.maxAge-0;if(Number.isNaN(s))throw new Error("maxAge should be a Number");i+=`; Max-Age=${Math.floor(s)}`}if(r.domain){if(!Hb.test(r.domain))throw new TypeError("option domain is invalid");i+=`; Domain=${r.domain}`}if(r.path){if(!Hb.test(r.path))throw new TypeError("option path is invalid");i+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");i+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i},Gb={create(e,t,n,r){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+n*60*1e3)),r&&(o.domain=r),document.cookie=YM(e,encodeURIComponent(t),o)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let o=n[r];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return o.substring(t.length,o.length)}return null},remove(e){this.create(e,"",-1)}};var zM={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return Gb.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:o,cookieOptions:i}=t;n&&typeof document<"u"&&Gb.create(n,e,r,o,i)}},KM={name:"querystring",lookup(e){var r;let{lookupQuerystring:t}=e,n;if(typeof window<"u"){let{search:o}=window.location;!window.location.search&&((r=window.location.hash)==null?void 0:r.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const s=o.substring(1).split("&");for(let a=0;a<s.length;a++){const c=s[a].indexOf("=");c>0&&s[a].substring(0,c)===t&&(n=s[a].substring(c+1))}}return n}};let mc=null;const qb=()=>{if(mc!==null)return mc;try{mc=window!=="undefined"&&window.localStorage!==null;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{mc=!1}return mc};var XM={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&qb())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&qb()&&window.localStorage.setItem(n,e)}};let gc=null;const $b=()=>{if(gc!==null)return gc;try{gc=window!=="undefined"&&window.sessionStorage!==null;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{gc=!1}return gc};var QM={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&$b())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&$b()&&window.sessionStorage.setItem(n,e)}},JM={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:o}=navigator;if(n)for(let i=0;i<n.length;i++)t.push(n[i]);r&&t.push(r),o&&t.push(o)}return t.length>0?t:void 0}},ZM={name:"htmlTag",lookup(e){let{htmlTag:t}=e,n;const r=t||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},eD={name:"path",lookup(e){var o;let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(o=n[typeof t=="number"?t:0])==null?void 0:o.replace("/",""):void 0}},tD={name:"subdomain",lookup(e){var o,i;let{lookupFromSubdomainIndex:t}=e;const n=typeof t=="number"?t+1:1,r=typeof window<"u"&&((i=(o=window.location)==null?void 0:o.hostname)==null?void 0:i.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(r)return r[n]}};function nD(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e}}class Wb{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t||{languageUtils:{}},this.options=WM(n,this.options||{},nD()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(zM),this.addDetector(KM),this.addDetector(XM),this.addDetector(QM),this.addDetector(JM),this.addDetector(ZM),this.addDetector(eD),this.addDetector(tD)}addDetector(t){return this.detectors[t.name]=t,this}detect(t){t||(t=this.options.order);let n=[];return t.forEach(r=>{if(this.detectors[r]){let o=this.detectors[r].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(n=n.concat(o))}}),n=n.map(r=>this.options.convertDetectedLanguage(r)),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(t,n){n||(n=this.options.caches),n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(t,this.options)}))}}Wb.type="languageDetector",ln.use(Ub).use(Wb).use(J3).init({fallbackLng:"en",lng:navigator.language&&navigator.language.substring(0,2),interpolation:{escapeValue:!1},backend:{loadPath:"https://translations.piggy.eu/portal-sessions/{{lng}}.json"}});function Yb(){const{uuid:e,portalSession:t}=He(),[n,r]=k.useState();return _r({url:`${e}/brand-kit`,onData:r}),k.useEffect(()=>{n&&ZT(n)},[n]),w.jsx(k.StrictMode,{children:w.jsxs(hh,{fallback:xM,children:[w.jsx(IT,{children:w.jsx(TM,{})}),w.jsx(wx,{enabled:t.inputData.enable_on_screen_keyboard}),w.jsx(F3,{className:"lg:top-14"})]})})}function zb(e){const{uuid:t,portalSession:n,error:r}=He();return n.uuid?w.jsx(Pw.Provider,{value:{...e,cameraService:n.inputData.camera_service,cameraFacingMode:n.inputData.facing_mode,primaryIdentificationMethod:n.inputData.primary_identification_method},children:e.children}):w.jsx(Fr,{message:r&&`No portal session found with uuid: ${t}.`})}function rD(e){const{portalSession:t}=xC(e);return t?w.jsx(rd.Provider,{value:{apiKey:e.apiKey,host:e.host},children:w.jsx(f0,{uuid:t.uuid,children:w.jsx(zb,{...e,children:w.jsx(Yb,{})})})}):w.jsx(Fr,{})}const oD="data:image/svg+xml,%3csvg%20width='24'%20height='25'%20viewBox='0%200%2024%2025'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M1.37482%209.55838C0.802045%2011.696%200.887351%2013.9567%201.61959%2016.045C2.35183%2018.1334%203.69695%2019.9524%205.47921%2021.2642C7.26146%2022.5761%209.39798%2023.3199%2011.6096%2023.3985C13.8212%2023.477%2016.0051%2022.8866%2017.876%2021.7045C19.7468%2020.5223%2021.2175%2018.8034%2022.0961%2016.7722C22.9746%2014.7411%2023.2201%2012.4921%2022.8004%2010.3193C22.3807%208.1464%2021.3154%206.15066%2019.7436%204.59277C18.1718%203.03489%2016.1667%201.98732%2013.9902%201.58693M7.14096%202.53681C5.21049%203.48732%203.60119%204.98315%202.51232%206.8391M10.7049%201.48193C10.452%201.51191%2010.2003%201.55066%209.95012%201.59811M18.1995%2015.656C18.757%2014.5927%2019.0317%2013.4039%2018.9971%2012.2038C18.9625%2011.0037%2018.6198%209.83263%2018.002%208.8032C17.3842%207.77377%2016.512%206.92055%2015.4692%206.32553C14.4264%205.73051%2013.2481%205.4137%2012.0476%205.40554C10.847%205.39739%209.66449%205.69816%208.61372%206.27895C7.56295%206.85974%206.67923%207.70104%206.04747%208.72198C5.41572%209.74292%205.05717%2010.9092%205.00628%2012.1087C4.9554%2013.3082%205.21389%2014.5007%205.75691%2015.5714M9.15764%2013.3648C9.00624%2012.9162%208.96314%2012.4382%209.03189%2011.9698C9.10064%2011.5014%209.27926%2011.0559%209.55317%2010.6697C9.82708%2010.2836%2010.1885%209.96774%2010.6079%209.74803C11.0272%209.52832%2011.4926%209.41098%2011.966%209.4056C12.4394%209.40023%2012.9074%209.50697%2013.3316%209.71709C13.7559%209.92722%2014.1244%2010.2348%2014.407%2010.6146C14.6896%2010.9944%2014.8783%2011.4358%2014.9576%2011.9025C15.037%2012.3692%2015.0048%2012.8481%2014.8636%2013.3M14.0993%2010.2622C14.0043%2010.1691%2013.9032%2010.0825%2013.7967%2010.0028M8.2478%2018.3147C9.32147%2018.9965%2010.5606%2019.3728%2011.832%2019.4033C13.1035%2019.4339%2014.3592%2019.1174%2015.4644%2018.488'%20stroke='%233430FF'%20stroke-width='2'%20stroke-linecap='round'/%3e%3c/svg%3e";function iD({message:e}){return w.jsxs("div",{className:"flex h-screen flex-col justify-center gap-12 text-center",children:[w.jsxs("div",{className:"flex items-center justify-center gap-3",children:[w.jsx("img",{alt:"logo",src:oD,className:"z-10 h-16 w-16 hover:animate-spin"}),w.jsxs("p",{className:"z-10 text-7xl font-semibold tracking-wide text-gray-600",children:["Welcome to ",w.jsx("span",{className:"italic",children:"PortalSessions"})]})]}),w.jsx("p",{className:"text-core-red-500",children:e})]})}function sD({uuid:e,host:t}){return e?w.jsx(rd.Provider,{value:{host:t},children:w.jsx(f0,{uuid:e,children:w.jsx(zb,{children:w.jsx(Yb,{})})})}):w.jsx(iD,{message:"No uuid provided."})}const aD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...e},ue.createElement("path",{d:"M8 4.75V8.25M16 4.75V8.25M7.75 10.75H16.25M6.75 19.25H17.25C18.3546 19.25 19.25 18.3546 19.25 17.25V8.75C19.25 7.64543 18.3546 6.75 17.25 6.75H6.75C5.64543 6.75 4.75 7.64543 4.75 8.75V17.25C4.75 18.3546 5.64543 19.25 6.75 19.25Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),cD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",...e},ue.createElement("path",{d:"m21.25 7.5c.3796958 0 .693491.28215388.7431534.64822944l.0068466.10177056v8.5c0 1.7330315-1.3564548 3.1492459-3.0655761 3.2448552l-.1844239.0051448h-12.689l.71933009.7196699c.26626656.2662666.29047261.6829303.07261815.9765418l-.07261815.0841184c-.26626657.2662665-.68293025.2904726-.97654174.0726181l-.08411844-.0726181-2-2-.06339799-.0720275c-.00244939-.0031685-.00487398-.0063571-.00727348-.0095656l.07067147.0815931c-.03705327-.0370533-.06941902-.077019-.09709724-.1191603-.01316484-.0201549-.025545-.0411423-.03690171-.0627516-.00483354-.0091218-.00919014-.0178526-.01336588-.0266478-.01274712-.0267885-.02425172-.0552483-.03400215-.0845099-.00225837-.0069437-.00418282-.0130149-.00602813-.019105-.02092163-.0684786-.0322748-.1419912-.0322748-.2181555 0-.0383922.00288471-.0761107.00844919-.1129505.00180466-.0115676.0038603-.0232773.00619514-.0349422.00494363-.0250031.01111685-.0492994.01844184-.073091.00362656-.0116598.00765847-.0237092.01200456-.0356703.00848426-.0232976.01778613-.0453662.02808241-.0668678.00549219-.0116011.01179514-.0239381.01846187-.0361292.01323523-.0240158.02734042-.0467392.04258121-.0686124.00392129-.0057417.00832657-.0118713.01283554-.0179483.0251194-.0332177.04801831-.0595185.07261815-.0841184l2-2c.29289322-.2928932.76776696-.2928932 1.06066018 0 .26626656.2662666.29047261.6829303.07261815.9765418l-.07261815.0841184-.72033009.7196699h12.69c.9181734 0 1.6711923-.7071103 1.7441988-1.6064728l.0058012-.1435272v-8.5c0-.41421356.3357864-.75.75-.75zm-3.0537883-5.35294824.0841184.07261815 2 2c.0254481.02544812.049076.05271652.0706715.08159313l-.0706715-.08159313c.0370533.03705328.069419.07701901.0970972.1191603.0131649.02015493.025545.04114226.0369017.06275154.0048336.00912187.0091902.01785262.0133659.02664784.0127471.02678853.0242517.0552483.0340022.08450994.0022583.00694369.0041828.01301489.0060281.01910493.0209216.06847868.0322748.14199127.0322748.21815554 0 .03839224-.0028847.07611073-.0084492.11295053-.0014988.0095454-.0031606.01924362-.0050138.02891241-.0051364.02710922-.0117072.05340972-.0196232.07912072-.0036265.0116598-.0076584.02370928-.0120045.03567032-.0084843.02329763-.0177862.04536621-.0280824.06686781-.0054922.01160108-.0117952.02393815-.0184619.03612923-.0132352.02401575-.0273404.04673917-.0425812.06861233-.0039213.00574174-.0083266.01187138-.0128356.0179483-.023778.03144192-.0451015.05615345-.0679264.07938506l-.0046917.00473338-2 2c-.2928932.29289321-.767767.29289321-1.0606602 0-.2662665-.26626657-.2904726-.68293025-.0726181-.97654174l.0726181-.08411844.7183301-.71966991h-12.688c-.9181734 0-1.67119234.70711027-1.7441988 1.60647279l-.0058012.14352721v8.5c0 .4142136-.33578644.75-.75.75-.37969577 0-.69349096-.2821539-.74315338-.6482294l-.00684662-.1017706v-8.5c0-1.73303146 1.35645477-3.14924593 3.06557609-3.24485521l.18442391-.00514479h12.689l-.7193301-.71966991c-.2662665-.26626657-.2904726-.68293025-.0726181-.97654174l.0726181-.08411844c.2662666-.26626656.6829303-.29047261.9765418-.07261815zm-6.1962117 5.85294824c2.209139 0 4 1.790861 4 4s-1.790861 4-4 4-4-1.790861-4-4 1.790861-4 4-4zm0 1.5c-1.3807119 0-2.5 1.1192881-2.5 2.5s1.1192881 2.5 2.5 2.5 2.5-1.1192881 2.5-2.5-1.1192881-2.5-2.5-2.5z",fill:"#212121"}))},Symbol.toStringTag,{value:"Module"})),uD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...e},ue.createElement("path",{d:"M13.25 8.75L9.75 12L13.25 15.25",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),lD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},ue.createElement("path",{d:"M17.25 6.75L6.75 17.25M6.75 6.75L17.25 17.25",strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),dD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ue.createElement("path",{d:"M4.7002 4.70016L11.2999 11.2998",stroke:"#000",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"}),ue.createElement("path",{d:"M11.2998 4.70016L4.70014 11.2998",stroke:"#000",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),fD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:24,height:24,fill:"none",viewBox:"0 0 24 24",...e},ue.createElement("circle",{cx:12,cy:12,r:7.25,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5}),ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M14.25 8.75H11.375C10.4775 8.75 9.75 9.47754 9.75 10.375V10.375C9.75 11.2725 10.4775 12 11.375 12H12.625C13.5225 12 14.25 12.7275 14.25 13.625V13.625C14.25 14.5225 13.5225 15.25 12.625 15.25H9.75"}),ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 7.75V8.25"}),ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 15.75V16.25"}))},Symbol.toStringTag,{value:"Module"})),hD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},ue.createElement("path",{d:"M19.25 19.25H13.75M9 18.25L4.75 19.25L5.75 15L15.0429 5.70711C15.4334 5.31658 16.0666 5.31658 16.4571 5.70711L18.2929 7.54289C18.6834 7.93342 18.6834 8.56658 18.2929 8.95711L9 18.25Z",strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),pD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...e},ue.createElement("path",{d:"M6.75024 19.2502H17.2502C18.3548 19.2502 19.2502 18.3548 19.2502 17.2502V9.75025L12.0002 4.75024L4.75024 9.75025V17.2502C4.75024 18.3548 5.64568 19.2502 6.75024 19.2502Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),ue.createElement("path",{d:"M9.74963 15.7493C9.74963 14.6447 10.6451 13.7493 11.7496 13.7493H12.2496C13.3542 13.7493 14.2496 14.6447 14.2496 15.7493V19.2493H9.74963V15.7493Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),mD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 13V15"}),ue.createElement("circle",{cx:12,cy:9,r:.5}),ue.createElement("circle",{cx:12,cy:12,r:7.25,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5}))},Symbol.toStringTag,{value:"Module"})),gD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},ue.createElement("path",{d:"M5.5 6.5L12 12.25L18.5 6.5M6.75 18.25H17.25C18.3546 18.25 19.25 17.3546 19.25 16.25V7.75C19.25 6.64543 18.3546 5.75 17.25 5.75H6.75C5.64543 5.75 4.75 6.64543 4.75 7.75V16.25C4.75 17.3546 5.64543 18.25 6.75 18.25Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),yD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ue.createElement("g",{clipPath:"url(#clip0_17_95)"},ue.createElement("rect",{width:32,height:32,rx:4,fill:"#FEF3F2"}),ue.createElement("path",{d:"M12.0003 12L20.0003 20M12.0003 20L20.0003 12",stroke:"#E02731",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),ue.createElement("defs",null,ue.createElement("clipPath",{id:"clip0_17_95"},ue.createElement("path",{d:"M0 16C0 7.16344 7.16344 0 16 0V0C24.8366 0 32 7.16344 32 16V16C32 24.8366 24.8366 32 16 32V32C7.16344 32 0 24.8366 0 16V16Z",fill:"white"}))))},Symbol.toStringTag,{value:"Module"})),vD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ue.createElement("g",{clipPath:"url(#clip0_15_20)"},ue.createElement("rect",{width:32,height:32,rx:4,fill:"#E7FBF4"}),ue.createElement("path",{d:"M10.6668 17.3333L14.6668 20L21.3335 12",stroke:"#039855",strokeWidth:1.6875,strokeLinecap:"round",strokeLinejoin:"round"})),ue.createElement("defs",null,ue.createElement("clipPath",{id:"clip0_15_20"},ue.createElement("path",{d:"M0 16C0 7.16344 7.16344 0 16 0V0C24.8366 0 32 7.16344 32 16V16C32 24.8366 24.8366 32 16 32V32C7.16344 32 0 24.8366 0 16V16Z",fill:"white"}))))},Symbol.toStringTag,{value:"Module"})),wD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ue.createElement("g",{clipPath:"url(#clip0_17_99)"},ue.createElement("rect",{width:32,height:32,rx:4,fill:"#FFFAEB"}),ue.createElement("path",{d:"M16.0002 17.3333V13.3333M16.0002 20V20.0067M23.0353 19.3333L17.942 10.456C17.0833 8.95867 14.9167 8.95867 14.058 10.456L8.96533 19.3333C8.11266 20.8187 9.18933 22.6667 10.9073 22.6667H21.0933C22.8107 22.6667 23.8873 20.8187 23.0353 19.3333Z",stroke:"#CFAA25",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),ue.createElement("defs",null,ue.createElement("clipPath",{id:"clip0_17_99"},ue.createElement("path",{d:"M0 16C0 7.16344 7.16344 0 16 0C24.8366 0 32 7.16344 32 16C32 24.8366 24.8366 32 16 32C7.16344 32 0 24.8366 0 16Z",fill:"white"}))))},Symbol.toStringTag,{value:"Module"})),bD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...e},ue.createElement("path",{d:"M13.1191 5.61336C13.0508 5.11856 12.6279 4.75 12.1285 4.75H11.8715C11.3721 4.75 10.9492 5.11856 10.8809 5.61336L10.7938 6.24511C10.7382 6.64815 10.4403 6.96897 10.0622 7.11922C10.006 7.14156 9.95021 7.16484 9.89497 7.18905C9.52217 7.3524 9.08438 7.3384 8.75876 7.09419L8.45119 6.86351C8.05307 6.56492 7.49597 6.60451 7.14408 6.9564L6.95641 7.14408C6.60452 7.49597 6.56492 8.05306 6.86351 8.45118L7.09419 8.75876C7.33841 9.08437 7.3524 9.52216 7.18905 9.89497C7.16484 9.95021 7.14156 10.006 7.11922 10.0622C6.96897 10.4403 6.64815 10.7382 6.24511 10.7938L5.61336 10.8809C5.11856 10.9492 4.75 11.372 4.75 11.8715V12.1285C4.75 12.6279 5.11856 13.0508 5.61336 13.1191L6.24511 13.2062C6.64815 13.2618 6.96897 13.5597 7.11922 13.9378C7.14156 13.994 7.16484 14.0498 7.18905 14.105C7.3524 14.4778 7.3384 14.9156 7.09419 15.2412L6.86351 15.5488C6.56492 15.9469 6.60451 16.504 6.9564 16.8559L7.14408 17.0436C7.49597 17.3955 8.05306 17.4351 8.45118 17.1365L8.75876 16.9058C9.08437 16.6616 9.52216 16.6476 9.89496 16.811C9.95021 16.8352 10.006 16.8584 10.0622 16.8808C10.4403 17.031 10.7382 17.3519 10.7938 17.7549L10.8809 18.3866C10.9492 18.8814 11.3721 19.25 11.8715 19.25H12.1285C12.6279 19.25 13.0508 18.8814 13.1191 18.3866L13.2062 17.7549C13.2618 17.3519 13.5597 17.031 13.9378 16.8808C13.994 16.8584 14.0498 16.8352 14.105 16.8109C14.4778 16.6476 14.9156 16.6616 15.2412 16.9058L15.5488 17.1365C15.9469 17.4351 16.504 17.3955 16.8559 17.0436L17.0436 16.8559C17.3955 16.504 17.4351 15.9469 17.1365 15.5488L16.9058 15.2412C16.6616 14.9156 16.6476 14.4778 16.811 14.105C16.8352 14.0498 16.8584 13.994 16.8808 13.9378C17.031 13.5597 17.3519 13.2618 17.7549 13.2062L18.3866 13.1191C18.8814 13.0508 19.25 12.6279 19.25 12.1285V11.8715C19.25 11.3721 18.8814 10.9492 18.3866 10.8809L17.7549 10.7938C17.3519 10.7382 17.031 10.4403 16.8808 10.0622C16.8584 10.006 16.8352 9.95021 16.8109 9.89496C16.6476 9.52216 16.6616 9.08437 16.9058 8.75875L17.1365 8.4512C17.4351 8.05308 17.3955 7.49599 17.0436 7.1441L16.8559 6.95642C16.504 6.60453 15.9469 6.56494 15.5488 6.86353L15.2412 7.09419C14.9156 7.33841 14.4778 7.3524 14.105 7.18905C14.0498 7.16484 13.994 7.14156 13.9378 7.11922C13.5597 6.96897 13.2618 6.64815 13.2062 6.24511L13.1191 5.61336Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),ue.createElement("path",{d:"M13.25 12C13.25 12.6904 12.6904 13.25 12 13.25C11.3096 13.25 10.75 12.6904 10.75 12C10.75 11.3096 11.3096 10.75 12 10.75C12.6904 10.75 13.25 11.3096 13.25 12Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),ED=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:24,height:24,fill:"none",viewBox:"0 0 24 24",...e},ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M18.25 7.75H5.75V16.75L4.75 19.25H19.25L18.25 16.75V7.75Z"}),ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M18.25 7.75L16.25 4.75H7.75L5.75 7.75"}),ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 10.75V11.75C9.75 12.9926 10.7574 14 12 14V14C13.2426 14 14.25 12.9926 14.25 11.75V10.75"}))},Symbol.toStringTag,{value:"Module"})),CD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:24,height:24,fill:"none",viewBox:"0 0 24 24",...e},ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 4.75L13.75 10.25H19.25L14.75 13.75L16.25 19.25L12 15.75L7.75 19.25L9.25 13.75L4.75 10.25H10.25L12 4.75Z"}))},Symbol.toStringTag,{value:"Module"})),_D=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",...e},ue.createElement("path",{d:"M15.25 8C15.25 9.79493 13.7949 11.25 12 11.25C10.205 11.25 8.74997 9.79493 8.74997 8C8.74997 6.20507 10.205 4.75 12 4.75C13.7949 4.75 15.25 6.20507 15.25 8Z"}),ue.createElement("path",{d:"M6.84748 19.25H17.1525C18.2944 19.25 19.174 18.2681 18.6407 17.2584C17.8563 15.7731 16.068 14 12 14C7.93198 14 6.14364 15.7731 5.35921 17.2584C4.82594 18.2681 5.70556 19.25 6.84748 19.25Z"}))},Symbol.toStringTag,{value:"Module"})),SD=Object.freeze(Object.defineProperty({__proto__:null,createWorker:()=>new Worker(URL.createObjectURL(new Blob([`class x{constructor(a,b){this.width=b;this.height=a.length/b;this.data=a}static createEmpty(a,b){return new x(new Uint8ClampedArray(a*b),a)}get(a,b){return 0>a||a>=this.width||0>b||b>=this.height?!1:!!this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c?1:0}setRegion(a,b,c,d,e){for(let f=b;f<b+d;f++)for(let g=a;g<a+c;g++)this.set(g,f,!!e)}}
|
|
159
159
|
class A{constructor(a,b,c){this.width=a;a*=b;if(c&&c.length!==a)throw Error("Wrong buffer size");this.data=c||new Uint8ClampedArray(a)}get(a,b){return this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c}}
|
|
160
160
|
class ba{constructor(a){this.bitOffset=this.byteOffset=0;this.bytes=a}readBits(a){if(1>a||32<a||a>this.available())throw Error("Cannot read "+a.toString()+" bits");var b=0;if(0<this.bitOffset){b=8-this.bitOffset;var c=a<b?a:b;b-=c;b=(this.bytes[this.byteOffset]&255>>8-c<<b)>>b;a-=c;this.bitOffset+=c;8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(0<a){for(;8<=a;)b=b<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,a-=8;0<a&&(c=8-a,b=b<<a|(this.bytes[this.byteOffset]&255>>c<<c)>>c,
|