cap-hydra-web-sdk 1.1.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).WebSDK=n()}(this,function(){"use strict";var t="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||"undefined"!=typeof global&&global||{},n="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),e="FormData"in t,s="ArrayBuffer"in t;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function a(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function c(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var n={next:function(){var n=t.shift();return{done:void 0===n,value:n}}};return r&&(n[Symbol.iterator]=function(){return n}),n}function h(t){this.map={},t instanceof h?t.forEach(function(t,n){this.append(n,t)},this):Array.isArray(t)?t.forEach(function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(n){this.append(n,t[n])},this)}function d(t){if(!t.t)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function v(t){return new Promise(function(n,r){t.onload=function(){n(t.result)},t.onerror=function(){r(t.error)}})}function l(t){var n=new FileReader,r=v(n);return n.readAsArrayBuffer(t),r}function g(t){if(t.slice)return t.slice(0);var n=new Uint8Array(t.byteLength);return n.set(new Uint8Array(t)),n.buffer}function w(){return this.bodyUsed=!1,this.i=function(t){var r;this.bodyUsed=this.bodyUsed,this.u=t,t?"string"==typeof t?this.o=t:i&&Blob.prototype.isPrototypeOf(t)?this.h=t:e&&FormData.prototype.isPrototypeOf(t)?this.v=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this.o=t.toString():s&&i&&((r=t)&&DataView.prototype.isPrototypeOf(r))?(this.l=g(t.buffer),this.u=new Blob([this.l])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||o(t))?this.l=g(t):this.o=t=Object.prototype.toString.call(t):(this.t=!0,this.o=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this.h&&this.h.type?this.headers.set("content-type",this.h.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=d(this);if(t)return t;if(this.h)return Promise.resolve(this.h);if(this.l)return Promise.resolve(new Blob([this.l]));if(this.v)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this.o]))}),this.arrayBuffer=function(){if(this.l){var t=d(this);return t||(ArrayBuffer.isView(this.l)?Promise.resolve(this.l.buffer.slice(this.l.byteOffset,this.l.byteOffset+this.l.byteLength)):Promise.resolve(this.l))}if(i)return this.blob().then(l);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,n,r,i,e,s=d(this);if(s)return s;if(this.h)return t=this.h,n=new FileReader,r=v(n),i=/charset=([A-Za-z0-9_-]+)/.exec(t.type),e=i?i[1]:"utf-8",n.readAsText(t,e),r;if(this.l)return Promise.resolve(function(t){for(var n=new Uint8Array(t),r=new Array(n.length),i=0;i<n.length;i++)r[i]=String.fromCharCode(n[i]);return r.join("")}(this.l));if(this.v)throw new Error("could not read FormData body as text");return Promise.resolve(this.o)},e&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,n){t=a(t),n=c(n);var r=this.map[t];this.map[t]=r?r+", "+n:n},h.prototype.delete=function(t){delete this.map[a(t)]},h.prototype.get=function(t){return t=a(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(a(t))},h.prototype.set=function(t,n){this.map[a(t)]=c(n)},h.prototype.forEach=function(t,n){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(n,this.map[r],r,this)},h.prototype.keys=function(){var t=[];return this.forEach(function(n,r){t.push(r)}),f(t)},h.prototype.values=function(){var t=[];return this.forEach(function(n){t.push(n)}),f(t)},h.prototype.entries=function(){var t=[];return this.forEach(function(n,r){t.push([r,n])}),f(t)},r&&(h.prototype[Symbol.iterator]=h.prototype.entries);var m=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function p(n,r){if(!(this instanceof p))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var i,e,s=(r=r||{}).body;if(n instanceof p){if(n.bodyUsed)throw new TypeError("Already read");this.url=n.url,this.credentials=n.credentials,r.headers||(this.headers=new h(n.headers)),this.method=n.method,this.mode=n.mode,this.signal=n.signal,s||null==n.u||(s=n.u,n.bodyUsed=!0)}else this.url=String(n);if(this.credentials=r.credentials||this.credentials||"same-origin",!r.headers&&this.headers||(this.headers=new h(r.headers)),this.method=(i=r.method||this.method||"GET",e=i.toUpperCase(),m.indexOf(e)>-1?e:i),this.mode=r.mode||this.mode||null,this.signal=r.signal||this.signal||function(){if("AbortController"in t)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");if(this.i(s),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==r.cache&&"no-cache"!==r.cache)){var u=/([?&])_=[^&]*/;if(u.test(this.url))this.url=this.url.replace(u,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function y(t){var n=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),e=r.join("=").replace(/\+/g," ");n.append(decodeURIComponent(i),decodeURIComponent(e))}}),n}function b(t,n){if(!(this instanceof b))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(n||(n={}),this.type="default",this.status=void 0===n.status?200:n.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===n.statusText?"":""+n.statusText,this.headers=new h(n.headers),this.url=n.url||"",this.i(t)}p.prototype.clone=function(){return new p(this,{body:this.u})},w.call(p.prototype),w.call(b.prototype),b.prototype.clone=function(){return new b(this.u,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var E=[301,302,303,307,308];b.redirect=function(t,n){if(-1===E.indexOf(n))throw new RangeError("Invalid status code");return new b(null,{status:n,headers:{location:t}})};var I=t.DOMException;try{new I}catch(t){(I=function(t,n){this.message=t,this.name=n;var r=Error(t);this.stack=r.stack}).prototype=Object.create(Error.prototype),I.prototype.constructor=I}function S(n,r){return new Promise(function(e,u){var o=new p(n,r);if(o.signal&&o.signal.aborted)return u(new I("Aborted","AbortError"));var f=new XMLHttpRequest;function d(){f.abort()}if(f.onload=function(){var t,n,r={statusText:f.statusText,headers:(t=f.getAllResponseHeaders()||"",n=new h,t.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t}).forEach(function(t){var r=t.split(":"),i=r.shift().trim();if(i){var e=r.join(":").trim();try{n.append(i,e)}catch(t){console.warn("Response "+t.message)}}}),n)};0===o.url.indexOf("file://")&&(f.status<200||f.status>599)?r.status=200:r.status=f.status,r.url="responseURL"in f?f.responseURL:r.headers.get("X-Request-URL");var i="response"in f?f.response:f.responseText;setTimeout(function(){e(new b(i,r))},0)},f.onerror=function(){setTimeout(function(){u(new TypeError("Network request failed"))},0)},f.ontimeout=function(){setTimeout(function(){u(new TypeError("Network request timed out"))},0)},f.onabort=function(){setTimeout(function(){u(new I("Aborted","AbortError"))},0)},f.open(o.method,function(n){try{return""===n&&t.location.href?t.location.href:n}catch(t){return n}}(o.url),!0),"include"===o.credentials?f.withCredentials=!0:"omit"===o.credentials&&(f.withCredentials=!1),"responseType"in f&&(i?f.responseType="blob":s&&(f.responseType="arraybuffer")),r&&"object"==typeof r.headers&&!(r.headers instanceof h||t.Headers&&r.headers instanceof t.Headers)){var v=[];Object.getOwnPropertyNames(r.headers).forEach(function(t){v.push(a(t)),f.setRequestHeader(t,c(r.headers[t]))}),o.headers.forEach(function(t,n){-1===v.indexOf(n)&&f.setRequestHeader(n,t)})}else o.headers.forEach(function(t,n){f.setRequestHeader(n,t)});o.signal&&(o.signal.addEventListener("abort",d),f.onreadystatechange=function(){4===f.readyState&&o.signal.removeEventListener("abort",d)}),f.send(void 0===o.u?null:o.u)})}S.polyfill=!0,t.fetch||(t.fetch=S,t.Headers=h,t.Request=p,t.Response=b);var T,k,R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},A={};function _(){if(k)return T;k=1;var t=function(t){return t&&t.Math===Math&&t};return T=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof R&&R)||t("object"==typeof T&&T)||function(){return this}()||Function("return this")()}var O,C,D,N,F,P,M,x,U={};function j(){return C?O:(C=1,O=function(t){try{return!!t()}catch(t){return!0}})}function V(){if(N)return D;N=1;var t=j();return D=!t(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}function L(){if(P)return F;P=1;var t=j();return F=!t(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})}function z(){if(x)return M;x=1;var t=L(),n=Function.prototype.call;return M=t?n.bind(n):function(){return n.apply(n,arguments)},M}var B,G,W,q,H,K,X,$,Q,J,Y,Z,tt,nt,rt,it,et,st,ut,ot,at,ct,ft,ht,dt,vt,lt,gt,wt,mt,pt,yt,bt,Et,It,St,Tt,kt,Rt,At,_t,Ot={};function Ct(){if(B)return Ot;B=1;var t={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!t.call({1:2},1);return Ot.f=r?function(t){var r=n(this,t);return!!r&&r.enumerable}:t,Ot}function Dt(){return W?G:(W=1,G=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}})}function Nt(){if(H)return q;H=1;var t=L(),n=Function.prototype,r=n.call,i=t&&n.bind.bind(r,r);return q=t?i:function(t){return function(){return r.apply(t,arguments)}},q}function Ft(){if(X)return K;X=1;var t=Nt(),n=t({}.toString),r=t("".slice);return K=function(t){return r(n(t),8,-1)}}function Pt(){if(Q)return $;Q=1;var t=Nt(),n=j(),r=Ft(),i=Object,e=t("".split);return $=n(function(){return!i("z").propertyIsEnumerable(0)})?function(t){return"String"===r(t)?e(t,""):i(t)}:i}function Mt(){return Y?J:(Y=1,J=function(t){return null==t})}function xt(){if(tt)return Z;tt=1;var t=Mt(),n=TypeError;return Z=function(r){if(t(r))throw new n("Can't call method on "+r);return r}}function Ut(){if(rt)return nt;rt=1;var t=Pt(),n=xt();return nt=function(r){return t(n(r))}}function jt(){if(et)return it;et=1;var t="object"==typeof document&&document.all;return it=void 0===t&&void 0!==t?function(n){return"function"==typeof n||n===t}:function(t){return"function"==typeof t}}function Vt(){if(ut)return st;ut=1;var t=jt();return st=function(n){return"object"==typeof n?null!==n:t(n)}}function Lt(){if(at)return ot;at=1;var t=_(),n=jt();return ot=function(r,i){return arguments.length<2?(e=t[r],n(e)?e:void 0):t[r]&&t[r][i];var e},ot}function zt(){if(ft)return ct;ft=1;var t=Nt();return ct=t({}.isPrototypeOf)}function Bt(){if(dt)return ht;dt=1;var t=_().navigator,n=t&&t.userAgent;return ht=n?String(n):""}function Gt(){if(lt)return vt;lt=1;var t,n,r=_(),i=Bt(),e=r.process,s=r.Deno,u=e&&e.versions||s&&s.version,o=u&&u.v8;return o&&(n=(t=o.split("."))[0]>0&&t[0]<4?1:+(t[0]+t[1])),!n&&i&&(!(t=i.match(/Edge\/(\d+)/))||t[1]>=74)&&(t=i.match(/Chrome\/(\d+)/))&&(n=+t[1]),vt=n}function Wt(){if(wt)return gt;wt=1;var t=Gt(),n=j(),r=_().String;return gt=!!Object.getOwnPropertySymbols&&!n(function(){var n=Symbol("symbol detection");return!r(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&t&&t<41})}function qt(){if(pt)return mt;pt=1;var t=Wt();return mt=t&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function Ht(){if(bt)return yt;bt=1;var t=Lt(),n=jt(),r=zt(),i=qt(),e=Object;return yt=i?function(t){return"symbol"==typeof t}:function(i){var s=t("Symbol");return n(s)&&r(s.prototype,e(i))}}function Kt(){if(It)return Et;It=1;var t=String;return Et=function(n){try{return t(n)}catch(t){return"Object"}}}function Xt(){if(Tt)return St;Tt=1;var t=jt(),n=Kt(),r=TypeError;return St=function(i){if(t(i))return i;throw new r(n(i)+" is not a function")}}function $t(){if(Rt)return kt;Rt=1;var t=Xt(),n=Mt();return kt=function(r,i){var e=r[i];return n(e)?void 0:t(e)}}function Qt(){if(_t)return At;_t=1;var t=z(),n=jt(),r=Vt(),i=TypeError;return At=function(e,s){var u,o;if("string"===s&&n(u=e.toString)&&!r(o=t(u,e)))return o;if(n(u=e.valueOf)&&!r(o=t(u,e)))return o;if("string"!==s&&n(u=e.toString)&&!r(o=t(u,e)))return o;throw new i("Can't convert object to primitive value")}}var Jt,Yt,Zt,tn,nn,rn,en,sn,un,on,an,cn,fn,hn,dn,vn,ln,gn,wn,mn,pn,yn,bn,En,In={exports:{}};function Sn(){return Yt?Jt:(Yt=1,Jt=!1)}function Tn(){if(tn)return Zt;tn=1;var t=_(),n=Object.defineProperty;return Zt=function(r,i){try{n(t,r,{value:i,configurable:!0,writable:!0})}catch(n){t[r]=i}return i}}function kn(){if(nn)return In.exports;nn=1;var t=Sn(),n=_(),r=Tn(),i="__core-js_shared__",e=In.exports=n[i]||r(i,{});return(e.versions||(e.versions=[])).push({version:"3.49.0",mode:t?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"}),In.exports}function Rn(){if(en)return rn;en=1;var t=kn();return rn=function(n,r){return t[n]||(t[n]=r||{})}}function An(){if(un)return sn;un=1;var t=xt(),n=Object;return sn=function(r){return n(t(r))}}function _n(){if(an)return on;an=1;var t=Nt(),n=An(),r=t({}.hasOwnProperty);return on=Object.hasOwn||function(t,i){return r(n(t),i)}}function On(){if(fn)return cn;fn=1;var t=Nt(),n=0,r=Math.random(),i=t(1.1.toString);return cn=function(t){return"Symbol("+(void 0===t?"":t)+")_"+i(++n+r,36)}}function Cn(){if(dn)return hn;dn=1;var t=_(),n=Rn(),r=_n(),i=On(),e=Wt(),s=qt(),u=t.Symbol,o=n("wks"),a=s?u.for||u:u&&u.withoutSetter||i;return hn=function(t){return r(o,t)||(o[t]=e&&r(u,t)?u[t]:a("Symbol."+t)),o[t]}}function Dn(){if(ln)return vn;ln=1;var t=z(),n=Vt(),r=Ht(),i=$t(),e=Qt(),s=Cn(),u=TypeError,o=s("toPrimitive");return vn=function(s,a){if(!n(s)||r(s))return s;var c,f=i(s,o);if(f){if(void 0===a&&(a="default"),c=t(f,s,a),!n(c)||r(c))return c;throw new u("Can't convert object to primitive value")}return void 0===a&&(a="number"),e(s,a)}}function Nn(){if(wn)return gn;wn=1;var t=Dn(),n=Ht();return gn=function(r){var i=t(r,"string");return n(i)?i:i+""}}function Fn(){if(pn)return mn;pn=1;var t=_(),n=Vt(),r=t.document,i=n(r)&&n(r.createElement);return mn=function(t){return i?r.createElement(t):{}}}function Pn(){if(bn)return yn;bn=1;var t=V(),n=j(),r=Fn();return yn=!t&&!n(function(){return 7!==Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a})}function Mn(){if(En)return U;En=1;var t=V(),n=z(),r=Ct(),i=Dt(),e=Ut(),s=Nn(),u=_n(),o=Pn(),a=Object.getOwnPropertyDescriptor;return U.f=t?a:function(t,c){if(t=e(t),c=s(c),o)try{return a(t,c)}catch(t){}if(u(t,c))return i(!n(r.f,t,c),t[c])},U}var xn,Un,jn,Vn,Ln,zn,Bn,Gn={};function Wn(){if(Un)return xn;Un=1;var t=V(),n=j();return xn=t&&n(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}function qn(){if(Vn)return jn;Vn=1;var t=Vt(),n=String,r=TypeError;return jn=function(i){if(t(i))return i;throw new r(n(i)+" is not an object")}}function Hn(){if(Ln)return Gn;Ln=1;var t=V(),n=Pn(),r=Wn(),i=qn(),e=Nn(),s=TypeError,u=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a="enumerable",c="configurable",f="writable";return Gn.f=t?r?function(t,n,r){if(i(t),n=e(n),i(r),"function"==typeof t&&"prototype"===n&&"value"in r&&f in r&&!r[f]){var s=o(t,n);s&&s[f]&&(t[n]=r.value,r={configurable:c in r?r[c]:s[c],enumerable:a in r?r[a]:s[a],writable:!1})}return u(t,n,r)}:u:function(t,r,o){if(i(t),r=e(r),i(o),n)try{return u(t,r,o)}catch(t){}if("get"in o||"set"in o)throw new s("Accessors not supported");return"value"in o&&(t[r]=o.value),t},Gn}function Kn(){if(Bn)return zn;Bn=1;var t=V(),n=Hn(),r=Dt();return zn=t?function(t,i,e){return n.f(t,i,r(1,e))}:function(t,n,r){return t[n]=r,t}}var Xn,$n,Qn,Jn,Yn,Zn,tr,nr,rr,ir,er,sr,ur,or,ar,cr={exports:{}};function fr(){if($n)return Xn;$n=1;var t=V(),n=_n(),r=Function.prototype,i=t&&Object.getOwnPropertyDescriptor,e=n(r,"name"),s=e&&"something"===function(){}.name,u=e&&(!t||t&&i(r,"name").configurable);return Xn={EXISTS:e,PROPER:s,CONFIGURABLE:u}}function hr(){if(Jn)return Qn;Jn=1;var t=Nt(),n=jt(),r=kn(),i=t(Function.toString);return n(r.inspectSource)||(r.inspectSource=function(t){return i(t)}),Qn=r.inspectSource}function dr(){if(nr)return tr;nr=1;var t=Rn(),n=On(),r=t("keys");return tr=function(t){return r[t]||(r[t]=n(t))}}function vr(){return ir?rr:(ir=1,rr={})}function lr(){if(sr)return er;sr=1;var t,n,r,i=function(){if(Zn)return Yn;Zn=1;var t=_(),n=jt(),r=t.WeakMap;return Yn=n(r)&&/native code/.test(String(r))}(),e=_(),s=Vt(),u=Kn(),o=_n(),a=kn(),c=dr(),f=vr(),h="Object already initialized",d=e.TypeError,v=e.WeakMap;if(i||a.state){var l=a.state||(a.state=new v);l.get=l.get,l.has=l.has,l.set=l.set,t=function(t,n){if(l.has(t))throw new d(h);return n.facade=t,l.set(t,n),n},n=function(t){return l.get(t)||{}},r=function(t){return l.has(t)}}else{var g=c("state");f[g]=!0,t=function(t,n){if(o(t,g))throw new d(h);return n.facade=t,u(t,g,n),n},n=function(t){return o(t,g)?t[g]:{}},r=function(t){return o(t,g)}}return er={set:t,get:n,has:r,enforce:function(i){return r(i)?n(i):t(i,{})},getterFor:function(t){return function(r){var i;if(!s(r)||(i=n(r)).type!==t)throw new d("Incompatible receiver, "+t+" required");return i}}}}function gr(){if(ur)return cr.exports;ur=1;var t=Nt(),n=j(),r=jt(),i=_n(),e=V(),s=fr().CONFIGURABLE,u=hr(),o=lr(),a=o.enforce,c=o.get,f=String,h=Object.defineProperty,d=t("".slice),v=t("".replace),l=t([].join),g=e&&!n(function(){return 8!==h(function(){},"length",{value:8}).length}),w=String(String).split("String"),m=cr.exports=function(t,n,r){"Symbol("===d(f(n),0,7)&&(n="["+v(f(n),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(n="get "+n),r&&r.setter&&(n="set "+n),(!i(t,"name")||s&&t.name!==n)&&(e?h(t,"name",{value:n,configurable:!0}):t.name=n),g&&r&&i(r,"arity")&&t.length!==r.arity&&h(t,"length",{value:r.arity});try{r&&i(r,"constructor")&&r.constructor?e&&h(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var u=a(t);return i(u,"source")||(u.source=l(w,"string"==typeof n?n:"")),t};return Function.prototype.toString=m(function(){return r(this)&&c(this).source||u(this)},"toString"),cr.exports}function wr(){if(ar)return or;ar=1;var t=jt(),n=Hn(),r=gr(),i=Tn();return or=function(e,s,u,o){o||(o={});var a=o.enumerable,c=void 0!==o.name?o.name:s;if(t(u)&&r(u,c,o),o.global)a?e[s]=u:i(s,u);else{try{o.unsafe?e[s]&&(a=!0):delete e[s]}catch(t){}a?e[s]=u:n.f(e,s,{value:u,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e}}var mr,pr,yr,br,Er,Ir,Sr,Tr,kr,Rr,Ar,_r,Or,Cr,Dr,Nr,Fr,Pr={};function Mr(){if(br)return yr;br=1;var t=function(){if(pr)return mr;pr=1;var t=Math.ceil,n=Math.floor;return mr=Math.trunc||function(r){var i=+r;return(i>0?n:t)(i)}}();return yr=function(n){var r=+n;return r!=r||0===r?0:t(r)}}function xr(){if(Ir)return Er;Ir=1;var t=Mr(),n=Math.max,r=Math.min;return Er=function(i,e){var s=t(i);return s<0?n(s+e,0):r(s,e)}}function Ur(){if(Tr)return Sr;Tr=1;var t=Mr(),n=Math.min;return Sr=function(r){var i=t(r);return i>0?n(i,9007199254740991):0}}function jr(){if(Rr)return kr;Rr=1;var t=Ur();return kr=function(n){return t(n.length)}}function Vr(){if(_r)return Ar;_r=1;var t=Ut(),n=xr(),r=jr(),i=function(i){return function(e,s,u){var o=t(e),a=r(o);if(0===a)return!i&&-1;var c,f=n(u,a);if(i&&s!=s){for(;a>f;)if((c=o[f++])!=c)return!0}else for(;a>f;f++)if((i||f in o)&&o[f]===s)return i||f||0;return!i&&-1}};return Ar={includes:i(!0),indexOf:i(!1)}}function Lr(){if(Cr)return Or;Cr=1;var t=Nt(),n=_n(),r=Ut(),i=Vr().indexOf,e=vr(),s=t([].push);return Or=function(t,u){var o,a=r(t),c=0,f=[];for(o in a)!n(e,o)&&n(a,o)&&s(f,o);for(;u.length>c;)n(a,o=u[c++])&&(~i(f,o)||s(f,o));return f}}function zr(){return Nr?Dr:(Nr=1,Dr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}function Br(){if(Fr)return Pr;Fr=1;var t=Lr(),n=zr().concat("length","prototype");return Pr.f=Object.getOwnPropertyNames||function(r){return t(r,n)},Pr}var Gr,Wr,qr,Hr,Kr,Xr,$r,Qr,Jr,Yr,Zr,ti,ni,ri,ii,ei,si,ui,oi,ai,ci,fi,hi,di,vi,li,gi,wi,mi,pi,yi={};function bi(){return Gr||(Gr=1,yi.f=Object.getOwnPropertySymbols),yi}function Ei(){if(qr)return Wr;qr=1;var t=Lt(),n=Nt(),r=Br(),i=bi(),e=qn(),s=n([].concat);return Wr=t("Reflect","ownKeys")||function(t){var n=r.f(e(t)),u=i.f;return u?s(n,u(t)):n}}function Ii(){if(Kr)return Hr;Kr=1;var t=_n(),n=Ei(),r=Mn(),i=Hn();return Hr=function(e,s,u){for(var o=n(s),a=i.f,c=r.f,f=0;f<o.length;f++){var h=o[f];t(e,h)||u&&t(u,h)||a(e,h,c(s,h))}}}function Si(){if($r)return Xr;$r=1;var t=j(),n=jt(),r=/#|\.prototype\./,i=function(r,i){var a=s[e(r)];return a===o||a!==u&&(n(i)?t(i):!!i)},e=i.normalize=function(t){return String(t).replace(r,".").toLowerCase()},s=i.data={},u=i.NATIVE="N",o=i.POLYFILL="P";return Xr=i}function Ti(){if(Jr)return Qr;Jr=1;var t=_(),n=Mn().f,r=Kn(),i=wr(),e=Tn(),s=Ii(),u=Si();return Qr=function(o,a){var c,f,h,d,v,l=o.target,g=o.global,w=o.stat;if(c=g?t:w?t[l]||e(l,{}):t[l]&&t[l].prototype)for(f in a){if(d=a[f],h=o.dontCallGetSet?(v=n(c,f))&&v.value:c[f],!u(g?f:l+(w?".":"#")+f,o.forced)&&void 0!==h){if(typeof d==typeof h)continue;s(d,h)}(o.sham||h&&h.sham)&&r(d,"sham",!0),i(c,f,d,o)}}}function ki(){if(Zr)return Yr;Zr=1;var t=Ft();return Yr=Array.isArray||function(n){return"Array"===t(n)}}function Ri(){if(ni)return ti;ni=1;var t=TypeError;return ti=function(n){if(n>9007199254740991)throw new t("Maximum allowed index exceeded");return n}}function Ai(){if(ii)return ri;ii=1;var t=V(),n=Hn(),r=Dt();return ri=function(i,e,s){t?n.f(i,e,r(0,s)):i[e]=s}}function _i(){if(si)return ei;si=1;var t=V(),n=ki(),r=TypeError,i=Object.getOwnPropertyDescriptor,e=t&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();return ei=e?function(t,e){if(n(t)&&!i(t,"length").writable)throw new r("Cannot set read only .length");return t.length=e}:function(t,n){return t.length=n}}function Oi(){if(oi)return ui;oi=1;var t={};return t[Cn()("toStringTag")]="z",ui="[object z]"===String(t)}function Ci(){if(ci)return ai;ci=1;var t=Oi(),n=jt(),r=Ft(),i=Cn()("toStringTag"),e=Object,s="Arguments"===r(function(){return arguments}());return ai=t?r:function(t){var u,o,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(o=function(t,n){try{return t[n]}catch(t){}}(u=e(t),i))?o:s?r(u):"Object"===(a=r(u))&&n(u.callee)?"Arguments":a}}function Di(){if(hi)return fi;hi=1;var t=Nt(),n=j(),r=jt(),i=Ci(),e=Lt(),s=hr(),u=function(){},o=e("Reflect","construct"),a=/^\s*(?:class|function)\b/,c=t(a.exec),f=!a.test(u),h=function(t){if(!r(t))return!1;try{return o(u,[],t),!0}catch(t){return!1}},d=function(t){if(!r(t))return!1;switch(i(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return f||!!c(a,s(t))}catch(t){return!0}};return d.sham=!0,fi=!o||n(function(){var t;return h(h.call)||!h(Object)||!h(function(){t=!0})||t})?d:h}function Ni(){if(vi)return di;vi=1;var t=ki(),n=Di(),r=Vt(),i=Cn()("species"),e=Array;return di=function(s){var u;return t(s)&&(u=s.constructor,(n(u)&&(u===e||t(u.prototype))||r(u)&&null===(u=u[i]))&&(u=void 0)),void 0===u?e:u}}function Fi(){if(gi)return li;gi=1;var t=Ni();return li=function(n,r){return new(t(n))(0===r?0:r)}}function Pi(){if(mi)return wi;mi=1;var t=j(),n=Cn(),r=Gt(),i=n("species");return wi=function(n){return r>=51||!t(function(){var t=[];return(t.constructor={})[i]=function(){return{foo:1}},1!==t[n](Boolean).foo})}}!function(){if(pi)return A;pi=1;var t=Ti(),n=j(),r=ki(),i=Vt(),e=An(),s=jr(),u=Ri(),o=Ai(),a=_i(),c=Fi(),f=Pi(),h=Cn(),d=Gt(),v=h("isConcatSpreadable"),l=d>=51||!n(function(){var t=[];return t[v]=!1,t.concat()[0]!==t}),g=function(t){if(!i(t))return!1;var n=t[v];return void 0!==n?!!n:r(t)};t({target:"Array",proto:!0,arity:1,forced:!l||!f("concat")},{concat:function(t){var n,r,i,f,h,d=e(this),v=c(d,0),l=0;for(n=-1,i=arguments.length;n<i;n++)if(g(h=-1===n?d:arguments[n]))for(f=s(h),u(l+f),r=0;r<f;r++,l++)r in h&&o(v,l,h[r]);else u(l+1),o(v,l++,h);return a(v,l),v}})}();var Mi,xi,Ui,ji,Vi,Li,zi,Bi,Gi,Wi,qi={},Hi={};function Ki(){if(xi)return Mi;xi=1;var t=Lr(),n=zr();return Mi=Object.keys||function(r){return t(r,n)}}function Xi(){if(Vi)return ji;Vi=1;var t=Lt();return ji=t("document","documentElement")}function $i(){if(zi)return Li;zi=1;var t,n=qn(),r=function(){if(Ui)return Hi;Ui=1;var t=V(),n=Wn(),r=Hn(),i=qn(),e=Ut(),s=Ki();return Hi.f=t&&!n?Object.defineProperties:function(t,n){i(t);for(var u,o=e(n),a=s(n),c=a.length,f=0;c>f;)r.f(t,u=a[f++],o[u]);return t},Hi}(),i=zr(),e=vr(),s=Xi(),u=Fn(),o=dr(),a="prototype",c="script",f=o("IE_PROTO"),h=function(){},d=function(t){return"<"+c+">"+t+"</"+c+">"},v=function(t){t.write(d("")),t.close();var n=t.parentWindow.Object;return t=null,n},l=function(){try{t=new ActiveXObject("htmlfile")}catch(t){}var n,r,e;l="undefined"!=typeof document?document.domain&&t?v(t):(r=u("iframe"),e="java"+c+":",r.style.display="none",s.appendChild(r),r.src=String(e),(n=r.contentWindow.document).open(),n.write(d("document.F=Object")),n.close(),n.F):v(t);for(var o=i.length;o--;)delete l[a][i[o]];return l()};return e[f]=!0,Li=Object.create||function(t,i){var e;return null!==t?(h[a]=n(t),e=new h,h[a]=null,e[f]=t):e=l(),void 0===i?e:r.f(e,i)}}function Qi(){if(Gi)return Bi;Gi=1;var t=Cn(),n=$i(),r=Hn().f,i=t("unscopables"),e=Array.prototype;return void 0===e[i]&&r(e,i,{configurable:!0,value:n(null)}),Bi=function(t){e[i][t]=!0}}!function(){if(Wi)return qi;Wi=1;var t=Ti(),n=Vr().includes,r=j(),i=Qi(),e=r(function(){return!Array(1).includes()}),s=r(function(){return[,1].includes(void 0,1)});t({target:"Array",proto:!0,forced:e||s},{includes:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}}),i("includes")}();var Ji,Yi,Zi,te={};function ne(){if(Yi)return Ji;Yi=1;var t=j();return Ji=function(n,r){var i=[][n];return!!i&&t(function(){i.call(null,r||function(){return 1},1)})}}!function(){if(Zi)return te;Zi=1;var t=Ti(),n=Nt(),r=Pt(),i=Ut(),e=ne(),s=n([].join);t({target:"Array",proto:!0,forced:r!==Object||!e("join",",")},{join:function(t){return s(i(this),void 0===t?",":t)}})}();var re,ie={};!function(){if(re)return ie;re=1;var t=Ti(),n=An(),r=Ki();t({target:"Object",stat:!0,forced:j()(function(){r(1)})},{keys:function(t){return r(n(t))}})}();var ee,se,ue,oe={};!function(){if(ue)return oe;ue=1;var t=Oi(),n=wr(),r=function(){if(se)return ee;se=1;var t=Oi(),n=Ci();return ee=t?{}.toString:function(){return"[object "+n(this)+"]"}}();t||n(Object.prototype,"toString",r,{unsafe:!0})}();var ae,ce,fe,he,de,ve,le,ge,we,me,pe,ye,be,Ee,Ie,Se,Te,ke,Re,Ae,_e,Oe,Ce,De,Ne,Fe,Pe,Me,xe,Ue,je,Ve,Le,ze,Be,Ge,We,qe,He,Ke,Xe,$e,Qe,Je,Ye,Ze,ts,ns,rs,is,es,ss,us,os,as,cs,fs,hs,ds={};function vs(){if(ce)return ae;ce=1;var t=_(),n=Bt(),r=Ft(),i=function(t){return n.slice(0,t.length)===t};return ae=i("Bun/")?"BUN":i("Cloudflare-Workers")?"CLOUDFLARE":i("Deno/")?"DENO":i("Node.js/")?"NODE":t.Bun&&"string"==typeof Bun.version?"BUN":t.Deno&&"object"==typeof Deno.version?"DENO":"process"===r(t.process)?"NODE":t.window&&t.document?"BROWSER":"REST"}function ls(){if(he)return fe;he=1;var t=vs();return fe="NODE"===t}function gs(){if(ve)return de;ve=1;var t=_();return de=t}function ws(){if(me)return we;me=1;var t=Vt();return we=function(n){return t(n)||null===n}}function ms(){if(ye)return pe;ye=1;var t=ws(),n=String,r=TypeError;return pe=function(i){if(t(i))return i;throw new r("Can't set "+n(i)+" as a prototype")}}function ps(){if(Ee)return be;Ee=1;var t=function(){if(ge)return le;ge=1;var t=Nt(),n=Xt();return le=function(r,i,e){try{return t(n(Object.getOwnPropertyDescriptor(r,i)[e]))}catch(t){}}}(),n=Vt(),r=xt(),i=ms();return be=Object.setPrototypeOf||("__proto__"in{}?function(){var e,s=!1,u={};try{(e=t(Object.prototype,"__proto__","set"))(u,[]),s=u instanceof Array}catch(t){}return function(t,u){return r(t),i(u),n(t)?(s?e(t,u):t.__proto__=u,t):t}}():void 0)}function ys(){if(Se)return Ie;Se=1;var t=Hn().f,n=_n(),r=Cn()("toStringTag");return Ie=function(i,e,s){i&&!s&&(i=i.prototype),i&&!n(i,r)&&t(i,r,{configurable:!0,value:e})}}function bs(){if(ke)return Te;ke=1;var t=gr(),n=Hn();return Te=function(r,i,e){return e.get&&t(e.get,i,{getter:!0}),e.set&&t(e.set,i,{setter:!0}),n.f(r,i,e)}}function Es(){if(Ae)return Re;Ae=1;var t=Lt(),n=bs(),r=Cn(),i=V(),e=r("species");return Re=function(r){var s=t(r);i&&s&&!s[e]&&n(s,e,{configurable:!0,get:function(){return this}})}}function Is(){if(Oe)return _e;Oe=1;var t=zt(),n=TypeError;return _e=function(r,i){if(t(i,r))return r;throw new n("Incorrect invocation")}}function Ss(){if(De)return Ce;De=1;var t=Di(),n=Kt(),r=TypeError;return Ce=function(i){if(t(i))return i;throw new r(n(i)+" is not a constructor")}}function Ts(){if(Fe)return Ne;Fe=1;var t=qn(),n=Ss(),r=Mt(),i=Cn()("species");return Ne=function(e,s){var u,o=t(e).constructor;return void 0===o||r(u=t(o)[i])?s:n(u)}}function ks(){if(Me)return Pe;Me=1;var t=L(),n=Function.prototype,r=n.apply,i=n.call;return Pe="object"==typeof Reflect&&Reflect.apply||(t?i.bind(r):function(){return i.apply(r,arguments)}),Pe}function Rs(){if(Ue)return xe;Ue=1;var t=Ft(),n=Nt();return xe=function(r){if("Function"===t(r))return n(r)}}function As(){if(Ve)return je;Ve=1;var t=Rs(),n=Xt(),r=L(),i=t(t.bind);return je=function(t,e){return n(t),void 0===e?t:r?i(t,e):function(){return t.apply(e,arguments)}},je}function _s(){if(ze)return Le;ze=1;var t=Nt();return Le=t([].slice)}function Os(){if(Ge)return Be;Ge=1;var t=TypeError;return Be=function(n,r){if(n<r)throw new t("Not enough arguments");return n}}function Cs(){if(qe)return We;qe=1;var t=Bt();return We=/ipad|iphone|ipod/i.test(t)&&/applewebkit/i.test(t)}function Ds(){if(Ke)return He;Ke=1;var t,n,r,i,e=_(),s=ks(),u=As(),o=jt(),a=_n(),c=j(),f=Xi(),h=_s(),d=Fn(),v=Os(),l=Cs(),g=ls(),w=e.setImmediate,m=e.clearImmediate,p=e.process,y=e.Dispatch,b=e.Function,E=e.MessageChannel,I=e.String,S=0,T={},k="onreadystatechange";c(function(){t=e.location});var R=function(t){if(a(T,t)){var n=T[t];delete T[t],n()}},A=function(t){return function(){R(t)}},O=function(t){R(t.data)},C=function(n){e.postMessage(I(n),t.protocol+"//"+t.host)};return w&&m||(w=function(t){v(arguments.length,1);var r=o(t)?t:b(t),i=h(arguments,1);return T[++S]=function(){s(r,void 0,i)},n(S),S},m=function(t){delete T[t]},g?n=function(t){p.nextTick(A(t))}:y&&y.now?n=function(t){y.now(A(t))}:E&&!l?(i=(r=new E).port2,r.port1.onmessage=O,n=u(i.postMessage,i)):e.addEventListener&&o(e.postMessage)&&!e.importScripts&&t&&"file:"!==t.protocol&&!c(C)?(n=C,e.addEventListener("message",O,!1)):n=k in d("script")?function(t){f.appendChild(d("script"))[k]=function(){f.removeChild(this),R(t)}}:function(t){setTimeout(A(t),0)}),He={set:w,clear:m}}function Ns(){if($e)return Xe;$e=1;var t=_(),n=V(),r=Object.getOwnPropertyDescriptor;return Xe=function(i){if(!n)return t[i];var e=r(t,i);return e&&e.value}}function Fs(){if(Je)return Qe;Je=1;var t=function(){this.head=null,this.tail=null};return t.prototype={add:function(t){var n={item:t,next:null},r=this.tail;r?r.next=n:this.head=n,this.tail=n},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}},Qe=t}function Ps(){if(is)return rs;is=1;var t,n,r,i,e,s=_(),u=Ns(),o=As(),a=Ds().set,c=Fs(),f=Cs(),h=function(){if(Ze)return Ye;Ze=1;var t=Bt();return Ye=/ipad|iphone|ipod/i.test(t)&&"undefined"!=typeof Pebble}(),d=function(){if(ns)return ts;ns=1;var t=Bt();return ts=/web0s(?!.*chrome)/i.test(t)}(),v=ls(),l=s.MutationObserver||s.WebKitMutationObserver,g=s.document,w=s.process,m=s.Promise,p=u("queueMicrotask");if(!p){var y=new c,b=function(){var n,r;for(v&&(n=w.domain)&&n.exit();r=y.get();)try{r()}catch(n){throw y.head&&t(),n}n&&n.enter()};f||v||d||!l||!g?!h&&m&&m.resolve?((i=m.resolve(void 0)).constructor=m,e=o(i.then,i),t=function(){e(b)}):v?t=function(){w.nextTick(b)}:(a=o(a,s),t=function(){a(b)}):(n=!0,r=g.createTextNode(""),new l(b).observe(r,{characterData:!0}),t=function(){r.data=n=!n}),p=function(n){y.head||t(),y.add(n)}}return rs=p}function Ms(){return ss||(ss=1,es=function(t,n){try{1===arguments.length?console.error(t):console.error(t,n)}catch(t){}}),es}function xs(){return os?us:(os=1,us=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}})}function Us(){if(cs)return as;cs=1;var t=_();return as=t.Promise}function js(){if(hs)return fs;hs=1;var t=_(),n=Us(),r=jt(),i=Si(),e=hr(),s=Cn(),u=vs(),o=Sn(),a=Gt(),c=n&&n.prototype,f=s("species"),h=!1,d=r(t.PromiseRejectionEvent),v=i("Promise",function(){var t=e(n),r=t!==String(n);if(!r&&66===a)return!0;if(o&&(!c.catch||!c.finally))return!0;if(!a||a<51||!/native code/.test(t)){var i=new n(function(t){t(1)}),s=function(t){t(function(){},function(){})};if((i.constructor={})[f]=s,!(h=i.then(function(){})instanceof s))return!0}return!(r||"BROWSER"!==u&&"DENO"!==u||d)});return fs={CONSTRUCTOR:v,REJECTION_EVENT:d,SUBCLASSING:h}}var Vs,Ls,zs={};function Bs(){if(Vs)return zs;Vs=1;var t=Xt(),n=TypeError,r=function(r){var i,e;this.promise=new r(function(t,r){if(void 0!==i||void 0!==e)throw new n("Bad Promise constructor");i=t,e=r}),this.resolve=t(i),this.reject=t(e)};return zs.f=function(t){return new r(t)},zs}var Gs,Ws,qs,Hs,Ks,Xs,$s,Qs,Js,Ys,Zs,tu,nu,ru,iu,eu,su,uu={};function ou(){return Ws?Gs:(Ws=1,Gs={})}function au(){if(Hs)return qs;Hs=1;var t=Cn(),n=ou(),r=t("iterator"),i=Array.prototype;return qs=function(t){return void 0!==t&&(n.Array===t||i[r]===t)}}function cu(){if(Xs)return Ks;Xs=1;var t=Ci(),n=$t(),r=Mt(),i=ou(),e=Cn()("iterator");return Ks=function(s){if(!r(s))return n(s,e)||n(s,"@@iterator")||i[t(s)]}}function fu(){if(Qs)return $s;Qs=1;var t=z(),n=Xt(),r=qn(),i=Kt(),e=cu(),s=TypeError;return $s=function(u,o){var a=arguments.length<2?e(u):o;if(n(a))return r(t(a,u));throw new s(i(u)+" is not iterable")},$s}function hu(){if(Ys)return Js;Ys=1;var t=z(),n=qn(),r=$t();return Js=function(i,e,s){var u,o;n(i);try{if(!(u=r(i,"return"))){if("throw"===e)throw s;return s}u=t(u,i)}catch(t){o=!0,u=t}if("throw"===e)throw s;if(o)throw u;return n(u),s}}function du(){if(tu)return Zs;tu=1;var t=As(),n=z(),r=qn(),i=Kt(),e=au(),s=jr(),u=zt(),o=fu(),a=cu(),c=hu(),f=TypeError,h=function(t,n){this.stopped=t,this.result=n},d=h.prototype;return Zs=function(v,l,g){var w,m,p,y,b,E,I,S=g&&g.that,T=!(!g||!g.AS_ENTRIES),k=!(!g||!g.IS_RECORD),R=!(!g||!g.IS_ITERATOR),A=!(!g||!g.INTERRUPTED),_=t(l,S),O=function(t){var n=w;return w=void 0,n&&c(n,"normal"),new h(!0,t)},C=function(t){return T?(r(t),A?_(t[0],t[1],O):_(t[0],t[1])):A?_(t,O):_(t)};if(k)w=v.iterator;else if(R)w=v;else{if(!(m=a(v)))throw new f(i(v)+" is not iterable");if(e(m)){for(p=0,y=s(v);y>p;p++)if((b=C(v[p]))&&u(d,b))return b;return new h(!1)}w=o(v,m)}for(E=k?v.next:w.next;!(I=n(E,w)).done;){var D=I.value;try{b=C(D)}catch(t){if(!w)throw t;c(w,"throw",t)}if("object"==typeof b&&b&&u(d,b))return b}return new h(!1)}}function vu(){if(ru)return nu;ru=1;var t=Cn()("iterator"),n=!1;try{var r=0,i={next:function(){return{done:!!r++}},return:function(){n=!0}};i[t]=function(){return this},Array.from(i,function(){throw 2})}catch(t){}return nu=function(r,i){try{if(!i&&!n)return!1}catch(t){return!1}var e=!1;try{var s={};s[t]=function(){return{next:function(){return{done:e=!0}}}},r(s)}catch(t){}return e}}function lu(){if(eu)return iu;eu=1;var t=Us(),n=vu(),r=js().CONSTRUCTOR;return iu=r||!n(function(n){t.all(n).then(void 0,function(){})})}var gu,wu={};var mu,pu={};var yu,bu={};var Eu,Iu,Su,Tu,ku={};function Ru(){if(Iu)return Eu;Iu=1;var t=qn(),n=Vt(),r=Bs();return Eu=function(i,e){if(t(i),n(e)&&e.constructor===i)return e;var s=r.f(i);return(0,s.resolve)(e),s.promise}}Tu||(Tu=1,function(){if(Ls)return ds;Ls=1;var t,n,r,i,e=Ti(),s=Sn(),u=ls(),o=_(),a=gs(),c=z(),f=wr(),h=ps(),d=ys(),v=Es(),l=Xt(),g=jt(),w=Vt(),m=Is(),p=Ts(),y=Ds().set,b=Ps(),E=Ms(),I=xs(),S=Fs(),T=lr(),k=Us(),R=js(),A=Bs(),O="Promise",C=R.CONSTRUCTOR,D=R.REJECTION_EVENT,N=R.SUBCLASSING,F=T.getterFor(O),P=T.set,M=k&&k.prototype,x=k,U=M,j=o.TypeError,V=o.document,L=o.process,B=A.f,G=B,W=!!(V&&V.createEvent&&o.dispatchEvent),q="unhandledrejection",H=function(t){var n;return!(!w(t)||!g(n=t.then))&&n},K=function(t,n){var r,i,e,s=n.value,u=1===n.state,o=u?t.ok:t.fail,a=t.resolve,f=t.reject,h=t.domain;try{o?(u||(2===n.rejection&&Y(n),n.rejection=1),!0===o?r=s:(h&&h.enter(),r=o(s),h&&(h.exit(),e=!0)),r===t.promise?f(new j("Promise-chain cycle")):(i=H(r))?c(i,r,a,f):a(r)):f(s)}catch(t){h&&!e&&h.exit(),f(t)}},X=function(t,n){t.notified||(t.notified=!0,b(function(){for(var r,i=t.reactions;r=i.get();)K(r,t);t.notified=!1,n&&!t.rejection&&Q(t)}))},$=function(t,n,r){var i,e;W?((i=V.createEvent("Event")).promise=n,i.reason=r,i.initEvent(t,!1,!0),o.dispatchEvent(i)):i={promise:n,reason:r},!D&&(e=o["on"+t])?e(i):t===q&&E("Unhandled promise rejection",r)},Q=function(t){c(y,o,function(){var n,r=t.facade,i=t.value;if(J(t)&&(n=I(function(){u?L.emit("unhandledRejection",i,r):$(q,r,i)}),t.rejection=u||J(t)?2:1,n.error))throw n.value})},J=function(t){return 1!==t.rejection&&!t.parent},Y=function(t){c(y,o,function(){var n=t.facade;u?L.emit("rejectionHandled",n):$("rejectionhandled",n,t.value)})},Z=function(t,n,r){return function(i){t(n,i,r)}},tt=function(t,n,r){t.done||(t.done=!0,r&&(t=r),t.value=n,t.state=2,X(t,!0))},nt=function(t,n,r){if(!t.done){t.done=!0,r&&(t=r);try{if(t.facade===n)throw new j("Promise can't be resolved itself");var i=H(n);i?b(function(){var r={done:!1};try{c(i,n,Z(nt,r,t),Z(tt,r,t))}catch(n){tt(r,n,t)}}):(t.value=n,t.state=1,X(t,!1))}catch(n){tt({done:!1},n,t)}}};if(C&&(U=(x=function(n){m(this,U),l(n),c(t,this);var r=F(this);try{n(Z(nt,r),Z(tt,r))}catch(t){tt(r,t)}}).prototype,(t=function(t){P(this,{type:O,done:!1,notified:!1,parent:!1,reactions:new S,rejection:!1,state:0,value:null})}).prototype=f(U,"then",function(t,n){var r=F(this),i=B(p(this,x));return r.parent=!0,i.ok=!g(t)||t,i.fail=g(n)&&n,i.domain=u?L.domain:void 0,0===r.state?r.reactions.add(i):b(function(){K(i,r)}),i.promise}),n=function(){var n=new t,r=F(n);this.promise=n,this.resolve=Z(nt,r),this.reject=Z(tt,r)},A.f=B=function(t){return t===x||t===r?new n(t):G(t)},!s&&g(k)&&M!==Object.prototype)){i=M.then,N||f(M,"then",function(t,n){var r=this;return new x(function(t,n){c(i,r,t,n)}).then(t,n)},{unsafe:!0});try{delete M.constructor}catch(t){}h&&h(M,U)}e({global:!0,constructor:!0,wrap:!0,forced:C},{Promise:x}),r=a.Promise,d(x,O,!1,!0),v(O)}(),function(){if(su)return uu;su=1;var t=Ti(),n=z(),r=Xt(),i=Bs(),e=xs(),s=du();t({target:"Promise",stat:!0,forced:lu()},{all:function(t){var u=this,o=i.f(u),a=o.resolve,c=o.reject,f=e(function(){var i=r(u.resolve),e=[],o=0,f=1;s(t,function(t){var r=o++,s=!1;f++,n(i,u,t).then(function(t){s||(s=!0,e[r]=t,--f||a(e))},c)}),--f||a(e)});return f.error&&c(f.value),o.promise}})}(),function(){if(gu)return wu;gu=1;var t=Ti(),n=Sn(),r=js().CONSTRUCTOR,i=Us(),e=Lt(),s=jt(),u=wr(),o=i&&i.prototype;if(t({target:"Promise",proto:!0,forced:r,real:!0},{catch:function(t){return this.then(void 0,t)}}),!n&&s(i)){var a=e("Promise").prototype.catch;o.catch!==a&&u(o,"catch",a,{unsafe:!0})}}(),function(){if(mu)return pu;mu=1;var t=Ti(),n=z(),r=Xt(),i=Bs(),e=xs(),s=du();t({target:"Promise",stat:!0,forced:lu()},{race:function(t){var u=this,o=i.f(u),a=o.reject,c=e(function(){var i=r(u.resolve);s(t,function(t){n(i,u,t).then(o.resolve,a)})});return c.error&&a(c.value),o.promise}})}(),function(){if(yu)return bu;yu=1;var t=Ti(),n=Bs();t({target:"Promise",stat:!0,forced:js().CONSTRUCTOR},{reject:function(t){var r=n.f(this);return(0,r.reject)(t),r.promise}})}(),function(){if(Su)return ku;Su=1;var t=Ti(),n=Lt(),r=Sn(),i=Us(),e=js().CONSTRUCTOR,s=Ru(),u=n("Promise"),o=r&&!e;t({target:"Promise",stat:!0,forced:r||e},{resolve:function(t){return s(o&&this===u?i:this,t)}})}());var Au,_u,Ou,Cu,Du,Nu,Fu,Pu,Mu,xu={};function Uu(){return _u?Au:(_u=1,Au={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0})}function ju(){if(Cu)return Ou;Cu=1;var t=Fn()("span").classList,n=t&&t.constructor&&t.constructor.prototype;return Ou=n===Object.prototype?void 0:n}function Vu(){if(Nu)return Du;Nu=1;var t=As(),n=Pt(),r=An(),i=jr(),e=Fi(),s=Ai(),u=function(u){var o=1===u,a=2===u,c=3===u,f=4===u,h=6===u,d=7===u,v=5===u||h;return function(l,g,w){for(var m,p,y=r(l),b=n(y),E=i(b),I=t(g,w),S=0,T=0,k=o?e(l,E):a||d?e(l,0):void 0;E>S;S++)if((v||S in b)&&(p=I(m=b[S],S,y),u))if(o)s(k,S,p);else if(p)switch(u){case 3:return!0;case 5:return m;case 6:return S;case 2:s(k,T++,m)}else switch(u){case 4:return!1;case 7:s(k,T++,m)}return h?-1:c||f?f:k}};return Du={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterReject:u(7)}}!function(){if(Mu)return xu;Mu=1;var t=_(),n=Uu(),r=ju(),i=function(){if(Pu)return Fu;Pu=1;var t=Vu().forEach,n=ne()("forEach");return Fu=n?[].forEach:function(n){return t(this,n,arguments.length>1?arguments[1]:void 0)},Fu}(),e=Kn(),s=function(t){if(t&&t.forEach!==i)try{e(t,"forEach",i)}catch(n){t.forEach=i}};for(var u in n)n[u]&&s(t[u]&&t[u].prototype);s(r)}();var Lu=function(t,n){return Lu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},Lu(t,n)};var zu=function(){return zu=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++)for(var e in n=arguments[r])Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);return t},zu.apply(this,arguments)};function Bu(t,n,r,i){return new(r||(r=Promise))(function(e,s){function u(t){try{a(i.next(t))}catch(t){s(t)}}function o(t){try{a(i.throw(t))}catch(t){s(t)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r(function(t){t(n)})).then(u,o)}a((i=i.apply(t,n||[])).next())})}function Gu(t,n){var r,i,e,s={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=o(0),u.throw=o(1),u.return=o(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function o(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,o[0]&&(s=0)),s;)try{if(r=1,i&&(e=2&o[0]?i.return:o[0]?i.throw||((e=i.return)&&e.call(i),0):i.next)&&!(e=e.call(i,o[1])).done)return e;switch(i=0,e&&(o=[2&o[0],e.value]),o[0]){case 0:case 1:e=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(e=s.trys,(e=e.length>0&&e[e.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!e||o[1]>e[0]&&o[1]<e[3])){s.label=o[1];break}if(6===o[0]&&s.label<e[1]){s.label=e[1],e=o;break}if(e&&s.label<e[2]){s.label=e[2],s.ops.push(o);break}e[2]&&s.ops.pop(),s.trys.pop();continue}o=n.call(t,s)}catch(t){o=[6,t],i=0}finally{r=e=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function Wu(t){var n="function"==typeof Symbol&&Symbol.iterator,r=n&&t[n],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function qu(t,n){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,e,s=r.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(i=s.next()).done;)u.push(i.value)}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return u}function Hu(t,n,r){if(r||2===arguments.length)for(var i,e=0,s=n.length;e<s;e++)!i&&e in n||(i||(i=Array.prototype.slice.call(n,0,e)),i[e]=n[e]);return t.concat(i||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var Ku="/phantom/web/events",Xu="/phantom/web/userEvents",$u="/phantom/api/v2/sdk/config",Qu="/phantom/api/v2/visitors",Ju="/phantom/api/v2/visitors",Yu="/phantom/api/v2/visitors/merge",Zu="/api/v1/websdk/dlr",to=18e5,no={STATUSES:{PENDING:"pending"},BATCH_SIZE:50,DEFAULT_RETRY_DELAYS:[6e4,12e4,24e4,48e4,9e5],RETRYABLE_HTTP_CODES:[408,429,500,502,503,504,401],GLOBAL_SUCCESS_CODE:200,PARTIAL_SUCCESS_CODE:201},ro="/firebase-messaging-sw.js",io="hydra-websdk-fcm",eo={USER_CONTEXT:"websdk_user_context",VISITOR_ID:"websdk_visitor_id",VISITOR_REF_ID:"websdk_visitor_ref_id",VISITOR_EXPIRED_AT:"websdk_visitor_expired_at",VISITOR_CONFIG:"websdk_visitor_config",FCM_TOKEN:"websdk_fcm_token",FCM_TOKEN_CREATED_AT:"websdk_fcm_token_created_at",NOTIFICATION_STATE:"websdk_notification_state",SESSION_ID:"websdk_session_id",SESSION_START_TIME:"websdk_session_start_time",LAST_EVENT_TIME:"websdk_last_event_time",LAST_AUTHENTICATED_USER:"websdk_last_authenticated_user",MERGED_USER_ID:"websdk_merged_user_id",PENDING_MERGE:"websdk_pending_merge",SESSION_NUMBER:"websdk_session_number"};function so(t,n,r){var i=eo[t],e=[];return n&&e.push(n),r&&e.push(r),e.length>0?"".concat(e.join("_"),"_").concat(i):i}var uo,oo="websdk_storage_test",ao="test_value",co="INIT_ERROR",fo="AUTH_ERROR",ho="NETWORK_ERROR",vo="EVENT_ERROR",lo="VISITOR_CONFIG_ERROR",go="WebSDK initialized successfully",wo="Failed to initialize WebSDK",mo="WebSDK destroyed successfully",po="EventTracker initialized successfully",yo="EventTracker destroyed successfully",bo="Failed to track event",Eo="Events sent successfully",Io="Failed to send events",So="Failed to initialize storage:",To="Storage test failed:",ko="Storage read/write test failed",Ro="StorageManager destroyed successfully",Ao="Error during storage cleanup:",_o="New session started",Oo="Session continued",Co="Session expired due to inactivity",Do="Session ended on user switch (different user login)",No="Session restored from storage",Fo="Failed to track user signin event",Po="Failed to track user signup event",Mo="Failed to track user update event",xo="Failed to track user signout event",Uo="Failed to track behavioral event",jo="VisitorConfigManager initialized successfully",Vo="Visitor config fetched successfully",Lo="Failed to fetch visitor config",zo="Visitor tracking is disabled",Bo="Visitor tracking is enabled",Go="Visitor config retrieved from cache",Wo="AnonymousVisitorManager initialized successfully",qo="Visitor ID generated successfully",Ho="Failed to generate visitor ID",Ko="Visitor ID restored from storage",Xo="Using cached visitor ID",$o="Visitor updated successfully",Qo="Failed to update visitor",Jo="Visitor merged with user successfully",Yo="Failed to merge visitor with user",Zo="Visitor merge skipped",ta="Notification permission denied by user",na="Notification manager initialized successfully",ra="Failed to initialize notification manager",ia="Notification initialization skipped (disabled or not supported)",ea="Firebase initialized successfully",sa="Failed to initialize Firebase",ua="FCM token received successfully",oa="FCM token refreshed",aa="Failed to retrieve FCM token",ca="Service worker registered successfully",fa="Failed to register service worker",ha="DLR events sent successfully",da="Failed to send DLR events",va="web",la="user_signin",ga="user_update",wa="user_signout",ma=30,pa=3e3,ya={WEBPUSH:"WEBPUSH"},ba={WEB:"web"},Ea={ACCOUNT_NOT_EXISTS:2432,ACCOUNT_ID_NOT_PASSED:9999},Ia={ALREADY_MERGED:"1429",VISITOR_NOT_FOUND:"1428"},Sa={NOTIFICATION_RECEIVED:"push_notification_received",NOTIFICATION_CLICKED:"push_notification_click",NOTIFICATION_DISMISSED:"push_notification_close"},Ta="fcm",ka="push",Ra="1.1.0",Aa={};!function(){if(uo)return Aa;uo=1;var t=V(),n=fr().EXISTS,r=Nt(),i=bs(),e=Function.prototype,s=r(e.toString),u=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,o=r(u.exec);t&&!n&&i(e,"name",{configurable:!0,get:function(){try{return o(u,s(this))[1]}catch(t){return""}}})}();var _a,Oa,Ca,Da,Na,Fa,Pa,Ma,xa,Ua={};function ja(){if(Oa)return _a;Oa=1;var t=Ci(),n=String;return _a=function(r){if("Symbol"===t(r))throw new TypeError("Cannot convert a Symbol value to a string");return n(r)}}function Va(){return Da?Ca:(Da=1,Ca="\t\n\v\f\r                 \u2028\u2029\ufeff")}function La(){if(Fa)return Na;Fa=1;var t=Nt(),n=xt(),r=ja(),i=Va(),e=t("".replace),s=RegExp("^["+i+"]+"),u=RegExp("(^|[^"+i+"])["+i+"]+$"),o=function(t){return function(i){var o=r(n(i));return 1&t&&(o=e(o,s,"")),2&t&&(o=e(o,u,"$1")),o}};return Na={start:o(1),end:o(2),trim:o(3)}}!function(){if(xa)return Ua;xa=1;var t=Ti(),n=La().trim,r=function(){if(Ma)return Pa;Ma=1;var t=fr().PROPER,n=j(),r=Va();return Pa=function(i){return n(function(){return!!r[i]()||"​…᠎"!=="​…᠎"[i]()||t&&r[i].name!==i})}}();t({target:"String",proto:!0,forced:r("trim")},{trim:function(){return n(this)}})}();var za,Ba,Ga,Wa,qa,Ha,Ka,Xa,$a,Qa,Ja,Ya={};function Za(){if(Ba)return za;Ba=1;var t=qn();return za=function(){var n=t(this),r="";return n.hasIndices&&(r+="d"),n.global&&(r+="g"),n.ignoreCase&&(r+="i"),n.multiline&&(r+="m"),n.dotAll&&(r+="s"),n.unicode&&(r+="u"),n.unicodeSets&&(r+="v"),n.sticky&&(r+="y"),r}}function tc(){if(Wa)return Ga;Wa=1;var t=j(),n=_().RegExp,r=t(function(){var t=n("a","y");return t.lastIndex=2,null!==t.exec("abcd")}),i=r||t(function(){return!n("a","y").sticky}),e=r||t(function(){var t=n("^r","gy");return t.lastIndex=2,null!==t.exec("str")});return Ga={BROKEN_CARET:e,MISSED_STICKY:i,UNSUPPORTED_Y:r}}function nc(){if(Ha)return qa;Ha=1;var t=j(),n=_().RegExp;return qa=t(function(){var t=n(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)})}function rc(){if(Xa)return Ka;Xa=1;var t=j(),n=_().RegExp;return Ka=t(function(){var t=n("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})}function ic(){if(Qa)return $a;Qa=1;var t,n,r=z(),i=Nt(),e=ja(),s=Za(),u=tc(),o=Rn(),a=$i(),c=lr().get,f=nc(),h=rc(),d=o("native-string-replace",String.prototype.replace),v=RegExp.prototype.exec,l=v,g=i("".charAt),w=i("".indexOf),m=i("".replace),p=i("".slice),y=(n=/b*/g,r(v,t=/a/,"a"),r(v,n,"a"),0!==t.lastIndex||0!==n.lastIndex),b=u.BROKEN_CARET,E=void 0!==/()??/.exec("")[1],I=function(t,n){for(var r=t.groups=a(null),i=0;i<n.length;i++){var e=n[i];r[e[0]]=t[e[1]]}};return(y||E||b||f||h)&&(l=function(t){var n,i,u,o=this,a=c(o),f=e(t),h=a.raw;if(h)return h.lastIndex=o.lastIndex,n=r(l,h,f),o.lastIndex=h.lastIndex,n&&a.groups&&I(n,a.groups),n;var S=a.groups,T=b&&o.sticky,k=r(s,o),R=o.source,A=0,_=f;if(T){k=m(k,"y",""),-1===w(k,"g")&&(k+="g"),_=p(f,o.lastIndex);var O=o.lastIndex>0&&g(f,o.lastIndex-1);o.lastIndex>0&&(!o.multiline||o.multiline&&"\n"!==O&&"\r"!==O&&"\u2028"!==O&&"\u2029"!==O)&&(R="(?: (?:"+R+"))",_=" "+_,A++),i=new RegExp("^(?:"+R+")",k)}E&&(i=new RegExp("^"+R+"$(?!\\s)",k)),y&&(u=o.lastIndex);var C=r(v,T?i:o,_);return T?C?(C.input=f,C[0]=p(C[0],A),C.index=o.lastIndex,o.lastIndex+=C[0].length):o.lastIndex=0:y&&C&&(o.lastIndex=o.global?C.index+C[0].length:u),E&&C&&C.length>1&&r(d,C[0],i,function(){for(var t=1;t<arguments.length-2;t++)void 0===arguments[t]&&(C[t]=void 0)}),C&&S&&I(C,S),C}),$a=l}function ec(){if(Ja)return Ya;Ja=1;var t=Ti(),n=ic();return t({target:"RegExp",proto:!0,forced:/./.exec!==n},{exec:n}),Ya}ec();var sc,uc,oc,ac,cc,fc,hc,dc={};function vc(){if(uc)return sc;uc=1;var t=Vt(),n=Ft(),r=Cn()("match");return sc=function(i){var e;return t(i)&&(void 0!==(e=i[r])?!!e:"RegExp"===n(i))}}function lc(){if(ac)return oc;ac=1;var t=vc(),n=TypeError;return oc=function(r){if(t(r))throw new n("The method doesn't accept regular expressions");return r}}function gc(){if(fc)return cc;fc=1;var t=Cn()("match");return cc=function(n){var r=/./;try{"/./"[n](r)}catch(i){try{return r[t]=!1,"/./"[n](r)}catch(t){}}return!1}}!function(){if(hc)return dc;hc=1;var t=Ti(),n=Nt(),r=lc(),i=xt(),e=ja(),s=gc(),u=n("".indexOf);t({target:"String",proto:!0,forced:!s("includes")},{includes:function(t){return!!~u(e(i(this)),e(r(t)),arguments.length>1?arguments[1]:void 0)}})}();var wc,mc,pc,yc,bc,Ec,Ic,Sc,Tc,kc,Rc,Ac,_c,Oc,Cc,Dc={};function Nc(){if(mc)return wc;mc=1,ec();var t=z(),n=wr(),r=ic(),i=j(),e=Cn(),s=Kn(),u=e("species"),o=RegExp.prototype;return wc=function(a,c,f,h){var d=e(a),v=!i(function(){var t={};return t[d]=function(){return 7},7!==""[a](t)}),l=v&&!i(function(){var t=!1,n=/a/;if("split"===a){var r={};r[u]=function(){return n},(n={constructor:r,flags:""})[d]=/./[d]}return n.exec=function(){return t=!0,null},n[d](""),!t});if(!v||!l||f){var g=/./[d],w=c(d,""[a],function(n,i,e,s,u){var a=i.exec;return a===r||a===o.exec?v&&!u?{done:!0,value:t(g,i,e,s)}:{done:!0,value:t(n,e,i,s)}:{done:!1}});n(String.prototype,a,w[0]),n(o,d,w[1])}h&&s(o[d],"sham",!0)},wc}function Fc(){if(yc)return pc;yc=1;var t=Nt(),n=Mr(),r=ja(),i=xt(),e=t("".charAt),s=t("".charCodeAt),u=t("".slice),o=function(t){return function(o,a){var c,f,h=r(i(o)),d=n(a),v=h.length;return d<0||d>=v?t?"":void 0:(c=s(h,d))<55296||c>56319||d+1===v||(f=s(h,d+1))<56320||f>57343?t?e(h,d):c:t?u(h,d,d+2):f-56320+(c-55296<<10)+65536}};return pc={codeAt:o(!1),charAt:o(!0)}}function Pc(){if(Ec)return bc;Ec=1;var t=Fc().charAt;return bc=function(n,r,i){return r+(i&&t(n,r).length||1)}}function Mc(){if(Sc)return Ic;Sc=1;var t=Nt(),n=An(),r=Math.floor,i=t("".charAt),e=t("".replace),s=t("".slice),u=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,o=/\$([$&'`]|\d{1,2})/g;return Ic=function(t,a,c,f,h,d){var v=c+t.length,l=f.length,g=o;return void 0!==h&&(h=n(h),g=u),e(d,g,function(n,e){var u;switch(i(e,0)){case"$":return"$";case"&":return t;case"`":return s(a,0,c);case"'":return s(a,v);case"<":u=h[s(e,1,-1)];break;default:var o=+e;if(0===o)return n;if(o>l){var d=r(o/10);return 0===d?n:d<=l?void 0===f[d-1]?i(e,1):f[d-1]+i(e,1):n}u=f[o-1]}return void 0===u?"":u})}}function xc(){if(Ac)return Rc;Ac=1;var t=z(),n=_n(),r=zt(),i=function(){if(kc)return Tc;kc=1;var t=_(),n=j(),r=t.RegExp,i=!n(function(){var t=!0;try{r(".","d")}catch(n){t=!1}var n={},i="",e=t?"dgimsy":"gimsy",s=function(t,r){Object.defineProperty(n,t,{get:function(){return i+=r,!0}})},u={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in t&&(u.hasIndices="d"),u)s(o,u[o]);return Object.getOwnPropertyDescriptor(r.prototype,"flags").get.call(n)!==e||i!==e});return Tc={correct:i}}(),e=Za(),s=RegExp.prototype;return Rc=i.correct?function(t){return t.flags}:function(u){return i.correct||!r(s,u)||n(u,"flags")?u.flags:t(e,u)}}function Uc(){if(Oc)return _c;Oc=1;var t=z(),n=qn(),r=jt(),i=Ft(),e=ic(),s=TypeError;return _c=function(u,o){var a=u.exec;if(r(a)){var c=t(a,u,o);return null!==c&&n(c),c}if("RegExp"===i(u))return t(e,u,o);throw new s("RegExp#exec called on incompatible receiver")}}!function(){if(Cc)return Dc;Cc=1;var t=ks(),n=z(),r=Nt(),i=Nc(),e=j(),s=qn(),u=jt(),o=Vt(),a=Mr(),c=Ur(),f=ja(),h=xt(),d=Pc(),v=$t(),l=Mc(),g=xc(),w=Uc(),m=Cn()("replace"),p=Math.max,y=Math.min,b=r([].concat),E=r([].push),I=r("".indexOf),S=r("".slice),T=function(t){return void 0===t?t:String(t)},k="$0"==="a".replace(/./,"$0"),R=!!/./[m]&&""===/./[m]("a","$0");i("replace",function(r,i,e){var k=R?"$":"$0";return[function(t,r){var e=h(this),s=o(t)?v(t,m):void 0;return s?n(s,t,e,r):n(i,f(e),t,r)},function(n,r){var o=s(this),h=f(n),v=u(r);v||(r=f(r));var m=f(g(o));if("string"==typeof r&&!~I(r,k)&&!~I(r,"$<")&&!~I(m,"y")){var R=e(i,o,h,r);if(R.done)return R.value}var A,_=!!~I(m,"g");_&&(A=!!~I(m,"u")||!!~I(m,"v"),o.lastIndex=0);for(var O,C=[];null!==(O=w(o,h))&&(E(C,O),_);){""===f(O[0])&&(o.lastIndex=d(h,c(o.lastIndex),A))}for(var D="",N=0,F=0;F<C.length;F++){for(var P,M=f((O=C[F])[0]),x=p(y(a(O.index),h.length),0),U=[],j=1;j<O.length;j++)E(U,T(O[j]));var V=O.groups;if(v){var L=b([M],U,x,h);void 0!==V&&E(L,V),P=f(t(r,void 0,L))}else P=l(M,h,x,U,V,r);x>=N&&(D+=S(h,N,x)+P,N=x+M.length)}return D+S(h,N)}]},!!e(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})||!k||R)}();var jc,Vc={};!function(){if(jc)return Vc;jc=1;var t,n=Ti(),r=Rs(),i=Mn().f,e=Ur(),s=ja(),u=lc(),o=xt(),a=gc(),c=Sn(),f=r("".slice),h=Math.min,d=a("startsWith");n({target:"String",proto:!0,forced:!!(c||d||(t=i(String.prototype,"startsWith"),!t||t.writable))&&!d},{startsWith:function(t){var n=s(o(this));u(t);var r=s(t),i=e(h(arguments.length>1?arguments[1]:void 0,n.length));return f(n,i,i+r.length)===r}})}();var Lc,zc,Bc,Gc,Wc,qc,Hc,Kc,Xc,$c,Qc,Jc,Yc,Zc,tf,nf,rf,ef=function(){function t(t){this.baseUrl=t.baseUrl.replace(/\/$/,"")}return t.prototype.request=function(t){return Bu(this,arguments,void 0,function(t,n){var r,i,e,s,u,o,a,c,f,h,d;return void 0===n&&(n={}),Gu(this,function(v){switch(v.label){case 0:r=n.method,i=void 0===r?"GET":r,e=n.headers,s=void 0===e?{}:e,u=n.body,o=!t||t.startsWith("/")?t:"/".concat(t),a="".concat(this.baseUrl).concat(o),v.label=1;case 1:return v.trys.push([1,6,,7]),c={method:i,headers:zu({"Content-Type":"application/json"},s),body:u?JSON.stringify(u):null},[4,fetch(a,c)];case 2:return(f=v.sent()).ok?[3,4]:[4,f.text()];case 3:throw h=v.sent(),new Error("HTTP ".concat(f.status,": ").concat(f.statusText," - ").concat(h));case 4:return[4,f.json()];case 5:return[2,v.sent()];case 6:throw d=v.sent(),this.handleError(d);case 7:return[2]}})})},t.prototype.handleError=function(t){return t instanceof Error?"AbortError"===t.name?{code:ho,message:"Request timeout",details:t}:t.message.includes("HTTP 401")||t.message.includes("HTTP 403")?{code:fo,message:"Authentication failed",details:t}:(t.message.includes("HTTP"),{code:ho,message:t.message,details:t}):{code:ho,message:"Unknown error: ".concat(String(t)),details:t}},t.prototype.get=function(t){return Bu(this,arguments,void 0,function(t,n){return void 0===n&&(n={}),Gu(this,function(r){return[2,this.request(t,zu(zu({},n),{method:"GET"}))]})})},t.prototype.post=function(t,n){return Bu(this,arguments,void 0,function(t,n,r){return void 0===r&&(r={}),Gu(this,function(i){return[2,this.request(t,zu(zu({},r),{method:"POST",body:n}))]})})},t.prototype.put=function(t,n){return Bu(this,arguments,void 0,function(t,n,r){return void 0===r&&(r={}),Gu(this,function(i){return[2,this.request(t,zu(zu({},r),{method:"PUT",body:n}))]})})},t.prototype.delete=function(t){return Bu(this,arguments,void 0,function(t,n){return void 0===n&&(n={}),Gu(this,function(r){return[2,this.request(t,zu(zu({},n),{method:"DELETE"}))]})})},t}(),sf={};function uf(){return zc?Lc:(zc=1,Lc=Object.is||function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n})}function of(){if(Hc)return qc;Hc=1;var t=_n(),n=jt(),r=An(),i=dr(),e=function(){if(Wc)return Gc;Wc=1;var t=j();return Gc=!t(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})}(),s=i("IE_PROTO"),u=Object,o=u.prototype;return qc=e?u.getPrototypeOf:function(i){var e=r(i);if(t(e,s))return e[s];var a=e.constructor;return n(a)&&e instanceof a?a.prototype:e instanceof u?o:null}}function af(){if(Xc)return Kc;Xc=1;var t,n,r,i=j(),e=jt(),s=Vt(),u=$i(),o=of(),a=wr(),c=Cn(),f=Sn(),h=c("iterator"),d=!1;return[].keys&&("next"in(r=[].keys())?(n=o(o(r)))!==Object.prototype&&(t=n):d=!0),!s(t)||i(function(){var n={};return t[h].call(n)!==n})?t={}:f&&(t=u(t)),e(t[h])||a(t,h,function(){return this}),Kc={IteratorPrototype:t,BUGGY_SAFARI_ITERATORS:d}}function cf(){if(Qc)return $c;Qc=1;var t=af().IteratorPrototype,n=$i(),r=Dt(),i=ys(),e=ou(),s=function(){return this};return $c=function(u,o,a,c){var f=o+" Iterator";return u.prototype=n(t,{next:r(+!c,a)}),i(u,f,!1,!0),e[f]=s,u}}function ff(){if(Yc)return Jc;Yc=1;var t=Ti(),n=z(),r=Sn(),i=fr(),e=jt(),s=cf(),u=of(),o=ps(),a=ys(),c=Kn(),f=wr(),h=Cn(),d=ou(),v=af(),l=i.PROPER,g=i.CONFIGURABLE,w=v.IteratorPrototype,m=v.BUGGY_SAFARI_ITERATORS,p=h("iterator"),y="keys",b="values",E="entries",I=function(){return this};return Jc=function(i,h,v,S,T,k,R){s(v,h,S);var A,_,O,C=function(t){if(t===T&&M)return M;if(!m&&t&&t in F)return F[t];switch(t){case y:case b:case E:return function(){return new v(this,t)}}return function(){return new v(this)}},D=h+" Iterator",N=!1,F=i.prototype,P=F[p]||F["@@iterator"]||T&&F[T],M=!m&&P||C(T),x="Array"===h&&F.entries||P;if(x&&(A=u(x.call(new i)))!==Object.prototype&&A.next&&(r||u(A)===w||(o?o(A,w):e(A[p])||f(A,p,I)),a(A,D,!0,!0),r&&(d[D]=I)),l&&T===b&&P&&P.name!==b&&(!r&&g?c(F,"name",b):(N=!0,M=function(){return n(P,this)})),T)if(_={values:C(b),keys:k?M:C(y),entries:C(E)},R)for(O in _)(m||N||!(O in F))&&f(F,O,_[O]);else t({target:h,proto:!0,forced:m||N},_);return r&&!R||F[p]===M||f(F,p,M,{name:T}),d[h]=M,_},Jc}function hf(){return tf?Zc:(tf=1,Zc=function(t,n){return{value:t,done:n}})}function df(){if(rf)return nf;rf=1;var t=Ut(),n=Qi(),r=ou(),i=lr(),e=Hn().f,s=ff(),u=hf(),o=Sn(),a=V(),c="Array Iterator",f=i.set,h=i.getterFor(c);nf=s(Array,"Array",function(n,r){f(this,{type:c,target:t(n),index:0,kind:r})},function(){var t=h(this),n=t.target,r=t.index++;if(!n||r>=n.length)return t.target=null,u(void 0,!0);switch(t.kind){case"keys":return u(r,!1);case"values":return u(n[r],!1)}return u([r,n[r]],!1)},"values");var d=r.Arguments=r.Array;if(n("keys"),n("values"),n("entries"),!o&&a&&"values"!==d.name)try{e(d,"name",{value:"values"})}catch(t){}return nf}!function(){if(Bc)return sf;Bc=1;var t=z(),n=Nc(),r=qn(),i=Vt(),e=xt(),s=uf(),u=ja(),o=$t(),a=Uc();n("search",function(n,c,f){return[function(r){var s=e(this),a=i(r)?o(r,n):void 0;return a?t(a,r,s):new RegExp(r)[n](u(s))},function(t){var n=r(this),i=u(t),e=f(c,n,i);if(e.done)return e.value;var o=n.lastIndex;s(o,0)||(n.lastIndex=0);var h=a(n,i);return s(n.lastIndex,o)||(n.lastIndex=o),null===h?-1:h.index}]})}(),df();var vf,lf,gf,wf,mf,pf={};function yf(){if(lf)return vf;lf=1;var t=jt(),n=Vt(),r=ps();return vf=function(i,e,s){var u,o;return r&&t(u=e.constructor)&&u!==s&&n(o=u.prototype)&&o!==s.prototype&&r(i,o),i}}function bf(){if(wf)return gf;wf=1;var t=Hn().f;return gf=function(n,r,i){i in n||t(n,i,{configurable:!0,get:function(){return r[i]},set:function(t){r[i]=t}})}}!function(){if(mf)return pf;mf=1;var t=V(),n=_(),r=Nt(),i=Si(),e=yf(),s=Kn(),u=$i(),o=Br().f,a=zt(),c=vc(),f=ja(),h=xc(),d=tc(),v=bf(),l=wr(),g=j(),w=_n(),m=lr().enforce,p=Es(),y=Cn(),b=nc(),E=rc(),I=y("match"),S=n.RegExp,T=S.prototype,k=n.SyntaxError,R=r(T.exec),A=r("".charAt),O=r("".replace),C=r("".indexOf),D=r("".slice),N=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,F=/a/g,P=/a/g,M=new S(F)!==F,x=d.MISSED_STICKY,U=d.UNSUPPORTED_Y,L=t&&(!M||x||b||E||g(function(){return P[I]=!1,S(F)!==F||S(P)===P||"/a/i"!==String(S(F,"i"))}));if(i("RegExp",L)){for(var z=function(t,n){var r,i,o,d,v,l,g=a(T,this),p=c(t),y=void 0===n,I=[],_=t;if(!g&&p&&y&&t.constructor===z)return t;if((p||a(T,t))&&(t=t.source,y&&(n=h(_))),t=void 0===t?"":f(t),n=void 0===n?"":f(n),_=t,b&&"dotAll"in F&&(i=!!n&&C(n,"s")>-1)&&(n=O(n,/s/g,"")),r=n,x&&"sticky"in F&&(o=!!n&&C(n,"y")>-1)&&U&&(n=O(n,/y/g,"")),E&&(d=function(t){for(var n,r=t.length,i=0,e="",s=[],o=u(null),a=!1,c=!1,f=0,h="";i<r;i++){if("\\"===(n=A(t,i))){if(n+=A(t,++i),!c&&"\\"===A(n,1)){e+="\\x5c";continue}}else if("]"===n)a=!1;else if(!a)switch(!0){case"["===n:a=!0;break;case"("===n:e+=n,R(N,D(t,i+1))?(i+=2,c=!0,f++):"?"!==A(t,i+1)&&f++;continue;case">"===n&&c:if(""===h||w(o,h))throw new k("Invalid capture group name");o[h]=!0,s[s.length]=[h,f],c=!1,h="";continue}c?h+=n:e+=n}for(var d=0;d<s.length;d++)for(var v="\\k<"+s[d][0]+">",l="\\"+s[d][1];C(e,v)>-1;)e=O(e,v,l);return[e,s]}(t),t=d[0],I=d[1]),v=e(S(t,n),g?this:T,z),(i||o||I.length)&&(l=m(v),i&&(l.dotAll=!0,l.raw=z(function(t){for(var n,r=t.length,i=0,e="",s=!1;i<r;i++)"\\"!==(n=A(t,i))?s||"."!==n?("["===n?s=!0:"]"===n&&(s=!1),e+=n):e+="[\\s\\S]":e+=n+A(t,++i);return e}(t),r)),o&&(l.sticky=!0),I.length&&(l.groups=I)),t!==_)try{s(v,"source",""===_?"(?:)":_)}catch(t){}return v},B=o(S),G=0;B.length>G;)v(z,S,B[G++]);T.constructor=z,z.prototype=T,l(n,"RegExp",z,{constructor:!0})}p("RegExp")}();var Ef,If={};!function(){if(Ef)return If;Ef=1;var t=fr().PROPER,n=wr(),r=qn(),i=ja(),e=j(),s=xc(),u="toString",o=RegExp.prototype,a=o[u],c=e(function(){return"/a/b"!==a.call({source:"a",flags:"b"})}),f=t&&a.name!==u;(c||f)&&n(o,u,function(){var t=r(this);return"/"+i(t.source)+"/"+i(s(t))},{unsafe:!0})}();var Sf,Tf={};function kf(){if(Sf)return Tf;Sf=1;var t=Fc().charAt,n=ja(),r=lr(),i=ff(),e=hf(),s="String Iterator",u=r.set,o=r.getterFor(s);return i(String,"String",function(t){u(this,{type:s,string:n(t),index:0})},function(){var n,r=o(this),i=r.string,s=r.index;return s>=i.length?e(void 0,!0):(n=t(i,s),r.index+=n.length,e(n,!1))}),Tf}kf();var Rf,Af={};!function(){if(Rf)return Af;Rf=1;var t=z(),n=Nt(),r=Nc(),i=qn(),e=Vt(),s=Ur(),u=ja(),o=xt(),a=$t(),c=Pc(),f=xc(),h=Uc(),d=n("".indexOf);r("match",function(n,r,v){return[function(r){var i=o(this),s=e(r)?a(r,n):void 0;return s?t(s,r,i):new RegExp(r)[n](u(i))},function(t){var n=i(this),e=u(t),o=v(r,n,e);if(o.done)return o.value;var a=u(f(n));if(!~d(a,"g"))return h(n,e);var l=!!~d(a,"u")||!!~d(a,"v");n.lastIndex=0;for(var g,w=[],m=0;null!==(g=h(n,e));){var p=u(g[0]);w[m]=p,""===p&&(n.lastIndex=c(e,s(n.lastIndex),l)),m++}return 0===m?null:w}]})}();var _f,Of={};!function(){if(_f)return Of;_f=1;var t=_(),n=Uu(),r=ju(),i=df(),e=Kn(),s=ys(),u=Cn()("iterator"),o=i.values,a=function(t,r){if(t){if(t[u]!==o)try{e(t,u,o)}catch(n){t[u]=o}if(s(t,r,!0),n[r])for(var a in i)if(t[a]!==i[a])try{e(t,a,i[a])}catch(n){t[a]=i[a]}}};for(var c in n)a(t[c]&&t[c].prototype,c);a(r,"DOMTokenList")}();var Cf,Df,Nf,Ff,Pf,Mf,xf,Uf,jf,Vf,Lf={};function zf(){if(Df)return Cf;Df=1;var t=j(),n=Cn(),r=V(),i=Sn(),e=n("iterator");return Cf=!t(function(){var t=new URL("b?a=1&b=2&c=3","https://a"),n=t.searchParams,s=new URLSearchParams("a=1&a=2&b=3"),u="";return t.pathname="c%20d",n.forEach(function(t,r){n.delete("b"),u+=r+t}),s.delete("a",2),s.delete("b",void 0),i&&(!t.toJSON||!s.has("a",1)||s.has("a",2)||!s.has("a",void 0)||s.has("b"))||!n.size&&(i||!r)||!n.sort||"https://a/c%20d?a=1&c=3"!==t.href||"3"!==n.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!n[e]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==u||"x"!==new URL("https://x",void 0).host})}function Bf(){if(Mf)return Pf;Mf=1;var t=qn(),n=hu();return Pf=function(r,i,e,s){try{return s?i(t(e)[0],e[1]):i(e)}catch(t){n(r,"throw",t)}}}function Gf(){if(Uf)return xf;Uf=1;var t=As(),n=z(),r=An(),i=Bf(),e=au(),s=Di(),u=jr(),o=Ai(),a=_i(),c=fu(),f=cu(),h=hu(),d=Array;return xf=function(v){var l=s(this),g=arguments.length,w=g>1?arguments[1]:void 0,m=void 0!==w;m&&(w=t(w,g>2?arguments[2]:void 0));var p,y,b,E,I,S,T=r(v),k=f(T),R=0;if(!k||this===d&&e(k))for(p=u(T),y=l?new this(p):d(p);p>R;R++)S=m?w(T[R],R):T[R],o(y,R,S);else for(y=l?new this:[],I=(E=c(T,k)).next;!(b=n(I,E)).done;R++){S=m?i(E,w,[b.value,R],!0):b.value;try{o(y,R,S)}catch(t){h(E,"throw",t)}}return a(y,R),y},xf}function Wf(){if(Vf)return jf;Vf=1;var t=Nt(),n=2147483647,r=/[^\0-\u007E]/,i=/[.\u3002\uFF0E\uFF61]/g,e="Overflow: input needs wider integers to process",s=RangeError,u=t(i.exec),o=Math.floor,a=String.fromCharCode,c=t("".charCodeAt),f=t([].join),h=t([].push),d=t("".replace),v=t("".split),l=t("".toLowerCase),g=function(t){return t+22+75*(t<26)},w=function(t,n,r){var i=0;for(t=r?o(t/700):t>>1,t+=o(t/n);t>455;)t=o(t/35),i+=36;return o(i+36*t/(t+38))},m=function(t){var r=[];t=function(t){for(var n=[],r=0,i=t.length;r<i;){var e=c(t,r++);if(e>=55296&&e<=56319&&r<i){var s=c(t,r++);56320==(64512&s)?h(n,((1023&e)<<10)+(1023&s)+65536):(h(n,e),r--)}else h(n,e)}return n}(t);var i,u,d=t.length,v=128,l=0,m=72;for(i=0;i<t.length;i++)(u=t[i])<128&&h(r,a(u));var p=r.length,y=p;for(p&&h(r,"-");y<d;){var b=n;for(i=0;i<t.length;i++)(u=t[i])>=v&&u<b&&(b=u);var E=y+1;if(b-v>o((n-l)/E))throw new s(e);for(l+=(b-v)*E,v=b,i=0;i<t.length;i++){if((u=t[i])<v&&++l>n)throw new s(e);if(u===v){for(var I=l,S=36;;){var T=S<=m?1:S>=m+26?26:S-m;if(I<T)break;var k=I-T,R=36-T;h(r,a(g(T+k%R))),I=o(k/R),S+=36}h(r,a(g(I))),m=w(l,E,y===p),l=0,y++}}l++,v++}return f(r,"")};return jf=function(t){var n,e,s=[],o=v(d(l(t),i,"."),".");for(n=0;n<o.length;n++)e=o[n],h(s,u(r,e)?"xn--"+m(e):e);return f(s,".")}}var qf,Hf,Kf,Xf,$f,Qf,Jf,Yf,Zf,th={};function nh(){if(Kf)return Hf;Kf=1;var t=wr();return Hf=function(n,r,i){for(var e in r)t(n,e,r[e],i);return n}}function rh(){if($f)return Xf;$f=1;var t=_s(),n=Math.floor,r=function(i,e){var s=i.length;if(s<8)for(var u,o,a=1;a<s;){for(o=a,u=i[a];o&&e(i[o-1],u)>0;)i[o]=i[--o];o!==a++&&(i[o]=u)}else for(var c=n(s/2),f=r(t(i,0,c),e),h=r(t(i,c),e),d=f.length,v=h.length,l=0,g=0;l<d||g<v;)i[l+g]=l<d&&g<v?e(f[l],h[g])<=0?f[l++]:h[g++]:l<d?f[l++]:h[g++];return i};return Xf=r}function ih(){if(Jf)return Qf;Jf=1,df(),function(){if(qf)return th;qf=1;var t=Ti(),n=Nt(),r=xr(),i=RangeError,e=String.fromCharCode,s=String.fromCodePoint,u=n([].join);t({target:"String",stat:!0,arity:1,forced:!!s&&1!==s.length},{fromCodePoint:function(t){for(var n,s=[],o=arguments.length,a=0;o>a;){if(r(n=+arguments[a],1114111)!==n)throw new i(n+" is not a valid code point");s[a++]=n<65536?e(n):e(55296+((n-=65536)>>10),n%1024+56320)}return u(s,"")}})}();var t=Ti(),n=_(),r=Ns(),i=Lt(),e=z(),s=Nt(),u=V(),o=zf(),a=wr(),c=bs(),f=nh(),h=ys(),d=cf(),v=lr(),l=Is(),g=jt(),w=_n(),m=As(),p=Ci(),y=qn(),b=Vt(),E=ja(),I=$i(),S=Dt(),T=fu(),k=cu(),R=hf(),A=Os(),O=Cn(),C=rh(),D=O("iterator"),N="URLSearchParams",F=N+"Iterator",P=v.set,M=v.getterFor(N),x=v.getterFor(F),U=r("fetch"),j=r("Request"),L=r("Headers"),B=j&&j.prototype,G=L&&L.prototype,W=n.TypeError,q=n.encodeURIComponent,H=String.fromCharCode,K=i("String","fromCodePoint"),X=parseInt,$=s("".charAt),Q=s([].join),J=s([].push),Y=s("".replace),Z=s([].shift),tt=s([].splice),nt=s("".split),rt=s("".slice),it=s(/./.exec),et=/\+/g,st=/^[0-9a-f]+$/i,ut=function(t,n){var r=rt(t,n,n+2);return it(st,r)?X(r,16):NaN},ot=function(t){for(var n=0,r=128;r>0&&0!==(t&r);r>>=1)n++;return n},at=function(t){var n=null,r=t.length;switch(r){case 1:n=t[0];break;case 2:n=(31&t[0])<<6|63&t[1];break;case 3:n=(15&t[0])<<12|(63&t[1])<<6|63&t[2];break;case 4:n=(7&t[0])<<18|(63&t[1])<<12|(63&t[2])<<6|63&t[3]}return null===n||n>1114111||n>=55296&&n<=57343||n<(r>3?65536:r>2?2048:r>1?128:0)?null:n},ct=function(t){for(var n=(t=Y(t,et," ")).length,r="",i=0;i<n;){var e=$(t,i);if("%"===e){if("%"===$(t,i+1)||i+3>n){r+="%",i++;continue}var s=ut(t,i+1);if(s!=s){r+=e,i++;continue}i+=2;var u=ot(s);if(0===u)e=H(s);else{if(1===u||u>4){r+="�",i++;continue}for(var o=[s],a=1;a<u&&!(++i+3>n||"%"!==$(t,i));){var c=ut(t,i+1);if(c!=c||c>191||c<128)break;if(1===a){if(224===s&&c<160)break;if(237===s&&c>159)break;if(240===s&&c<144)break;if(244===s&&c>143)break}J(o,c),i+=2,a++}if(o.length!==u){r+="�";continue}var f=at(o);if(null===f){for(var h=0;h<u;h++)r+="�";i++;continue}e=K(f)}}r+=e,i++}return r},ft=/[!'()~]|%20/g,ht={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},dt=function(t){return ht[t]},vt=function(t){return Y(q(t),ft,dt)},lt=d(function(t,n){P(this,{type:F,target:M(t).entries,index:0,kind:n})},N,function(){var t=x(this),n=t.target,r=t.index++;if(!n||r>=n.length)return t.target=null,R(void 0,!0);var i=n[r];switch(t.kind){case"keys":return R(i.key,!1);case"values":return R(i.value,!1)}return R([i.key,i.value],!1)},!0),gt=function(t){this.entries=[],this.url=null,void 0!==t&&(b(t)?this.parseObject(t):this.parseQuery("string"==typeof t?"?"===$(t,0)?rt(t,1):t:E(t)))};gt.prototype={type:N,bindURL:function(t){this.url=t,this.update()},parseObject:function(t){var n,r,i,s,u,o,a,c=this.entries,f=k(t);if(f)for(r=(n=T(t,f)).next;!(i=e(r,n)).done;){if(u=(s=T(y(i.value))).next,(o=e(u,s)).done||(a=e(u,s)).done||!e(u,s).done)throw new W("Expected sequence with length 2");J(c,{key:E(o.value),value:E(a.value)})}else for(var h in t)w(t,h)&&J(c,{key:h,value:E(t[h])})},parseQuery:function(t){if(t)for(var n,r,i=this.entries,e=nt(t,"&"),s=0;s<e.length;)(n=e[s++]).length&&(r=nt(n,"="),J(i,{key:ct(Z(r)),value:ct(Q(r,"="))}))},serialize:function(){for(var t,n=this.entries,r=[],i=0;i<n.length;)t=n[i++],J(r,vt(t.key)+"="+vt(t.value));return Q(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var wt=function(){l(this,mt);var t=P(this,new gt(arguments.length>0?arguments[0]:void 0));u||(this.size=t.entries.length)},mt=wt.prototype;if(f(mt,{append:function(t,n){var r=M(this);A(arguments.length,2),J(r.entries,{key:E(t),value:E(n)}),u||this.size++,r.updateURL()},delete:function(t){for(var n=M(this),r=A(arguments.length,1),i=n.entries,e=E(t),s=r<2?void 0:arguments[1],o=void 0===s?s:E(s),a=0;a<i.length;){var c=i[a];c.key!==e||void 0!==o&&c.value!==o?a++:tt(i,a,1)}u||(this.size=i.length),n.updateURL()},get:function(t){var n=M(this).entries;A(arguments.length,1);for(var r=E(t),i=0;i<n.length;i++)if(n[i].key===r)return n[i].value;return null},getAll:function(t){var n=M(this).entries;A(arguments.length,1);for(var r=E(t),i=[],e=0;e<n.length;e++)n[e].key===r&&J(i,n[e].value);return i},has:function(t){for(var n=M(this).entries,r=A(arguments.length,1),i=E(t),e=r<2?void 0:arguments[1],s=void 0===e?e:E(e),u=0;u<n.length;){var o=n[u++];if(o.key===i&&(void 0===s||o.value===s))return!0}return!1},set:function(t,n){var r=M(this);A(arguments.length,2);for(var i,e=r.entries,s=!1,o=E(t),a=E(n),c=0;c<e.length;c++)(i=e[c]).key===o&&(s?tt(e,c--,1):(s=!0,i.value=a));s||J(e,{key:o,value:a}),u||(this.size=e.length),r.updateURL()},sort:function(){var t=M(this);C(t.entries,function(t,n){return t.key>n.key?1:-1}),t.updateURL()},forEach:function(t){for(var n,r=M(this).entries,i=m(t,arguments.length>1?arguments[1]:void 0),e=0;e<r.length;)i((n=r[e++]).value,n.key,this)},keys:function(){return new lt(this,"keys")},values:function(){return new lt(this,"values")},entries:function(){return new lt(this,"entries")}},{enumerable:!0}),a(mt,D,mt.entries,{name:"entries"}),a(mt,"toString",function(){return M(this).serialize()},{enumerable:!0}),u&&c(mt,"size",{get:function(){return M(this).entries.length},configurable:!0,enumerable:!0}),h(wt,N),t({global:!0,constructor:!0,forced:!o},{URLSearchParams:wt}),!o&&g(L)){var pt=s(G.has),yt=s(G.set),bt=function(t){if(b(t)){var n,r=t.body;if(p(r)===N)return n=t.headers?new L(t.headers):new L,pt(n,"content-type")||yt(n,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),I(t,{body:S(0,E(r)),headers:S(0,n)})}return t};if(g(U)&&t({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(t){return U(t,arguments.length>1?bt(arguments[1]):{})}}),g(j)){var Et=function(t){return l(this,B),new j(t,arguments.length>1?bt(arguments[1]):{})};B.constructor=Et,Et.prototype=B,t({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Et})}}return Qf={URLSearchParams:wt,getState:M}}function eh(){if(Yf)return Lf;Yf=1,kf();var t,n=Ti(),r=V(),i=zf(),e=_(),s=As(),u=Nt(),o=wr(),a=bs(),c=Is(),f=_n(),h=function(){if(Ff)return Nf;Ff=1;var t=V(),n=Nt(),r=z(),i=j(),e=Ki(),s=bi(),u=Ct(),o=An(),a=Pt(),c=Object.assign,f=Object.defineProperty,h=n([].concat);return Nf=!c||i(function(){if(t&&1!==c({b:1},c(f({},"a",{enumerable:!0,get:function(){f(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var n={},r={},i=Symbol("assign detection"),s="abcdefghijklmnopqrst";return n[i]=7,s.split("").forEach(function(t){r[t]=t}),7!==c({},n)[i]||e(c({},r)).join("")!==s})?function(n,i){for(var c=o(n),f=arguments.length,d=1,v=s.f,l=u.f;f>d;)for(var g,w=a(arguments[d++]),m=v?h(e(w),v(w)):e(w),p=m.length,y=0;p>y;)g=m[y++],t&&!r(l,w,g)||(c[g]=w[g]);return c}:c,Nf}(),d=Gf(),v=_s(),l=Fc().codeAt,g=Wf(),w=ja(),m=ys(),p=Os(),y=ih(),b=lr(),E=b.set,I=b.getterFor("URL"),S=y.URLSearchParams,T=y.getState,k=e.URL,R=e.TypeError,A=e.encodeURIComponent,O=e.parseInt,C=Math.floor,D=Math.pow,N=u("".charAt),F=u(/./.exec),P=u([].join),M=u(1.1.toString),x=u([].pop),U=u([].push),L=u("".replace),B=u([].shift),G=u("".split),W=u("".slice),q=u("".toLowerCase),H=u([].unshift),K="Invalid scheme",X="Invalid host",$="Invalid port",Q=/[a-z]/i,J=/[\d+\-.a-z]/i,Y=/\d/,Z=/^0x/i,tt=/^[0-7]+$/,nt=/^\d+$/,rt=/^[\da-f]+$/i,it=/[\0\t\n\r #%/:<>?@[\\\]^|]/,et=/[\0\t\n\r #/:<>?@[\\\]^|]/,st=/^[\u0000-\u0020]+/,ut=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,ot=/[\t\n\r]/g,at=function(t){var n,r,i,e;if("number"==typeof t){for(n=[],r=0;r<4;r++)H(n,t%256),t=C(t/256);return P(n,".")}if("object"==typeof t){for(n="",i=function(t){for(var n=null,r=1,i=null,e=0,s=0;s<8;s++)0!==t[s]?(e>r&&(n=i,r=e),i=null,e=0):(null===i&&(i=s),++e);return e>r?i:n}(t),r=0;r<8;r++)e&&0===t[r]||(e&&(e=!1),i===r?(n+=r?":":"::",e=!0):(n+=M(t[r],16),r<7&&(n+=":")));return"["+n+"]"}return t},ct={},ft=h({},ct,{" ":1,'"':1,"#":1,"<":1,">":1}),ht=h({},ft,{"'":1}),dt=h({},ct,{" ":1,'"':1,"<":1,">":1,"`":1}),vt=h({},dt,{"#":1,"?":1,"{":1,"}":1,"^":1}),lt=h({},vt,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),gt=function(t,n){var r=l(t,0);return r>=32&&r<127&&!f(n,t)?t:"'"===t&&f(n,t)?"%27":A(t)},wt={ftp:21,file:null,http:80,https:443,ws:80,wss:443},mt=function(t,n){var r;return 2===t.length&&F(Q,N(t,0))&&(":"===(r=N(t,1))||!n&&"|"===r)},pt=function(t){var n;return t.length>1&&mt(W(t,0,2))&&(2===t.length||"/"===(n=N(t,2))||"\\"===n||"?"===n||"#"===n)},yt=function(t){return"."===t||"%2e"===q(t)},bt=function(t){return".."===(t=q(t))||"%2e."===t||".%2e"===t||"%2e%2e"===t},Et={},It={},St={},Tt={},kt={},Rt={},At={},_t={},Ot={},Dt={},Ft={},Mt={},xt={},Ut={},jt={},Vt={},Lt={},zt={},Bt={},Gt={},Wt={},qt=function(t,n,r){var i,e,s,u=w(t);if(n){if(e=this.parse(u))throw new R(e);this.searchParams=null}else{if(void 0!==r&&(i=new qt(r,!0)),e=this.parse(u,null,i))throw new R(e);(s=T(new S)).bindURL(this),this.searchParams=s}};qt.prototype={type:"URL",parse:function(n,r,i){var e,s,u,o,a=this,c=r||Et,h=0,l="",g=!1,m=!1,p=!1;for(n=w(n),r||(a.scheme="",a.username="",a.password="",a.host=null,a.port=null,a.path=[],a.query=null,a.fragment=null,a.cannotBeABaseURL=!1,n=L(n,st,""),n=L(n,ut,"$1")),n=L(n,ot,""),e=d(n);h<=e.length;){switch(s=e[h],c){case Et:if(!s||!F(Q,s)){if(r)return K;c=St;continue}l+=q(s),c=It;break;case It:if(s&&F(J,s))l+=q(s);else{if(":"!==s){if(r)return K;l="",c=St,h=0;continue}if(r&&(a.isSpecial()!==f(wt,l)||"file"===l&&(a.includesCredentials()||null!==a.port)||"file"===a.scheme&&""===a.host))return;if(a.scheme=l,r)return void(a.isSpecial()&&wt[a.scheme]===a.port&&(a.port=null));l="","file"===a.scheme?c=Ut:a.isSpecial()&&i&&i.scheme===a.scheme?c=Tt:a.isSpecial()?c=_t:"/"===e[h+1]?(c=kt,h++):(a.cannotBeABaseURL=!0,U(a.path,""),c=Bt)}break;case St:if(!i||i.cannotBeABaseURL&&"#"!==s)return K;if(i.cannotBeABaseURL&&"#"===s){a.scheme=i.scheme,a.path=v(i.path),a.query=i.query,a.fragment="",a.cannotBeABaseURL=!0,c=Wt;break}c="file"===i.scheme?Ut:Rt;continue;case Tt:if("/"!==s||"/"!==e[h+1]){c=Rt;continue}c=Ot,h++;break;case kt:if("/"===s){c=Dt;break}c=zt;continue;case Rt:if(a.scheme=i.scheme,s===t)a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,a.path=v(i.path),a.query=i.query;else if("/"===s||"\\"===s&&a.isSpecial())c=At;else if("?"===s)a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,a.path=v(i.path),a.query="",c=Gt;else{if("#"!==s){a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,a.path=v(i.path),a.path.length&&a.path.length--,c=zt;continue}a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,a.path=v(i.path),a.query=i.query,a.fragment="",c=Wt}break;case At:if(!a.isSpecial()||"/"!==s&&"\\"!==s){if("/"!==s){a.username=i.username,a.password=i.password,a.host=i.host,a.port=i.port,c=zt;continue}c=Dt}else c=Ot;break;case _t:if(c=Ot,"/"!==s||"/"!==e[h+1])continue;h++;break;case Ot:if("/"!==s&&"\\"!==s){c=Dt;continue}break;case Dt:if("@"===s){g&&(l="%40"+l),g=!0,u=d(l);for(var y=0;y<u.length;y++){var b=u[y];if(":"!==b||p){var E=gt(b,lt);p?a.password+=E:a.username+=E}else p=!0}l=""}else if(s===t||"/"===s||"?"===s||"#"===s||"\\"===s&&a.isSpecial()){if(g&&""===l)return"Invalid authority";h-=d(l).length+1,l="",c=Ft}else l+=s;break;case Ft:case Mt:if(r&&"file"===a.scheme){c=Vt;continue}if(":"!==s||m){if(s===t||"/"===s||"?"===s||"#"===s||"\\"===s&&a.isSpecial()){if(a.isSpecial()&&""===l)return X;if(r&&""===l&&(a.includesCredentials()||null!==a.port))return;if(o=a.parseHost(l))return o;if(l="",c=Lt,r)return;continue}"["===s?m=!0:"]"===s&&(m=!1),l+=s}else{if(""===l)return X;if(r===Mt)return;if(o=a.parseHost(l))return o;l="",c=xt}break;case xt:if(!F(Y,s)){if(s===t||"/"===s||"?"===s||"#"===s||"\\"===s&&a.isSpecial()||r){if(""!==l){var I=O(l,10);if(I>65535)return $;a.port=a.isSpecial()&&I===wt[a.scheme]?null:I,l=""}if(r)return;c=Lt;continue}return $}l+=s;break;case Ut:if(a.scheme="file",a.host="","/"===s||"\\"===s)c=jt;else{if(!i||"file"!==i.scheme){c=zt;continue}switch(s){case t:a.host=i.host,a.path=v(i.path),a.query=i.query;break;case"?":a.host=i.host,a.path=v(i.path),a.query="",c=Gt;break;case"#":a.host=i.host,a.path=v(i.path),a.query=i.query,a.fragment="",c=Wt;break;default:a.host=i.host,pt(P(v(e,h),""))||(a.path=v(i.path),a.shortenPath()),c=zt;continue}}break;case jt:if("/"===s||"\\"===s){c=Vt;break}i&&"file"===i.scheme&&(a.host=i.host,!pt(P(v(e,h),""))&&mt(i.path[0],!0)&&U(a.path,i.path[0])),c=zt;continue;case Vt:if(s===t||"/"===s||"\\"===s||"?"===s||"#"===s){if(!r&&mt(l))c=zt;else if(""===l){if(a.host="",r)return;c=Lt}else{if(o=a.parseHost(l))return o;if("localhost"===a.host&&(a.host=""),r)return;l="",c=Lt}continue}l+=s;break;case Lt:if(a.isSpecial()){if(c=zt,"/"!==s&&"\\"!==s)continue}else if(r||"?"!==s)if(r||"#"!==s){if(s!==t&&(c=zt,"/"!==s))continue}else a.fragment="",c=Wt;else a.query="",c=Gt;break;case zt:if(s===t||"/"===s||"\\"===s&&a.isSpecial()||!r&&("?"===s||"#"===s)){if(bt(l)?(a.shortenPath(),"/"===s||"\\"===s&&a.isSpecial()||U(a.path,"")):yt(l)?"/"===s||"\\"===s&&a.isSpecial()||U(a.path,""):("file"===a.scheme&&!a.path.length&&mt(l)&&(null!==a.host&&""!==a.host&&(a.host=""),l=N(l,0)+":"),U(a.path,l)),l="","file"===a.scheme&&(s===t||"?"===s||"#"===s))for(;a.path.length>1&&""===a.path[0];)B(a.path);"?"===s?(a.query="",c=Gt):"#"===s&&(a.fragment="",c=Wt)}else l+=gt(s,vt);break;case Bt:"?"===s?(a.query="",c=Gt):"#"===s?(a.fragment="",c=Wt):s!==t&&(a.path[0]+=gt(s,ct));break;case Gt:r||"#"!==s?s!==t&&(a.query+=gt(s,a.isSpecial()?ht:ft)):(a.fragment="",c=Wt);break;case Wt:s!==t&&(a.fragment+=gt(s,dt))}h++}},parseHost:function(t){var n,r,i;if("["===N(t,0)){if("]"!==N(t,t.length-1))return X;if(n=function(t){var n,r,i,e,s,u,o,a=[0,0,0,0,0,0,0,0],c=0,f=null,h=0,d=function(){return N(t,h)};if(":"===d()){if(":"!==N(t,1))return;h+=2,f=++c}for(;d();){if(8===c)return;if(":"!==d()){for(n=r=0;r<4&&F(rt,d());)n=16*n+O(d(),16),h++,r++;if("."===d()){if(0===r)return;if(h-=r,c>6)return;for(i=0;d();){if(e=null,i>0){if(!("."===d()&&i<4))return;h++}if(!F(Y,d()))return;for(;F(Y,d());){if(s=O(d(),10),null===e)e=s;else{if(0===e)return;e=10*e+s}if(e>255)return;h++}a[c]=256*a[c]+e,2!==++i&&4!==i||c++}if(4!==i)return;break}if(":"===d()){if(h++,!d())return}else if(d())return;a[c++]=n}else{if(null!==f)return;h++,f=++c}}if(null!==f)for(u=c-f,c=7;0!==c&&u>0;)o=a[c],a[c--]=a[f+u-1],a[f+--u]=o;else if(8!==c)return;return a}(W(t,1,-1)),!n)return X;this.host=n}else if(this.isSpecial()){if(t=g(t),F(it,t))return X;if(function(t){var n,r,i=G(t,".");if(""===i[i.length-1]){if(1===i.length)return!1;i.length--}return n=i[i.length-1],!!F(nt,n)||!!F(Z,n)&&(""===(r=W(n,2))||!!F(rt,r))}(t)){if(n=function(t){var n,r,i,e,s,u,o,a=G(t,".");if(a.length&&""===a[a.length-1]&&a.length--,(n=a.length)>4)return null;for(r=[],i=0;i<n;i++){if(""===(e=a[i]))return null;if(s=10,e.length>1&&"0"===N(e,0)&&(s=F(Z,e)?16:8,e=W(e,8===s?1:2)),""===e)u=0;else{if(!F(10===s?nt:8===s?tt:rt,e))return null;u=O(e,s)}U(r,u)}for(i=0;i<n;i++)if(u=r[i],i===n-1){if(u>=D(256,5-n))return null}else if(u>255)return null;for(o=x(r),i=0;i<r.length;i++)o+=r[i]*D(256,3-i);return o}(t),null===n)return X;this.host=n}else this.host=t}else{if(F(et,t))return X;for(n="",r=d(t),i=0;i<r.length;i++)n+=gt(r[i],ct);this.host=n}},cannotHaveUsernamePasswordPort:function(){return null===this.host||""===this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return f(wt,this.scheme)},shortenPath:function(){var t=this.path,n=t.length;!n||"file"===this.scheme&&1===n&&mt(t[0],!0)||t.length--},serialize:function(){var t=this,n=t.scheme,r=t.username,i=t.password,e=t.host,s=t.port,u=t.path,o=t.query,a=t.fragment,c=n+":";return null!==e?(c+="//",t.includesCredentials()&&(c+=r+(i?":"+i:"")+"@"),c+=at(e),null!==s&&(c+=":"+s)):"file"===n&&(c+="//"),null===e&&!t.cannotBeABaseURL&&u.length>1&&""===u[0]&&(c+="/."),c+=t.cannotBeABaseURL?u[0]:u.length?"/"+P(u,"/"):"",null!==o&&(c+="?"+o),null!==a&&(c+="#"+a),c},setHref:function(t){var n=this.parse(t);if(n)throw new R(n);this.searchParams.update()},getOrigin:function(){var t=this.scheme,n=this.port;if("blob"===t)try{return new Ht(this.path[0]).origin}catch(t){return"null"}return"file"!==t&&this.isSpecial()?t+"://"+at(this.host)+(null!==n?":"+n:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(t){this.parse(w(t)+":",Et)},getUsername:function(){return this.username},setUsername:function(t){var n=d(w(t));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<n.length;r++)this.username+=gt(n[r],lt)}},getPassword:function(){return this.password},setPassword:function(t){var n=d(w(t));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<n.length;r++)this.password+=gt(n[r],lt)}},getHost:function(){var t=this.host,n=this.port;return null===t?"":null===n?at(t):at(t)+":"+n},setHost:function(t){this.cannotBeABaseURL||this.parse(t,Ft)},getHostname:function(){var t=this.host;return null===t?"":at(t)},setHostname:function(t){this.cannotBeABaseURL||this.parse(t,Mt)},getPort:function(){var t=this.port;return null===t?"":w(t)},setPort:function(t){this.cannotHaveUsernamePasswordPort()||(""===(t=w(t))?this.port=null:this.parse(t,xt))},getPathname:function(){var t=this.path;return this.cannotBeABaseURL?t[0]:t.length?"/"+P(t,"/"):""},setPathname:function(t){this.cannotBeABaseURL||(this.path=[],this.parse(t,Lt))},getSearch:function(){var t=this.query;return t?"?"+t:""},setSearch:function(t){""===(t=w(t))?this.query=null:("?"===N(t,0)&&(t=W(t,1)),this.query="",this.parse(t,Gt)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var t=this.fragment;return t?"#"+t:""},setHash:function(t){""!==(t=w(t))?("#"===N(t,0)&&(t=W(t,1)),this.fragment="",this.parse(t,Wt)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Ht=function(t){var n=c(this,Kt),i=p(arguments.length,1)>1?arguments[1]:void 0,e=E(n,new qt(t,!1,i));r||(n.href=e.serialize(),n.origin=e.getOrigin(),n.protocol=e.getProtocol(),n.username=e.getUsername(),n.password=e.getPassword(),n.host=e.getHost(),n.hostname=e.getHostname(),n.port=e.getPort(),n.pathname=e.getPathname(),n.search=e.getSearch(),n.searchParams=e.getSearchParams(),n.hash=e.getHash())},Kt=Ht.prototype,Xt=function(t,n){return{get:function(){return I(this)[t]()},set:n&&function(t){return I(this)[n](t)},configurable:!0,enumerable:!0}};if(r&&(a(Kt,"href",Xt("serialize","setHref")),a(Kt,"origin",Xt("getOrigin")),a(Kt,"protocol",Xt("getProtocol","setProtocol")),a(Kt,"username",Xt("getUsername","setUsername")),a(Kt,"password",Xt("getPassword","setPassword")),a(Kt,"host",Xt("getHost","setHost")),a(Kt,"hostname",Xt("getHostname","setHostname")),a(Kt,"port",Xt("getPort","setPort")),a(Kt,"pathname",Xt("getPathname","setPathname")),a(Kt,"search",Xt("getSearch","setSearch")),a(Kt,"searchParams",Xt("getSearchParams")),a(Kt,"hash",Xt("getHash","setHash"))),o(Kt,"toJSON",function(){return I(this).serialize()},{enumerable:!0}),o(Kt,"toString",function(){return I(this).serialize()},{enumerable:!0}),k){var $t=k.createObjectURL,Qt=k.revokeObjectURL;$t&&o(Ht,"createObjectURL",s($t,k)),Qt&&o(Ht,"revokeObjectURL",s(Qt,k))}return m(Ht,"URL"),n({global:!0,constructor:!0,forced:!i,sham:!r},{URL:Ht}),Lf}Zf||(Zf=1,eh());var sh,uh={};!function(){if(sh)return uh;sh=1;var t=Ti(),n=z();t({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return n(URL.prototype.toString,this)}})}();var oh;function ah(t,n){var r;if("undefined"!=typeof URLSearchParams)return new URLSearchParams(t).get(n);var i=new RegExp("[?&]"+n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"=([^&#]*)"),e=t.match(i);return e?decodeURIComponent(null!==(r=e[1])&&void 0!==r?r:""):null}function ch(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return"UTC"}}function fh(t){var n,r={campaignName:ah(n=window.location.search,"utm_campaign")||"",campaignSource:ah(n,"utm_source")||"",campaignMedium:ah(n,"utm_medium")||""};return{libraryName:"cap-hydra-web-sdk",libraryVersion:Ra,locale:navigator.language||navigator.languages&&navigator.languages[0]||"en-US",userAgent:navigator.userAgent||"",timezone:ch(),ip:"",campaignName:r.campaignName,campaignSource:r.campaignSource,campaignMedium:r.campaignMedium,pageUrl:window.location.href||"",pagePath:window.location.pathname||"",pageReferrer:document.referrer||"",pageTitle:document.title||"",sessionId:t}}oh||(oh=1,ih());var hh,dh={};!function(){if(hh)return dh;hh=1;var t=Ti(),n=Gf();t({target:"Array",stat:!0,forced:!vu()(function(t){Array.from(t)})},{from:n})}();var vh,lh={};!function(){if(vh)return lh;vh=1;var t=Ti(),n=Vu().map;t({target:"Array",proto:!0,forced:!Pi()("map")},{map:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}})}();var gh,wh,mh,ph,yh,bh,Eh,Ih,Sh,Th,kh,Rh,Ah,_h,Oh,Ch,Dh,Nh,Fh,Ph={};function Mh(){return wh?gh:(wh=1,gh="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView)}function xh(){if(ph)return mh;ph=1;var t=Mr(),n=Ur(),r=RangeError;return mh=function(i){if(void 0===i)return 0;var e=t(i),s=n(e);if(e!==s)throw new r("Wrong length or index");return s}}function Uh(){if(Th)return Sh;Th=1;var t=bh?yh:(bh=1,yh=Math.sign||function(t){var n=+t;return 0===n||n!=n?n:n<0?-1:1}),n=function(){if(Ih)return Eh;Ih=1;var t=4503599627370496;return Eh=function(n){return n+t-t}}(),r=Math.abs;return Sh=function(i,e,s,u){var o=+i,a=r(o),c=t(o);if(a<u)return c*n(a/u/e)*u*e;var f=(1+e/2220446049250313e-31)*a,h=f-(f-a);return h>s||h!=h?c*(1/0):c*h}}function jh(){if(_h)return Ah;_h=1;var t=Array,n=Math.abs,r=Math.pow,i=Math.floor,e=Math.log,s=Math.LN2;return Ah={pack:function(u,o,a){var c,f,h,d=t(a),v=8*a-o-1,l=(1<<v)-1,g=l>>1,w=23===o?r(2,-24)-r(2,-77):0,m=u<0||0===u&&1/u<0?1:0,p=0;for((u=n(u))!=u||u===1/0?(f=u!=u?1:0,c=l):(c=i(e(u)/s),u*(h=r(2,-c))<1&&(c--,h*=2),(u+=c+g>=1?w/h:w*r(2,1-g))*h>=2&&(c++,h/=2),c+g>=l?(f=0,c=l):c+g>=1?(f=(u*h-1)*r(2,o),c+=g):(f=u*r(2,g-1)*r(2,o),c=0));o>=8;)d[p++]=255&f,f/=256,o-=8;for(c=c<<o|f,v+=o;v>0;)d[p++]=255&c,c/=256,v-=8;return d[p-1]|=128*m,d},unpack:function(t,n){var i,e=t.length,s=8*e-n-1,u=(1<<s)-1,o=u>>1,a=s-7,c=e-1,f=t[c--],h=127&f;for(f>>=7;a>0;)h=256*h+t[c--],a-=8;for(i=h&(1<<-a)-1,h>>=-a,a+=n;a>0;)i=256*i+t[c--],a-=8;if(0===h)h=1-o;else{if(h===u)return i?NaN:f?-1/0:1/0;i+=r(2,n),h-=o}return(f?-1:1)*i*r(2,h-n)}}}function Vh(){if(Ch)return Oh;Ch=1;var t=An(),n=xr(),r=jr();return Oh=function(i){for(var e=t(this),s=r(e),u=arguments.length,o=n(u>1?arguments[1]:void 0,s),a=u>2?arguments[2]:void 0,c=void 0===a?s:n(a,s);c>o;)e[o++]=i;return e},Oh}function Lh(){if(Nh)return Dh;Nh=1;var t=_(),n=Nt(),r=V(),i=Mh(),e=fr(),s=Kn(),u=bs(),o=nh(),a=j(),c=Is(),f=Mr(),h=xh(),d=function(){if(Rh)return kh;Rh=1;var t=Uh();return kh=Math.fround||function(n){return t(n,1.1920928955078125e-7,34028234663852886e22,11754943508222875e-54)}}(),v=jh(),l=of(),g=ps(),w=Vh(),m=_s(),p=yf(),y=Ii(),b=ys(),E=lr(),I=e.PROPER,S=e.CONFIGURABLE,T="ArrayBuffer",k="DataView",R="prototype",A="Wrong index",O=E.getterFor(T),C=E.getterFor(k),D=E.set,N=t[T],F=N,P=F&&F[R],M=t[k],x=M&&M[R],U=Object.prototype,L=t.Array,z=t.RangeError,B=n(w),G=n([].reverse),W=v.pack,q=v.unpack,H=function(t){return[255&t]},K=function(t){return[255&t,t>>8&255]},X=function(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]},$=function(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]},Q=function(t){return W(d(t),23,4)},J=function(t){return W(t,52,8)},Y=function(t,n,r){u(t[R],n,{configurable:!0,get:function(){return r(this)[n]}})},Z=function(t,n,r,i){var e=C(t),s=h(r),u=!!i;if(s+n>e.byteLength)throw new z(A);var o=e.bytes,a=s+e.byteOffset,c=m(o,a,a+n);return u?c:G(c)},tt=function(t,n,r,i,e,s){var u=C(t),o=h(r),a=i(+e),c=!!s;if(o+n>u.byteLength)throw new z(A);for(var f=u.bytes,d=o+u.byteOffset,v=0;v<n;v++)f[d+v]=a[c?v:n-v-1]};if(i){var nt=I&&N.name!==T;a(function(){N(1)})&&a(function(){new N(-1)})&&!a(function(){return new N,new N(1.5),new N(NaN),1!==N.length||nt&&!S})?nt&&S&&s(N,"name",T):((F=function(t){return c(this,P),p(new N(h(t)),this,F)})[R]=P,P.constructor=F,y(F,N)),g&&l(x)!==U&&g(x,U);var rt=new M(new F(2)),it=n(x.setInt8);rt.setInt8(0,2147483648),rt.setInt8(1,2147483649),!rt.getInt8(0)&&rt.getInt8(1)||o(x,{setInt8:function(t,n){it(this,t,n<<24>>24)},setUint8:function(t,n){it(this,t,n<<24>>24)}},{unsafe:!0})}else P=(F=function(t){c(this,P);var n=h(t);D(this,{type:T,bytes:B(L(n),0),byteLength:n}),r||(this.byteLength=n,this.detached=!1)})[R],x=(M=function(t,n,i){c(this,x),c(t,P);var e=O(t),s=e.byteLength,u=f(n);if(u<0||u>s)throw new z("Wrong offset");if(u+(i=void 0===i?s-u:h(i))>s)throw new z("Wrong length");D(this,{type:k,buffer:t,byteLength:i,byteOffset:u,bytes:e.bytes}),r||(this.buffer=t,this.byteLength=i,this.byteOffset=u)})[R],r&&(Y(F,"byteLength",O),Y(M,"buffer",C),Y(M,"byteLength",C),Y(M,"byteOffset",C)),o(x,{getInt8:function(t){return Z(this,1,t)[0]<<24>>24},getUint8:function(t){return Z(this,1,t)[0]},getInt16:function(t){var n=Z(this,2,t,arguments.length>1&&arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function(t){var n=Z(this,2,t,arguments.length>1&&arguments[1]);return n[1]<<8|n[0]},getInt32:function(t){return $(Z(this,4,t,arguments.length>1&&arguments[1]))},getUint32:function(t){return $(Z(this,4,t,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(t){return q(Z(this,4,t,arguments.length>1&&arguments[1]),23)},getFloat64:function(t){return q(Z(this,8,t,arguments.length>1&&arguments[1]),52)},setInt8:function(t,n){tt(this,1,t,H,n)},setUint8:function(t,n){tt(this,1,t,H,n)},setInt16:function(t,n){tt(this,2,t,K,n,arguments.length>2&&arguments[2])},setUint16:function(t,n){tt(this,2,t,K,n,arguments.length>2&&arguments[2])},setInt32:function(t,n){tt(this,4,t,X,n,arguments.length>2&&arguments[2])},setUint32:function(t,n){tt(this,4,t,X,n,arguments.length>2&&arguments[2])},setFloat32:function(t,n){tt(this,4,t,Q,n,arguments.length>2&&arguments[2])},setFloat64:function(t,n){tt(this,8,t,J,n,arguments.length>2&&arguments[2])}});return b(F,T),b(M,k),Dh={ArrayBuffer:F,DataView:M}}!function(){if(Fh)return Ph;Fh=1;var t=Ti(),n=_(),r=Lh(),i=Es(),e="ArrayBuffer",s=r[e];t({global:!0,constructor:!0,forced:n[e]!==s},{ArrayBuffer:s}),i(e)}();var zh,Bh={};!function(){if(zh)return Bh;zh=1;var t=Ti(),n=Rs(),r=j(),i=Lh(),e=qn(),s=xr(),u=Ur(),o=i.ArrayBuffer,a=i.DataView,c=a.prototype,f=n(o.prototype.slice),h=n(c.getUint8),d=n(c.setUint8);t({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:r(function(){return!new o(2).slice(1,void 0).byteLength})},{slice:function(t,n){if(f&&void 0===n)return f(e(this),t);for(var r=e(this).byteLength,i=s(t,r),c=s(void 0===n?r:n,r),v=new o(u(c-i)),l=new a(this),g=new a(v),w=0;i<c;)d(g,w++,h(l,i++));return v}})}();var Gh,Wh,qh,Hh,Kh,Xh,$h,Qh={};function Jh(){if(Hh)return qh;Hh=1;var t=Nt(),n=Ur(),r=ja(),i=function(){if(Wh)return Gh;Wh=1;var t=Mr(),n=ja(),r=xt(),i=RangeError,e=Math.floor;return Gh=function(s){var u=n(r(this)),o="",a=t(s);if(a<0||a===1/0)throw new i("Wrong number of repetitions");for(;a>0;(a=e(a/2))&&(u+=u))a%2&&(o+=u);return o}}(),e=xt(),s=t(i),u=t("".slice),o=Math.ceil,a=function(t){return function(i,a,c){var f=r(e(i)),h=n(a),d=f.length;if(h<=d)return f;var v,l,g=void 0===c?" ":r(c);return""===g?f:((l=s(g,o((v=h-d)/g.length))).length>v&&(l=u(l,0,v)),t?f+l:l+f)}};return qh={start:a(!1),end:a(!0)}}!function(){if($h)return Qh;$h=1;var t=Ti(),n=Jh().start;t({target:"String",proto:!0,forced:function(){if(Xh)return Kh;Xh=1;var t=Bt();return Kh=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(t)}()},{padStart:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}})}();var Yh,Zh,td,nd,rd,id,ed,sd,ud,od,ad,cd,fd,hd,dd,vd,ld,gd,wd,md,pd,yd,bd={exports:{}};function Ed(){if(Zh)return Yh;Zh=1;var t,n,r,i=Mh(),e=V(),s=_(),u=jt(),o=Vt(),a=_n(),c=Ci(),f=Kt(),h=Kn(),d=wr(),v=bs(),l=zt(),g=of(),w=ps(),m=Cn(),p=On(),y=lr(),b=y.enforce,E=y.get,I=s.Int8Array,S=I&&I.prototype,T=s.Uint8ClampedArray,k=T&&T.prototype,R=I&&g(I),A=S&&g(S),O=Object.prototype,C=s.TypeError,D=m("toStringTag"),N=p("TYPED_ARRAY_TAG"),F="TypedArrayConstructor",P=i&&!!w&&"Opera"!==c(s.opera),M=!1,x={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},U={BigInt64Array:8,BigUint64Array:8},j=function(t){var n=g(t);if(o(n)){var r=E(n);return r&&a(r,F)?r[F]:j(n)}},L=function(t){if(!o(t))return!1;var n=c(t);return a(x,n)||a(U,n)};for(t in x)(r=(n=s[t])&&n.prototype)?b(r)[F]=n:P=!1;for(t in U)(r=(n=s[t])&&n.prototype)&&(b(r)[F]=n);if((!P||!u(R)||R===Function.prototype)&&(R=function(){throw new C("Incorrect invocation")},P))for(t in x)s[t]&&w(s[t],R);if((!P||!A||A===O)&&(A=R.prototype,P))for(t in x)s[t]&&w(s[t].prototype,A);if(P&&g(k)!==A&&w(k,A),e&&!a(A,D))for(t in M=!0,v(A,D,{configurable:!0,get:function(){return o(this)?this[N]:void 0}}),x)s[t]&&h(s[t].prototype,N,t);return Yh={NATIVE_ARRAY_BUFFER_VIEWS:P,TYPED_ARRAY_TAG:M&&N,aTypedArray:function(t){if(L(t))return t;throw new C("Target is not a typed array")},aTypedArrayConstructor:function(t){if(u(t)&&(!w||l(R,t)))return t;throw new C(f(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,n,r,i){if(e){if(r)for(var u in x){var o=s[u];if(o&&a(o.prototype,t))try{delete o.prototype[t]}catch(r){try{o.prototype[t]=n}catch(t){}}}A[t]&&!r||d(A,t,r?n:P&&S[t]||n,i)}},exportTypedArrayStaticMethod:function(t,n,r){var i,u;if(e){if(w){if(r)for(i in x)if((u=s[i])&&a(u,t))try{delete u[t]}catch(t){}if(R[t]&&!r)return;try{return d(R,t,r?n:P&&R[t]||n)}catch(t){}}for(i in x)!(u=s[i])||u[t]&&!r||d(u,t,n)}},getTypedArrayConstructor:j,isView:function(t){if(!o(t))return!1;var n=c(t);return"DataView"===n||a(x,n)||a(U,n)},isTypedArray:L,TypedArray:R,TypedArrayPrototype:A}}function Id(){if(id)return rd;id=1;var t=Vt(),n=Math.floor;return rd=Number.isInteger||function(r){return!t(r)&&isFinite(r)&&n(r)===r}}function Sd(){if(sd)return ed;sd=1;var t=Mr(),n=RangeError;return ed=function(r){var i=t(r);if(i<0)throw new n("The argument can't be less than 0");return i}}function Td(){if(od)return ud;od=1;var t=Sd(),n=RangeError;return ud=function(r,i){var e=t(r);if(e%i)throw new n("Wrong offset");return e}}function kd(){if(cd)return ad;cd=1;var t=Math.floor;return ad=function(n){var r=+n;if(r!=r||r<=0)return 0;if(r>=255)return 255;var i=t(r);return i+.5<r?i+1:r<i+.5||i%2==0?i:i+1}}function Rd(){if(hd)return fd;hd=1;var t=Ci();return fd=function(n){var r=t(n);return"BigInt64Array"===r||"BigUint64Array"===r}}function Ad(){if(vd)return dd;vd=1;var t=Dn(),n=TypeError;return dd=function(r){var i=t(r,"number");if("number"==typeof i)throw new n("Can't convert number to bigint");return BigInt(i)}}function _d(){if(gd)return ld;gd=1;var t=As(),n=z(),r=Xt(),i=Ss(),e=An(),s=jr(),u=fu(),o=cu(),a=au(),c=Rd(),f=Ed().aTypedArrayConstructor,h=Ad();return ld=function(d){var v=i(this),l=arguments.length,g=l>1?arguments[1]:void 0,w=void 0!==g;w&&r(g);var m,p,y,b,E,I,S,T,k=e(d),R=o(k);if(R&&!a(R))for(T=(S=u(k,R)).next,k=[];!(I=n(T,S)).done;)k.push(I.value);for(w&&l>2&&(g=t(g,arguments[2])),p=s(k),y=new(f(v))(p),b=c(y),m=0;p>m;m++)E=w?g(k[m],m):k[m],y[m]=b?h(E):+E;return y},ld}function Od(){if(md)return wd;md=1;var t=jr();return wd=function(n,r,i){for(var e=0,s=arguments.length>2?i:t(r),u=new n(s);s>e;)u[e]=r[e++];return u},wd}function Cd(){if(pd)return bd.exports;pd=1;var t=Ti(),n=_(),r=z(),i=V(),e=function(){if(nd)return td;nd=1;var t=_(),n=j(),r=vu(),i=Ed().NATIVE_ARRAY_BUFFER_VIEWS,e=t.ArrayBuffer,s=t.Int8Array;return td=!i||!n(function(){s(1)})||!n(function(){new s(-1)})||!r(function(t){new s,new s(null),new s(1.5),new s(t)},!0)||n(function(){return 1!==new s(new e(2),1,void 0).length})}(),s=Ed(),u=Lh(),o=Is(),a=Dt(),c=Kn(),f=Id(),h=xh(),d=Td(),v=kd(),l=Nn(),g=_n(),w=Ci(),m=Vt(),p=Ht(),y=$i(),b=zt(),E=ps(),I=Br().f,S=_d(),T=Vu().forEach,k=Es(),R=bs(),A=Hn(),O=Mn(),C=Od(),D=lr(),N=yf(),F=D.get,P=D.set,M=D.enforce,x=A.f,U=O.f,L=n.RangeError,B=u.ArrayBuffer,G=B.prototype,W=u.DataView,q=s.NATIVE_ARRAY_BUFFER_VIEWS,H=s.TYPED_ARRAY_TAG,K=s.TypedArray,X=s.TypedArrayPrototype,$=s.isTypedArray,Q="BYTES_PER_ELEMENT",J="Wrong length",Y=function(t,n){R(t,n,{configurable:!0,get:function(){return F(this)[n]}})},Z=function(t){var n;return b(G,t)||"ArrayBuffer"===(n=w(t))||"SharedArrayBuffer"===n},tt=function(t,n){return $(t)&&!p(n)&&n in t&&f(+n)&&n>=0},nt=function(t,n){return n=l(n),tt(t,n)?a(2,t[n]):U(t,n)},rt=function(t,n,r){return n=l(n),!(tt(t,n)&&m(r)&&g(r,"value"))||g(r,"get")||g(r,"set")||r.configurable||g(r,"writable")&&!r.writable||g(r,"enumerable")&&!r.enumerable?x(t,n,r):(t[n]=r.value,t)};return i?(q||(O.f=nt,A.f=rt,Y(X,"buffer"),Y(X,"byteOffset"),Y(X,"byteLength"),Y(X,"length")),t({target:"Object",stat:!0,forced:!q},{getOwnPropertyDescriptor:nt,defineProperty:rt}),bd.exports=function(i,s,u){var a=i.match(/\d+/)[0]/8,f=i+(u?"Clamped":"")+"Array",l="get"+i,g="set"+i,w=n[f],p=w,b=p&&p.prototype,R={},A=function(t,n){x(t,n,{get:function(){return function(t,n){var r=F(t);return r.view[l](n*a+r.byteOffset,!0)}(this,n)},set:function(t){return function(t,n,r){var i=F(t);i.view[g](n*a+i.byteOffset,u?v(r):r,!0)}(this,n,t)},enumerable:!0})};q?e&&(p=s(function(t,n,i,e){return o(t,b),N(m(n)?Z(n)?void 0!==e?new w(n,d(i,a),e):void 0!==i?new w(n,d(i,a)):new w(n):$(n)?C(p,n):r(S,p,n):new w(h(n)),t,p)}),E&&E(p,K),T(I(w),function(t){t in p||c(p,t,w[t])}),p.prototype=b):(p=s(function(t,n,i,e){o(t,b);var s,u,c,f=0,v=0;if(m(n)){if(!Z(n))return $(n)?C(p,n):r(S,p,n);s=n,v=d(i,a);var l=n.byteLength;if(void 0===e){if(l%a)throw new L(J);if((u=l-v)<0)throw new L(J)}else if((u=h(e)*a)+v>l)throw new L(J);c=u/a}else c=h(n),s=new B(u=c*a);for(P(t,{buffer:s,byteOffset:v,byteLength:u,length:c,view:new W(s)});f<c;)A(t,f++)}),E&&E(p,K),b=p.prototype=y(X)),b.constructor!==p&&c(b,"constructor",p),M(b).TypedArrayConstructor=p,H&&c(b,H,f);var _=p!==w;R[f]=p,t({global:!0,constructor:!0,forced:_,sham:!q},R),Q in p||c(p,Q,a),Q in b||c(b,Q,a),k(f)}):bd.exports=function(){},bd.exports}yd||(yd=1,Cd()("Uint8",function(t){return function(n,r,i){return t(this,n,r,i)}}));var Dd,Nd,Fd,Pd,Md,xd={};function Ud(){if(Nd)return Dd;Nd=1;var t=Kt(),n=TypeError;return Dd=function(r,i){if(!delete r[i])throw new n("Cannot delete property "+t(i)+" of "+t(r))}}!function(){if(Md)return xd;Md=1;var t=Nt(),n=Ed(),r=function(){if(Pd)return Fd;Pd=1;var t=An(),n=xr(),r=jr(),i=Ud(),e=Math.min;return Fd=[].copyWithin||function(s,u){var o=t(this),a=r(o),c=n(s,a),f=n(u,a),h=arguments.length>2?arguments[2]:void 0,d=e((void 0===h?a:n(h,a))-f,a-c),v=1;for(f<c&&c<f+d&&(v=-1,f+=d-1,c+=d-1);d-- >0;)f in o?o[c]=o[f]:i(o,c),c+=v,f+=v;return o},Fd}(),i=t(r),e=n.aTypedArray;(0,n.exportTypedArrayMethod)("copyWithin",function(t,n){return i(e(this),t,n,arguments.length>2?arguments[2]:void 0)})}();var jd,Vd={};!function(){if(jd)return Vd;jd=1;var t=Ed(),n=Vu().every,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("every",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var Ld,zd={};!function(){if(Ld)return zd;Ld=1;var t=Ed(),n=Vh(),r=Ad(),i=Ci(),e=z(),s=Nt(),u=j(),o=t.aTypedArray,a=t.exportTypedArrayMethod,c=s("".slice);a("fill",function(t){var s=arguments.length;o(this);var u="Big"===c(i(this),0,3)?r(t):+t;return e(n,this,u,s>1?arguments[1]:void 0,s>2?arguments[2]:void 0)},u(function(){var t=0;return new Int8Array(2).fill({valueOf:function(){return t++}}),1!==t}))}();var Bd,Gd,Wd,qd={};function Hd(){if(Gd)return Bd;Gd=1;var t=Od(),n=Ed().getTypedArrayConstructor;return Bd=function(r,i){return t(n(r),i)}}!function(){if(Wd)return qd;Wd=1;var t=Ed(),n=Vu().filter,r=Hd(),i=t.aTypedArray;(0,t.exportTypedArrayMethod)("filter",function(t){var e=n(i(this),t,arguments.length>1?arguments[1]:void 0);return r(this,e)})}();var Kd,Xd={};!function(){if(Kd)return Xd;Kd=1;var t=Ed(),n=Vu().find,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("find",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var $d,Qd={};!function(){if($d)return Qd;$d=1;var t=Ed(),n=Vu().findIndex,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("findIndex",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var Jd,Yd={};!function(){if(Jd)return Yd;Jd=1;var t=Ed(),n=Vu().forEach,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("forEach",function(t){n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var Zd,tv={};!function(){if(Zd)return tv;Zd=1;var t=Ed(),n=Vr().includes,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("includes",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var nv,rv={};!function(){if(nv)return rv;nv=1;var t=Ed(),n=Vr().indexOf,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("indexOf",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var iv,ev={};!function(){if(iv)return ev;iv=1;var t=_(),n=j(),r=Nt(),i=Ed(),e=df(),s=Cn()("iterator"),u=t.Uint8Array,o=r(e.values),a=r(e.keys),c=r(e.entries),f=i.aTypedArray,h=i.exportTypedArrayMethod,d=u&&u.prototype,v=!n(function(){d[s].call([1])}),l=!!d&&d.values&&d[s]===d.values&&"values"===d.values.name,g=function(){return o(f(this))};h("entries",function(){return c(f(this))},v),h("keys",function(){return a(f(this))},v),h("values",g,v||!l,{name:"values"}),h(s,g,v||!l,{name:"values"})}();var sv,uv={};!function(){if(sv)return uv;sv=1;var t=Ed(),n=Nt(),r=t.aTypedArray,i=t.exportTypedArrayMethod,e=n([].join);i("join",function(t){return e(r(this),t)})}();var ov,av,cv,fv={};!function(){if(cv)return fv;cv=1;var t=Ed(),n=ks(),r=function(){if(av)return ov;av=1;var t=ks(),n=Ut(),r=Mr(),i=jr(),e=ne(),s=Math.min,u=[].lastIndexOf,o=!!u&&1/[1].lastIndexOf(1,-0)<0,a=e("lastIndexOf");return ov=o||!a?function(e){if(o)return t(u,this,arguments)||0;var a=n(this),c=i(a);if(0===c)return-1;var f=c-1;for(arguments.length>1&&(f=s(f,r(arguments[1]))),f<0&&(f=c+f);f>=0;f--)if(f in a&&a[f]===e)return f||0;return-1}:u,ov}(),i=t.aTypedArray;(0,t.exportTypedArrayMethod)("lastIndexOf",function(t){var e=arguments.length;return n(r,i(this),e>1?[t,arguments[1]]:[t])})}();var hv,dv={};!function(){if(hv)return dv;hv=1;var t=Ed(),n=Vu().map,r=Hd(),i=t.aTypedArray;(0,t.exportTypedArrayMethod)("map",function(t){var e=n(i(this),t,arguments.length>1?arguments[1]:void 0);return r(this,e)})}();var vv,lv,gv,wv={};function mv(){if(lv)return vv;lv=1;var t=Xt(),n=An(),r=Pt(),i=jr(),e=TypeError,s="Reduce of empty array with no initial value",u=function(u){return function(o,a,c,f){var h=n(o),d=r(h),v=i(h);if(t(a),0===v&&c<2)throw new e(s);var l=u?v-1:0,g=u?-1:1;if(c<2)for(;;){if(l in d){f=d[l],l+=g;break}if(l+=g,u?l<0:v<=l)throw new e(s)}for(;u?l>=0:v>l;l+=g)l in d&&(f=a(f,d[l],l,h));return f}};return vv={left:u(!1),right:u(!0)}}!function(){if(gv)return wv;gv=1;var t=Ed(),n=mv().left,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("reduce",function(t){var i=arguments.length;return n(r(this),t,i,i>1?arguments[1]:void 0)})}();var pv,yv={};!function(){if(pv)return yv;pv=1;var t=Ed(),n=mv().right,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("reduceRight",function(t){var i=arguments.length;return n(r(this),t,i,i>1?arguments[1]:void 0)})}();var bv,Ev={};!function(){if(bv)return Ev;bv=1;var t=Ed(),n=t.aTypedArray,r=t.exportTypedArrayMethod,i=Math.floor;r("reverse",function(){for(var t,r=this,e=n(r).length,s=i(e/2),u=0;u<s;)t=r[u],r[u++]=r[--e],r[e]=t;return r})}();var Iv,Sv={};!function(){if(Iv)return Sv;Iv=1;var t=_(),n=z(),r=Ed(),i=jr(),e=Td(),s=An(),u=j(),o=t.RangeError,a=t.Int8Array,c=a&&a.prototype,f=c&&c.set,h=r.aTypedArray,d=r.exportTypedArrayMethod,v=!u(function(){var t=new Uint8ClampedArray(2);return n(f,t,{length:1,0:3},1),3!==t[1]}),l=v&&r.NATIVE_ARRAY_BUFFER_VIEWS&&u(function(){var t=new a(2);return t.set(1),t.set("2",1),0!==t[0]||2!==t[1]});d("set",function(t){h(this);var r=e(arguments.length>1?arguments[1]:void 0,1),u=s(t);if(v)return n(f,this,u,r);var a=this.length,c=i(u),d=0;if(c+r>a)throw new o("Wrong length");for(;d<c;)this[r+d]=u[d++]},!v||l)}();var Tv,kv={};!function(){if(Tv)return kv;Tv=1;var t=Ed(),n=j(),r=_s(),i=t.aTypedArray,e=t.getTypedArrayConstructor;(0,t.exportTypedArrayMethod)("slice",function(t,n){for(var s=r(i(this),t,n),u=e(this),o=0,a=s.length,c=new u(a);a>o;)c[o]=s[o++];return c},n(function(){new Int8Array(1).slice()}))}();var Rv,Av={};!function(){if(Rv)return Av;Rv=1;var t=Ed(),n=Vu().some,r=t.aTypedArray;(0,t.exportTypedArrayMethod)("some",function(t){return n(r(this),t,arguments.length>1?arguments[1]:void 0)})}();var _v,Ov,Cv,Dv,Nv,Fv,Pv,Mv={};!function(){if(Pv)return Mv;Pv=1;var t=_(),n=Rs(),r=j(),i=Xt(),e=rh(),s=Ed(),u=function(){if(Ov)return _v;Ov=1;var t=Bt().match(/firefox\/(\d+)/i);return _v=!!t&&+t[1]}(),o=function(){if(Dv)return Cv;Dv=1;var t=Bt();return Cv=/MSIE|Trident/.test(t)}(),a=Gt(),c=function(){if(Fv)return Nv;Fv=1;var t=Bt().match(/AppleWebKit\/(\d+)\./);return Nv=!!t&&+t[1]}(),f=s.aTypedArray,h=s.exportTypedArrayMethod,d=t.Uint16Array,v=d&&n(d.prototype.sort),l=!(!v||r(function(){v(new d(2),null)})&&r(function(){v(new d(2),{})})),g=!!v&&!r(function(){if(a)return a<74;if(u)return u<67;if(o)return!0;if(c)return c<602;var t,n,r=new d(516),i=Array(516);for(t=0;t<516;t++)n=t%4,r[t]=515-t,i[t]=t-2*n+3;for(v(r,function(t,n){return(t/4|0)-(n/4|0)}),t=0;t<516;t++)if(r[t]!==i[t])return!0});h("sort",function(t){return void 0!==t&&i(t),g?v(this,t):e(f(this),function(t){return function(n,r){return void 0!==t?+t(n,r)||0:r!=r?n!=n?0:-1:n!=n?1:0===n&&0===r?1/n>0?1/r>0?0:1:1/r>0?-1:0:n>r?1:n<r?-1:0}}(t))},!g||l)}();var xv,Uv={};!function(){if(xv)return Uv;xv=1;var t=Ed(),n=Ur(),r=xr(),i=t.aTypedArray,e=t.getTypedArrayConstructor;(0,t.exportTypedArrayMethod)("subarray",function(t,s){var u=i(this),o=u.length,a=r(t,o);return new(e(u))(u.buffer,u.byteOffset+a*u.BYTES_PER_ELEMENT,n((void 0===s?o:r(s,o))-a))})}();var jv,Vv={};!function(){if(jv)return Vv;jv=1;var t=_(),n=ks(),r=Ed(),i=j(),e=_s(),s=t.Int8Array,u=r.aTypedArray,o=r.exportTypedArrayMethod,a=[].toLocaleString,c=!!s&&i(function(){a.call(new s(1))});o("toLocaleString",function(){return n(a,c?e(u(this)):u(this),e(arguments))},i(function(){return[1,2].toLocaleString()!==new s([1,2]).toLocaleString()})||!i(function(){s.prototype.toLocaleString.call([1,2])}))}();var Lv,zv={};function Bv(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();var t="undefined"!=typeof crypto?crypto:null;if(null==t?void 0:t.getRandomValues){var n=new Uint8Array(16);t.getRandomValues(n);var r=new DataView(n.buffer);return r.setUint8(6,15&r.getUint8(6)|64),r.setUint8(8,63&r.getUint8(8)|128),Array.from(n).map(function(t,n){return[4,6,8,10].includes(n)?"-".concat(t.toString(16).padStart(2,"0")):t.toString(16).padStart(2,"0")}).join("")}throw new Error("No cryptographically secure random number generator available")}function Gv(){try{var t=function(){var t,n;if("undefined"!=typeof navigator&&"userAgentData"in navigator){var r=navigator.userAgentData;if(r&&r.brands)try{for(var i=Wu(r.brands),e=i.next();!e.done;e=i.next()){var s=e.value;if(s.brand&&"Chromium"!==s.brand&&!s.brand.startsWith("Not"))return s.brand}}catch(n){t={error:n}}finally{try{e&&!e.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}return null}();return t||("undefined"!=typeof navigator&&navigator.userAgent?(n=navigator.userAgent).includes("Firefox/")?"Firefox":n.includes("Edg/")?"Edge":n.includes("Chrome/")?"Chrome":n.includes("Safari/")&&!n.includes("Chrome")?"Safari":n.includes("Opera/")||n.includes("OPR/")?"Opera":null:null)}catch(t){return null}var n}function Wv(){try{var t=function(){if("undefined"!=typeof navigator&&"userAgentData"in navigator){var t=navigator.userAgentData;if(t&&t.platform)return t.platform}return null}();return t||("undefined"!=typeof navigator&&navigator.userAgent?(n=navigator.userAgent,null!==(i=null!==(r=function(t){if(!t.includes("Mac OS X"))return null;var n=t.match(/Mac OS X ([\d_]+)/);return(null==n?void 0:n[1])?"macOS ".concat(n[1].replace(/_/g,".")):"macOS"}(n))&&void 0!==r?r:function(t){var n;if(!t.includes("Windows NT"))return null;var r=t.match(/Windows NT ([\d.]+)/);return(null==r?void 0:r[1])?"Windows ".concat(null!==(n={"10.0":"10/11",6.3:"8.1",6.2:"8",6.1:"7"}[r[1]])&&void 0!==n?n:r[1]):"Windows"}(n))&&void 0!==i?i:function(t){var n;return t.includes("iPhone")||t.includes("iPad")?(null==(n=t.match(/OS ([\d_]+)/))?void 0:n[1])?"iOS ".concat(n[1].replace(/_/g,".")):"iOS":t.includes("Android")?(n=t.match(/Android ([\d.]+)/))?"Android ".concat(n[1]):"Android":t.includes("Linux")?"Linux":null}(n)):null)}catch(r){return null}var n,r,i}function qv(){try{if("undefined"!=typeof document&&document.referrer)return function(t){var n;if("undefined"!=typeof URL)try{return new URL(t).hostname}catch(t){return"direct"}var r=t.match(/^https?:\/\/([^/?#]+)/);return r&&null!==(n=r[1])&&void 0!==n?n:"direct"}(document.referrer)}catch(t){}return"direct"}function Hv(t){var n=Gv(),r=Wv(),i=function(){var t;try{if("undefined"!=typeof navigator)return navigator.language||(null===(t=navigator.languages)||void 0===t?void 0:t[0])||"en-US"}catch(t){}return"en-US"}(),e=function(){try{if("undefined"!=typeof Intl)return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch(t){}return"UTC"}(),s=function(){try{if("undefined"!=typeof window&&window.screen)return"".concat(window.screen.width,"x").concat(window.screen.height)}catch(t){}return"0x0"}(),u=function(){try{if("undefined"!=typeof window&&window.location){var t=window.location.search;return{utmSource:ah(t,"utm_source"),utmMedium:ah(t,"utm_medium"),utmCampaign:ah(t,"utm_campaign"),utmTerm:ah(t,"utm_term"),utmContent:ah(t,"utm_content"),adsId:ah(t,"gclid")||ah(t,"fbclid")||ah(t,"msclkid")||ah(t,"ttclid")}}}catch(t){}return{utmSource:null,utmMedium:null,utmCampaign:null,utmTerm:null,utmContent:null,adsId:null}}(),o=qv(),a={sdk_version:Ra,consent:(null==t?void 0:t.notificationPermissionGranted)?"yes":"no"};return function(t,n,r,i,e,s){n&&(t.browser=n),r&&(t.os_version=r),i&&"en-US"!==i&&(t.locale=i),e&&"UTC"!==e&&(t.timezone=e),s&&"0x0"!==s&&(t.screen_resolution=s)}(a,n,r,i,e,s),function(t,n,r,i){(null==n?void 0:n.appVersion)&&(t.app_version=n.appVersion),(null==n?void 0:n.fcmTokenCreatedAt)&&(t.token_creation_date=n.fcmTokenCreatedAt),r.utmSource&&(t.utm_source=r.utmSource),r.utmMedium&&(t.utm_medium=r.utmMedium),r.utmCampaign&&(t.utm_campaign=r.utmCampaign),r.utmTerm&&(t.utm_term=r.utmTerm),r.utmContent&&(t.utm_content=r.utmContent),r.adsId&&(t.ads_id=r.adsId),i&&"direct"!==i&&(t.initial_referrer=i)}(a,t,u,o),a}!function(){if(Lv)return zv;Lv=1;var t=Ed().exportTypedArrayMethod,n=j(),r=_(),i=Nt(),e=r.Uint8Array,s=e&&e.prototype||{},u=[].toString,o=i([].join);n(function(){u.call({})})&&(u=function(){return o(this)});var a=s.toString!==u;t("toString",u,a)}();var Kv=function(){function t(t,n,r,i,e){this.httpClient=new ef(t),this.logger=n,this.accountId=r,this.orgId=i,this.source=e}return t.prototype.sendEvents=function(t,n,r,i,e,s){return Bu(this,void 0,void 0,function(){var u,o,a,c,f,h,d;return Gu(this,function(v){switch(v.label){case 0:if(!n&&!r&&!i)throw new Error("Either visitorId, visitorRefId, or userId must be provided for event tracking");if(!s)throw new Error("Session ID is required for event tracking");o=(u=!!n||!!r)&&i?"identified":u?"anonymous":"user-only",this.logger.info("Sending events",{eventCount:t.length,trackingMode:o,hasVisitor:u,hasUser:!!i,sessionId:s}),a=fh(s),c={request_id:Bv(),system_data:a,events:t},n?c.visitor={identifierName:"id",identifierValue:n}:r&&(c.visitor={identifierName:"refId",identifierValue:r}),i&&e&&(c.user={identifierName:e,identifierValue:i}),v.label=1;case 1:return v.trys.push([1,3,,4]),f={"X-CAP-API-AUTH-ORG-ID":this.orgId,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":this.source,"X-CAP-API-AUTH-ENTITY-ID":this.orgId},[4,this.httpClient.post(Ku,c,{headers:f})];case 2:return h=v.sent(),this.logger.info(Eo,{requestId:c.request_id,eventCount:t.length,trackingMode:o,success:h.status.success}),[2,h];case 3:throw d=v.sent(),this.logger.error(Io,{requestId:c.request_id,eventCount:t.length,trackingMode:o,error:d}),d;case 4:return[2]}})})},t.prototype.getVisitorConfig=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s;return Gu(this,function(u){switch(u.label){case 0:this.logger.info("Fetching visitor config",{orgId:t}),u.label=1;case 1:return u.trys.push([1,3,,4]),n={"X-CAP-API-AUTH-ORG-ID":t,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":ya.WEBPUSH},[4,this.httpClient.get($u,{headers:n})];case 2:return r=u.sent(),this.logger.info(Vo,{isEnabled:null===(e=r.data)||void 0===e?void 0:e.visitorTrackingEnabled,warningCount:(null===(s=r.warnings)||void 0===s?void 0:s.length)||0}),[2,r];case 3:throw i=u.sent(),this.logger.error(Lo,i),i;case 4:return[2]}})})},t.prototype.createVisitor=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:this.logger.info("Creating anonymous visitor",{orgId:t,profileCount:n.profiles.length,hasExtendedFields:!!n.extendedFields}),a.label=1;case 1:if(a.trys.push([1,3,,4]),!n.profiles||0===n.profiles.length)throw new Error("At least one profile is required");return r={"X-CAP-API-AUTH-ORG-ID":t},[4,this.httpClient.post(Qu,n,{headers:r})];case 2:return i=a.sent(),this.logger.info(qo,{visitorId:null===(s=i.data)||void 0===s?void 0:s.id,warningCount:(null===(u=i.warnings)||void 0===u?void 0:u.length)||0}),[2,i];case 3:throw e=a.sent(),this.logger.error(Ho,{error:e,accountId:null===(o=n.profiles[0])||void 0===o?void 0:o.accountId}),e;case 4:return[2]}})})},t.prototype.updateVisitor=function(t,n,r){return Bu(this,void 0,void 0,function(){var i,e,s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:this.logger.info("Updating visitor",{orgId:t,visitorId:n,profileCount:r.profiles.length,hasExtendedFields:!!r.extendedFields}),f.label=1;case 1:if(f.trys.push([1,3,,4]),!r.profiles||0===r.profiles.length)throw new Error("At least one profile is required");if(!n||""===n.trim())throw new Error("Visitor ID is required for update");return i={"X-CAP-API-AUTH-ORG-ID":t},e="".concat(Ju,"?identifierType=visitorId&identifierValue=").concat(encodeURIComponent(n)),[4,this.httpClient.put(e,r,{headers:i})];case 2:return s=f.sent(),this.logger.info($o,{visitorId:null===(o=s.data)||void 0===o?void 0:o.id,warningCount:(null===(a=s.warnings)||void 0===a?void 0:a.length)||0}),[2,s];case 3:throw u=f.sent(),this.logger.error(Qo,{error:u,visitorId:n,accountId:null===(c=r.profiles[0])||void 0===c?void 0:c.accountId}),u;case 4:return[2]}})})},t.prototype.buildMergeIdentifiers=function(t,n,r){var i=[];return t&&i.push({type:"email",value:t}),n&&i.push({type:"mobile",value:n}),r&&i.push({type:"externalId",value:r}),i},t.prototype.handleMergeResponse=function(t,n){var r,i=this;if(t.warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){i.logger.warn("Visitor merge warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0){var e=t.errors[0],s=e.code,u=e.message,o=String(s);if(o===Ia.ALREADY_MERGED)return void this.logger.info("Visitor already merged, treating as success",{visitorId:n});if(o===Ia.VISITOR_NOT_FOUND)throw this.logger.warn("Visitor not found, merge cannot proceed",{visitorId:n}),new Xv(o,u);throw new Error("Merge API error: [".concat(o,"] ").concat(u))}if(202!==(null===(r=t.status)||void 0===r?void 0:r.code))throw new Error("Unexpected merge API response");this.logger.info(Jo,{visitorId:n,statusCode:t.status.code,message:t.status.message})},t.prototype.mergeVisitor=function(t,n,r){return Bu(this,void 0,void 0,function(){var i,e,s,u,o,a,c,f,h,d,v,l,g,w,m,p,y,b;return Gu(this,function(E){switch(E.label){case 0:if(i=r.firstName,e=r.lastName,s=r.email,u=r.mobile,o=r.fcmToken,a=r.channelType,c=r.subscribed,f=void 0===c||c,h=r.fields,d=r.extendedFields,v=r.externalId,!s&&!u&&!v)throw new Error("At least one identifier (email, mobile, or externalId) is required for visitor merge");if(!t&&!n)throw new Error("Either visitorId or visitorRefId is required for visitor merge");this.logger.info("Merging visitor with user",{visitorId:t,visitorRefId:n,hasEmail:!!s,hasMobile:!!u,hasExternalId:!!v,hasFcmToken:!!o}),l=this.buildMergeIdentifiers(s,u,v),g=a||ba.WEB,w=[],o&&w.push({type:g,value:o,primary:!0,verified:!0,subscribed:f}),m={visitor:t?{identifierName:"id",identifierValue:t}:{identifierName:"refId",identifierValue:n},user:{profiles:[{firstName:i,lastName:e,identifiers:l,commChannels:w,fields:h||{},source:ya.WEBPUSH,accountId:this.accountId}],extendedFields:d||{}}},E.label=1;case 1:return E.trys.push([1,3,,4]),p={"X-CAP-API-AUTH-ORG-ID":this.orgId,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":this.source},[4,this.httpClient.post(Yu,m,{headers:p})];case 2:return y=E.sent(),this.handleMergeResponse(y,t),[3,4];case 3:if((b=E.sent())instanceof Xv)throw b;throw this.logger.error(Yo,{visitorId:t,error:b}),b;case 4:return[2]}})})},t.prototype.buildUserEventsRequest=function(t,n,r){var i=fh(r);return{request_id:Bv(),system_data:zu(zu({},i),{os_name:va}),events:[{name:t,eventRefId:Bv(),eventDateTime:(new Date).toISOString(),attributes:n}]}},t.prototype.sendUserEvents=function(t,n,r,i,e){return Bu(this,void 0,void 0,function(){var s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:n?t.visitor={identifierName:"id",identifierValue:n}:r&&(t.visitor={identifierName:"refId",identifierValue:r}),i&&e&&(t.user={identifierName:e,identifierValue:i}),this.logger.info("Sending user event",{eventName:null===(o=t.events[0])||void 0===o?void 0:o.name,requestId:t.request_id,hasVisitor:!!t.visitor,hasUser:!!t.user}),f.label=1;case 1:return f.trys.push([1,3,,4]),s={"X-CAP-API-AUTH-ORG-ID":this.orgId,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":this.source,"X-CAP-API-AUTH-ENTITY-ID":this.orgId},[4,this.httpClient.post(Xu,t,{headers:s})];case 2:return f.sent(),this.logger.info("User event sent successfully",{eventName:null===(a=t.events[0])||void 0===a?void 0:a.name,requestId:t.request_id}),[3,4];case 3:throw u=f.sent(),this.logger.error("Failed to send user event",{eventName:null===(c=t.events[0])||void 0===c?void 0:c.name,requestId:t.request_id,error:u}),u;case 4:return[2]}})})},t.prototype.sendDLR=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s;return Gu(this,function(u){switch(u.label){case 0:this.logger.info("Sending DLR events",{eventCount:t.events.length,requestId:t.request_id,cuid:null===(e=t.user)||void 0===e?void 0:e.identifierValue,visitorId:null===(s=t.visitor)||void 0===s?void 0:s.identifierValue}),u.label=1;case 1:return u.trys.push([1,3,,4]),n={"x-cap-api-auth-org-id":this.orgId,"x-cap-request-id":t.request_id},[4,this.httpClient.post(Zu,t,{headers:n})];case 2:return r=u.sent(),this.logger.info(ha,{requestId:t.request_id,eventCount:t.events.length,success:r.status.success}),[2,r];case 3:throw i=u.sent(),this.logger.error(da,{requestId:t.request_id,eventCount:t.events.length,error:i}),i;case 4:return[2]}})})},t}(),Xv=function(t){function n(n,r){var i=t.call(this,r)||this;return i.name="MergeNonRetryableError",i.code=n,i}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}Lu(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,t),n}(Error);var $v,Qv={};!function(){if($v)return Qv;$v=1;var t=Ti(),n=Vu().filter;t({target:"Array",proto:!0,forced:!Pi()("filter")},{filter:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}})}();var Jv,Yv,Zv,tl,nl,rl,il,el,sl,ul,ol,al,cl,fl,hl={exports:{}},dl={};function vl(){if(Jv)return dl;Jv=1;var t=Ft(),n=Ut(),r=Br().f,i=_s(),e="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];return dl.f=function(s){return e&&"Window"===t(s)?function(t){try{return r(t)}catch(t){return i(e)}}(s):r(n(s))},dl}function ll(){if(nl)return tl;nl=1;var t=j(),n=Vt(),r=Ft(),i=function(){if(Zv)return Yv;Zv=1;var t=j();return Yv=t(function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})}(),e=Object.isExtensible,s=t(function(){});return tl=s||i?function(t){return!!n(t)&&((!i||"ArrayBuffer"!==r(t))&&(!e||e(t)))}:e}function gl(){if(el)return hl.exports;el=1;var t=Ti(),n=Nt(),r=vr(),i=Vt(),e=_n(),s=Hn().f,u=Br(),o=vl(),a=ll(),c=On(),f=function(){if(il)return rl;il=1;var t=j();return rl=!t(function(){return Object.isExtensible(Object.preventExtensions({}))})}(),h=!1,d=c("meta"),v=0,l=function(t){s(t,d,{value:{objectID:"O"+v++,weakData:{}}})},g=hl.exports={enable:function(){g.enable=function(){},h=!0;var r=u.f,i=n([].splice),e={};e[d]=1,r(e).length&&(u.f=function(t){for(var n=r(t),e=0,s=n.length;e<s;e++)if(n[e]===d){i(n,e,1);break}return n},t({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:o.f}))},fastKey:function(t,n){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!e(t,d)){if(!a(t))return"F";if(!n)return"E";l(t)}return t[d].objectID},getWeakData:function(t,n){if(!e(t,d)){if(!a(t))return!0;if(!n)return!1;l(t)}return t[d].weakData},onFreeze:function(t){return f&&h&&a(t)&&!e(t,d)&&l(t),t}};return r[d]=!0,hl.exports}fl||(fl=1,cl||(cl=1,function(){if(ul)return sl;ul=1;var t=Ti(),n=_(),r=Nt(),i=Si(),e=wr(),s=gl(),u=du(),o=Is(),a=jt(),c=Mt(),f=Vt(),h=j(),d=vu(),v=ys(),l=yf();return sl=function(g,w,m){var p=-1!==g.indexOf("Map"),y=-1!==g.indexOf("Weak"),b=p?"set":"add",E=n[g],I=E&&E.prototype,S=E,T={},k=function(t){var n=r(I[t]);e(I,t,"add"===t?function(t){return n(this,0===t?0:t),this}:"delete"===t?function(t){return!(y&&!f(t))&&n(this,0===t?0:t)}:"get"===t?function(t){return y&&!f(t)?void 0:n(this,0===t?0:t)}:"has"===t?function(t){return!(y&&!f(t))&&n(this,0===t?0:t)}:function(t,r){return n(this,0===t?0:t,r),this})};if(i(g,!a(E)||!(y||I.forEach&&!h(function(){(new E).entries().next()}))))S=m.getConstructor(w,g,p,b),s.enable();else if(i(g,!0)){var R=new S,A=R[b](y?{}:-0,1)!==R,_=h(function(){R.has(1)}),O=d(function(t){new E(t)}),C=!y&&h(function(){for(var t=new E,n=5;n--;)t[b](n,n);return!t.has(-0)});O||((S=w(function(t,n){o(t,I);var r=l(new E,t,S);return c(n)||u(n,r[b],{that:r,AS_ENTRIES:p}),r})).prototype=I,I.constructor=S),(_||C)&&(k("delete"),k("has"),p&&k("get")),(C||A)&&k(b),y&&I.clear&&delete I.clear}return T[g]=S,t({global:!0,constructor:!0,forced:S!==E},T),v(S,g),y||m.setStrong(S,g,p),S}}()("Map",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},function(){if(al)return ol;al=1;var t=$i(),n=bs(),r=nh(),i=As(),e=Is(),s=Mt(),u=du(),o=ff(),a=hf(),c=Es(),f=V(),h=gl().fastKey,d=lr(),v=d.set,l=d.getterFor;return ol={getConstructor:function(o,a,c,d){var g=o(function(n,r){e(n,w),v(n,{type:a,index:t(null),first:null,last:null,size:0}),f||(n.size=0),s(r)||u(r,n[d],{that:n,AS_ENTRIES:c})}),w=g.prototype,m=l(a),p=function(t,n,r){var i,e,s=m(t),u=y(t,n);return u?u.value=r:(s.last=u={index:e=h(n,!0),key:n,value:r,previous:i=s.last,next:null,removed:!1},s.first||(s.first=u),i&&(i.next=u),f?s.size++:t.size++,"F"!==e&&(s.index[e]=u)),t},y=function(t,n){var r,i=m(t),e=h(n);if("F"!==e)return i.index[e];for(r=i.first;r;r=r.next)if(r.key===n)return r};return r(w,{clear:function(){for(var n=m(this),r=n.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=null),r=r.next;n.first=n.last=null,n.index=t(null),f?n.size=0:this.size=0},delete:function(t){var n=this,r=m(n),i=y(n,t);if(i){var e=i.next,s=i.previous;delete r.index[i.index],i.removed=!0,s&&(s.next=e),e&&(e.previous=s),r.first===i&&(r.first=e),r.last===i&&(r.last=s),f?r.size--:n.size--}return!!i},forEach:function(t){for(var n,r=m(this),e=i(t,arguments.length>1?arguments[1]:void 0);n=n?n.next:r.first;)for(e(n.value,n.key,this);n&&n.removed;)n=n.previous},has:function(t){return!!y(this,t)}}),r(w,c?{get:function(t){var n=y(this,t);return n&&n.value},set:function(t,n){return p(this,0===t?0:t,n)}}:{add:function(t){return p(this,t=0===t?0:t,t)}}),f&&n(w,"size",{configurable:!0,get:function(){return m(this).size}}),g},setStrong:function(t,n,r){var i=n+" Iterator",e=l(n),s=l(i);o(t,n,function(t,n){v(this,{type:i,target:t,state:e(t),kind:n,last:null})},function(){for(var t=s(this),n=t.kind,r=t.last;r&&r.removed;)r=r.previous;return t.target&&(t.last=r=r?r.next:t.state.first)?a("keys"===n?r.key:"values"===n?r.value:[r.key,r.value],!1):(t.target=null,a(void 0,!0))},r?"entries":"values",!r,!0),c(n)}},ol}())));var wl;wl||(wl=1,Ti()({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991}));var ml,pl,yl,bl={};function El(t){return El="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},El(t)}!function(){if(yl)return bl;yl=1;var t=Ti(),n=function(){if(pl)return ml;pl=1;var t=_(),n=j(),r=Nt(),i=ja(),e=La().trim,s=Va(),u=t.parseInt,o=t.Symbol,a=o&&o.iterator,c=/^[+-]?0x/i,f=r(c.exec),h=8!==u(s+"08")||22!==u(s+"0x16")||a&&!n(function(){u(Object(a))});return ml=h?function(t,n){var r=e(i(t));return u(r,n>>>0||(f(c,r)?16:10))}:u}();t({global:!0,forced:parseInt!==n},{parseInt:n})}();var Il,Sl=function(){function t(t,n,r){void 0===t&&(t="WebSDK"),void 0===n&&(n=2),void 0===r&&(r="data"),this.db=null,this.dbName=t,this.version=n,this.storeName=r,this.eventsStoreName="events"}return t.prototype.openDB=function(){return Bu(this,void 0,void 0,function(){var t=this;return Gu(this,function(n){return this.db?[2,this.db]:[2,new Promise(function(n,r){var i=indexedDB.open(t.dbName,t.version);i.onerror=function(){return r(i.error)},i.onsuccess=function(){t.db=i.result,n(t.db)},i.onupgradeneeded=function(n){var r=n.target.result;if(r.objectStoreNames.contains(t.storeName)||r.createObjectStore(t.storeName),!r.objectStoreNames.contains(t.eventsStoreName)){var i=r.createObjectStore(t.eventsStoreName,{keyPath:"id"});i.createIndex("timestamp","timestamp",{unique:!1}),i.createIndex("status","status",{unique:!1})}}})]})})},t.prototype.getItem=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.storeName],"readonly").objectStore(r.storeName).get(t);s.onerror=function(){return e(s.error)},s.onsuccess=function(){var t=s.result;i(null==t?null:"string"==typeof t?t:"object"===El(t)?JSON.stringify(t):String(t))}})]}})})},t.prototype.setItem=function(t,n){return Bu(this,void 0,void 0,function(){var r,i=this;return Gu(this,function(e){switch(e.label){case 0:return[4,this.openDB()];case 1:return r=e.sent(),[2,new Promise(function(e,s){var u=r.transaction([i.storeName],"readwrite").objectStore(i.storeName).put(n,t);u.onerror=function(){return s(u.error)},u.onsuccess=function(){return e()}})]}})})},t.prototype.removeItem=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.storeName],"readwrite").objectStore(r.storeName).delete(t);s.onerror=function(){return e(s.error)},s.onsuccess=function(){return i()}})]}})})},t.prototype.clear=function(){return Bu(this,void 0,void 0,function(){var t,n=this;return Gu(this,function(r){switch(r.label){case 0:return[4,this.openDB()];case 1:return t=r.sent(),[2,new Promise(function(r,i){var e=t.transaction([n.storeName],"readwrite").objectStore(n.storeName).clear();e.onerror=function(){return i(e.error)},e.onsuccess=function(){return r()}})]}})})},t.prototype.close=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return this.db&&(this.db.close(),this.db=null),[2]})})},t.prototype.addEvent=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.eventsStoreName],"readwrite").objectStore(r.eventsStoreName).add(t);s.onerror=function(){return e(s.error)},s.onsuccess=function(){return i()}})]}})})},t.prototype.getOldestPendingEvents=function(t){return Bu(this,arguments,void 0,function(t,n){var r,i=this;return void 0===n&&(n=50),Gu(this,function(e){switch(e.label){case 0:return[4,this.openDB()];case 1:return r=e.sent(),[2,new Promise(function(e,s){var u=r.transaction([i.eventsStoreName],"readonly").objectStore(i.eventsStoreName).index("timestamp").openCursor(),o=[],a=0;u.onerror=function(){return s(u.error)},u.onsuccess=function(r){var i=r.target.result;if(i&&a<n){var s=i.value;"pending"===s.status&&s.accountId===t&&(o.push(s),a++),i.continue()}else e(o)}})]}})})},t.prototype.updateEventStatus=function(t,n,r,i){return Bu(this,void 0,void 0,function(){var e,s=this;return Gu(this,function(u){switch(u.label){case 0:return[4,this.openDB()];case 1:return e=u.sent(),[2,new Promise(function(u,o){var a=e.transaction([s.eventsStoreName],"readwrite").objectStore(s.eventsStoreName),c=a.get(t);c.onerror=function(){return o(c.error)},c.onsuccess=function(){var e=c.result;if(e){e.status=n,e.lastAttempt=Date.now(),r&&(e.error=r),void 0!==i&&(e.attempts=i);var s=a.put(e);s.onerror=function(){return o(s.error)},s.onsuccess=function(){return u()}}else o(new Error("Event with id ".concat(t," not found")))}})]}})})},t.prototype.removeEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.eventsStoreName],"readwrite").objectStore(r.eventsStoreName),u=0,o=t.length;0!==o?t.forEach(function(t){var n=s.delete(t);n.onerror=function(){return e(n.error)},n.onsuccess=function(){++u===o&&i()}}):i()})]}})})},t.prototype.recoverOrphanedEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.eventsStoreName],"readwrite").objectStore(r.eventsStoreName).openCursor(),u=0;s.onerror=function(){return e(s.error)},s.onsuccess=function(n){var r=n.target.result;if(r){var e=r.value;if("processing"===e.status&&e.accountId===t)e.status="failed",e.lastAttempt=Date.now(),e.error="Recovered from orphaned processing state",r.update(e).onsuccess=function(){u++};r.continue()}else i(u)}})]}})})},t.prototype.getPendingEventCount=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return n=i.sent(),[2,new Promise(function(i,e){var s=n.transaction([r.eventsStoreName],"readonly").objectStore(r.eventsStoreName).openCursor(),u=0;s.onerror=function(){return e(s.error)},s.onsuccess=function(n){var r=n.target.result;if(r){var e=r.value;"pending"===e.status&&e.accountId===t&&u++,r.continue()}else i(u)}})]}})})},t.prototype.getRetryableEvents=function(t){return Bu(this,arguments,void 0,function(t,n){var r,i=this;return void 0===n&&(n=5),Gu(this,function(e){switch(e.label){case 0:return[4,this.openDB()];case 1:return r=e.sent(),[2,new Promise(function(e,s){var u=r.transaction([i.eventsStoreName],"readonly").objectStore(i.eventsStoreName).openCursor(),o=[];u.onerror=function(){return s(u.error)},u.onsuccess=function(r){var i=r.target.result;if(i){var s=i.value;"failed"===s.status&&s.attempts<=n&&s.accountId===t&&o.push(s),i.continue()}else e(o)}})]}})})},t}(),Tl=function(){function t(t,n,r,i,e){if(this.currentAccountId=null,this.currentCuid=null,this.currentUserIdentifierType=null,this.currentVisitorId=null,this.currentVisitorRefId=null,this.getSessionInfo=null,this.isProcessing=!1,this.processingPromise=null,this.paused=!1,this.apiClient=t,this.logger=n,this.BATCH_SIZE=e||no.BATCH_SIZE,this.RETRY_DELAYS=i||no.DEFAULT_RETRY_DELAYS,r&&"getIndexedDBAdapter"in r){var s=r.getIndexedDBAdapter();s?(n.info("EventQueue: Reusing existing IndexedDB adapter from StorageManager"),this.storage=s):(n.warn("EventQueue: StorageManager has no IndexedDB adapter, creating new one"),this.storage=new Sl)}else r?(n.info("EventQueue: Using provided IndexedDBStorage"),this.storage=r):(n.warn("EventQueue: No storage provided, creating new IndexedDBStorage"),this.storage=new Sl)}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Initializing EventQueue"),[4,this.processQueueIfIdle()];case 1:return t.sent(),this.logger.info("EventQueue initialized successfully"),[2]}})})},t.prototype.setUserContext=function(t,n,r){return Bu(this,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return this.currentAccountId=t,this.currentCuid=n||null,this.currentUserIdentifierType=r||null,this.logger.debug("EventQueue user context set",{accountId:t,cuid:n,userIdentifierType:r}),[4,this.storage.recoverOrphanedEvents(t)];case 1:return(i=e.sent())>0&&this.logger.info("Recovered ".concat(i," orphaned processing events for account ").concat(t)),[2]}})})},t.prototype.setVisitorContext=function(t,n){this.currentVisitorId=t,this.currentVisitorRefId=null!=n?n:null,this.logger.debug("EventQueue visitor context set",{visitorId:t,visitorRefId:n})},t.prototype.setSessionInfoCallback=function(t){this.getSessionInfo=t,this.logger.debug("EventQueue session info callback set")},t.prototype.getCurrentAccountId=function(){return this.currentAccountId},t.prototype.getCurrentCuid=function(){return this.currentCuid},t.prototype.getCurrentVisitorId=function(){return this.currentVisitorId},t.prototype.clearUserContext=function(){this.currentCuid=null,this.currentUserIdentifierType=null,this.logger.debug("EventQueue user context cleared (cuid removed)")},t.prototype.enqueue=function(t){return Bu(this,arguments,void 0,function(t,n){var r,i,e,s;return void 0===n&&(n=!1),Gu(this,function(u){switch(u.label){case 0:if(u.trys.push([0,7,,8]),!this.currentAccountId)throw new Error("Cannot enqueue event: No account context set");if(r=null,!this.getSessionInfo)return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.getSessionInfo()];case 2:return r=u.sent(),[3,4];case 3:return i=u.sent(),this.logger.warn("Failed to resolve session ID at enqueue time",i),[3,4];case 4:return e={id:Bv(),event:t,accountId:this.currentAccountId,timestamp:(new Date).toISOString(),attempts:0,status:no.STATUSES.PENDING,visitorId:this.currentVisitorId,visitorRefId:this.currentVisitorRefId,cuid:this.currentCuid,userIdentifierType:this.currentUserIdentifierType,sessionId:r,isDLR:n},[4,this.storage.addEvent(e)];case 5:return u.sent(),this.logger.debug("Event added to queue",{eventId:e.id,eventName:t.name,visitorId:e.visitorId,cuid:e.cuid,sessionId:e.sessionId,isDLR:n}),[4,this.processQueueIfIdle()];case 6:return u.sent(),[3,8];case 7:throw s=u.sent(),this.logger.error("Failed to enqueue event",{event:t,error:s}),s;case 8:return[2]}})})},t.prototype.processQueueIfIdle=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return this.paused?(this.logger.debug("Queue processing paused, skipping"),[2]):this.isProcessing?(this.logger.debug("Queue processing already in progress, skipping"),[2]):(this.processingPromise||(this.processingPromise=this.processQueue()),[2,this.processingPromise])})})},t.prototype.getIdentityKey=function(t){var n,r,i,e,s,u=null!==(n=t.visitorId)&&void 0!==n?n:"_none_",o=null!==(r=t.visitorRefId)&&void 0!==r?r:"_none_",a=null!==(i=t.cuid)&&void 0!==i?i:"_none_",c=null!==(e=t.userIdentifierType)&&void 0!==e?e:"_none_",f=null!==(s=t.sessionId)&&void 0!==s?s:"_none_";return"".concat(u,"|").concat(o,"|").concat(a,"|").concat(c,"|").concat(f)},t.prototype.groupEventsByIdentity=function(t){var n,r,i=new Map;try{for(var e=Wu(t),s=e.next();!s.done;s=e.next()){var u=s.value,o=this.getIdentityKey(u),a=i.get(o);a?a.push(u):i.set(o,[u])}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return Array.from(i.values())},t.prototype.processQueue=function(){return Bu(this,void 0,void 0,function(){var n=this;return Gu(this,function(r){switch(r.label){case 0:return this.isProcessing?[2]:"undefined"!=typeof navigator&&"locks"in navigator?[4,navigator.locks.request(t.QUEUE_LOCK_NAME,{ifAvailable:!0},function(t){return Bu(n,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return t?[4,this.executeProcessQueue()]:(this.logger.debug("Queue lock held by another tab, skipping"),[2]);case 1:return n.sent(),[2]}})})})]:[3,2];case 1:return r.sent(),[3,4];case 2:return[4,this.executeProcessQueue()];case 3:r.sent(),r.label=4;case 4:return[2]}})})},t.prototype.executeProcessQueue=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:this.isProcessing=!0,this.logger.debug("Starting queue processing"),f.label=1;case 1:f.trys.push([1,16,17,18]),f.label=2;case 2:return this.paused?(this.logger.debug("Queue processing paused mid-cycle, stopping"),[3,15]):[4,this.checkAndPromoteRetryEvents()];case 3:return f.sent(),this.currentAccountId?[4,this.storage.getOldestPendingEvents(this.currentAccountId,this.BATCH_SIZE)]:(this.logger.debug("No account context, skipping event processing"),[3,15]);case 4:if(0===(t=f.sent()).length)return this.logger.debug("No pending events to process"),[3,15];n=this.groupEventsByIdentity(t),this.logger.info("Processing events",{totalEvents:t.length,identityGroups:n.length}),f.label=5;case 5:f.trys.push([5,11,12,13]),a=void 0,r=Wu(n),i=r.next(),f.label=6;case 6:return i.done?[3,10]:(e=i.value,s=e[0],this.logger.debug("Processing identity group",{batchSize:e.length,visitorId:null==s?void 0:s.visitorId,cuid:null==s?void 0:s.cuid,sessionId:null==s?void 0:s.sessionId}),[4,this.markEventsAsProcessing(e)]);case 7:return f.sent(),[4,this.sendBatch(e)];case 8:f.sent(),f.label=9;case 9:return i=r.next(),[3,6];case 10:return[3,13];case 11:return u=f.sent(),a={error:u},[3,13];case 12:try{i&&!i.done&&(c=r.return)&&c.call(r)}finally{if(a)throw a.error}return[7];case 13:return[4,this.storage.getPendingEventCount(this.currentAccountId)];case 14:return 0===f.sent()?(this.logger.debug("No more pending events"),[3,15]):[3,2];case 15:return[3,18];case 16:return o=f.sent(),this.logger.error("Queue processing failed",o),[3,18];case 17:return this.isProcessing=!1,this.processingPromise=null,this.logger.debug("Queue processing completed"),[7];case 18:return[2]}})})},t.prototype.markEventsAsProcessing=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),n=Wu(t),r=n.next(),a.label=1;case 1:if(r.done)return[3,6];i=r.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.storage.updateEventStatus(i.id,"processing")];case 3:return a.sent(),[3,5];case 4:return e=a.sent(),this.logger.warn("Failed to mark event as processing",{eventId:i.id,error:e}),[3,5];case 5:return r=n.next(),[3,1];case 6:return[3,9];case 7:return s=a.sent(),u={error:s},[3,9];case 8:try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(u)throw u.error}return[7];case 9:return[2]}})})},t.prototype.sendBatch=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:if(f.trys.push([0,5,,10]),!this.currentAccountId)throw new Error("Missing account context for batch sending");return n=t[0],r=!!(null!==(c=n.visitorId)&&void 0!==c?c:n.visitorRefId),i=!!n.cuid,e=void 0,e=r&&i?"identified":r?"anonymous":"user-only",this.logger.debug("Sending event batch",{batchSize:t.length,trackingMode:e,hasVisitor:r,hasUser:i}),s=t.filter(function(t){return!0===t.isDLR}),(u=t.filter(function(t){return!0!==t.isDLR})).length>0?[4,this.sendRegularEvents(u)]:[3,2];case 1:f.sent(),f.label=2;case 2:return s.length>0?[4,this.sendDLREvents(s)]:[3,4];case 3:f.sent(),f.label=4;case 4:return[2,!0];case 5:return o=f.sent(),a=this.isRetryableHttpError(o),this.logger.error("Failed to send batch",{batchSize:t.length,error:o,isRetryable:a}),a?[4,this.handleFailedBatch(t)]:[3,7];case 6:return f.sent(),[3,9];case 7:return[4,this.removeNonRetryableEvents(t)];case 8:f.sent(),f.label=9;case 9:return[2,!1];case 10:return[2]}})})},t.prototype.sendRegularEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o,a,c,f,h,d,v,l;return Gu(this,function(g){switch(g.label){case 0:if(n=t[0],r=null!==(f=n.visitorId)&&void 0!==f?f:null,i=null!==(h=n.visitorRefId)&&void 0!==h?h:null,e=null!==(d=n.cuid)&&void 0!==d?d:null,s=null!==(v=n.userIdentifierType)&&void 0!==v?v:null,u=null!==(l=n.sessionId)&&void 0!==l?l:null,o=this.apiClient,a=t.map(function(t){return t.event}),!u)throw new Error("Session ID is required for event tracking");return[4,o.sendEvents(a,r||void 0,i||void 0,e||void 0,s||void 0,u)];case 1:return c=g.sent(),[4,this.handleBatchResponse(t,c)];case 2:return g.sent(),[2]}})})},t.prototype.sendDLREvents=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:return n=t[0],r=this.apiClient,i=null!==(o=n.sessionId)&&void 0!==o?o:"",e=fh(i),s={events:t.map(function(t){return t.event}),request_id:Bv(),system_data:e},n.cuid?s.user={identifierName:"id",identifierValue:n.cuid}:n.visitorId&&(s.visitor={identifierName:"id",identifierValue:n.visitorId}),[4,r.sendDLR(s)];case 1:return u=a.sent(),[4,this.handleBatchResponse(t,u)];case 2:return a.sent(),[2]}})})},t.prototype.removeSuccessfulEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:n=t.map(function(t){return t.id}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.storage.removeEvents(n)];case 2:return i.sent(),this.logger.debug("Successfully removed events from storage",{count:n.length}),[3,4];case 3:return r=i.sent(),this.logger.error("Failed to remove events from storage",{eventIds:n,error:r}),[3,4];case 4:return[2]}})})},t.prototype.handleBatchResponse=function(t,n){return Bu(this,void 0,void 0,function(){var r;return Gu(this,function(i){switch(i.label){case 0:return(r=parseInt(n.status.code,10))!==no.GLOBAL_SUCCESS_CODE?[3,2]:[4,this.removeSuccessfulEvents(t)];case 1:return i.sent(),this.logger.info("All events processed successfully",{count:t.length}),[3,8];case 2:return r!==no.PARTIAL_SUCCESS_CODE?[3,4]:[4,this.handlePartialSuccess(t,n.events)];case 3:return i.sent(),[3,8];case 4:return no.RETRYABLE_HTTP_CODES.includes(r)?[4,this.handleFailedBatch(t)]:[3,6];case 5:return i.sent(),this.logger.warn("Batch failed with retryable error",{code:r,message:n.status.message}),[3,8];case 6:return[4,this.removeNonRetryableEvents(t)];case 7:i.sent(),this.logger.error("Batch failed with non-retryable error",{code:r,message:n.status.message}),i.label=8;case 8:return[2]}})})},t.prototype.handlePartialSuccess=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u,o,a,c,f;return Gu(this,function(h){switch(h.label){case 0:r=new Map,n.forEach(function(t){r.set(t.eventRefId,t)}),h.label=1;case 1:h.trys.push([1,12,13,14]),i=Wu(t),e=i.next(),h.label=2;case 2:return e.done?[3,11]:(s=e.value,(u=r.get(s.event.eventRefId))?[3,4]:[4,this.markEventForRetry(s,"No response received")]);case 3:return h.sent(),[3,10];case 4:return u.status.success?[4,this.storage.removeEvents([s.id])]:[3,6];case 5:return h.sent(),this.logger.debug("Event processed successfully",{eventId:s.id}),[3,10];case 6:return o=parseInt(u.status.code,10),no.RETRYABLE_HTTP_CODES.includes(o)?[4,this.markEventForRetry(s,u.status.message)]:[3,8];case 7:return h.sent(),this.logger.debug("Event marked for retry",{eventId:s.id,code:o,message:u.status.message}),[3,10];case 8:return[4,this.storage.removeEvents([s.id])];case 9:h.sent(),this.logger.warn("Event permanently failed - removed",{eventId:s.id,code:o,message:u.status.message}),h.label=10;case 10:return e=i.next(),[3,2];case 11:return[3,14];case 12:return a=h.sent(),c={error:a},[3,14];case 13:try{e&&!e.done&&(f=i.return)&&f.call(i)}finally{if(c)throw c.error}return[7];case 14:return[2]}})})},t.prototype.markEventForRetry=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e;return Gu(this,function(s){switch(s.label){case 0:return r=(t.attempts||0)+1,[4,this.storage.updateEventStatus(t.id,"failed","Attempt ".concat(r," failed: ").concat(n),r)];case 1:return s.sent(),i=Math.min(Math.max(r-1,0),this.RETRY_DELAYS.length-1),e=this.RETRY_DELAYS[i],this.logger.debug("Event marked for retry",{eventId:t.id,attempts:r,delay:e,isInfiniteRetry:r>this.RETRY_DELAYS.length}),[2]}})})},t.prototype.checkAndPromoteRetryEvents=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c,f,h;return Gu(this,function(d){switch(d.label){case 0:return d.trys.push([0,10,,11]),this.currentAccountId?[4,this.storage.getRetryableEvents(this.currentAccountId,Number.MAX_SAFE_INTEGER)]:(this.logger.debug("No account context, skipping retry check"),[2]);case 1:if(0===(t=d.sent()).length)return[2];n=0,d.label=2;case 2:d.trys.push([2,7,8,9]),r=Wu(t),i=r.next(),d.label=3;case 3:return i.done?[3,6]:(e=i.value,s=Math.min(Math.max(e.attempts-1,0),this.RETRY_DELAYS.length-1),u=this.RETRY_DELAYS[s],(o=Date.now()-(e.lastAttempt||0))>=(u||0)?[4,this.storage.updateEventStatus(e.id,"pending")]:[3,5]);case 4:d.sent(),n++,this.logger.debug("Failed event promoted to pending",{eventId:e.id,attempt:e.attempts+1,delay:u,timeSinceLastAttempt:o}),d.label=5;case 5:return i=r.next(),[3,3];case 6:return[3,9];case 7:return a=d.sent(),f={error:a},[3,9];case 8:try{i&&!i.done&&(h=r.return)&&h.call(r)}finally{if(f)throw f.error}return[7];case 9:return n>0&&this.logger.debug("Promoted ".concat(n," failed events for retry")),[3,11];case 10:return c=d.sent(),this.logger.error("Failed to check retry events",c),[3,11];case 11:return[2]}})})},t.prototype.isRetryableHttpError=function(t){var n,r,i,e,s=t;if(s.code){var u=parseInt(s.code,10);return no.RETRYABLE_HTTP_CODES.includes(u)}return null!==(e=(null===(n=s.message)||void 0===n?void 0:n.includes("network"))||(null===(r=s.message)||void 0===r?void 0:r.includes("timeout"))||(null===(i=s.message)||void 0===i?void 0:i.includes("fetch")))&&void 0!==e&&e},t.prototype.removeNonRetryableEvents=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:n=t.map(function(t){return t.id}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.storage.removeEvents(n)];case 2:return i.sent(),this.logger.warn("Non-retryable events removed permanently",{eventIds:n}),[3,4];case 3:return r=i.sent(),this.logger.error("Failed to remove non-retryable events",{eventIds:n,error:r}),[3,4];case 4:return[2]}})})},t.prototype.handleFailedBatch=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),n=Wu(t),r=n.next(),a.label=1;case 1:if(r.done)return[3,6];i=r.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.markEventForRetry(i,"Batch failed")];case 3:return a.sent(),[3,5];case 4:return e=a.sent(),this.logger.error("Failed to mark event for retry",{eventId:i.id,error:e}),[3,5];case 5:return r=n.next(),[3,1];case 6:return[3,9];case 7:return s=a.sent(),u={error:s},[3,9];case 8:try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(u)throw u.error}return[7];case 9:return[2]}})})},t.prototype.pause=function(){this.paused=!0,this.logger.info("EventQueue paused")},t.prototype.resume=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.paused=!1,this.logger.info("EventQueue resumed"),[4,this.processQueueIfIdle()];case 1:return t.sent(),[2]}})})},t.prototype.flush=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Manual flush requested"),[4,this.processQueueIfIdle()];case 1:return t.sent(),[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Destroying EventQueue"),this.processingPromise?[4,this.processingPromise]:[3,2];case 1:t.sent(),t.label=2;case 2:return[4,this.storage.close()];case 3:return t.sent(),this.logger.info("EventQueue destroyed"),[2]}})})},t.QUEUE_LOCK_NAME="websdk-event-queue-lock",t}(),kl=function(){function t(t,n,r,i){this.eventQueue=null,this.initialized=!1,this.visitorId=null,this.visitorTrackingEnabled=null,this.config=t,this.logger=i,this.apiClient=n,this.storageManager=r}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.initialized?(this.logger.warn("EventTracker already initialized"),[2]):(this.logger.info("Initializing EventTracker with IndexedDB queue"),this.eventQueue=new Tl(this.apiClient,this.logger,this.storageManager,this.config.retryDelays,this.config.batchSize),[4,this.eventQueue.init()]);case 1:return t.sent(),this.initialized=!0,this.logger.info(po),[2]}})})},t.prototype.setUserContext=function(t,n,r){return Bu(this,void 0,void 0,function(){return Gu(this,function(i){switch(i.label){case 0:if(!this.eventQueue)throw new Error("EventTracker not initialized");return[4,this.eventQueue.setUserContext(t,n,r)];case 1:return i.sent(),this.logger.info("User context set",{accountId:t,cuid:n,userIdentifierType:r}),[2]}})})},t.prototype.setVisitorTrackingState=function(t,n,r){this.visitorId=t,this.visitorTrackingEnabled=n,this.eventQueue&&this.eventQueue.setVisitorContext(t,r),this.logger.debug("Visitor tracking state updated",{visitorId:t,visitorRefId:r,isEnabled:n,trackingMode:t?"anonymous":"not-configured"})},t.prototype.setSessionInfoCallback=function(t){if(!this.eventQueue)throw new Error("EventTracker not initialized");this.eventQueue.setSessionInfoCallback(t),this.logger.debug("Session info callback set in EventTracker")},t.prototype.clearUserContext=function(){this.eventQueue?(this.eventQueue.clearUserContext(),this.logger.info("User context cleared from EventTracker")):this.logger.warn("Cannot clear user context - EventTracker not initialized")},t.prototype.track=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:if(!this.initialized||!this.eventQueue)throw new Error("EventTracker not initialized");if(!1===this.visitorTrackingEnabled)throw this.logger.warn("Event tracking is disabled - visitor tracking is not enabled"),new Error("Event tracking is disabled");this.logger.debug("Tracking event",{event:t}),i.label=1;case 1:return i.trys.push([1,3,,4]),n=this.convertToApiEvent(t),[4,this.eventQueue.enqueue(n)];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.logger.error(bo,{event:t,error:r}),new Error("".concat(vo,": ").concat(r));case 4:return[2]}})})},t.prototype.convertToApiEvent=function(t){if(!t.name||""===t.name.trim())throw new Error("Event name is required");var n=zu({},t.data);if(!this.eventQueue)throw new Error("EventTracker not initialized");var r,i=this.eventQueue.getCurrentCuid();if(!i&&!this.visitorId){var e=null===this.visitorTrackingEnabled?"Cannot track event: User must be identified (cuid) or visitor tracking must be configured":"Cannot track event: Either visitor tracking must be enabled or user must be identified";throw this.logger.error(e,{hasVisitorId:!!this.visitorId,hasCuid:!1,visitorTrackingEnabled:this.visitorTrackingEnabled}),new Error(e)}return r=this.visitorId&&i?"identified":this.visitorId?"anonymous":"user-only",this.logger.debug("Creating event payload",{eventName:t.name,hasCuid:!!i,hasVisitorId:!!this.visitorId,trackingMode:r,visitorTrackingEnabled:this.visitorTrackingEnabled}),function(t,n){if(!t||""===t.trim())throw new Error("Event name is required");return{name:t.trim(),eventRefId:Bv(),eventDateTime:(new Date).toISOString(),attributes:n||{}}}(t.name,n)},t.prototype.pause=function(){this.eventQueue&&this.eventQueue.pause(),this.logger.info("EventTracker paused")},t.prototype.resume=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.eventQueue?[4,this.eventQueue.resume()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.logger.info("EventTracker resumed"),[2]}})})},t.prototype.flush=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.initialized&&this.eventQueue?(this.logger.info("Manual flush requested"),[4,this.eventQueue.flush()]):(this.logger.warn("Cannot flush events - EventTracker not initialized"),[2]);case 1:return t.sent(),[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Destroying EventTracker"),this.eventQueue?[4,this.eventQueue.destroy()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.initialized=!1,this.logger.info(yo),[2]}})})},t.prototype.trackNotificationReceived=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return[4,this.trackDLREvent("received",t)];case 1:return n.sent(),[2]}})})},t.prototype.trackNotificationClicked=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return[4,this.trackDLREvent("clicked",t)];case 1:return n.sent(),[2]}})})},t.prototype.trackNotificationDismissed=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return[4,this.trackDLREvent("dismissed",t)];case 1:return n.sent(),[2]}})})},t.prototype.trackDLREvent=function(t,n){return Bu(this,void 0,void 0,function(){var r,i;return Gu(this,function(e){switch(e.label){case 0:if(!this.initialized||!this.eventQueue)return this.logger.warn("EventTracker not initialized, skipping DLR event",{eventType:t}),[2];e.label=1;case 1:return e.trys.push([1,3,,4]),r=this.createDLREvent(t,n),[4,this.eventQueue.enqueue(r,!0)];case 2:return e.sent(),this.logger.info("DLR event tracked: ".concat(t),{eventType:t,eventName:r.name,messageId:n.messageId}),[3,4];case 3:return i=e.sent(),this.logger.error("Failed to track DLR event",{eventType:t,notificationData:n,error:i}),[3,4];case 4:return[2]}})})},t.prototype.createDLREvent=function(t,n){var r,i={received:Sa.NOTIFICATION_RECEIVED,clicked:Sa.NOTIFICATION_CLICKED,dismissed:Sa.NOTIFICATION_DISMISSED},e=null===(r=this.eventQueue)||void 0===r?void 0:r.getCurrentCuid(),s={messageId:n.messageId,gateway:Ta,result:{received:"SUCCESS",clicked:"CLICKED",dismissed:"DISMISSED"}[t],notification_route:ka,cuid:e||null,visitor_id:e?null:this.visitorId||null,scope:n.scope||null};return n.senderId&&(s.senderId=n.senderId),{attributes:s,name:i[t],eventDateTime:(new Date).toISOString(),eventRefId:Bv()}},t.prototype.dispatchDLREvent=function(t){return Bu(this,void 0,void 0,function(){var n;return Gu(this,function(r){switch(r.label){case 0:switch(n=zu(zu(zu(zu(zu(zu({messageId:t.messageId},void 0!==t.scope?{scope:t.scope}:{}),void 0!==t.campaignId?{campaignId:t.campaignId}:{}),void 0!==t.variationId?{variationId:t.variationId}:{}),void 0!==t.senderId?{senderId:t.senderId}:{}),void 0!==t.cuid?{cuid:t.cuid}:{}),void 0!==t.accountId?{accountId:t.accountId}:{}),t.type){case"received":return[3,1];case"clicked":return[3,3];case"dismissed":return[3,5]}return[3,7];case 1:return[4,this.trackNotificationReceived(n)];case 2:case 4:case 6:return r.sent(),[3,7];case 3:return[4,this.trackNotificationClicked(n)];case 5:return[4,this.trackNotificationDismissed(n)];case 7:return[2]}})})},t.prototype.processPendingServiceWorkerDLREvents=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:if(!this.initialized)return[2];a.label=1;case 1:return a.trys.push([1,12,,13]),[4,this.getServiceWorkerPendingDLREvents()];case 2:if(0===(t=a.sent()).length)return[2];this.logger.info("Processing pending service worker DLR events",{count:t.length}),a.label=3;case 3:a.trys.push([3,8,9,10]),n=Wu(t),r=n.next(),a.label=4;case 4:return r.done?[3,7]:(i=r.value,[4,this.dispatchDLREvent(i)]);case 5:a.sent(),a.label=6;case 6:return r=n.next(),[3,4];case 7:return[3,10];case 8:return e=a.sent(),u={error:e},[3,10];case 9:try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(u)throw u.error}return[7];case 10:return[4,this.clearServiceWorkerPendingDLREvents()];case 11:return a.sent(),this.logger.info("Processed pending service worker DLR events",{count:t.length}),[3,13];case 12:return s=a.sent(),this.logger.error("Failed to process pending service worker DLR events",s),[3,13];case 13:return[2]}})})},t.prototype.getServiceWorkerPendingDLREvents=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return[2,new Promise(function(t){var n=indexedDB.open("WebSDK_DLR_SW",1);n.onerror=function(){return t([])},n.onsuccess=function(){var r=n.result;if(!r.objectStoreNames.contains("pending_dlr_events"))return r.close(),void t([]);var i=r.transaction(["pending_dlr_events"],"readonly").objectStore("pending_dlr_events").getAll();i.onerror=function(){r.close(),t([])},i.onsuccess=function(){r.close(),t(i.result||[])}},n.onupgradeneeded=function(t){var n=t.target.result;n.objectStoreNames.contains("pending_dlr_events")||n.createObjectStore("pending_dlr_events",{keyPath:"id",autoIncrement:!0})}})]})})},t.prototype.clearServiceWorkerPendingDLREvents=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return[2,new Promise(function(t){var n=indexedDB.open("WebSDK_DLR_SW",1);n.onerror=function(){return t()},n.onsuccess=function(){var r=n.result;if(!r.objectStoreNames.contains("pending_dlr_events"))return r.close(),void t();var i=r.transaction(["pending_dlr_events"],"readwrite").objectStore("pending_dlr_events").clear();i.onerror=function(){r.close(),t()},i.onsuccess=function(){r.close(),t()}},n.onupgradeneeded=function(t){var n=t.target.result;n.objectStoreNames.contains("pending_dlr_events")||n.createObjectStore("pending_dlr_events",{keyPath:"id",autoIncrement:!0})}})]})})},t}(),Rl=function(){function t(t,n,r){this.initialized=!1,this.logger=t,this.brandId=n,this.applicationId=r,this.adapter=new Al}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:if(this.initialized)return this.logger.warn("StorageManager already initialized"),[2];this.logger.info("Initializing StorageManager"),e.label=1;case 1:return e.trys.push([1,6,,7]),this.isIndexedDBSupported()?(t=["WebSDK"],this.brandId&&t.push(this.brandId),this.applicationId&&t.push(this.applicationId),n=t.join("_"),r=new Sl(n),[4,this.testStorageAdapter(r)]):[3,3];case 2:return e.sent(),this.adapter=r,this.logger.info("StorageManager initialized with IndexedDB",{dbName:n,brandId:this.brandId,applicationId:this.applicationId}),[3,5];case 3:return[4,this.testStorageAdapter(this.adapter)];case 4:e.sent(),this.logger.info("StorageManager initialized with localStorage"),e.label=5;case 5:return this.initialized=!0,[3,7];case 6:throw i=e.sent(),this.logger.error(So,i),new Error("Storage initialization failed: ".concat(i));case 7:return[2]}})})},t.prototype.isIndexedDBSupported=function(){return"undefined"!=typeof window&&"indexedDB"in window&&null!==indexedDB},t.prototype.testStorageAdapter=function(t){return Bu(this,void 0,void 0,function(){var n,r,i;return Gu(this,function(e){switch(e.label){case 0:n=oo,r=ao,e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.setItem(n,r)];case 2:return e.sent(),[4,t.getItem(n)];case 3:if(e.sent()!==r)throw new Error(ko);return[4,t.removeItem(n)];case 4:return e.sent(),[3,6];case 5:throw i=e.sent(),new Error("".concat(To," ").concat(i));case 6:return[2]}})})},t.prototype.get=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.getItem(t)]})})},t.prototype.set=function(t,n){return Bu(this,void 0,void 0,function(){return Gu(this,function(r){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.setItem(t,n)]})})},t.prototype.remove=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.removeItem(t)]})})},t.prototype.clear=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.clear()]})})},t.prototype.getIndexedDBAdapter=function(){return this.adapter instanceof Sl?this.adapter:null},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:this.logger.info("Destroying StorageManager"),n.label=1;case 1:return n.trys.push([1,4,,5]),this.adapter instanceof Sl?[4,this.adapter.close()]:[3,3];case 2:n.sent(),n.label=3;case 3:return this.initialized=!1,this.logger.info(Ro),[3,5];case 4:return t=n.sent(),this.logger.error(Ao,t),this.initialized=!1,[3,5];case 5:return[2]}})})},t}(),Al=function(){function t(){}return t.prototype.getItem=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){try{return[2,localStorage.getItem(t)]}catch(t){throw new Error("LocalStorage getItem failed: ".concat(t))}return[2]})})},t.prototype.setItem=function(t,n){return Bu(this,void 0,void 0,function(){return Gu(this,function(r){try{localStorage.setItem(t,n)}catch(t){if(t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name))throw new Error("LocalStorage quota exceeded");throw new Error("LocalStorage setItem failed: ".concat(t))}return[2]})})},t.prototype.removeItem=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){try{localStorage.removeItem(t)}catch(t){throw new Error("LocalStorage removeItem failed: ".concat(t))}return[2]})})},t.prototype.clear=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){try{localStorage.clear()}catch(t){throw new Error("LocalStorage clear failed: ".concat(t))}return[2]})})},t}();!function(t){t[t.VERBOSE=0]="VERBOSE",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.NONE=5]="NONE"}(Il||(Il={}));var _l,Ol,Cl=function(){function t(t,n){void 0===t&&(t=!1),void 0===n&&(n=Il.INFO),this.logs=[],this.maxLogs=1e3,this.enabled=t,this.level=n}return t.prototype.formatMessage=function(t,n){var r=(new Date).toISOString(),i=Il[t];return"[".concat(r,"] [WebSDK:").concat(i,"] ").concat(n)},t.prototype.log=function(t,n,r){if(this.enabled&&!(t<this.level)){var i={level:t,message:n,timestamp:Date.now(),data:r};this.logs.push(i),this.logs.length>this.maxLogs&&this.logs.shift();var e=this.formatMessage(t,n),s=r?[e,r]:[e];switch(t){case Il.VERBOSE:case Il.DEBUG:console.debug.apply(console,Hu([],qu(s),!1));break;case Il.INFO:console.info.apply(console,Hu([],qu(s),!1));break;case Il.WARN:console.warn.apply(console,Hu([],qu(s),!1));break;case Il.ERROR:console.error.apply(console,Hu([],qu(s),!1))}}},t.prototype.verbose=function(t,n){this.log(Il.VERBOSE,t,n)},t.prototype.debug=function(t,n){this.log(Il.DEBUG,t,n)},t.prototype.info=function(t,n){this.log(Il.INFO,t,n)},t.prototype.warn=function(t,n){this.log(Il.WARN,t,n)},t.prototype.error=function(t,n){this.log(Il.ERROR,t,n)},t.prototype.setLevel=function(t){this.level=t},t.prototype.setEnabled=function(t){this.enabled=t},t.prototype.getLogs=function(){return Hu([],qu(this.logs),!1)},t.prototype.clearLogs=function(){this.logs=[]},t}(),Dl=function(){function t(t,n,r,i,e,s){this.initialized=!1,this.cachedConfig=null,this.orgId=t,this.apiClient=n,this.logger=r,this.storageManager=i,void 0!==e&&(this.brandId=e),void 0!==s&&(this.applicationId=s)}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.initialized?(this.logger.warn("VisitorConfigManager already initialized"),[2]):(this.logger.info("Initializing VisitorConfigManager",{orgId:this.orgId}),[4,this.restoreCachedConfig()]);case 1:return t.sent(),this.initialized=!0,this.logger.info(jo),[2]}})})},t.prototype.fetchConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i=this;return Gu(this,function(e){switch(e.label){case 0:if(!this.initialized)throw new Error("VisitorConfigManager not initialized");if(this.cachedConfig)return this.logger.info(Go),[2,this.cachedConfig];e.label=1;case 1:return e.trys.push([1,4,,5]),this.logger.info("Fetching visitor config from API",{orgId:this.orgId}),[4,this.apiClient.getVisitorConfig(this.orgId)];case 2:return(t=e.sent()).warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){i.logger.warn("Visitor config warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0&&t.errors.forEach(function(t){i.logger.error("Visitor config error from response",{code:t.code,message:t.message})}),this.cachedConfig=t,[4,this.storeCachedConfig(t)];case 3:return e.sent(),this.logger.info(Vo,{isEnabled:null===(r=t.data)||void 0===r?void 0:r.visitorTrackingEnabled}),[2,t];case 4:throw n=e.sent(),this.logger.error(Lo,n),new Error("".concat(lo,": ").concat(n));case 5:return[2]}})})},t.prototype.isVisitorTrackingEnabled=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.fetchConfig()];case 1:return t=e.sent(),(n=!0===(null===(i=t.data)||void 0===i?void 0:i.visitorTrackingEnabled))?this.logger.info(Bo):this.logger.info(zo),[2,n];case 2:return r=e.sent(),this.logger.error("Failed to check visitor tracking status",r),[2,!1];case 3:return[2]}})})},t.prototype.refreshConfig=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){if(!this.initialized)throw new Error("VisitorConfigManager not initialized");return this.logger.info("Force refreshing visitor config from API"),this.cachedConfig=null,[2,this.fetchConfig()]})})},t.prototype.getCachedConfig=function(){return this.cachedConfig},t.prototype.storeCachedConfig=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("VISITOR_CONFIG",this.brandId,this.applicationId),[4,this.storageManager.set(n,JSON.stringify(t))];case 1:return i.sent(),this.logger.debug("Visitor config cached to storage",{key:n}),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to store visitor config to cache",r),[3,3];case 3:return[2]}})})},t.prototype.restoreCachedConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e;return Gu(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),t=so("VISITOR_CONFIG",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=s.sent())&&(r=JSON.parse(n),this.cachedConfig=r,this.logger.info("Visitor config restored from cache",{isEnabled:null===(e=r.data)||void 0===e?void 0:e.visitorTrackingEnabled})),[3,3];case 2:return i=s.sent(),this.logger.warn("Failed to restore visitor config from cache",i),this.cachedConfig=null,[3,3];case 3:return[2]}})})},t.prototype.clearCachedConfig=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:this.cachedConfig=null,r.label=1;case 1:return r.trys.push([1,3,,4]),t=so("VISITOR_CONFIG",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 2:return r.sent(),this.logger.debug("Visitor config cache cleared"),[3,4];case 3:return n=r.sent(),this.logger.warn("Failed to clear visitor config cache",n),[3,4];case 4:return[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Destroying VisitorConfigManager"),[4,this.clearCachedConfig()];case 1:return t.sent(),this.initialized=!1,this.logger.info("VisitorConfigManager destroyed successfully"),[2]}})})},t}(),Nl={};Ol||(Ol=1,function(){if(_l)return Nl;_l=1;var t=Ti(),n=_();t({global:!0,forced:n.globalThis!==n},{globalThis:n})}());var Fl,Pl=function(){function t(t,n,r,i,e,s,u){this.initialized=!1,this.visitorId=null,this.visitorRefId=null,this.expiredAt=null,this.getFcmToken=null,this.getChannelType=null,this.getExtendedFields=null,this.getPermissionGranted=null,this.mergeRetryTimeoutId=null,this.accountId=t,this.orgId=n,this.source=r,this.apiClient=i,this.logger=e,this.storageManager=s,void 0!==(null==u?void 0:u.brandId)&&(this.brandId=u.brandId),void 0!==(null==u?void 0:u.applicationId)&&(this.applicationId=u.applicationId)}return t.prototype.setMergeDataProviders=function(t,n,r,i){this.getFcmToken=t,this.getChannelType=n,this.getExtendedFields=r,this.getPermissionGranted=i},t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.initialized?(this.logger.warn("AnonymousVisitorManager already initialized"),[2]):(this.logger.info("Initializing AnonymousVisitorManager",{accountId:this.accountId,orgId:this.orgId}),[4,this.restoreVisitorId()]);case 1:return t.sent(),this.initialized=!0,this.logger.info(Wo),[2]}})})},t.prototype.getOrCreateVisitorId=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:if(!this.initialized)throw new Error("AnonymousVisitorManager not initialized");if(this.visitorId&&!this.isVisitorExpired())return this.logger.info(Xo,{visitorId:this.visitorId}),[2,this.visitorId];if(this.visitorId&&this.isVisitorExpired()&&this.logger.info("Visitor session expired, creating new visitor via API",{visitorId:this.visitorId,expiredAt:this.expiredAt}),!this.accountId||""===this.accountId.trim())throw r=new Error("AccountId is required for visitor creation"),this.logger.error("Visitor creation validation failed",r),r;o.label=1;case 1:return o.trys.push([1,5,,6]),this.logger.info("Creating new visitor ID",{accountId:this.accountId,hasCommChannels:!!t&&t.length>0,hasExtendedFields:!!n}),[4,this.createVisitor(t,n)];case 2:return i=o.sent(),e=i.visitorId,s=i.expiredAt,this.visitorId=e,[4,this.storeVisitorId(e)];case 3:return o.sent(),[4,this.storeExpiredAt(s)];case 4:return o.sent(),this.logger.info(qo,{visitorId:e}),[2,e];case 5:throw u=o.sent(),this.logger.error(Ho,u),u;case 6:return[2]}})})},t.prototype.createVisitor=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.getOrGenerateVisitorRefId()];case 1:return r=o.sent(),i=t&&t.length>0?t:[],e=zu({visitorRefId:r,profiles:[{source:this.source,accountId:this.accountId,commChannels:i}]},n&&{extendedFields:n}),this.logger.debug("Visitor creation request payload",{request:e}),[4,this.apiClient.createVisitor(this.orgId,e)];case 2:return s=o.sent(),[2,this.handleCreateVisitorResponse(s)];case 3:throw u=o.sent(),this.handleCreateVisitorError(u),u;case 4:return[2]}})})},t.prototype.handleCreateVisitorResponse=function(t){var n,r,i=this;t.warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){i.logger.warn("Visitor creation warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0&&t.errors.forEach(function(t){i.logger.error("Visitor creation error from response",{code:t.code,message:t.message})});var e=null===(n=t.data)||void 0===n?void 0:n.id;if(!e||""===e.trim())throw new Error("Invalid visitor ID received from API");var s=null===(r=t.data)||void 0===r?void 0:r.expiredAt;if(!s)throw new Error("Missing expiredAt in visitor creation response");return{visitorId:e,expiredAt:s}},t.prototype.handleCreateVisitorError=function(t){var n,r=this;try{var i=(null===(n=t.response)||void 0===n?void 0:n.data)||t;i.warnings&&i.warnings.length>0&&i.warnings.forEach(function(t){t.code===Ea.ACCOUNT_NOT_EXISTS?r.logger.error("Account does not exist",{code:t.code,message:t.message,accountId:r.accountId}):r.logger.warn("Visitor creation warning",{code:t.code,message:t.message})}),i.errors&&i.errors.length>0&&i.errors.forEach(function(t){t.code===Ea.ACCOUNT_ID_NOT_PASSED?r.logger.error("AccountId not passed",{code:t.code,message:t.message}):r.logger.error("Visitor creation error",{code:t.code,message:t.message})})}catch(t){this.logger.warn("Failed to parse visitor creation error",t)}},t.prototype.updateVisitor=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:if(!this.initialized)throw new Error("AnonymousVisitorManager not initialized");if(!this.visitorId)throw new Error("No visitor ID exists. Create a visitor first.");o.label=1;case 1:return o.trys.push([1,3,,4]),this.logger.info("Updating visitor",{visitorId:this.visitorId,hasCommChannels:!!t&&t.length>0,hasExtendedFields:!!n}),r=t&&t.length>0?t:[],i=zu({profiles:[{source:this.source,accountId:this.accountId,commChannels:r}]},n&&{extendedFields:n}),this.logger.debug("Visitor update request payload",{request:i}),[4,this.apiClient.updateVisitor(this.orgId,this.visitorId,i)];case 2:return e=o.sent(),s=this.handleUpdateVisitorResponse(e),this.logger.info($o,{visitorId:s}),[2,s];case 3:throw u=o.sent(),this.handleUpdateVisitorError(u),this.logger.error(Qo,u),u;case 4:return[2]}})})},t.prototype.handleUpdateVisitorResponse=function(t){var n,r=this;t.warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){r.logger.warn("Visitor update warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0&&t.errors.forEach(function(t){r.logger.error("Visitor update error from response",{code:t.code,message:t.message})});var i=null===(n=t.data)||void 0===n?void 0:n.id;if(!i||""===i.trim())throw new Error("Invalid visitor ID received from update API");return i},t.prototype.handleUpdateVisitorError=function(t){var n,r=this;try{var i=(null===(n=t.response)||void 0===n?void 0:n.data)||t;i.warnings&&i.warnings.length>0&&i.warnings.forEach(function(t){t.code===Ea.ACCOUNT_NOT_EXISTS?r.logger.error("Account does not exist",{code:t.code,message:t.message,accountId:r.accountId}):r.logger.warn("Visitor update warning",{code:t.code,message:t.message})}),i.errors&&i.errors.length>0&&i.errors.forEach(function(t){r.logger.error("Visitor update error",{code:t.code,message:t.message})})}catch(t){this.logger.warn("Failed to parse visitor update error",t)}},t.prototype.mergeVisitorWithUser=function(t,n,r,i,e,s){var u=this;if(this.initialized)if(this.visitorId)if(r||i||e){var o=this.visitorId,a=this.visitorRefId;this.isMerged().then(function(c){if(!c)return u.persistPendingMerge(o,a,zu(zu(zu(zu({firstName:t,lastName:n},void 0!==r&&{email:r}),void 0!==i&&{mobile:i}),void 0!==e&&{externalId:e}),void 0!==s&&{customData:s})).then(function(){return u.attemptPendingMerge()});u.logger.info(Zo,{reason:"Visitor already merged",visitorId:o})}).catch(function(t){u.logger.warn("Merge background task failed unexpectedly",t)})}else this.logger.warn(Zo,{reason:"No email, mobile, or externalId"});else this.logger.warn(Zo,{reason:"No visitor ID"});else this.logger.warn(Zo,{reason:"Not initialized"})},t.prototype.retryPendingMerge=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,7,,8]),[4,this.getPendingMerge()];case 1:return(t=r.sent())?[4,this.isMerged()]:[2];case 2:return r.sent()?[4,this.clearPendingMerge()]:[3,4];case 3:return r.sent(),this.logger.info(Zo,{reason:"Already merged"}),[2];case 4:return t.attempts>=ma?(this.logger.error(Yo,{visitorId:t.visitorId,attempts:t.attempts,message:"Max retries exhausted"}),[4,this.clearPendingMerge()]):[3,6];case 5:return r.sent(),[2];case 6:return this.scheduleMergeRetry(),[3,8];case 7:return n=r.sent(),this.logger.warn("Failed to retry pending merge",n),[3,8];case 8:return[2]}})})},t.prototype.cancelMergeRetryTimer=function(){null!==this.mergeRetryTimeoutId&&(globalThis.clearTimeout(this.mergeRetryTimeoutId),this.mergeRetryTimeoutId=null)},t.prototype.scheduleMergeRetry=function(){var t=this;this.cancelMergeRetryTimer(),this.mergeRetryTimeoutId=globalThis.setTimeout(function(){t.mergeRetryTimeoutId=null,t.attemptPendingMerge().catch(function(n){t.logger.warn("Scheduled merge retry failed unexpectedly",n)})},pa)},t.prototype.attemptPendingMerge=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o;return Gu(this,function(a){switch(a.label){case 0:return[4,this.getPendingMerge()];case 1:if(!(t=a.sent()))return[2];n=this.getFcmToken?this.getFcmToken():null,r=this.getChannelType?this.getChannelType():void 0,i=!this.getPermissionGranted||this.getPermissionGranted(),a.label=2;case 2:return a.trys.push([2,6,,7]),this.getExtendedFields?[4,this.getExtendedFields()]:[3,4];case 3:return s=a.sent(),[3,5];case 4:s=void 0,a.label=5;case 5:return e=s,[3,7];case 6:return u=a.sent(),this.logger.warn("Failed to collect extended fields for merge, proceeding without them",u),e=void 0,[3,7];case 7:return a.trys.push([7,11,,13]),[4,this.apiClient.mergeVisitor(t.visitorId,t.visitorRefId||null,zu(zu(zu(zu(zu(zu(zu({firstName:t.firstName,lastName:t.lastName},void 0!==t.email&&{email:t.email}),void 0!==t.mobile&&{mobile:t.mobile}),n?{fcmToken:n,subscribed:i}:{}),void 0!==r&&{channelType:r}),{fields:t.customData||{}}),void 0!==e&&{extendedFields:e}),void 0!==t.externalId&&{externalId:t.externalId}))];case 8:return a.sent(),[4,this.markAsMerged(t.visitorId)];case 9:return a.sent(),[4,this.clearPendingMerge()];case 10:return a.sent(),this.logger.info(Jo,{visitorId:t.visitorId,attempts:t.attempts+1}),[3,13];case 11:return o=a.sent(),[4,this.handleMergeRetryOrAbort(o,t)];case 12:return a.sent(),[3,13];case 13:return[2]}})})},t.prototype.handleMergeRetryOrAbort=function(t,n){return Bu(this,void 0,void 0,function(){var r;return Gu(this,function(i){switch(i.label){case 0:return t instanceof Xv?[4,this.clearPendingMerge()]:[3,2];case 1:return i.sent(),this.logger.error("Visitor merge failed permanently, will not retry",{code:t.code,message:t.message,visitorId:n.visitorId}),[2];case 2:return r=zu(zu({},n),{attempts:n.attempts+1}),[4,this.savePendingMerge(r)];case 3:return i.sent(),r.attempts>=ma?(this.logger.error(Yo,{visitorId:n.visitorId,attempts:r.attempts,message:"Max retries exhausted"}),[4,this.clearPendingMerge()]):[3,5];case 4:return i.sent(),[2];case 5:return this.logger.warn("Visitor merge attempt failed, scheduling retry",{attempt:r.attempts,maxRetries:ma,nextRetryMs:pa,visitorId:n.visitorId,error:t}),this.scheduleMergeRetry(),[2]}})})},t.prototype.persistPendingMerge=function(t,n,r){return Bu(this,void 0,void 0,function(){var i,e,s,u,o,a,c;return Gu(this,function(f){switch(f.label){case 0:return i=r.firstName,e=r.lastName,s=r.email,u=r.mobile,o=r.externalId,a=r.customData,c=zu(zu(zu(zu(zu(zu(zu({visitorId:t},n&&{visitorRefId:n}),{firstName:i,lastName:e}),void 0!==s&&{email:s}),void 0!==u&&{mobile:u}),void 0!==o&&{externalId:o}),void 0!==a&&{customData:a}),{attempts:0}),[4,this.savePendingMerge(c)];case 1:return f.sent(),this.logger.debug("Pending merge request persisted to storage",{visitorId:t}),[2]}})})},t.prototype.getPendingMerge=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=so("PENDING_MERGE",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=i.sent())?[2,JSON.parse(n)]:[2,null];case 2:return r=i.sent(),this.logger.warn("Failed to read pending merge from storage",r),[2,null];case 3:return[2]}})})},t.prototype.savePendingMerge=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("PENDING_MERGE",this.brandId,this.applicationId),[4,this.storageManager.set(n,JSON.stringify(t))];case 1:return i.sent(),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to save pending merge to storage",r),[3,3];case 3:return[2]}})})},t.prototype.clearPendingMerge=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:this.cancelMergeRetryTimer(),r.label=1;case 1:return r.trys.push([1,3,,4]),t=so("PENDING_MERGE",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 2:return r.sent(),this.logger.debug("Pending merge cleared from storage"),[3,4];case 3:return n=r.sent(),this.logger.warn("Failed to clear pending merge from storage",n),[3,4];case 4:return[2]}})})},t.prototype.isMerged=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return[2,null!=r.sent()];case 2:return n=r.sent(),this.logger.warn("Failed to check merge status",n),[2,!1];case 3:return[2]}})})},t.prototype.getMergedUserId=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=so("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return[2,null!=(n=i.sent())?n:null];case 2:return r=i.sent(),this.logger.warn("Failed to get merge status",r),[2,null];case 3:return[2]}})})},t.prototype.clearMergedUserId=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 1:return r.sent(),this.logger.info("Merge status cleared from storage"),[3,3];case 2:return n=r.sent(),this.logger.warn("Failed to clear merge status",n),[3,3];case 3:return[2]}})})},t.prototype.markAsMerged=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 1:return i.sent(),this.logger.debug("Visitor marked as merged",{visitorId:t,key:n}),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to store merge status",r),[3,3];case 3:return[2]}})})},t.prototype.getVisitorId=function(){return this.visitorId},t.prototype.getVisitorRefId=function(){return this.visitorRefId},t.prototype.hasVisitorId=function(){return null!==this.visitorId},t.prototype.storeVisitorId=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("VISITOR_ID",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 1:return i.sent(),this.logger.debug("Visitor ID stored to storage",{visitorId:t,key:n}),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to store visitor ID",r),[3,3];case 3:return[2]}})})},t.prototype.storeExpiredAt=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.expiredAt=t,n=so("VISITOR_EXPIRED_AT",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 1:return i.sent(),this.logger.debug("Visitor expiredAt stored to storage",{expiredAt:t}),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to store visitor expiredAt",r),[3,3];case 3:return[2]}})})},t.prototype.isVisitorExpired=function(){if(!this.expiredAt)return!0;try{return new Date(this.expiredAt).getTime()<=Date.now()}catch(t){return this.logger.warn("Invalid expiredAt format, treating as expired",{expiredAt:this.expiredAt}),!0}},t.prototype.getOrGenerateVisitorRefId=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:if(this.visitorRefId)return[2,this.visitorRefId];t=Bv(),this.visitorRefId=t,i.label=1;case 1:return i.trys.push([1,3,,4]),n=so("VISITOR_REF_ID",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 2:return i.sent(),this.logger.debug("visitorRefId generated and stored",{visitorRefId:t}),[3,4];case 3:return r=i.sent(),this.logger.warn("Failed to store visitorRefId",r),[3,4];case 4:return[2,t]}})})},t.prototype.restoreVisitorId=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:return o.trys.push([0,4,,5]),t=so("VISITOR_ID",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=o.sent())&&(this.visitorId=n,this.logger.info(Ko,{visitorId:n})),r=so("VISITOR_REF_ID",this.brandId,this.applicationId),[4,this.storageManager.get(r)];case 2:return(i=o.sent())&&(this.visitorRefId=i),e=so("VISITOR_EXPIRED_AT",this.brandId,this.applicationId),[4,this.storageManager.get(e)];case 3:return(s=o.sent())&&(this.expiredAt=s),[3,5];case 4:return u=o.sent(),this.logger.warn("Failed to restore visitor ID from storage",u),this.visitorId=null,[3,5];case 5:return[2]}})})},t.prototype.clearVisitorId=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),t=so("VISITOR_ID",this.brandId,this.applicationId),n=so("VISITOR_REF_ID",this.brandId,this.applicationId),r=so("VISITOR_EXPIRED_AT",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 1:return e.sent(),[4,this.storageManager.remove(n)];case 2:return e.sent(),[4,this.storageManager.remove(r)];case 3:return e.sent(),this.visitorId=null,this.visitorRefId=null,this.expiredAt=null,this.logger.info("Visitor ID cleared from storage"),[3,5];case 4:return i=e.sent(),this.logger.warn("Failed to clear visitor ID",i),this.visitorId=null,this.visitorRefId=null,this.expiredAt=null,[3,5];case 5:return[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return this.logger.info("Destroying AnonymousVisitorManager"),this.cancelMergeRetryTimer(),this.initialized=!1,this.logger.info("AnonymousVisitorManager destroyed successfully"),[2]})})},t}(),Ml={};function xl(){return"undefined"!=typeof window&&window.firebase?window.firebase:null}function Ul(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){return(t=xl())?[2,t]:[2,import("firebase/app")]})})}function jl(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){return(t=xl())&&t.messaging?[2,t]:[2,import("firebase/messaging")]})})}function Vl(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){return(t=xl())&&t.remoteConfig?[2,t]:[2,import("firebase/remote-config")]})})}!function(){if(Fl)return Ml;Fl=1;var t=Ti(),n=Vu().find,r=Qi(),i="find",e=!0;i in[]&&Array(1)[i](function(){e=!1}),t({target:"Array",proto:!0,forced:e},{find:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}}),r(i)}();var Ll=function(){function t(t,n,r,i,e,s,u){this.isInitialized=!1,this.firebaseApp=null,this.messaging=null,this.remoteConfig=null,this.remoteConfigGetValue=null,this.remoteConfigGetAll=null,this.currentToken=null,this.swRegistration=null,this.config=t,this.logger=n,this.vapidKey=r,this.serviceWorkerPath=i||ro,this.onTokenReceivedCallback=e,this.m=s,this.onMessageReceivedCallback=u}return t.prototype.checkFirebaseAvailability=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Ul()];case 1:return t.sent(),this.logger.info("Firebase available"),[2,!0];case 2:return t.sent(),this.logger.warn("Firebase not available - notifications will not work"),[2,!1];case 3:return[2]}})})},t.prototype.initialize=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:if(this.isInitialized)return this.logger.warn("Firebase already initialized"),[2,!0];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,this.checkFirebaseAvailability()];case 2:return n.sent()?[4,this.initializeFirebaseApp()]:[2,!1];case 3:return n.sent()?this.messaging?(this.isInitialized=!0,this.logger.info(ea),[2,!0]):(this.logger.error("Failed to initialize Firebase Messaging"),[2,!1]):[2,!1];case 4:return t=n.sent(),this.logger.error(sa,t),[2,!1];case 5:return[2]}})})},t.prototype.initializeFirebaseApp=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a;return Gu(this,function(c){switch(c.label){case 0:return(t="undefined"!=typeof window?window.firebase:null)?(this.logger.info("Initializing Firebase in compat mode"),(o=null===(a=t.apps)||void 0===a?void 0:a.find(function(t){return t.name===io}))?(this.logger.info("Using existing Firebase app"),this.firebaseApp=o):(this.logger.info("Creating new Firebase app"),this.firebaseApp=t.initializeApp(this.config,io)),this.messaging=this.firebaseApp.messaging?this.firebaseApp.messaging():null,[3,5]):[3,1];case 1:return this.logger.info("Initializing Firebase in modular mode"),[4,Ul()];case 2:return n=c.sent(),[4,jl()];case 3:return r=c.sent(),i=n.initializeApp,e=n.getApps,s=r.getMessaging,[4,(0,r.isSupported)()];case 4:if(!c.sent())return this.logger.warn("Firebase Messaging not supported in this browser"),[2,!1];u=e(),(o=u.find(function(t){return t.name===io}))?(this.logger.info("Using existing Firebase app"),this.firebaseApp=o):(this.logger.info("Creating new Firebase app"),this.firebaseApp=i(this.config,io)),this.messaging=s(this.firebaseApp),c.label=5;case 5:return[2,!0]}})})},t.prototype.ensureServiceWorkerRegistered=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:return this.swRegistration?[2,this.swRegistration]:this.isInitialized&&this.messaging?(t=this,[4,this.registerServiceWorker()]):[2,null];case 1:return t.swRegistration=n.sent(),[2,this.swRegistration]}})})},t.prototype.registerServiceWorker=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:if(!("serviceWorker"in navigator))return this.logger.warn("Service Worker not supported"),[2,null];i.label=1;case 1:return i.trys.push([1,7,,8]),[4,navigator.serviceWorker.getRegistration(this.serviceWorkerPath)];case 2:return(t=i.sent())?(this.logger.info("Service worker already registered",{scope:t.scope}),[4,this.ensureServiceWorkerActive(t)]):[3,4];case 3:return i.sent(),[2,t];case 4:return this.logger.info("Registering service worker",{path:this.serviceWorkerPath}),[4,navigator.serviceWorker.register(this.serviceWorkerPath)];case 5:return n=i.sent(),this.logger.info(ca,{scope:n.scope}),[4,this.ensureServiceWorkerActive(n)];case 6:return i.sent(),[2,n];case 7:return r=i.sent(),this.logger.error(fa,r),[2,null];case 8:return[2]}})})},t.prototype.ensureServiceWorkerActive=function(t){return Bu(this,void 0,void 0,function(){var n,r=this;return Gu(this,function(i){return t.active?(this.logger.debug("Service worker is already active"),[2]):(n=t.installing||t.waiting)?(this.logger.info("Waiting for service worker to activate...",{state:n.state}),[2,new Promise(function(t,i){if("activated"!==n.state){var e=function(){"activated"===n.state?(n.removeEventListener("statechange",e),r.logger.info("Service worker activated"),t()):"redundant"===n.state&&(n.removeEventListener("statechange",e),i(new Error("Service worker became redundant")))};n.addEventListener("statechange",e)}else t()})]):(this.logger.warn("No service worker found in registration"),[2])})})},t.prototype.requestToken=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:if(!this.isInitialized||!this.messaging)return this.logger.error("FirebaseManager not initialized"),[2,null];e.label=1;case 1:return e.trys.push([1,5,,6]),(n=this.swRegistration)?[3,3]:[4,this.registerServiceWorker()];case 2:n=e.sent(),e.label=3;case 3:return(t=n)?(this.swRegistration=t,[4,this.fetchFCMToken(t)]):(this.logger.warn("Service worker registration required for FCM"),[2,null]);case 4:return(r=e.sent())?(this.currentToken=r,this.logger.info(ua,{token:r}),this.onTokenReceivedCallback&&this.onTokenReceivedCallback(r),[2,r]):(this.logger.warn("No FCM token received - permission may be denied"),[2,null]);case 5:return i=e.sent(),this.logger.error(aa,i),[2,null];case 6:return[2]}})})},t.prototype.fetchFCMToken=function(t){return Bu(this,void 0,void 0,function(){var n,r,i;return Gu(this,function(e){switch(e.label){case 0:return("undefined"!=typeof window?window.firebase:null)?(this.logger.info("Getting token using compat mode"),i={serviceWorkerRegistration:t},this.vapidKey&&(i.vapidKey=this.vapidKey),[2,this.messaging.getToken(i)]):[3,1];case 1:return[4,jl()];case 2:return n=e.sent(),r=n.getToken,i={serviceWorkerRegistration:t},this.vapidKey&&(i.vapidKey=this.vapidKey),[2,r(this.messaging,i)]}})})},t.prototype.setupMessageListener=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i=this;return Gu(this,function(e){switch(e.label){case 0:if(!this.isInitialized||!this.messaging)return this.logger.error("FirebaseManager not initialized"),[2];e.label=1;case 1:return e.trys.push([1,5,,6]),("undefined"!=typeof window?window.firebase:null)?(this.logger.info("Setting up message listener (compat mode)"),this.messaging.onMessage(function(t){i.handleMessage(t)}),[3,4]):[3,2];case 2:return[4,jl()];case 3:t=e.sent(),n=t.onMessage,this.logger.info("Setting up message listener (modular mode)"),n(this.messaging,function(t){i.handleMessage(t)}),e.label=4;case 4:return this.logger.info("Message listener setup successfully"),[3,6];case 5:return r=e.sent(),this.logger.error("Failed to setup message listener",r),[3,6];case 6:return[2]}})})},t.prototype.handleMessage=function(t){this.logger.info("FCM message received",t),this.onMessageReceivedCallback&&this.onMessageReceivedCallback(t)},t.prototype.handleTokenRefresh=function(t){this.logger.info("FCM token refreshed",{token:t}),this.m&&this.m(t)},t.prototype.getCurrentToken=function(){return this.currentToken},t.prototype.isFirebaseInitialized=function(){return this.isInitialized},t.prototype.initializeRemoteConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:if(!this.isInitialized||!this.firebaseApp)return this.logger.warn("Firebase not initialized, cannot setup Remote Config"),[2];o.label=1;case 1:return o.trys.push([1,6,,7]),(t="undefined"!=typeof window?window.firebase:null)&&t.remoteConfig?(this.remoteConfig=t.remoteConfig(this.firebaseApp),this.remoteConfig.settings.minimumFetchIntervalMillis=36e5,this.logger.info("Remote Config initialized (compat mode)"),[3,5]):[3,2];case 2:return o.trys.push([2,4,,5]),[4,Vl()];case 3:return n=o.sent(),r=n.getRemoteConfig,i=n.getValue,e=n.getAll,this.remoteConfig=r(this.firebaseApp),this.remoteConfig.settings.minimumFetchIntervalMillis=36e5,this.remoteConfigGetValue=i,this.remoteConfigGetAll=e,this.logger.info("Remote Config initialized (modular mode)"),[3,5];case 4:return s=o.sent(),this.logger.warn("Remote Config module not available:",s),[2];case 5:return[3,7];case 6:return u=o.sent(),this.logger.error("Failed to initialize Remote Config:",u),[3,7];case 7:return[2]}})})},t.prototype.getRemoteConfigString=function(t){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),"";try{var n="undefined"!=typeof window?window.firebase:null;return n&&n.remoteConfig?this.remoteConfig.getString(t):this.remoteConfigGetValue?this.remoteConfigGetValue(this.remoteConfig,t).asString():(this.logger.warn("Remote Config getValue function not available"),"")}catch(n){return this.logger.error('Failed to get Remote Config value for key "'.concat(t,'":'),n),""}},t.prototype.getRemoteConfigBoolean=function(t){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),!1;try{var n="undefined"!=typeof window?window.firebase:null;return n&&n.remoteConfig?this.remoteConfig.getBoolean(t):this.remoteConfig.getBoolean(t)||!1}catch(n){return this.logger.error('Failed to get Remote Config boolean for key "'.concat(t,'":'),n),!1}},t.prototype.getRemoteConfigNumber=function(t){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),0;try{var n="undefined"!=typeof window?window.firebase:null;return n&&n.remoteConfig?this.remoteConfig.getNumber(t):this.remoteConfig.getNumber(t)||0}catch(n){return this.logger.error('Failed to get Remote Config number for key "'.concat(t,'":'),n),0}},t.prototype.getAllRemoteConfigValues=function(){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),{};try{var t="undefined"!=typeof window?window.firebase:null;if(t&&t.remoteConfig){var n=this.remoteConfig.getAll(),r={};return Object.keys(n).forEach(function(t){r[t]=n[t].asString()}),r}if(this.remoteConfigGetAll){var i=this.remoteConfigGetAll(this.remoteConfig),e={};return Object.keys(i).forEach(function(t){e[t]=i[t].asString()}),e}return this.logger.warn("Remote Config getAll function not available"),{}}catch(t){return this.logger.error("Failed to get all Remote Config values:",t),{}}},t.prototype.getRemoteConfigJSON=function(t){if(!this.remoteConfig)return this.logger.warn("Remote Config not initialized"),null;try{var n=this.getRemoteConfigString(t);if(!n)return this.logger.warn('Remote Config key "'.concat(t,'" is empty')),null;var r=JSON.parse(n);return this.logger.info('Remote Config JSON parsed for key "'.concat(t,'"'),r),r}catch(n){return this.logger.error('Failed to parse Remote Config JSON for key "'.concat(t,'":'),n),null}},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),this.firebaseApp?("undefined"!=typeof window?window.firebase:null)?[4,this.firebaseApp.delete()]:[3,2]:[3,5];case 1:return r.sent(),[3,5];case 2:return[4,Ul()];case 3:return t=r.sent(),[4,(0,t.deleteApp)(this.firebaseApp)];case 4:r.sent(),r.label=5;case 5:return this.isInitialized=!1,this.firebaseApp=null,this.messaging=null,this.currentToken=null,this.swRegistration=null,this.logger.info("FirebaseManager destroyed successfully"),[3,7];case 6:return n=r.sent(),this.logger.error("Failed to destroy FirebaseManager",n),[3,7];case 7:return[2]}})})},t}(),zl=function(){function t(t,n,r,i,e){this.firebaseManager=null,this.tokenUpdateCallback=null,this.config=t,this.logger=n,this.storageManager=r,this.brandId=i,this.applicationId=e,this.state={isNotificationEnabled:!1,firebaseInitialized:!1,permissionStatus:"default"}}return t.prototype.isNotificationSupported=function(){return"undefined"!=typeof window&&"undefined"!=typeof Notification&&"undefined"!=typeof navigator&&"serviceWorker"in navigator},t.prototype.getPermissionStatus=function(){return this.isNotificationSupported()?Notification.permission:"denied"},t.prototype.shouldInitializeNotifications=function(){return this.isNotificationSupported()?!!this.config.firebaseConfig||(this.logger.warn("Firebase config not provided - notifications disabled"),!1):(this.logger.warn("Notifications not supported in this browser"),!1)},t.prototype.restoreState=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e;return Gu(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),t=so("NOTIFICATION_STATE",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=s.sent())&&(r=JSON.parse(n),i=this.getPermissionStatus(),this.state=zu(zu(zu({},this.state),r),{permissionStatus:i}),this.logger.info("Notification state restored from storage",{storedPermission:r.permissionStatus,currentPermission:i,hasToken:!!r.fcmToken})),[3,3];case 2:return e=s.sent(),this.logger.warn("Failed to restore notification state",e),[3,3];case 3:return[2]}})})},t.prototype.saveState=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("NOTIFICATION_STATE",this.brandId,this.applicationId),[4,this.storageManager.set(t,JSON.stringify(this.state))];case 1:return r.sent(),this.logger.debug("Notification state saved to storage",this.state),[3,3];case 2:return n=r.sent(),this.logger.warn("Failed to save notification state",n),[3,3];case 3:return[2]}})})},t.prototype.init=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,15,,17]),[4,this.restoreState()];case 1:return r.sent(),this.shouldInitializeNotifications()?[3,3]:(this.logger.info(ia),this.state.isNotificationEnabled=!1,[4,this.saveState()]);case 2:return r.sent(),[2,this.state];case 3:return t=this.getPermissionStatus(),this.state.permissionStatus=t,this.logger.info("Current notification permission",{permission:t,hasStoredToken:!!this.state.fcmToken,isNotificationEnabled:this.state.isNotificationEnabled}),"denied"!==t?[3,5]:(this.logger.warn(ta),this.state.isNotificationEnabled=!1,delete this.state.fcmToken,[4,this.saveState()]);case 4:return r.sent(),[2,this.state];case 5:return"default"!==t?[3,7]:(this.logger.info("Permission not yet granted - notifications will not be shown until user grants permission"),this.state.isNotificationEnabled=!1,[4,this.saveState()]);case 6:return r.sent(),[2,this.state];case 7:return"granted"!==t?[3,14]:this.state.fcmToken?(this.logger.info("Using existing FCM token from storage",{token:this.state.fcmToken.substring(0,20)+"..."}),this.state.isNotificationEnabled=!0,this.firebaseManager?[3,9]:(this.logger.info("Initializing Firebase for message listening"),[4,this.initializeFirebaseForMessaging()])):[3,11];case 8:r.sent(),r.label=9;case 9:return[4,this.saveState()];case 10:return r.sent(),[2,this.state];case 11:return this.logger.info("Permission granted - initializing Firebase to generate FCM token"),[4,this.initializeFirebase()];case 12:return r.sent(),[4,this.saveState()];case 13:r.sent(),r.label=14;case 14:return this.logger.info(na,this.state),[2,this.state];case 15:return n=r.sent(),this.logger.error(ra,n),this.state.isNotificationEnabled=!1,[4,this.saveState()];case 16:return r.sent(),[2,this.state];case 17:return[2]}})})},t.prototype.initializeFirebaseForMessaging=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:if(!this.config.firebaseConfig)throw new Error("Firebase config is required");n.label=1;case 1:return n.trys.push([1,5,,6]),this.firebaseManager=new Ll(this.config.firebaseConfig,this.logger,this.config.vapidKey,this.config.serviceWorkerPath,this.config.onTokenReceived,this.config.onTokenRefresh,this.config.onMessageReceived),[4,this.firebaseManager.initialize()];case 2:if(!n.sent())throw new Error("Firebase initialization failed");return this.state.firebaseInitialized=!0,[4,this.firebaseManager.ensureServiceWorkerRegistered()];case 3:return n.sent(),[4,this.firebaseManager.setupMessageListener()];case 4:return n.sent(),this.initializeRemoteConfigAsync(),this.logger.info("Firebase initialized for message listening"),[3,6];case 5:throw t=n.sent(),this.logger.error("Failed to initialize Firebase for messaging",t),t;case 6:return[2]}})})},t.prototype.initializeFirebase=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:if(!this.config.firebaseConfig)throw new Error("Firebase config is required");r.label=1;case 1:return r.trys.push([1,7,,8]),this.firebaseManager=new Ll(this.config.firebaseConfig,this.logger,this.config.vapidKey,this.config.serviceWorkerPath,this.config.onTokenReceived,this.config.onTokenRefresh,this.config.onMessageReceived),[4,this.firebaseManager.initialize()];case 2:if(!r.sent())throw new Error("Firebase initialization failed");return this.state.firebaseInitialized=!0,this.state.isNotificationEnabled=!0,[4,this.firebaseManager.requestToken()];case 3:return(t=r.sent())?(this.state.fcmToken=t,[4,this.storeFCMToken(t)]):[3,5];case 4:r.sent(),r.label=5;case 5:return[4,this.firebaseManager.setupMessageListener()];case 6:return r.sent(),this.initializeRemoteConfigAsync(),this.logger.info("Firebase initialized and FCM token retrieved",{hasToken:!!t}),[3,8];case 7:throw n=r.sent(),this.logger.error("Failed to initialize Firebase",n),this.state.firebaseInitialized=!1,this.state.isNotificationEnabled=!1,n;case 8:return[2]}})})},t.prototype.initializeRemoteConfigAsync=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),this.firebaseManager?[4,this.firebaseManager.initializeRemoteConfig()]:[3,2];case 1:n.sent(),this.logger.info("✅ Remote Config initialized and fetched successfully"),n.label=2;case 2:return[3,4];case 3:return t=n.sent(),this.logger.warn("Remote Config initialization failed (non-critical):",t),[3,4];case 4:return[2]}})})},t.prototype.storeFCMToken=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:return o.trys.push([0,6,,7]),n=so("FCM_TOKEN",this.brandId,this.applicationId),r=so("FCM_TOKEN_CREATED_AT",this.brandId,this.applicationId),[4,this.storageManager.get(n)];case 1:return i=o.sent(),e=!i||i!==t,[4,this.storageManager.set(n,t)];case 2:return o.sent(),e?(s=(new Date).toISOString(),[4,this.storageManager.set(r,s)]):[3,4];case 3:return o.sent(),this.logger.debug("FCM token and creation date stored successfully",{createdAt:s}),[3,5];case 4:this.logger.debug("FCM token stored (creation date unchanged)"),o.label=5;case 5:return this.tokenUpdateCallback&&(this.logger.info("Notifying token update callback",{isNewToken:e,tokenPreview:t.substring(0,20)+"..."}),this.tokenUpdateCallback(t,e)),[3,7];case 6:return u=o.sent(),this.logger.warn("Failed to store FCM token",u),[3,7];case 7:return[2]}})})},t.prototype.setTokenUpdateCallback=function(t){this.tokenUpdateCallback=t,this.logger.debug("Token update callback registered")},t.prototype.clearTokenUpdateCallback=function(){this.tokenUpdateCallback=null,this.logger.debug("Token update callback cleared")},t.prototype.getState=function(){return zu({},this.state)},t.prototype.getFCMToken=function(){return this.state.fcmToken||null},t.prototype.getTokenCreationDate=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("FCM_TOKEN_CREATED_AT",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return[2,r.sent()||null];case 2:return n=r.sent(),this.logger.warn("Failed to retrieve FCM token creation date",n),[2,null];case 3:return[2]}})})},t.prototype.isEnabled=function(){return this.state.isNotificationEnabled},t.prototype.getFirebaseManager=function(){return this.firebaseManager},t.prototype.refreshToken=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:if(!this.firebaseManager||!this.state.isNotificationEnabled)return this.logger.warn("Cannot refresh token - notifications not enabled"),[2,null];r.label=1;case 1:return r.trys.push([1,6,,7]),[4,this.firebaseManager.requestToken()];case 2:return(t=r.sent())?(this.state.fcmToken=t,[4,this.storeFCMToken(t)]):[3,5];case 3:return r.sent(),[4,this.saveState()];case 4:r.sent(),this.logger.info(oa,{token:t}),r.label=5;case 5:return[2,t];case 6:return n=r.sent(),this.logger.error("Failed to refresh FCM token",n),[2,null];case 7:return[2]}})})},t.prototype.clearToken=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),this.logger.info("Clearing notification state (permission revoked)"),t=this.state.fcmToken,this.state.isNotificationEnabled=!1,this.state.firebaseInitialized=!1,this.firebaseManager?[4,this.firebaseManager.destroy()]:[3,2];case 1:r.sent(),this.firebaseManager=null,r.label=2;case 2:return[4,this.saveState()];case 3:return r.sent(),this.tokenUpdateCallback&&t&&(this.logger.info("Notifying permission revoked to sync push_opted:false with backend"),this.tokenUpdateCallback(t,!0)),this.logger.info("Notification state cleared"),[3,5];case 4:throw n=r.sent(),this.logger.error("Failed to clear notification state",n),n;case 5:return[2]}})})},t.prototype.hasPermissionChanged=function(){return this.getPermissionStatus()!==this.state.permissionStatus},t.prototype.handlePermissionChange=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return t=this.getPermissionStatus(),n=this.state.permissionStatus,this.logger.info("Permission status changed",{from:n,to:t}),this.state.permissionStatus=t,"denied"!==t&&"default"!==t?[3,5]:"granted"!==n?[3,2]:(this.logger.warn("Permission revoked - clearing FCM token"),[4,this.clearToken()]);case 1:return r.sent(),[3,4];case 2:return this.state.isNotificationEnabled=!1,[4,this.saveState()];case 3:r.sent(),r.label=4;case 4:return[3,8];case 5:return"granted"!==t||"granted"===n?[3,8]:(this.logger.info("Permission granted - initializing Firebase"),[4,this.initializeFirebase()]);case 6:return r.sent(),[4,this.saveState()];case 7:r.sent(),r.label=8;case 8:return[2,this.state]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),this.firebaseManager?[4,this.firebaseManager.destroy()]:[3,2];case 1:r.sent(),this.firebaseManager=null,r.label=2;case 2:return t=so("NOTIFICATION_STATE",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 3:return r.sent(),this.logger.info("NotificationManager destroyed successfully"),[3,5];case 4:return n=r.sent(),this.logger.error("Failed to destroy NotificationManager",n),[3,5];case 5:return[2]}})})},t}(),Bl=function(){function t(t,n,r,i,e){this.currentSession=null,this.sessionNumber=0,this.storageManager=t,this.logger=n,this.brandId=r,this.applicationId=i;var s=to/6e4;this.inactivityTimeoutMs=60*(e||s)*1e3,this.logger.info("SessionManager configured with timeout:",{timeoutMinutes:e||s,timeoutMs:this.inactivityTimeoutMs,source:e?"Remote Config":"Default"})}return t.prototype.init=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return this.logger.info("Initializing SessionManager"),[4,this.restoreSessionNumber()];case 1:return t.sent(),[4,this.restoreSession()];case 2:return t.sent(),this.logger.info("SessionManager initialized successfully"),[2]}})})},t.prototype.getOrCreateSession=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return t=Date.now(),this.currentSession?(n=t-this.currentSession.lastEventTime)<this.inactivityTimeoutMs?(this.currentSession.lastEventTime=t,[4,this.persistSession()]):[3,2]:[3,3];case 1:return r.sent(),this.logger.debug(Oo,{sessionId:this.currentSession.sessionId,inactivityDuration:n}),[2,this.currentSession.sessionId];case 2:this.logger.info(Co,{sessionId:this.currentSession.sessionId,inactivityDuration:n,timeoutMs:this.inactivityTimeoutMs}),r.label=3;case 3:return[2,this.startNewSession()]}})})},t.prototype.getSessionStartTime=function(){var t;return(null===(t=this.currentSession)||void 0===t?void 0:t.sessionStartTime)||null},t.prototype.getCurrentSessionId=function(){var t,n;return null!==(n=null===(t=this.currentSession)||void 0===t?void 0:t.sessionId)&&void 0!==n?n:null},t.prototype.getSessionNumber=function(){return this.sessionNumber},t.prototype.resetSessionNumber=function(){return Bu(this,arguments,void 0,function(t){return void 0===t&&(t=0),Gu(this,function(n){switch(n.label){case 0:return this.sessionNumber=t,[4,this.persistSessionNumber()];case 1:return n.sent(),this.logger.info("Session number reset",{sessionNumber:this.sessionNumber}),[2]}})})},t.prototype.endSession=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return this.currentSession?(this.logger.info(Do,{sessionId:this.currentSession.sessionId,reason:t}),this.currentSession=null,[4,this.clearSessionStorage()]):[3,3];case 1:return n.sent(),[4,this.resetSessionNumber(0)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){return Gu(this,function(t){return this.logger.info("Destroying SessionManager (session persists in storage)"),this.currentSession=null,[2]})})},t.prototype.startNewSession=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return t=Date.now(),n=Bv(),this.currentSession={sessionId:n,sessionStartTime:t,lastEventTime:t},this.sessionNumber+=1,[4,this.persistSession()];case 1:return r.sent(),[4,this.persistSessionNumber()];case 2:return r.sent(),this.logger.info(_o,{sessionId:n,sessionStartTime:t,sessionNumber:this.sessionNumber}),[2,n]}})})},t.prototype.restoreSession=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a;return Gu(this,function(c){switch(c.label){case 0:return c.trys.push([0,7,,9]),t=so("SESSION_ID",this.brandId,this.applicationId),n=so("SESSION_START_TIME",this.brandId,this.applicationId),r=so("LAST_EVENT_TIME",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return i=c.sent(),[4,this.storageManager.get(n)];case 2:return e=c.sent(),[4,this.storageManager.get(r)];case 3:return s=c.sent(),i&&e&&s?(u=Date.now(),(o=u-parseInt(s))<this.inactivityTimeoutMs?(this.currentSession={sessionId:i,sessionStartTime:parseInt(e),lastEventTime:parseInt(s)},this.logger.info(No,{sessionId:i,timeSinceLastEvent:o}),[3,6]):[3,4]):[3,6];case 4:return this.logger.debug("Stored session expired, will create new session",{timeSinceLastEvent:o,timeoutMs:this.inactivityTimeoutMs}),[4,this.clearSessionStorage()];case 5:c.sent(),c.label=6;case 6:return[3,9];case 7:return a=c.sent(),this.logger.warn("Failed to restore session from storage",a),[4,this.clearSessionStorage()];case 8:return c.sent(),[3,9];case 9:return[2]}})})},t.prototype.persistSession=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:if(!this.currentSession)return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),t=so("SESSION_ID",this.brandId,this.applicationId),n=so("SESSION_START_TIME",this.brandId,this.applicationId),r=so("LAST_EVENT_TIME",this.brandId,this.applicationId),[4,Promise.all([this.storageManager.set(t,this.currentSession.sessionId),this.storageManager.set(n,this.currentSession.sessionStartTime.toString()),this.storageManager.set(r,this.currentSession.lastEventTime.toString())])];case 2:return e.sent(),[3,4];case 3:return i=e.sent(),this.logger.warn("Failed to persist session to storage",i),[3,4];case 4:return[2]}})})},t.prototype.clearSessionStorage=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=so("SESSION_ID",this.brandId,this.applicationId),n=so("SESSION_START_TIME",this.brandId,this.applicationId),r=so("LAST_EVENT_TIME",this.brandId,this.applicationId),[4,Promise.all([this.storageManager.remove(t),this.storageManager.remove(n),this.storageManager.remove(r)])];case 1:return e.sent(),[3,3];case 2:return i=e.sent(),this.logger.warn("Failed to clear session storage",i),[3,3];case 3:return[2]}})})},t.prototype.restoreSessionNumber=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=so("SESSION_NUMBER",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=i.sent())&&(this.sessionNumber=parseInt(n,10)||0,this.logger.debug("Session number restored",{sessionNumber:this.sessionNumber})),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to restore session number",r),[3,3];case 3:return[2]}})})},t.prototype.persistSessionNumber=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("SESSION_NUMBER",this.brandId,this.applicationId),[4,this.storageManager.set(t,this.sessionNumber.toString())];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),this.logger.warn("Failed to persist session number",n),[3,3];case 3:return[2]}})})},t}();return function(){function t(t){this.userContextSet=!1,this.initialized=!1,this.initializationPromise=null,this.visitorTrackingEnabled=!1,this.visitorId=null,this.currentUserIdentifierType=null,this.notificationManager=null,this.permissionChangeCleanup=null,this.dlrMessageCleanup=null,this.lastAuthenticatedUser=null,this.lastUserAttributes=null,this.sdkDisabled=!1,this.userIdentified=!1,this.userOperationChain=Promise.resolve(),this.config=t,this.logger=new Cl(!1),this.validateRequiredConfig(t),this.logger.info("🔧 SDK initializing in Remote Config bootstrap mode"),this.logger.info("Will fetch configuration from Remote Config key:",t.remoteConfigKey)}return t.initialize=function(n){return t.p?(new Cl(!0).warn("WebSDK is already initialized. Returning existing instance."),t.p):(t.p=new t(n),t.p.init(),t.p)},t.getInstance=function(){return t.p},t.isInitialized=function(){return null!==t.p},t.requireInstance=function(){if(!t.p)throw new Error("WebSDK is not initialized. Call WebSDK.initialize(config) first.");return t.p},t.track=function(n,r){t.requireInstance().track(n,r)},t.pageView=function(n){t.requireInstance().pageView(n)},t.identify=function(n){t.requireInstance().identify(n)},t.getUser=function(){return t.requireInstance().getUser()},t.reset=function(){t.requireInstance().reset()},t.disableSDK=function(){t.requireInstance().disableSDK()},t.enableSDK=function(){t.requireInstance().enableSDK()},t.destroy=function(){if(!t.p)return Promise.resolve();var n=t.p.destroy();return t.p=null,n},t.prototype.shouldEnableLogging=function(t){return!(!t||"NONE"===t)&&["ERROR","WARN","INFO","DEBUG","VERBOSE"].includes(t)},t.prototype.restoreUserContext=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a;return Gu(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),t=so("USER_CONTEXT",this.config.brandId,this.config.applicationId),[4,this.storageManager.get(t)];case 1:return(n=c.sent())?(r=JSON.parse(n),i=r.cuid,e=r.userIdentifierType,this.currentUserIdentifierType=null!=e?e:null,s=this.config.accountId||"",[4,this.eventTracker.setUserContext(s,i,e)]):[3,3];case 2:c.sent(),this.userContextSet=!0,this.logger.info("User context restored from storage",{cuid:i,accountId:this.config.accountId}),c.label=3;case 3:return u=so("LAST_AUTHENTICATED_USER",this.config.brandId,this.config.applicationId),[4,this.storageManager.get(u)];case 4:return(o=c.sent())&&(this.lastAuthenticatedUser=o,this.logger.info("Last authenticated user restored from storage",{lastAuthenticatedUser:this.lastAuthenticatedUser})),[3,6];case 5:return a=c.sent(),this.logger.warn("Failed to restore user context from storage",a),[3,6];case 6:return[2]}})})},t.prototype.validateAndClearDifferentUserContext=function(t){return Bu(this,void 0,void 0,function(){var n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,5,,7]),this.lastAuthenticatedUser&&this.lastAuthenticatedUser!==t?(this.logger.info("Different user detected, ending session and clearing context",{previousCuid:this.lastAuthenticatedUser,newCuid:t}),[4,this.sessionManager.endSession("user_switch")]):[3,3];case 1:return r.sent(),[4,this.clearUserContext()];case 2:r.sent(),this.userContextSet=!1,r.label=3;case 3:return this.lastAuthenticatedUser=t,[4,this.persistLastAuthenticatedUser(t)];case 4:return r.sent(),[3,7];case 5:return n=r.sent(),this.logger.warn("Error validating different user context",n),[4,this.clearUserContext()];case 6:return r.sent(),this.userContextSet=!1,[3,7];case 7:return[2]}})})},t.prototype.persistLastAuthenticatedUser=function(t){return Bu(this,void 0,void 0,function(){var n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=so("LAST_AUTHENTICATED_USER",this.config.brandId,this.config.applicationId),[4,this.storageManager.set(n,t)];case 1:return i.sent(),[3,3];case 2:return r=i.sent(),this.logger.warn("Failed to persist lastAuthenticatedUser",r),[3,3];case 3:return[2]}})})},t.prototype.storeUserContext=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s;return Gu(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),r=null!=n?n:this.currentUserIdentifierType,i={cuid:t,timestamp:Date.now()},r&&(i.userIdentifierType=r),e=so("USER_CONTEXT",this.config.brandId,this.config.applicationId),[4,this.storageManager.set(e,JSON.stringify(i))];case 1:return u.sent(),[3,3];case 2:return s=u.sent(),this.logger.warn("Failed to store user context",s),[3,3];case 3:return[2]}})})},t.prototype.init=function(){var t=this;this.initialized?this.logger.warn("WebSDK already initialized"):this.initializationPromise?this.logger.warn("WebSDK initialization already in progress"):this.initializationPromise=this.initializeAsync().catch(function(n){t.logger.error(wo,n),t.initializationPromise=null})},t.prototype.initializeAsync=function(){return Bu(this,void 0,void 0,function(){var t,n,r=this;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,12,,13]),this.logger.info("Initializing WebSDK",{version:Ra,config:this.config}),[4,this.fetchAndApplyRemoteConfig()];case 1:return i.sent(),[4,this.storageManager.init()];case 2:return i.sent(),[4,this.sessionManager.init()];case 3:return i.sent(),this.config.notifications?(t=zu(zu({},this.config.notifications),{firebaseConfig:this.config.firebaseConfig}),this.notificationManager=new zl(t,this.logger,this.storageManager,this.config.brandId,this.config.applicationId),this.setupTokenUpdateCallback(),[4,this.notificationManager.init()]):[3,5];case 4:i.sent(),this.logger.info("Notifications initialized early for FCM token availability"),i.label=5;case 5:return[4,this.initializeVisitorConfig()];case 6:return i.sent(),[4,this.eventTracker.init()];case 7:return i.sent(),this.eventTracker.setSessionInfoCallback(function(){return Bu(r,void 0,void 0,function(){return Gu(this,function(t){return[2,this.sessionManager.getOrCreateSession()]})})}),[4,this.restoreUserContext()];case 8:return i.sent(),[4,this.syncEventTrackerContext()];case 9:return i.sent(),this.initialized=!0,this.notificationManager&&this.setupPermissionChangeDetection(),this.config.notifications?(this.setupDLRServiceWorkerListener(),[4,this.eventTracker.processPendingServiceWorkerDLREvents()]):[3,11];case 10:i.sent(),i.label=11;case 11:return this.logger.info(go),[3,13];case 12:throw n=i.sent(),new Error("".concat(co,": ").concat(n));case 13:return[2]}})})},t.prototype.handleVisibilityChange=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:if("visible"!==document.visibilityState||!this.notificationManager)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),this.notificationManager.hasPermissionChanged()?(t="Notification"in window?Notification.permission:"denied",this.logger.info("Notification permission changed detected",{currentPermission:t}),[4,this.notificationManager.handlePermissionChange()]):[2];case 2:return(n=i.sent())&&this.logger.info("Notification state updated after permission change",n),[3,4];case 3:return r=i.sent(),this.logger.warn("Error handling permission change",r),[3,4];case 4:return[2]}})})},t.prototype.setupPermissionChangeDetection=function(){var t=this;if("undefined"!=typeof document&&"undefined"!=typeof window){var n=function(){return t.handleVisibilityChange()};document.addEventListener("visibilitychange",n),window.addEventListener("focus",n),this.permissionChangeCleanup=function(){document.removeEventListener("visibilitychange",n),window.removeEventListener("focus",n)},this.logger.debug("Permission change detection setup complete")}},t.prototype.setupDLRServiceWorkerListener=function(){var t=this;if("undefined"!=typeof navigator&&"serviceWorker"in navigator){var n=function(n){return Bu(t,void 0,void 0,function(){var t;return Gu(this,function(r){switch(r.label){case 0:if(!n.data||"HYDRA_DLR_EVENTS_PENDING"!==n.data.type)return[3,4];this.logger.info("Received DLR events pending notification from service worker"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.eventTracker.processPendingServiceWorkerDLREvents()];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),this.logger.error("Failed to process pending DLR events",t),[3,4];case 4:return[2]}})})};navigator.serviceWorker.addEventListener("message",n),this.dlrMessageCleanup=function(){navigator.serviceWorker.removeEventListener("message",n)},this.logger.debug("DLR service worker message listener setup complete")}},t.prototype.initializeVisitorConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r=this;return Gu(this,function(i){switch(i.label){case 0:return this.logger.info("Initializing visitor configuration"),[4,this.visitorConfigManager.init()];case 1:return i.sent(),t=this,[4,this.visitorConfigManager.isVisitorTrackingEnabled()];case 2:return t.visitorTrackingEnabled=i.sent(),this.visitorTrackingEnabled?(this.logger.info(Bo),[4,this.anonymousVisitorManager.init()]):[3,5];case 3:return i.sent(),[4,this.getOrCreateVisitorId()];case 4:return i.sent(),this.anonymousVisitorManager.retryPendingMerge().catch(function(t){r.logger.warn("Failed to retry pending merge on init",t)}),[3,6];case 5:this.logger.info(zo),i.label=6;case 6:return(n=this.visitorConfigManager.getCachedConfig())&&n.warnings&&n.warnings.length>0&&n.warnings.forEach(function(t){r.logger.warn("Visitor config warning",{code:t.code,message:t.message})}),[2]}})})},t.prototype.syncEventTrackerContext=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i;return Gu(this,function(e){switch(e.label){case 0:return t=null!==(i=null===(r=this.anonymousVisitorManager)||void 0===r?void 0:r.getVisitorRefId())&&void 0!==i?i:null,this.eventTracker.setVisitorTrackingState(this.visitorId,this.visitorTrackingEnabled,t),this.visitorTrackingEnabled?(n=this.config.accountId||"",this.userContextSet?[3,2]:[4,this.eventTracker.setUserContext(n)]):(this.logger.warn("Event tracking disabled: Visitor tracking is off"),[2]);case 1:return e.sent(),this.logger.info("Account context set for visitor tracking"),[3,3];case 2:this.logger.info("User context restored from storage"),e.label=3;case 3:return[2]}})})},t.prototype.getOrCreateVisitorId=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c,f;return Gu(this,function(h){switch(h.label){case 0:t=[],(n=null===(a=this.notificationManager)||void 0===a?void 0:a.getFCMToken())?(r="granted"===(null===(c=this.notificationManager)||void 0===c?void 0:c.getState().permissionStatus),t.push({type:this.getChannelType(),value:n,primary:!0,verified:!0,subscribed:r}),this.logger.info("Including FCM token in visitor creation",{tokenPreview:n.substring(0,20)+"...",subscribed:r})):this.logger.info("No FCM token available, creating visitor without commChannels"),h.label=1;case 1:return h.trys.push([1,5,,6]),this.notificationManager?[4,this.notificationManager.getTokenCreationDate()]:[3,3];case 2:return s=h.sent(),[3,4];case 3:s=null,h.label=4;case 4:return e=s,i=Hv(zu(zu({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:"granted"===(null===(f=this.notificationManager)||void 0===f?void 0:f.getState().permissionStatus),fcmTokenCreatedAt:e})),this.logger.debug("Extended fields collected",{extendedFields:i}),[3,6];case 5:return u=h.sent(),this.logger.warn("Failed to collect extended fields, proceeding without them",u),i=void 0,[3,6];case 6:return o=this,[4,this.anonymousVisitorManager.getOrCreateVisitorId(t.length>0?t:void 0,i)];case 7:return o.visitorId=h.sent(),this.logger.info("Visitor ID ready",{visitorId:this.visitorId}),[2,this.visitorId]}})})},t.prototype.setupTokenUpdateCallback=function(){var t=this;this.notificationManager&&(this.notificationManager.setTokenUpdateCallback(function(n,r){return Bu(t,void 0,void 0,function(){return Gu(this,function(t){switch(t.label){case 0:return[4,this.handleTokenUpdate(n,r)];case 1:return t.sent(),[2]}})})}),this.logger.debug("Token update callback configured for backend sync"))},t.prototype.handleTokenUpdate=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e;return Gu(this,function(s){switch(s.label){case 0:if(!this.visitorId)return this.logger.debug("Skipping token sync - no visitor ID yet (will be included in create)",{isNewToken:n}),[2];if(!n)return this.logger.debug("Skipping token sync - token unchanged"),[2];r="granted"!==(null===(e=this.notificationManager)||void 0===e?void 0:e.getState().permissionStatus),this.logTokenSyncStart(t,r),s.label=1;case 1:return s.trys.push([1,6,,7]),this.userIdentified&&this.lastAuthenticatedUser?[4,this.syncTokenForIdentifiedUser(r)]:[3,3];case 2:return s.sent(),[3,5];case 3:return[4,this.syncTokenForAnonymousUser(t,r)];case 4:s.sent(),s.label=5;case 5:return[3,7];case 6:return i=s.sent(),this.logger.error("Failed to sync FCM token with backend",i),[3,7];case 7:return[2]}})})},t.prototype.logTokenSyncStart=function(t,n){n?this.logger.info("Permission revoked, syncing push_opted:false with backend",{visitorId:this.visitorId}):this.logger.info("FCM token updated, syncing with backend",{visitorId:this.visitorId,tokenPreview:t.substring(0,20)+"..."})},t.prototype.syncTokenForIdentifiedUser=function(t){return Bu(this,void 0,void 0,function(){return Gu(this,function(n){switch(n.label){case 0:return this.lastAuthenticatedUser?[4,this.sendUserEventToApi(ga,this.lastAuthenticatedUser,null)]:[2];case 1:return n.sent(),this.logger.info("Token state synced via User Events API (user_update)",{permissionRevoked:t}),[2]}})})},t.prototype.syncTokenForAnonymousUser=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e,s,u;return Gu(this,function(o){switch(o.label){case 0:r=t?[{type:this.getChannelType(),value:t,primary:!0,verified:!0,subscribed:!n}]:[],o.label=1;case 1:return o.trys.push([1,5,,6]),n||!this.notificationManager?[3,3]:[4,this.notificationManager.getTokenCreationDate()];case 2:return s=o.sent(),[3,4];case 3:s=null,o.label=4;case 4:return e=s,i=Hv(zu(zu({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:!n,fcmTokenCreatedAt:e})),[3,6];case 5:return u=o.sent(),this.logger.warn("Failed to collect extended fields for token update",u),i=void 0,[3,6];case 6:return[4,this.anonymousVisitorManager.updateVisitor(r,i)];case 7:return o.sent(),n?this.logger.info("Token synced with subscribed:false (permission revoked)",{visitorId:this.visitorId}):this.logger.info("FCM token synced with backend successfully",{visitorId:this.visitorId}),[2]}})})},t.prototype.getUser=function(){var t,n,r,i,e;if(this.userIdentified)throw new Error("This data is not exposed");var s=null!==(n=null===(t=this.sessionManager)||void 0===t?void 0:t.getCurrentSessionId())&&void 0!==n?n:"",u=null!==(i=null===(r=this.sessionManager)||void 0===r?void 0:r.getSessionNumber())&&void 0!==i?i:0;return{visitorId:null!==(e=this.visitorId)&&void 0!==e?e:"",userId:null,sessionId:s,isIdentified:!1,isAnonymous:!0,profileTier:"anonymous",attributes:null,sessionNumber:u,isFirstSession:1===u,isReturningVisitor:u>1}},t.prototype.setUserContext=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e;return Gu(this,function(s){switch(s.label){case 0:if(!this.initialized)throw new Error("WebSDK must be initialized before setting user context");return[4,this.validateAndClearDifferentUserContext(t)];case 1:return s.sent(),r=null!==(e=null!=n?n:this.currentUserIdentifierType)&&void 0!==e?e:void 0,i=this.config.accountId||"",[4,this.eventTracker.setUserContext(i,t,r)];case 2:return s.sent(),this.userContextSet=!0,n&&(this.currentUserIdentifierType=n),this.visitorId&&this.logger.info("User identified - transitioning from anonymous to identified tracking",{visitorId:this.visitorId,cuid:t,trackingMode:"identified"}),[4,this.storeUserContext(t,r)];case 3:return s.sent(),this.logger.info("User context set and persisted",{cuid:t,accountId:this.config.accountId}),[2]}})})},t.prototype.clearUserContext=function(){return Bu(this,void 0,void 0,function(){var t,n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=so("USER_CONTEXT",this.config.brandId,this.config.applicationId),[4,this.storageManager.remove(t)];case 1:return r.sent(),this.eventTracker&&this.eventTracker.clearUserContext(),this.currentUserIdentifierType=null,this.userContextSet=!1,this.userIdentified=!1,this.logger.info("User context cleared"),[3,3];case 2:return n=r.sent(),this.logger.warn("Failed to clear user context",n),this.currentUserIdentifierType=null,this.userContextSet=!1,this.userIdentified=!1,[3,3];case 3:return[2]}})})},t.prototype.track=function(t,n){this.sdkDisabled?this.logger.debug("SDK disabled, dropping track call",{eventName:t}):this.pushEvent(t,n)},t.prototype.pageView=function(t){var n,r;if(this.sdkDisabled)this.logger.debug("SDK disabled, dropping pageView call");else{var i=null!==(n=null==t?void 0:t.url)&&void 0!==n?n:"undefined"!=typeof window?window.location.href:void 0,e=null!==(r=null==t?void 0:t.title)&&void 0!==r?r:"undefined"!=typeof document?document.title:void 0,s=zu(zu(zu(zu({},i&&{url:i}),e&&{title:e}),(null==t?void 0:t.category)&&{category:t.category}),null==t?void 0:t.properties);this.pushEvent("page_view",s)}},t.prototype.pickTraitFields=function(t){var n={},r=t.gender,i=t.birthday,e=t.city,s=t.country,u=t.timezone;return r&&(n.gender=r),i&&(n.birthday=i),e&&(n.city=e),s&&(n.country=s),u&&(n.timezone=u),n},t.prototype.identify=function(t){var n,r;if(this.sdkDisabled)this.logger.debug("SDK disabled, dropping identify call");else{var i=t.identifier,e=t.actionType,s=t.traits,u=void 0===s?{}:s;if(!i||!i.cuid)throw new Error("identifier with a non-empty cuid is required for identify");if(!["email","mobile","externalId"].includes(i.type))throw new Error("Invalid identifier type: ".concat(i.type,". Must be 'email', 'mobile', or 'externalId'."));var o=i.cuid;this.currentUserIdentifierType=i.type;var a=zu(zu(zu(zu({firstName:null!==(n=u.firstName)&&void 0!==n?n:"",lastName:null!==(r=u.lastName)&&void 0!==r?r:""},"email"===i.type&&{email:o}),"mobile"===i.type&&{mobile:o}),"externalId"===i.type&&{externalId:o}),void 0!==u.custom&&{customData:u.custom}),c=this.pickTraitFields(u);a.customData=zu(zu({},c),a.customData),this.userIdentified=!0;var f=i.type;switch(e){case"USER_REGISTER":this.pushUserSignin(o,a,f);break;case"USER_UPDATE":this.pushUserUpdate(o,a,f);break;default:throw this.logger.error("Invalid identify actionType",{actionType:e,cuid:o}),new Error("Invalid identify actionType: ".concat(e,". Must be 'USER_REGISTER' or 'USER_UPDATE'."))}}},t.prototype.trackEvent=function(t){return Bu(this,void 0,void 0,function(){var n;return Gu(this,function(r){switch(r.label){case 0:if(!this.initialized)throw new Error("WebSDK must be initialized before tracking events");r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.eventTracker.track(t)];case 2:return r.sent(),[3,4];case 3:throw n=r.sent(),this.logger.error(bo,{event:t,error:n}),n;case 4:return[2]}})})},t.prototype.destroy=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:this.logger.info("Destroying WebSDK instance"),n.label=1;case 1:return n.trys.push([1,16,,17]),this.eventTracker?[4,this.eventTracker.flush()]:[3,4];case 2:return n.sent(),[4,this.eventTracker.destroy()];case 3:n.sent(),n.label=4;case 4:return this.visitorConfigManager?[4,this.visitorConfigManager.destroy()]:[3,6];case 5:n.sent(),n.label=6;case 6:return this.anonymousVisitorManager?[4,this.anonymousVisitorManager.destroy()]:[3,8];case 7:n.sent(),n.label=8;case 8:return this.permissionChangeCleanup&&(this.permissionChangeCleanup(),this.permissionChangeCleanup=null),this.dlrMessageCleanup&&(this.dlrMessageCleanup(),this.dlrMessageCleanup=null),this.notificationManager?(this.notificationManager.clearTokenUpdateCallback(),[4,this.notificationManager.destroy()]):[3,10];case 9:n.sent(),this.notificationManager=null,n.label=10;case 10:return this.sessionManager?[4,this.sessionManager.destroy()]:[3,12];case 11:n.sent(),n.label=12;case 12:return this.storageManager?[4,this.clearUserContext()]:[3,15];case 13:return n.sent(),[4,this.storageManager.destroy()];case 14:n.sent(),n.label=15;case 15:return this.initialized=!1,this.logger.info(mo),[3,17];case 16:throw t=n.sent(),this.logger.error(mo,t),t;case 17:return[2]}})})},t.prototype.validateUserAttributes=function(t){if(!t.email&&!t.mobile&&!t.externalId)throw new Error("At least one of email, mobile, or externalId is required")},t.prototype.attemptVisitorMerge=function(t){try{if(!this.visitorTrackingEnabled||!this.visitorId)return;if(!t.email&&!t.mobile&&!t.externalId)return void this.logger.debug(Zo,{reason:"No email, mobile, or externalId"});this.anonymousVisitorManager.mergeVisitorWithUser(t.firstName,t.lastName,t.email,t.mobile,t.externalId,t.customData),this.logger.info("Visitor merge triggered in background",{visitorId:this.visitorId})}catch(t){this.logger.warn("Visitor merge attempt failed, proceeding with user flow",t)}},t.prototype.sendUserEventToApi=function(t,n,r){return Bu(this,void 0,void 0,function(){var i,e,s,u,o,a,c,f,h,d,v,l,g,w,m,p;return Gu(this,function(y){switch(y.label){case 0:return i="granted"===(null===(f=this.notificationManager)||void 0===f?void 0:f.getState().permissionStatus),e=null!==(d=null===(h=this.notificationManager)||void 0===h?void 0:h.getFCMToken())&&void 0!==d?d:null,s=i&&!!e,u=e?[{interface_id:e,gateway:ba.WEB}]:[],o=null!==(l=null===(v=this.sessionManager)||void 0===v?void 0:v.getCurrentSessionId())&&void 0!==l?l:"",a=this.apiClient.buildUserEventsRequest(t,zu(zu(zu(zu({cuid:n,push_opted:s,tokens:u},(null==r?void 0:r.firstName)&&{firstName:r.firstName}),(null==r?void 0:r.lastName)&&{lastName:r.lastName}),(null==r?void 0:r.email)&&{email:r.email}),(null==r?void 0:r.mobile)&&{phone:r.mobile}),o),c=null!==(w=null===(g=this.anonymousVisitorManager)||void 0===g?void 0:g.getVisitorRefId())&&void 0!==w?w:void 0,[4,this.apiClient.sendUserEvents(a,null!==(m=this.visitorId)&&void 0!==m?m:void 0,c,n,null!==(p=this.currentUserIdentifierType)&&void 0!==p?p:void 0)];case 1:return y.sent(),this.logger.info("User event sent to User Events API",{eventName:t,cuid:n}),[2]}})})},t.prototype.pushUserSignin=function(t,n,r){var i=this;this.userIdentified=!0,this.queueUserOperation(function(){return Bu(i,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.pushUserSigninAsync(t,n,r)];case 1:return e.sent(),[3,3];case 2:return i=e.sent(),this.logger.error(Fo,{cuid:t,error:i}),[3,3];case 3:return[2]}})})})},t.prototype.pushUserSigninAsync=function(t,n,r){return Bu(this,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return[4,this.ensureInitialized()];case 1:return e.sent(),this.validateUserAttributes(n),[4,this.setUserContextIfNeeded(t,r)];case 2:e.sent(),this.attemptVisitorMerge(n),this.lastUserAttributes=n,e.label=3;case 3:return e.trys.push([3,5,,6]),[4,this.sendUserEventToApi(la,t,n)];case 4:return e.sent(),this.logger.info("User signin event tracked",{cuid:t,firstName:n.firstName,lastName:n.lastName,email:n.email}),[3,6];case 5:throw i=e.sent(),this.logger.error(Fo,{cuid:t,error:i}),i;case 6:return[2]}})})},t.prototype.pushUserSignup=function(t,n,r){var i=this;this.userIdentified=!0,this.queueUserOperation(function(){return Bu(i,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.pushUserSignupAsync(t,n,r)];case 1:return e.sent(),[3,3];case 2:return i=e.sent(),this.logger.error(Po,{cuid:t,error:i}),[3,3];case 3:return[2]}})})})},t.prototype.pushUserSignupAsync=function(t,n,r){return Bu(this,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return[4,this.ensureInitialized()];case 1:return e.sent(),this.validateUserAttributes(n),[4,this.setUserContextIfNeeded(t,r)];case 2:e.sent(),this.attemptVisitorMerge(n),this.lastUserAttributes=n,e.label=3;case 3:return e.trys.push([3,5,,6]),[4,this.sendUserEventToApi(la,t,n)];case 4:return e.sent(),this.logger.info("User signup event tracked (routed as user_signin)",{cuid:t,firstName:n.firstName,lastName:n.lastName,email:n.email}),[3,6];case 5:throw i=e.sent(),this.logger.error(Po,{cuid:t,error:i}),i;case 6:return[2]}})})},t.prototype.pushUserUpdate=function(t,n,r){var i=this;this.queueUserOperation(function(){return Bu(i,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.pushUserUpdateAsync(t,n,r)];case 1:return e.sent(),[3,3];case 2:return i=e.sent(),this.logger.error(Mo,{cuid:t,error:i}),[3,3];case 3:return[2]}})})})},t.prototype.pushUserUpdateAsync=function(t,n,r){return Bu(this,void 0,void 0,function(){var i;return Gu(this,function(e){switch(e.label){case 0:return[4,this.ensureInitialized()];case 1:return e.sent(),this.validateUserAttributes(n),[4,this.setUserContextIfNeeded(t,r)];case 2:e.sent(),this.lastUserAttributes=n,e.label=3;case 3:return e.trys.push([3,5,,6]),[4,this.sendUserEventToApi(ga,t,null)];case 4:return e.sent(),this.logger.info("User update event tracked",{cuid:t}),[3,6];case 5:throw i=e.sent(),this.logger.error(Mo,{cuid:t,error:i}),i;case 6:return[2]}})})},t.prototype.reset=function(){if(this.sdkDisabled)this.logger.debug("SDK disabled, dropping reset call");else{var t=this.lastAuthenticatedUser;t?this.pushUserSignOut(t):this.logger.warn("reset() called but no authenticated user to sign out")}},t.prototype.pushUserSignOut=function(t){var n=this;this.queueUserOperation(function(){return Bu(n,void 0,void 0,function(){var n;return Gu(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.pushUserSignOutAsync(t)];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),this.logger.error(xo,{cuid:t,error:n}),[3,3];case 3:return[2]}})})})},t.prototype.resetToAnonymousMode=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c,f,h,d;return Gu(this,function(v){switch(v.label){case 0:if(!this.visitorTrackingEnabled)return this.logger.info("Visitor tracking disabled per latest config, skipping anonymous mode"),this.visitorId=null,this.eventTracker.setVisitorTrackingState(null,!1),[2];v.label=1;case 1:return v.trys.push([1,11,,12]),[4,this.anonymousVisitorManager.clearVisitorId()];case 2:v.sent(),this.logger.info("Visitor ID cleared on user signout"),t=[],(n=null===(f=this.notificationManager)||void 0===f?void 0:f.getFCMToken())&&(r="granted"===(null===(h=this.notificationManager)||void 0===h?void 0:h.getState().permissionStatus),t.push({type:this.getChannelType(),value:n,primary:!0,verified:!0,subscribed:r})),i=void 0,v.label=3;case 3:return v.trys.push([3,7,,8]),this.notificationManager?[4,this.notificationManager.getTokenCreationDate()]:[3,5];case 4:return s=v.sent(),[3,6];case 5:s=null,v.label=6;case 6:return e=s,i=Hv(zu(zu({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:"granted"===(null===(d=this.notificationManager)||void 0===d?void 0:d.getState().permissionStatus),fcmTokenCreatedAt:e})),[3,8];case 7:return u=v.sent(),this.logger.warn("Failed to collect extended fields on signout, proceeding without them",u),i=void 0,[3,8];case 8:return o=this,[4,this.anonymousVisitorManager.getOrCreateVisitorId(t.length>0?t:void 0,i)];case 9:return o.visitorId=v.sent(),[4,this.sessionManager.resetSessionNumber(1)];case 10:return v.sent(),this.logger.info("New anonymous visitor ID generated after signout",{visitorId:this.visitorId,hasFCMToken:!!n}),a=this.anonymousVisitorManager.getVisitorRefId(),this.eventTracker.setVisitorTrackingState(this.visitorId,!0,a),[3,12];case 11:return c=v.sent(),this.logger.warn("Failed to regenerate visitor ID on signout",c),this.visitorId=null,this.eventTracker.setVisitorTrackingState(null,!0),[3,12];case 12:return[2]}})})},t.prototype.pushUserSignOutAsync=function(t){return Bu(this,void 0,void 0,function(){var n,r,i,e,s;return Gu(this,function(u){switch(u.label){case 0:return[4,this.ensureInitialized()];case 1:return u.sent(),[4,this.setUserContextIfNeeded(t)];case 2:u.sent(),u.label=3;case 3:return u.trys.push([3,5,,6]),[4,this.sendUserEventToApi(wa,t,this.lastUserAttributes)];case 4:return u.sent(),this.logger.info("User signout event tracked",{cuid:t}),[3,6];case 5:return n=u.sent(),this.logger.warn("Failed to track signout event (tracking may be disabled)",{cuid:t,error:n}),[3,6];case 6:return u.trys.push([6,15,,16]),[4,this.anonymousVisitorManager.clearMergedUserId()];case 7:return u.sent(),[4,this.anonymousVisitorManager.clearPendingMerge()];case 8:return u.sent(),[4,this.clearUserContext()];case 9:u.sent(),this.logger.info("User context cleared, returning to anonymous mode (session continues)"),u.label=10;case 10:return u.trys.push([10,12,,13]),[4,this.visitorConfigManager.refreshConfig()];case 11:return r=u.sent(),this.visitorTrackingEnabled=!0===(null===(s=r.data)||void 0===s?void 0:s.visitorTrackingEnabled),this.logger.info("Visitor config refreshed on signout",{visitorTrackingEnabled:this.visitorTrackingEnabled}),[3,13];case 12:return i=u.sent(),this.logger.warn("Failed to refresh visitor config on signout, using existing value",{visitorTrackingEnabled:this.visitorTrackingEnabled,error:i}),[3,13];case 13:return[4,this.resetToAnonymousMode()];case 14:return u.sent(),this.logger.info("SDK remains active for anonymous tracking"),[3,16];case 15:throw e=u.sent(),this.logger.error("Failed to clear user context on signout",e),e;case 16:return[2]}})})},t.prototype.pushEvent=function(t,n){var r=this;this.pushEventAsync(t,n).catch(function(n){r.logger.error(Uo,{eventName:t,error:n})})},t.prototype.pushEventAsync=function(t,n){return Bu(this,void 0,void 0,function(){var r,i,e;return Gu(this,function(s){switch(s.label){case 0:return[4,this.ensureInitialized()];case 1:if(s.sent(),!this.visitorTrackingEnabled)return this.logger.warn("Event tracking skipped: Visitor tracking is disabled",{eventName:t}),[2];if(!this.userContextSet&&!this.visitorId)return this.logger.warn("Event tracking skipped: No visitor ID available and no user context set",{eventName:t}),[2];r=zu({event_name:t},null!=n?n:{}),i={type:"behavioral",name:t,timestamp:Date.now(),data:r},s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this.trackEvent(i)];case 3:return s.sent(),this.logger.info("Behavioral event tracked",{eventName:t,attributes:n}),[3,5];case 4:throw e=s.sent(),this.logger.error(Uo,{eventName:t,error:e}),e;case 5:return[2]}})})},t.prototype.disableSDK=function(){this.sdkDisabled?this.logger.warn("SDK is already disabled"):(this.sdkDisabled=!0,this.eventTracker&&this.eventTracker.pause(),this.logger.info("SDK disabled — event tracking stopped"))},t.prototype.enableSDK=function(){var t=this;this.sdkDisabled?(this.sdkDisabled=!1,this.eventTracker&&this.eventTracker.resume().catch(function(n){t.logger.error("Failed to resume event tracker",n)}),this.logger.info("SDK enabled — event tracking resumed")):this.logger.warn("SDK is already enabled")},t.prototype.getChannelType=function(){return this.config.channelType||ba.WEB},t.prototype.applyRemoteConfigValues=function(t){this.config.accountId=t.accountId,this.config.baseURL=t.baseURL,this.config.orgId=t.orgId,this.config.source=t.source||ya.WEBPUSH,this.config.channelType=t.channelType||ba.WEB,this.config.brandId=this.config.brandId||t.brandId,this.config.applicationId=this.config.applicationId||t.applicationId;var n=to/6e4;this.config.sessionTimeoutMinutes=t.sessionTimeoutMinutes||n,this.config.batchSize=t.batchSize||no.BATCH_SIZE,this.config.debugLevel=t.debugLevel||"NONE",this.logger.setEnabled(this.shouldEnableLogging(this.config.debugLevel)),this.logger.info("Session timeout configured:",{timeoutMinutes:this.config.sessionTimeoutMinutes,source:t.sessionTimeoutMinutes?"Remote Config":"Default"}),this.logger.info("Batch size configured:",{batchSize:this.config.batchSize,source:t.batchSize?"Remote Config":"Default"}),this.logger.info("Debug level configured:",{debugLevel:this.config.debugLevel,source:t.debugLevel?"Remote Config":"Default"})},t.prototype.getExtendedFieldsForMerge=function(){return Bu(this,void 0,void 0,function(){var t,n,r;return Gu(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),this.notificationManager?[4,this.notificationManager.getTokenCreationDate()]:[3,2];case 1:return n=i.sent(),[3,3];case 2:n=null,i.label=3;case 3:return t=n,[2,Hv(zu(zu({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:"granted"===(null===(r=this.notificationManager)||void 0===r?void 0:r.getState().permissionStatus),fcmTokenCreatedAt:t}))];case 4:return i.sent(),[2,void 0];case 5:return[2]}})})},t.prototype.initializeManagersFromConfig=function(){var t=this;this.storageManager=new Rl(this.logger,this.config.brandId,this.config.applicationId),this.sessionManager=new Bl(this.storageManager,this.logger,this.config.brandId,this.config.applicationId,this.config.sessionTimeoutMinutes),this.apiClient=new Kv({baseUrl:this.config.baseURL||""},this.logger,this.config.accountId||"",this.config.orgId||"",this.config.source||ya.WEBPUSH);var n=this.apiClient;this.eventTracker=new kl(this.config,n,this.storageManager,this.logger);var r=this.config.orgId||"",i=this.config.accountId||"",e=this.config.source||ya.WEBPUSH;this.visitorConfigManager=new Dl(r,n,this.logger,this.storageManager,this.config.brandId,this.config.applicationId),this.anonymousVisitorManager=new Pl(i,r,e,n,this.logger,this.storageManager,zu(zu({},void 0!==this.config.brandId?{brandId:this.config.brandId}:{}),void 0!==this.config.applicationId?{applicationId:this.config.applicationId}:{})),this.anonymousVisitorManager.setMergeDataProviders(function(){var n;return(null===(n=t.notificationManager)||void 0===n?void 0:n.getFCMToken())||null},function(){return t.getChannelType()},function(){return t.getExtendedFieldsForMerge()},function(){var n;return"granted"===(null===(n=t.notificationManager)||void 0===n?void 0:n.getState().permissionStatus)})},t.prototype.fetchAndApplyRemoteConfig=function(){return Bu(this,void 0,void 0,function(){var t,n,r,i,e,s,u,o,a,c,f,h;return Gu(this,function(d){switch(d.label){case 0:this.logger.info("📡 Fetching configuration from Firebase Remote Config..."),d.label=1;case 1:return d.trys.push([1,5,,6]),[4,Ul()];case 2:return t=d.sent(),[4,Vl()];case 3:return n=d.sent(),r=t.initializeApp||t,i=n.getRemoteConfig||n,e=n.fetchAndActivate,s=n.getValue,u=r(this.config.firebaseConfig),(o=i(u)).settings.minimumFetchIntervalMillis=36e5,this.logger.info("🔄 Fetching Remote Config from Firebase..."),[4,e(o)];case 4:if(d.sent()||this.logger.warn("⚠️ Remote Config fetched but not activated (using cached values)"),a=s(o,this.config.remoteConfigKey),!(c=a.asString()))throw new Error('Remote Config key "'.concat(this.config.remoteConfigKey,'" is empty or not found'));f=void 0;try{f=JSON.parse(c)}catch(t){throw new Error("Failed to parse Remote Config JSON: ".concat(t))}return this.logger.info("✅ Remote Config fetched successfully:",f),this.applyRemoteConfigValues(f),this.initializeManagersFromConfig(),this.logger.info("✅ SDK configuration applied from Remote Config"),this.logger.debug("Final SDK config:",this.config),[3,6];case 5:throw h=d.sent(),this.logger.error("❌ Failed to fetch Remote Config:",h),new Error("Remote Config bootstrap failed: ".concat(h));case 6:return[2]}})})},t.prototype.validateRequiredConfig=function(t){var n=[];if(t.firebaseConfig||n.push("firebaseConfig"),t.remoteConfigKey||n.push("remoteConfigKey"),n.length>0)throw new Error("WebSDK initialization failed: Missing required configuration fields: ".concat(n.join(", ")))},t.prototype.ensureInitialized=function(){return Bu(this,void 0,void 0,function(){var t;return Gu(this,function(n){switch(n.label){case 0:if(!this.initializationPromise)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.initializationPromise];case 2:return n.sent(),[3,4];case 3:throw t=n.sent(),new Error("SDK initialization failed: ".concat(t));case 4:if(!this.initialized)throw new Error("WebSDK must be initialized before tracking events. Call init() first.");return[2]}})})},t.prototype.setUserContextIfNeeded=function(t,n){return Bu(this,void 0,void 0,function(){return Gu(this,function(r){switch(r.label){case 0:return this.userContextSet?[3,2]:[4,this.setUserContext(t,n)];case 1:r.sent(),this.logger.debug("User context set automatically",{cuid:t}),r.label=2;case 2:return[2]}})})},t.prototype.queueUserOperation=function(t){var n=this;this.userOperationChain=this.userOperationChain.then(t).catch(function(t){n.logger.error("User operation failed",t)})},t.p=null,t}()});
1
+ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).WebSDK={})}(this,function(t){"use strict";var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||"undefined"!=typeof global&&global||{},i="URLSearchParams"in n,r="Symbol"in n&&"iterator"in Symbol,e="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in n,s="ArrayBuffer"in n;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var n={next:function(){var n=t.shift();return{done:void 0===n,value:n}}};return r&&(n[Symbol.iterator]=function(){return n}),n}function d(t){this.map={},t instanceof d?t.forEach(function(t,n){this.append(n,t)},this):Array.isArray(t)?t.forEach(function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(n){this.append(n,t[n])},this)}function v(t){if(!t.t)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function l(t){return new Promise(function(n,i){t.onload=function(){n(t.result)},t.onerror=function(){i(t.error)}})}function g(t){var n=new FileReader,i=l(n);return n.readAsArrayBuffer(t),i}function m(t){if(t.slice)return t.slice(0);var n=new Uint8Array(t.byteLength);return n.set(new Uint8Array(t)),n.buffer}function p(){return this.bodyUsed=!1,this.i=function(t){var n;this.bodyUsed=this.bodyUsed,this.o=t,t?"string"==typeof t?this.u=t:e&&Blob.prototype.isPrototypeOf(t)?this.h=t:o&&FormData.prototype.isPrototypeOf(t)?this.l=t:i&&URLSearchParams.prototype.isPrototypeOf(t)?this.u=t.toString():s&&e&&((n=t)&&DataView.prototype.isPrototypeOf(n))?(this.m=m(t.buffer),this.o=new Blob([this.m])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this.m=m(t):this.u=t=Object.prototype.toString.call(t):(this.t=!0,this.u=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this.h&&this.h.type?this.headers.set("content-type",this.h.type):i&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e&&(this.blob=function(){var t=v(this);if(t)return t;if(this.h)return Promise.resolve(this.h);if(this.m)return Promise.resolve(new Blob([this.m]));if(this.l)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this.u]))}),this.arrayBuffer=function(){if(this.m){var t=v(this);return t||(ArrayBuffer.isView(this.m)?Promise.resolve(this.m.buffer.slice(this.m.byteOffset,this.m.byteOffset+this.m.byteLength)):Promise.resolve(this.m))}if(e)return this.blob().then(g);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,n,i,r,e,o=v(this);if(o)return o;if(this.h)return t=this.h,n=new FileReader,i=l(n),r=/charset=([A-Za-z0-9_-]+)/.exec(t.type),e=r?r[1]:"utf-8",n.readAsText(t,e),i;if(this.m)return Promise.resolve(function(t){for(var n=new Uint8Array(t),i=new Array(n.length),r=0;r<n.length;r++)i[r]=String.fromCharCode(n[r]);return i.join("")}(this.m));if(this.l)throw new Error("could not read FormData body as text");return Promise.resolve(this.u)},o&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,n){t=c(t),n=f(n);var i=this.map[t];this.map[t]=i?i+", "+n:n},d.prototype.delete=function(t){delete this.map[c(t)]},d.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},d.prototype.set=function(t,n){this.map[c(t)]=f(n)},d.prototype.forEach=function(t,n){for(var i in this.map)this.map.hasOwnProperty(i)&&t.call(n,this.map[i],i,this)},d.prototype.keys=function(){var t=[];return this.forEach(function(n,i){t.push(i)}),h(t)},d.prototype.values=function(){var t=[];return this.forEach(function(n){t.push(n)}),h(t)},d.prototype.entries=function(){var t=[];return this.forEach(function(n,i){t.push([i,n])}),h(t)},r&&(d.prototype[Symbol.iterator]=d.prototype.entries);var w=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function y(t,i){if(!(this instanceof y))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,e,o=(i=i||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,i.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t.o||(o=t.o,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=i.credentials||this.credentials||"same-origin",!i.headers&&this.headers||(this.headers=new d(i.headers)),this.method=(r=i.method||this.method||"GET",e=r.toUpperCase(),w.indexOf(e)>-1?e:r),this.mode=i.mode||this.mode||null,this.signal=i.signal||this.signal||function(){if("AbortController"in n)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this.i(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==i.cache&&"no-cache"!==i.cache)){var s=/([?&])_=[^&]*/;if(s.test(this.url))this.url=this.url.replace(s,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function b(t){var n=new FormData;return t.trim().split("&").forEach(function(t){if(t){var i=t.split("="),r=i.shift().replace(/\+/g," "),e=i.join("=").replace(/\+/g," ");n.append(decodeURIComponent(r),decodeURIComponent(e))}}),n}function E(t,n){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(n||(n={}),this.type="default",this.status=void 0===n.status?200:n.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===n.statusText?"":""+n.statusText,this.headers=new d(n.headers),this.url=n.url||"",this.i(t)}y.prototype.clone=function(){return new y(this,{body:this.o})},p.call(y.prototype),p.call(E.prototype),E.prototype.clone=function(){return new E(this.o,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},E.error=function(){var t=new E(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var _=[301,302,303,307,308];E.redirect=function(t,n){if(-1===_.indexOf(n))throw new RangeError("Invalid status code");return new E(null,{status:n,headers:{location:t}})};var I=n.DOMException;try{new I}catch(t){(I=function(t,n){this.message=t,this.name=n;var i=Error(t);this.stack=i.stack}).prototype=Object.create(Error.prototype),I.prototype.constructor=I}function T(t,i){return new Promise(function(r,o){var u=new y(t,i);if(u.signal&&u.signal.aborted)return o(new I("Aborted","AbortError"));var a=new XMLHttpRequest;function h(){a.abort()}if(a.onload=function(){var t,n,i={statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",n=new d,t.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t}).forEach(function(t){var i=t.split(":"),r=i.shift().trim();if(r){var e=i.join(":").trim();try{n.append(r,e)}catch(t){console.warn("Response "+t.message)}}}),n)};0===u.url.indexOf("file://")&&(a.status<200||a.status>599)?i.status=200:i.status=a.status,i.url="responseURL"in a?a.responseURL:i.headers.get("X-Request-URL");var e="response"in a?a.response:a.responseText;setTimeout(function(){r(new E(e,i))},0)},a.onerror=function(){setTimeout(function(){o(new TypeError("Network request failed"))},0)},a.ontimeout=function(){setTimeout(function(){o(new TypeError("Network request timed out"))},0)},a.onabort=function(){setTimeout(function(){o(new I("Aborted","AbortError"))},0)},a.open(u.method,function(t){try{return""===t&&n.location.href?n.location.href:t}catch(n){return t}}(u.url),!0),"include"===u.credentials?a.withCredentials=!0:"omit"===u.credentials&&(a.withCredentials=!1),"responseType"in a&&(e?a.responseType="blob":s&&(a.responseType="arraybuffer")),i&&"object"==typeof i.headers&&!(i.headers instanceof d||n.Headers&&i.headers instanceof n.Headers)){var v=[];Object.getOwnPropertyNames(i.headers).forEach(function(t){v.push(c(t)),a.setRequestHeader(t,f(i.headers[t]))}),u.headers.forEach(function(t,n){-1===v.indexOf(n)&&a.setRequestHeader(n,t)})}else u.headers.forEach(function(t,n){a.setRequestHeader(n,t)});u.signal&&(u.signal.addEventListener("abort",h),a.onreadystatechange=function(){4===a.readyState&&u.signal.removeEventListener("abort",h)}),a.send(void 0===u.o?null:u.o)})}T.polyfill=!0,n.fetch||(n.fetch=T,n.Headers=d,n.Request=y,n.Response=E);var S,A,O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},N={};function k(){if(A)return S;A=1;var t=function(t){return t&&t.Math===Math&&t};return S=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof O&&O)||t("object"==typeof S&&S)||function(){return this}()||Function("return this")()}var D,C,x,R,M,U,P,L,F={};function G(){return C?D:(C=1,D=function(t){try{return!!t()}catch(t){return!0}})}function j(){if(R)return x;R=1;var t=G();return x=!t(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}function V(){if(U)return M;U=1;var t=G();return M=!t(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})}function B(){if(L)return P;L=1;var t=V(),n=Function.prototype.call;return P=t?n.bind(n):function(){return n.apply(n,arguments)},P}var z,H,W,K,q,X,$,Y,J,Q,Z,tt,nt,it,rt,et,ot,st,ut,at,ct,ft,ht,dt,vt,lt,gt,mt,pt,wt,yt,bt,Et,_t,It,Tt,St,At,Ot,Nt,kt,Dt={};function Ct(){if(z)return Dt;z=1;var t={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,i=n&&!t.call({1:2},1);return Dt.f=i?function(t){var i=n(this,t);return!!i&&i.enumerable}:t,Dt}function xt(){return W?H:(W=1,H=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}})}function Rt(){if(q)return K;q=1;var t=V(),n=Function.prototype,i=n.call,r=t&&n.bind.bind(i,i);return K=t?r:function(t){return function(){return i.apply(t,arguments)}},K}function Mt(){if($)return X;$=1;var t=Rt(),n=t({}.toString),i=t("".slice);return X=function(t){return i(n(t),8,-1)}}function Ut(){if(J)return Y;J=1;var t=Rt(),n=G(),i=Mt(),r=Object,e=t("".split);return Y=n(function(){return!r("z").propertyIsEnumerable(0)})?function(t){return"String"===i(t)?e(t,""):r(t)}:r}function Pt(){return Z?Q:(Z=1,Q=function(t){return null==t})}function Lt(){if(nt)return tt;nt=1;var t=Pt(),n=TypeError;return tt=function(i){if(t(i))throw new n("Can't call method on "+i);return i}}function Ft(){if(rt)return it;rt=1;var t=Ut(),n=Lt();return it=function(i){return t(n(i))}}function Gt(){if(ot)return et;ot=1;var t="object"==typeof document&&document.all;return et=void 0===t&&void 0!==t?function(n){return"function"==typeof n||n===t}:function(t){return"function"==typeof t}}function jt(){if(ut)return st;ut=1;var t=Gt();return st=function(n){return"object"==typeof n?null!==n:t(n)}}function Vt(){if(ct)return at;ct=1;var t=k(),n=Gt();return at=function(i,r){return arguments.length<2?(e=t[i],n(e)?e:void 0):t[i]&&t[i][r];var e},at}function Bt(){if(ht)return ft;ht=1;var t=Rt();return ft=t({}.isPrototypeOf)}function zt(){if(vt)return dt;vt=1;var t=k().navigator,n=t&&t.userAgent;return dt=n?String(n):""}function Ht(){if(gt)return lt;gt=1;var t,n,i=k(),r=zt(),e=i.process,o=i.Deno,s=e&&e.versions||o&&o.version,u=s&&s.v8;return u&&(n=(t=u.split("."))[0]>0&&t[0]<4?1:+(t[0]+t[1])),!n&&r&&(!(t=r.match(/Edge\/(\d+)/))||t[1]>=74)&&(t=r.match(/Chrome\/(\d+)/))&&(n=+t[1]),lt=n}function Wt(){if(pt)return mt;pt=1;var t=Ht(),n=G(),i=k().String;return mt=!!Object.getOwnPropertySymbols&&!n(function(){var n=Symbol("symbol detection");return!i(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&t&&t<41})}function Kt(){if(yt)return wt;yt=1;var t=Wt();return wt=t&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function qt(){if(Et)return bt;Et=1;var t=Vt(),n=Gt(),i=Bt(),r=Kt(),e=Object;return bt=r?function(t){return"symbol"==typeof t}:function(r){var o=t("Symbol");return n(o)&&i(o.prototype,e(r))}}function Xt(){if(It)return _t;It=1;var t=String;return _t=function(n){try{return t(n)}catch(t){return"Object"}}}function $t(){if(St)return Tt;St=1;var t=Gt(),n=Xt(),i=TypeError;return Tt=function(r){if(t(r))return r;throw new i(n(r)+" is not a function")}}function Yt(){if(Ot)return At;Ot=1;var t=$t(),n=Pt();return At=function(i,r){var e=i[r];return n(e)?void 0:t(e)}}function Jt(){if(kt)return Nt;kt=1;var t=B(),n=Gt(),i=jt(),r=TypeError;return Nt=function(e,o){var s,u;if("string"===o&&n(s=e.toString)&&!i(u=t(s,e)))return u;if(n(s=e.valueOf)&&!i(u=t(s,e)))return u;if("string"!==o&&n(s=e.toString)&&!i(u=t(s,e)))return u;throw new r("Can't convert object to primitive value")}}var Qt,Zt,tn,nn,rn,en,on,sn,un,an,cn,fn,hn,dn,vn,ln,gn,mn,pn,wn,yn,bn,En,_n,In={exports:{}};function Tn(){return Zt?Qt:(Zt=1,Qt=!1)}function Sn(){if(nn)return tn;nn=1;var t=k(),n=Object.defineProperty;return tn=function(i,r){try{n(t,i,{value:r,configurable:!0,writable:!0})}catch(n){t[i]=r}return r}}function An(){if(rn)return In.exports;rn=1;var t=Tn(),n=k(),i=Sn(),r="__core-js_shared__",e=In.exports=n[r]||i(r,{});return(e.versions||(e.versions=[])).push({version:"3.50.0",mode:t?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.50.0/LICENSE",source:"https://github.com/zloirock/core-js"}),In.exports}function On(){if(on)return en;on=1;var t=An(),n=Object.create||Object;return en=function(i,r){return t[i]||(t[i]=r||n(null))}}function Nn(){if(un)return sn;un=1;var t=Lt(),n=Object;return sn=function(i){return n(t(i))}}function kn(){if(cn)return an;cn=1;var t=Rt(),n=Nn(),i=t({}.hasOwnProperty);return an=Object.hasOwn||function(t,r){return i(n(t),r)}}function Dn(){if(hn)return fn;hn=1;var t=Rt(),n=0,i=Math.random(),r=t(1.1.toString);return fn=function(t){return"Symbol("+(void 0===t?"":t)+")_"+r(++n+i,36)}}function Cn(){if(vn)return dn;vn=1;var t=k(),n=On(),i=kn(),r=Dn(),e=Wt(),o=Kt(),s=t.Symbol,u=n("wks"),a=o?s.for||s:s&&s.withoutSetter||r;return dn=function(t){return i(u,t)||(u[t]=e&&i(s,t)?s[t]:a("Symbol."+t)),u[t]}}function xn(){if(gn)return ln;gn=1;var t=B(),n=jt(),i=qt(),r=Yt(),e=Jt(),o=Cn(),s=TypeError,u=o("toPrimitive");return ln=function(o,a){if(!n(o)||i(o))return o;var c,f=r(o,u);if(f){if(void 0===a&&(a="default"),c=t(f,o,a),!n(c)||i(c))return c;throw new s("Can't convert object to primitive value")}return void 0===a&&(a="number"),e(o,a)}}function Rn(){if(pn)return mn;pn=1;var t=xn(),n=qt();return mn=function(i){var r=t(i,"string");return n(r)?r:r+""}}function Mn(){if(yn)return wn;yn=1;var t=k(),n=jt(),i=t.document,r=n(i)&&n(i.createElement);return wn=function(t){return r?i.createElement(t):{}}}function Un(){if(En)return bn;En=1;var t=j(),n=G(),i=Mn();return bn=!t&&!n(function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a})}function Pn(){if(_n)return F;_n=1;var t=j(),n=B(),i=Ct(),r=xt(),e=Ft(),o=Rn(),s=kn(),u=Un(),a=Object.getOwnPropertyDescriptor;return F.f=t?a:function(t,c){if(t=e(t),c=o(c),u)try{return a(t,c)}catch(t){}if(s(t,c))return r(!n(i.f,t,c),t[c])},F}var Ln,Fn,Gn,jn,Vn,Bn,zn,Hn={};function Wn(){if(Fn)return Ln;Fn=1;var t=j(),n=G();return Ln=t&&n(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}function Kn(){if(jn)return Gn;jn=1;var t=jt(),n=String,i=TypeError;return Gn=function(r){if(t(r))return r;throw new i(n(r)+" is not an object")}}function qn(){if(Vn)return Hn;Vn=1;var t=j(),n=Un(),i=Wn(),r=Kn(),e=Rn(),o=TypeError,s=Object.defineProperty,u=Object.getOwnPropertyDescriptor,a="enumerable",c="configurable",f="writable";return Hn.f=t?i?function(t,n,i){if(r(t),n=e(n),r(i),"function"==typeof t&&"prototype"===n&&"value"in i&&f in i&&!i[f]){var o=u(t,n);o&&o[f]&&(t[n]=i.value,i={configurable:c in i?i[c]:o[c],enumerable:a in i?i[a]:o[a],writable:!1})}return s(t,n,i)}:s:function(t,i,u){if(r(t),i=e(i),r(u),n)try{return s(t,i,u)}catch(t){}if("get"in u||"set"in u)throw new o("Accessors not supported");return"value"in u&&(t[i]=u.value),t},Hn}function Xn(){if(zn)return Bn;zn=1;var t=j(),n=qn(),i=xt();return Bn=t?function(t,r,e){return n.f(t,r,i(1,e))}:function(t,n,i){return t[n]=i,t}}var $n,Yn,Jn,Qn,Zn,ti,ni,ii,ri,ei,oi,si,ui,ai,ci,fi={exports:{}};function hi(){if(Yn)return $n;Yn=1;var t=j(),n=kn(),i=Function.prototype,r=t&&Object.getOwnPropertyDescriptor,e=n(i,"name"),o=e&&"something"===function(){}.name,s=e&&(!t||t&&r(i,"name").configurable);return $n={EXISTS:e,PROPER:o,CONFIGURABLE:s}}function di(){if(Qn)return Jn;Qn=1;var t=Rt(),n=Gt(),i=An(),r=t(Function.toString);return n(i.inspectSource)||(i.inspectSource=function(t){return r(t)}),Jn=i.inspectSource}function vi(){if(ii)return ni;ii=1;var t=On(),n=Dn(),i=t("keys");return ni=function(t){return i[t]||(i[t]=n(t))}}function li(){return ei?ri:(ei=1,ri={})}function gi(){if(si)return oi;si=1;var t,n,i,r=function(){if(ti)return Zn;ti=1;var t=k(),n=Gt(),i=t.WeakMap;return Zn=n(i)&&/native code/.test(String(i))}(),e=k(),o=jt(),s=Xn(),u=kn(),a=An(),c=vi(),f=li(),h="Object already initialized",d=e.TypeError,v=e.WeakMap;if(r||a.state){var l=a.state||(a.state=new v);l.get=l.get,l.has=l.has,l.set=l.set,t=function(t,n){if(l.has(t))throw new d(h);return n.facade=t,l.set(t,n),n},n=function(t){return l.get(t)||{}},i=function(t){return l.has(t)}}else{var g=c("state");f[g]=!0,t=function(t,n){if(u(t,g))throw new d(h);return n.facade=t,s(t,g,n),n},n=function(t){return u(t,g)?t[g]:{}},i=function(t){return u(t,g)}}return oi={set:t,get:n,has:i,enforce:function(r){return i(r)?n(r):t(r,{})},getterFor:function(t){return function(i){var r;if(!o(i)||(r=n(i)).type!==t)throw new d("Incompatible receiver, "+t+" required");return r}}}}function mi(){if(ui)return fi.exports;ui=1;var t=Rt(),n=G(),i=Gt(),r=kn(),e=j(),o=hi().CONFIGURABLE,s=di(),u=gi(),a=u.enforce,c=u.get,f=String,h=Object.defineProperty,d=t("".slice),v=t("".replace),l=t([].join),g=e&&!n(function(){return 8!==h(function(){},"length",{value:8}).length}),m=String(String).split("String"),p=fi.exports=function(t,n,i){"Symbol("===d(f(n),0,7)&&(n="["+v(f(n),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(n="get "+n),i&&i.setter&&(n="set "+n),(!r(t,"name")||o&&t.name!==n)&&(e?h(t,"name",{value:n,configurable:!0}):t.name=n),g&&i&&r(i,"arity")&&t.length!==i.arity&&h(t,"length",{value:i.arity});try{i&&r(i,"constructor")&&i.constructor?e&&h(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var s=a(t);return r(s,"source")||(s.source=l(m,"string"==typeof n?n:"")),t};return Function.prototype.toString=p(function(){return i(this)&&c(this).source||s(this)},"toString"),fi.exports}function pi(){if(ci)return ai;ci=1;var t=Gt(),n=qn(),i=mi(),r=Sn();return ai=function(e,o,s,u){u||(u={});var a=u.enumerable,c=void 0!==u.name?u.name:o;if(t(s)&&i(s,c,u),u.global)a?e[o]=s:r(o,s);else{try{u.unsafe?e[o]&&(a=!0):delete e[o]}catch(t){}a?e[o]=s:n.f(e,o,{value:s,enumerable:!1,configurable:!u.nonConfigurable,writable:!u.nonWritable})}return e}}var wi,yi,bi,Ei,_i,Ii,Ti,Si,Ai,Oi,Ni,ki,Di,Ci,xi,Ri,Mi,Ui={};function Pi(){if(Ei)return bi;Ei=1;var t=function(){if(yi)return wi;yi=1;var t=Math.ceil,n=Math.floor;return wi=Math.trunc||function(i){var r=+i;return(r>0?n:t)(r)}}();return bi=function(n){var i=+n;return i!=i||0===i?0:t(i)}}function Li(){if(Ii)return _i;Ii=1;var t=Pi(),n=Math.max,i=Math.min;return _i=function(r,e){var o=t(r);return o<0?n(o+e,0):i(o,e)}}function Fi(){if(Si)return Ti;Si=1;var t=Pi(),n=Math.min;return Ti=function(i){var r=t(i);return r>0?n(r,9007199254740991):0}}function Gi(){if(Oi)return Ai;Oi=1;var t=Fi();return Ai=function(n){return t(n.length)}}function ji(){if(ki)return Ni;ki=1;var t=Ft(),n=Li(),i=Gi(),r=function(r){return function(e,o,s){var u=t(e),a=i(u);if(0===a)return!r&&-1;var c,f=n(s,a);if(r&&o!=o){for(;a>f;)if((c=u[f++])!=c)return!0}else for(;a>f;f++)if((r||f in u)&&u[f]===o)return r||f||0;return!r&&-1}};return Ni={includes:r(!0),indexOf:r(!1)}}function Vi(){if(Ci)return Di;Ci=1;var t=Rt(),n=kn(),i=Ft(),r=ji().indexOf,e=li(),o=t([].push);return Di=function(t,s){var u,a=i(t),c=0,f=[];for(u in a)!n(e,u)&&n(a,u)&&o(f,u);for(;s.length>c;)n(a,u=s[c++])&&(~r(f,u)||o(f,u));return f}}function Bi(){return Ri?xi:(Ri=1,xi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}function zi(){if(Mi)return Ui;Mi=1;var t=Vi(),n=Bi().concat("length","prototype");return Ui.f=Object.getOwnPropertyNames||function(i){return t(i,n)},Ui}var Hi,Wi,Ki,qi,Xi,$i,Yi,Ji,Qi,Zi,tr,nr,ir,rr,er,or,sr,ur,ar,cr,fr,hr,dr,vr,lr,gr,mr,pr,wr,yr,br={};function Er(){return Hi||(Hi=1,br.f=Object.getOwnPropertySymbols),br}function _r(){if(Ki)return Wi;Ki=1;var t=Vt(),n=Rt(),i=zi(),r=Er(),e=Kn(),o=n([].concat);return Wi=t("Reflect","ownKeys")||function(t){var n=i.f(e(t)),s=r.f;return s?o(n,s(t)):n}}function Ir(){if(Xi)return qi;Xi=1;var t=kn(),n=_r(),i=Pn(),r=qn();return qi=function(e,o,s){for(var u=n(o),a=r.f,c=i.f,f=0;f<u.length;f++){var h=u[f];t(e,h)||s&&t(s,h)||a(e,h,c(o,h))}}}function Tr(){if(Yi)return $i;Yi=1;var t=G(),n=Gt(),i=/#|\.prototype\./,r=function(i,r){var a=o[e(i)];return a===u||a!==s&&(n(r)?t(r):!!r)},e=r.normalize=function(t){return String(t).replace(i,".").toLowerCase()},o=r.data={},s=r.NATIVE="N",u=r.POLYFILL="P";return $i=r}function Sr(){if(Qi)return Ji;Qi=1;var t=k(),n=Pn().f,i=Xn(),r=pi(),e=Sn(),o=Ir(),s=Tr();return Ji=function(u,a){var c,f,h,d,v,l=u.target,g=u.global,m=u.stat;if(c=g?t:m?t[l]||e(l,{}):t[l]&&t[l].prototype)for(f in a){if(d=a[f],h=u.dontCallGetSet?(v=n(c,f))&&v.value:c[f],!s(g?f:l+(m?".":"#")+f,u.forced)&&void 0!==h){if(typeof d==typeof h)continue;o(d,h)}(u.sham||h&&h.sham)&&i(d,"sham",!0),r(c,f,d,u)}}}function Ar(){if(tr)return Zi;tr=1;var t=Mt();return Zi=Array.isArray||function(n){return"Array"===t(n)}}function Or(){if(ir)return nr;ir=1;var t=TypeError;return nr=function(n){if(n>9007199254740991)throw new t("Maximum allowed index exceeded");return n}}function Nr(){if(er)return rr;er=1;var t=j(),n=qn(),i=xt();return rr=function(r,e,o){t?n.f(r,e,i(0,o)):r[e]=o}}function kr(){if(sr)return or;sr=1;var t=j(),n=Ar(),i=TypeError,r=Object.getOwnPropertyDescriptor,e=t&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();return or=e?function(t,e){if(n(t)&&!r(t,"length").writable)throw new i("Cannot set read only .length");return t.length=e}:function(t,n){return t.length=n}}function Dr(){if(ar)return ur;ar=1;var t={};return t[Cn()("toStringTag")]="z",ur="[object z]"===String(t)}function Cr(){if(fr)return cr;fr=1;var t=Dr(),n=Gt(),i=Mt(),r=Cn()("toStringTag"),e=Object,o="Arguments"===i(function(){return arguments}());return cr=t?i:function(t){var s,u,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(u=function(t,n){try{return t[n]}catch(t){}}(s=e(t),r))?u:o?i(s):"Object"===(a=i(s))&&n(s.callee)?"Arguments":a}}function xr(){if(dr)return hr;dr=1;var t=Rt(),n=G(),i=Gt(),r=Cr(),e=Vt(),o=di(),s=function(){},u=e("Reflect","construct"),a=/^\s*(?:class|function)\b/,c=t(a.exec),f=!a.test(s),h=function(t){if(!i(t))return!1;try{return u(s,[],t),!0}catch(t){return!1}},d=function(t){if(!i(t))return!1;switch(r(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return f||!!c(a,o(t))}catch(t){return!0}};return d.sham=!0,hr=!u||n(function(){var t;return h(h.call)||!h(Object)||!h(function(){t=!0})||t})?d:h}function Rr(){if(lr)return vr;lr=1;var t=Ar(),n=xr(),i=jt(),r=Cn()("species"),e=Array;return vr=function(o){var s;return t(o)&&(s=o.constructor,(n(s)&&(s===e||t(s.prototype))||i(s)&&null===(s=s[r]))&&(s=void 0)),void 0===s?e:s}}function Mr(){if(mr)return gr;mr=1;var t=Rr();return gr=function(n,i){return new(t(n))(0===i?0:i)}}function Ur(){if(wr)return pr;wr=1;var t=G(),n=Cn(),i=Ht(),r=n("species");return pr=function(n){return i>=51||!t(function(){var t=[];return(t.constructor={})[r]=function(){return{foo:1}},1!==t[n](Boolean).foo})}}!function(){if(yr)return N;yr=1;var t=Sr(),n=G(),i=Ar(),r=jt(),e=Nn(),o=Gi(),s=Or(),u=Nr(),a=kr(),c=Mr(),f=Ur(),h=Cn(),d=Ht(),v=h("isConcatSpreadable"),l=d>=51||!n(function(){var t=[];return t[v]=!1,t.concat()[0]!==t}),g=function(t){if(!r(t))return!1;var n=t[v];return void 0!==n?!!n:i(t)};t({target:"Array",proto:!0,arity:1,forced:!l||!f("concat")},{concat:function(t){var n,i,r,f,h,d=e(this),v=c(d,0),l=0;for(n=-1,r=arguments.length;n<r;n++)if(g(h=-1===n?d:arguments[n]))for(f=o(h),s(l+f),i=0;i<f;i++,l++)i in h&&u(v,l,h[i]);else s(l+1),u(v,l++,h);return a(v,l),v}})}();var Pr,Lr,Fr,Gr,jr,Vr,Br,zr={};function Hr(){if(Lr)return Pr;Lr=1;var t=Mt(),n=Rt();return Pr=function(i){if("Function"===t(i))return n(i)}}function Wr(){if(Gr)return Fr;Gr=1;var t=Hr(),n=$t(),i=V(),r=t(t.bind);return Fr=function(t,e){return n(t),void 0===e?t:i?r(t,e):function(){return t.apply(e,arguments)}},Fr}function Kr(){if(Vr)return jr;Vr=1;var t=Wr(),n=Ut(),i=Nn(),r=Gi(),e=Mr(),o=Nr(),s=function(s){var u=1===s,a=2===s,c=3===s,f=4===s,h=6===s,d=7===s,v=5===s||h;return function(l,g,m){for(var p,w,y=i(l),b=n(y),E=r(b),_=t(g,m),I=0,T=0,S=u?e(l,E):a||d?e(l,0):void 0;E>I;I++)if((v||I in b)&&(w=_(p=b[I],I,y),s))if(u)o(S,I,w);else if(w)switch(s){case 3:return!0;case 5:return p;case 6:return I;case 2:o(S,T++,p)}else switch(s){case 4:return!1;case 7:o(S,T++,p)}return h?-1:c||f?f:S}};return jr={forEach:s(0),map:s(1),filter:s(2),some:s(3),every:s(4),find:s(5),findIndex:s(6),filterReject:s(7)}}!function(){if(Br)return zr;Br=1;var t=Sr(),n=Kr().filter;t({target:"Array",proto:!0,forced:!Ur()("filter")},{filter:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}})}();var qr,Xr,$r,Yr,Jr,Qr,Zr,te,ne,ie,re={},ee={};function oe(){if(Xr)return qr;Xr=1;var t=Vi(),n=Bi();return qr=Object.keys||function(i){return t(i,n)}}function se(){if(Jr)return Yr;Jr=1;var t=Vt();return Yr=t("document","documentElement")}function ue(){if(Zr)return Qr;Zr=1;var t,n=Kn(),i=function(){if($r)return ee;$r=1;var t=j(),n=Wn(),i=qn(),r=Kn(),e=Ft(),o=oe();return ee.f=t&&!n?Object.defineProperties:function(t,n){r(t);for(var s,u=e(n),a=o(n),c=a.length,f=0;c>f;)i.f(t,s=a[f++],u[s]);return t},ee}(),r=Bi(),e=li(),o=se(),s=Mn(),u=vi(),a="prototype",c="script",f=u("IE_PROTO"),h=function(){},d=function(t){return"<"+c+">"+t+"</"+c+">"},v=function(t){t.write(d("")),t.close();var n=t.parentWindow.Object;return t=null,n},l=function(){try{t=new ActiveXObject("htmlfile")}catch(t){}var n,i,e;l="undefined"!=typeof document?document.domain&&t?v(t):(i=s("iframe"),e="java"+c+":",i.style.display="none",o.appendChild(i),i.src=String(e),(n=i.contentWindow.document).open(),n.write(d("document.F=Object")),n.close(),n.F):v(t);for(var u=r.length;u--;)delete l[a][r[u]];return l()};return e[f]=!0,Qr=Object.create||function(t,r){var e;return null!==t?(h[a]=n(t),e=new h,h[a]=null,e[f]=t):e=l(),void 0===r?e:i.f(e,r)}}function ae(){if(ne)return te;ne=1;var t=Cn(),n=ue(),i=qn().f,r=t("unscopables"),e=Array.prototype;return void 0===e[r]&&i(e,r,{configurable:!0,value:n(null)}),te=function(t){e[r][t]=!0}}!function(){if(ie)return re;ie=1;var t=Sr(),n=ji().includes,i=G(),r=ae(),e=i(function(){return!Array(1).includes()}),o=i(function(){return[,1].includes(void 0,1)});t({target:"Array",proto:!0,forced:e||o},{includes:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}}),r("includes")}();var ce,fe,he,de={};function ve(){if(fe)return ce;fe=1;var t=G();return ce=function(n,i){var r=[][n];return!!r&&t(function(){r.call(null,i||function(){return 1},1)})}}!function(){if(he)return de;he=1;var t=Sr(),n=Rt(),i=Ut(),r=Ft(),e=ve(),o=n([].join);t({target:"Array",proto:!0,forced:i!==Object||!e("join",",")},{join:function(t){return o(r(this),void 0===t?",":t)}})}();var le,ge,me,pe={};function we(){if(ge)return le;ge=1;var t=j(),n=Rt(),i=B(),r=G(),e=oe(),o=Er(),s=Ct(),u=Nn(),a=Ut(),c=Object.assign,f=Object.defineProperty,h=n([].concat);return le=!c||r(function(){if(t&&1!==c({b:1},c(f({},"a",{enumerable:!0,get:function(){f(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var n={},i={},r=Symbol("assign detection"),o="abcdefghijklmnopqrst";return n[r]=7,o.split("").forEach(function(t){i[t]=t}),7!==c({},n)[r]||e(c({},i)).join("")!==o})?function(n,r){for(var c=u(n),f=arguments.length,d=1,v=o.f,l=s.f;f>d;)for(var g,m=a(arguments[d++]),p=v?h(e(m),v(m)):e(m),w=p.length,y=0;w>y;)g=p[y++],t&&!i(l,m,g)||(c[g]=m[g]);return c}:c,le}!function(){if(me)return pe;me=1;var t=Sr(),n=we();t({target:"Object",stat:!0,arity:2,forced:Object.assign!==n},{assign:n})}();var ye,be={};!function(){if(ye)return be;ye=1;var t=Sr(),n=Nn(),i=oe();t({target:"Object",stat:!0,forced:G()(function(){i(1)})},{keys:function(t){return i(n(t))}})}();var Ee,_e,Ie,Te={};!function(){if(Ie)return Te;Ie=1;var t=Dr(),n=pi(),i=function(){if(_e)return Ee;_e=1;var t=Dr(),n=Cr();return Ee=t?{}.toString:function(){return"[object "+n(this)+"]"}}();t||n(Object.prototype,"toString",i,{unsafe:!0})}();var Se,Ae,Oe,Ne,ke,De,Ce,xe,Re,Me,Ue,Pe,Le,Fe,Ge,je,Ve,Be,ze,He,We,Ke,qe,Xe,$e,Ye,Je,Qe,Ze,to,no,io,ro,eo,oo,so,uo,ao,co,fo,ho,vo,lo,go,mo,po,wo,yo,bo,Eo,_o,Io,To,So,Ao={};function Oo(){if(Ae)return Se;Ae=1;var t=k(),n=zt(),i=Mt(),r=function(t){return n.slice(0,t.length)===t};return Se=r("Bun/")?"BUN":r("Cloudflare-Workers")?"CLOUDFLARE":r("Deno/")?"DENO":r("Node.js/")?"NODE":t.Bun&&"string"==typeof Bun.version?"BUN":t.Deno&&"object"==typeof Deno.version?"DENO":"process"===i(t.process)?"NODE":t.window&&t.document?"BROWSER":"REST"}function No(){if(Ne)return Oe;Ne=1;var t=Oo();return Oe="NODE"===t}function ko(){if(De)return ke;De=1;var t=k();return ke=t}function Do(){if(Me)return Re;Me=1;var t=jt();return Re=function(n){return t(n)||null===n}}function Co(){if(Pe)return Ue;Pe=1;var t=Do(),n=String,i=TypeError;return Ue=function(r){if(t(r))return r;throw new i("Can't set "+n(r)+" as a prototype")}}function xo(){if(Fe)return Le;Fe=1;var t=function(){if(xe)return Ce;xe=1;var t=Rt(),n=$t();return Ce=function(i,r,e){try{return t(n(Object.getOwnPropertyDescriptor(i,r)[e]))}catch(t){}}}(),n=jt(),i=Lt(),r=Co();return Le=Object.setPrototypeOf||("__proto__"in{}?function(){var e,o=!1,s={};try{(e=t(Object.prototype,"__proto__","set"))(s,[]),o=s instanceof Array}catch(t){}return function(t,s){return i(t),r(s),n(t)?(o?e(t,s):t.__proto__=s,t):t}}():void 0)}function Ro(){if(je)return Ge;je=1;var t=qn().f,n=kn(),i=Cn()("toStringTag");return Ge=function(r,e,o){r&&!o&&(r=r.prototype),r&&!n(r,i)&&t(r,i,{configurable:!0,value:e})}}function Mo(){if(Be)return Ve;Be=1;var t=mi(),n=qn();return Ve=function(i,r,e){return e.get&&t(e.get,r,{getter:!0}),e.set&&t(e.set,r,{setter:!0}),n.f(i,r,e)}}function Uo(){if(He)return ze;He=1;var t=Vt(),n=Mo(),i=Cn(),r=j(),e=i("species");return ze=function(i){var o=t(i);r&&o&&!o[e]&&n(o,e,{configurable:!0,get:function(){return this}})}}function Po(){if(Ke)return We;Ke=1;var t=Bt(),n=TypeError;return We=function(i,r){if(t(r,i))return i;throw new n("Incorrect invocation")}}function Lo(){if(Xe)return qe;Xe=1;var t=xr(),n=Xt(),i=TypeError;return qe=function(r){if(t(r))return r;throw new i(n(r)+" is not a constructor")}}function Fo(){if(Ye)return $e;Ye=1;var t=Kn(),n=Lo(),i=Pt(),r=Cn()("species");return $e=function(e,o){var s,u=t(e).constructor;return void 0===u||i(s=t(u)[r])?o:n(s)}}function Go(){if(Qe)return Je;Qe=1;var t=V(),n=Function.prototype,i=n.apply,r=n.call;return Je="object"==typeof Reflect&&Reflect.apply||(t?r.bind(i):function(){return r.apply(i,arguments)}),Je}function jo(){if(to)return Ze;to=1;var t=Rt();return Ze=t([].slice)}function Vo(){if(io)return no;io=1;var t=TypeError;return no=function(n,i){if(n<i)throw new t("Not enough arguments");return n}}function Bo(){if(eo)return ro;eo=1;var t=zt();return ro=/ipad|iphone|ipod/i.test(t)&&/applewebkit/i.test(t)}function zo(){if(so)return oo;so=1;var t,n,i,r,e=k(),o=Go(),s=Wr(),u=Gt(),a=kn(),c=G(),f=se(),h=jo(),d=Mn(),v=Vo(),l=Bo(),g=No(),m=e.setImmediate,p=e.clearImmediate,w=e.process,y=e.Dispatch,b=e.Function,E=e.MessageChannel,_=e.String,I=0,T={},S="onreadystatechange";c(function(){t=e.location});var A=function(t){if(a(T,t)){var n=T[t];delete T[t],n()}},O=function(t){return function(){A(t)}},N=function(t){A(t.data)},D=function(n){e.postMessage(_(n),t.protocol+"//"+t.host)};return m&&p||(m=function(t){v(arguments.length,1);var i=u(t)?t:b(t),r=h(arguments,1);return T[++I]=function(){o(i,void 0,r)},n(I),I},p=function(t){delete T[t]},g?n=function(t){w.nextTick(O(t))}:y&&y.now?n=function(t){y.now(O(t))}:E&&!l?(r=(i=new E).port2,i.port1.onmessage=N,n=s(r.postMessage,r)):e.addEventListener&&u(e.postMessage)&&!e.importScripts&&t&&"file:"!==t.protocol&&!c(D)?(n=D,e.addEventListener("message",N,!1)):n=S in d("script")?function(t){f.appendChild(d("script"))[S]=function(){f.removeChild(this),A(t)}}:function(t){setTimeout(O(t),0)}),oo={set:m,clear:p}}function Ho(){if(ao)return uo;ao=1;var t=k(),n=j(),i=Object.getOwnPropertyDescriptor;return uo=function(r){if(!n)return t[r];var e=i(t,r);return e&&e.value}}function Wo(){if(fo)return co;fo=1;var t=function(){this.head=null,this.tail=null};return t.prototype={add:function(t){var n={item:t,next:null},i=this.tail;i?i.next=n:this.head=n,this.tail=n},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}},co=t}function Ko(){if(po)return mo;po=1;var t,n,i,r,e,o=k(),s=Ho(),u=Wr(),a=zo().set,c=Wo(),f=Bo(),h=function(){if(vo)return ho;vo=1;var t=zt();return ho=/ipad|iphone|ipod/i.test(t)&&"undefined"!=typeof Pebble}(),d=function(){if(go)return lo;go=1;var t=zt();return lo=/web0s(?!.*chrome)/i.test(t)}(),v=No(),l=o.MutationObserver||o.WebKitMutationObserver,g=o.document,m=o.process,p=o.Promise,w=s("queueMicrotask");if(!w){var y=new c,b=function(){var n,i;for(v&&(n=m.domain)&&n.exit();i=y.get();)try{i()}catch(n){throw y.head&&t(),n}n&&n.enter()};f||v||d||!l||!g?!h&&p&&p.resolve?((r=p.resolve(void 0)).constructor=p,e=u(r.then,r),t=function(){e(b)}):v?t=function(){m.nextTick(b)}:(a=u(a,o),t=function(){a(b)}):(n=!0,i=g.createTextNode(""),new l(b).observe(i,{characterData:!0}),t=function(){i.data=n=!n}),w=function(n){y.head||t(),y.add(n)}}return mo=w}function qo(){return yo||(yo=1,wo=function(t,n){try{1===arguments.length?console.error(t):console.error(t,n)}catch(t){}}),wo}function Xo(){return Eo?bo:(Eo=1,bo=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}})}function $o(){if(Io)return _o;Io=1;var t=k();return _o=t.Promise}function Yo(){if(So)return To;So=1;var t=k(),n=$o(),i=Gt(),r=Tr(),e=di(),o=Cn(),s=Oo(),u=Tn(),a=Ht(),c=n&&n.prototype,f=o("species"),h=!1,d=i(t.PromiseRejectionEvent),v=r("Promise",function(){var t=e(n),i=t!==String(n);if(!i&&66===a)return!0;if(u&&(!c.catch||!c.finally))return!0;if(!a||a<51||!/native code/.test(t)){var r=new n(function(t){t(1)}),o=function(t){t(function(){},function(){})};if((r.constructor={})[f]=o,!(h=r.then(function(){})instanceof o))return!0}return!(i||"BROWSER"!==s&&"DENO"!==s||d)});return To={CONSTRUCTOR:v,REJECTION_EVENT:d,SUBCLASSING:h}}var Jo,Qo,Zo={};function ts(){if(Jo)return Zo;Jo=1;var t=$t(),n=TypeError,i=function(i){var r,e;this.promise=new i(function(t,i){if(void 0!==r||void 0!==e)throw new n("Bad Promise constructor");r=t,e=i}),this.resolve=t(r),this.reject=t(e)};return Zo.f=function(t){return new i(t)},Zo}var ns,is,rs,es,os,ss,us,as,cs,fs,hs,ds,vs,ls,gs,ms,ps,ws={};function ys(){return is?ns:(is=1,ns=Object.create?Object.create(null):{})}function bs(){if(es)return rs;es=1;var t=Cn(),n=ys(),i=t("iterator"),r=Array.prototype;return rs=function(t){return void 0!==t&&(n.Array===t||r[i]===t)}}function Es(){if(ss)return os;ss=1;var t=Mt(),n=Pt(),i=Yt(),r=Cn()("iterator"),e=Array.prototype;return os=function(o){if(!n(o))return i(o,r)||i(o,"@@iterator")||("Arguments"===t(o)?e[r]:void 0)}}function _s(){if(as)return us;as=1;var t=B(),n=Gt(),i=Kn(),r=Xt(),e=Es(),o=TypeError;return us=function(s,u){var a=arguments.length<2?e(s):u;if(n(a))return i(t(a,s));throw new o(r(s)+" is not iterable")},us}function Is(){if(fs)return cs;fs=1;var t=B(),n=Kn(),i=Yt();return cs=function(r,e,o){var s,u;n(r);try{if(!(s=i(r,"return"))){if("throw"===e)throw o;return o}s=t(s,r)}catch(t){u=!0,s=t}if("throw"===e)throw o;if(u)throw s;return n(s),o}}function Ts(){if(ds)return hs;ds=1;var t=Wr(),n=B(),i=Kn(),r=Xt(),e=bs(),o=Gi(),s=Bt(),u=_s(),a=Es(),c=Is(),f=TypeError,h=function(t,n){this.stopped=t,this.result=n},d=h.prototype;return hs=function(v,l,g){var m,p,w,y,b,E,_,I=g&&g.that,T=!(!g||!g.AS_ENTRIES),S=!(!g||!g.IS_RECORD),A=!(!g||!g.IS_ITERATOR),O=!(!g||!g.INTERRUPTED),N=t(l,I),k=function(t){var n=m;return m=void 0,n&&c(n,"normal"),new h(!0,t)},D=function(t){return T?(i(t),O?N(t[0],t[1],k):N(t[0],t[1])):O?N(t,k):N(t)};if(S)m=v.iterator;else if(A)m=v;else{if(!(p=a(v)))throw new f(r(v)+" is not iterable");if(e(p)){for(w=0,y=o(v);y>w;w++)if((b=D(v[w]))&&s(d,b))return b;return new h(!1)}m=u(v,p)}for(E=S?v.next:m.next;!(_=n(E,m)).done;){var C=_.value;try{b=D(C)}catch(t){if(!m)throw t;c(m,"throw",t)}if("object"==typeof b&&b&&s(d,b))return b}return new h(!1)}}function Ss(){if(ls)return vs;ls=1;var t=Cn()("iterator"),n=!1;try{var i=0,r={next:function(){return{done:!!i++}},return:function(){n=!0}};r[t]=function(){return this},Array.from(r,function(){throw 2})}catch(t){}return vs=function(i,r){try{if(!r&&!n)return!1}catch(t){return!1}var e=!1;try{var o={};o[t]=function(){return{next:function(){return{done:e=!0}}}},i(o)}catch(t){}return e}}function As(){if(ms)return gs;ms=1;var t=$o(),n=Ss(),i=Yo().CONSTRUCTOR;return gs=i||!n(function(n){t.all(n).then(void 0,function(){})})}var Os,Ns={};var ks,Ds={};var Cs,xs={};var Rs,Ms,Us,Ps,Ls={};function Fs(){if(Ms)return Rs;Ms=1;var t=Kn(),n=jt(),i=ts();return Rs=function(r,e){if(t(r),n(e)&&e.constructor===r)return e;var o=i.f(r);return(0,o.resolve)(e),o.promise}}Ps||(Ps=1,function(){if(Qo)return Ao;Qo=1;var t,n,i,r,e=Sr(),o=Tn(),s=No(),u=k(),a=ko(),c=B(),f=pi(),h=xo(),d=Ro(),v=Uo(),l=$t(),g=Gt(),m=jt(),p=Po(),w=Fo(),y=zo().set,b=Ko(),E=qo(),_=Xo(),I=Wo(),T=gi(),S=$o(),A=Yo(),O=ts(),N="Promise",D=A.CONSTRUCTOR,C=A.REJECTION_EVENT,x=A.SUBCLASSING,R=T.getterFor(N),M=T.set,U=S&&S.prototype,P=S,L=U,F=u.TypeError,G=u.document,j=u.process,V=O.f,z=V,H=!!(G&&G.createEvent&&u.dispatchEvent),W="unhandledrejection",K=function(t){var n;return!(!m(t)||!g(n=t.then))&&n},q=function(t,n){var i,r,e,o=n.value,s=1===n.state,u=s?t.ok:t.fail,a=t.resolve,f=t.reject,h=t.domain;try{u?(s||(2===n.rejection&&Q(n),n.rejection=1),!0===u?i=o:(h&&h.enter(),i=u(o),h&&(h.exit(),e=!0)),i===t.promise?f(new F("Promise-chain cycle")):(r=K(i))?c(r,i,a,f):a(i)):f(o)}catch(t){h&&!e&&h.exit(),f(t)}},X=function(t,n){t.notified||(t.notified=!0,b(function(){for(var i,r=t.reactions;i=r.get();)q(i,t);t.notified=!1,n&&!t.rejection&&Y(t)}))},$=function(t,n,i){var r,e;H?((r=G.createEvent("Event")).promise=n,r.reason=i,r.initEvent(t,!1,!0),u.dispatchEvent(r)):r={promise:n,reason:i},!C&&(e=u["on"+t])?e(r):t===W&&E("Unhandled promise rejection",i)},Y=function(t){c(y,u,function(){var n,i=t.facade,r=t.value;if(J(t)&&(n=_(function(){s?j.emit("unhandledRejection",r,i):$(W,i,r)}),t.rejection=s||J(t)?2:1,n.error))throw n.value})},J=function(t){return 1!==t.rejection&&!t.parent},Q=function(t){c(y,u,function(){var n=t.facade;s?j.emit("rejectionHandled",n):$("rejectionhandled",n,t.value)})},Z=function(t,n,i){return function(r){t(n,r,i)}},tt=function(t,n,i){t.done||(t.done=!0,i&&(t=i),t.value=n,t.state=2,X(t,!0))},nt=function(t,n,i){if(!t.done){t.done=!0,i&&(t=i);try{if(t.facade===n)throw new F("Promise can't be resolved itself");var r=K(n);r?b(function(){var i={done:!1};try{c(r,n,Z(nt,i,t),Z(tt,i,t))}catch(n){tt(i,n,t)}}):(t.value=n,t.state=1,X(t,!1))}catch(n){tt({done:!1},n,t)}}};if(D&&(L=(P=function(n){p(this,L),l(n),c(t,this);var i=R(this);try{n(Z(nt,i),Z(tt,i))}catch(t){tt(i,t)}}).prototype,(t=function(t){M(this,{type:N,done:!1,notified:!1,parent:!1,reactions:new I,rejection:!1,state:0,value:null})}).prototype=f(L,"then",function(t,n){var i=R(this),r=V(w(this,P));return i.parent=!0,r.ok=!g(t)||t,r.fail=g(n)&&n,r.domain=s?j.domain:void 0,0===i.state?i.reactions.add(r):b(function(){q(r,i)}),r.promise}),n=function(){var n=new t,i=R(n);this.promise=n,this.resolve=Z(nt,i),this.reject=Z(tt,i)},O.f=V=function(t){return t===P||t===i?new n(t):z(t)},!o&&g(S)&&U!==Object.prototype)){r=U.then,x||f(U,"then",function(t,n){var i=this;return new P(function(t,n){c(r,i,t,n)}).then(t,n)},{unsafe:!0});try{delete U.constructor}catch(t){}h&&h(U,L)}e({global:!0,constructor:!0,wrap:!0,forced:D},{Promise:P}),i=a.Promise,d(P,N,!1,!0),v(N)}(),function(){if(ps)return ws;ps=1;var t=Sr(),n=B(),i=$t(),r=ts(),e=Xo(),o=Ts();t({target:"Promise",stat:!0,forced:As()},{all:function(t){var s=this,u=r.f(s),a=u.resolve,c=u.reject,f=e(function(){var r=i(s.resolve),e=[],u=0,f=1;o(t,function(t){var i=u++,o=!1;f++,n(r,s,t).then(function(t){o||(o=!0,e[i]=t,--f||a(e))},c)}),--f||a(e)});return f.error&&c(f.value),u.promise}})}(),function(){if(Os)return Ns;Os=1;var t=Sr(),n=Tn(),i=Yo().CONSTRUCTOR,r=$o(),e=Vt(),o=Gt(),s=pi(),u=r&&r.prototype;if(t({target:"Promise",proto:!0,forced:i,real:!0},{catch:function(t){return this.then(void 0,t)}}),!n&&o(r)){var a=e("Promise").prototype.catch;u.catch!==a&&s(u,"catch",a,{unsafe:!0})}}(),function(){if(ks)return Ds;ks=1;var t=Sr(),n=B(),i=$t(),r=ts(),e=Xo(),o=Ts();t({target:"Promise",stat:!0,forced:As()},{race:function(t){var s=this,u=r.f(s),a=u.reject,c=e(function(){var r=i(s.resolve);o(t,function(t){n(r,s,t).then(u.resolve,a)})});return c.error&&a(c.value),u.promise}})}(),function(){if(Cs)return xs;Cs=1;var t=Sr(),n=ts();t({target:"Promise",stat:!0,forced:Yo().CONSTRUCTOR},{reject:function(t){var i=n.f(this);return(0,i.reject)(t),i.promise}})}(),function(){if(Us)return Ls;Us=1;var t=Sr(),n=Vt(),i=Tn(),r=$o(),e=Yo().CONSTRUCTOR,o=Fs(),s=n("Promise"),u=i&&!e;t({target:"Promise",stat:!0,forced:i||e},{resolve:function(t){return o(u&&this===s?r:this,t)}})}());var Gs,js,Vs,Bs,zs,Hs,Ws,Ks={};function qs(){return js?Gs:(js=1,Gs={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0})}function Xs(){if(Bs)return Vs;Bs=1;var t=Mn()("span").classList,n=t&&t.constructor&&t.constructor.prototype;return Vs=n===Object.prototype?void 0:n}!function(){if(Ws)return Ks;Ws=1;var t=k(),n=qs(),i=Xs(),r=function(){if(Hs)return zs;Hs=1;var t=Kr().forEach,n=ve()("forEach");return zs=n?[].forEach:function(n){return t(this,n,arguments.length>1?arguments[1]:void 0)},zs}(),e=Xn(),o=function(t){if(t&&t.forEach!==r)try{e(t,"forEach",r)}catch(n){t.forEach=r}};for(var s in n)n[s]&&o(t[s]&&t[s].prototype);o(i)}();var $s=function(t,n){return $s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},$s(t,n)};function Ys(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}$s(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var Js=function(){return Js=Object.assign||function(t){for(var n,i=1,r=arguments.length;i<r;i++)for(var e in n=arguments[i])Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);return t},Js.apply(this,arguments)};function Qs(t,n,i,r){return new(i||(i=Promise))(function(e,o){function s(t){try{a(r.next(t))}catch(t){o(t)}}function u(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i(function(t){t(n)})).then(s,u)}a((r=r.apply(t,n||[])).next())})}function Zs(t,n){var i,r,e,o={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(u){return function(a){return function(u){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(i=1,r&&(e=2&u[0]?r.return:u[0]?r.throw||((e=r.return)&&e.call(r),0):r.next)&&!(e=e.call(r,u[1])).done)return e;switch(r=0,e&&(u=[2&u[0],e.value]),u[0]){case 0:case 1:e=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(e=o.trys,(e=e.length>0&&e[e.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!e||u[1]>e[0]&&u[1]<e[3])){o.label=u[1];break}if(6===u[0]&&o.label<e[1]){o.label=e[1],e=u;break}if(e&&o.label<e[2]){o.label=e[2],o.ops.push(u);break}e[2]&&o.ops.pop(),o.trys.pop();continue}u=n.call(t,o)}catch(t){u=[6,t],r=0}finally{i=e=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function tu(t){var n="function"==typeof Symbol&&Symbol.iterator,i=n&&t[n],r=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function nu(t,n){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var r,e,o=i.call(t),s=[];try{for(;(void 0===n||n-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){e={error:t}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}return s}function iu(t,n,i){if(i||2===arguments.length)for(var r,e=0,o=n.length;e<o;e++)!r&&e in n||(r||(r=Array.prototype.slice.call(n,0,e)),r[e]=n[e]);return t.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var ru="/api/v1/web/events",eu="/api/v1/web/userEvents",ou="/sdk/v2/config",su="/sdk/v2/visitors",uu="/sdk/v2/visitors",au="/sdk/v2/visitors/merge",cu="/api/v1/websdk/dlr",fu=18e5,hu={STATUSES:{PENDING:"pending"},BATCH_SIZE:50,DEFAULT_RETRY_DELAYS:[6e4,12e4,24e4,48e4,9e5],RETRYABLE_HTTP_CODES:[408,429,500,502,503,504,401],GLOBAL_SUCCESS_CODE:202,PARTIAL_SUCCESS_CODE:201,DLR_SUCCESS_CODE:200},du="/firebase-messaging-sw.js",vu={USER_CONTEXT:"websdk_user_context",VISITOR_ID:"websdk_visitor_id",VISITOR_EXTERNAL_ID:"websdk_visitor_external_id",VISITOR_EXPIRED_AT:"websdk_visitor_expired_at",VISITOR_CONFIG:"websdk_visitor_config",FCM_TOKEN:"websdk_fcm_token",FCM_TOKEN_CREATED_AT:"websdk_fcm_token_created_at",NOTIFICATION_STATE:"websdk_notification_state",SESSION_ID:"websdk_session_id",SESSION_START_TIME:"websdk_session_start_time",LAST_EVENT_TIME:"websdk_last_event_time",LAST_AUTHENTICATED_USER:"websdk_last_authenticated_user",MERGED_USER_ID:"websdk_merged_user_id",PENDING_MERGE:"websdk_pending_merge",SESSION_NUMBER:"websdk_session_number"};function lu(t,n,i){var r=vu[t],e=[];return n&&e.push(n),i&&e.push(i),e.length>0?"".concat(e.join("_"),"_").concat(r):r}var gu="websdk_storage_test",mu="test_value",pu="INIT_ERROR",wu="AUTH_ERROR",yu="NETWORK_ERROR",bu="EVENT_ERROR",Eu="VISITOR_CONFIG_ERROR",_u="WebSDK initialized successfully",Iu="Failed to initialize WebSDK",Tu="WebSDK destroyed successfully",Su="Storage initialization failed",Au="Failed to restore persisted page-path-tracking preference",Ou="Session initialization failed",Nu="Visitor config initialization failed",ku="Event tracker initialization failed",Du="Failed to restore user context",Cu="Failed to sync event tracker context",xu="DLR setup failed",Ru="EventTracker initialized successfully",Mu="EventTracker destroyed successfully",Uu="Failed to track event",Pu="Events sent successfully",Lu="Failed to send events",Fu="Failed to initialize storage:",Gu="Storage test failed:",ju="Storage read/write test failed",Vu="StorageManager destroyed successfully",Bu="Error during storage cleanup:",zu="New session started",Hu="Session continued",Wu="Session expired due to inactivity",Ku="Session ended on user switch (different user login)",qu="Session restored from storage",Xu="Failed to track user signin event",$u="Failed to track user signup event",Yu="Failed to track user update event",Ju="Failed to track user signout event",Qu="Failed to track behavioral event",Zu="VisitorConfigManager initialized successfully",ta="Visitor config fetched successfully",na="Failed to fetch visitor config",ia="Visitor tracking is disabled",ra="Visitor tracking is enabled",ea="Visitor config retrieved from cache",oa="AnonymousVisitorManager initialized successfully",sa="Visitor ID generated successfully",ua="Failed to generate visitor ID",aa="Visitor ID restored from storage",ca="Using cached visitor ID",fa="Visitor updated successfully",ha="Failed to update visitor",da="Visitor merged with user successfully",va="Failed to merge visitor with user",la="Visitor merge skipped",ga="Notification permission denied by user",ma="Notification manager initialized successfully",pa="Failed to initialize notification manager",wa="Notification initialization skipped (disabled or not supported)",ya="Firebase initialized successfully",ba="Failed to initialize Firebase",Ea="FCM token received successfully",_a="FCM token refreshed",Ia="Failed to retrieve FCM token",Ta="Service worker registered successfully",Sa="Failed to register service worker",Aa="DLR events sent successfully",Oa="Failed to send DLR events",Na="web",ka="user_signin",Da="user_update",Ca="user_signout",xa="scroll_depth",Ra=[25,50,75,90],Ma=30,Ua=3e3,Pa={WEBPUSH:"WEBPUSH"},La={WEB:"web"},Fa={ACCOUNT_NOT_EXISTS:2432,ACCOUNT_ID_NOT_PASSED:9999},Ga={ALREADY_MERGED:"1429",VISITOR_NOT_FOUND:"1428"},ja={NOTIFICATION_RECEIVED:"push_notification_received",NOTIFICATION_CLICKED:"push_notification_click",NOTIFICATION_DISMISSED:"push_notification_close"},Va="fcm",Ba="push",za="1.7.0";function Ha(t){return Ha="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ha(t)}var Wa,Ka={};!function(){if(Wa)return Ka;Wa=1;var t=Sr(),n=Kr().find,i=ae(),r="find",e=!0;r in[]&&Array(1)[r](function(){e=!1}),t({target:"Array",proto:!0,forced:e},{find:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}}),i(r)}();var qa,Xa,$a,Ya,Ja,Qa,Za,tc,nc,ic,rc,ec,oc,sc,uc,ac={};function cc(){if(Ja)return Ya;Ja=1;var t=kn(),n=Gt(),i=Nn(),r=vi(),e=function(){if($a)return Xa;$a=1;var t=G();return Xa=!t(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})}(),o=r("IE_PROTO"),s=Object,u=s.prototype;return Ya=e?s.getPrototypeOf:function(r){var e=i(r);if(t(e,o))return e[o];var a=e.constructor;return n(a)&&e instanceof a?a.prototype:e instanceof s?u:null}}function fc(){if(Za)return Qa;Za=1;var t,n,i,r=G(),e=Gt(),o=jt(),s=ue(),u=cc(),a=pi(),c=Cn(),f=Tn(),h=c("iterator"),d=!1;return[].keys&&("next"in(i=[].keys())?(n=u(u(i)))!==Object.prototype&&(t=n):d=!0),!o(t)||r(function(){var n={};return t[h].call(n)!==n})?t={}:f&&(t=s(t)),e(t[h])||a(t,h,function(){return this}),Qa={IteratorPrototype:t,BUGGY_SAFARI_ITERATORS:d}}function hc(){if(nc)return tc;nc=1;var t=fc().IteratorPrototype,n=ue(),i=xt(),r=Ro(),e=ys(),o=function(){return this};return tc=function(s,u,a,c){var f=u+" Iterator";return s.prototype=n(t,{next:i(+!c,a)}),r(s,f,!1,!0),e[f]=o,s}}function dc(){if(rc)return ic;rc=1;var t=Sr(),n=B(),i=Tn(),r=hi(),e=Gt(),o=hc(),s=cc(),u=xo(),a=Ro(),c=Xn(),f=pi(),h=Cn(),d=ys(),v=fc(),l=r.PROPER,g=r.CONFIGURABLE,m=v.IteratorPrototype,p=v.BUGGY_SAFARI_ITERATORS,w=h("iterator"),y="keys",b="values",E="entries",_=function(){return this};return ic=function(r,h,v,I,T,S,A){o(v,h,I);var O,N,k,D=function(t){if(t===T&&U)return U;if(!p&&t&&t in R)return R[t];switch(t){case y:case b:case E:return function(){return new v(this,t)}}return function(){return new v(this)}},C=h+" Iterator",x=!1,R=r.prototype,M=R[w]||R["@@iterator"]||T&&R[T],U=!p&&M||D(T),P="Array"===h&&R.entries||M;if(P&&(O=s(P.call(new r)))!==Object.prototype&&O.next&&(i||s(O)===m||(u?u(O,m):e(O[w])||f(O,w,_)),a(O,C,!0,!0),i&&(d[C]=_)),l&&T===b&&M&&M.name!==b&&(!i&&g?c(R,"name",b):(x=!0,U=function(){return n(M,this)})),T)if(N={values:D(b),keys:S?U:D(y),entries:D(E)},A)for(k in N)(p||x||!(k in R))&&f(R,k,N[k]);else t({target:h,proto:!0,forced:p||x},N);return i&&!A||R[w]===U||f(R,w,U,{name:T}),d[h]=U,N},ic}function vc(){return oc?ec:(oc=1,ec=function(t,n){return{value:t,done:n}})}function lc(){if(uc)return sc;uc=1;var t=Ft(),n=ae(),i=ys(),r=gi(),e=qn().f,o=dc(),s=vc(),u=Tn(),a=j(),c="Array Iterator",f=r.set,h=r.getterFor(c);sc=o(Array,"Array",function(n,i){f(this,{type:c,target:t(n),index:0,kind:i})},function(){var t=h(this),n=t.target,i=t.index++;if(!n||i>=n.length)return t.target=null,s(void 0,!0);switch(t.kind){case"keys":return s(i,!1);case"values":return s(n[i],!1)}return s([i,n[i]],!1)},"values");var d=i.Arguments=i.Array;if(n("keys"),n("values"),n("entries"),!u&&a&&"values"!==d.name)try{e(d,"name",{value:"values"})}catch(t){}return sc}!function(){if(qa)return ac;qa=1;var t=Sr(),n=Hr(),i=ji().indexOf,r=ve(),e=n([].indexOf),o=!!e&&1/e([1],1,-0)<0;t({target:"Array",proto:!0,forced:o||!r("indexOf")},{indexOf:function(t){var n=arguments.length>1?arguments[1]:void 0;return o?e(this,t,n)||0:i(this,t,n)}})}(),lc();var gc,mc={};!function(){if(gc)return mc;gc=1;var t=Sr(),n=Kr().map;t({target:"Array",proto:!0,forced:!Ur()("map")},{map:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}})}();var pc,wc,yc,bc={};function Ec(){if(wc)return pc;wc=1;var t=Xt(),n=TypeError;return pc=function(i,r){if(!delete i[r])throw new n("Cannot delete property "+t(r)+" of "+t(i))}}!function(){if(yc)return bc;yc=1;var t=Sr(),n=Nn(),i=Li(),r=Pi(),e=Gi(),o=kr(),s=Or(),u=Mr(),a=Nr(),c=Ec(),f=Ur()("splice"),h=Math.max,d=Math.min;t({target:"Array",proto:!0,forced:!f},{splice:function(t,f){var v,l,g,m,p,w,y=n(this),b=e(y),E=i(t,b),_=arguments.length;for(0===_?v=l=0:1===_?(v=0,l=b-E):(v=_-2,l=d(h(r(f),0),b-E)),s(b+v-l),g=u(y,l),m=0;m<l;m++)(p=E+m)in y&&a(g,m,y[p]);if(o(g,l),v<l){for(m=E;m<b-l;m++)w=m+v,(p=m+l)in y?y[w]=y[p]:c(y,w);for(m=b;m>b-l+v;m--)c(y,m-1)}else if(v>l)for(m=b-l;m>E;m--)w=m+v-1,(p=m+l-1)in y?y[w]=y[p]:c(y,w);for(m=0;m<v;m++)y[m+E]=arguments[m+2];return o(y,b-l+v),g}})}();var _c,Ic,Tc,Sc,Ac,Oc,Nc,kc,Dc,Cc,xc,Rc,Mc,Uc,Pc,Lc,Fc,Gc,jc={exports:{}},Vc={};function Bc(){if(_c)return Vc;_c=1;var t=Mt(),n=Ft(),i=zi().f,r=jo(),e="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];return Vc.f=function(o){return e&&"Window"===t(o)?function(t){try{return i(t)}catch(t){return r(e)}}(o):i(n(o))},Vc}function zc(){if(Ac)return Sc;Ac=1;var t=G(),n=jt(),i=Mt(),r=function(){if(Tc)return Ic;Tc=1;var t=G();return Ic=t(function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})}(),e=Object.isExtensible,o=t(function(){});return Sc=o||r?function(t){return!!n(t)&&((!r||"ArrayBuffer"!==i(t))&&(!e||e(t)))}:e}function Hc(){if(kc)return jc.exports;kc=1;var t=Sr(),n=Rt(),i=li(),r=jt(),e=kn(),o=qn().f,s=zi(),u=Bc(),a=zc(),c=Dn(),f=function(){if(Nc)return Oc;Nc=1;var t=G();return Oc=!t(function(){return Object.isExtensible(Object.preventExtensions({}))})}(),h=!1,d=c("meta"),v=0,l=function(t){o(t,d,{value:{objectID:"O"+v++,weakData:{}}})},g=jc.exports={enable:function(){g.enable=function(){},h=!0;var i=s.f,r=n([].splice),e={};e[d]=1,i(e).length&&(s.f=function(t){for(var n=i(t),e=0,o=n.length;e<o;e++)if(n[e]===d){r(n,e,1);break}return n},t({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:u.f}))},fastKey:function(t,n){if(!r(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!e(t,d)){if(!a(t))return"F";if(!n)return"E";l(t)}return t[d].objectID},getWeakData:function(t,n){if(!e(t,d)){if(!a(t))return!0;if(!n)return!1;l(t)}return t[d].weakData},onFreeze:function(t){return f&&h&&a(t)&&!e(t,d)&&l(t),t}};return i[d]=!0,jc.exports}function Wc(){if(Cc)return Dc;Cc=1;var t=Gt(),n=jt(),i=xo();return Dc=function(r,e,o){var s,u;return i&&t(s=e.constructor)&&s!==o&&n(u=s.prototype)&&u!==o.prototype&&i(r,u),r}}function Kc(){if(Rc)return xc;Rc=1;var t=Sr(),n=k(),i=Rt(),r=Tr(),e=pi(),o=Hc(),s=Ts(),u=Po(),a=Gt(),c=Pt(),f=jt(),h=G(),d=Ss(),v=Ro(),l=Wc();return xc=function(g,m,p){var w=-1!==g.indexOf("Map"),y=-1!==g.indexOf("Weak"),b=w?"set":"add",E=n[g],_=E&&E.prototype,I=E,T={},S=function(t){var n=i(_[t]);e(_,t,"add"===t?function(t){return n(this,0===t?0:t),this}:"delete"===t?function(t){return!(y&&!f(t))&&n(this,0===t?0:t)}:"get"===t?function(t){return y&&!f(t)?void 0:n(this,0===t?0:t)}:"has"===t?function(t){return!(y&&!f(t))&&n(this,0===t?0:t)}:function(t,i){return n(this,0===t?0:t,i),this})};if(r(g,!a(E)||!(y||_.forEach&&!h(function(){(new E).entries().next()}))))I=p.getConstructor(m,g,w,b),o.enable();else if(r(g,!0)){var A=new I,O=A[b](y?{}:-0,1)!==A,N=h(function(){A.has(1)}),k=d(function(t){new E(t)}),D=!y&&h(function(){for(var t=new E,n=5;n--;)t[b](n,n);return!t.has(-0)});k||((I=m(function(t,n){u(t,_);var i=l(new E,t,I);return c(n)||s(n,i[b],{that:i,AS_ENTRIES:w}),i})).prototype=_,_.constructor=I),(N||D)&&(S("delete"),S("has"),w&&S("get")),(D||O)&&S(b),y&&_.clear&&delete _.clear}return T[g]=I,t({global:!0,constructor:!0,forced:I!==E},T),v(I,g),y||p.setStrong(I,g,w),I}}function qc(){if(Uc)return Mc;Uc=1;var t=pi();return Mc=function(n,i,r){for(var e in i)t(n,e,i[e],r);return n}}function Xc(){if(Lc)return Pc;Lc=1;var t=ue(),n=Mo(),i=qc(),r=Wr(),e=Po(),o=Pt(),s=Ts(),u=dc(),a=vc(),c=Uo(),f=j(),h=Hc().fastKey,d=gi(),v=d.set,l=d.getterFor;return Pc={getConstructor:function(u,a,c,d){var g=u(function(n,i){e(n,m),v(n,{type:a,index:t(null),first:null,last:null,size:0}),f||(n.size=0),o(i)||s(i,n[d],{that:n,AS_ENTRIES:c})}),m=g.prototype,p=l(a),w=function(t,n,i){var r,e,o=p(t),s=y(t,n);return s?s.value=i:(o.last=s={index:e=h(n,!0),key:n,value:i,previous:r=o.last,next:null,removed:!1},o.first||(o.first=s),r&&(r.next=s),f?o.size++:t.size++,"F"!==e&&(o.index[e]=s)),t},y=function(t,n){var i,r=p(t),e=h(n);if("F"!==e)return r.index[e];for(i=r.first;i;i=i.next)if(i.key===n)return i};return i(m,{clear:function(){for(var n=p(this),i=n.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=null),i=i.next;n.first=n.last=null,n.index=t(null),f?n.size=0:this.size=0},delete:function(t){var n=this,i=p(n),r=y(n,t);if(r){var e=r.next,o=r.previous;delete i.index[r.index],r.removed=!0,o&&(o.next=e),e&&(e.previous=o),i.first===r&&(i.first=e),i.last===r&&(i.last=o),f?i.size--:n.size--}return!!r},forEach:function(t){for(var n,i=p(this),e=r(t,arguments.length>1?arguments[1]:void 0);n=n?n.next:i.first;)for(e(n.value,n.key,this);n&&n.removed;)n=n.previous},has:function(t){return!!y(this,t)}}),i(m,c?{get:function(t){var n=y(this,t);return n&&n.value},set:function(t,n){return w(this,0===t?0:t,n)}}:{add:function(t){return w(this,t=0===t?0:t,t)}}),f&&n(m,"size",{configurable:!0,get:function(){return p(this).size}}),g},setStrong:function(t,n,i){var r=n+" Iterator",e=l(n),o=l(r);u(t,n,function(t,n){v(this,{type:r,target:t,state:e(t),kind:n,last:null})},function(){for(var t=o(this),n=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?a("keys"===n?i.key:"values"===n?i.value:[i.key,i.value],!1):(t.target=null,a(void 0,!0))},i?"entries":"values",!i,!0),c(n)}},Pc}Gc||(Gc=1,Fc||(Fc=1,Kc()("Map",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Xc())));var $c,Yc,Jc,Qc,Zc,tf,nf,rf={};function ef(){if(Yc)return $c;Yc=1;var t=Rt();return $c=t(1.1.valueOf)}function of(){if(Qc)return Jc;Qc=1;var t=Cr(),n=String;return Jc=function(i){if("Symbol"===t(i))throw new TypeError("Cannot convert a Symbol value to a string");return n(i)}}function sf(){if(tf)return Zc;tf=1;var t=Pi(),n=of(),i=Lt(),r=RangeError,e=Math.floor;return Zc=function(o){var s=n(i(this)),u="",a=t(o);if(a<0||a===1/0)throw new r("Wrong number of repetitions");for(;a>0;(a=e(a/2))&&(s+=s))a%2&&(u+=s);return u}}!function(){if(nf)return rf;nf=1;var t=Sr(),n=Rt(),i=Pi(),r=ef(),e=sf(),o=G(),s=RangeError,u=String,a=Math.floor,c=n(e),f=n("".slice),h=n(1.1.toFixed),d=function(t,n,i){return 0===n?i:n%2==1?d(t,n-1,i*t):d(t*t,n/2,i)},v=function(t,n,i){for(var r=-1,e=i;++r<6;)e+=n*t[r],t[r]=e%1e7,e=a(e/1e7)},l=function(t,n){for(var i=6,r=0;--i>=0;)r+=t[i],t[i]=a(r/n),r=r%n*1e7},g=function(t){for(var n=6,i="";--n>=0;)if(""!==i||0===n||0!==t[n]){var r=u(t[n]);i=""===i?r:i+c("0",7-r.length)+r}return i};t({target:"Number",proto:!0,forced:o(function(){return"0.000"!==h(8e-5,3)||"1"!==h(.9,0)||"1.25"!==h(1.255,2)||"1000000000000000128"!==h(0xde0b6b3a7640080,0)})||!o(function(){h({})})},{toFixed:function(t){var n,e,o,a,h=r(this),m=i(t),p=[0,0,0,0,0,0],w="",y="0";if(m<0||m>20)throw new s("Incorrect fraction digits");if(h!=h)return"NaN";if(h<=-1e21||h>=1e21)return u(h);if(h<0&&(w="-",h=-h),h>1e-21)if(e=(n=function(t){for(var n=0,i=t;i>=4096;)n+=12,i/=4096;for(;i>=2;)n+=1,i/=2;return n}(h*d(2,69,1))-69)<0?h*d(2,-n,1):h/d(2,n,1),e*=4503599627370496,(n=52-n)>0){for(v(p,0,e),o=m;o>=7;)v(p,1e7,0),o-=7;for(v(p,d(10,o,1),0),o=n-1;o>=23;)l(p,1<<23),o-=23;l(p,1<<o),v(p,1,1),l(p,2),y=g(p)}else v(p,0,e),v(p,1<<-n,0),y=g(p)+c("0",m);return y=m>0?w+((a=y.length)<=m?"0."+c("0",m-a)+y:f(y,0,a-m)+"."+f(y,a-m)):w+y}})}();var uf,af;af||(af=1,uf||(uf=1,Kc()("Set",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Xc())));var cf,ff,hf,df,vf,lf,gf,mf={};function pf(){if(ff)return cf;ff=1;var t=jt(),n=Mt(),i=Cn()("match");return cf=function(r){var e;return t(r)&&(void 0!==(e=r[i])?!!e:"RegExp"===n(r))}}function wf(){if(df)return hf;df=1;var t=pf(),n=TypeError;return hf=function(i){if(t(i))throw new n("The method doesn't accept regular expressions");return i}}function yf(){if(lf)return vf;lf=1;var t=Cn()("match");return vf=function(n){var i=/./;try{"/./"[n](i)}catch(r){try{return i[t]=!1,"/./"[n](i)}catch(t){}}return!1}}!function(){if(gf)return mf;gf=1;var t=Sr(),n=Rt(),i=wf(),r=Lt(),e=of(),o=yf(),s=n("".indexOf);t({target:"String",proto:!0,forced:!o("includes")},{includes:function(t){return!!~s(e(r(this)),e(i(t)),arguments.length>1?arguments[1]:void 0)}})}();var bf,Ef,_f,If={};function Tf(){if(Ef)return bf;Ef=1;var t=Rt(),n=Pi(),i=of(),r=Lt(),e=t("".charAt),o=t("".charCodeAt),s=t("".slice),u=function(t){return function(u,a){var c,f,h=i(r(u)),d=n(a),v=h.length;return d<0||d>=v?t?"":void 0:(c=o(h,d))<55296||c>56319||d+1===v||(f=o(h,d+1))<56320||f>57343?t?e(h,d):c:t?s(h,d,d+2):f-56320+(c-55296<<10)+65536}};return bf={codeAt:u(!1),charAt:u(!0)}}function Sf(){if(_f)return If;_f=1;var t=Tf().charAt,n=of(),i=gi(),r=dc(),e=vc(),o="String Iterator",s=i.set,u=i.getterFor(o);return r(String,"String",function(t){s(this,{type:o,string:n(t),index:0})},function(){var n,i=u(this),r=i.string,o=i.index;return o>=r.length?e(void 0,!0):(n=t(r,o),i.index+=n.length,e(n,!1))}),If}Sf();var Af,Of={};!function(){if(Af)return Of;Af=1;var t=k(),n=qs(),i=Xs(),r=lc(),e=Xn(),o=Ro(),s=Cn()("iterator"),u=r.values,a=function(t,i){if(t){if(t[s]!==u)try{e(t,s,u)}catch(n){t[s]=u}if(o(t,i,!0),n[i])for(var a in r)if(t[a]!==r[a])try{e(t,a,r[a])}catch(n){t[a]=r[a]}}};for(var c in n)a(t[c]&&t[c].prototype,c);a(i,"DOMTokenList")}();var Nf,kf="GamificationManager initialized successfully",Df="Failed to initialize GamificationManager",Cf="GamificationManager destroyed successfully",xf="GamificationManager state cleared",Rf="Gamification disabled — gamificationWriteKey not configured",Mf="GamificationManager refresh triggered",Uf="GamificationManager data resync triggered",Pf="GamificationManager data resync failed",Lf="GamificationManager loaded from cache — API call skipped",Ff="GamificationManager cache miss — fetching from API",Gf="GamificationManager reused cached token — token API call skipped",jf="GamificationManager token cache miss — fetching new token",Vf="GamificationManager got an auth error on campaigns/entry points — invalidating cached token and retrying once",Bf="GamificationManager token refetch is in backoff after repeated failures — skipping network call",zf="GAME_PLAYED",Hf="CAMPAIGN_PLAY",Wf="game_open",Kf="game_viewed",qf="game_played",Xf="game_completed",$f="reward_seen",Yf="content_open",Jf="content_viewed",Qf="LOYALTY",Zf="COMPLETED",th="https://api.customerglu.com",nh=function(t){return"https://api-".concat(t,".customerglu.com")},ih=3e5,rh=18e5,eh="__GLU__CACHE__",oh="__GLU__TOKEN__",sh="__GLU__COUNT_DATE_",uh=16,ah={LOGGED_IN:"loggedIn"},ch={EVENT_NAME:"event_name",REWARD_TYPE:"reward_type",CAMPAIGN_ID:"campaign_id",CAMPAIGN_DETAILS:"campaign_details",REWARD_STATUS:"reward_status",REWARD_USER_ID:"reward_user_id"},fh=1e3,hh=16e3,dh=2e3,vh=3e5,lh="glu_cap_token",gh="glu_page_path_tracking_enabled",mh="/preload",ph=5e3,wh="__GLU__ORIGIN__",yh={};!function(){if(Nf)return yh;Nf=1;var t=j(),n=hi().EXISTS,i=Rt(),r=Mo(),e=Function.prototype,o=i(e.toString),s=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,u=i(s.exec);t&&!n&&r(e,"name",{configurable:!0,get:function(){try{return u(s,o(this))[1]}catch(t){return""}}})}();var bh,Eh,_h,Ih,Th,Sh,Ah,Oh,Nh={};function kh(){if(Eh)return bh;Eh=1;var t=G(),n=Cn(),i=j(),r=Tn(),e=n("iterator");return bh=!t(function(){var t=new URL("b?a=1&b=2&c=3","https://a"),n=t.searchParams,o=new URLSearchParams("a=1&a=2&b=3"),s="";return t.pathname="c%20d",n.forEach(function(t,i){n.delete("b"),s+=i+t}),o.delete("a",2),o.delete("b",void 0),r&&(!t.toJSON||!o.has("a",1)||o.has("a",2)||!o.has("a",void 0)||o.has("b"))||!n.size&&(r||!i)||!n.sort||"https://a/c%20d?a=1&c=3"!==t.href||"3"!==n.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!n[e]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==s||"x"!==new URL("https://x",void 0).host})}function Dh(){if(Ih)return _h;Ih=1;var t=Kn(),n=Is();return _h=function(i,r,e,o){try{return o?r(t(e)[0],e[1]):r(e)}catch(t){n(i,"throw",t)}}}function Ch(){if(Sh)return Th;Sh=1;var t=Wr(),n=B(),i=Nn(),r=Dh(),e=bs(),o=xr(),s=Gi(),u=Nr(),a=kr(),c=_s(),f=Es(),h=Is(),d=Or(),v=Array;return Th=function(l){var g=o(this),m=arguments.length,p=m>1?arguments[1]:void 0,w=void 0!==p;w&&(p=t(p,m>2?arguments[2]:void 0));var y,b,E,_,I,T,S=i(l),A=f(S),O=0;if(!A||this===v&&e(A))for(y=s(S),b=g?new this(y):v(y);y>O;O++)T=w?p(S[O],O):S[O],u(b,O,T);else for(b=g?new this:[],I=(_=c(S,A)).next;!(E=n(I,_)).done;O++){try{d(O)}catch(t){h(_,"throw",t)}T=w?r(_,p,[E.value,O],!0):E.value;try{u(b,O,T)}catch(t){h(_,"throw",t)}}return a(b,O),b},Th}function xh(){if(Oh)return Ah;Oh=1;var t=Rt(),n=2147483647,i=/[^\0-\u007E]/,r=/[.\u3002\uFF0E\uFF61]/g,e="Overflow: input needs wider integers to process",o=RangeError,s=t(r.exec),u=Math.floor,a=String.fromCharCode,c=t("".charCodeAt),f=t([].join),h=t([].push),d=t("".replace),v=t("".split),l=t("".toLowerCase),g=function(t){return t+22+75*(t<26)},m=function(t,n,i){var r=0;for(t=i?u(t/700):t>>1,t+=u(t/n);t>455;)t=u(t/35),r+=36;return u(r+36*t/(t+38))},p=function(t){var i=[];t=function(t){for(var n=[],i=0,r=t.length;i<r;){var e=c(t,i++);if(e>=55296&&e<=56319&&i<r){var o=c(t,i++);56320==(64512&o)?h(n,((1023&e)<<10)+(1023&o)+65536):(h(n,e),i--)}else h(n,e)}return n}(t);var r,s,d=t.length,v=128,l=0,p=72;for(r=0;r<t.length;r++)(s=t[r])<128&&h(i,a(s));var w=i.length,y=w;for(w&&h(i,"-");y<d;){var b=n;for(r=0;r<t.length;r++)(s=t[r])>=v&&s<b&&(b=s);var E=y+1;if(b-v>u((n-l)/E))throw new o(e);for(l+=(b-v)*E,v=b,r=0;r<t.length;r++){if((s=t[r])<v&&++l>n)throw new o(e);if(s===v){for(var _=l,I=36;;){var T=I<=p?1:I>=p+26?26:I-p;if(_<T)break;var S=_-T,A=36-T;h(i,a(g(T+S%A))),_=u(S/A),I+=36}h(i,a(g(_))),p=m(l,E,y===w),l=0,y++}}l++,v++}return f(i,"")};return Ah=function(t){var n,e,o=[],u=v(d(l(t),r,"."),".");for(n=0;n<u.length;n++)e=u[n],h(o,s(i,e)?"xn--"+p(e):e);return f(o,".")}}var Rh,Mh,Uh,Ph,Lh,Fh,Gh,jh,Vh,Bh={};function zh(){if(Uh)return Mh;Uh=1,function(){if(Rh)return Bh;Rh=1;var t=Sr(),n=Rt(),i=Li(),r=RangeError,e=String.fromCharCode,o=String.fromCodePoint,s=n([].join);t({target:"String",stat:!0,arity:1,forced:!!o&&1!==o.length},{fromCodePoint:function(t){for(var n,o=[],u=arguments.length,a=0;u>a;){if(i(n=+arguments[a],1114111)!==n)throw new r(n+" is not a valid code point");o[a++]=n<65536?e(n):e(55296+((n-=65536)>>10),n%1024+56320)}return s(o,"")}})}();var t=Vt(),n=Rt(),i=String.fromCharCode,r=t("String","fromCodePoint"),e=encodeURIComponent,o=parseInt,s=n("".charAt),u=n([].push),a=n("".replace),c=n("".slice),f=n(/./.exec),h="�",d=/^[0-9a-f]+$/i,v=/[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDFFF]/g,l=function(t,n){var i=c(t,n,n+2);return f(d,i)?o(i,16):NaN},g=function(t){for(var n=0,i=128;i>0&&0!==(t&i);i>>=1)n++;return n},m=function(t){var n=null,i=t.length;switch(i){case 1:n=t[0];break;case 2:n=(31&t[0])<<6|63&t[1];break;case 3:n=(15&t[0])<<12|(63&t[1])<<6|63&t[2];break;case 4:n=(7&t[0])<<18|(63&t[1])<<12|(63&t[2])<<6|63&t[3]}return null===n||n>1114111||n>=55296&&n<=57343||n<(i>3?65536:i>2?2048:i>1?128:0)?null:n},p=function(t){return 2===t.length?t:h};return Mh={decode:function(t){for(var n=t.length,e="",o=0;o<n;){var a=s(t,o);if("%"===a){if("%"===s(t,o+1)||o+3>n){e+="%",o++;continue}var c=l(t,o+1);if(c!=c){e+=a,o++;continue}o+=2;var f=g(c);if(0===f)a=i(c);else{if(1===f||f>4){e+=h,o++;continue}for(var d=[c],v=1;v<f&&!(++o+3>n||"%"!==s(t,o));){var p=l(t,o+1);if(p!=p||p>191||p<128)break;if(1===v){if(224===c&&p<160)break;if(237===c&&p>159)break;if(240===c&&p<144)break;if(244===c&&p>143)break}u(d,p),o+=2,v++}if(d.length!==f){e+=h;continue}var w=m(d);if(null===w){for(var y=0;y<f;y++)e+=h;o++;continue}a=r(w)}}e+=a,o++}return e},encode:function(t){try{return e(t)}catch(n){return e(a(t,v,p))}}}}function Hh(){if(Lh)return Ph;Lh=1;var t=jo(),n=Math.floor,i=function(r,e){var o=r.length;if(o<8)for(var s,u,a=1;a<o;){for(u=a,s=r[a];u&&e(r[u-1],s)>0;)r[u]=r[--u];u!==a++&&(r[u]=s)}else for(var c=n(o/2),f=i(t(r,0,c),e),h=i(t(r,c),e),d=f.length,v=h.length,l=0,g=0;l<d||g<v;)r[l+g]=l<d&&g<v?e(f[l],h[g])<=0?f[l++]:h[g++]:l<d?f[l++]:h[g++];return r};return Ph=i}function Wh(){if(Gh)return Fh;Gh=1,lc();var t=Sr(),n=k(),i=Ho(),r=B(),e=Rt(),o=j(),s=kh(),u=zh(),a=pi(),c=Mo(),f=qc(),h=Ro(),d=hc(),v=gi(),l=Po(),g=Gt(),m=kn(),p=Wr(),w=Cr(),y=Kn(),b=jt(),E=of(),_=ue(),I=xt(),T=_s(),S=Es(),A=vc(),O=Vo(),N=Cn(),D=Hh(),C=N("iterator"),x="URLSearchParams",R=x+"Iterator",M=v.set,U=v.getterFor(x),P=v.getterFor(R),L=u.decode,F=u.encode,G=i("fetch"),V=i("Request"),z=i("Headers"),H=V&&V.prototype,W=z&&z.prototype,K=n.TypeError,q=e("".charAt),X=e([].join),$=e([].push),Y=e("".replace),J=e([].shift),Q=e([].splice),Z=e("".split),tt=e("".slice),nt=/\+/g,it=function(t){return L(Y(t,nt," "))},rt=/[!'()~]|%20/g,et={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},ot=function(t){return et[t]},st=function(t){return Y(F(t),rt,ot)},ut=d(function(t,n){M(this,{type:R,target:U(t).entries,index:0,kind:n})},x,function(){var t=P(this),n=t.target,i=t.index++;if(!n||i>=n.length)return t.target=null,A(void 0,!0);var r=n[i];switch(t.kind){case"keys":return A(r.key,!1);case"values":return A(r.value,!1)}return A([r.key,r.value],!1)},!0),at=function(t){this.entries=[],this.url=null,void 0!==t&&(b(t)?this.parseObject(t):this.parseQuery("string"==typeof t?"?"===q(t,0)?tt(t,1):t:E(t)))};at.prototype={type:x,bindURL:function(t){this.url=t,this.update()},parseObject:function(t){var n,i,e,o,s,u,a,c=this.entries,f=S(t);if(f)for(i=(n=T(t,f)).next;!(e=r(i,n)).done;){if(s=(o=T(y(e.value))).next,(u=r(s,o)).done||(a=r(s,o)).done||!r(s,o).done)throw new K("Expected sequence with length 2");$(c,{key:E(u.value),value:E(a.value)})}else for(var h in t)m(t,h)&&$(c,{key:h,value:E(t[h])})},parseQuery:function(t){if(t)for(var n,i,r=this.entries,e=Z(t,"&"),o=0;o<e.length;)(n=e[o++]).length&&(i=Z(n,"="),$(r,{key:it(J(i)),value:it(X(i,"="))}))},serialize:function(){for(var t,n=this.entries,i=[],r=0;r<n.length;)t=n[r++],$(i,st(t.key)+"="+st(t.value));return X(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var ct=function(){l(this,ft);var t=M(this,new at(arguments.length>0?arguments[0]:void 0));o||(this.size=t.entries.length)},ft=ct.prototype;if(f(ft,{append:function(t,n){var i=U(this);O(arguments.length,2),$(i.entries,{key:E(t),value:E(n)}),o||this.size++,i.updateURL()},delete:function(t){for(var n=U(this),i=O(arguments.length,1),r=n.entries,e=E(t),s=i<2?void 0:arguments[1],u=void 0===s?s:E(s),a=0;a<r.length;){var c=r[a];c.key!==e||void 0!==u&&c.value!==u?a++:Q(r,a,1)}o||(this.size=r.length),n.updateURL()},get:function(t){var n=U(this).entries;O(arguments.length,1);for(var i=E(t),r=0;r<n.length;r++)if(n[r].key===i)return n[r].value;return null},getAll:function(t){var n=U(this).entries;O(arguments.length,1);for(var i=E(t),r=[],e=0;e<n.length;e++)n[e].key===i&&$(r,n[e].value);return r},has:function(t){for(var n=U(this).entries,i=O(arguments.length,1),r=E(t),e=i<2?void 0:arguments[1],o=void 0===e?e:E(e),s=0;s<n.length;){var u=n[s++];if(u.key===r&&(void 0===o||u.value===o))return!0}return!1},set:function(t,n){var i=U(this);O(arguments.length,2);for(var r,e=i.entries,s=!1,u=E(t),a=E(n),c=0;c<e.length;c++)(r=e[c]).key===u&&(s?Q(e,c--,1):(s=!0,r.value=a));s||$(e,{key:u,value:a}),o||(this.size=e.length),i.updateURL()},sort:function(){var t=U(this);D(t.entries,function(t,n){return t.key>n.key?1:-1}),t.updateURL()},forEach:function(t){for(var n,i=U(this).entries,r=p(t,arguments.length>1?arguments[1]:void 0),e=0;e<i.length;)r((n=i[e++]).value,n.key,this)},keys:function(){return new ut(this,"keys")},values:function(){return new ut(this,"values")},entries:function(){return new ut(this,"entries")}},{enumerable:!0}),a(ft,C,ft.entries,{name:"entries"}),a(ft,"toString",function(){return U(this).serialize()},{enumerable:!0}),o&&c(ft,"size",{get:function(){return U(this).entries.length},configurable:!0,enumerable:!0}),h(ct,x),t({global:!0,constructor:!0,forced:!s},{URLSearchParams:ct}),!s&&g(z)){var ht=e(W.has),dt=e(W.set),vt=function(t){if(b(t)){var n,i=t.body;if(w(i)===x)return n=t.headers?new z(t.headers):new z,ht(n,"content-type")||dt(n,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),_(t,{body:I(0,E(i)),headers:I(0,n)})}return t};if(g(G)&&t({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(t){return G(t,arguments.length>1?vt(arguments[1]):{})}}),g(V)){var lt=function(t){return l(this,H),new V(t,arguments.length>1?vt(arguments[1]):{})};H.constructor=lt,lt.prototype=H,t({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:lt})}}return Fh={URLSearchParams:ct,getState:U}}function Kh(){if(jh)return Nh;jh=1,Sf();var t,n=Sr(),i=j(),r=kh(),e=k(),o=Wr(),s=Rt(),u=pi(),a=Mo(),c=Po(),f=kn(),h=we(),d=Ch(),v=jo(),l=Tf().codeAt,g=xh(),m=zh(),p=of(),w=Ro(),y=Vo(),b=Wh(),E=gi(),_=E.set,I=E.getterFor("URL"),T=b.URLSearchParams,S=b.getState,A=m.decode,O=m.encode,N=e.URL,D=e.TypeError,C=e.parseInt,x=Math.floor,R=Math.pow,M=String.fromCharCode,U=s("".charAt),P=s(/./.exec),L=s([].join),F=s(1.1.toString),G=s([].pop),V=s([].push),B=s("".replace),z=s([].shift),H=s("".split),W=s("".indexOf),K=s("".slice),q=s("".toLowerCase),X=s([].unshift),$="Invalid scheme",Y="Invalid host",J="Invalid port",Q=/[a-z]/i,Z=/[\d+\-.a-z]/i,tt=/\d/,nt=/^0x/i,it=/^[0-7]+$/,rt=/^\d+$/,et=/^[\da-f]+$/i,ot=/[\u0000-\u0020#%/:<>?@[\\\]^|\u007F]/,st=/[\0\t\n\r #/:<>?@[\\\]^|]/,ut=/^[\u0000-\u0020]+/,at=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,ct=/[\t\n\r]/g,ft=/[^\u0000-\u007F]/,ht=function(t){return 173===t||847===t||8203===t||12644===t||65279===t||65440===t||t>=4447&&t<=4448||t>=6068&&t<=6069||t>=6155&&t<=6159||t>=8288&&t<=8292||t>=8298&&t<=8303||t>=65024&&t<=65039||t>=917760&&t<=917999},dt=function(t){return 65533===t||t>=55296&&t<=57343||t>=128&&t<=159||t>=8206&&t<=8207||t>=8232&&t<=8233||t>=8234&&t<=8238||t>=8293&&t<=8297||t>=64976&&t<=65007||!(65534&~t)||t>=57344&&t<=63743||t>=983040&&t<=1114109},vt=function(t){return t>=65281&&t<=65374?t-65248:160===t||5760===t||8239===t||8287===t||12288===t||t>=8192&&t<=8202||t<=65535&&W("¨¯´¸˘˙˚˛˜˝ͺ΄΅᾽᾿῀῁῍῎῏῝῞῟῭΅´῾‗‾⁇⁈⁉℀℁℅℆⩴゛゜ﱞﱟﱠﱡﱢﱣﷺﷻ︓︖﹇﹈﹉﹊﹋﹌﹕﹖﹟﹤﹥﹨﹪﹫ﹰﹲﹴﹶﹸﹺﹼﹾ ̄",M(t))>-1?32:t},lt=function(t){var n,i,r,e;if("number"==typeof t){for(n=[],i=0;i<4;i++)X(n,t%256),t=x(t/256);return L(n,".")}if("object"==typeof t){for(n="",r=function(t){for(var n=null,i=1,r=null,e=0,o=0;o<8;o++)0!==t[o]?(e>i&&(n=r,i=e),r=null,e=0):(null===r&&(r=o),++e);return e>i?r:n}(t),i=0;i<8;i++)e&&0===t[i]||(e&&(e=!1),r===i?(n+=i?":":"::",e=!0):(n+=F(t[i],16),i<7&&(n+=":")));return"["+n+"]"}return t},gt={},mt=h({},gt,{" ":1,'"':1,"#":1,"<":1,">":1}),pt=h({},mt,{"'":1}),wt=h({},gt,{" ":1,'"':1,"<":1,">":1,"`":1}),yt=h({},wt,{"#":1,"?":1,"{":1,"}":1,"^":1}),bt=h({},yt,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Et=function(t,n){var i=l(t,0);return i>=32&&i<127&&!f(n,t)?t:"'"===t&&f(n,t)?"%27":O(t)},_t={ftp:21,file:null,http:80,https:443,ws:80,wss:443},It=function(t,n){var i;return 2===t.length&&P(Q,U(t,0))&&(":"===(i=U(t,1))||!n&&"|"===i)},Tt=function(t){var n;return t.length>1&&It(K(t,0,2))&&(2===t.length||"/"===(n=U(t,2))||"\\"===n||"?"===n||"#"===n)},St=function(t){return"."===t||"%2e"===q(t)},At=function(t){return".."===(t=q(t))||"%2e."===t||".%2e"===t||"%2e%2e"===t},Ot={},Nt={},kt={},Dt={},Ct={},xt={},Mt={},Ut={},Pt={},Lt={},Ft={},Gt={},jt={},Vt={},Bt={},zt={},Ht={},Wt={},Kt={},qt={},Xt={},$t=function(t,n,i){var r,e,o,s=p(t);if(n){if(e=this.parse(s))throw new D(e);this.searchParams=null}else{if(void 0!==i&&(r=new $t(i,!0)),e=this.parse(s,null,r))throw new D(e);(o=S(new T)).bindURL(this),this.searchParams=o}};$t.prototype={type:"URL",parse:function(n,i,r){var e,o,s,u,a=this,c=i||Ot,h=0,l="",g=!1,m=!1,w=!1;for(n=p(n),i||(a.scheme="",a.username="",a.password="",a.host=null,a.port=null,a.path=[],a.query=null,a.fragment=null,a.cannotBeABaseURL=!1,n=B(n,ut,""),n=B(n,at,"$1")),n=B(n,ct,""),e=d(n);h<=e.length;){switch(o=e[h],c){case Ot:if(!o||!P(Q,o)){if(i)return $;c=kt;continue}l+=q(o),c=Nt;break;case Nt:if(o&&P(Z,o))l+=q(o);else{if(":"!==o){if(i)return $;l="",c=kt,h=0;continue}if(i&&(a.isSpecial()!==f(_t,l)||"file"===l&&(a.includesCredentials()||null!==a.port)||"file"===a.scheme&&""===a.host))return;if(a.scheme=l,i)return void(a.isSpecial()&&_t[a.scheme]===a.port&&(a.port=null));l="","file"===a.scheme?c=Vt:a.isSpecial()&&r&&r.scheme===a.scheme?c=Dt:a.isSpecial()?c=Ut:"/"===e[h+1]?(c=Ct,h++):(a.cannotBeABaseURL=!0,V(a.path,""),c=Kt)}break;case kt:if(!r||r.cannotBeABaseURL&&"#"!==o)return $;if(r.cannotBeABaseURL&&"#"===o){a.scheme=r.scheme,a.path=v(r.path),a.query=r.query,a.fragment="",a.cannotBeABaseURL=!0,c=Xt;break}c="file"===r.scheme?Vt:xt;continue;case Dt:if("/"!==o||"/"!==e[h+1]){c=xt;continue}c=Pt,h++;break;case Ct:if("/"===o){c=Lt;break}c=Wt;continue;case xt:if(a.scheme=r.scheme,o===t)a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=v(r.path),a.query=r.query;else if("/"===o||"\\"===o&&a.isSpecial())c=Mt;else if("?"===o)a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=v(r.path),a.query="",c=qt;else{if("#"!==o){a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=v(r.path),a.path.length&&a.path.length--,c=Wt;continue}a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=v(r.path),a.query=r.query,a.fragment="",c=Xt}break;case Mt:if(!a.isSpecial()||"/"!==o&&"\\"!==o){if("/"!==o){a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,c=Wt;continue}c=Lt}else c=Pt;break;case Ut:if(c=Pt,"/"!==o||"/"!==e[h+1])continue;h++;break;case Pt:if("/"!==o&&"\\"!==o){c=Lt;continue}break;case Lt:if("@"===o){g&&(l="%40"+l),g=!0,s=d(l);for(var y=0;y<s.length;y++){var b=s[y];if(":"!==b||w){var E=Et(b,bt);w?a.password+=E:a.username+=E}else w=!0}l=""}else if(o===t||"/"===o||"?"===o||"#"===o||"\\"===o&&a.isSpecial()){if(g&&""===l)return"Invalid authority";h-=d(l).length+1,l="",c=Ft}else l+=o;break;case Ft:case Gt:if(i&&"file"===a.scheme){c=zt;continue}if(":"!==o||m){if(o===t||"/"===o||"?"===o||"#"===o||"\\"===o&&a.isSpecial()){if(a.isSpecial()&&""===l)return Y;if(i&&""===l&&(a.includesCredentials()||null!==a.port))return;if(u=a.parseHost(l))return u;if(l="",c=Ht,i)return;continue}"["===o?m=!0:"]"===o&&(m=!1),l+=o}else{if(""===l)return Y;if(i===Gt)return;if(u=a.parseHost(l))return u;l="",c=jt}break;case jt:if(!P(tt,o)){if(o===t||"/"===o||"?"===o||"#"===o||"\\"===o&&a.isSpecial()||i){if(""!==l){var _=C(l,10);if(_>65535)return J;a.port=a.isSpecial()&&_===_t[a.scheme]?null:_,l=""}if(i)return;c=Ht;continue}return J}l+=o;break;case Vt:if(a.scheme="file",a.host="","/"===o||"\\"===o)c=Bt;else{if(!r||"file"!==r.scheme){c=Wt;continue}switch(o){case t:a.host=r.host,a.path=v(r.path),a.query=r.query;break;case"?":a.host=r.host,a.path=v(r.path),a.query="",c=qt;break;case"#":a.host=r.host,a.path=v(r.path),a.query=r.query,a.fragment="",c=Xt;break;default:a.host=r.host,Tt(L(v(e,h),""))||(a.path=v(r.path),a.shortenPath()),c=Wt;continue}}break;case Bt:if("/"===o||"\\"===o){c=zt;break}r&&"file"===r.scheme&&(a.host=r.host,!Tt(L(v(e,h),""))&&It(r.path[0],!0)&&V(a.path,r.path[0])),c=Wt;continue;case zt:if(o===t||"/"===o||"\\"===o||"?"===o||"#"===o){if(!i&&It(l))c=Wt;else if(""===l){if(a.host="",i)return;c=Ht}else{if(u=a.parseHost(l))return u;if("localhost"===a.host&&(a.host=""),i)return;l="",c=Ht}continue}l+=o;break;case Ht:if(a.isSpecial()){if(c=Wt,"/"!==o&&"\\"!==o)continue}else if(i||"?"!==o)if(i||"#"!==o){if(o!==t&&(c=Wt,"/"!==o))continue}else a.fragment="",c=Xt;else a.query="",c=qt;break;case Wt:if(o===t||"/"===o||"\\"===o&&a.isSpecial()||!i&&("?"===o||"#"===o)){if(At(l)?(a.shortenPath(),"/"===o||"\\"===o&&a.isSpecial()||V(a.path,"")):St(l)?"/"===o||"\\"===o&&a.isSpecial()||V(a.path,""):("file"===a.scheme&&!a.path.length&&It(l)&&(null!==a.host&&""!==a.host&&(a.host=""),l=U(l,0)+":"),V(a.path,l)),l="","file"===a.scheme&&(o===t||"?"===o||"#"===o))for(;a.path.length>1&&""===a.path[0];)z(a.path);"?"===o?(a.query="",c=qt):"#"===o&&(a.fragment="",c=Xt)}else l+=Et(o,yt);break;case Kt:"?"===o?(a.query="",c=qt):"#"===o?(a.fragment="",c=Xt):o!==t&&(a.path[0]+=" "===o?"?"===e[h+1]||"#"===e[h+1]?"%20":" ":Et(o,gt));break;case qt:i||"#"!==o?o!==t&&(a.query+=Et(o,a.isSpecial()?pt:mt)):(a.fragment="",c=Xt);break;case Xt:o!==t&&(a.fragment+=Et(o,wt))}h++}},parseHost:function(t){var n,i,r;if("["===U(t,0)){if("]"!==U(t,t.length-1))return Y;if(n=function(t){var n,i,r,e,o,s,u,a=[0,0,0,0,0,0,0,0],c=0,f=null,h=0,d=function(){return U(t,h)};if(":"===d()){if(":"!==U(t,1))return;h+=2,f=++c}for(;d();){if(8===c)return;if(":"!==d()){for(n=i=0;i<4&&P(et,d());)n=16*n+C(d(),16),h++,i++;if("."===d()){if(0===i)return;if(h-=i,c>6)return;for(r=0;d();){if(e=null,r>0){if(!("."===d()&&r<4))return;h++}if(!P(tt,d()))return;for(;P(tt,d());){if(o=C(d(),10),null===e)e=o;else{if(0===e)return;e=10*e+o}if(e>255)return;h++}a[c]=256*a[c]+e,2!==++r&&4!==r||c++}if(4!==r)return;break}if(":"===d()){if(h++,!d())return}else if(d())return;a[c++]=n}else{if(null!==f)return;h++,f=++c}}if(null!==f)for(s=c-f,c=7;0!==c&&s>0;)u=a[c],a[c--]=a[f+s-1],a[f+--s]=u;else if(8!==c)return;return a}(K(t,1,-1)),!n)return Y;this.host=n}else if(this.isSpecial()){if(t=function(t){if(!P(ft,t))return""===t?null:g(t);var n,i,r,e=d(t),o="";for(n=0;n<e.length;n++){if(i=l(e[n],0),dt(i))return null;ht(i)||(o+=(r=vt(i))===i?e[n]:M(r))}return""===o?null:g(o)}(A(t)),null===t||P(ot,t))return Y;if(function(t){var n,i,r=H(t,".");if(""===r[r.length-1]){if(1===r.length)return!1;r.length--}return n=r[r.length-1],!!P(rt,n)||!!P(nt,n)&&(""===(i=K(n,2))||!!P(et,i))}(t)){if(n=function(t){var n,i,r,e,o,s,u,a=H(t,".");if(a.length&&""===a[a.length-1]&&a.length--,(n=a.length)>4)return null;for(i=[],r=0;r<n;r++){if(""===(e=a[r]))return null;if(o=10,e.length>1&&"0"===U(e,0)&&(o=P(nt,e)?16:8,e=K(e,8===o?1:2)),""===e)s=0;else{if(!P(10===o?rt:8===o?it:et,e))return null;s=C(e,o)}V(i,s)}for(r=0;r<n;r++)if(s=i[r],r===n-1){if(s>=R(256,5-n))return null}else if(s>255)return null;for(u=G(i),r=0;r<i.length;r++)u+=i[r]*R(256,3-r);return u}(t),null===n)return Y;this.host=n}else this.host=t}else{if(P(st,t))return Y;for(n="",i=d(t),r=0;r<i.length;r++)n+=Et(i[r],gt);this.host=n}},cannotHaveUsernamePasswordPort:function(){return null===this.host||""===this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return f(_t,this.scheme)},shortenPath:function(){var t=this.path,n=t.length;!n||"file"===this.scheme&&1===n&&It(t[0],!0)||t.length--},serialize:function(){var t=this,n=t.scheme,i=t.username,r=t.password,e=t.host,o=t.port,s=t.path,u=t.query,a=t.fragment,c=n+":";return null!==e?(c+="//",t.includesCredentials()&&(c+=i+(r?":"+r:"")+"@"),c+=lt(e),null!==o&&(c+=":"+o)):"file"===n&&(c+="//"),null===e&&!t.cannotBeABaseURL&&s.length>1&&""===s[0]&&(c+="/."),c+=t.cannotBeABaseURL?s[0]:s.length?"/"+L(s,"/"):"",null!==u&&(c+="?"+u),null!==a&&(c+="#"+a),c},setHref:function(t){var n=this.parse(t);if(n)throw new D(n);this.searchParams.update()},getOrigin:function(){var t=this.scheme,n=this.port;if("blob"===t)try{return new Yt(this.path[0]).origin}catch(t){return"null"}return"file"!==t&&this.isSpecial()?t+"://"+lt(this.host)+(null!==n?":"+n:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(t){this.parse(p(t)+":",Ot)},getUsername:function(){return this.username},setUsername:function(t){var n=d(p(t));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<n.length;i++)this.username+=Et(n[i],bt)}},getPassword:function(){return this.password},setPassword:function(t){var n=d(p(t));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<n.length;i++)this.password+=Et(n[i],bt)}},getHost:function(){var t=this.host,n=this.port;return null===t?"":null===n?lt(t):lt(t)+":"+n},setHost:function(t){this.cannotBeABaseURL||this.parse(t,Ft)},getHostname:function(){var t=this.host;return null===t?"":lt(t)},setHostname:function(t){this.cannotBeABaseURL||this.parse(t,Gt)},getPort:function(){var t=this.port;return null===t?"":p(t)},setPort:function(t){this.cannotHaveUsernamePasswordPort()||(""===(t=p(t))?this.port=null:this.parse(t,jt))},getPathname:function(){var t=this.path;return this.cannotBeABaseURL?t[0]:t.length?"/"+L(t,"/"):""},setPathname:function(t){this.cannotBeABaseURL||(this.path=[],this.parse(t,Ht))},getSearch:function(){var t=this.query;return t?"?"+t:""},setSearch:function(t){""===(t=p(t))?this.query=null:("?"===U(t,0)&&(t=K(t,1)),this.query="",this.parse(t,qt)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var t=this.fragment;return t?"#"+t:""},setHash:function(t){""!==(t=p(t))?("#"===U(t,0)&&(t=K(t,1)),this.fragment="",this.parse(t,Xt)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Yt=function(t){var n=c(this,Jt),r=y(arguments.length,1)>1?arguments[1]:void 0,e=_(n,new $t(t,!1,r));i||(n.href=e.serialize(),n.origin=e.getOrigin(),n.protocol=e.getProtocol(),n.username=e.getUsername(),n.password=e.getPassword(),n.host=e.getHost(),n.hostname=e.getHostname(),n.port=e.getPort(),n.pathname=e.getPathname(),n.search=e.getSearch(),n.searchParams=e.getSearchParams(),n.hash=e.getHash())},Jt=Yt.prototype,Qt=function(t,n){return{get:function(){return I(this)[t]()},set:n&&function(t){return I(this)[n](t)},configurable:!0,enumerable:!0}};if(i&&(a(Jt,"href",Qt("serialize","setHref")),a(Jt,"origin",Qt("getOrigin")),a(Jt,"protocol",Qt("getProtocol","setProtocol")),a(Jt,"username",Qt("getUsername","setUsername")),a(Jt,"password",Qt("getPassword","setPassword")),a(Jt,"host",Qt("getHost","setHost")),a(Jt,"hostname",Qt("getHostname","setHostname")),a(Jt,"port",Qt("getPort","setPort")),a(Jt,"pathname",Qt("getPathname","setPathname")),a(Jt,"search",Qt("getSearch","setSearch")),a(Jt,"searchParams",Qt("getSearchParams")),a(Jt,"hash",Qt("getHash","setHash"))),u(Jt,"toJSON",function(){return I(this).serialize()},{enumerable:!0}),u(Jt,"toString",function(){return I(this).serialize()},{enumerable:!0}),N){var Zt=N.createObjectURL,tn=N.revokeObjectURL;Zt&&u(Yt,"createObjectURL",o(Zt,N)),tn&&u(Yt,"revokeObjectURL",o(tn,N))}return w(Yt,"URL"),n({global:!0,constructor:!0,forced:!r,sham:!i},{URL:Yt}),Nh}Vh||(Vh=1,Kh());var qh,Xh,$h,Yh={};function Jh(){if(Xh)return qh;Xh=1;var t=k();return qh=function(n,i){var r=t[n],e=r&&r.prototype;return e&&e[i]}}!function(){if($h)return Yh;$h=1;var t=Sr(),n=B(),i=Jh()("URL","toString");t({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return n(i,this)}})}();var Qh;Qh||(Qh=1,Wh());var Zh,td,nd,id,rd,ed,od,sd,ud,ad,cd,fd={};function hd(){if(td)return Zh;td=1;var t=Kn();return Zh=function(){var n=t(this),i="";return n.hasIndices&&(i+="d"),n.global&&(i+="g"),n.ignoreCase&&(i+="i"),n.multiline&&(i+="m"),n.dotAll&&(i+="s"),n.unicode&&(i+="u"),n.unicodeSets&&(i+="v"),n.sticky&&(i+="y"),i}}function dd(){if(id)return nd;id=1;var t=G(),n=k().RegExp,i=t(function(){var t=n("a","y");return t.lastIndex=2,null!==t.exec("abcd")}),r=i||t(function(){return!n("a","y").sticky}),e=i||t(function(){var t=n("^r","gy");return t.lastIndex=2,null!==t.exec("str")});return nd={BROKEN_CARET:e,MISSED_STICKY:r,UNSUPPORTED_Y:i}}function vd(){if(ed)return rd;ed=1;var t=G(),n=k().RegExp;return rd=t(function(){var t=n(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)})}function ld(){if(sd)return od;sd=1;var t=G(),n=k().RegExp;return od=t(function(){var t=n("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})}function gd(){if(ad)return ud;ad=1;var t,n,i=B(),r=Rt(),e=of(),o=hd(),s=dd(),u=On(),a=ue(),c=gi().get,f=vd(),h=ld(),d=u("native-string-replace",String.prototype.replace),v=RegExp.prototype.exec,l=v,g=r("".charAt),m=r("".indexOf),p=r("".replace),w=r("".slice),y=(n=/b*/g,i(v,t=/a/,"a"),i(v,n,"a"),0!==t.lastIndex||0!==n.lastIndex),b=s.BROKEN_CARET,E=void 0!==/()??/.exec("")[1],_=function(t,n){for(var i=t.groups=a(null),r=0;r<n.length;r++){var e=n[r];i[e[0]]=t[e[1]]}};return(y||E||b||f||h)&&(l=function(t){var n,r,s,u=this,a=c(u),f=e(t),h=a.raw;if(h)return h.lastIndex=u.lastIndex,n=i(l,h,f),u.lastIndex=h.lastIndex,n&&a.groups&&_(n,a.groups),n;var I=a.groups,T=b&&u.sticky,S=i(o,u),A=u.source,O=0,N=f;if(T){S=p(S,"y",""),-1===m(S,"g")&&(S+="g"),N=w(f,u.lastIndex);var k=u.lastIndex>0&&g(f,u.lastIndex-1);u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==k&&"\r"!==k&&"\u2028"!==k&&"\u2029"!==k)&&(A="(?: (?:"+A+"))",N=" "+N,O++),r=new RegExp("^(?:"+A+")",S)}E&&(r=new RegExp("^"+A+"$(?!\\s)",S)),y&&(s=u.lastIndex);var D=i(v,T?r:u,N);return T?D?(D.input=f,D[0]=w(D[0],O),D.index=u.lastIndex,u.lastIndex+=D[0].length):u.lastIndex=0:y&&D&&(u.lastIndex=u.global?D.index+D[0].length:s),E&&D&&D.length>1&&i(d,D[0],r,function(){for(var t=1;t<arguments.length-2;t++)void 0===arguments[t]&&(D[t]=void 0)}),D&&I&&_(D,I),D}),ud=l}function md(){if(cd)return fd;cd=1;var t=Sr(),n=gd();return t({target:"RegExp",proto:!0,forced:/./.exec!==n},{exec:n}),fd}md();var pd,wd,yd,bd,Ed,_d,Id,Td,Sd,Ad,Od,Nd,kd,Dd={};function Cd(){if(wd)return pd;wd=1,md();var t=B(),n=pi(),i=gd(),r=G(),e=Cn(),o=Xn(),s=e("species"),u=RegExp.prototype;return pd=function(a,c,f,h){var d=e(a),v=!r(function(){var t={};return t[d]=function(){return 7},7!==""[a](t)}),l=v&&!r(function(){var t=!1,n=/a/;if("split"===a){var i={};i[s]=function(){return n},(n={constructor:i,flags:""})[d]=/./[d]}return n.exec=function(){return t=!0,null},n[d](""),!t});if(!v||!l||f){var g=/./[d],m=c(d,""[a],function(n,r,e,o,s){var a=r.exec;return a===i||a===u.exec?v&&!s?{done:!0,value:t(g,r,e,o)}:{done:!0,value:t(n,e,r,o)}:{done:!1}});n(String.prototype,a,m[0]),n(u,d,m[1])}h&&o(u[d],"sham",!0)},pd}function xd(){if(bd)return yd;bd=1;var t=Tf().charAt;return yd=function(n,i,r){return i+(r&&t(n,i).length||1)}}function Rd(){if(_d)return Ed;_d=1;var t=Rt(),n=Nn(),i=Math.floor,r=t("".charAt),e=t("".replace),o=t("".slice),s=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,u=/\$([$&'`]|\d{1,2})/g;return Ed=function(t,a,c,f,h,d){var v=c+t.length,l=f.length,g=u;return void 0!==h&&(h=n(h),g=s),e(d,g,function(n,e){var s;switch(r(e,0)){case"$":return"$";case"&":return t;case"`":return o(a,0,c);case"'":return o(a,v);case"<":s=h[o(e,1,-1)];break;default:var u=+e;if(0===u)return n;if(u>l){var d=i(u/10);return 0===d?n:d<=l?void 0===f[d-1]?r(e,1):f[d-1]+r(e,1):n}s=f[u-1]}return void 0===s?"":s})}}function Md(){if(Ad)return Sd;Ad=1;var t=B(),n=kn(),i=Bt(),r=function(){if(Td)return Id;Td=1;var t=k(),n=G(),i=t.RegExp,r=!n(function(){var t=!0;try{i(".","d")}catch(n){t=!1}var n={},r="",e=t?"dgimsy":"gimsy",o=function(t,i){Object.defineProperty(n,t,{get:function(){return r+=i,!0}})},s={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var u in t&&(s.hasIndices="d"),s)o(u,s[u]);return Object.getOwnPropertyDescriptor(i.prototype,"flags").get.call(n)!==e||r!==e});return Id={correct:r}}(),e=hd(),o=RegExp.prototype;return Sd=r.correct?function(t){return t.flags}:function(s){return r.correct||!i(o,s)||n(s,"flags")?s.flags:t(e,s)}}function Ud(){if(Nd)return Od;Nd=1;var t=B(),n=Kn(),i=Gt(),r=Mt(),e=gd(),o=TypeError;return Od=function(s,u){var a=s.exec;if(i(a)){var c=t(a,s,u);return null!==c&&n(c),c}if("RegExp"===r(s))return t(e,s,u);throw new o("RegExp#exec called on incompatible receiver")}}!function(){if(kd)return Dd;kd=1;var t=Go(),n=B(),i=Rt(),r=Cd(),e=G(),o=Kn(),s=Gt(),u=jt(),a=Pi(),c=Fi(),f=of(),h=Lt(),d=xd(),v=Yt(),l=Rd(),g=Md(),m=Ud(),p=Cn()("replace"),w=Math.max,y=Math.min,b=i([].concat),E=i([].push),_=i("".indexOf),I=i("".slice),T=function(t){return void 0===t?t:String(t)},S="$0"==="a".replace(/./,"$0"),A=!!/./[p]&&""===/./[p]("a","$0");r("replace",function(i,r,e){var S=A?"$":"$0";return[function(t,i){var e=h(this),o=u(t)?v(t,p):void 0;return o?n(o,t,e,i):n(r,f(e),t,i)},function(n,i){var u=o(this),h=f(n),v=s(i);v||(i=f(i));var p=f(g(u));if("string"==typeof i&&!~_(i,S)&&!~_(i,"$<")&&!~_(p,"y")){var A=e(r,u,h,i);if(A.done)return A.value}var O,N=!!~_(p,"g");N&&(O=!!~_(p,"u")||!!~_(p,"v"),u.lastIndex=0);for(var k,D=[];null!==(k=m(u,h))&&(E(D,k),N);){""===f(k[0])&&(u.lastIndex=d(h,c(u.lastIndex),O))}for(var C="",x=0,R=0;R<D.length;R++){for(var M,U=f((k=D[R])[0]),P=w(y(a(k.index),h.length),0),L=[],F=1;F<k.length;F++)E(L,T(k[F]));var G=k.groups;if(v){var j=b([U],L,P,h);void 0!==G&&E(j,G),M=f(t(i,void 0,j))}else M=l(U,h,P,L,G,i);P>=x&&(C+=I(h,x,P)+M,x=P+U.length)}return C+I(h,x)}]},!!e(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})||!S||A)}();var Pd,Ld={};!function(){if(Pd)return Ld;Pd=1;var t,n=Sr(),i=Hr(),r=Pn().f,e=Fi(),o=of(),s=wf(),u=Lt(),a=yf(),c=Tn(),f=i("".slice),h=Math.min,d=a("startsWith");n({target:"String",proto:!0,forced:!!(c||d||(t=r(String.prototype,"startsWith"),!t||t.writable))&&!d},{startsWith:function(t){var n=o(u(this));s(t);var i=o(t),r=e(h(arguments.length>1?arguments[1]:void 0,n.length));return f(n,r,r+i.length)===i}})}();var Fd,Gd,jd,Vd=function(){function t(t){this.baseUrl=t.baseUrl.replace(/\/$/,"")}return t.prototype.request=function(t){return Qs(this,arguments,void 0,function(t,n){var i,r,e,o,s,u,a,c,f,h,d;return void 0===n&&(n={}),Zs(this,function(v){switch(v.label){case 0:i=n.method,r=void 0===i?"GET":i,e=n.headers,o=void 0===e?{}:e,s=n.body,u=!t||t.startsWith("/")?t:"/".concat(t),a="".concat(this.baseUrl).concat(u),v.label=1;case 1:return v.trys.push([1,6,,7]),c={method:r,headers:Js({"Content-Type":"application/json"},o),body:s?JSON.stringify(s):null},[4,fetch(a,c)];case 2:return(f=v.sent()).ok?[3,4]:[4,f.text()];case 3:throw h=v.sent(),new Error("HTTP ".concat(f.status,": ").concat(f.statusText," - ").concat(h));case 4:return[4,f.json()];case 5:return[2,v.sent()];case 6:throw d=v.sent(),this.handleError(d);case 7:return[2]}})})},t.prototype.handleError=function(t){return t instanceof Error?"AbortError"===t.name?{code:yu,message:"Request timeout",details:t}:t.message.includes("HTTP 401")||t.message.includes("HTTP 403")?{code:wu,message:"Authentication failed",details:t}:(t.message.includes("HTTP"),{code:yu,message:t.message,details:t}):{code:yu,message:"Unknown error: ".concat(String(t)),details:t}},t.prototype.get=function(t){return Qs(this,arguments,void 0,function(t,n){return void 0===n&&(n={}),Zs(this,function(i){return[2,this.request(t,Js(Js({},n),{method:"GET"}))]})})},t.prototype.post=function(t,n){return Qs(this,arguments,void 0,function(t,n,i){return void 0===i&&(i={}),Zs(this,function(r){return[2,this.request(t,Js(Js({},i),{method:"POST",body:n}))]})})},t.prototype.put=function(t,n){return Qs(this,arguments,void 0,function(t,n,i){return void 0===i&&(i={}),Zs(this,function(r){return[2,this.request(t,Js(Js({},i),{method:"PUT",body:n}))]})})},t.prototype.delete=function(t){return Qs(this,arguments,void 0,function(t,n){return void 0===n&&(n={}),Zs(this,function(i){return[2,this.request(t,Js(Js({},n),{method:"DELETE"}))]})})},t}(),Bd="/user/v1/user/sdk",zd="/reward/v1.1/user",Hd="/entrypoints/v1/list",Wd=function(){function t(t,n){this.http=new Vd({baseUrl:t}),this.logger=n}return t.prototype.getToken=function(t,n,i,r,e){return Qs(this,void 0,void 0,function(){var o,s=this;return Zs(this,function(u){return o=Js(Js(Js(Js(Js(Js({writeKey:t,userId:n,userState:i,appType:"WEB",sdkVersion:za},r&&{anonymousId:r}),(null==e?void 0:e.name)&&{name:e.name}),(null==e?void 0:e.email)&&{email:e.email}),(null==e?void 0:e.mobile)&&{mobile:e.mobile}),(null==e?void 0:e.country)&&{country:e.country}),(null==e?void 0:e.customAttributes)&&{customAttributes:e.customAttributes}),[2,this.withRetry(function(){return Qs(s,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return[4,this.http.post("".concat(Bd,"?token=true"),o)];case 1:return[2,t.sent().data.token]}})})},"getToken")]})})},t.prototype.getCampaigns=function(t){return Qs(this,void 0,void 0,function(){var n=this;return Zs(this,function(i){return[2,this.withRetry(function(){return Qs(n,void 0,void 0,function(){var n;return Zs(this,function(i){switch(i.label){case 0:return[4,this.http.get(zd,{headers:{Authorization:"Bearer ".concat(t)}})];case 1:return n=i.sent(),[2,this.normalizeCampaigns(n)]}})})},"getCampaigns")]})})},t.prototype.getEntryPoints=function(t){return Qs(this,void 0,void 0,function(){var n=this;return Zs(this,function(i){return[2,this.withRetry(function(){return Qs(n,void 0,void 0,function(){return Zs(this,function(n){switch(n.label){case 0:return[4,this.http.get("".concat(Hd,"?consumer=WEB"),{headers:{Authorization:"Bearer ".concat(t)}})];case 1:return[2,n.sent().data]}})})},"getEntryPoints")]})})},t.prototype.normalizeCampaigns=function(t){var n,i,r,e=[],o={};try{for(var s=tu(t.campaigns),u=s.next();!u.done;u=s.next()){var a=u.value;e.push(a.campaignId),o[a.campaignId]=a}}catch(t){n={error:t}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return{allIds:e,byId:o,defaultUrl:t.defaultUrl,base:this.extractBase(t.defaultUrl),loyaltyUrls:null!==(r=t.loyaltyUrls)&&void 0!==r?r:[]}},t.prototype.extractBase=function(t){try{var n=new URL(t);return"".concat(n.protocol,"//").concat(n.host)}catch(t){return""}},t.prototype.isAuthError=function(t){return"object"===Ha(t)&&null!==t&&t.code===wu},t.prototype.withRetry=function(t,n){return Qs(this,void 0,void 0,function(){var i,r,e,o,s;return Zs(this,function(u){switch(u.label){case 0:r=function(r){var o,s,u;return Zs(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,5]),o={},[4,t()];case 1:return[2,(o.value=a.sent(),o)];case 2:if(s=a.sent(),i=s,e.logger.warn("".concat(Pf," — ").concat(n," attempt ").concat(r,"/").concat(5),s),e.isAuthError(s))throw s;return r<5?(u=Math.min(fh*Math.pow(2,r-1),hh),[4,new Promise(function(t){return setTimeout(t,u)})]):[3,4];case 3:a.sent(),a.label=4;case 4:return[3,5];case 5:return[2]}})},e=this,o=1,u.label=1;case 1:return o<=5?[5,r(o)]:[3,4];case 2:if("object"===Ha(s=u.sent()))return[2,s.value];u.label=3;case 3:return o++,[3,1];case 4:throw i}})})},t}(),Kd={};function qd(){if(Gd)return Fd;Gd=1;var t=j(),n=G(),i=Rt(),r=cc(),e=oe(),o=Ft(),s=i(Ct().f),u=i([].push),a=t&&n(function(){var t=Object.create(null);return t[2]=2,!s(t,2)}),c=function(n){return function(i){for(var c,f=o(i),h=e(f),d=a&&null===r(f),v=h.length,l=0,g=[];v>l;)c=h[l++],t&&!(d?c in f:s(f,c))||u(g,n?[c,f[c]]:f[c]);return g}};return Fd={entries:c(!0),values:c(!1)}}!function(){if(jd)return Kd;jd=1;var t=Sr(),n=qd().entries;t({target:"Object",stat:!0},{entries:function(t){return n(t)}})}();var Xd={EMBEDDED:"EMBED",POP_UP:"POP_UP",BOTTOM_SHEET:"BOTTOM_SHEET",ICON_BUTTON:"FLOATING",CHAT_BOX:"CHAT_BOX",NATIVE_BANNER:"BANNER"};function $d(t){var n,i=(n=t.container.typeId,Xd[n]);return"EMBED"===i&&"STATIC"===t.content.typeId?"BANNER":i}function Yd(t){return"NATIVE_BANNER"===t.container.typeId||"EMBEDDED"===t.container.typeId?"content":"CAMPAIGN"===t.content.typeId?"game":null}function Jd(t){return t.toFixed(2)}function Qd(t){var n=null==t?void 0:t.campaignId;if("string"==typeof n)return n;if(Array.isArray(n)){var i=n[0];if("string"==typeof i)return i}return null}function Zd(t){var n,i,r=t.content;if("CAMPAIGN"===r.typeId)return null!==(n=r.campaignId)&&void 0!==n?n:Qd(r.conditions);if("NUDGE"===r.typeId||"PROGRAM"===r.typeId)return null!==(i=r.campaignId)&&void 0!==i?i:null;if("STATIC"===r.typeId&&r.action){var e=r.action;if("TOGGLE_CONTAINER_CONTENT"===e.type||"OPEN_CONTAINER_CONTENT"===e.type)return Qd(e.content.conditions)}return null}var tv={LAUNCHER_ICON:"ICON_BUTTON",BOTTOM_SHEET:"BOTTOM_SHEET",POP_UP:"POP_UP",EMBEDDED:"EMBEDDED",CHAT_BOX:"CHAT_BOX",NATIVE_BANNER:"NATIVE_BANNER"};function nv(t){var n,i;if("string"==typeof t.p&&t.p.length>0)return t.p;try{for(var r=tu(Object.entries(t)),e=r.next();!e.done;e=r.next()){var o=nu(e.value,2),s=o[0],u=o[1];if("_id"===s&&"string"==typeof u&&u.length>0)return u}}catch(t){n={error:t}}finally{try{e&&!e.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}}function iv(t,n){var i;return Js(Js(Js(Js(Js(Js(Js(Js(Js({typeId:null!==(i=null==t?void 0:t.typeId)&&void 0!==i?i:""},void 0!==n&&{campaignId:n}),void 0!==(null==t?void 0:t.src)&&{src:t.src}),void 0!==(null==t?void 0:t.state)&&{state:t.state}),void 0!==(null==t?void 0:t.action)&&{action:t.action}),void 0!==(null==t?void 0:t.conditions)&&{conditions:t.conditions}),void 0!==(null==t?void 0:t.IWidgetState)&&{IWidgetState:t.IWidgetState}),void 0!==(null==t?void 0:t.widgetCss)&&{widgetCss:t.widgetCss}),void 0!==(null==t?void 0:t.progressBarIcon)&&{progressBarIcon:t.progressBarIcon}),void 0!==(null==t?void 0:t.progressMeterIcon)&&{progressMeterIcon:t.progressMeterIcon})}function rv(t){var n,i,r,e,o=t.web,s=o.container,u=o.content,a=o.conditions,c=u[0],f=null==a?void 0:a.backgroundOpacity,h=null!=f?s.css.replace("{{backgroundOpacity}}",String(f)):s.css,d=null!==(i=null!==(n=null==c?void 0:c.campaignId)&&void 0!==n?n:Qd(null==c?void 0:c.conditions))&&void 0!==i?i:void 0;return Js(Js(Js({id:null!==(r=nv(t))&&void 0!==r?r:""},void 0!==t.name&&{name:t.name}),{container:{typeId:null!==(e=tv[s.typeId])&&void 0!==e?e:s.typeId,css:h,height:s.height,elementHookId:s.elementId},content:iv(c,d)}),void 0!==a&&{conditions:a})}function ev(t){var n,i,r=[],e={};try{for(var o=tu(t),s=o.next();!s.done;s=o.next()){var u=rv(s.value);r.push(u.id),e[u.id]=u}}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return{allIds:r,byId:e}}var ov,sv,uv,av={};function cv(){if(sv)return ov;sv=1;var t=Go(),n=Ft(),i=Pi(),r=Gi(),e=ve(),o=Math.min,s=[].lastIndexOf,u=!!s&&1/[1].lastIndexOf(1,-0)<0,a=e("lastIndexOf");return ov=u||!a?function(e){if(u)return t(s,this,arguments)||0;var a=n(this),c=r(a);if(0===c)return-1;var f=c-1;for(arguments.length>1&&(f=o(f,i(arguments[1]))),f<0&&(f=c+f);f>=0;f--)if(f in a&&a[f]===e)return f||0;return-1}:s,ov}!function(){if(uv)return av;uv=1;var t=Sr(),n=cv();t({target:"Array",proto:!0,forced:n!==[].lastIndexOf},{lastIndexOf:n})}();var fv,hv={};!function(){if(fv)return hv;fv=1;var t=Sr(),n=Ar(),i=xr(),r=jt(),e=Li(),o=Gi(),s=Ft(),u=Nr(),a=kr(),c=Cn(),f=Ur(),h=jo(),d=f("slice"),v=c("species"),l=Array,g=Math.max;t({target:"Array",proto:!0,forced:!d},{slice:function(t,c){var f,d,m,p=s(this),w=o(p),y=e(t,w),b=e(void 0===c?w:c,w);if(n(p)&&(f=p.constructor,(i(f)&&(f===l||n(f.prototype))||r(f)&&null===(f=f[v]))&&(f=void 0),f===l||void 0===f))return h(p,y,b);for(d=new(void 0===f?l:f)(g(b-y,0)),m=0;y<b;y++,m++)y in p&&u(d,m,p[y]);return a(d,m),d}})}();var dv,vv,lv,gv={};function mv(){if(vv)return dv;vv=1;var t=qn().f;return dv=function(n,i,r){r in n||t(n,r,{configurable:!0,get:function(){return i[r]},set:function(t){i[r]=t}})}}!function(){if(lv)return gv;lv=1;var t=j(),n=k(),i=Rt(),r=Tr(),e=Wc(),o=Xn(),s=ue(),u=zi().f,a=Bt(),c=pf(),f=of(),h=Md(),d=dd(),v=mv(),l=pi(),g=G(),m=kn(),p=gi().enforce,w=Uo(),y=Cn(),b=vd(),E=ld(),_=y("match"),I=n.RegExp,T=I.prototype,S=n.SyntaxError,A=i(T.exec),O=i("".charAt),N=i("".replace),D=i("".indexOf),C=i("".slice),x=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,R=/a/g,M=/a/g,U=new I(R)!==R,P=d.MISSED_STICKY,L=d.UNSUPPORTED_Y,F=t&&(!U||P||b||E||g(function(){return M[_]=!1,I(R)!==R||I(M)===M||"/a/i"!==String(I(R,"i"))}));if(r("RegExp",F)){for(var V=function(t,n){var i,r,u,d,v,l,g=a(T,this),w=c(t),y=void 0===n,_=[],k=t;if(!g&&w&&y&&t.constructor===V)return t;if((w||a(T,t))&&(t=t.source,y&&(n=h(k))),t=void 0===t?"":f(t),n=void 0===n?"":f(n),k=t,b&&"dotAll"in R&&(r=!!n&&D(n,"s")>-1)&&(n=N(n,/s/g,"")),i=n,P&&"sticky"in R&&(u=!!n&&D(n,"y")>-1)&&L&&(n=N(n,/y/g,"")),E&&(d=function(t){for(var n,i=t.length,r=0,e="",o=[],u=s(null),a=!1,c=!1,f=0,h="";r<i;r++){if("\\"===(n=O(t,r))){if(n+=O(t,++r),!c&&"\\"===O(n,1)){e+="\\x5c";continue}}else if("]"===n)a=!1;else if(!a)switch(!0){case"["===n:a=!0;break;case"("===n:e+=n,A(x,C(t,r+1))?(r+=2,c=!0,f++):"?"!==O(t,r+1)&&f++;continue;case">"===n&&c:if(""===h||m(u,h))throw new S("Invalid capture group name");u[h]=!0,o[o.length]=[h,f],c=!1,h="";continue}c?h+=n:e+=n}for(var d=0;d<o.length;d++)for(var v="\\k<"+o[d][0]+">",l="\\"+o[d][1];D(e,v)>-1;)e=N(e,v,l);return[e,o]}(t),t=d[0],_=d[1]),v=e(I(t,n),g?this:T,V),(r||u||_.length)&&(l=p(v),r&&(l.dotAll=!0,l.raw=V(function(t){for(var n,i=t.length,r=0,e="",o=!1;r<i;r++)"\\"!==(n=O(t,r))?o||"."!==n?("["===n?o=!0:"]"===n&&(o=!1),e+=n):e+="[\\s\\S]":e+=n+O(t,++r);return e}(t),i)),u&&(l.sticky=!0),_.length&&(l.groups=_)),t!==k)try{o(v,"source",""===k?"(?:)":k)}catch(t){}return v},B=u(I),z=0;B.length>z;)v(V,I,B[z++]);T.constructor=V,V.prototype=T,l(n,"RegExp",V,{constructor:!0})}w("RegExp")}();var pv,wv={};!function(){if(pv)return wv;pv=1;var t=hi().PROPER,n=pi(),i=Kn(),r=of(),e=G(),o=Md(),s="toString",u=RegExp.prototype,a=u[s],c=e(function(){return"/a/b"!==a.call({source:"a",flags:"b"})}),f=t&&a.name!==s;(c||f)&&n(u,s,function(){var t=i(this);return"/"+r(t.source)+"/"+r(o(t))},{unsafe:!0})}();var yv,bv={};!function(){if(yv)return bv;yv=1;var t,n=Sr(),i=Hr(),r=Pn().f,e=Fi(),o=of(),s=wf(),u=Lt(),a=yf(),c=Tn(),f=i("".slice),h=Math.min,d=a("endsWith");n({target:"String",proto:!0,forced:!!(c||d||(t=r(String.prototype,"endsWith"),!t||t.writable))&&!d},{endsWith:function(t){var n=o(u(this));s(t);var i=o(t),r=arguments.length>1?arguments[1]:void 0,a=n.length,c=void 0===r?a:h(e(r),a);return f(n,c-i.length,c)===i}})}();var Ev,_v,Iv,Tv,Sv,Av,Ov,Nv={};function kv(){return _v?Ev:(_v=1,Ev="\t\n\v\f\r                 \u2028\u2029\ufeff")}function Dv(){if(Tv)return Iv;Tv=1;var t=Rt(),n=Lt(),i=of(),r=kv(),e=t("".replace),o=RegExp("^["+r+"]+"),s=RegExp("(^|[^"+r+"])["+r+"]+$"),u=function(t){return function(r){var u=i(n(r));return 1&t&&(u=e(u,o,"")),2&t&&(u=e(u,s,"$1")),u}};return Iv={start:u(1),end:u(2),trim:u(3)}}!function(){if(Ov)return Nv;Ov=1;var t=Sr(),n=Dv().trim,i=function(){if(Av)return Sv;Av=1;var t=hi().PROPER,n=G(),i=kv();return Sv=function(r){return n(function(){return!!i[r]()||"​…᠎"!=="​…᠎"[r]()||t&&i[r].name!==r})}}();t({target:"String",proto:!0,forced:i("trim")},{trim:function(){return n(this)}})}();var Cv="/*";function xv(t){return t.startsWith("#/")||t.startsWith("#!/")}function Rv(t){try{return decodeURIComponent(t)}catch(n){return t}}function Mv(t){return t.replace(/^\/+|\/+$/g,"").split("/").filter(Boolean).map(Rv)}function Uv(t){try{return new URL(t)}catch(t){return null}}function Pv(t,n){if(n.length>t.length)return-1;t:for(var i=0;i<=t.length-n.length;i++){for(var r=0;r<n.length;r++)if(t[i+r]!==n[r])continue t;return i}return-1}function Lv(t,n){var i=n.endsWith(Cv),r=i?n.slice(0,-2):n;if(""===r)return!1;if("/"===r)return!i&&0===t.length;var e=Mv(r),o=Pv(t,e);return-1!==o&&(!i||o+e.length<t.length)}function Fv(t,n){var i=function(t){var n=t.trim();if("*"===n||n===Cv)return"*";if(""===n)return"";var i=n.replace(/^\/+|\/+$/g,"");return""===i?"/":i}(n);if("*"===i)return!0;var r=t.indexOf("#"),e=-1===r?t:t.slice(0,r),o=-1===r?"":t.slice(r),s=e.replace(/\?.*$/,""),u=function(t){if(!t.startsWith("/"))return null;var n=t.lastIndexOf("/");if(n<=1)return null;var i=t.slice(1,n),r=t.slice(n+1);if(!/[*+?^${}()|[\]\\]/.test(i))return null;try{return new RegExp(i,r)}catch(t){return null}}(n.trim());if(u){var a=xv(o)?s+o:s;return u.test(a)}var c=function(t,n){if(!/^https?:\/\//i.test(t))return null;var i=Uv(n);if(!i)return!1;var r=t.endsWith(Cv),e=Uv(r?t.slice(0,-2):t);if(!e)return!1;if(i.origin!==e.origin)return!1;if(!r)return i.pathname.replace(/\/+$/,"")===e.pathname.replace(/\/+$/,"");var o=Mv(i.pathname),s=Mv(e.pathname),u=Pv(o,s);return 0===u&&u+s.length<o.length}(i,s);if(null!==c)return c;var f=Uv(t);return!!Lv(Mv(f?f.pathname:s),i)||!!xv(o)&&Lv(Mv(o.replace(/^#!?\//,"").replace(/\?.*$/,"")),i)}function Gv(t,n){var i,r;try{for(var e=tu(n),o=e.next();!o.done;o=e.next()){if(Fv(t,o.value))return!0}}catch(t){i={error:t}}finally{try{o&&!o.done&&(r=e.return)&&r.call(e)}finally{if(i)throw i.error}}return!1}function jv(t,n){return"".concat(sh).concat(null!=n?n:"anonymous","_").concat(t)}function Vv(t,n,i,r){return Qs(this,void 0,void 0,function(){var e,o,s;return Zs(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),[4,i.get(jv(t,n))];case 1:return(e=u.sent())?(o=JSON.parse(e),[2,(a=o,"object"===Ha(a)&&null!==a&&"number"==typeof a.count&&"string"==typeof a.date?o:null)]):[2,null];case 2:return s=u.sent(),r.warn("Failed to read entry point count state",{entryPointId:t,error:s}),[2,null];case 3:return[2]}var a})})}function Bv(t,n){var i=t.entryPointId,r=t.userId,e=t.saveDelayMs,o=t.storageManager,s=t.logger,u=t.pendingTimers,a=setTimeout(function(){null==u||u.delete(a),o.set(jv(i,r),JSON.stringify(n)).catch(function(t){s.warn("Failed to persist entry point count state",{entryPointId:i,error:t})})},e);null==u||u.add(a)}function zv(t){var n=t.count,i=t.countState,r=t.now;return i&&r.getDate()===new Date(i.date).getDate()?!(i.count>=n)&&(Bv(t,{count:i.count+1,date:r.toISOString()}),!0):(Bv(t,{count:1,date:r.toISOString()}),!0)}function Hv(t){var n=t.count,i=t.countState,r=t.now;return!(i&&i.count>=n)&&(Bv(t,{count:i?i.count+1:1,date:r.toISOString()}),!0)}function Wv(t,n,i,r,e,o){return Qs(this,void 0,void 0,function(){var s,u,a,c,f,h,d,v,l,g,m,p,w,y;return Zs(this,function(b){switch(b.label){case 0:return null===(s=t.conditions)?[2,!1]:s?(u=s.paths,a=s.showCount,c=s.timeWindow,f=s.isLoggedIn,h=s.backendValidations,d=s.delay,v=new Date,l=null!=o?o:"undefined"!=typeof window?window.location.href:"",f&&!n?[2,!1]:function(t,n){if(!t)return!0;var i=n.valueOf();return i>=new Date(t.start).valueOf()&&i<=new Date(t.end).valueOf()}(c,v)&&function(t,n){var i,r;if(!t)return!0;var e=null!==(i=t.excludePaths)&&void 0!==i?i:[],o=null!==(r=t.includePaths)&&void 0!==r?r:[];return!(e.length&&Gv(n,e)||o.length&&!Gv(n,o))}(u,l)?"INVALID"===h?[2,!1]:a?(g=a.count,m=a.dailyRefresh,p=d?1e3*d:0,[4,Vv(t.id,n,i,r)]):[2,!0]:[2,!1]):[2,!0];case 1:return w=b.sent(),y=Js({entryPointId:t.id,userId:n,count:g,countState:w,now:v,saveDelayMs:p,storageManager:i,logger:r},void 0!==e&&{pendingTimers:e}),[2,m?zv(y):Hv(y)]}})})}var Kv,qv={};!function(){if(Kv)return qv;Kv=1;var t=Sr(),n=qd().values;t({target:"Object",stat:!0},{values:function(t){return n(t)}})}();var Xv={iframe:{className:"__GLU__IFRAME",css:".__GLU__IFRAME{ height: 100%; width: 100%; border: none !important; outline: none; }"},hideScroll:{className:"__GLU_HIDE_SCROLL",css:".__GLU_HIDE_SCROLL::-moz-focus-inner {border: 0;} .__GLU_HIDE_SCROLL::-webkit-scrollbar {width: 0px !important;background: transparent !important;display: none !important;} .__GLU_HIDE_SCROLL {scrollbar-width: none !important;-ms-overflow-style: -ms-autohiding-scrollbar !important;}"},slideUp:{className:"__GLU__SLIDE_UP",css:".__GLU__SLIDE_UP { animation: GLU_SLIDE_UP 300ms ease-out; } @keyframes GLU_SLIDE_UP { from { opacity: 0; transform: translateY(100px); }to { opacity: 1; transform: translateY(0px); }}"},slideDown:{className:"__GLU__SLIDE_DOWN",css:".__GLU__SLIDE_DOWN { animation: GLU_SLIDE_DOWN 300ms ease-out; } @keyframes GLU_SLIDE_DOWN { from { opacity: 1; transform: translateY(0px); }to { opacity: 0; transform: translateY(100px); }}"},slideUpSheet:{className:"__GLU__SLIDE_UP_SHEET",css:".__GLU__SLIDE_UP_SHEET { animation: GLU_SLIDE_UP_SHEET 300ms ease-out; } @keyframes GLU_SLIDE_UP_SHEET { from { transform: translateY(100%); } to { transform: translateY(0px); }}"},slideDownSheet:{className:"__GLU__SLIDE_DOWN_SHEET",css:".__GLU__SLIDE_DOWN_SHEET { animation: GLU_SLIDE_DOWN_SHEET 300ms ease-out forwards; } @keyframes GLU_SLIDE_DOWN_SHEET { from { transform: translateY(0px); } to { transform: translateY(100%); }}"},iconButton:{className:"__GLU__ICON_BUTTON",css:".__GLU__ICON_BUTTON { position: fixed; bottom: 40px; left: 40px; height: 160px; width: 160px; overflow: hidden; z-index: 999;}"},chatBox:{className:"__GLU__CHAT_BOX",css:".__GLU__CHAT_BOX { position: fixed; bottom: 220px; left: 40px; height: 580px; width: 360px; background-color: #fff; border-radius: 24px; overflow-x: hidden; z-index: 9999; }"},popUp:{className:"__GLU__POP_UP",css:".__GLU__POP_UP { max-height: 740px; max-width: 1000px; width: 100%; height:90%; background-color: #fff; border-radius: 12px; z-index: 999999; overflow: hidden;}"},popUpStatic:{className:"__GLU__POP_UP_STATIC",css:".__GLU__POP_UP_STATIC { max-height: 100%; max-width: 100%; background-color: #fff; border-radius: 12px; z-index: 999999; overflow: hidden;}"},backDrop:{className:"__GLU__BACK_DROP",css:".__GLU__BACK_DROP { position: fixed; bottom: 0px; left: 0px; height: 100%; width: 100vw; background-color: rgba(0,0,0,0.2); display: flex; justify-content: center; align-items: center; z-index: 99999;}"},bottomSheet:{className:"__GLU__BOTTOM_SHEET",css:".__GLU__BOTTOM_SHEET { height: 880px; width: 600px; max-width: 100%; max-height: 100%; background-color: #fff; border-radius: 20px 20px 0px 0px; overflow-x: hidden; z-index: 999999; align-self: flex-end}"},bottomSheetStatic:{className:"__GLU__BOTTOM_SHEET_STATIC",css:".__GLU__BOTTOM_SHEET_STATIC { max-width: 100%; max-height: 100%; border-radius: 20px 20px 0px 0px; overflow-x: hidden; z-index: 999999; align-self: flex-end}"},embeddedStatic:{className:"__GLU__EMBEDDED_STATIC",css:".__GLU__EMBEDDED_STATIC { width: 100%; overflow-x: hidden; }"},embedded:{className:"__GLU__EMBEDDED",css:".__GLU__EMBEDDED { width: 100%; height: 100%; overflow-x: hidden; }"}};var $v,Yv={};!function(){if($v)return Yv;$v=1;var t=Sr(),n=Ch();t({target:"Array",stat:!0,forced:!Ss()(function(t){Array.from(t)})},{from:n})}();var Jv,Qv,Zv,tl,nl,il,rl,el,ol,sl,ul,al,cl,fl,hl,dl,vl,ll,gl,ml={};function pl(){return Qv?Jv:(Qv=1,Jv="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView)}function wl(){if(tl)return Zv;tl=1;var t=Pi(),n=Fi(),i=RangeError;return Zv=function(r){if(void 0===r)return 0;var e=t(r),o=n(e);if(e!==o)throw new i("Wrong length or index");return o}}function yl(){if(sl)return ol;sl=1;var t=il?nl:(il=1,nl=Math.sign||function(t){var n=+t;return 0===n||n!=n?n:n<0?-1:1}),n=function(){if(el)return rl;el=1;var t=4503599627370496;return rl=function(n){return n+t-t}}(),i=Math.abs;return ol=function(r,e,o,s){var u=+r,a=i(u),c=t(u);if(a<s)return c*n(a/s/e)*s*e;var f=(1+e/2220446049250313e-31)*a,h=f-(f-a);return h>o||h!=h?c*(1/0):c*h}}function bl(){if(fl)return cl;fl=1;var t=Array,n=Math.abs,i=Math.pow,r=Math.floor,e=Math.log,o=Math.LN2;return cl={pack:function(s,u,a){var c,f,h,d=t(a),v=8*a-u-1,l=(1<<v)-1,g=l>>1,m=23===u?i(2,-24)-i(2,-77):0,p=s<0||0===s&&1/s<0?1:0,w=0;for((s=n(s))!=s||s===1/0?(f=s!=s?1:0,c=l):(c=r(e(s)/o),s*(h=i(2,-c))<1&&(c--,h*=2),(s+=c+g>=1?m/h:m*i(2,1-g))*h>=2&&(c++,h/=2),c+g>=l?(f=0,c=l):c+g>=1?(f=(s*h-1)*i(2,u),c+=g):(f=s*i(2,g-1)*i(2,u),c=0));u>=8;)d[w++]=255&f,f/=256,u-=8;for(c=c<<u|f,v+=u;v>0;)d[w++]=255&c,c/=256,v-=8;return d[w-1]|=128*p,d},unpack:function(t,n){var r,e=t.length,o=8*e-n-1,s=(1<<o)-1,u=s>>1,a=o-7,c=e-1,f=t[c--],h=127&f;for(f>>=7;a>0;)h=256*h+t[c--],a-=8;for(r=h&(1<<-a)-1,h>>=-a,a+=n;a>0;)r=256*r+t[c--],a-=8;if(0===h)h=1-u;else{if(h===s)return r?NaN:f?-1/0:1/0;r+=i(2,n),h-=u}return(f?-1:1)*r*i(2,h-n)}}}function El(){if(dl)return hl;dl=1;var t=Nn(),n=Li(),i=Gi();return hl=[].fill||function(r){for(var e=t(this),o=i(e),s=arguments.length,u=n(s>1?arguments[1]:void 0,o),a=s>2?arguments[2]:void 0,c=void 0===a?o:n(a,o);c>u;)e[u++]=r;return e},hl}function _l(){if(ll)return vl;ll=1;var t=k(),n=Rt(),i=j(),r=pl(),e=hi(),o=Xn(),s=Mo(),u=qc(),a=G(),c=Po(),f=Pi(),h=wl(),d=function(){if(al)return ul;al=1;var t=yl();return ul=Math.fround||function(n){return t(n,1.1920928955078125e-7,34028234663852886e22,11754943508222875e-54)}}(),v=bl(),l=cc(),g=xo(),m=El(),p=jo(),w=Wc(),y=Ir(),b=Ro(),E=gi(),_=e.PROPER,I=e.CONFIGURABLE,T="ArrayBuffer",S="DataView",A="prototype",O="Wrong index",N=E.getterFor(T),D=E.getterFor(S),C=E.set,x=t[T],R=x,M=R&&R[A],U=t[S],P=U&&U[A],L=Object.prototype,F=t.Array,V=t.RangeError,B=n(m),z=n([].reverse),H=v.pack,W=v.unpack,K=function(t){return[255&t]},q=function(t){return[255&t,t>>8&255]},X=function(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]},$=function(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]},Y=function(t){return H(d(t),23,4)},J=function(t){return H(t,52,8)},Q=function(t,n,i){s(t[A],n,{configurable:!0,get:function(){return i(this)[n]}})},Z=function(t,n,i,r){var e=D(t),o=h(i),s=!!r;if(o+n>e.byteLength)throw new V(O);var u=e.bytes,a=o+e.byteOffset,c=p(u,a,a+n);return s?c:z(c)},tt=function(t,n,i,r,e,o){var s=D(t),u=h(i),a=r(+e),c=!!o;if(u+n>s.byteLength)throw new V(O);for(var f=s.bytes,d=u+s.byteOffset,v=0;v<n;v++)f[d+v]=a[c?v:n-v-1]};if(r){var nt=_&&x.name!==T;a(function(){x(1)})&&a(function(){new x(-1)})&&!a(function(){return new x,new x(1.5),new x(NaN),1!==x.length||nt&&!I})?nt&&I&&o(x,"name",T):((R=function(t){return c(this,M),w(new x(h(t)),this,R)})[A]=M,M.constructor=R,y(R,x)),g&&l(P)!==L&&g(P,L);var it=new U(new R(2)),rt=n(P.setInt8);it.setInt8(0,2147483648),it.setInt8(1,2147483649),!it.getInt8(0)&&it.getInt8(1)||u(P,{setInt8:function(t,n){rt(this,t,n<<24>>24)},setUint8:function(t,n){rt(this,t,n<<24>>24)}},{unsafe:!0})}else M=(R=function(t){c(this,M);var n=h(t);C(this,{type:T,bytes:B(F(n),0),byteLength:n}),i||(this.byteLength=n,this.detached=!1)})[A],P=(U=function(t,n,r){c(this,P),c(t,M);var e=N(t),o=e.byteLength,s=f(n);if(s<0||s>o)throw new V("Wrong offset");if(s+(r=void 0===r?o-s:h(r))>o)throw new V("Wrong length");C(this,{type:S,buffer:t,byteLength:r,byteOffset:s,bytes:e.bytes}),i||(this.buffer=t,this.byteLength=r,this.byteOffset=s)})[A],i&&(Q(R,"byteLength",N),Q(U,"buffer",D),Q(U,"byteLength",D),Q(U,"byteOffset",D)),u(P,{getInt8:function(t){return Z(this,1,t)[0]<<24>>24},getUint8:function(t){return Z(this,1,t)[0]},getInt16:function(t){var n=Z(this,2,t,arguments.length>1&&arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function(t){var n=Z(this,2,t,arguments.length>1&&arguments[1]);return n[1]<<8|n[0]},getInt32:function(t){return $(Z(this,4,t,arguments.length>1&&arguments[1]))},getUint32:function(t){return $(Z(this,4,t,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(t){return W(Z(this,4,t,arguments.length>1&&arguments[1]),23)},getFloat64:function(t){return W(Z(this,8,t,arguments.length>1&&arguments[1]),52)},setInt8:function(t,n){tt(this,1,t,K,n)},setUint8:function(t,n){tt(this,1,t,K,n)},setInt16:function(t,n){tt(this,2,t,q,n,arguments.length>2&&arguments[2])},setUint16:function(t,n){tt(this,2,t,q,n,arguments.length>2&&arguments[2])},setInt32:function(t,n){tt(this,4,t,X,n,arguments.length>2&&arguments[2])},setUint32:function(t,n){tt(this,4,t,X,n,arguments.length>2&&arguments[2])},setFloat32:function(t,n){tt(this,4,t,Y,n,arguments.length>2&&arguments[2])},setFloat64:function(t,n){tt(this,8,t,J,n,arguments.length>2&&arguments[2])}});return b(R,T),b(U,S),vl={ArrayBuffer:R,DataView:U}}!function(){if(gl)return ml;gl=1;var t=Sr(),n=k(),i=_l(),r=Uo(),e="ArrayBuffer",o=i[e];t({global:!0,constructor:!0,forced:n[e]!==o},{ArrayBuffer:o}),r(e)}();var Il,Tl={};!function(){if(Il)return Tl;Il=1;var t=Sr(),n=Hr(),i=G(),r=_l(),e=Kn(),o=Li(),s=Fi(),u=r.ArrayBuffer,a=r.DataView,c=a.prototype,f=n(u.prototype.slice),h=n(c.getUint8),d=n(c.setUint8);t({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:i(function(){return!new u(2).slice(1,void 0).byteLength})},{slice:function(t,n){if(f&&void 0===n)return f(e(this),t);for(var i=e(this).byteLength,r=o(t,i),c=o(void 0===n?i:n,i),v=new u(s(c-r)),l=new a(this),g=new a(v),m=0;r<c;)d(g,m++,h(l,r++));return v}})}();var Sl,Al,Ol,Nl,kl,Dl={};!function(){if(kl)return Dl;kl=1;var t=Sr(),n=function(){if(Al)return Sl;Al=1;var t=Rt(),n=Fi(),i=of(),r=sf(),e=Lt(),o=t(r),s=t("".slice),u=Math.ceil,a=function(t){return function(r,a,c){var f=i(e(r)),h=n(a),d=f.length;if(h<=d)return f;var v,l,g=void 0===c?" ":i(c);return""===g?f:((l=o(g,u((v=h-d)/g.length))).length>v&&(l=s(l,0,v)),t?f+l:l+f)}};return Sl={start:a(!1),end:a(!0)}}().start;t({target:"String",proto:!0,forced:function(){if(Nl)return Ol;Nl=1;var t=zt();return Ol=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(t)}()},{padStart:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}})}();var Cl,xl,Rl,Ml,Ul,Pl,Ll,Fl,Gl,jl,Vl,Bl,zl,Hl,Wl,Kl,ql,Xl,$l,Yl,Jl,Ql,Zl={exports:{}};function tg(){if(xl)return Cl;xl=1;var t,n,i,r=pl(),e=j(),o=k(),s=Gt(),u=jt(),a=kn(),c=Cr(),f=Xt(),h=Xn(),d=pi(),v=Mo(),l=Bt(),g=cc(),m=xo(),p=Cn(),w=Dn(),y=gi(),b=y.enforce,E=y.get,_=o.Int8Array,I=_&&_.prototype,T=o.Uint8ClampedArray,S=T&&T.prototype,A=_&&g(_),O=I&&g(I),N=Object.prototype,D=o.TypeError,C=p("toStringTag"),x=w("TYPED_ARRAY_TAG"),R="TypedArrayConstructor",M=r&&!!m&&"Opera"!==c(o.opera),U=!1,P={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},L={BigInt64Array:8,BigUint64Array:8},F=function(t){var n=g(t);if(u(n)){var i=E(n);return i&&a(i,R)?i[R]:F(n)}},G=function(t){if(!u(t))return!1;var n=c(t);return a(P,n)||a(L,n)};for(t in P)(i=(n=o[t])&&n.prototype)?b(i)[R]=n:M=!1;for(t in L)(i=(n=o[t])&&n.prototype)&&(b(i)[R]=n);if((!M||!s(A)||A===Function.prototype)&&(A=function(){throw new D("Incorrect invocation")},M))for(t in P)o[t]&&m(o[t],A);if((!M||!O||O===N)&&(O=A.prototype,M))for(t in P)o[t]&&m(o[t].prototype,O);if(M&&g(S)!==O&&m(S,O),e&&!a(O,C))for(t in U=!0,v(O,C,{configurable:!0,get:function(){return u(this)?this[x]:void 0}}),P)o[t]&&h(o[t].prototype,x,t);return Cl={NATIVE_ARRAY_BUFFER_VIEWS:M,TYPED_ARRAY_TAG:U&&x,aTypedArray:function(t){if(G(t))return t;throw new D("Target is not a typed array")},aTypedArrayConstructor:function(t){if(s(t)&&(!m||l(A,t)))return t;throw new D(f(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,n,i,r){if(e){if(i)for(var s in P){var u=o[s];if(u&&a(u.prototype,t))try{delete u.prototype[t]}catch(i){try{u.prototype[t]=n}catch(t){}}}O[t]&&!i||d(O,t,i?n:M&&I[t]||n,r)}},exportTypedArrayStaticMethod:function(t,n,i){var r,s;if(e){if(m){if(i)for(r in P)if((s=o[r])&&a(s,t))try{delete s[t]}catch(t){}if(A[t]&&!i)return;try{return d(A,t,i?n:M&&A[t]||n)}catch(t){}}for(r in P)!(s=o[r])||s[t]&&!i||d(s,t,n)}},getTypedArrayConstructor:F,isView:function(t){if(!u(t))return!1;var n=c(t);return"DataView"===n||a(P,n)||a(L,n)},isTypedArray:G,TypedArray:A,TypedArrayPrototype:O}}function ng(){if(Pl)return Ul;Pl=1;var t=jt(),n=Math.floor;return Ul=Number.isInteger||function(i){return!t(i)&&isFinite(i)&&n(i)===i}}function ig(){if(Fl)return Ll;Fl=1;var t=Pi(),n=RangeError;return Ll=function(i){var r=t(i);if(r<0)throw new n("The argument can't be less than 0");return r}}function rg(){if(jl)return Gl;jl=1;var t=ig(),n=RangeError;return Gl=function(i,r){var e=t(i);if(e%r)throw new n("Wrong offset");return e}}function eg(){if(Bl)return Vl;Bl=1;var t=Math.floor;return Vl=function(n){var i=+n;if(i!=i||i<=0)return 0;if(i>=255)return 255;var r=t(i);return r+.5<i?r+1:i<r+.5||r%2==0?r:r+1}}function og(){if(Hl)return zl;Hl=1;var t=Cr();return zl=function(n){var i=t(n);return"BigInt64Array"===i||"BigUint64Array"===i}}function sg(){if(Kl)return Wl;Kl=1;var t=xn(),n=TypeError;return Wl=function(i){var r=t(i,"number");if("number"==typeof r)throw new n("Can't convert number to bigint");return BigInt(r)}}function ug(){if(Xl)return ql;Xl=1;var t=Wr(),n=B(),i=$t(),r=Lo(),e=Nn(),o=Gi(),s=_s(),u=Es(),a=bs(),c=og(),f=tg().aTypedArrayConstructor,h=sg();return ql=function(d){var v=r(this),l=arguments.length,g=l>1?arguments[1]:void 0,m=void 0!==g;m&&i(g);var p,w,y,b,E,_,I,T,S=e(d),A=u(S);if(A&&!a(A))for(T=(I=s(S,A)).next,S=[];!(_=n(T,I)).done;)S.push(_.value);for(m&&l>2&&(g=t(g,arguments[2])),w=o(S),y=new(f(v))(w),b=c(y),p=0;w>p;p++)E=m?g(S[p],p):S[p],y[p]=b?h(E):+E;return y},ql}function ag(){if(Yl)return $l;Yl=1;var t=Gi();return $l=function(n,i,r){for(var e=0,o=arguments.length>2?r:t(i),s=new n(o);o>e;)s[e]=i[e++];return s},$l}function cg(){if(Jl)return Zl.exports;Jl=1;var t=Sr(),n=k(),i=B(),r=j(),e=function(){if(Ml)return Rl;Ml=1;var t=k(),n=G(),i=Ss(),r=tg().NATIVE_ARRAY_BUFFER_VIEWS,e=t.ArrayBuffer,o=t.Int8Array;return Rl=!r||!n(function(){o(1)})||!n(function(){new o(-1)})||!i(function(t){new o,new o(null),new o(1.5),new o(t)},!0)||n(function(){return 1!==new o(new e(2),1,void 0).length})}(),o=tg(),s=_l(),u=Po(),a=xt(),c=Xn(),f=ng(),h=wl(),d=rg(),v=eg(),l=Rn(),g=kn(),m=Cr(),p=jt(),w=qt(),y=ue(),b=Bt(),E=xo(),_=zi().f,I=ug(),T=Kr().forEach,S=Uo(),A=Mo(),O=qn(),N=Pn(),D=ag(),C=gi(),x=Wc(),R=C.get,M=C.set,U=C.enforce,P=O.f,L=N.f,F=n.RangeError,V=s.ArrayBuffer,z=V.prototype,H=s.DataView,W=o.NATIVE_ARRAY_BUFFER_VIEWS,K=o.TYPED_ARRAY_TAG,q=o.TypedArray,X=o.TypedArrayPrototype,$=o.isTypedArray,Y="BYTES_PER_ELEMENT",J="Wrong length",Q=function(t,n){A(t,n,{configurable:!0,get:function(){return R(this)[n]}})},Z=function(t){var n;return b(z,t)||"ArrayBuffer"===(n=m(t))||"SharedArrayBuffer"===n},tt=function(t,n){return $(t)&&!w(n)&&n in t&&f(+n)&&n>=0},nt=function(t,n){return n=l(n),tt(t,n)?a(2,t[n]):L(t,n)},it=function(t,n,i){return n=l(n),!(tt(t,n)&&p(i)&&g(i,"value"))||g(i,"get")||g(i,"set")||i.configurable||g(i,"writable")&&!i.writable||g(i,"enumerable")&&!i.enumerable?P(t,n,i):(t[n]=i.value,t)};return r?(W||(N.f=nt,O.f=it,Q(X,"buffer"),Q(X,"byteOffset"),Q(X,"byteLength"),Q(X,"length")),t({target:"Object",stat:!0,forced:!W},{getOwnPropertyDescriptor:nt,defineProperty:it}),Zl.exports=function(r,o,s){var a=r.match(/\d+/)[0]/8,f=r+(s?"Clamped":"")+"Array",l="get"+r,g="set"+r,m=n[f],w=m,b=w&&w.prototype,A={},O=function(t,n){P(t,n,{get:function(){return function(t,n){var i=R(t);return i.view[l](n*a+i.byteOffset,!0)}(this,n)},set:function(t){return function(t,n,i){var r=R(t);r.view[g](n*a+r.byteOffset,s?v(i):i,!0)}(this,n,t)},enumerable:!0})};W?e&&(w=o(function(t,n,r,e){return u(t,b),x(p(n)?Z(n)?void 0!==e?new m(n,d(r,a),e):void 0!==r?new m(n,d(r,a)):new m(n):$(n)?D(w,n):i(I,w,n):new m(h(n)),t,w)}),E&&E(w,q),T(_(m),function(t){t in w||c(w,t,m[t])}),w.prototype=b):(w=o(function(t,n,r,e){u(t,b);var o,s,c,f=0,v=0;if(p(n)){if(!Z(n))return $(n)?D(w,n):i(I,w,n);o=n,v=d(r,a);var l=n.byteLength;if(void 0===e){if(l%a)throw new F(J);if((s=l-v)<0)throw new F(J)}else if((s=h(e)*a)+v>l)throw new F(J);c=s/a}else c=h(n),o=new V(s=c*a);for(M(t,{buffer:o,byteOffset:v,byteLength:s,length:c,view:new H(o)});f<c;)O(t,f++)}),E&&E(w,q),b=w.prototype=y(X)),b.constructor!==w&&c(b,"constructor",w),U(b).TypedArrayConstructor=w,K&&c(b,K,f);var N=w!==m;A[f]=w,t({global:!0,constructor:!0,forced:N,sham:!W},A),Y in w||c(w,Y,a),Y in b||c(b,Y,a),S(f)}):Zl.exports=function(){},Zl.exports}Ql||(Ql=1,cg()("Uint8",function(t){return function(n,i,r){return t(this,n,i,r)}}));var fg,hg,dg,vg={};!function(){if(dg)return vg;dg=1;var t=Rt(),n=tg(),i=function(){if(hg)return fg;hg=1;var t=Nn(),n=Li(),i=Gi(),r=Ec(),e=Math.min;return fg=[].copyWithin||function(o,s){var u=t(this),a=i(u),c=n(o,a),f=n(s,a),h=arguments.length>2?arguments[2]:void 0,d=e((void 0===h?a:n(h,a))-f,a-c),v=1;for(f<c&&c<f+d&&(v=-1,f+=d-1,c+=d-1);d-- >0;)f in u?u[c]=u[f]:r(u,c),c+=v,f+=v;return u},fg}(),r=t(i),e=n.aTypedArray;(0,n.exportTypedArrayMethod)("copyWithin",function(t,n){return r(e(this),t,n,arguments.length>2?arguments[2]:void 0)})}();var lg,gg={};!function(){if(lg)return gg;lg=1;var t=tg(),n=Kr().every,i=t.aTypedArray;(0,t.exportTypedArrayMethod)("every",function(t){return n(i(this),t,arguments.length>1?arguments[1]:void 0)})}();var mg,pg={};!function(){if(mg)return pg;mg=1;var t=tg(),n=El(),i=sg(),r=Cr(),e=B(),o=Rt(),s=G(),u=t.aTypedArray,a=t.exportTypedArrayMethod,c=o("".slice);a("fill",function(t){var o=arguments.length;u(this);var s="Big"===c(r(this),0,3)?i(t):+t;return e(n,this,s,o>1?arguments[1]:void 0,o>2?arguments[2]:void 0)},s(function(){var t=0;return new Int8Array(2).fill({valueOf:function(){return t++}}),1!==t}))}();var wg,yg,bg,Eg={};function _g(){if(yg)return wg;yg=1;var t=ag(),n=tg().getTypedArrayConstructor;return wg=function(i,r){return t(n(i),r)}}!function(){if(bg)return Eg;bg=1;var t=tg(),n=Kr().filter,i=_g(),r=t.aTypedArray;(0,t.exportTypedArrayMethod)("filter",function(t){var e=n(r(this),t,arguments.length>1?arguments[1]:void 0);return i(this,e)})}();var Ig,Tg={};!function(){if(Ig)return Tg;Ig=1;var t=tg(),n=Kr().find,i=t.aTypedArray;(0,t.exportTypedArrayMethod)("find",function(t){return n(i(this),t,arguments.length>1?arguments[1]:void 0)})}();var Sg,Ag={};!function(){if(Sg)return Ag;Sg=1;var t=tg(),n=Kr().findIndex,i=t.aTypedArray;(0,t.exportTypedArrayMethod)("findIndex",function(t){return n(i(this),t,arguments.length>1?arguments[1]:void 0)})}();var Og,Ng={};!function(){if(Og)return Ng;Og=1;var t=tg(),n=Kr().forEach,i=t.aTypedArray;(0,t.exportTypedArrayMethod)("forEach",function(t){n(i(this),t,arguments.length>1?arguments[1]:void 0)})}();var kg,Dg={};!function(){if(kg)return Dg;kg=1;var t=tg(),n=ji().includes,i=t.aTypedArray;(0,t.exportTypedArrayMethod)("includes",function(t){return n(i(this),t,arguments.length>1?arguments[1]:void 0)})}();var Cg,xg={};!function(){if(Cg)return xg;Cg=1;var t=tg(),n=ji().indexOf,i=t.aTypedArray;(0,t.exportTypedArrayMethod)("indexOf",function(t){return n(i(this),t,arguments.length>1?arguments[1]:void 0)})}();var Rg,Mg={};!function(){if(Rg)return Mg;Rg=1;var t=k(),n=G(),i=Rt(),r=tg(),e=lc(),o=Cn()("iterator"),s=t.Uint8Array,u=i(e.values),a=i(e.keys),c=i(e.entries),f=r.aTypedArray,h=r.exportTypedArrayMethod,d=s&&s.prototype,v=!n(function(){d[o].call([1])}),l=!!d&&d.values&&d[o]===d.values&&"values"===d.values.name,g=function(){return u(f(this))};h("entries",function(){return c(f(this))},v),h("keys",function(){return a(f(this))},v),h("values",g,v||!l,{name:"values"}),h(o,g,v||!l,{name:"values"})}();var Ug,Pg={};!function(){if(Ug)return Pg;Ug=1;var t=tg(),n=Rt(),i=t.aTypedArray,r=t.exportTypedArrayMethod,e=n([].join);r("join",function(t){return e(i(this),t)})}();var Lg,Fg={};!function(){if(Lg)return Fg;Lg=1;var t=tg(),n=Go(),i=cv(),r=t.aTypedArray;(0,t.exportTypedArrayMethod)("lastIndexOf",function(t){var e=arguments.length;return n(i,r(this),e>1?[t,arguments[1]]:[t])})}();var Gg,jg={};!function(){if(Gg)return jg;Gg=1;var t=tg(),n=Kr().map,i=_g(),r=t.aTypedArray;(0,t.exportTypedArrayMethod)("map",function(t){var e=n(r(this),t,arguments.length>1?arguments[1]:void 0);return i(this,e)})}();var Vg,Bg,zg,Hg={};function Wg(){if(Bg)return Vg;Bg=1;var t=$t(),n=Nn(),i=Ut(),r=Gi(),e=TypeError,o="Reduce of empty array with no initial value",s=function(s){return function(u,a,c,f){var h=n(u),d=i(h),v=r(h);if(t(a),0===v&&c<2)throw new e(o);var l=s?v-1:0,g=s?-1:1;if(c<2)for(;;){if(l in d){f=d[l],l+=g;break}if(l+=g,s?l<0:v<=l)throw new e(o)}for(;s?l>=0:v>l;l+=g)l in d&&(f=a(f,d[l],l,h));return f}};return Vg={left:s(!1),right:s(!0)}}!function(){if(zg)return Hg;zg=1;var t=tg(),n=Wg().left,i=t.aTypedArray;(0,t.exportTypedArrayMethod)("reduce",function(t){var r=arguments.length;return n(i(this),t,r,r>1?arguments[1]:void 0)})}();var Kg,qg={};!function(){if(Kg)return qg;Kg=1;var t=tg(),n=Wg().right,i=t.aTypedArray;(0,t.exportTypedArrayMethod)("reduceRight",function(t){var r=arguments.length;return n(i(this),t,r,r>1?arguments[1]:void 0)})}();var Xg,$g={};!function(){if(Xg)return $g;Xg=1;var t=tg(),n=t.aTypedArray,i=t.exportTypedArrayMethod,r=Math.floor;i("reverse",function(){for(var t,i=this,e=n(i).length,o=r(e/2),s=0;s<o;)t=i[s],i[s++]=i[--e],i[e]=t;return i})}();var Yg,Jg={};!function(){if(Yg)return Jg;Yg=1;var t=k(),n=B(),i=tg(),r=Gi(),e=rg(),o=Nn(),s=G(),u=t.RangeError,a=t.Int8Array,c=a&&a.prototype,f=c&&c.set,h=i.aTypedArray,d=i.exportTypedArrayMethod,v=!s(function(){var t=new Uint8ClampedArray(2);return n(f,t,{length:1,0:3},1),3!==t[1]}),l=v&&i.NATIVE_ARRAY_BUFFER_VIEWS&&s(function(){var t=new a(2);return t.set(1),t.set("2",1),0!==t[0]||2!==t[1]});d("set",function(t){h(this);var i=e(arguments.length>1?arguments[1]:void 0,1),s=o(t);if(v)return n(f,this,s,i);var a=this.length,c=r(s),d=0;if(c+i>a)throw new u("Wrong length");for(;d<c;)this[i+d]=s[d++]},!v||l)}();var Qg,Zg={};!function(){if(Qg)return Zg;Qg=1;var t=tg(),n=G(),i=jo(),r=t.aTypedArray,e=t.getTypedArrayConstructor;(0,t.exportTypedArrayMethod)("slice",function(t,n){for(var o=i(r(this),t,n),s=e(this),u=0,a=o.length,c=new s(a);a>u;)c[u]=o[u++];return c},n(function(){new Int8Array(1).slice()}))}();var tm,nm={};!function(){if(tm)return nm;tm=1;var t=tg(),n=Kr().some,i=t.aTypedArray;(0,t.exportTypedArrayMethod)("some",function(t){return n(i(this),t,arguments.length>1?arguments[1]:void 0)})}();var im,rm,em,om,sm,um,am,cm={};function fm(){if(rm)return im;rm=1;var t=zt().match(/firefox\/(\d+)/i);return im=!!t&&+t[1]}function hm(){if(om)return em;om=1;var t=zt();return em=/MSIE|Trident/.test(t)}function dm(){if(um)return sm;um=1;var t=zt().match(/AppleWebKit\/(\d+)\./);return sm=!!t&&+t[1]}!function(){if(am)return cm;am=1;var t=k(),n=Hr(),i=G(),r=$t(),e=Hh(),o=tg(),s=fm(),u=hm(),a=Ht(),c=dm(),f=o.aTypedArray,h=o.exportTypedArrayMethod,d=t.Uint16Array,v=d&&n(d.prototype.sort),l=!(!v||i(function(){v(new d(2),null)})&&i(function(){v(new d(2),{})})),g=!!v&&!i(function(){if(a)return a<74;if(s)return s<67;if(u)return!0;if(c)return c<602;var t,n,i=new d(516),r=Array(516);for(t=0;t<516;t++)n=t%4,i[t]=515-t,r[t]=t-2*n+3;for(v(i,function(t,n){return(t/4|0)-(n/4|0)}),t=0;t<516;t++)if(i[t]!==r[t])return!0});h("sort",function(t){return void 0!==t&&r(t),g?v(this,t):e(f(this),function(t){return function(n,i){return void 0!==t?+t(n,i)||0:i!=i?n!=n?0:-1:n!=n?1:0===n&&0===i?1/n>0?1/i>0?0:1:1/i>0?-1:0:n>i?1:n<i?-1:0}}(t))},!g||l)}();var vm,lm={};!function(){if(vm)return lm;vm=1;var t=tg(),n=Fi(),i=Li(),r=t.aTypedArray,e=t.getTypedArrayConstructor;(0,t.exportTypedArrayMethod)("subarray",function(t,o){var s=r(this),u=s.length,a=i(t,u);return new(e(s))(s.buffer,s.byteOffset+a*s.BYTES_PER_ELEMENT,n((void 0===o?u:i(o,u))-a))})}();var gm,mm={};!function(){if(gm)return mm;gm=1;var t=k(),n=Go(),i=tg(),r=G(),e=jo(),o=t.Int8Array,s=i.aTypedArray,u=i.exportTypedArrayMethod,a=[].toLocaleString,c=!!o&&r(function(){a.call(new o(1))});u("toLocaleString",function(){return n(a,c?e(s(this)):s(this),e(arguments))},r(function(){return[1,2].toLocaleString()!==new o([1,2]).toLocaleString()})||!r(function(){o.prototype.toLocaleString.call([1,2])}))}();var pm,wm={};function ym(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();var t="undefined"!=typeof crypto?crypto:null;if(null==t?void 0:t.getRandomValues){var n=new Uint8Array(16);t.getRandomValues(n);var i=new DataView(n.buffer);return i.setUint8(6,15&i.getUint8(6)|64),i.setUint8(8,63&i.getUint8(8)|128),Array.from(n).map(function(t,n){return[4,6,8,10].includes(n)?"-".concat(t.toString(16).padStart(2,"0")):t.toString(16).padStart(2,"0")}).join("")}throw new Error("No cryptographically secure random number generator available")}!function(){if(pm)return wm;pm=1;var t=tg().exportTypedArrayMethod,n=G(),i=k(),r=Rt(),e=i.Uint8Array,o=e&&e.prototype||{},s=[].toString,u=r([].join);n(function(){s.call({})})&&(s=function(){return u(this)});var a=o.toString!==s;t("toString",s,a)}();var bm,Em,_m,Im={};function Tm(){return Em?bm:(Em=1,bm=Object.is||function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n})}!function(){if(_m)return Im;_m=1;var t=B(),n=Cd(),i=Kn(),r=jt(),e=Lt(),o=Tm(),s=of(),u=Yt(),a=Ud();n("search",function(n,c,f){return[function(i){var o=e(this),a=r(i)?u(i,n):void 0;if(a)return t(a,i,o);var c=s(o);return new RegExp(i)[n](c)},function(t){var n=i(this),r=s(t),e=f(c,n,r);if(e.done)return e.value;var u=n.lastIndex;o(u,0)||(n.lastIndex=0);var h=a(n,r);return o(n.lastIndex,u)||(n.lastIndex=u),null===h?-1:h.index}]})}();var Sm,Am={};function Om(t,n){var i;if("undefined"!=typeof URLSearchParams)return new URLSearchParams(t).get(n);var r=new RegExp("[?&]"+n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"=([^&#]*)"),e=t.match(r);return e?decodeURIComponent(null!==(i=e[1])&&void 0!==i?i:""):null}function Nm(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return"UTC"}}function km(t,n){var i,r={campaignName:Om(i=window.location.search,"utm_campaign")||"",campaignSource:Om(i,"utm_source")||"",campaignMedium:Om(i,"utm_medium")||""};return{libraryName:"cap-hydra-web-sdk",libraryVersion:za,locale:navigator.language||navigator.languages&&navigator.languages[0]||"en-US",userAgent:navigator.userAgent||"",timezone:Nm(),ip:"",campaignName:r.campaignName,campaignSource:r.campaignSource,campaignMedium:r.campaignMedium,pageUrl:window.location.href||"",pagePath:window.location.pathname||"",pageReferrer:document.referrer||"",pageTitle:document.title||"",sessionId:t,lat:n?String(n.latitude):"",long:n?String(n.longitude):""}}function Dm(){try{var t=function(){var t,n;if("undefined"!=typeof navigator&&"userAgentData"in navigator){var i=navigator.userAgentData;if(i&&i.brands)try{for(var r=tu(i.brands),e=r.next();!e.done;e=r.next()){var o=e.value;if(o.brand&&"Chromium"!==o.brand&&!o.brand.startsWith("Not"))return o.brand}}catch(n){t={error:n}}finally{try{e&&!e.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}}return null}();return t||("undefined"!=typeof navigator&&navigator.userAgent?(n=navigator.userAgent).includes("Firefox/")?"Firefox":n.includes("Edg/")?"Edge":n.includes("Chrome/")?"Chrome":n.includes("Safari/")&&!n.includes("Chrome")?"Safari":n.includes("Opera/")||n.includes("OPR/")?"Opera":null:null)}catch(t){return null}var n}function Cm(){try{var t=function(){if("undefined"!=typeof navigator&&"userAgentData"in navigator){var t=navigator.userAgentData;if(t&&t.platform)return t.platform}return null}();return t||("undefined"!=typeof navigator&&navigator.userAgent?(n=navigator.userAgent,null!==(r=null!==(i=function(t){if(!t.includes("Mac OS X"))return null;var n=t.match(/Mac OS X ([\d_]+)/);return(null==n?void 0:n[1])?"macOS ".concat(n[1].replace(/_/g,".")):"macOS"}(n))&&void 0!==i?i:function(t){var n;if(!t.includes("Windows NT"))return null;var i=t.match(/Windows NT ([\d.]+)/);return(null==i?void 0:i[1])?"Windows ".concat(null!==(n={"10.0":"10/11",6.3:"8.1",6.2:"8",6.1:"7"}[i[1]])&&void 0!==n?n:i[1]):"Windows"}(n))&&void 0!==r?r:function(t){var n;return t.includes("iPhone")||t.includes("iPad")?(null==(n=t.match(/OS ([\d_]+)/))?void 0:n[1])?"iOS ".concat(n[1].replace(/_/g,".")):"iOS":t.includes("Android")?(n=t.match(/Android ([\d.]+)/))?"Android ".concat(n[1]):"Android":t.includes("Linux")?"Linux":null}(n)):null)}catch(i){return null}var n,i,r}function xm(){try{if("undefined"!=typeof document&&document.referrer)return function(t){var n;if("undefined"!=typeof URL)try{return new URL(t).hostname}catch(t){return"direct"}var i=t.match(/^https?:\/\/([^/?#]+)/);return i&&null!==(n=i[1])&&void 0!==n?n:"direct"}(document.referrer)}catch(t){}return"direct"}function Rm(t){var n=Dm(),i=Cm(),r=function(){var t;try{if("undefined"!=typeof navigator)return navigator.language||(null===(t=navigator.languages)||void 0===t?void 0:t[0])||"en-US"}catch(t){}return"en-US"}(),e=function(){try{if("undefined"!=typeof Intl)return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch(t){}return"UTC"}(),o=function(){try{if("undefined"!=typeof window&&window.screen)return"".concat(window.screen.width,"x").concat(window.screen.height)}catch(t){}return"0x0"}(),s=function(){try{if("undefined"!=typeof window&&window.location){var t=window.location.search;return{utmSource:Om(t,"utm_source"),utmMedium:Om(t,"utm_medium"),utmCampaign:Om(t,"utm_campaign"),utmTerm:Om(t,"utm_term"),utmContent:Om(t,"utm_content"),adsId:Om(t,"gclid")||Om(t,"fbclid")||Om(t,"msclkid")||Om(t,"ttclid")}}}catch(t){}return{utmSource:null,utmMedium:null,utmCampaign:null,utmTerm:null,utmContent:null,adsId:null}}(),u=xm(),a={sdk_version:za,consent:(null==t?void 0:t.notificationPermissionGranted)?"yes":"no"};return function(t,n,i,r,e,o){n&&(t.browser=n),i&&(t.os_version=i),r&&"en-US"!==r&&(t.locale=r),e&&"UTC"!==e&&(t.timezone=e),o&&"0x0"!==o&&(t.screen_resolution=o)}(a,n,i,r,e,o),function(t,n,i,r){(null==n?void 0:n.appVersion)&&(t.app_version=n.appVersion),(null==n?void 0:n.fcmTokenCreatedAt)&&(t.token_creation_date=n.fcmTokenCreatedAt),i.utmSource&&(t.utm_source=i.utmSource),i.utmMedium&&(t.utm_medium=i.utmMedium),i.utmCampaign&&(t.utm_campaign=i.utmCampaign),i.utmTerm&&(t.utm_term=i.utmTerm),i.utmContent&&(t.utm_content=i.utmContent),i.adsId&&(t.ads_id=i.adsId),r&&"direct"!==r&&(t.initial_referrer=r)}(a,t,s,u),a}!function(){if(Sm)return Am;Sm=1;var t=B(),n=Rt(),i=Cd(),r=Kn(),e=jt(),o=Fi(),s=of(),u=Lt(),a=Yt(),c=xd(),f=Md(),h=Ud(),d=n("".indexOf);i("match",function(n,i,v){return[function(i){var r=u(this),o=e(i)?a(i,n):void 0;if(o)return t(o,i,r);var c=s(r);return new RegExp(i)[n](c)},function(t){var n=r(this),e=s(t),u=v(i,n,e);if(u.done)return u.value;var a=s(f(n));if(!~d(a,"g"))return h(n,e);var l=!!~d(a,"u")||!!~d(a,"v");n.lastIndex=0;for(var g,m=[],p=0;null!==(g=h(n,e));){var w=s(g[0]);m[p]=w,""===w&&(n.lastIndex=c(e,o(n.lastIndex),l)),p++}return 0===p?null:m}]})}();var Mm=3e5,Um=null,Pm=0;function Lm(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){return null!==Um&&Date.now()-Pm<Mm?[2,Um]:"undefined"!=typeof navigator&&navigator.geolocation?[2,new Promise(function(t){navigator.geolocation.getCurrentPosition(function(n){Um={latitude:n.coords.latitude,longitude:n.coords.longitude},Pm=Date.now(),t(Um)},function(){return t(null)},{maximumAge:Mm,timeout:2e3,enableHighAccuracy:!1})})]:[2,null]})})}var Fm="__glu_container",Gm="__glu_backdrop";function jm(){return"__GLU__"+ym().replace(/-/g,"")}function Vm(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Bm=function(){function t(t,n){this.rootElement=null,this.closeListener=null,this.isShown=!1,this.supportsPreload=!0,this.preloaded=!1,this.preloadStyleSnapshot=null,this.boundListeners=[],this.customStyles=[],this.destroyed=!1,this.config=t,this.contentElement=n,this.mountDefaultStyleOnce()}return t.prototype.mountDefaultStyleOnce=function(){if("undefined"!=typeof document&&!document.getElementById(t.DEFAULT_STYLE_ID)){var n=this.mountStyle(Object.values(Xv).map(function(t){return t.css}).join(""));null==n||n.setAttribute("id",t.DEFAULT_STYLE_ID)}},t.prototype.bindEvent=function(t,n,i){t.addEventListener(n,i),this.boundListeners.push({target:t,type:n,handler:i})},t.prototype.mountStyle=function(t){if("undefined"==typeof document)return null;var n=document.createElement("style");return n.textContent=t,document.head.appendChild(n),n},t.prototype.addCustomStyle=function(t){if(this.config.css){var n=function(t,n){var i,r,e=t;try{for(var o=tu(Object.entries(n)),s=o.next();!s.done;s=o.next()){var u=nu(s.value,2),a=u[0],c=u[1];e.includes(a)&&(e=e.replace(new RegExp(Vm(a),"g"),c))}}catch(t){i={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return e}(this.config.css,t),i=this.mountStyle(n);i&&this.customStyles.push(i)}},t.prototype.preload=function(){var n,i;if(this.supportsPreload&&!this.preloaded&&!this.isShown&&this.rootElement&&"undefined"!=typeof document){this.preloaded=!0;var r={};try{for(var e=tu(t.PRELOAD_STYLE_KEYS),o=e.next();!o.done;o=e.next()){var s=o.value;r[s]=this.rootElement.style[s]}}catch(t){n={error:t}}finally{try{o&&!o.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}this.preloadStyleSnapshot=r,Object.assign(this.rootElement.style,t.HIDDEN_STYLE),document.body.appendChild(this.rootElement)}},t.prototype.clearPreloadStyles=function(){var n;this.preloaded&&this.rootElement&&(this.preloaded=!1,Object.assign(this.rootElement.style,null!==(n=this.preloadStyleSnapshot)&&void 0!==n?n:t.CLEARED_STYLE),this.preloadStyleSnapshot=null)},t.prototype.show=function(){this.rootElement&&"undefined"!=typeof document&&(this.clearPreloadStyles(),this.rootElement.parentNode||document.body.appendChild(this.rootElement),this.isShown=!0)},t.prototype.hide=function(){this.isShown=!1,this.rootElement&&this.rootElement.parentNode&&this.rootElement.parentNode.removeChild(this.rootElement)},t.prototype.addCloseListener=function(t){this.closeListener=t},t.prototype.destroy=function(){var t,n,i,r,e;if(!this.destroyed){this.destroyed=!0,this.isShown=!1;try{for(var o=tu(this.boundListeners),s=o.next();!s.done;s=o.next()){var u=s.value,a=u.target,c=u.type,f=u.handler;a.removeEventListener(c,f)}}catch(n){t={error:n}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}this.boundListeners.length=0,(null===(e=this.rootElement)||void 0===e?void 0:e.parentNode)&&this.rootElement.parentNode.removeChild(this.rootElement);try{for(var h=tu(this.customStyles),d=h.next();!d.done;d=h.next()){d.value.remove()}}catch(t){i={error:t}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(i)throw i.error}}this.customStyles.length=0,this.closeListener=null,this.onDestroy()}},t.prototype.onDestroy=function(){},t.DEFAULT_STYLE_ID="__glu_default_style",t.PRELOAD_STYLE_KEYS=["position","left","top","visibility","pointerEvents"],t.HIDDEN_STYLE={position:"fixed",left:"-9999px",top:"-9999px",visibility:"hidden",pointerEvents:"none"},t.CLEARED_STYLE={position:"",left:"",top:"",visibility:"",pointerEvents:""},t}(),zm=function(t){function n(n,i){var r,e=t.call(this,n,i)||this;return e.sheetClass=jm(),e.backdropClass=jm(),e.sheetElement=null,e.height=n.height,e.createElement(),e.addCustomStyle(((r={})[Fm]=e.sheetClass,r[Gm]=e.backdropClass,r)),e}return Ys(n,t),n.prototype.createElement=function(){var n=this;if("undefined"!=typeof document){var i=document.createElement("div");i.classList.add(this.backdropClass,Xv.backDrop.className);var r=document.createElement("div"),e="IMG"===this.contentElement.tagName;r.classList.add(this.sheetClass,e?Xv.bottomSheetStatic.className:Xv.bottomSheet.className,Xv.hideScroll.className),r.style.height=this.height,r.appendChild(this.contentElement),this.bindEvent(r,"click",function(t){return t.stopPropagation()}),i.appendChild(r),this.bindEvent(i,"click",function(t){var i;t.stopPropagation(),t.preventDefault(),null===(i=n.closeListener)||void 0===i||i.call(n)}),this.bindEvent(i,"animationend",function(){n.isShown||t.prototype.hide.call(n)}),this.rootElement=i,this.sheetElement=r}},n.prototype.show=function(){this.sheetElement&&(this.sheetElement.classList.remove(Xv.slideDownSheet.className),this.sheetElement.classList.add(Xv.slideUpSheet.className),t.prototype.show.call(this))},n.prototype.hide=function(){this.sheetElement&&(this.sheetElement.classList.remove(Xv.slideUpSheet.className),this.sheetElement.classList.add(Xv.slideDownSheet.className),this.isShown=!1)},n}(Bm),Hm=function(t){function n(n,i){var r,e=t.call(this,n,i)||this;return e.instanceClass=jm(),e.createElement(),e.addCustomStyle(((r={})[Fm]=e.instanceClass,r)),e}return Ys(n,t),n.prototype.createElement=function(){var n=this;if("undefined"!=typeof document){var i=document.createElement("div");i.appendChild(this.contentElement),i.classList.add(Xv.chatBox.className,this.instanceClass),this.bindEvent(i,"animationend",function(){n.isShown||t.prototype.hide.call(n)}),this.rootElement=i}},n.prototype.show=function(){this.rootElement&&(this.rootElement.classList.remove(Xv.slideDown.className),this.rootElement.classList.add(Xv.slideUp.className),t.prototype.show.call(this))},n.prototype.hide=function(){this.rootElement&&(this.rootElement.classList.remove(Xv.slideUp.className),this.rootElement.classList.add(Xv.slideDown.className),this.isShown=!1)},n}(Bm),Wm=[],Km=!1,qm=null;function Xm(t){"undefined"!=typeof document&&(Km||((qm||(qm=new MutationObserver(function(){var t,n;try{for(var i=tu(iu([],nu(Wm),!1)),r=i.next();!r.done;r=i.next()){var e=r.value;try{e()}catch(t){console.error("[gamification] DOM observer callback failed",t)}}}catch(n){t={error:n}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}})),qm).observe(document.body,{childList:!0,subtree:!0}),Km=!0),Wm.includes(t)||Wm.push(t))}function $m(t){0===(Wm=Wm.filter(function(n){return n!==t})).length&&Km&&qm&&(qm.disconnect(),qm=null,Km=!1)}var Ym=function(t){function n(n,i){var r,e=t.call(this,n,i)||this;return e.supportsPreload=!1,e.instanceClass=jm(),e.isObserverRunning=!1,e.showOnceHookPresent=function(){if(e.isObserverRunning&&"undefined"!=typeof document&&e.rootElement){var t=document.querySelector("#".concat(e.hookId));t&&(t.innerHTML="",t.append(e.rootElement),e.isShown=!0,$m(e.showOnceHookPresent),e.isObserverRunning=!1)}},e.hookId=n.elementHookId,e.createElement(),e.addCustomStyle(((r={})[Fm]=e.instanceClass,r)),e}return Ys(n,t),n.prototype.createElement=function(){if("undefined"!=typeof document){var t=document.createElement("div");t.appendChild(this.contentElement);var n="IMG"===this.contentElement.tagName;t.classList.add(this.instanceClass,n?Xv.embeddedStatic.className:Xv.embedded.className),this.rootElement=t}},n.prototype.show=function(){if("undefined"!=typeof document&&this.rootElement){var t=document.querySelector("#".concat(this.hookId));if(t)return t.innerHTML="",t.append(this.rootElement),void(this.isShown=!0);this.isObserverRunning||(Xm(this.showOnceHookPresent),this.isObserverRunning=!0)}},n.prototype.hide=function(){var t;null===(t=this.rootElement)||void 0===t||t.remove(),this.isShown=!1,this.isObserverRunning&&($m(this.showOnceHookPresent),this.isObserverRunning=!1)},n.prototype.onDestroy=function(){this.isObserverRunning&&($m(this.showOnceHookPresent),this.isObserverRunning=!1)},n}(Bm),Jm=function(t){function n(n,i){var r,e=t.call(this,n,i)||this;return e.instanceClass=jm(),e.createElement(),e.addCustomStyle(((r={})[Fm]=e.instanceClass,r)),e}return Ys(n,t),n.prototype.createElement=function(){if("undefined"!=typeof document){var t=document.createElement("div");t.appendChild(this.contentElement),t.classList.add(Xv.iconButton.className,this.instanceClass),this.rootElement=t}},n.prototype.show=function(){this.rootElement&&(this.rootElement.classList.remove(Xv.slideDown.className),this.rootElement.classList.add(Xv.slideUp.className),t.prototype.show.call(this))},n.prototype.hide=function(){this.rootElement&&(this.rootElement.classList.remove(Xv.slideUp.className),this.rootElement.classList.add(Xv.slideDown.className),t.prototype.hide.call(this))},n}(Bm),Qm=function(t){function n(n,i){var r,e=t.call(this,n,i)||this;return e.supportsPreload=!1,e.instanceClass=jm(),e.isObserverRunning=!1,e.showOnceHookPresent=function(){if(e.isObserverRunning&&"undefined"!=typeof document&&e.rootElement){var t=document.querySelector("#".concat(e.hookId));t&&(t.innerHTML="",t.append(e.rootElement),e.isShown=!0,$m(e.showOnceHookPresent),e.isObserverRunning=!1)}},e.hookId=n.elementHookId,e.contentElement.classList.add(e.instanceClass),e.rootElement=e.contentElement,e.addCustomStyle(((r={})[Fm]=e.instanceClass,r)),e}return Ys(n,t),n.prototype.show=function(){if("undefined"!=typeof document&&this.rootElement){var t=document.querySelector("#".concat(this.hookId));if(t)return t.innerHTML="",t.append(this.rootElement),void(this.isShown=!0);this.isObserverRunning||(Xm(this.showOnceHookPresent),this.isObserverRunning=!0)}},n.prototype.hide=function(){var t;null===(t=this.rootElement)||void 0===t||t.remove(),this.isShown=!1,this.isObserverRunning&&($m(this.showOnceHookPresent),this.isObserverRunning=!1)},n.prototype.onDestroy=function(){this.isObserverRunning&&($m(this.showOnceHookPresent),this.isObserverRunning=!1)},n}(Bm),Zm=function(t){function n(n,i){var r,e=t.call(this,n,i)||this;return e.popupClass=jm(),e.backdropClass=jm(),e.popupElement=null,e.createElement(),e.addCustomStyle(((r={})[Fm]=e.popupClass,r[Gm]=e.backdropClass,r)),e}return Ys(n,t),n.prototype.createElement=function(){var n=this;if("undefined"!=typeof document){var i=document.createElement("div");i.classList.add(this.backdropClass,Xv.backDrop.className);var r=document.createElement("div"),e="IMG"===this.contentElement.tagName;r.classList.add(this.popupClass,e?Xv.popUpStatic.className:Xv.popUp.className,Xv.hideScroll.className),r.appendChild(this.contentElement),this.bindEvent(r,"click",function(t){return t.stopPropagation()}),i.appendChild(r),this.bindEvent(i,"click",function(t){var i;t.stopPropagation(),t.preventDefault(),null===(i=n.closeListener)||void 0===i||i.call(n)}),this.bindEvent(i,"animationend",function(){n.isShown||t.prototype.hide.call(n)}),this.rootElement=i,this.popupElement=r}},n.prototype.show=function(){this.popupElement&&(this.popupElement.classList.remove(Xv.slideDown.className),this.popupElement.classList.add(Xv.slideUp.className),t.prototype.show.call(this))},n.prototype.hide=function(){this.popupElement&&(this.popupElement.classList.remove(Xv.slideUp.className),this.popupElement.classList.add(Xv.slideDown.className),this.isShown=!1)},n}(Bm);var tp=function(){function t(n){var i=this;this.sdkEventListener=null,this.boundListeners=[],this.headStyles=[],this.destroyed=!1,this.messageListener=function(t,n){var r,e,o="CLOSE_FRAME_CONTENT"===n.action.type?{target:"GLU_SDK",action:{type:"CLOSE_CONTAINER_CONTENT"}}:n;i.element instanceof HTMLIFrameElement&&t===i.element.contentWindow?null===(r=i.sdkEventListener)||void 0===r||r.call(i,o):"UPDATE_CONTENT_STATE"===o.action.type?i.sendMessageToContent(o.action):"CLOSE_CONTAINER_CONTENT"===o.action.type&&i.sendMessageToContent({type:"UPDATE_CONTENT_STATE",data:null!==(e=o.action.data)&&void 0!==e?e:{}})},this.config=n,t.listeners.push(this.messageListener),t.isListening||t.installWindowListener()}return t.prototype.bindEvent=function(t,n,i,r){t.addEventListener(n,i,r),this.boundListeners.push({target:t,type:n,handler:i})},t.prototype.addHeadStyle=function(t){if("undefined"!=typeof document){var n=document.createElement("style");n.textContent=t,document.head.appendChild(n),this.headStyles.push(n)}},t.prototype.destroy=function(){var n,i,r,e;if(!this.destroyed){this.destroyed=!0,t.removeListener(this.messageListener);try{for(var o=tu(this.boundListeners),s=o.next();!s.done;s=o.next()){var u=s.value,a=u.target,c=u.type,f=u.handler;a.removeEventListener(c,f)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.boundListeners.length=0;try{for(var h=tu(this.headStyles),d=h.next();!d.done;d=h.next()){d.value.remove()}}catch(t){r={error:t}}finally{try{d&&!d.done&&(e=h.return)&&e.call(h)}finally{if(r)throw r.error}}this.headStyles.length=0,this.sdkEventListener=null,this.onDestroy()}},t.prototype.onDestroy=function(){},t.removeListener=function(n){t.listeners=t.listeners.filter(function(t){return t!==n}),0===t.listeners.length&&t.windowListener&&"undefined"!=typeof window&&(window.removeEventListener("message",t.windowListener),t.windowListener=null,t.isListening=!1)},t.parseSdkEvent=function(t){var n=t;if("string"==typeof n)try{var i=JSON.parse(n);if("ANALYTICS"===i.eventName)return{target:"GLU_SDK",action:{type:"ANALYTICS",data:i.data}};n=i}catch(t){return null}return n&&"object"===Ha(n)&&"GLU_SDK"===n.target?n:null},t.dispatchToListeners=function(n,i){var r,e;try{for(var o=tu(t.listeners),s=o.next();!s.done;s=o.next()){var u=s.value;try{u(n,i)}catch(t){}}}catch(t){r={error:t}}finally{try{s&&!s.done&&(e=o.return)&&e.call(o)}finally{if(r)throw r.error}}},t.installWindowListener=function(){if("undefined"!=typeof window){var n=function(n){var i=t.parseSdkEvent(n.data);i&&(t.dispatchToListeners(n.source,i),n.stopPropagation())};window.addEventListener("message",n),t.windowListener=n,t.isListening=!0}},t.prototype.urlModifier=function(t,n){var i=t.includes("?")?"&":"?";return i+="source=JS_SDK",(null==n?void 0:n.token)&&(i+="&token=".concat(this.config.token)),this.config.isEmbedded&&(i+="&isEmbedded=true"),this.config.userId||(i+="&notLoggedIn=true"),encodeURI(t+i)},t.prototype.listen=function(t){this.sdkEventListener=t},t.prototype.sendMessageToContent=function(t){var n={target:"GLU_SDK",action:t};if(this.element instanceof HTMLIFrameElement){var i=this.element.contentWindow;i&&"function"==typeof i.postMessage&&i.postMessage(n,"*")}},t.listeners=[],t.isListening=!1,t.windowListener=null,t}(),np=["https://img.icons8.com/ios-filled/24/000000/rocket.png","https://img.icons8.com/ios-filled/24/000000/gift.png","https://img.icons8.com/ios-filled/24/000000/money.png"],ip=function(t){function n(n,i){var r=t.call(this,i)||this;if(r.data=n,r.campaignId=r.extractCampaignId(),!r.campaignId)throw new Error("ACCEPT_GUARD content missing conditions.campaignId");if(!r.config.allCampaignsMap.byId[r.campaignId])throw new Error("ACCEPT_GUARD: campaign ".concat(r.campaignId," not present in campaign map"));return r.createElement(),r}return Ys(n,t),n.prototype.extractCampaignId=function(){var t,n=null===(t=this.data.conditions)||void 0===t?void 0:t.campaignId;return"string"==typeof n?n:Array.isArray(n)&&void 0!==n[0]?String(n[0]):""},n.prototype.createElement=function(){var t,n,i,r,e,o=this,s="display: flex; justify-content: center; align-items: center;",u="background-color: #fff; text-align: center; padding: 30px 20px; max-width: 400px; width: 100%; margin: 10px;",a="background-color: #e0f7fa; border-radius: 50%; padding: 15px; margin: 0 auto 20px; width: 100px; height: 100px; display: flex; justify-content: center; align-items: center;",c="width: 60px; height: 60px;",f="font-size: 22px; font-weight: bold; color: #333; margin: 20px 0;",h="list-style: none; padding: 0; margin: 0 0 20px; text-align: left;",d="display: flex; align-items: center; margin-bottom: 15px; font-size: 16px;",v="margin-right: 10px;",l="background-color: #6c63ff; color: #fff; border: none; border-radius: 25px; padding: 12px 25px; font-size: 16px; cursor: pointer; width: 80%; margin: 0 auto 10px;",g="background: none; border: none; color: #888; font-size: 14px; cursor: pointer; margin-top: 5px;",m=document.createElement("div");m.style.cssText=s;var p=document.createElement("div");p.style.cssText=u;var w=document.createElement("div");w.style.cssText=a;var y=document.createElement("img");y.src="https://img.icons8.com/color/96/000000/fire-element.png",y.style.cssText=c,w.appendChild(y);var b=document.createElement("h1");b.innerText="Can you complete a 7-day earning streak?",b.style.cssText=f;var E=document.createElement("ul");E.style.cssText=h;var _=[{icon:null!==(i=np[0])&&void 0!==i?i:"",text:"Start a streak anytime until [DATE HERE] by earning at least $1"},{icon:null!==(r=np[1])&&void 0!==r?r:"",text:"Claim a bonus reward for each streak day"},{icon:null!==(e=np[2])&&void 0!==e?e:"",text:"Complete a 7-day streak and earn an additional up to $50 reward"}];try{for(var I=tu(_),T=I.next();!T.done;T=I.next()){var S=T.value,A=document.createElement("li");A.style.cssText=d;var O=document.createElement("img");O.src=S.icon,O.style.cssText=v;var N=document.createElement("span");N.innerText=S.text,A.appendChild(O),A.appendChild(N),E.appendChild(A)}}catch(n){t={error:n}}finally{try{T&&!T.done&&(n=I.return)&&n.call(I)}finally{if(t)throw t.error}}var k=document.createElement("button");k.innerText="Earn to start your streak",k.style.cssText=l,this.bindEvent(k,"click",function(){o.accept()});var D=document.createElement("button");D.innerText="Not now",D.style.cssText=g,this.bindEvent(D,"click",function(){var t;null===(t=o.sdkEventListener)||void 0===t||t.call(o,{target:"GLU_SDK",action:{type:"CLOSE_CONTAINER_CONTENT"}})}),p.appendChild(w),p.appendChild(b),p.appendChild(E),p.appendChild(k),p.appendChild(D),m.appendChild(p),this.element=m},n.prototype.accept=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r;return Zs(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,fetch("https://api.customerglu.com/reward/v1.1/user/program/accept",{method:"POST",headers:{authorization:"Bearer ".concat(this.config.token),"content-type":"application/json"},body:JSON.stringify({campaignId:this.campaignId,choice:"accept"})})];case 1:if(!(t=e.sent()).ok)throw new Error("Accept failed with status ".concat(t.status));return n={target:"GLU_SDK",action:{type:"TOGGLE_CONTAINER_CONTENT",id:jm(),content:{typeId:"CAMPAIGN",conditions:{campaignId:[this.campaignId]}},container:{typeId:"POP_UP",css:".__glu_container { \n background-color: #000; \n border-radius: 0px;\n max-width: none;\n max-height: none;\n height: 100vh;\n width: 100vw;\n } \n .__glu_backdrop { background-color: rgba(0,0,0,0.5); \n background-color: rgba(0,0,0,0.5); \n }",height:"",elementHookId:""}}},null===(r=this.sdkEventListener)||void 0===r||r.call(this,n),[3,3];case 2:return i=e.sent(),console.error("[gamification] ACCEPT_GUARD accept failed",i),[3,3];case 3:return[2]}})})},n}(tp);function rp(t,n){var i=document.createElement("iframe");if(i.classList.add(Xv.iframe.className),i.style.height="100%",i.style.width="100%",i.style.display="block",i.setAttribute("fetchpriority","high"),n){var r=performance.now();i.addEventListener("load",function(){return n(performance.now()-r)},{once:!0})}return i.src=t,i}var ep,op=function(t){function n(n,i){var r=t.call(this,i)||this,e=r.resolveUrl(n);return r.element=rp(r.urlModifier(e),i.onLoad),r}return Ys(n,t),n.prototype.resolveUrl=function(t){var n,i,r,e=null!==(r=t.conditions)&&void 0!==r?r:{};if(0===Object.keys(e).length){if(t.campaignId)if(f=this.config.allCampaignsMap.byId[t.campaignId])return f.url;throw new Error("CAMPAIGN content has no conditions")}var o=this.config.allCampaignsMap,s=o.allIds,u=o.byId;try{for(var a=tu(s),c=a.next();!c.done;c=a.next()){var f;if((f=u[c.value])&&this.campaignMatches(f,e))return f.url}}catch(t){n={error:t}}finally{try{c&&!c.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}throw new Error("CAMPAIGN_NOT_FOUND")},n.prototype.campaignMatches=function(t,n){var i,r,e;try{for(var o=tu(Object.keys(n)),s=o.next();!s.done;s=o.next()){var u=s.value,a=n[u],c=t[u],f=null===(e=t.banner)||void 0===e?void 0:e[u];if("string"==typeof a){if(a!==c&&a!==f)return!1}else{if(!Array.isArray(a))return!1;if(!a.includes(c)&&!a.includes(f))return!1}}}catch(t){i={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return!0},n}(tp),sp=function(t){function n(n,i){var r=t.call(this,i)||this;r.actionId=jm(),r.data=n;var e=r.lookupCampaign();if(!(null==e?void 0:e.banner))throw new Error("DYNAMIC content requires a campaign with banner state");return r.bannerData=e.banner,r.createElement(),r}return Ys(n,t),n.prototype.lookupCampaign=function(){var t,n=this.data.action;if("TOGGLE_CONTAINER_CONTENT"===(null==n?void 0:n.type)){var i=null===(t=n.content.conditions)||void 0===t?void 0:t.campaignId,r="";if("string"==typeof i?r=i:Array.isArray(i)&&void 0!==i[0]&&(r=String(i[0])),r)return this.config.allCampaignsMap.byId[r]}},n.prototype.createElement=function(){var t,n,i=this,r=this.bannerData,e=null!==(t=this.data.state)&&void 0!==t?t:{},o=r.userCampaignStatus,s=null!==(n=e[o])&&void 0!==n?n:{title:"",body:""},u=r.stepCompleted,a=r.activityCount,c=r.totalCampaignParticipants,f=r.activityExpiry,h=Math.floor(Date.now()/1e3),d=Math.max(0,f-h),v=Math.floor(d/3600),l=Math.floor(d%3600/60),g="".concat(v,"h").concat(l.toString().padStart(2,"0"),"m"),m=document.createElement("div");m.className="element";var p=document.createElement("div");p.className="progress-text-container";var w=document.createElement("div");w.setAttribute("class","progress-container");var y="http://www.w3.org/2000/svg",b=document.createElementNS(y,"svg");b.setAttribute("class","progress-circle"),b.setAttribute("viewBox","0 0 36 36");var E=document.createElementNS(y,"path");E.setAttribute("class","progress-bg"),E.setAttribute("d","M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831");var _=document.createElementNS(y,"path");_.setAttribute("class","progress"),_.setAttribute("d","M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831");var I=a>0?u/a*100:0;_.setAttribute("stroke-dasharray","".concat(I,", 100")),_.setAttribute("stroke-linecap",0===u?"butt":"round"),b.appendChild(E),b.appendChild(_);var T=document.createElement("div");T.setAttribute("class","inner-content");var S=document.createElement("div");S.setAttribute("class","primary-icon-container");var A=document.createElement("img");A.setAttribute("class","icon-image"),A.setAttribute("src","https://assets.customerglu.com/d051269a-05d7-4722-9e25-7e031655b4d0/b4194687-57e6-4272-83d5-b7867053408d.svg"),S.appendChild(A),T.appendChild(S),w.appendChild(b),w.appendChild(T);var O=document.createElement("p");O.setAttribute("class","progress-text"),O.innerText="".concat(u,"/").concat(a),p.appendChild(w),p.appendChild(O),m.appendChild(p);var N=document.createElement("img");N.setAttribute("class","smaller-icon"),N.setAttribute("src","https://assets.customerglu.com/d051269a-05d7-4722-9e25-7e031655b4d0/c7d4d74e-c9ef-4ba1-8646-277c2ba2e91d.svg"),w.appendChild(N);var k=document.createElement("div");if(k.className="time-title-body-container",m.appendChild(k),"completed"!==o){var D=document.createElement("div");D.className="icon-text-container";var C=document.createElement("img");C.className="icon-container",C.src="pristine"===o?"https://assets.customerglu.com/d051269a-05d7-4722-9e25-7e031655b4d0/2ca387f9-60b5-40bb-af78-272d81a73021.svg":"https://assets.customerglu.com/d051269a-05d7-4722-9e25-7e031655b4d0/9406d009-5604-4e13-a03b-4e24a7ca4264.svg",D.appendChild(C);var x=document.createElement("p");x.className="timer-text",x.innerText="pristine"===o?"".concat(c," users currently streaking"):g,D.appendChild(x),k.appendChild(D)}var R=document.createElement("div");R.className="title-body-container";var M=document.createElement("p");M.className="title-text",M.innerText=s.title,R.appendChild(M);var U=document.createElement("p");U.className="body-text",U.innerText=s.body,R.appendChild(U),k.appendChild(R);var P=document.createElement("div");P.className="right-icon-container";var L=document.createElement("img");L.className="right-icon",L.src="https://assets.customerglu.com/d051269a-05d7-4722-9e25-7e031655b4d0/5ca637bd-2b75-4996-a3aa-14e58b60c07e.svg",P.appendChild(L),m.appendChild(P),this.addHeadStyle(this.buildStylesheet(u===a)),this.bindEvent(m,"click",function(t){t.stopPropagation(),t.preventDefault(),i.handleClick()}),this.element=m},n.prototype.handleClick=function(){var t=this.data.action;if(t&&"TOGGLE_CONTAINER_CONTENT"===t.type&&this.sdkEventListener)if(this.bannerData.checkAccepted&&this.bannerData.accepted){var n=Js(Js({},t),{id:this.actionId});this.sdkEventListener({target:"GLU_SDK",action:n})}else{var i={target:"GLU_SDK",action:Js(Js({},t),{id:this.actionId,content:Js(Js({},t.content),{typeId:"ACCEPT_GUARD"}),container:Js(Js({},t.container),{typeId:"BOTTOM_SHEET",css:".__glu_container {\n background-color: #fff;\n height: 57vh\n }\n .__glu_backdrop {\n background-color: rgba(0,0,0,0.5);\n }"})})};this.sdkEventListener(i)}},n.prototype.buildStylesheet=function(t){return"\n *{ margin: 0; padding: 0; box-sizing: border-box; }\n body{ font-family: 'Poppins', sans-serif; }\n .element { border-radius: 8px; width: 100%; padding: 8px 0; align-items: stretch; background-color: white; display: flex; }\n .progress-text-container{ display: flex; flex-direction: column; align-items: center; width: 20%; }\n .progress-container { align-items: center; display: flex; flex-direction: column; width: 80%; position: relative; }\n .progress-bg { fill: none; stroke: #d3d3d3; stroke-width: 3; }\n .progress { fill: none; stroke: #FF0099; stroke-width: 3; transition: stroke-dasharray 0.3s ease; }\n .inner-content { height: 63%; width: 63%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; background-color: #E9F2F9; border-radius: 50%; }\n .primary-icon-container { height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; }\n .icon-image{ height: 70%; width: 70%; }\n .smaller-icon { display: ".concat(t?"block":"none","; position: absolute; bottom: 9%; width: 31%; right: 0%; border-radius: 50%; background-color: white; padding: 1px; }\n .progress-text { margin: 0; font-size: 12px; font-weight: 400; color: #757575; }\n .time-title-body-container { max-height: 100%; display: flex; gap: 8px; flex-direction: column; justify-content: center; width: 65%; }\n .icon-text-container { display: flex; border: 1px solid #D8D8D8; border-radius: 4px; gap: 4px; padding: 2px 4px; width: fit-content; align-items: center; }\n .icon-container { width: 12px; height: 12px; }\n .timer-text { margin: 0px; font-size: 12px; font-weight: 600; }\n .title-body-container { display: flex; gap: 8px; flex-direction: column; }\n .title-text { margin: 0; font-size: 16px; font-weight: 600; }\n .body-text { margin: 0; font-size: 12px; font-weight: 400; color: #757575; }\n .right-icon-container { display: flex; justify-content: center; align-items: center; width: 15%; }\n .right-icon { width: 20px; height: 20px; }\n ")},n}(tp),up=function(t){function n(n,i){var r=t.call(this,i)||this;r.actionId=jm(),r.data=n;var e=r.lookupCampaign();return r.createElement(e),r}return Ys(n,t),n.prototype.lookupCampaign=function(){var t,n=this.data.campaignId;if(n)return this.config.allCampaignsMap.byId[n];var i=this.data.action;if("TOGGLE_CONTAINER_CONTENT"===(null==i?void 0:i.type)){var r=null===(t=i.content.conditions)||void 0===t?void 0:t.campaignId,e="";return"string"==typeof r?e=r:Array.isArray(r)&&void 0!==r[0]&&(e=String(r[0])),e?this.config.allCampaignsMap.byId[e]:void 0}},n.prototype.createElement=function(t){var n,i,r,e,o,s,u,a,c,f=this,h=null==t?void 0:t.banner,d=null!==(n=null==h?void 0:h.stepCompleted)&&void 0!==n?n:0,v=null!==(i=null==h?void 0:h.activityCount)&&void 0!==i?i:0,l=null!==(r=null==h?void 0:h.userCampaignStatus)&&void 0!==r?r:"pristine",g=this.findWidgetState(d,l),m=null!==(e=null==g?void 0:g.title)&&void 0!==e?e:"",p=null!==(o=null==g?void 0:g.body)&&void 0!==o?o:"",w=null!==(u=null===(s=null==g?void 0:g.progressBar)||void 0===s?void 0:s.progressRewardText)&&void 0!==u?u:"",y=null!==(c=null!==(a=this.data.progressBarIcon)&&void 0!==a?a:this.data.src)&&void 0!==c?c:"",b=v>0?Math.round(d/v*100):0;this.data.widgetCss&&this.addHeadStyle(this.data.widgetCss);var E=document.createElement("div");E.className="banner-container";var _=document.createElement("div");_.className="header-progressbar-container";var I=document.createElement("div");I.className="header-container";var T=document.createElement("p");T.className="heading-text",T.innerHTML=m;var S=document.createElement("p");S.className="body-text",S.textContent=p,I.appendChild(T),I.appendChild(S);var A=document.createElement("div");A.className="progressbar-parent-container";var O=document.createElement("span");O.className="progressbar-text",O.textContent=w;var N=document.createElement("div");N.className="progressbar-container";var k=document.createElement("div");k.className="total-progress";var D=document.createElement("div");D.className="completed-progress",D.style.width="".concat(b,"%"),N.appendChild(k),N.appendChild(D),A.appendChild(O),A.appendChild(N),_.appendChild(I),_.appendChild(A);var C=document.createElement("div");if(C.className="right-icon-container",y){var x=document.createElement("img");x.src=y,x.style.width="48px",x.style.height="48px",C.appendChild(x)}E.appendChild(_),E.appendChild(C),this.bindEvent(E,"click",function(t){t.stopPropagation(),t.preventDefault(),f.handleClick()}),this.element=E},n.prototype.findWidgetState=function(t,n){var i,r,e=this.data.IWidgetState;if(null==e?void 0:e.length)return null!==(r=null!==(i=e.find(function(i){return i.step===t&&i.state===n}))&&void 0!==i?i:e.find(function(n){return n.step===t}))&&void 0!==r?r:e[0]},n.prototype.handleClick=function(){var t=this.data.action;if(t&&"TOGGLE_CONTAINER_CONTENT"===t.type&&this.sdkEventListener){var n={target:"GLU_SDK",action:Js(Js({},t),{id:this.actionId})};this.sdkEventListener(n)}},n}(tp),ap={};!function(){if(ep)return ap;ep=1;var t=Sr(),n=Rt(),i=$t(),r=Nn(),e=Gi(),o=Ec(),s=of(),u=G(),a=Hh(),c=ve(),f=fm(),h=hm(),d=Ht(),v=dm(),l=[],g=n(l.sort),m=n(l.push),p=u(function(){l.sort(void 0)}),w=u(function(){l.sort(null)}),y=c("sort"),b=!u(function(){if(d)return d<70;if(!(f&&f>3)){if(h)return!0;if(v)return v<603;var t,n,i,r,e="";for(t=65;t<76;t++){switch(n=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(r=0;r<47;r++)l.push({k:n+r,v:i})}for(l.sort(function(t,n){return n.v-t.v}),r=0;r<l.length;r++)n=l[r].k.charAt(0),e.charAt(e.length-1)!==n&&(e+=n);return"DGBEFHACIJK"!==e}});t({target:"Array",proto:!0,forced:p||!w||!y||!b},{sort:function(t){void 0!==t&&i(t);var n=r(this);if(b)return void 0===t?g(n):g(n,t);var u,c,f=[],h=e(n);for(c=0;c<h;c++)c in n&&m(f,n[c]);for(a(f,function(t){return function(n,i){if(void 0===i)return-1;if(void 0===n)return 1;if(void 0!==t)return+t(n,i)||0;var r=s(n),e=s(i);return r===e?0:r>e?1:-1}}(t)),u=e(f),c=0;c<u;)n[c]=f[c++];for(;c<h;)o(n,c++);return n}})}();var cp=function(t){function n(n,i){var r=t.call(this,i)||this;r.actionId=jm(),r.data=n;var e=r.lookupCampaign();return r.createElement(e),r}return Ys(n,t),n.prototype.lookupCampaign=function(){var t,n=this.data.campaignId;if(n)return this.config.allCampaignsMap.byId[n];var i=this.data.action;if("TOGGLE_CONTAINER_CONTENT"===(null==i?void 0:i.type)){var r=null===(t=i.content.conditions)||void 0===t?void 0:t.campaignId,e="";return"string"==typeof r?e=r:Array.isArray(r)&&void 0!==r[0]&&(e=String(r[0])),e?this.config.allCampaignsMap.byId[e]:void 0}},n.prototype.buildHeaderImage=function(t){if(!t)return null;var n=document.createElement("div");n.className="image-container-ms2";var i=document.createElement("img");return i.className="header-image",i.src=t,n.appendChild(i),n},n.prototype.buildProgressBar=function(t,n){var i=document.createElement("div");i.className="progressbar-wrapper-ms2";var r=document.createElement("div");r.className="progressbar-container-ms2";var e=document.createElement("div");e.className="total-progress-ms2";var o=document.createElement("div");o.className="completed-progress-ms2",o.style.width="".concat(t,"%"),r.appendChild(e),r.appendChild(o);var s=document.createElement("div");s.className="progressbar-text-container-ms2";var u=document.createElement("span");return u.className="progressbar-text-ms2",u.textContent=n,s.appendChild(u),i.appendChild(r),i.appendChild(s),i},n.prototype.buildStepCircle=function(t,n){var i=document.createElement("div");i.className="step";var r=document.createElement("div");r.className=n?"circle completed":"circle";var e=document.createElement("span");return e.className=n?"amount completed":"amount",e.textContent=t,r.appendChild(e),i.appendChild(r),i},n.prototype.buildStepLabel=function(t,n,i){var r=document.createElement("div"),e="label inactive";return n?e="label completed":i&&(e="label current"),r.className=e,r.textContent=t,r},n.prototype.buildStepRows=function(t,n,i){var r=this,e=document.createElement("div");e.className="steps-container";var o=document.createElement("div");return o.className="labels-container",n.forEach(function(s,u){var a,c,f,h,d,v=null!==(a=t.find(function(t){return t.step===s&&"pristine"===t.state}))&&void 0!==a?a:t.find(function(t){return t.step===s}),l=null!==(f=null===(c=null==v?void 0:v.progressBar)||void 0===c?void 0:c.progressRewardText)&&void 0!==f?f:"",g=null!==(d=null===(h=null==v?void 0:v.progressBar)||void 0===h?void 0:h.progressLabel)&&void 0!==d?d:"",m=s<i,p=s===i;if(e.appendChild(r.buildStepCircle(l,m||p)),u<n.length-1){var w=document.createElement("div");w.className=m?"connector completed":"connector",e.appendChild(w)}o.appendChild(r.buildStepLabel(g,m,p))}),[e,o]},n.prototype.buildCtaButton=function(t){var n=this,i=document.createElement("div");i.className="button-container";var r=document.createElement("button");return r.className="view-rewards-button",r.textContent=t,this.bindEvent(r,"click",function(t){t.stopPropagation(),t.preventDefault(),n.handleClick()}),i.appendChild(r),i},n.prototype.createElement=function(t){var n,i,r,e,o,s,u,a,c,f,h=this,d=null==t?void 0:t.banner,v=null!==(n=null==d?void 0:d.stepCompleted)&&void 0!==n?n:0,l=null!==(i=null==d?void 0:d.activityCount)&&void 0!==i?i:0,g=null!==(r=null==d?void 0:d.userCampaignStatus)&&void 0!==r?r:"pristine",m=null!==(e=this.data.IWidgetState)&&void 0!==e?e:[],p=this.findWidgetState(v,g,m),w=l>0?Math.round(v/l*100):0;this.data.widgetCss&&this.addHeadStyle(this.data.widgetCss);var y=document.createElement("div");y.className="card-container-ms2";var b=document.createElement("div");b.className="banner-container-ms2";var E=null!==(u=null!==(s=null!==(o=null==p?void 0:p.headerImage)&&void 0!==o?o:this.data.progressMeterIcon)&&void 0!==s?s:this.data.src)&&void 0!==u?u:"",_=this.buildHeaderImage(E);_&&b.appendChild(_);var I=document.createElement("div");I.className="header-progressbar-container-ms2";var T=document.createElement("div");T.className="heading-container-ms2";var S=document.createElement("p");S.className="heading-text-ms2",S.innerHTML=null!==(a=null==p?void 0:p.title)&&void 0!==a?a:"",T.appendChild(S),I.appendChild(T),I.appendChild(this.buildProgressBar(w,null!==(f=null===(c=null==p?void 0:p.progressMeter)||void 0===c?void 0:c.completedText)&&void 0!==f?f:""));var A=iu([],nu(new Set(m.map(function(t){return t.step}))),!1).sort(function(t,n){return t-n});if(A.length>0){var O=nu(this.buildStepRows(m,A,v),2),N=O[0],k=O[1];I.appendChild(N),I.appendChild(k)}(null==p?void 0:p.ctaText)&&I.appendChild(this.buildCtaButton(p.ctaText)),b.appendChild(I),y.appendChild(b),this.bindEvent(y,"click",function(t){t.stopPropagation(),t.preventDefault(),h.handleClick()}),this.element=y},n.prototype.findWidgetState=function(t,n,i){var r,e;return null!==(e=null!==(r=i.find(function(i){return i.step===t&&i.state===n}))&&void 0!==r?r:i.find(function(n){return n.step===t}))&&void 0!==e?e:i[0]},n.prototype.handleClick=function(){var t=this.data.action;if(t&&"TOGGLE_CONTAINER_CONTENT"===t.type&&this.sdkEventListener){var n={target:"GLU_SDK",action:Js(Js({},t),{id:this.actionId})};this.sdkEventListener(n)}},n}(tp),fp=function(t){function n(n,i){var r=t.call(this,i)||this;r.actionId=jm(),r.isExpanded=!0,r.data=n;var e=r.lookupCampaign();return r.createElement(e),r}return Ys(n,t),n.prototype.lookupCampaign=function(){var t,n=this.data.campaignId;if(n)return this.config.allCampaignsMap.byId[n];var i=this.data.action;if("TOGGLE_CONTAINER_CONTENT"===(null==i?void 0:i.type)){var r=null===(t=i.content.conditions)||void 0===t?void 0:t.campaignId,e="";return"string"==typeof r?e=r:Array.isArray(r)&&void 0!==r[0]&&(e=String(r[0])),e?this.config.allCampaignsMap.byId[e]:void 0}},n.prototype.buildHeader=function(t,n){var i=document.createElement("div");i.className="header-container-ms3";var r=document.createElement("div");if(r.className="header-content-ms3",n){var e=document.createElement("span");e.className="progress-badge-ms3",e.textContent=n,r.appendChild(e)}var o=document.createElement("p");if(o.className="heading-ms3",o.innerHTML=t,r.appendChild(o),i.appendChild(r),this.data.progressBarIcon){var s=document.createElement("img");s.className="dropdown-icon-ms3",s.src=this.data.progressBarIcon,i.appendChild(s)}return i},n.prototype.buildStepDiv=function(t,n,i,r){var e=document.createElement("div");e.className="step-ms3";var o=document.createElement("div"),s="circle-ms3";n?s+=" completed":i&&(s+=" current"),o.className=s;var u=document.createElement("span");if(u.className=i?"amount-ms3 current":"amount-ms3",u.textContent=t,o.appendChild(u),e.appendChild(o),r){var a=document.createElement("div");a.className=n?"connector-ms3 completed":"connector-ms3";var c=document.createElement("div");c.className="connector-progress-ms3",a.appendChild(c),e.appendChild(a)}return e},n.prototype.buildStepsContainer=function(t,n,i){var r=this,e=document.createElement("div");return e.className="steps-container-ms3",n.forEach(function(o,s){var u,a,c,f=null!==(u=t.find(function(t){return t.step===o&&"pristine"===t.state}))&&void 0!==u?u:t.find(function(t){return t.step===o}),h=null!==(c=null===(a=null==f?void 0:f.progressBar)||void 0===a?void 0:a.progressRewardText)&&void 0!==c?c:"",d=o<i,v=o===i;e.appendChild(r.buildStepDiv(h,d,v,s<n.length-1))}),e},n.prototype.buildCtaButton=function(t){var n=this,i=document.createElement("div");i.className="button-container-ms3";var r=document.createElement("button");r.className="action-button-ms3",r.textContent=t,this.bindEvent(r,"click",function(t){t.stopPropagation(),t.preventDefault(),n.handleClick()});var e=document.createElement("div");return e.className="shine-effect",i.appendChild(r),i.appendChild(e),i},n.prototype.createElement=function(t){var n,i,r,e,o=this,s=null==t?void 0:t.banner,u=null!==(n=null==s?void 0:s.stepCompleted)&&void 0!==n?n:0,a=null!==(i=null==s?void 0:s.userCampaignStatus)&&void 0!==i?i:"pristine",c=null!==(r=this.data.IWidgetState)&&void 0!==r?r:[],f=this.findWidgetState(u,a,c);this.data.widgetCss&&this.addHeadStyle(this.data.widgetCss);var h=document.createElement("div");h.className="content-container-ms3";var d=document.createElement("div");d.className="main-content-ms3";var v=iu([],nu(new Set(c.map(function(t){return t.step}))),!1).sort(function(t,n){return t-n});if(v.length>0&&d.appendChild(this.buildStepsContainer(c,v,u)),null==f?void 0:f.body){var l=document.createElement("p");l.className="description-ms3",l.textContent=f.body,d.appendChild(l)}(null==f?void 0:f.ctaText)&&d.appendChild(this.buildCtaButton(f.ctaText)),h.appendChild(d);var g=this.buildHeader(null!==(e=null==f?void 0:f.title)&&void 0!==e?e:"",null==f?void 0:f.badgeTag);this.bindEvent(g,"click",function(t){t.stopPropagation(),o.isExpanded=!o.isExpanded,h.classList.toggle("hidden",!o.isExpanded)});var m=document.createElement("div");m.className="banner-container-ms3",m.appendChild(g),m.appendChild(h);var p=document.createElement("div");p.className="card-container-ms3",p.appendChild(m),this.element=p},n.prototype.findWidgetState=function(t,n,i){var r,e;return null!==(e=null!==(r=i.find(function(i){return i.step===t&&i.state===n}))&&void 0!==r?r:i.find(function(n){return n.step===t}))&&void 0!==e?e:i[0]},n.prototype.handleClick=function(){var t=this.data.action;if(t&&"TOGGLE_CONTAINER_CONTENT"===t.type&&this.sdkEventListener){var n={target:"GLU_SDK",action:Js(Js({},t),{id:this.actionId})};this.sdkEventListener(n)}},n}(tp),hp=function(t){function n(n,i){var r=t.call(this,i)||this;if(!n.url)throw new Error("NUDGE content missing `url`");return r.element=rp(r.urlModifier(n.url),i.onLoad),r}return Ys(n,t),n}(tp),dp=function(t){function n(n,i){var r=t.call(this,i)||this;if(!n.campaignId)throw new Error("PROGRAM content missing `campaignId`");var e="".concat(r.config.allCampaignsMap.base,"/program/?campaignId=").concat(n.campaignId);return r.element=rp(r.urlModifier(e,{token:!0}),i.onLoad),r}return Ys(n,t),n}(tp),vp=function(t){function n(n,i){var r=t.call(this,i)||this;if(!n.rewardUserId)throw new Error("REWARD content missing `rewardUserId`");var e="".concat(r.config.allCampaignsMap.base,"/reward/?rewardUserId=").concat(n.rewardUserId);return r.element=rp(r.urlModifier(e,{token:!0}),i.onLoad),r}return Ys(n,t),n}(tp),lp=function(t){function n(n,i){var r=t.call(this,i)||this;if(r.actionId=jm(),r.data=n,r.shouldGateOnCampaign()){var e=r.extractGatedCampaignId();return e&&r.config.allCampaignsMap.byId[e]&&r.createElement(),r}return r.createElement(),r}return Ys(n,t),n.prototype.shouldGateOnCampaign=function(){var t,n,i,r=this.data.action;return!(!r||"TOGGLE_CONTAINER_CONTENT"!==r.type)&&("CAMPAIGN"===(null===(t=r.content)||void 0===t?void 0:t.typeId)&&void 0!==(null===(i=null===(n=r.content)||void 0===n?void 0:n.conditions)||void 0===i?void 0:i.campaignId))},n.prototype.extractGatedCampaignId=function(){var t,n;if("TOGGLE_CONTAINER_CONTENT"!==(null===(t=this.data.action)||void 0===t?void 0:t.type))return null;var i=null===(n=this.data.action.content.conditions)||void 0===n?void 0:n.campaignId;return"string"==typeof i?i:Array.isArray(i)&&void 0!==i[0]?String(i[0]):null},n.prototype.createElement=function(){var t=this;if(!this.data.src)throw new Error("STATIC content missing `src`");var n=document.createElement("img");n.style.maxWidth="100%",n.style.maxHeight="100%",n.style.display="block",n.style.cursor="pointer";var i=this.config.onLoad;if(i){var r=performance.now();this.bindEvent(n,"load",function(){return i(performance.now()-r)},{once:!0})}n.src=this.data.src,this.bindEvent(n,"click",function(n){n.stopPropagation(),n.preventDefault();var i=t.data.action;if(i&&t.sdkEventListener){var r={target:"GLU_SDK",action:"TOGGLE_CONTAINER_CONTENT"===i.type?Js(Js({},i),{id:t.actionId}):i};t.sdkEventListener(r)}}),this.element=n},n}(tp),gp=function(t){function n(n,i){var r=t.call(this,i)||this;return r.element=rp(r.urlModifier(r.config.allCampaignsMap.defaultUrl),i.onLoad),r}return Ys(n,t),n}(tp);var mp=function(){function t(t,n){var i=this;this.sdkEventListener=null,this.closeListener=null,this.entryPoint=t,this.onOpen=n.onOpen;var r=Js(Js({},n),{isEmbedded:"EMBEDDED"===t.container.typeId});if(this.content=function(t,n){var i=t.content;switch(i.typeId){case"CAMPAIGN":return new op(i,n);case"WALLET":return new gp(i,n);case"NUDGE":return new hp(i,n);case"PROGRAM":return new dp(i,n);case"REWARD":return new vp(i,n);case"STATIC":return new lp(i,n);case"DYNAMIC":return new sp(i,n);case"DYNAMIC_MULTISTEP_1":return new up(i,n);case"DYNAMIC_MULTISTEP_2":return new cp(i,n);case"DYNAMIC_MULTISTEP_3":return new fp(i,n);case"ACCEPT_GUARD":return new ip(i,n);default:var r=i.typeId;throw new Error("Unknown content typeId: ".concat(String(r)))}}(t,r),!this.content.element)throw new Error("Content ".concat(t.content.typeId," did not produce an element"));this.container=function(t,n){var i=t.container,r={typeId:i.typeId,css:i.css};switch(i.typeId){case"ICON_BUTTON":return new Jm(r,n);case"CHAT_BOX":return new Hm(r,n);case"POP_UP":return new Zm(r,n);case"BOTTOM_SHEET":return new zm(Js(Js({},r),{height:i.height}),n);case"NATIVE_BANNER":return new Qm(Js(Js({},r),{elementHookId:i.elementHookId}),n);case"EMBEDDED":return new Ym(Js(Js({},r),{elementHookId:i.elementHookId}),n);default:var e=i.typeId;throw new Error("Unknown container typeId: ".concat(String(e)))}}(t,this.content.element),this.content.listen(function(t){var n;return null===(n=i.sdkEventListener)||void 0===n?void 0:n.call(i,t)}),this.container.addCloseListener(function(){var t;return null===(t=i.closeListener)||void 0===t?void 0:t.call(i)})}return Object.defineProperty(t.prototype,"containerTypeId",{get:function(){return this.entryPoint.container.typeId},enumerable:!1,configurable:!0}),t.prototype.addEventListener=function(t){this.sdkEventListener=t},t.prototype.addCloseEventListener=function(t){this.closeListener=t},t.prototype.open=function(){var t;this.container.show(),null===(t=this.onOpen)||void 0===t||t.call(this,this.entryPoint)},t.prototype.preload=function(){this.container.preload()},t.prototype.close=function(){this.container.hide()},t.prototype.toggle=function(){this.isOpen()?this.close():this.open()},t.prototype.isOpen=function(){return this.container.isShown},t.prototype.sendMessage=function(t){this.content.sendMessageToContent(t)},t.prototype.destroy=function(){this.container.destroy(),this.content.destroy(),this.sdkEventListener=null,this.closeListener=null,this.onOpen=void 0},t}(),pp=function(){function t(){}return t.prototype.render=function(t,n,i){var r,e;if("undefined"!=typeof document){document.querySelectorAll("[data-glu-loyalty]").forEach(function(t){t.remove()});try{for(var o=tu(t),s=o.next();!s.done;s=o.next()){var u=s.value,a=document.getElementById(u.embedId);a&&this.injectIframe(a,this.buildUrl(u.url,n),u.embedId,i)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(e=o.return)&&e.call(o)}finally{if(r)throw r.error}}}},t.prototype.buildUrl=function(t,n){if(!n)return t;var i=t.includes("?")?"&":"?";return"".concat(t).concat(i,"capToken=").concat(encodeURIComponent(n))},t.prototype.injectIframe=function(t,n,i,r){var e,o=document.createElement("iframe"),s=null==r?void 0:r.onLoad;if(s){var u=performance.now();o.addEventListener("load",function(){return s(i,performance.now()-u)},{once:!0})}o.src=n,o.setAttribute("data-glu-loyalty",i),o.style.cssText="border:none;width:100%;height:100%;",t.appendChild(o),null===(e=null==r?void 0:r.onOpen)||void 0===e||e.call(r,i)},t}(),wp=function(){function t(t,n,i,r,e){this.initialized=!1,this.userId=null,this.userAttributes=void 0,this.token=null,this.allCampaignsMap=null,this.entryPointMap=null,this.instances=new Map,this.dataDump=null,this.analyticsListener=null,this.lastSyncTimestamp=0,this.spaListenerCleanup=null,this.visibilityListenerCleanup=null,this.capToken=null,this.loyaltyRenderer=new pp,this.pagePathTrackingEnabled=!0,this.manualScreenName=null,this.pagePathTrackingExplicitlySet=!1,this.tokenRefetchInFlight=null,this.authFailureCount=0,this.authBackoffUntil=0,this.pendingTimers=new Set,this.initGeneration=0,this.syncGeneration=0,this.preconnectedOrigins=new Set,this.swPreloaded=!1,this.trackingState=new Map,this.ephemeralEntryPointIds=new Set,this.adHocEntryPointIds=new Set,this.writeKey=t,this.logger=i,this.storageManager=r,this.apiClient=new Wd(n,i),this.trackEvent=e}return t.prototype.initialize=function(t,n){return Qs(this,void 0,void 0,function(){var i,r,e,o,s,u,a,c,f,h,d,v,l;return Zs(this,function(g){switch(g.label){case 0:this.initialized&&(this.logger.info("GamificationManager re-initializing for new user",{userId:t}),this.clean()),this.logger.info("GamificationManager initializing",{userId:t}),i=++this.initGeneration,g.label=1;case 1:return g.trys.push([1,7,,8]),this.userId=t,this.userAttributes=n,this.preconnectFromCachedOrigin(),[4,Promise.all([this.storageManager.get(lh),this.loadFromCache(t)])];case 2:return r=nu.apply(void 0,[g.sent(),2]),e=r[0],o=r[1],i!==this.initGeneration?[2]:(e&&(this.capToken=e),o?(this.logger.info(Lf,{campaigns:null!==(a=null===(u=this.allCampaignsMap)||void 0===u?void 0:u.allIds.length)&&void 0!==a?a:0,entryPoints:null!==(f=null===(c=this.entryPointMap)||void 0===c?void 0:c.allIds.length)&&void 0!==f?f:0}),[3,5]):[3,3]);case 3:return this.logger.info(Ff),[4,this.fetchAndCache(t,n,i)];case 4:if(!g.sent())return[2];g.label=5;case 5:return this.preloadEntryPoints(),this.initialized=!0,this.logger.info(kf,{campaigns:null!==(d=null===(h=this.allCampaignsMap)||void 0===h?void 0:h.allIds.length)&&void 0!==d?d:0,entryPoints:null!==(l=null===(v=this.entryPointMap)||void 0===v?void 0:v.allIds.length)&&void 0!==l?l:0}),[4,this.refresh()];case 6:return g.sent(),i!==this.initGeneration?[2]:(this.loyaltyRenderer.render(this.loyaltyUrls,this.capToken,this.loyaltyCallbacks()),this.registerSpaListener(),this.registerVisibilityListener(),[3,8]);case 7:return s=g.sent(),this.logger.error(Df,s),[3,8];case 8:return[2]}})})},t.prototype.getCampaignsMap=function(){return this.allCampaignsMap},t.prototype.getEntryPointMap=function(){return this.entryPointMap},t.prototype.getToken=function(){return this.token},t.prototype.setCapToken=function(t){this.capToken=t,this.storageManager.set(lh,t).catch(function(){}),this.loyaltyRenderer.render(this.loyaltyUrls,this.capToken,this.loyaltyCallbacks())},t.prototype.getCapToken=function(){return this.capToken},t.prototype.enablePagePathTracking=function(t){this.pagePathTrackingEnabled=t,this.pagePathTrackingExplicitlySet=!0,this.storageManager.set(gh,String(t)).catch(function(){}),this.refresh()},t.prototype.restorePersistedPagePathTracking=function(){return Qs(this,void 0,void 0,function(){var t;return Zs(this,function(n){switch(n.label){case 0:return[4,this.storageManager.get(gh)];case 1:return null===(t=n.sent())||this.pagePathTrackingExplicitlySet||(this.pagePathTrackingEnabled="true"===t),[2]}})})},t.prototype.onScreenChanged=function(t){this.manualScreenName=t,this.pagePathTrackingEnabled||this.handleScreenChange()},t.prototype.setAnalyticsListener=function(t){this.analyticsListener=t},t.prototype.openEntryPoint=function(t){if(this.initialized){var n=this.getOrCreateInstance(t);null==n||n.open()}},t.prototype.closeEntryPoint=function(t){var n;this.initialized&&(null===(n=this.instances.get(t))||void 0===n||n.close())},t.prototype.clean=function(){var t,n,i,r,e,o;this.logger.info(xf),this.initGeneration++,this.syncGeneration++,null===(e=this.spaListenerCleanup)||void 0===e||e.call(this),this.spaListenerCleanup=null,null===(o=this.visibilityListenerCleanup)||void 0===o||o.call(this),this.visibilityListenerCleanup=null,this.lastSyncTimestamp=0;try{for(var s=tu(this.pendingTimers),u=s.next();!u.done;u=s.next()){var a=u.value;clearTimeout(a)}}catch(n){t={error:n}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}this.pendingTimers.clear();try{for(var c=tu(this.instances.values()),f=c.next();!f.done;f=c.next()){var h=f.value;h.isOpen()&&h.close(),h.destroy()}}catch(t){i={error:t}}finally{try{f&&!f.done&&(r=c.return)&&r.call(c)}finally{if(i)throw i.error}}this.instances.clear(),this.trackingState.clear(),this.ephemeralEntryPointIds.clear(),this.adHocEntryPointIds.clear(),this.userId&&(this.storageManager.remove(this.cacheKey(this.userId)).catch(function(){}),this.storageManager.remove(this.tokenCacheKey(this.userId)).catch(function(){})),this.userId=null,this.userAttributes=void 0,this.token=null,this.tokenRefetchInFlight=null,this.authFailureCount=0,this.authBackoffUntil=0,this.allCampaignsMap=null,this.entryPointMap=null,this.dataDump=null,this.capToken=null,this.storageManager.remove(lh).catch(function(){}),this.initialized=!1},t.prototype.destroy=function(){this.clean(),this.logger.info(Cf)},Object.defineProperty(t.prototype,"loyaltyUrls",{get:function(){var t,n;return null!==(n=null===(t=this.allCampaignsMap)||void 0===t?void 0:t.loyaltyUrls)&&void 0!==n?n:[]},enumerable:!1,configurable:!0}),t.prototype.resolveCurrentPath=function(){var t;return this.pagePathTrackingEnabled?"undefined"!=typeof window?window.location.href:"":null!==(t=this.manualScreenName)&&void 0!==t?t:""},t.prototype.refresh=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e,o,s,u,a,c,f;return Zs(this,function(h){switch(h.label){case 0:if(!this.entryPointMap)return[2];t=this.resolveCurrentPath(),this.logger.info(Mf,{entryPoints:this.entryPointMap.allIds.length,url:t}),n={},i=this.entryPointMap,r=this.initGeneration,h.label=1;case 1:h.trys.push([1,6,7,8]),e=tu(iu([],nu(i.allIds),!1)),o=e.next(),h.label=2;case 2:return o.done?[3,5]:(s=o.value,r!==this.initGeneration?[2]:(u=i.byId[s])?[4,this.refreshEntryPoint(u,n)]:[3,4]);case 3:h.sent(),h.label=4;case 4:return o=e.next(),[3,2];case 5:return[3,8];case 6:return a=h.sent(),c={error:a},[3,8];case 7:try{o&&!o.done&&(f=e.return)&&f.call(e)}finally{if(c)throw c.error}return[7];case 8:return[2]}})})},t.prototype.refreshEntryPoint=function(t,n){return Qs(this,void 0,void 0,function(){var i,r,e,o,s,u,a=this;return Zs(this,function(c){switch(c.label){case 0:return(i=null===(s=t.conditions)||void 0===s?void 0:s.singleOpenName)&&n[i]?[2]:this.isCampaignCompleted(t)?((null==(r=this.instances.get(t.id))?void 0:r.isOpen())&&r.close(),[2]):[4,Wv(t,this.userId,this.storageManager,this.logger,this.pendingTimers,this.resolveCurrentPath())];case 1:return c.sent()?(i&&(n[i]=!0),(e=null===(u=t.conditions)||void 0===u?void 0:u.delay)?(o=setTimeout(function(){a.pendingTimers.delete(o),a.openInstance(t)},1e3*e),this.pendingTimers.add(o)):this.openInstance(t),[2]):((null==(r=this.instances.get(t.id))?void 0:r.isOpen())&&r.close(),[2])}})})},t.prototype.openInstance=function(t){var n=this.getOrCreateInstance(t.id);null==n||n.open()},t.prototype.preloadEntryPoints=function(){var t,n;if(this.entryPointMap){this.preconnectToCampaignOrigin(),this.preloadServiceWorker();try{for(var i=tu(this.entryPointMap.allIds),r=i.next();!r.done;r=i.next()){var e=r.value;if(!this.instances.has(e)){var o=this.entryPointMap.byId[e];if(o&&!this.isCampaignCompleted(o)){var s=this.getOrCreateInstance(e);null==s||s.preload()}}}}catch(n){t={error:n}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}},t.prototype.preconnectToCampaignOrigin=function(t){var n,i=null!=t?t:null===(n=this.allCampaignsMap)||void 0===n?void 0:n.base;if("undefined"!=typeof document&&i&&!this.preconnectedOrigins.has(i)){this.preconnectedOrigins.add(i);var r=document.createElement("link");r.rel="preconnect",r.href=i,document.head.appendChild(r)}},t.prototype.preconnectFromCachedOrigin=function(){return Qs(this,void 0,void 0,function(){var t;return Zs(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.storageManager.get(wh)];case 1:return(t=n.sent())&&this.preconnectToCampaignOrigin(t),[3,3];case 2:return n.sent(),[3,3];case 3:return[2]}})})},t.prototype.preloadServiceWorker=function(){var t,n=this;if("undefined"!=typeof document&&(null===(t=this.allCampaignsMap)||void 0===t?void 0:t.base)&&!this.swPreloaded){this.swPreloaded=!0;var i="".concat(this.allCampaignsMap.base).concat(mh),r=document.createElement("iframe");r.setAttribute("aria-hidden","true"),r.setAttribute("sandbox","allow-scripts allow-same-origin"),r.style.cssText="position:absolute;left:-9999px;top:-9999px;width:1px;height:1px;border:0;",r.setAttribute("fetchpriority","low");var e=function(){r.remove(),clearTimeout(o),n.pendingTimers.delete(o)};r.addEventListener("load",function(){return e()},{once:!0});var o=setTimeout(function(){return e()},ph);this.pendingTimers.add(o),r.src=i,document.body.appendChild(r)}},t.prototype.getOrCreateInstance=function(t){var n,i=this,r=this.instances.get(t);if(r)return r;var e=null===(n=this.entryPointMap)||void 0===n?void 0:n.byId[t];if(!(e&&this.token&&this.allCampaignsMap&&this.userId))return null;var o=this.token,s=this.userId;try{var u=function(){var n,r;return null!==(r=null===(n=i.entryPointMap)||void 0===n?void 0:n.byId[t])&&void 0!==r?r:e},a=new mp(e,{userId:s,token:o,allCampaignsMap:this.allCampaignsMap,onOpen:function(){return i.trackEntryPointOpen(u())},onLoad:function(t){return i.trackEntryPointLoaded(u(),t)}});return a.addEventListener(function(n){return i.handleSdkEvent(n,t)}),a.addCloseEventListener(function(){return a.close()}),this.instances.set(t,a),a}catch(n){return this.logger.warn("Failed to construct entry point instance",{entryPointId:t,error:n}),null}},t.prototype.trackEntryPointOpen=function(t){var n,i,r=this,e=Yd(t);if(e&&this.userId){if(this.markOpened(t.id),"game"===e){var o=Zd(t),s={campaign_id:o,game_type:this.lookupGameType(o),entry_surface:null!==(n=$d(t))&&void 0!==n?n:"",embed_id:t.container.elementHookId,entry_point_id:this.resolveTrackingEntryPointId(t,o),entry_point_location:"undefined"!=typeof window?window.location.href:""};this.trackEvent(Wf,s)}else{s={page_id:t.container.elementHookId,content_surface:null!==(i=$d(t))&&void 0!==i?i:""};this.trackEvent(Yf,s)}this.fireViewedIfReady(t.id,function(n){return r.buildViewedAttributes(t,e,n)},e)}},t.prototype.trackEntryPointLoaded=function(t,n){var i=this;this.logger.debug("Campaign iframe loaded in ".concat(n.toFixed(2),"ms"),{entryPointId:t.id,campaignId:Zd(t)});var r=Yd(t);r&&(this.markLoaded(t.id,n),this.fireViewedIfReady(t.id,function(n){return i.buildViewedAttributes(t,r,n)},r))},t.prototype.buildViewedAttributes=function(t,n,i){var r;if("game"===n){var e=Zd(t);return{campaign_id:e,game_type:this.lookupGameType(e),load_time_ms:Jd(i)}}return{page_id:t.container.elementHookId,content_surface:null!==(r=$d(t))&&void 0!==r?r:"",load_time_ms:Jd(i)}},t.prototype.lookupGameType=function(t){var n,i,r;return t&&null!==(r=null===(i=null===(n=this.allCampaignsMap)||void 0===n?void 0:n.byId[t])||void 0===i?void 0:i.type)&&void 0!==r?r:null},t.prototype.resolveTrackingEntryPointId=function(t,n){var i;if(!this.ephemeralEntryPointIds.has(t.id)||!n||!this.entryPointMap)return t.id;var r=this.entryPointMap,e=r.allIds.map(function(t){return r.byId[t]}).find(function(i){return void 0!==i&&i.id!==t.id&&Zd(i)===n});return null!==(i=null==e?void 0:e.id)&&void 0!==i?i:t.id},t.prototype.handleInboundAnalyticsEvent=function(t,n){var i=this;return this.matchesAnalyticsEventName(t,Hf)?(this.trackGamePlayed(n),void this.trackRewardSeenIfPresent(t)):this.matchesAnalyticsEventName(t,zf)?(this.trackGameCompleted(n),this.trackRewardSeenIfPresent(t),void Qs(i,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.resyncData()];case 1:case 2:return t.sent(),[3,3];case 3:return[2]}})})):void this.trackRewardSeenIfPresent(t)},t.prototype.matchesAnalyticsEventName=function(t,n){return"object"===Ha(t)&&null!==t&&t[ch.EVENT_NAME]===n},t.prototype.trackGamePlayed=function(t){var n,i=null===(n=this.instances.get(t))||void 0===n?void 0:n.entryPoint;if(i&&"CAMPAIGN"===i.content.typeId&&this.userId){this.getOrCreateTrackingState(t).playedAt=Date.now();var r=Zd(i),e={campaign_id:r,game_type:this.lookupGameType(r)};this.trackEvent(qf,e)}},t.prototype.trackGameCompleted=function(t){var n,i,r=null===(n=this.instances.get(t))||void 0===n?void 0:n.entryPoint;if(r&&"CAMPAIGN"===r.content.typeId&&this.userId){var e=null===(i=this.trackingState.get(t))||void 0===i?void 0:i.playedAt,o=void 0!==e?Date.now()-e:0,s=Zd(r),u={campaign_id:s,game_type:this.lookupGameType(s),total_time_ms:Jd(o)};this.trackEvent(Xf,u)}},t.prototype.trackRewardSeenIfPresent=function(t){if("object"===Ha(t)&&null!==t){var n=t[ch.CAMPAIGN_DETAILS];if("object"===Ha(n)&&null!==n){var i=n,r=i[ch.REWARD_STATUS];"string"==typeof r&&r.split("-").includes("SEEN")&&this.trackRewardSeen(i)}}},t.prototype.trackRewardSeen=function(t){if(this.userId){var n={reward_id:this.readStringField(t,ch.REWARD_USER_ID),campaign_id:this.readStringField(t,ch.CAMPAIGN_ID),reward_type:this.readStringField(t,ch.REWARD_TYPE)};this.trackEvent($f,n)}},t.prototype.readStringField=function(t,n){var i=t[n];return void 0===i?null:"string"==typeof i?i:(this.logger.warn("Expected a string field in analytics payload",{field:n,value:i}),null)},t.prototype.trackLoyaltyOpen=function(t){var n=this;if(this.userId){var i=this.loyaltyStateKey(t);this.markOpened(i);var r={page_id:t,content_surface:Qf};this.trackEvent(Yf,r),this.fireViewedIfReady(i,function(i){return n.buildLoyaltyViewedAttributes(t,i)},"content")}},t.prototype.trackLoyaltyLoaded=function(t,n){var i=this,r=this.loyaltyStateKey(t);this.markLoaded(r,n),this.fireViewedIfReady(r,function(n){return i.buildLoyaltyViewedAttributes(t,n)},"content")},t.prototype.buildLoyaltyViewedAttributes=function(t,n){return{page_id:t,content_surface:Qf,load_time_ms:Jd(n)}},t.prototype.loyaltyStateKey=function(t){return"loyalty:".concat(t)},t.prototype.loyaltyCallbacks=function(){var t=this;return{onOpen:function(n){return t.trackLoyaltyOpen(n)},onLoad:function(n,i){return t.trackLoyaltyLoaded(n,i)}}},t.prototype.markOpened=function(t){this.getOrCreateTrackingState(t).opened=!0},t.prototype.markLoaded=function(t,n){this.getOrCreateTrackingState(t).loadTimeMs=n},t.prototype.getOrCreateTrackingState=function(t){var n=this.trackingState.get(t);return n||(n={opened:!1,viewedFired:!1},this.trackingState.set(t,n)),n},t.prototype.fireViewedIfReady=function(t,n,i){var r=this.trackingState.get(t);r&&!r.viewedFired&&r.opened&&void 0!==r.loadTimeMs&&this.userId&&(r.viewedFired=!0,this.trackEvent("game"===i?Kf:Jf,n(r.loadTimeMs)))},t.prototype.handleSdkEvent=function(t,n){var i,r,e,o;if(this.initialized&&t&&"GLU_SDK"===t.target&&t.action){var s=t.action;switch(s.type){case"TOGGLE_CONTAINER_CONTENT":this.handleToggle(s);break;case"OPEN_CONTAINER_CONTENT":this.handleOpen(s);break;case"CLOSE_CONTAINER_CONTENT":null===(i=this.instances.get(n))||void 0===i||i.close(),this.ephemeralEntryPointIds.delete(n)&&this.trackingState.delete(n),s.data&&(this.dataDump=s.data);break;case"REQUEST_STATE":null===(r=this.instances.get(n))||void 0===r||r.sendMessage({type:"UPDATE_CONTENT_STATE",data:null!==(e=this.dataDump)&&void 0!==e?e:{}});break;case"LOGIN":"undefined"!=typeof window&&(window.location.href=s.data.url);break;case"REDIRECT":this.handleRedirect(s);break;case"ANALYTICS":null===(o=this.analyticsListener)||void 0===o||o.call(this,s.data),this.handleInboundAnalyticsEvent(s.data,n);break;case"REFRESH":this.refresh()}}},t.prototype.handleToggle=function(t){var n=this.instances.get(t.id);if(n)n.toggle();else{var i={id:t.id,container:t.container,content:t.content};this.registerAdHocEntryPoint(i),this.openInstance(i)}t.data&&(this.dataDump=t.data)},t.prototype.handleOpen=function(t){var n={id:jm(),container:t.container,content:t.content};this.ephemeralEntryPointIds.add(n.id),this.registerAdHocEntryPoint(n),this.openInstance(n),t.data&&(this.dataDump=t.data)},t.prototype.handleRedirect=function(t){if("undefined"!=typeof window){var n=t.data.url;this.userId&&(n+=n.includes("?")?"&":"?",n+="userId=".concat(this.userId)),t.data.openInNewTab?window.open(n):window.location.href=n}},t.prototype.registerAdHocEntryPoint=function(t){this.entryPointMap&&(this.adHocEntryPointIds.add(t.id),this.entryPointMap.byId[t.id]||(this.entryPointMap.allIds.push(t.id),this.entryPointMap.byId[t.id]=t))},t.prototype.closeAdHocEntryPoints=function(){var t,n;if(0!==this.adHocEntryPointIds.size){try{for(var i=tu(this.adHocEntryPointIds),r=i.next();!r.done;r=i.next()){var e=r.value,o=this.instances.get(e);if(o&&(o.isOpen()&&o.close(),o.destroy(),this.instances.delete(e)),this.trackingState.delete(e),this.ephemeralEntryPointIds.delete(e),this.entryPointMap){delete this.entryPointMap.byId[e];var s=this.entryPointMap.allIds.indexOf(e);-1!==s&&this.entryPointMap.allIds.splice(s,1)}}}catch(n){t={error:n}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}this.adHocEntryPointIds.clear()}},t.prototype.cacheKey=function(t){return eh+t},t.prototype.tokenCacheKey=function(t){return oh+t},t.prototype.loadTokenFromCache=function(t){return Qs(this,void 0,void 0,function(){var n,i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.storageManager.get(this.tokenCacheKey(t))];case 1:return(n=r.sent())?(i=JSON.parse(n),Date.now()-i.timestamp>=rh?[2,null]:[2,i.token]):[2,null];case 2:return r.sent(),[2,null];case 3:return[2]}})})},t.prototype.saveTokenToCache=function(t,n){return Qs(this,void 0,void 0,function(){var i,r;return Zs(this,function(e){switch(e.label){case 0:i={token:n,timestamp:Date.now()},e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.storageManager.set(this.tokenCacheKey(t),JSON.stringify(i))];case 2:return e.sent(),[3,4];case 3:return r=e.sent(),this.logger.warn("Failed to persist gamification token cache",{error:r}),[3,4];case 4:return[2]}})})},t.prototype.getOrFetchToken=function(t,n){return Qs(this,void 0,void 0,function(){var i,r;return Zs(this,function(e){switch(e.label){case 0:return[4,this.loadTokenFromCache(t)];case 1:return(i=e.sent())?(this.logger.info(Gf),[2,i]):(this.logger.info(jf),[4,this.apiClient.getToken(this.writeKey,t,ah.LOGGED_IN,void 0,n)]);case 2:return r=e.sent(),[4,this.saveTokenToCache(t,r)];case 3:return e.sent(),[2,r]}})})},t.prototype.isAuthError=function(t){return"object"===Ha(t)&&null!==t&&t.code===wu},t.prototype.ensureFreshToken=function(t){return Qs(this,void 0,void 0,function(){var n,i,r,e;return Zs(this,function(o){switch(o.label){case 0:if(this.tokenRefetchInFlight)return[2,this.tokenRefetchInFlight];if(Date.now()<this.authBackoffUntil)throw this.logger.warn(Bf,{retryInMs:this.authBackoffUntil-Date.now()}),new Error("Gamification token refetch is in backoff after repeated failures");n=this.refetchToken(t,this.userAttributes),this.tokenRefetchInFlight=n,o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,n];case 2:return i=o.sent(),this.authFailureCount=0,this.authBackoffUntil=0,[2,i];case 3:throw r=o.sent(),this.authFailureCount+=1,e=Math.min(dh*Math.pow(2,this.authFailureCount-1),vh),this.authBackoffUntil=Date.now()+e,r;case 4:return this.tokenRefetchInFlight=null,[7];case 5:return[2]}})})},t.prototype.refetchToken=function(t,n){return Qs(this,void 0,void 0,function(){var i;return Zs(this,function(r){switch(r.label){case 0:return[4,this.storageManager.remove(this.tokenCacheKey(t)).catch(function(){})];case 1:return r.sent(),[4,this.apiClient.getToken(this.writeKey,t,ah.LOGGED_IN,void 0,n)];case 2:return i=r.sent(),this.userId!==t?[3,4]:[4,this.saveTokenToCache(t,i)];case 3:r.sent(),this.token=i,r.label=4;case 4:return[2,i]}})})},t.prototype.fetchCampaignsAndEntryPoints=function(t,n){return Qs(this,void 0,void 0,function(){var i,r;return Zs(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,4]),[4,Promise.all([this.apiClient.getCampaigns(n),this.apiClient.getEntryPoints(n)])];case 1:return[2,e.sent()];case 2:if(i=e.sent(),!this.isAuthError(i))throw i;return this.logger.warn(Vf),[4,this.ensureFreshToken(t)];case 3:return r=e.sent(),[2,Promise.all([this.apiClient.getCampaigns(r),this.apiClient.getEntryPoints(r)])];case 4:return[2]}})})},t.prototype.loadFromCache=function(t){return Qs(this,void 0,void 0,function(){var n,i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.storageManager.get(this.cacheKey(t))];case 1:return(n=r.sent())?(i=JSON.parse(n),Date.now()-i.timestamp>=ih?[2,!1]:(this.token=i.token,this.allCampaignsMap=i.allCampaignsMap,this.entryPointMap=i.entryPointMap,this.lastSyncTimestamp=i.timestamp,[2,!0])):[2,!1];case 2:return r.sent(),[2,!1];case 3:return[2]}})})},t.prototype.saveToCache=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:if(!(this.userId&&this.token&&this.allCampaignsMap&&this.entryPointMap))return[2];t={token:this.token,allCampaignsMap:this.allCampaignsMap,entryPointMap:this.entryPointMap,timestamp:this.lastSyncTimestamp},i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.storageManager.set(this.cacheKey(this.userId),JSON.stringify(t))];case 2:return i.sent(),[3,4];case 3:return n=i.sent(),this.logger.warn("Failed to persist gamification cache",{error:n}),[3,4];case 4:return this.allCampaignsMap.base&&this.storageManager.set(wh,this.allCampaignsMap.base).catch(function(){}),[2]}})})},t.prototype.handleScreenChange=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.closeAdHocEntryPoints(),this.isDataStale()?[4,this.resyncData()]:[3,2];case 1:return t.sent(),[3,3];case 2:this.loyaltyRenderer.render(this.loyaltyUrls,this.capToken,this.loyaltyCallbacks()),t.label=3;case 3:return this.refresh(),[2]}})})},t.prototype.isDataStale=function(){return Date.now()-this.lastSyncTimestamp>=ih},t.prototype.resyncData=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e,o,s;return Zs(this,function(u){switch(u.label){case 0:if(t=this.token,n=this.userId,!t||!n)return[2];i=++this.syncGeneration,this.logger.info(Uf),u.label=1;case 1:return u.trys.push([1,4,,5]),[4,this.fetchCampaignsAndEntryPoints(n,t)];case 2:return r=nu.apply(void 0,[u.sent(),2]),e=r[0],o=r[1],i!==this.syncGeneration?[2]:(this.allCampaignsMap=e,this.entryPointMap=ev(o),this.lastSyncTimestamp=Date.now(),this.preloadEntryPoints(),[4,this.saveToCache()]);case 3:return u.sent(),this.loyaltyRenderer.render(this.loyaltyUrls,this.capToken,this.loyaltyCallbacks()),[3,5];case 4:return s=u.sent(),this.logger.error(Pf,s),[3,5];case 5:return[2]}})})},t.prototype.fetchAndCache=function(t,n,i){return Qs(this,void 0,void 0,function(){var r,e,o,s;return Zs(this,function(u){switch(u.label){case 0:return[4,this.getOrFetchToken(t,n)];case 1:return r=u.sent(),i!==this.initGeneration?[2,!1]:(this.token=r,[4,this.fetchCampaignsAndEntryPoints(t,r)]);case 2:return e=nu.apply(void 0,[u.sent(),2]),o=e[0],s=e[1],i!==this.initGeneration?[2,!1]:(this.allCampaignsMap=o,this.entryPointMap=ev(s),this.lastSyncTimestamp=Date.now(),this.saveToCache(),[2,i===this.initGeneration])}})})},t.prototype.isCampaignCompleted=function(t){var n,i,r,e=Zd(t);if(!e||!this.allCampaignsMap)return!1;var o=this.allCampaignsMap.byId[e];if(!o)return!1;var s=Zf;return(null===(n=o.status)||void 0===n?void 0:n.toUpperCase())===s||(null===(r=null===(i=o.banner)||void 0===i?void 0:i.userCampaignStatus)||void 0===r?void 0:r.toUpperCase())===s},t.prototype.registerSpaListener=function(){var t=this;if("undefined"!=typeof window&&"undefined"!=typeof document){var n=window.location.href,i=null,r=new MutationObserver(function(){var r=window.location.href;if(r!==n){if(n=r,!t.pagePathTrackingEnabled)return;i&&clearTimeout(i),i=setTimeout(function(){t.handleScreenChange()},uh)}});r.observe(document.body,{childList:!0,subtree:!0}),this.spaListenerCleanup=function(){r.disconnect(),i&&clearTimeout(i)}}},t.prototype.registerVisibilityListener=function(){var t=this;if("undefined"!=typeof document){var n=function(){return Qs(t,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return"visible"===document.visibilityState&&this.isDataStale()?[4,this.resyncData()]:[3,2];case 1:t.sent(),this.refresh(),t.label=2;case 2:return[2]}})})};document.addEventListener("visibilitychange",n),this.visibilityListenerCleanup=function(){document.removeEventListener("visibilitychange",n)}}},t}(),yp=function(){function t(t,n,i,r,e){this.httpClient=new Vd(t),this.logger=n,this.accountId=i,this.orgId=r,this.source=e}return t.prototype.sendEvents=function(t,n,i,r,e,o){return Qs(this,void 0,void 0,function(){var s,u,a,c,f,h,d,v;return Zs(this,function(l){switch(l.label){case 0:if(!n&&!i&&!r)throw new Error("Either visitorId, visitorExternalId, or userId must be provided for event tracking");if(!o)throw new Error("Session ID is required for event tracking");return u=(s=!!n||!!i)&&r?"identified":s?"anonymous":"user-only",this.logger.info("Sending events",{eventCount:t.length,trackingMode:u,hasVisitor:s,hasUser:!!r,sessionId:o}),[4,Lm()];case 1:a=l.sent(),c=km(o,a),f={request_id:ym(),context:c,events:t},n?f.visitor={identifierName:"id",identifierValue:n}:i&&(f.visitor={identifierName:"externalId",identifierValue:i}),r&&e&&(f.user={identifierName:e,identifierValue:r}),l.label=2;case 2:return l.trys.push([2,4,,5]),h={"X-CAP-API-AUTH-ORG-ID":this.orgId,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":this.source,"X-CAP-API-AUTH-ENTITY-ID":this.orgId},[4,this.httpClient.post(ru,f,{headers:h})];case 3:return d=l.sent(),this.logger.info(Pu,{requestId:f.request_id,eventCount:t.length,trackingMode:u,success:d.status.success}),[2,d];case 4:throw v=l.sent(),this.logger.error(Lu,{requestId:f.request_id,eventCount:t.length,trackingMode:u,error:v}),v;case 5:return[2]}})})},t.prototype.getVisitorConfig=function(t){return Qs(this,void 0,void 0,function(){var n,i,r,e,o;return Zs(this,function(s){switch(s.label){case 0:this.logger.info("Fetching visitor config",{orgId:t}),s.label=1;case 1:return s.trys.push([1,3,,4]),n={"X-CAP-API-AUTH-ORG-ID":t,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":Pa.WEBPUSH},[4,this.httpClient.get(ou,{headers:n})];case 2:return i=s.sent(),this.logger.info(ta,{isEnabled:null===(e=i.data)||void 0===e?void 0:e.visitorTrackingEnabled,warningCount:(null===(o=i.warnings)||void 0===o?void 0:o.length)||0}),[2,i];case 3:throw r=s.sent(),this.logger.error(na,r),r;case 4:return[2]}})})},t.prototype.createVisitor=function(t,n){return Qs(this,void 0,void 0,function(){var i,r,e,o,s;return Zs(this,function(u){switch(u.label){case 0:this.logger.info("Creating anonymous visitor",{orgId:t,profileCount:n.profiles.length,hasExtendedFields:!!n.extendedFields}),u.label=1;case 1:if(u.trys.push([1,3,,4]),!n.profiles||0===n.profiles.length)throw new Error("At least one profile is required");return i={"X-CAP-API-AUTH-ORG-ID":t,"X-CAP-SOURCE-NAME":this.source,"X-CAP-ORG-ACCOUNT-ID":this.accountId},[4,this.httpClient.post(su,n,{headers:i})];case 2:return r=u.sent(),this.logger.info(sa,{visitorId:null===(o=r.data)||void 0===o?void 0:o.id,warningCount:(null===(s=r.warnings)||void 0===s?void 0:s.length)||0}),[2,r];case 3:throw e=u.sent(),this.logger.error(ua,{error:e,accountId:this.accountId}),e;case 4:return[2]}})})},t.prototype.updateVisitor=function(t,n,i){return Qs(this,void 0,void 0,function(){var r,e,o,s,u,a;return Zs(this,function(c){switch(c.label){case 0:this.logger.info("Updating visitor",{orgId:t,visitorId:n,profileCount:i.profiles.length,hasExtendedFields:!!i.extendedFields}),c.label=1;case 1:if(c.trys.push([1,3,,4]),!i.profiles||0===i.profiles.length)throw new Error("At least one profile is required");if(!n||""===n.trim())throw new Error("Visitor ID is required for update");return r={"X-CAP-API-AUTH-ORG-ID":t,"X-CAP-SOURCE-NAME":this.source,"X-CAP-ORG-ACCOUNT-ID":this.accountId},e="".concat(uu,"?identifierType=visitorId&identifierValue=").concat(encodeURIComponent(n)),[4,this.httpClient.put(e,i,{headers:r})];case 2:return o=c.sent(),this.logger.info(fa,{visitorId:null===(u=o.data)||void 0===u?void 0:u.id,warningCount:(null===(a=o.warnings)||void 0===a?void 0:a.length)||0}),[2,o];case 3:throw s=c.sent(),this.logger.error(ha,{error:s,visitorId:n,accountId:this.accountId}),s;case 4:return[2]}})})},t.prototype.buildMergeIdentifiers=function(t,n,i){var r=[];return t&&r.push({type:"email",value:t}),n&&r.push({type:"mobile",value:n}),i&&r.push({type:"externalId",value:i}),r},t.prototype.handleMergeResponse=function(t,n){var i,r=this;if(t.warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){r.logger.warn("Visitor merge warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0){var e=t.errors[0],o=e.code,s=e.message,u=String(o);if(u===Ga.ALREADY_MERGED)return void this.logger.info("Visitor already merged, treating as success",{visitorId:n});if(u===Ga.VISITOR_NOT_FOUND)throw this.logger.warn("Visitor not found, merge cannot proceed",{visitorId:n}),new bp(u,s);throw new Error("Merge API error: [".concat(u,"] ").concat(s))}if(202!==(null===(i=t.status)||void 0===i?void 0:i.code))throw new Error("Unexpected merge API response");this.logger.info(da,{visitorId:n,statusCode:t.status.code,message:t.status.message})},t.prototype.mergeVisitor=function(t,n,i){return Qs(this,void 0,void 0,function(){var r,e,o,s,u,a,c,f,h,d,v,l,g,m,p,w,y,b,E,_,I,T,S;return Zs(this,function(A){switch(A.label){case 0:if(r=i.firstName,e=i.lastName,o=i.email,s=i.mobile,u=i.fcmToken,a=i.channelType,c=i.subscribed,f=void 0===c||c,h=i.fields,d=i.extendedFields,v=i.externalId,l=i.sessionId,g=void 0===l?"":l,!o&&!s&&!v)throw new Error("At least one identifier (email, mobile, or externalId) is required for visitor merge");if(!t&&!n)throw new Error("Either visitorId or visitorExternalId is required for visitor merge");return this.logger.info("Merging visitor with user",{visitorId:t,visitorExternalId:n,hasEmail:!!o,hasMobile:!!s,hasExternalId:!!v,hasFcmToken:!!u}),m=this.buildMergeIdentifiers(o,s,v),p=a||La.WEB,w=[],u&&w.push({type:p,value:u,primary:!0,verified:!0,subscribed:f}),S={visitor:t?{identifierName:"id",identifierValue:t}:{identifierName:"externalId",identifierValue:n},user:{profiles:[{firstName:r,lastName:e,identifiers:m,commChannels:w,fields:h||{}}],extendedFields:d||{}}},b=km,E=[g],[4,Lm()];case 1:S.context=b.apply(void 0,E.concat([A.sent()])),y=S,A.label=2;case 2:return A.trys.push([2,4,,5]),_={"X-CAP-API-AUTH-ORG-ID":this.orgId,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":this.source},[4,this.httpClient.post(au,y,{headers:_})];case 3:return I=A.sent(),this.handleMergeResponse(I,t),[3,5];case 4:if((T=A.sent())instanceof bp)throw T;throw this.logger.error(va,{visitorId:t,error:T}),T;case 5:return[2]}})})},t.prototype.buildUserEventsRequest=function(t,n,i){return Qs(this,void 0,void 0,function(){var r,e;return Zs(this,function(o){switch(o.label){case 0:return[4,Lm()];case 1:return r=o.sent(),e=km(i,r),[2,{request_id:ym(),context:Js(Js({},e),{os_name:Na}),events:[{name:t,eventExternalId:ym(),eventDateTime:(new Date).toISOString(),attributes:n}]}]}})})},t.prototype.sendUserEvents=function(t,n,i,r,e){return Qs(this,void 0,void 0,function(){var o,s,u,a,c;return Zs(this,function(f){switch(f.label){case 0:n?t.visitor={identifierName:"id",identifierValue:n}:i&&(t.visitor={identifierName:"externalId",identifierValue:i}),r&&e&&(t.user={identifierName:e,identifierValue:r}),this.logger.info("Sending user event",{eventName:null===(u=t.events[0])||void 0===u?void 0:u.name,requestId:t.request_id,hasVisitor:!!t.visitor,hasUser:!!t.user}),f.label=1;case 1:return f.trys.push([1,3,,4]),o={"X-CAP-API-AUTH-ORG-ID":this.orgId,"X-CAP-ORG-ACCOUNT-ID":this.accountId,"X-CAP-SOURCE-NAME":this.source,"X-CAP-API-AUTH-ENTITY-ID":this.orgId},[4,this.httpClient.post(eu,t,{headers:o})];case 2:return f.sent(),this.logger.info("User event sent successfully",{eventName:null===(a=t.events[0])||void 0===a?void 0:a.name,requestId:t.request_id}),[3,4];case 3:throw s=f.sent(),this.logger.error("Failed to send user event",{eventName:null===(c=t.events[0])||void 0===c?void 0:c.name,requestId:t.request_id,error:s}),s;case 4:return[2]}})})},t.prototype.sendDLR=function(t){return Qs(this,void 0,void 0,function(){var n,i,r,e,o;return Zs(this,function(s){switch(s.label){case 0:this.logger.info("Sending DLR events",{eventCount:t.events.length,requestId:t.request_id,cuid:null===(e=t.user)||void 0===e?void 0:e.identifierValue,visitorId:null===(o=t.visitor)||void 0===o?void 0:o.identifierValue}),s.label=1;case 1:return s.trys.push([1,3,,4]),n={"x-cap-api-auth-org-id":this.orgId,"x-cap-request-id":t.request_id},[4,this.httpClient.post(cu,t,{headers:n})];case 2:return i=s.sent(),this.logger.info(Aa,{requestId:t.request_id,eventCount:t.events.length,success:i.status.success}),[2,i];case 3:throw r=s.sent(),this.logger.error(Oa,{requestId:t.request_id,eventCount:t.events.length,error:r}),r;case 4:return[2]}})})},t}(),bp=function(t){function n(n,i){var r=t.call(this,i)||this;return r.name="MergeNonRetryableError",r.code=n,r}return Ys(n,t),n}(Error);var Ep;Ep||(Ep=1,Sr()({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991}));var _p,Ip,Tp,Sp={};!function(){if(Tp)return Sp;Tp=1;var t=Sr(),n=function(){if(Ip)return _p;Ip=1;var t=k(),n=G(),i=Rt(),r=of(),e=Dv().trim,o=kv(),s=t.parseInt,u=t.Symbol,a=u&&u.iterator,c=/^[+-]?0x/i,f=i(c.exec),h=8!==s(o+"08")||22!==s(o+"0x16")||a&&!n(function(){s(Object(a))});return _p=h?function(t,n){var i=e(r(t));return s(i,n>>>0||(f(c,i)?16:10))}:s}();t({global:!0,forced:parseInt!==n},{parseInt:n})}();var Ap,Op=function(){function t(t,n,i){void 0===t&&(t="WebSDK"),void 0===n&&(n=2),void 0===i&&(i="data"),this.db=null,this.dbName=t,this.version=n,this.storeName=i,this.eventsStoreName="events"}return t.prototype.openDB=function(){return Qs(this,void 0,void 0,function(){var t=this;return Zs(this,function(n){return this.db?[2,this.db]:[2,new Promise(function(n,i){var r=indexedDB.open(t.dbName,t.version);r.onerror=function(){return i(r.error)},r.onsuccess=function(){t.db=r.result,n(t.db)},r.onupgradeneeded=function(n){var i=n.target.result;if(i.objectStoreNames.contains(t.storeName)||i.createObjectStore(t.storeName),!i.objectStoreNames.contains(t.eventsStoreName)){var r=i.createObjectStore(t.eventsStoreName,{keyPath:"id"});r.createIndex("timestamp","timestamp",{unique:!1}),r.createIndex("status","status",{unique:!1})}}})]})})},t.prototype.getItem=function(t){return Qs(this,void 0,void 0,function(){var n,i=this;return Zs(this,function(r){switch(r.label){case 0:return[4,this.openDB()];case 1:return n=r.sent(),[2,new Promise(function(r,e){var o=n.transaction([i.storeName],"readonly").objectStore(i.storeName).get(t);o.onerror=function(){return e(o.error)},o.onsuccess=function(){var t=o.result;r(null==t?null:"string"==typeof t?t:"object"===Ha(t)?JSON.stringify(t):String(t))}})]}})})},t.prototype.setItem=function(t,n){return Qs(this,void 0,void 0,function(){var i,r=this;return Zs(this,function(e){switch(e.label){case 0:return[4,this.openDB()];case 1:return i=e.sent(),[2,new Promise(function(e,o){var s=i.transaction([r.storeName],"readwrite").objectStore(r.storeName).put(n,t);s.onerror=function(){return o(s.error)},s.onsuccess=function(){return e()}})]}})})},t.prototype.removeItem=function(t){return Qs(this,void 0,void 0,function(){var n,i=this;return Zs(this,function(r){switch(r.label){case 0:return[4,this.openDB()];case 1:return n=r.sent(),[2,new Promise(function(r,e){var o=n.transaction([i.storeName],"readwrite").objectStore(i.storeName).delete(t);o.onerror=function(){return e(o.error)},o.onsuccess=function(){return r()}})]}})})},t.prototype.clear=function(){return Qs(this,void 0,void 0,function(){var t,n=this;return Zs(this,function(i){switch(i.label){case 0:return[4,this.openDB()];case 1:return t=i.sent(),[2,new Promise(function(i,r){var e=t.transaction([n.storeName],"readwrite").objectStore(n.storeName).clear();e.onerror=function(){return r(e.error)},e.onsuccess=function(){return i()}})]}})})},t.prototype.close=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){return this.db&&(this.db.close(),this.db=null),[2]})})},t.prototype.addEvent=function(t){return Qs(this,void 0,void 0,function(){var n,i=this;return Zs(this,function(r){switch(r.label){case 0:return[4,this.openDB()];case 1:return n=r.sent(),[2,new Promise(function(r,e){var o=n.transaction([i.eventsStoreName],"readwrite").objectStore(i.eventsStoreName).add(t);o.onerror=function(){return e(o.error)},o.onsuccess=function(){return r()}})]}})})},t.prototype.getOldestPendingEvents=function(t){return Qs(this,arguments,void 0,function(t,n){var i,r=this;return void 0===n&&(n=50),Zs(this,function(e){switch(e.label){case 0:return[4,this.openDB()];case 1:return i=e.sent(),[2,new Promise(function(e,o){var s=i.transaction([r.eventsStoreName],"readonly").objectStore(r.eventsStoreName).index("timestamp").openCursor(),u=[],a=0;s.onerror=function(){return o(s.error)},s.onsuccess=function(i){var r=i.target.result;if(r&&a<n){var o=r.value;"pending"===o.status&&o.accountId===t&&(u.push(o),a++),r.continue()}else e(u)}})]}})})},t.prototype.updateEventStatus=function(t,n,i,r){return Qs(this,void 0,void 0,function(){var e,o=this;return Zs(this,function(s){switch(s.label){case 0:return[4,this.openDB()];case 1:return e=s.sent(),[2,new Promise(function(s,u){var a=e.transaction([o.eventsStoreName],"readwrite").objectStore(o.eventsStoreName),c=a.get(t);c.onerror=function(){return u(c.error)},c.onsuccess=function(){var e=c.result;if(e){e.status=n,e.lastAttempt=Date.now(),i&&(e.error=i),void 0!==r&&(e.attempts=r);var o=a.put(e);o.onerror=function(){return u(o.error)},o.onsuccess=function(){return s()}}else u(new Error("Event with id ".concat(t," not found")))}})]}})})},t.prototype.removeEvents=function(t){return Qs(this,void 0,void 0,function(){var n,i=this;return Zs(this,function(r){switch(r.label){case 0:return[4,this.openDB()];case 1:return n=r.sent(),[2,new Promise(function(r,e){var o=n.transaction([i.eventsStoreName],"readwrite").objectStore(i.eventsStoreName),s=0,u=t.length;0!==u?t.forEach(function(t){var n=o.delete(t);n.onerror=function(){return e(n.error)},n.onsuccess=function(){++s===u&&r()}}):r()})]}})})},t.prototype.recoverOrphanedEvents=function(t){return Qs(this,void 0,void 0,function(){var n,i=this;return Zs(this,function(r){switch(r.label){case 0:return[4,this.openDB()];case 1:return n=r.sent(),[2,new Promise(function(r,e){var o=n.transaction([i.eventsStoreName],"readwrite").objectStore(i.eventsStoreName).openCursor(),s=0;o.onerror=function(){return e(o.error)},o.onsuccess=function(n){var i=n.target.result;if(i){var e=i.value;if("processing"===e.status&&e.accountId===t)e.status="failed",e.lastAttempt=Date.now(),e.error="Recovered from orphaned processing state",i.update(e).onsuccess=function(){s++};i.continue()}else r(s)}})]}})})},t.prototype.getPendingEventCount=function(t){return Qs(this,void 0,void 0,function(){var n,i=this;return Zs(this,function(r){switch(r.label){case 0:return[4,this.openDB()];case 1:return n=r.sent(),[2,new Promise(function(r,e){var o=n.transaction([i.eventsStoreName],"readonly").objectStore(i.eventsStoreName).openCursor(),s=0;o.onerror=function(){return e(o.error)},o.onsuccess=function(n){var i=n.target.result;if(i){var e=i.value;"pending"===e.status&&e.accountId===t&&s++,i.continue()}else r(s)}})]}})})},t.prototype.getRetryableEvents=function(t){return Qs(this,arguments,void 0,function(t,n){var i,r=this;return void 0===n&&(n=5),Zs(this,function(e){switch(e.label){case 0:return[4,this.openDB()];case 1:return i=e.sent(),[2,new Promise(function(e,o){var s=i.transaction([r.eventsStoreName],"readonly").objectStore(r.eventsStoreName).openCursor(),u=[];s.onerror=function(){return o(s.error)},s.onsuccess=function(i){var r=i.target.result;if(r){var o=r.value;"failed"===o.status&&o.attempts<=n&&o.accountId===t&&u.push(o),r.continue()}else e(u)}})]}})})},t}(),Np=function(){function t(t,n,i,r,e){if(this.currentAccountId=null,this.currentCuid=null,this.currentUserIdentifierType=null,this.currentVisitorId=null,this.currentVisitorExternalId=null,this.getSessionInfo=null,this.isProcessing=!1,this.processingPromise=null,this.paused=!1,this.apiClient=t,this.logger=n,this.BATCH_SIZE=e||hu.BATCH_SIZE,this.RETRY_DELAYS=r||hu.DEFAULT_RETRY_DELAYS,i&&"getIndexedDBAdapter"in i){var o=i.getIndexedDBAdapter();o?(n.info("EventQueue: Reusing existing IndexedDB adapter from StorageManager"),this.storage=o):(n.warn("EventQueue: StorageManager has no IndexedDB adapter, creating new one"),this.storage=new Op)}else i?(n.info("EventQueue: Using provided IndexedDBStorage"),this.storage=i):(n.warn("EventQueue: No storage provided, creating new IndexedDBStorage"),this.storage=new Op)}return t.prototype.init=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.logger.info("Initializing EventQueue"),[4,this.processQueueIfIdle()];case 1:return t.sent(),this.logger.info("EventQueue initialized successfully"),[2]}})})},t.prototype.setUserContext=function(t,n,i){return Qs(this,void 0,void 0,function(){var r;return Zs(this,function(e){switch(e.label){case 0:return this.currentAccountId=t,this.currentCuid=n||null,this.currentUserIdentifierType=i||null,this.logger.debug("EventQueue user context set",{accountId:t,cuid:n,userIdentifierType:i}),[4,this.storage.recoverOrphanedEvents(t)];case 1:return(r=e.sent())>0&&this.logger.info("Recovered ".concat(r," orphaned processing events for account ").concat(t)),[2]}})})},t.prototype.setVisitorContext=function(t,n){this.currentVisitorId=t,this.currentVisitorExternalId=null!=n?n:null,this.logger.debug("EventQueue visitor context set",{visitorId:t,visitorExternalId:n})},t.prototype.setSessionInfoCallback=function(t){this.getSessionInfo=t,this.logger.debug("EventQueue session info callback set")},t.prototype.getCurrentAccountId=function(){return this.currentAccountId},t.prototype.getCurrentCuid=function(){return this.currentCuid},t.prototype.getCurrentVisitorId=function(){return this.currentVisitorId},t.prototype.clearUserContext=function(){this.currentCuid=null,this.currentUserIdentifierType=null,this.logger.debug("EventQueue user context cleared (cuid removed)")},t.prototype.enqueue=function(t){return Qs(this,arguments,void 0,function(t,n){var i,r,e,o;return void 0===n&&(n=!1),Zs(this,function(s){switch(s.label){case 0:if(s.trys.push([0,7,,8]),!this.currentAccountId)throw new Error("Cannot enqueue event: No account context set");if(i=null,!this.getSessionInfo)return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.getSessionInfo()];case 2:return i=s.sent(),[3,4];case 3:return r=s.sent(),this.logger.warn("Failed to resolve session ID at enqueue time",r),[3,4];case 4:return e={id:ym(),event:t,accountId:this.currentAccountId,timestamp:(new Date).toISOString(),attempts:0,status:hu.STATUSES.PENDING,visitorId:this.currentVisitorId,visitorExternalId:this.currentVisitorExternalId,cuid:this.currentCuid,userIdentifierType:this.currentUserIdentifierType,sessionId:i,isDLR:n},[4,this.storage.addEvent(e)];case 5:return s.sent(),this.logger.debug("Event added to queue",{eventId:e.id,eventName:t.name,visitorId:e.visitorId,cuid:e.cuid,sessionId:e.sessionId,isDLR:n}),[4,this.processQueueIfIdle()];case 6:return s.sent(),[3,8];case 7:throw o=s.sent(),this.logger.error("Failed to enqueue event",{event:t,error:o}),o;case 8:return[2]}})})},t.prototype.processQueueIfIdle=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){return this.paused?(this.logger.debug("Queue processing paused, skipping"),[2]):this.isProcessing?(this.logger.debug("Queue processing already in progress, skipping"),[2]):(this.processingPromise||(this.processingPromise=this.processQueue()),[2,this.processingPromise])})})},t.prototype.getIdentityKey=function(t){var n,i,r,e,o,s=null!==(n=t.visitorId)&&void 0!==n?n:"_none_",u=null!==(i=t.visitorExternalId)&&void 0!==i?i:"_none_",a=null!==(r=t.cuid)&&void 0!==r?r:"_none_",c=null!==(e=t.userIdentifierType)&&void 0!==e?e:"_none_",f=null!==(o=t.sessionId)&&void 0!==o?o:"_none_";return"".concat(s,"|").concat(u,"|").concat(a,"|").concat(c,"|").concat(f)},t.prototype.groupEventsByIdentity=function(t){var n,i,r=new Map;try{for(var e=tu(t),o=e.next();!o.done;o=e.next()){var s=o.value,u=this.getIdentityKey(s),a=r.get(u);a?a.push(s):r.set(u,[s])}}catch(t){n={error:t}}finally{try{o&&!o.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return Array.from(r.values())},t.prototype.processQueue=function(){return Qs(this,void 0,void 0,function(){var n=this;return Zs(this,function(i){switch(i.label){case 0:return this.isProcessing?[2]:"undefined"!=typeof navigator&&"locks"in navigator?[4,navigator.locks.request(t.QUEUE_LOCK_NAME,{ifAvailable:!0},function(t){return Qs(n,void 0,void 0,function(){return Zs(this,function(n){switch(n.label){case 0:return t?[4,this.executeProcessQueue()]:(this.logger.debug("Queue lock held by another tab, skipping"),[2]);case 1:return n.sent(),[2]}})})})]:[3,2];case 1:return i.sent(),[3,4];case 2:return[4,this.executeProcessQueue()];case 3:i.sent(),i.label=4;case 4:return[2]}})})},t.prototype.executeProcessQueue=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e,o,s,u,a,c;return Zs(this,function(f){switch(f.label){case 0:this.isProcessing=!0,this.logger.debug("Starting queue processing"),f.label=1;case 1:f.trys.push([1,16,17,18]),f.label=2;case 2:return this.paused?(this.logger.debug("Queue processing paused mid-cycle, stopping"),[3,15]):[4,this.checkAndPromoteRetryEvents()];case 3:return f.sent(),this.currentAccountId?[4,this.storage.getOldestPendingEvents(this.currentAccountId,this.BATCH_SIZE)]:(this.logger.debug("No account context, skipping event processing"),[3,15]);case 4:if(0===(t=f.sent()).length)return this.logger.debug("No pending events to process"),[3,15];n=this.groupEventsByIdentity(t),this.logger.info("Processing events",{totalEvents:t.length,identityGroups:n.length}),f.label=5;case 5:f.trys.push([5,11,12,13]),a=void 0,i=tu(n),r=i.next(),f.label=6;case 6:return r.done?[3,10]:(e=r.value,o=e[0],this.logger.debug("Processing identity group",{batchSize:e.length,visitorId:null==o?void 0:o.visitorId,cuid:null==o?void 0:o.cuid,sessionId:null==o?void 0:o.sessionId}),[4,this.markEventsAsProcessing(e)]);case 7:return f.sent(),[4,this.sendBatch(e)];case 8:f.sent(),f.label=9;case 9:return r=i.next(),[3,6];case 10:return[3,13];case 11:return s=f.sent(),a={error:s},[3,13];case 12:try{r&&!r.done&&(c=i.return)&&c.call(i)}finally{if(a)throw a.error}return[7];case 13:return[4,this.storage.getPendingEventCount(this.currentAccountId)];case 14:return 0===f.sent()?(this.logger.debug("No more pending events"),[3,15]):[3,2];case 15:return[3,18];case 16:return u=f.sent(),this.logger.error("Queue processing failed",u),[3,18];case 17:return this.isProcessing=!1,this.processingPromise=null,this.logger.debug("Queue processing completed"),[7];case 18:return[2]}})})},t.prototype.markEventsAsProcessing=function(t){return Qs(this,void 0,void 0,function(){var n,i,r,e,o,s,u;return Zs(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),n=tu(t),i=n.next(),a.label=1;case 1:if(i.done)return[3,6];r=i.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.storage.updateEventStatus(r.id,"processing")];case 3:return a.sent(),[3,5];case 4:return e=a.sent(),this.logger.warn("Failed to mark event as processing",{eventId:r.id,error:e}),[3,5];case 5:return i=n.next(),[3,1];case 6:return[3,9];case 7:return o=a.sent(),s={error:o},[3,9];case 8:try{i&&!i.done&&(u=n.return)&&u.call(n)}finally{if(s)throw s.error}return[7];case 9:return[2]}})})},t.prototype.sendBatch=function(t){return Qs(this,void 0,void 0,function(){var n,i,r,e,o,s,u,a,c;return Zs(this,function(f){switch(f.label){case 0:if(f.trys.push([0,5,,10]),!this.currentAccountId)throw new Error("Missing account context for batch sending");return n=t[0],i=!!(null!==(c=n.visitorId)&&void 0!==c?c:n.visitorExternalId),r=!!n.cuid,e=void 0,e=i&&r?"identified":i?"anonymous":"user-only",this.logger.debug("Sending event batch",{batchSize:t.length,trackingMode:e,hasVisitor:i,hasUser:r}),o=t.filter(function(t){return!0===t.isDLR}),(s=t.filter(function(t){return!0!==t.isDLR})).length>0?[4,this.sendRegularEvents(s)]:[3,2];case 1:f.sent(),f.label=2;case 2:return o.length>0?[4,this.sendDLREvents(o)]:[3,4];case 3:f.sent(),f.label=4;case 4:return[2,!0];case 5:return u=f.sent(),a=this.isRetryableHttpError(u),this.logger.error("Failed to send batch",{batchSize:t.length,error:u,isRetryable:a}),a?[4,this.handleFailedBatch(t)]:[3,7];case 6:return f.sent(),[3,9];case 7:return[4,this.removeNonRetryableEvents(t)];case 8:f.sent(),f.label=9;case 9:return[2,!1];case 10:return[2]}})})},t.prototype.sendRegularEvents=function(t){return Qs(this,void 0,void 0,function(){var n,i,r,e,o,s,u,a,c,f,h,d,v,l;return Zs(this,function(g){switch(g.label){case 0:if(n=t[0],i=null!==(f=n.visitorId)&&void 0!==f?f:null,r=null!==(h=n.visitorExternalId)&&void 0!==h?h:null,e=null!==(d=n.cuid)&&void 0!==d?d:null,o=null!==(v=n.userIdentifierType)&&void 0!==v?v:null,s=null!==(l=n.sessionId)&&void 0!==l?l:null,u=this.apiClient,a=t.map(function(t){return t.event}),!s)throw new Error("Session ID is required for event tracking");return[4,u.sendEvents(a,i||void 0,r||void 0,e||void 0,o||void 0,s)];case 1:return c=g.sent(),[4,this.handleBatchResponse(t,c)];case 2:return g.sent(),[2]}})})},t.prototype.sendDLREvents=function(t){return Qs(this,void 0,void 0,function(){var n,i,r,e,o,s,u,a;return Zs(this,function(c){switch(c.label){case 0:return n=t[0],i=this.apiClient,r=null!==(a=n.sessionId)&&void 0!==a?a:"",[4,Lm()];case 1:return e=c.sent(),o=km(r,e),s={events:t.map(function(t){var n=t.event,i=n.eventExternalId,r=function(t,n){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var e=0;for(r=Object.getOwnPropertySymbols(t);e<r.length;e++)n.indexOf(r[e])<0&&Object.prototype.propertyIsEnumerable.call(t,r[e])&&(i[r[e]]=t[r[e]])}return i}(n,["eventExternalId"]);return Js(Js({},r),{eventRefId:i})}),request_id:ym(),system_data:o},n.cuid?s.user={identifierName:"id",identifierValue:n.cuid}:n.visitorId&&(s.visitor={identifierName:"id",identifierValue:n.visitorId}),[4,i.sendDLR(s)];case 2:return u=c.sent(),[4,this.handleBatchResponse(t,u,hu.DLR_SUCCESS_CODE)];case 3:return c.sent(),[2]}})})},t.prototype.removeSuccessfulEvents=function(t){return Qs(this,void 0,void 0,function(){var n,i;return Zs(this,function(r){switch(r.label){case 0:n=t.map(function(t){return t.id}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.storage.removeEvents(n)];case 2:return r.sent(),this.logger.debug("Successfully removed events from storage",{count:n.length}),[3,4];case 3:return i=r.sent(),this.logger.error("Failed to remove events from storage",{eventIds:n,error:i}),[3,4];case 4:return[2]}})})},t.prototype.handleBatchResponse=function(t,n){return Qs(this,arguments,void 0,function(t,n,i){var r;return void 0===i&&(i=hu.GLOBAL_SUCCESS_CODE),Zs(this,function(e){switch(e.label){case 0:return(r=parseInt(n.status.code,10))!==i?[3,2]:[4,this.removeSuccessfulEvents(t)];case 1:return e.sent(),this.logger.info("All events processed successfully",{count:t.length}),[3,8];case 2:return r!==hu.PARTIAL_SUCCESS_CODE?[3,4]:[4,this.handlePartialSuccess(t,n.events)];case 3:return e.sent(),[3,8];case 4:return hu.RETRYABLE_HTTP_CODES.includes(r)?[4,this.handleFailedBatch(t)]:[3,6];case 5:return e.sent(),this.logger.warn("Batch failed with retryable error",{code:r,message:n.status.message}),[3,8];case 6:return[4,this.removeNonRetryableEvents(t)];case 7:e.sent(),this.logger.error("Batch failed with non-retryable error",{code:r,message:n.status.message}),e.label=8;case 8:return[2]}})})},t.prototype.handlePartialSuccess=function(t,n){return Qs(this,void 0,void 0,function(){var i,r,e,o,s,u,a,c,f;return Zs(this,function(h){switch(h.label){case 0:i=new Map,n.forEach(function(t){i.set(t.eventExternalId,t)}),h.label=1;case 1:h.trys.push([1,12,13,14]),r=tu(t),e=r.next(),h.label=2;case 2:return e.done?[3,11]:(o=e.value,(s=i.get(o.event.eventExternalId))?[3,4]:[4,this.markEventForRetry(o,"No response received")]);case 3:return h.sent(),[3,10];case 4:return s.status.success?[4,this.storage.removeEvents([o.id])]:[3,6];case 5:return h.sent(),this.logger.debug("Event processed successfully",{eventId:o.id}),[3,10];case 6:return u=parseInt(s.status.code,10),hu.RETRYABLE_HTTP_CODES.includes(u)?[4,this.markEventForRetry(o,s.status.message)]:[3,8];case 7:return h.sent(),this.logger.debug("Event marked for retry",{eventId:o.id,code:u,message:s.status.message}),[3,10];case 8:return[4,this.storage.removeEvents([o.id])];case 9:h.sent(),this.logger.warn("Event permanently failed - removed",{eventId:o.id,code:u,message:s.status.message}),h.label=10;case 10:return e=r.next(),[3,2];case 11:return[3,14];case 12:return a=h.sent(),c={error:a},[3,14];case 13:try{e&&!e.done&&(f=r.return)&&f.call(r)}finally{if(c)throw c.error}return[7];case 14:return[2]}})})},t.prototype.markEventForRetry=function(t,n){return Qs(this,void 0,void 0,function(){var i,r,e;return Zs(this,function(o){switch(o.label){case 0:return i=(t.attempts||0)+1,[4,this.storage.updateEventStatus(t.id,"failed","Attempt ".concat(i," failed: ").concat(n),i)];case 1:return o.sent(),r=Math.min(Math.max(i-1,0),this.RETRY_DELAYS.length-1),e=this.RETRY_DELAYS[r],this.logger.debug("Event marked for retry",{eventId:t.id,attempts:i,delay:e,isInfiniteRetry:i>this.RETRY_DELAYS.length}),[2]}})})},t.prototype.checkAndPromoteRetryEvents=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e,o,s,u,a,c,f,h;return Zs(this,function(d){switch(d.label){case 0:return d.trys.push([0,10,,11]),this.currentAccountId?[4,this.storage.getRetryableEvents(this.currentAccountId,Number.MAX_SAFE_INTEGER)]:(this.logger.debug("No account context, skipping retry check"),[2]);case 1:if(0===(t=d.sent()).length)return[2];n=0,d.label=2;case 2:d.trys.push([2,7,8,9]),i=tu(t),r=i.next(),d.label=3;case 3:return r.done?[3,6]:(e=r.value,o=Math.min(Math.max(e.attempts-1,0),this.RETRY_DELAYS.length-1),s=this.RETRY_DELAYS[o],(u=Date.now()-(e.lastAttempt||0))>=(s||0)?[4,this.storage.updateEventStatus(e.id,"pending")]:[3,5]);case 4:d.sent(),n++,this.logger.debug("Failed event promoted to pending",{eventId:e.id,attempt:e.attempts+1,delay:s,timeSinceLastAttempt:u}),d.label=5;case 5:return r=i.next(),[3,3];case 6:return[3,9];case 7:return a=d.sent(),f={error:a},[3,9];case 8:try{r&&!r.done&&(h=i.return)&&h.call(i)}finally{if(f)throw f.error}return[7];case 9:return n>0&&this.logger.debug("Promoted ".concat(n," failed events for retry")),[3,11];case 10:return c=d.sent(),this.logger.error("Failed to check retry events",c),[3,11];case 11:return[2]}})})},t.prototype.isRetryableHttpError=function(t){var n,i,r,e,o=t;if(o.code){var s=parseInt(o.code,10);return hu.RETRYABLE_HTTP_CODES.includes(s)}return null!==(e=(null===(n=o.message)||void 0===n?void 0:n.includes("network"))||(null===(i=o.message)||void 0===i?void 0:i.includes("timeout"))||(null===(r=o.message)||void 0===r?void 0:r.includes("fetch")))&&void 0!==e&&e},t.prototype.removeNonRetryableEvents=function(t){return Qs(this,void 0,void 0,function(){var n,i;return Zs(this,function(r){switch(r.label){case 0:n=t.map(function(t){return t.id}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.storage.removeEvents(n)];case 2:return r.sent(),this.logger.warn("Non-retryable events removed permanently",{eventIds:n}),[3,4];case 3:return i=r.sent(),this.logger.error("Failed to remove non-retryable events",{eventIds:n,error:i}),[3,4];case 4:return[2]}})})},t.prototype.handleFailedBatch=function(t){return Qs(this,void 0,void 0,function(){var n,i,r,e,o,s,u;return Zs(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),n=tu(t),i=n.next(),a.label=1;case 1:if(i.done)return[3,6];r=i.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.markEventForRetry(r,"Batch failed")];case 3:return a.sent(),[3,5];case 4:return e=a.sent(),this.logger.error("Failed to mark event for retry",{eventId:r.id,error:e}),[3,5];case 5:return i=n.next(),[3,1];case 6:return[3,9];case 7:return o=a.sent(),s={error:o},[3,9];case 8:try{i&&!i.done&&(u=n.return)&&u.call(n)}finally{if(s)throw s.error}return[7];case 9:return[2]}})})},t.prototype.pause=function(){this.paused=!0,this.logger.info("EventQueue paused")},t.prototype.resume=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.paused=!1,this.logger.info("EventQueue resumed"),[4,this.processQueueIfIdle()];case 1:return t.sent(),[2]}})})},t.prototype.flush=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.logger.info("Manual flush requested"),[4,this.processQueueIfIdle()];case 1:return t.sent(),[2]}})})},t.prototype.destroy=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.logger.info("Destroying EventQueue"),this.processingPromise?[4,this.processingPromise]:[3,2];case 1:t.sent(),t.label=2;case 2:return[4,this.storage.close()];case 3:return t.sent(),this.logger.info("EventQueue destroyed"),[2]}})})},t.QUEUE_LOCK_NAME="websdk-event-queue-lock",t}(),kp=function(){function t(t,n,i,r){this.eventQueue=null,this.initialized=!1,this.visitorId=null,this.visitorTrackingEnabled=null,this.config=t,this.logger=r,this.apiClient=n,this.storageManager=i}return t.prototype.init=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.initialized?(this.logger.warn("EventTracker already initialized"),[2]):(this.logger.info("Initializing EventTracker with IndexedDB queue"),this.eventQueue=new Np(this.apiClient,this.logger,this.storageManager,this.config.retryDelays,this.config.batchSize),[4,this.eventQueue.init()]);case 1:return t.sent(),this.initialized=!0,this.logger.info(Ru),[2]}})})},t.prototype.setUserContext=function(t,n,i){return Qs(this,void 0,void 0,function(){return Zs(this,function(r){switch(r.label){case 0:if(!this.eventQueue)throw new Error("EventTracker not initialized");return[4,this.eventQueue.setUserContext(t,n,i)];case 1:return r.sent(),this.logger.info("User context set",{accountId:t,cuid:n,userIdentifierType:i}),[2]}})})},t.prototype.setVisitorTrackingState=function(t,n,i){this.visitorId=t,this.visitorTrackingEnabled=n,this.eventQueue&&this.eventQueue.setVisitorContext(t,i),this.logger.debug("Visitor tracking state updated",{visitorId:t,visitorExternalId:i,isEnabled:n,trackingMode:t?"anonymous":"not-configured"})},t.prototype.setSessionInfoCallback=function(t){if(!this.eventQueue)throw new Error("EventTracker not initialized");this.eventQueue.setSessionInfoCallback(t),this.logger.debug("Session info callback set in EventTracker")},t.prototype.clearUserContext=function(){this.eventQueue?(this.eventQueue.clearUserContext(),this.logger.info("User context cleared from EventTracker")):this.logger.warn("Cannot clear user context - EventTracker not initialized")},t.prototype.track=function(t){return Qs(this,void 0,void 0,function(){var n,i;return Zs(this,function(r){switch(r.label){case 0:if(!this.initialized||!this.eventQueue)throw new Error("EventTracker not initialized");if(!1===this.visitorTrackingEnabled)throw this.logger.warn("Event tracking is disabled - visitor tracking is not enabled"),new Error("Event tracking is disabled");this.logger.debug("Tracking event",{event:t}),r.label=1;case 1:return r.trys.push([1,3,,4]),n=this.convertToApiEvent(t),[4,this.eventQueue.enqueue(n)];case 2:return r.sent(),[3,4];case 3:throw i=r.sent(),this.logger.error(Uu,{event:t,error:i}),new Error("".concat(bu,": ").concat(i));case 4:return[2]}})})},t.prototype.convertToApiEvent=function(t){if(!t.name||""===t.name.trim())throw new Error("Event name is required");var n=Js({},t.data);if(!this.eventQueue)throw new Error("EventTracker not initialized");var i,r=this.eventQueue.getCurrentCuid();if(!r&&!this.visitorId){var e=null===this.visitorTrackingEnabled?"Cannot track event: User must be identified (cuid) or visitor tracking must be configured":"Cannot track event: Either visitor tracking must be enabled or user must be identified";throw this.logger.error(e,{hasVisitorId:!!this.visitorId,hasCuid:!1,visitorTrackingEnabled:this.visitorTrackingEnabled}),new Error(e)}return i=this.visitorId&&r?"identified":this.visitorId?"anonymous":"user-only",this.logger.debug("Creating event payload",{eventName:t.name,hasCuid:!!r,hasVisitorId:!!this.visitorId,trackingMode:i,visitorTrackingEnabled:this.visitorTrackingEnabled}),function(t,n){if(!t||""===t.trim())throw new Error("Event name is required");return{name:t.trim(),eventExternalId:ym(),eventDateTime:(new Date).toISOString(),attributes:n||{}}}(t.name,n)},t.prototype.pause=function(){this.eventQueue&&this.eventQueue.pause(),this.logger.info("EventTracker paused")},t.prototype.resume=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.eventQueue?[4,this.eventQueue.resume()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.logger.info("EventTracker resumed"),[2]}})})},t.prototype.flush=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.initialized&&this.eventQueue?(this.logger.info("Manual flush requested"),[4,this.eventQueue.flush()]):(this.logger.warn("Cannot flush events - EventTracker not initialized"),[2]);case 1:return t.sent(),[2]}})})},t.prototype.destroy=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.logger.info("Destroying EventTracker"),this.eventQueue?[4,this.eventQueue.destroy()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.initialized=!1,this.logger.info(Mu),[2]}})})},t.prototype.trackNotificationReceived=function(t){return Qs(this,void 0,void 0,function(){return Zs(this,function(n){switch(n.label){case 0:return[4,this.trackDLREvent("received",t)];case 1:return n.sent(),[2]}})})},t.prototype.trackNotificationClicked=function(t){return Qs(this,void 0,void 0,function(){return Zs(this,function(n){switch(n.label){case 0:return[4,this.trackDLREvent("clicked",t)];case 1:return n.sent(),[2]}})})},t.prototype.trackNotificationDismissed=function(t){return Qs(this,void 0,void 0,function(){return Zs(this,function(n){switch(n.label){case 0:return[4,this.trackDLREvent("dismissed",t)];case 1:return n.sent(),[2]}})})},t.prototype.trackDLREvent=function(t,n){return Qs(this,void 0,void 0,function(){var i,r;return Zs(this,function(e){switch(e.label){case 0:if(!this.initialized||!this.eventQueue)return this.logger.warn("EventTracker not initialized, skipping DLR event",{eventType:t}),[2];e.label=1;case 1:return e.trys.push([1,3,,4]),i=this.createDLREvent(t,n),[4,this.eventQueue.enqueue(i,!0)];case 2:return e.sent(),this.logger.info("DLR event tracked: ".concat(t),{eventType:t,eventName:i.name,messageId:n.messageId}),[3,4];case 3:return r=e.sent(),this.logger.error("Failed to track DLR event",{eventType:t,notificationData:n,error:r}),[3,4];case 4:return[2]}})})},t.prototype.createDLREvent=function(t,n){var i,r={received:ja.NOTIFICATION_RECEIVED,clicked:ja.NOTIFICATION_CLICKED,dismissed:ja.NOTIFICATION_DISMISSED},e=null===(i=this.eventQueue)||void 0===i?void 0:i.getCurrentCuid(),o={messageId:n.messageId,gateway:Va,result:{received:"SUCCESS",clicked:"CLICKED",dismissed:"DISMISSED"}[t],notification_route:Ba,cuid:e||null,visitor_id:e?null:this.visitorId||null,scope:n.scope||null};return"received"===t&&(o.notification_id=n.messageId,o.campaign_id=n.campaignId||null,o.channel=Ba,o.title=n.title||null),"clicked"===t&&(o.notification_id=n.messageId,o.campaign_id=n.campaignId||null,o.channel=Ba,o.action="open_app"),n.senderId&&(o.senderId=n.senderId),{attributes:o,name:r[t],eventDateTime:(new Date).toISOString(),eventExternalId:ym()}},t.prototype.dispatchDLREvent=function(t){return Qs(this,void 0,void 0,function(){var n;return Zs(this,function(i){switch(i.label){case 0:switch(n=Js(Js(Js(Js(Js(Js({messageId:t.messageId},void 0!==t.scope?{scope:t.scope}:{}),void 0!==t.campaignId?{campaignId:t.campaignId}:{}),void 0!==t.variationId?{variationId:t.variationId}:{}),void 0!==t.senderId?{senderId:t.senderId}:{}),void 0!==t.cuid?{cuid:t.cuid}:{}),void 0!==t.accountId?{accountId:t.accountId}:{}),t.type){case"received":return[3,1];case"clicked":return[3,3];case"dismissed":return[3,5]}return[3,7];case 1:return[4,this.trackNotificationReceived(n)];case 2:case 4:case 6:return i.sent(),[3,7];case 3:return[4,this.trackNotificationClicked(n)];case 5:return[4,this.trackNotificationDismissed(n)];case 7:return[2]}})})},t.prototype.processPendingServiceWorkerDLREvents=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e,o,s,u;return Zs(this,function(a){switch(a.label){case 0:if(!this.initialized)return[2];a.label=1;case 1:return a.trys.push([1,12,,13]),[4,this.getServiceWorkerPendingDLREvents()];case 2:if(0===(t=a.sent()).length)return[2];this.logger.info("Processing pending service worker DLR events",{count:t.length}),a.label=3;case 3:a.trys.push([3,8,9,10]),n=tu(t),i=n.next(),a.label=4;case 4:return i.done?[3,7]:(r=i.value,[4,this.dispatchDLREvent(r)]);case 5:a.sent(),a.label=6;case 6:return i=n.next(),[3,4];case 7:return[3,10];case 8:return e=a.sent(),s={error:e},[3,10];case 9:try{i&&!i.done&&(u=n.return)&&u.call(n)}finally{if(s)throw s.error}return[7];case 10:return[4,this.clearServiceWorkerPendingDLREvents()];case 11:return a.sent(),this.logger.info("Processed pending service worker DLR events",{count:t.length}),[3,13];case 12:return o=a.sent(),this.logger.error("Failed to process pending service worker DLR events",o),[3,13];case 13:return[2]}})})},t.prototype.getServiceWorkerPendingDLREvents=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){return[2,new Promise(function(t){var n=indexedDB.open("WebSDK_DLR_SW",1);n.onerror=function(){return t([])},n.onsuccess=function(){var i=n.result;if(!i.objectStoreNames.contains("pending_dlr_events"))return i.close(),void t([]);var r=i.transaction(["pending_dlr_events"],"readonly").objectStore("pending_dlr_events").getAll();r.onerror=function(){i.close(),t([])},r.onsuccess=function(){i.close(),t(r.result||[])}},n.onupgradeneeded=function(t){var n=t.target.result;n.objectStoreNames.contains("pending_dlr_events")||n.createObjectStore("pending_dlr_events",{keyPath:"id",autoIncrement:!0})}})]})})},t.prototype.clearServiceWorkerPendingDLREvents=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){return[2,new Promise(function(t){var n=indexedDB.open("WebSDK_DLR_SW",1);n.onerror=function(){return t()},n.onsuccess=function(){var i=n.result;if(!i.objectStoreNames.contains("pending_dlr_events"))return i.close(),void t();var r=i.transaction(["pending_dlr_events"],"readwrite").objectStore("pending_dlr_events").clear();r.onerror=function(){i.close(),t()},r.onsuccess=function(){i.close(),t()}},n.onupgradeneeded=function(t){var n=t.target.result;n.objectStoreNames.contains("pending_dlr_events")||n.createObjectStore("pending_dlr_events",{keyPath:"id",autoIncrement:!0})}})]})})},t}(),Dp=function(){function t(t,n,i){this.initialized=!1,this.logger=t,this.brandId=n,this.applicationId=i,this.adapter=new Cp}return t.prototype.init=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r;return Zs(this,function(e){switch(e.label){case 0:if(this.initialized)return this.logger.warn("StorageManager already initialized"),[2];this.logger.info("Initializing StorageManager"),e.label=1;case 1:return e.trys.push([1,6,,7]),this.isIndexedDBSupported()?(t=["WebSDK"],this.brandId&&t.push(this.brandId),this.applicationId&&t.push(this.applicationId),n=t.join("_"),i=new Op(n),[4,this.testStorageAdapter(i)]):[3,3];case 2:return e.sent(),this.adapter=i,this.logger.info("StorageManager initialized with IndexedDB",{dbName:n,brandId:this.brandId,applicationId:this.applicationId}),[3,5];case 3:return[4,this.testStorageAdapter(this.adapter)];case 4:e.sent(),this.logger.info("StorageManager initialized with localStorage"),e.label=5;case 5:return this.initialized=!0,[3,7];case 6:throw r=e.sent(),this.logger.error(Fu,r),new Error("Storage initialization failed: ".concat(r));case 7:return[2]}})})},t.prototype.isIndexedDBSupported=function(){return"undefined"!=typeof window&&"indexedDB"in window&&null!==indexedDB},t.prototype.testStorageAdapter=function(t){return Qs(this,void 0,void 0,function(){var n,i,r;return Zs(this,function(e){switch(e.label){case 0:n=gu,i=mu,e.label=1;case 1:return e.trys.push([1,5,,6]),[4,t.setItem(n,i)];case 2:return e.sent(),[4,t.getItem(n)];case 3:if(e.sent()!==i)throw new Error(ju);return[4,t.removeItem(n)];case 4:return e.sent(),[3,6];case 5:throw r=e.sent(),new Error("".concat(Gu," ").concat(r));case 6:return[2]}})})},t.prototype.get=function(t){return Qs(this,void 0,void 0,function(){return Zs(this,function(n){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.getItem(t)]})})},t.prototype.set=function(t,n){return Qs(this,void 0,void 0,function(){return Zs(this,function(i){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.setItem(t,n)]})})},t.prototype.remove=function(t){return Qs(this,void 0,void 0,function(){return Zs(this,function(n){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.removeItem(t)]})})},t.prototype.clear=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){if(!this.initialized)throw new Error("StorageManager not initialized");return[2,this.adapter.clear()]})})},t.prototype.getIndexedDBAdapter=function(){return this.adapter instanceof Op?this.adapter:null},t.prototype.destroy=function(){return Qs(this,void 0,void 0,function(){var t;return Zs(this,function(n){switch(n.label){case 0:this.logger.info("Destroying StorageManager"),n.label=1;case 1:return n.trys.push([1,4,,5]),this.adapter instanceof Op?[4,this.adapter.close()]:[3,3];case 2:n.sent(),n.label=3;case 3:return this.initialized=!1,this.logger.info(Vu),[3,5];case 4:return t=n.sent(),this.logger.error(Bu,t),this.initialized=!1,[3,5];case 5:return[2]}})})},t}(),Cp=function(){function t(){}return t.prototype.getItem=function(t){return Qs(this,void 0,void 0,function(){return Zs(this,function(n){try{return[2,localStorage.getItem(t)]}catch(t){throw new Error("LocalStorage getItem failed: ".concat(t))}return[2]})})},t.prototype.setItem=function(t,n){return Qs(this,void 0,void 0,function(){return Zs(this,function(i){try{localStorage.setItem(t,n)}catch(t){if(t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name))throw new Error("LocalStorage quota exceeded");throw new Error("LocalStorage setItem failed: ".concat(t))}return[2]})})},t.prototype.removeItem=function(t){return Qs(this,void 0,void 0,function(){return Zs(this,function(n){try{localStorage.removeItem(t)}catch(t){throw new Error("LocalStorage removeItem failed: ".concat(t))}return[2]})})},t.prototype.clear=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){try{localStorage.clear()}catch(t){throw new Error("LocalStorage clear failed: ".concat(t))}return[2]})})},t}();!function(t){t[t.VERBOSE=0]="VERBOSE",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.NONE=5]="NONE"}(Ap||(Ap={}));var xp,Rp,Mp=function(){function t(t,n){void 0===t&&(t=!1),void 0===n&&(n=Ap.INFO),this.logs=[],this.maxLogs=1e3,this.enabled=t,this.level=n}return t.prototype.formatMessage=function(t,n){var i=(new Date).toISOString(),r=Ap[t];return"[".concat(i,"] [WebSDK:").concat(r,"] ").concat(n)},t.prototype.log=function(t,n,i){if(this.enabled&&!(t<this.level)){var r={level:t,message:n,timestamp:Date.now(),data:i};this.logs.push(r),this.logs.length>this.maxLogs&&this.logs.shift();var e=this.formatMessage(t,n),o=i?[e,i]:[e];switch(t){case Ap.VERBOSE:case Ap.DEBUG:console.debug.apply(console,iu([],nu(o),!1));break;case Ap.INFO:console.info.apply(console,iu([],nu(o),!1));break;case Ap.WARN:console.warn.apply(console,iu([],nu(o),!1));break;case Ap.ERROR:console.error.apply(console,iu([],nu(o),!1))}}},t.prototype.verbose=function(t,n){this.log(Ap.VERBOSE,t,n)},t.prototype.debug=function(t,n){this.log(Ap.DEBUG,t,n)},t.prototype.info=function(t,n){this.log(Ap.INFO,t,n)},t.prototype.warn=function(t,n){this.log(Ap.WARN,t,n)},t.prototype.error=function(t,n){this.log(Ap.ERROR,t,n)},t.prototype.setLevel=function(t){this.level=t},t.prototype.setEnabled=function(t){this.enabled=t},t.prototype.getLogs=function(){return iu([],nu(this.logs),!1)},t.prototype.clearLogs=function(){this.logs=[]},t}(),Up=function(){function t(t,n,i,r,e,o){this.initialized=!1,this.cachedConfig=null,this.orgId=t,this.apiClient=n,this.logger=i,this.storageManager=r,void 0!==e&&(this.brandId=e),void 0!==o&&(this.applicationId=o)}return t.prototype.init=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.initialized?(this.logger.warn("VisitorConfigManager already initialized"),[2]):(this.logger.info("Initializing VisitorConfigManager",{orgId:this.orgId}),[4,this.restoreCachedConfig()]);case 1:return t.sent(),this.initialized=!0,this.logger.info(Zu),[2]}})})},t.prototype.fetchConfig=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r=this;return Zs(this,function(e){switch(e.label){case 0:if(!this.initialized)throw new Error("VisitorConfigManager not initialized");if(this.cachedConfig)return this.logger.info(ea),[2,this.cachedConfig];e.label=1;case 1:return e.trys.push([1,4,,5]),this.logger.info("Fetching visitor config from API",{orgId:this.orgId}),[4,this.apiClient.getVisitorConfig(this.orgId)];case 2:return(t=e.sent()).warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){r.logger.warn("Visitor config warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0&&t.errors.forEach(function(t){r.logger.error("Visitor config error from response",{code:t.code,message:t.message})}),this.cachedConfig=t,[4,this.storeCachedConfig(t)];case 3:return e.sent(),this.logger.info(ta,{isEnabled:null===(i=t.data)||void 0===i?void 0:i.visitorTrackingEnabled}),[2,t];case 4:throw n=e.sent(),this.logger.error(na,n),new Error("".concat(Eu,": ").concat(n));case 5:return[2]}})})},t.prototype.isVisitorTrackingEnabled=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r;return Zs(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.fetchConfig()];case 1:return t=e.sent(),(n=!0===(null===(r=t.data)||void 0===r?void 0:r.visitorTrackingEnabled))?this.logger.info(ra):this.logger.info(ia),[2,n];case 2:return i=e.sent(),this.logger.error("Failed to check visitor tracking status",i),[2,!1];case 3:return[2]}})})},t.prototype.refreshConfig=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){if(!this.initialized)throw new Error("VisitorConfigManager not initialized");return this.logger.info("Force refreshing visitor config from API"),this.cachedConfig=null,[2,this.fetchConfig()]})})},t.prototype.getCachedConfig=function(){return this.cachedConfig},t.prototype.storeCachedConfig=function(t){return Qs(this,void 0,void 0,function(){var n,i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),n=lu("VISITOR_CONFIG",this.brandId,this.applicationId),[4,this.storageManager.set(n,JSON.stringify(t))];case 1:return r.sent(),this.logger.debug("Visitor config cached to storage",{key:n}),[3,3];case 2:return i=r.sent(),this.logger.warn("Failed to store visitor config to cache",i),[3,3];case 3:return[2]}})})},t.prototype.restoreCachedConfig=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e;return Zs(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),t=lu("VISITOR_CONFIG",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=o.sent())&&(i=JSON.parse(n),this.cachedConfig=i,this.logger.info("Visitor config restored from cache",{isEnabled:null===(e=i.data)||void 0===e?void 0:e.visitorTrackingEnabled})),[3,3];case 2:return r=o.sent(),this.logger.warn("Failed to restore visitor config from cache",r),this.cachedConfig=null,[3,3];case 3:return[2]}})})},t.prototype.clearCachedConfig=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:this.cachedConfig=null,i.label=1;case 1:return i.trys.push([1,3,,4]),t=lu("VISITOR_CONFIG",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 2:return i.sent(),this.logger.debug("Visitor config cache cleared"),[3,4];case 3:return n=i.sent(),this.logger.warn("Failed to clear visitor config cache",n),[3,4];case 4:return[2]}})})},t.prototype.destroy=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.logger.info("Destroying VisitorConfigManager"),[4,this.clearCachedConfig()];case 1:return t.sent(),this.initialized=!1,this.logger.info("VisitorConfigManager destroyed successfully"),[2]}})})},t}(),Pp={};Rp||(Rp=1,function(){if(xp)return Pp;xp=1;var t=Sr(),n=k();t({global:!0,forced:n.globalThis!==n},{globalThis:n})}());var Lp=function(){function t(t,n,i,r,e,o){this.initialized=!1,this.visitorId=null,this.visitorExternalId=null,this.expiredAt=null,this.getFcmToken=null,this.getChannelType=null,this.getExtendedFields=null,this.getPermissionGranted=null,this.getSessionId=null,this.mergeRetryTimeoutId=null,this.accountId=t,this.orgId=n,this.apiClient=i,this.logger=r,this.storageManager=e,void 0!==(null==o?void 0:o.brandId)&&(this.brandId=o.brandId),void 0!==(null==o?void 0:o.applicationId)&&(this.applicationId=o.applicationId)}return t.prototype.setMergeDataProviders=function(t,n,i,r,e){this.getFcmToken=t,this.getChannelType=n,this.getExtendedFields=i,this.getPermissionGranted=r,this.getSessionId=e},t.prototype.init=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.initialized?(this.logger.warn("AnonymousVisitorManager already initialized"),[2]):(this.logger.info("Initializing AnonymousVisitorManager",{accountId:this.accountId,orgId:this.orgId}),[4,this.restoreVisitorId()]);case 1:return t.sent(),this.initialized=!0,this.logger.info(oa),[2]}})})},t.prototype.getOrCreateVisitorId=function(t,n){return Qs(this,void 0,void 0,function(){var i,r,e,o,s;return Zs(this,function(u){switch(u.label){case 0:if(!this.initialized)throw new Error("AnonymousVisitorManager not initialized");if(this.visitorId&&!this.isVisitorExpired())return this.logger.info(ca,{visitorId:this.visitorId}),[2,this.visitorId];if(this.visitorId&&this.isVisitorExpired()&&this.logger.info("Visitor session expired, creating new visitor via API",{visitorId:this.visitorId,expiredAt:this.expiredAt}),!this.accountId||""===this.accountId.trim())throw i=new Error("AccountId is required for visitor creation"),this.logger.error("Visitor creation validation failed",i),i;u.label=1;case 1:return u.trys.push([1,5,,6]),this.logger.info("Creating new visitor ID",{accountId:this.accountId,hasCommChannels:!!t&&t.length>0,hasExtendedFields:!!n}),[4,this.createVisitor(t,n)];case 2:return r=u.sent(),e=r.visitorId,o=r.expiredAt,this.visitorId=e,[4,this.storeVisitorId(e)];case 3:return u.sent(),[4,this.storeExpiredAt(o)];case 4:return u.sent(),this.logger.info(sa,{visitorId:e}),[2,e];case 5:throw s=u.sent(),this.logger.error(ua,s),s;case 6:return[2]}})})},t.prototype.createVisitor=function(t,n){return Qs(this,void 0,void 0,function(){var i,r,e,o,s;return Zs(this,function(u){switch(u.label){case 0:return u.trys.push([0,3,,4]),[4,this.getOrGenerateVisitorExternalId()];case 1:return i=u.sent(),r=t&&t.length>0?t:[],e=Js({visitorExternalId:i,profiles:[{commChannels:r}]},n&&{extendedFields:n}),this.logger.debug("Visitor creation request payload",{request:e}),[4,this.apiClient.createVisitor(this.orgId,e)];case 2:return o=u.sent(),[2,this.handleCreateVisitorResponse(o)];case 3:throw s=u.sent(),this.handleCreateVisitorError(s),s;case 4:return[2]}})})},t.prototype.handleCreateVisitorResponse=function(t){var n,i,r=this;t.warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){r.logger.warn("Visitor creation warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0&&t.errors.forEach(function(t){r.logger.error("Visitor creation error from response",{code:t.code,message:t.message})});var e=null===(n=t.data)||void 0===n?void 0:n.id;if(!e||""===e.trim())throw new Error("Invalid visitor ID received from API");var o=null===(i=t.data)||void 0===i?void 0:i.expiredAt;if(!o)throw new Error("Missing expiredAt in visitor creation response");return{visitorId:e,expiredAt:o}},t.prototype.handleCreateVisitorError=function(t){var n,i=this;try{var r=(null===(n=t.response)||void 0===n?void 0:n.data)||t;r.warnings&&r.warnings.length>0&&r.warnings.forEach(function(t){t.code===Fa.ACCOUNT_NOT_EXISTS?i.logger.error("Account does not exist",{code:t.code,message:t.message,accountId:i.accountId}):i.logger.warn("Visitor creation warning",{code:t.code,message:t.message})}),r.errors&&r.errors.length>0&&r.errors.forEach(function(t){t.code===Fa.ACCOUNT_ID_NOT_PASSED?i.logger.error("AccountId not passed",{code:t.code,message:t.message}):i.logger.error("Visitor creation error",{code:t.code,message:t.message})})}catch(t){this.logger.warn("Failed to parse visitor creation error",t)}},t.prototype.updateVisitor=function(t,n){return Qs(this,void 0,void 0,function(){var i,r,e,o,s;return Zs(this,function(u){switch(u.label){case 0:if(!this.initialized)throw new Error("AnonymousVisitorManager not initialized");if(!this.visitorId)throw new Error("No visitor ID exists. Create a visitor first.");u.label=1;case 1:return u.trys.push([1,3,,4]),this.logger.info("Updating visitor",{visitorId:this.visitorId,hasCommChannels:!!t&&t.length>0,hasExtendedFields:!!n}),i=t&&t.length>0?t:[],r=Js({profiles:[{commChannels:i}]},n&&{extendedFields:n}),this.logger.debug("Visitor update request payload",{request:r}),[4,this.apiClient.updateVisitor(this.orgId,this.visitorId,r)];case 2:return e=u.sent(),o=this.handleUpdateVisitorResponse(e),this.logger.info(fa,{visitorId:o}),[2,o];case 3:throw s=u.sent(),this.handleUpdateVisitorError(s),this.logger.error(ha,s),s;case 4:return[2]}})})},t.prototype.handleUpdateVisitorResponse=function(t){var n,i=this;t.warnings&&t.warnings.length>0&&t.warnings.forEach(function(t){i.logger.warn("Visitor update warning",{code:t.code,message:t.message})}),t.errors&&t.errors.length>0&&t.errors.forEach(function(t){i.logger.error("Visitor update error from response",{code:t.code,message:t.message})});var r=null===(n=t.data)||void 0===n?void 0:n.id;if(!r||""===r.trim())throw new Error("Invalid visitor ID received from update API");return r},t.prototype.handleUpdateVisitorError=function(t){var n,i=this;try{var r=(null===(n=t.response)||void 0===n?void 0:n.data)||t;r.warnings&&r.warnings.length>0&&r.warnings.forEach(function(t){t.code===Fa.ACCOUNT_NOT_EXISTS?i.logger.error("Account does not exist",{code:t.code,message:t.message,accountId:i.accountId}):i.logger.warn("Visitor update warning",{code:t.code,message:t.message})}),r.errors&&r.errors.length>0&&r.errors.forEach(function(t){i.logger.error("Visitor update error",{code:t.code,message:t.message})})}catch(t){this.logger.warn("Failed to parse visitor update error",t)}},t.prototype.mergeVisitorWithUser=function(t,n,i,r,e,o){return Qs(this,void 0,void 0,function(){var s,u,a;return Zs(this,function(c){switch(c.label){case 0:if(!this.initialized)return this.logger.warn(la,{reason:"Not initialized"}),[2,!1];if(!this.visitorId)return this.logger.warn(la,{reason:"No visitor ID"}),[2,!1];if(!i&&!r&&!e)return this.logger.warn(la,{reason:"No email, mobile, or externalId"}),[2,!1];s=this.visitorId,u=this.visitorExternalId,c.label=1;case 1:return c.trys.push([1,5,,6]),[4,this.isMerged()];case 2:return c.sent()?(this.logger.info(la,{reason:"Visitor already merged",visitorId:s}),[2,!0]):[4,this.persistPendingMerge(s,u,Js(Js(Js(Js({firstName:t,lastName:n},void 0!==i&&{email:i}),void 0!==r&&{mobile:r}),void 0!==e&&{externalId:e}),void 0!==o&&{customData:o}))];case 3:return c.sent(),[4,this.attemptPendingMerge()];case 4:return c.sent(),[2,this.isMerged()];case 5:return a=c.sent(),this.logger.warn("Merge background task failed unexpectedly",a),[2,!1];case 6:return[2]}})})},t.prototype.retryPendingMerge=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:return i.trys.push([0,7,,8]),[4,this.getPendingMerge()];case 1:return(t=i.sent())?[4,this.isMerged()]:[2];case 2:return i.sent()?[4,this.clearPendingMerge()]:[3,4];case 3:return i.sent(),this.logger.info(la,{reason:"Already merged"}),[2];case 4:return t.attempts>=Ma?(this.logger.error(va,{visitorId:t.visitorId,attempts:t.attempts,message:"Max retries exhausted"}),[4,this.clearPendingMerge()]):[3,6];case 5:return i.sent(),[2];case 6:return this.scheduleMergeRetry(),[3,8];case 7:return n=i.sent(),this.logger.warn("Failed to retry pending merge",n),[3,8];case 8:return[2]}})})},t.prototype.cancelMergeRetryTimer=function(){null!==this.mergeRetryTimeoutId&&(globalThis.clearTimeout(this.mergeRetryTimeoutId),this.mergeRetryTimeoutId=null)},t.prototype.scheduleMergeRetry=function(){var t=this;this.cancelMergeRetryTimer(),this.mergeRetryTimeoutId=globalThis.setTimeout(function(){t.mergeRetryTimeoutId=null,t.attemptPendingMerge().catch(function(n){t.logger.warn("Scheduled merge retry failed unexpectedly",n)})},Ua)},t.prototype.collectMergeContext=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e,o,s;return Zs(this,function(u){switch(u.label){case 0:t=this.getFcmToken?this.getFcmToken():null,n=this.getChannelType?this.getChannelType():void 0,i=!this.getPermissionGranted||this.getPermissionGranted(),r=this.getSessionId?this.getSessionId():"",u.label=1;case 1:return u.trys.push([1,5,,6]),this.getExtendedFields?[4,this.getExtendedFields()]:[3,3];case 2:return o=u.sent(),[3,4];case 3:o=void 0,u.label=4;case 4:return e=o,[3,6];case 5:return s=u.sent(),this.logger.warn("Failed to collect extended fields for merge, proceeding without them",s),e=void 0,[3,6];case 6:return[2,{fcmToken:t,channelType:n,subscribed:i,sessionId:r,extendedFields:e}]}})})},t.prototype.attemptPendingMerge=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e,o,s,u;return Zs(this,function(a){switch(a.label){case 0:return[4,this.getPendingMerge()];case 1:return(t=a.sent())?[4,this.collectMergeContext()]:[2];case 2:n=a.sent(),i=n.fcmToken,r=n.channelType,e=n.subscribed,o=n.sessionId,s=n.extendedFields,a.label=3;case 3:return a.trys.push([3,7,,9]),[4,this.apiClient.mergeVisitor(t.visitorId,t.visitorExternalId||null,Js(Js(Js(Js(Js(Js(Js(Js({firstName:t.firstName,lastName:t.lastName},void 0!==t.email&&{email:t.email}),void 0!==t.mobile&&{mobile:t.mobile}),i?{fcmToken:i,subscribed:e}:{}),void 0!==r&&{channelType:r}),{fields:t.customData||{}}),void 0!==s&&{extendedFields:s}),void 0!==t.externalId&&{externalId:t.externalId}),{sessionId:o}))];case 4:return a.sent(),[4,this.markAsMerged(t.visitorId)];case 5:return a.sent(),[4,this.clearPendingMerge()];case 6:return a.sent(),this.logger.info(da,{visitorId:t.visitorId,attempts:t.attempts+1}),[3,9];case 7:return u=a.sent(),[4,this.handleMergeRetryOrAbort(u,t)];case 8:return a.sent(),[3,9];case 9:return[2]}})})},t.prototype.handleMergeRetryOrAbort=function(t,n){return Qs(this,void 0,void 0,function(){var i;return Zs(this,function(r){switch(r.label){case 0:return t instanceof bp?[4,this.clearPendingMerge()]:[3,2];case 1:return r.sent(),this.logger.error("Visitor merge failed permanently, will not retry",{code:t.code,message:t.message,visitorId:n.visitorId}),[2];case 2:return i=Js(Js({},n),{attempts:n.attempts+1}),[4,this.savePendingMerge(i)];case 3:return r.sent(),i.attempts>=Ma?(this.logger.error(va,{visitorId:n.visitorId,attempts:i.attempts,message:"Max retries exhausted"}),[4,this.clearPendingMerge()]):[3,5];case 4:return r.sent(),[2];case 5:return this.logger.warn("Visitor merge attempt failed, scheduling retry",{attempt:i.attempts,maxRetries:Ma,nextRetryMs:Ua,visitorId:n.visitorId,error:t}),this.scheduleMergeRetry(),[2]}})})},t.prototype.persistPendingMerge=function(t,n,i){return Qs(this,void 0,void 0,function(){var r,e,o,s,u,a,c;return Zs(this,function(f){switch(f.label){case 0:return r=i.firstName,e=i.lastName,o=i.email,s=i.mobile,u=i.externalId,a=i.customData,c=Js(Js(Js(Js(Js(Js(Js({visitorId:t},n&&{visitorExternalId:n}),{firstName:r,lastName:e}),void 0!==o&&{email:o}),void 0!==s&&{mobile:s}),void 0!==u&&{externalId:u}),void 0!==a&&{customData:a}),{attempts:0}),[4,this.savePendingMerge(c)];case 1:return f.sent(),this.logger.debug("Pending merge request persisted to storage",{visitorId:t}),[2]}})})},t.prototype.getPendingMerge=function(){return Qs(this,void 0,void 0,function(){var t,n,i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=lu("PENDING_MERGE",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=r.sent())?[2,JSON.parse(n)]:[2,null];case 2:return i=r.sent(),this.logger.warn("Failed to read pending merge from storage",i),[2,null];case 3:return[2]}})})},t.prototype.savePendingMerge=function(t){return Qs(this,void 0,void 0,function(){var n,i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),n=lu("PENDING_MERGE",this.brandId,this.applicationId),[4,this.storageManager.set(n,JSON.stringify(t))];case 1:return r.sent(),[3,3];case 2:return i=r.sent(),this.logger.warn("Failed to save pending merge to storage",i),[3,3];case 3:return[2]}})})},t.prototype.clearPendingMerge=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:this.cancelMergeRetryTimer(),i.label=1;case 1:return i.trys.push([1,3,,4]),t=lu("PENDING_MERGE",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 2:return i.sent(),this.logger.debug("Pending merge cleared from storage"),[3,4];case 3:return n=i.sent(),this.logger.warn("Failed to clear pending merge from storage",n),[3,4];case 4:return[2]}})})},t.prototype.isMerged=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=lu("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return[2,null!=i.sent()];case 2:return n=i.sent(),this.logger.warn("Failed to check merge status",n),[2,!1];case 3:return[2]}})})},t.prototype.getMergedUserId=function(){return Qs(this,void 0,void 0,function(){var t,n,i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=lu("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return[2,null!=(n=r.sent())?n:null];case 2:return i=r.sent(),this.logger.warn("Failed to get merge status",i),[2,null];case 3:return[2]}})})},t.prototype.clearMergedUserId=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=lu("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 1:return i.sent(),this.logger.info("Merge status cleared from storage"),[3,3];case 2:return n=i.sent(),this.logger.warn("Failed to clear merge status",n),[3,3];case 3:return[2]}})})},t.prototype.markAsMerged=function(t){return Qs(this,void 0,void 0,function(){var n,i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),n=lu("MERGED_USER_ID",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 1:return r.sent(),this.logger.debug("Visitor marked as merged",{visitorId:t,key:n}),[3,3];case 2:return i=r.sent(),this.logger.warn("Failed to store merge status",i),[3,3];case 3:return[2]}})})},t.prototype.getVisitorId=function(){return this.visitorId},t.prototype.getVisitorExternalId=function(){return this.visitorExternalId},t.prototype.hasVisitorId=function(){return null!==this.visitorId},t.prototype.storeVisitorId=function(t){return Qs(this,void 0,void 0,function(){var n,i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),n=lu("VISITOR_ID",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 1:return r.sent(),this.logger.debug("Visitor ID stored to storage",{visitorId:t,key:n}),[3,3];case 2:return i=r.sent(),this.logger.warn("Failed to store visitor ID",i),[3,3];case 3:return[2]}})})},t.prototype.storeExpiredAt=function(t){return Qs(this,void 0,void 0,function(){var n,i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.expiredAt=t,n=lu("VISITOR_EXPIRED_AT",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 1:return r.sent(),this.logger.debug("Visitor expiredAt stored to storage",{expiredAt:t}),[3,3];case 2:return i=r.sent(),this.logger.warn("Failed to store visitor expiredAt",i),[3,3];case 3:return[2]}})})},t.prototype.isVisitorExpired=function(){if(!this.expiredAt)return!0;try{return new Date(this.expiredAt).getTime()<=Date.now()}catch(t){return this.logger.warn("Invalid expiredAt format, treating as expired",{expiredAt:this.expiredAt}),!0}},t.prototype.getOrGenerateVisitorExternalId=function(){return Qs(this,void 0,void 0,function(){var t,n,i;return Zs(this,function(r){switch(r.label){case 0:if(this.visitorExternalId)return[2,this.visitorExternalId];t=ym(),this.visitorExternalId=t,r.label=1;case 1:return r.trys.push([1,3,,4]),n=lu("VISITOR_EXTERNAL_ID",this.brandId,this.applicationId),[4,this.storageManager.set(n,t)];case 2:return r.sent(),this.logger.debug("visitorExternalId generated and stored",{visitorExternalId:t}),[3,4];case 3:return i=r.sent(),this.logger.warn("Failed to store visitorExternalId",i),[3,4];case 4:return[2,t]}})})},t.prototype.restoreVisitorId=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e,o,s;return Zs(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),t=lu("VISITOR_ID",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=u.sent())&&(this.visitorId=n,this.logger.info(aa,{visitorId:n})),i=lu("VISITOR_EXTERNAL_ID",this.brandId,this.applicationId),[4,this.storageManager.get(i)];case 2:return(r=u.sent())&&(this.visitorExternalId=r),e=lu("VISITOR_EXPIRED_AT",this.brandId,this.applicationId),[4,this.storageManager.get(e)];case 3:return(o=u.sent())&&(this.expiredAt=o),[3,5];case 4:return s=u.sent(),this.logger.warn("Failed to restore visitor ID from storage",s),this.visitorId=null,[3,5];case 5:return[2]}})})},t.prototype.clearVisitorId=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r;return Zs(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),t=lu("VISITOR_ID",this.brandId,this.applicationId),n=lu("VISITOR_EXTERNAL_ID",this.brandId,this.applicationId),i=lu("VISITOR_EXPIRED_AT",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 1:return e.sent(),[4,this.storageManager.remove(n)];case 2:return e.sent(),[4,this.storageManager.remove(i)];case 3:return e.sent(),this.visitorId=null,this.visitorExternalId=null,this.expiredAt=null,this.logger.info("Visitor ID cleared from storage"),[3,5];case 4:return r=e.sent(),this.logger.warn("Failed to clear visitor ID",r),this.visitorId=null,this.visitorExternalId=null,this.expiredAt=null,[3,5];case 5:return[2]}})})},t.prototype.destroy=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){return this.logger.info("Destroying AnonymousVisitorManager"),this.cancelMergeRetryTimer(),this.initialized=!1,this.logger.info("AnonymousVisitorManager destroyed successfully"),[2]})})},t}();function Fp(){return"undefined"!=typeof window&&window.firebase?window.firebase:null}function Gp(){return Qs(this,void 0,void 0,function(){var t;return Zs(this,function(n){return(t=Fp())?[2,t]:[2,import("firebase/app")]})})}function jp(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){return[2,import("firebase/messaging")]})})}function Vp(){return Qs(this,void 0,void 0,function(){var t;return Zs(this,function(n){return(t=Fp())&&t.remoteConfig?[2,t]:[2,import("firebase/remote-config")]})})}var Bp=function(){function t(t,n,i,r,e,o){this.isInitialized=!1,this.currentToken=null,this.swRegistration=null,this.messaging=t,this.logger=n,this.vapidKey=i,this.serviceWorkerPath=r||du,this.onTokenReceivedCallback=e,this.onMessageReceivedCallback=o}return t.prototype.initialize=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){return this.isInitialized?(this.logger.warn("FirebaseManager already initialized"),[2,!0]):this.messaging?(this.isInitialized=!0,this.logger.info(ya),[2,!0]):(this.logger.error(ba,new Error("Messaging instance missing")),[2,!1])})})},t.prototype.ensureServiceWorkerRegistered=function(){return Qs(this,void 0,void 0,function(){var t;return Zs(this,function(n){switch(n.label){case 0:return this.swRegistration?[2,this.swRegistration]:this.isInitialized&&this.messaging?(t=this,[4,this.registerServiceWorker()]):[2,null];case 1:return t.swRegistration=n.sent(),[2,this.swRegistration]}})})},t.prototype.registerServiceWorker=function(){return Qs(this,void 0,void 0,function(){var t,n,i;return Zs(this,function(r){switch(r.label){case 0:if(!("serviceWorker"in navigator))return this.logger.warn("Service Worker not supported"),[2,null];r.label=1;case 1:return r.trys.push([1,7,,8]),[4,navigator.serviceWorker.getRegistration(this.serviceWorkerPath)];case 2:return(t=r.sent())?(this.logger.info("Service worker already registered",{scope:t.scope}),[4,this.ensureServiceWorkerActive(t)]):[3,4];case 3:return r.sent(),[2,t];case 4:return this.logger.info("Registering service worker",{path:this.serviceWorkerPath}),[4,navigator.serviceWorker.register(this.serviceWorkerPath)];case 5:return n=r.sent(),this.logger.info(Ta,{scope:n.scope}),[4,this.ensureServiceWorkerActive(n)];case 6:return r.sent(),[2,n];case 7:return i=r.sent(),this.logger.error(Sa,i),[2,null];case 8:return[2]}})})},t.prototype.ensureServiceWorkerActive=function(t){return Qs(this,void 0,void 0,function(){var n,i=this;return Zs(this,function(r){return t.active?(this.logger.debug("Service worker is already active"),[2]):(n=t.installing||t.waiting)?(this.logger.info("Waiting for service worker to activate...",{state:n.state}),[2,new Promise(function(t,r){if("activated"!==n.state){var e=function(){"activated"===n.state?(n.removeEventListener("statechange",e),i.logger.info("Service worker activated"),t()):"redundant"===n.state&&(n.removeEventListener("statechange",e),r(new Error("Service worker became redundant")))};n.addEventListener("statechange",e)}else t()})]):(this.logger.warn("No service worker found in registration"),[2])})})},t.prototype.requestToken=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r;return Zs(this,function(e){switch(e.label){case 0:if(!this.isInitialized||!this.messaging)return this.logger.error("FirebaseManager not initialized"),[2,null];e.label=1;case 1:return e.trys.push([1,5,,6]),(n=this.swRegistration)?[3,3]:[4,this.registerServiceWorker()];case 2:n=e.sent(),e.label=3;case 3:return(t=n)?(this.swRegistration=t,[4,this.fetchFCMToken(t)]):(this.logger.warn("Service worker registration required for FCM"),[2,null]);case 4:return(i=e.sent())?(this.currentToken=i,this.logger.info(Ea,{token:i}),this.onTokenReceivedCallback&&this.onTokenReceivedCallback(i),[2,i]):(this.logger.warn("No FCM token received - permission may be denied"),[2,null]);case 5:return r=e.sent(),this.logger.error(Ia,r),[2,null];case 6:return[2]}})})},t.prototype.fetchFCMToken=function(t){return Qs(this,void 0,void 0,function(){var n,i;return Zs(this,function(r){switch(r.label){case 0:return[4,jp()];case 1:return n=r.sent().getToken,i={serviceWorkerRegistration:t},this.vapidKey&&(i.vapidKey=this.vapidKey),[2,n(this.messaging,i)]}})})},t.prototype.setupMessageListener=function(){return Qs(this,void 0,void 0,function(){var t,n=this;return Zs(this,function(i){switch(i.label){case 0:if(!this.isInitialized||!this.messaging)return this.logger.error("FirebaseManager not initialized"),[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,jp()];case 2:return(0,i.sent().onMessage)(this.messaging,function(t){n.handleMessage(t)}),this.logger.info("Message listener setup successfully"),[3,4];case 3:return t=i.sent(),this.logger.error("Failed to setup message listener",t),[3,4];case 4:return[2]}})})},t.prototype.handleMessage=function(t){this.logger.info("FCM message received",t),this.onMessageReceivedCallback&&this.onMessageReceivedCallback(t)},t.prototype.getCurrentToken=function(){return this.currentToken},t.prototype.isFirebaseInitialized=function(){return this.isInitialized},t.prototype.destroy=function(){this.isInitialized=!1,this.messaging=null,this.currentToken=null,this.swRegistration=null,this.logger.info("FirebaseManager destroyed successfully")},t}(),zp=function(){function t(t,n,i,r,e){this.firebaseManager=null,this.tokenUpdateCallback=null,this.config=t,this.logger=n,this.storageManager=i,this.brandId=r,this.applicationId=e,this.config.onTokenRefresh&&this.logger.warn("notifications.onTokenRefresh has no effect — the modular Firebase SDK has no token-refresh event to fire it from. Call NotificationManager.refreshToken() to manually re-request a token instead."),this.state={isNotificationEnabled:!1,firebaseInitialized:!1,permissionStatus:"default"}}return t.prototype.isNotificationSupported=function(){return"undefined"!=typeof window&&"undefined"!=typeof Notification&&"undefined"!=typeof navigator&&"serviceWorker"in navigator},t.prototype.getPermissionStatus=function(){return this.isNotificationSupported()?Notification.permission:"denied"},t.prototype.shouldInitializeNotifications=function(){return this.isNotificationSupported()?!!this.config.messaging||(this.logger.warn("Firebase Messaging instance not provided - notifications disabled"),!1):(this.logger.warn("Notifications not supported in this browser"),!1)},t.prototype.restoreState=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e;return Zs(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),t=lu("NOTIFICATION_STATE",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=o.sent())&&(i=JSON.parse(n),r=this.getPermissionStatus(),this.state=Js(Js(Js({},this.state),i),{permissionStatus:r}),this.logger.info("Notification state restored from storage",{storedPermission:i.permissionStatus,currentPermission:r,hasToken:!!i.fcmToken})),[3,3];case 2:return e=o.sent(),this.logger.warn("Failed to restore notification state",e),[3,3];case 3:return[2]}})})},t.prototype.saveState=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=lu("NOTIFICATION_STATE",this.brandId,this.applicationId),[4,this.storageManager.set(t,JSON.stringify(this.state))];case 1:return i.sent(),this.logger.debug("Notification state saved to storage",this.state),[3,3];case 2:return n=i.sent(),this.logger.warn("Failed to save notification state",n),[3,3];case 3:return[2]}})})},t.prototype.init=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:return i.trys.push([0,15,,17]),[4,this.restoreState()];case 1:return i.sent(),this.shouldInitializeNotifications()?[3,3]:(this.logger.info(wa),this.state.isNotificationEnabled=!1,[4,this.saveState()]);case 2:return i.sent(),[2,this.state];case 3:return t=this.getPermissionStatus(),this.state.permissionStatus=t,this.logger.info("Current notification permission",{permission:t,hasStoredToken:!!this.state.fcmToken,isNotificationEnabled:this.state.isNotificationEnabled}),"denied"!==t?[3,5]:(this.logger.warn(ga),this.state.isNotificationEnabled=!1,delete this.state.fcmToken,[4,this.saveState()]);case 4:return i.sent(),[2,this.state];case 5:return"default"!==t?[3,7]:(this.logger.info("Permission not yet granted - notifications will not be shown until user grants permission"),this.state.isNotificationEnabled=!1,[4,this.saveState()]);case 6:return i.sent(),[2,this.state];case 7:return"granted"!==t?[3,14]:this.state.fcmToken?(this.logger.info("Using existing FCM token from storage",{token:this.state.fcmToken.substring(0,20)+"..."}),this.state.isNotificationEnabled=!0,this.firebaseManager?[3,9]:(this.logger.info("Initializing Firebase for message listening"),[4,this.initializeFirebaseForMessaging()])):[3,11];case 8:i.sent(),i.label=9;case 9:return[4,this.saveState()];case 10:return i.sent(),[2,this.state];case 11:return this.logger.info("Permission granted - initializing Firebase to generate FCM token"),[4,this.initializeFirebase()];case 12:return i.sent(),[4,this.saveState()];case 13:i.sent(),i.label=14;case 14:return this.logger.info(ma,this.state),[2,this.state];case 15:return n=i.sent(),this.logger.error(pa,n),this.state.isNotificationEnabled=!1,[4,this.saveState()];case 16:return i.sent(),[2,this.state];case 17:return[2]}})})},t.prototype.initializeFirebaseForMessaging=function(){return Qs(this,void 0,void 0,function(){var t;return Zs(this,function(n){switch(n.label){case 0:if(!this.config.messaging)throw new Error("Firebase Messaging instance is required");n.label=1;case 1:return n.trys.push([1,5,,6]),this.firebaseManager=new Bp(this.config.messaging,this.logger,this.config.vapidKey,this.config.serviceWorkerPath,this.config.onTokenReceived,this.config.onMessageReceived),[4,this.firebaseManager.initialize()];case 2:if(!n.sent())throw new Error("Firebase initialization failed");return this.state.firebaseInitialized=!0,[4,this.firebaseManager.ensureServiceWorkerRegistered()];case 3:return n.sent(),[4,this.firebaseManager.setupMessageListener()];case 4:return n.sent(),this.logger.info("Firebase initialized for message listening"),[3,6];case 5:throw t=n.sent(),this.logger.error("Failed to initialize Firebase for messaging",t),t;case 6:return[2]}})})},t.prototype.initializeFirebase=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:if(!this.config.messaging)throw new Error("Firebase Messaging instance is required");i.label=1;case 1:return i.trys.push([1,7,,8]),this.firebaseManager=new Bp(this.config.messaging,this.logger,this.config.vapidKey,this.config.serviceWorkerPath,this.config.onTokenReceived,this.config.onMessageReceived),[4,this.firebaseManager.initialize()];case 2:if(!i.sent())throw new Error("Firebase initialization failed");return this.state.firebaseInitialized=!0,this.state.isNotificationEnabled=!0,[4,this.firebaseManager.requestToken()];case 3:return(t=i.sent())?(this.state.fcmToken=t,[4,this.storeFCMToken(t)]):[3,5];case 4:i.sent(),i.label=5;case 5:return[4,this.firebaseManager.setupMessageListener()];case 6:return i.sent(),this.logger.info("Firebase initialized and FCM token retrieved",{hasToken:!!t}),[3,8];case 7:throw n=i.sent(),this.logger.error("Failed to initialize Firebase",n),this.state.firebaseInitialized=!1,this.state.isNotificationEnabled=!1,n;case 8:return[2]}})})},t.prototype.storeFCMToken=function(t){return Qs(this,void 0,void 0,function(){var n,i,r,e,o,s;return Zs(this,function(u){switch(u.label){case 0:return u.trys.push([0,6,,7]),n=lu("FCM_TOKEN",this.brandId,this.applicationId),i=lu("FCM_TOKEN_CREATED_AT",this.brandId,this.applicationId),[4,this.storageManager.get(n)];case 1:return r=u.sent(),e=!r||r!==t,[4,this.storageManager.set(n,t)];case 2:return u.sent(),e?(o=(new Date).toISOString(),[4,this.storageManager.set(i,o)]):[3,4];case 3:return u.sent(),this.logger.debug("FCM token and creation date stored successfully",{createdAt:o}),[3,5];case 4:this.logger.debug("FCM token stored (creation date unchanged)"),u.label=5;case 5:return this.tokenUpdateCallback&&(this.logger.info("Notifying token update callback",{isNewToken:e,tokenPreview:t.substring(0,20)+"..."}),this.tokenUpdateCallback(t,e)),[3,7];case 6:return s=u.sent(),this.logger.warn("Failed to store FCM token",s),[3,7];case 7:return[2]}})})},t.prototype.setTokenUpdateCallback=function(t){this.tokenUpdateCallback=t,this.logger.debug("Token update callback registered")},t.prototype.clearTokenUpdateCallback=function(){this.tokenUpdateCallback=null,this.logger.debug("Token update callback cleared")},t.prototype.getState=function(){return Js({},this.state)},t.prototype.getFCMToken=function(){return this.state.fcmToken||null},t.prototype.getTokenCreationDate=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=lu("FCM_TOKEN_CREATED_AT",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return[2,i.sent()||null];case 2:return n=i.sent(),this.logger.warn("Failed to retrieve FCM token creation date",n),[2,null];case 3:return[2]}})})},t.prototype.isEnabled=function(){return this.state.isNotificationEnabled},t.prototype.getFirebaseManager=function(){return this.firebaseManager},t.prototype.refreshToken=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:if(!this.firebaseManager||!this.state.isNotificationEnabled)return this.logger.warn("Cannot refresh token - notifications not enabled"),[2,null];i.label=1;case 1:return i.trys.push([1,6,,7]),[4,this.firebaseManager.requestToken()];case 2:return(t=i.sent())?(this.state.fcmToken=t,[4,this.storeFCMToken(t)]):[3,5];case 3:return i.sent(),[4,this.saveState()];case 4:i.sent(),this.logger.info(_a,{token:t}),i.label=5;case 5:return[2,t];case 6:return n=i.sent(),this.logger.error("Failed to refresh FCM token",n),[2,null];case 7:return[2]}})})},t.prototype.clearToken=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.logger.info("Clearing notification state (permission revoked)"),t=this.state.fcmToken,this.state.isNotificationEnabled=!1,this.state.firebaseInitialized=!1,this.firebaseManager&&(this.firebaseManager.destroy(),this.firebaseManager=null),[4,this.saveState()];case 1:return i.sent(),this.tokenUpdateCallback&&t&&(this.logger.info("Notifying permission revoked to sync push_opted:false with backend"),this.tokenUpdateCallback(t,!0)),this.logger.info("Notification state cleared"),[3,3];case 2:throw n=i.sent(),this.logger.error("Failed to clear notification state",n),n;case 3:return[2]}})})},t.prototype.hasPermissionChanged=function(){return this.getPermissionStatus()!==this.state.permissionStatus},t.prototype.handlePermissionChange=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:return t=this.getPermissionStatus(),n=this.state.permissionStatus,this.logger.info("Permission status changed",{from:n,to:t}),this.state.permissionStatus=t,"denied"!==t&&"default"!==t?[3,5]:"granted"!==n?[3,2]:(this.logger.warn("Permission revoked - clearing FCM token"),[4,this.clearToken()]);case 1:return i.sent(),[3,4];case 2:return this.state.isNotificationEnabled=!1,[4,this.saveState()];case 3:i.sent(),i.label=4;case 4:return[3,10];case 5:return"granted"!==t||"granted"===n?[3,10]:this.config.messaging?[3,6]:(this.logger.warn("Firebase Messaging instance not provided - notifications disabled"),this.state.isNotificationEnabled=!1,[3,8]);case 6:return this.logger.info("Permission granted - initializing Firebase"),[4,this.initializeFirebase()];case 7:i.sent(),i.label=8;case 8:return[4,this.saveState()];case 9:i.sent(),i.label=10;case 10:return[2,this.state]}})})},t.prototype.destroy=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.firebaseManager&&(this.firebaseManager.destroy(),this.firebaseManager=null),t=lu("NOTIFICATION_STATE",this.brandId,this.applicationId),[4,this.storageManager.remove(t)];case 1:return i.sent(),this.logger.info("NotificationManager destroyed successfully"),[3,3];case 2:return n=i.sent(),this.logger.error("Failed to destroy NotificationManager",n),[3,3];case 3:return[2]}})})},t}(),Hp=function(){function t(t,n,i,r,e){this.currentSession=null,this.sessionNumber=0,this.storageManager=t,this.logger=n,this.brandId=i,this.applicationId=r;var o=fu/6e4;this.inactivityTimeoutMs=60*(e||o)*1e3,this.logger.info("SessionManager configured with timeout:",{timeoutMinutes:e||o,timeoutMs:this.inactivityTimeoutMs,source:e?"Remote Config":"Default"})}return t.prototype.init=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.logger.info("Initializing SessionManager"),[4,this.restoreSessionNumber()];case 1:return t.sent(),[4,this.restoreSession()];case 2:return t.sent(),this.logger.info("SessionManager initialized successfully"),[2]}})})},t.prototype.getOrCreateSession=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:return t=Date.now(),this.currentSession?(n=t-this.currentSession.lastEventTime)<this.inactivityTimeoutMs?(this.currentSession.lastEventTime=t,[4,this.persistSession()]):[3,2]:[3,3];case 1:return i.sent(),this.logger.debug(Hu,{sessionId:this.currentSession.sessionId,inactivityDuration:n}),[2,this.currentSession.sessionId];case 2:this.logger.info(Wu,{sessionId:this.currentSession.sessionId,inactivityDuration:n,timeoutMs:this.inactivityTimeoutMs}),i.label=3;case 3:return[2,this.startNewSession()]}})})},t.prototype.getSessionStartTime=function(){var t;return(null===(t=this.currentSession)||void 0===t?void 0:t.sessionStartTime)||null},t.prototype.getCurrentSessionId=function(){var t,n;return null!==(n=null===(t=this.currentSession)||void 0===t?void 0:t.sessionId)&&void 0!==n?n:null},t.prototype.getSessionNumber=function(){return this.sessionNumber},t.prototype.resetSessionNumber=function(){return Qs(this,arguments,void 0,function(t){return void 0===t&&(t=0),Zs(this,function(n){switch(n.label){case 0:return this.sessionNumber=t,[4,this.persistSessionNumber()];case 1:return n.sent(),this.logger.info("Session number reset",{sessionNumber:this.sessionNumber}),[2]}})})},t.prototype.endSession=function(t){return Qs(this,void 0,void 0,function(){return Zs(this,function(n){switch(n.label){case 0:return this.currentSession?(this.logger.info(Ku,{sessionId:this.currentSession.sessionId,reason:t}),this.currentSession=null,[4,this.clearSessionStorage()]):[3,3];case 1:return n.sent(),[4,this.resetSessionNumber(0)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.destroy=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){return this.logger.info("Destroying SessionManager (session persists in storage)"),this.currentSession=null,[2]})})},t.prototype.startNewSession=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:return t=Date.now(),n=ym(),this.currentSession={sessionId:n,sessionStartTime:t,lastEventTime:t},this.sessionNumber+=1,[4,this.persistSession()];case 1:return i.sent(),[4,this.persistSessionNumber()];case 2:return i.sent(),this.logger.info(zu,{sessionId:n,sessionStartTime:t,sessionNumber:this.sessionNumber}),[2,n]}})})},t.prototype.restoreSession=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e,o,s,u,a;return Zs(this,function(c){switch(c.label){case 0:return c.trys.push([0,7,,9]),t=lu("SESSION_ID",this.brandId,this.applicationId),n=lu("SESSION_START_TIME",this.brandId,this.applicationId),i=lu("LAST_EVENT_TIME",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return r=c.sent(),[4,this.storageManager.get(n)];case 2:return e=c.sent(),[4,this.storageManager.get(i)];case 3:return o=c.sent(),r&&e&&o?(s=Date.now(),(u=s-parseInt(o))<this.inactivityTimeoutMs?(this.currentSession={sessionId:r,sessionStartTime:parseInt(e),lastEventTime:parseInt(o)},this.logger.info(qu,{sessionId:r,timeSinceLastEvent:u}),[3,6]):[3,4]):[3,6];case 4:return this.logger.debug("Stored session expired, will create new session",{timeSinceLastEvent:u,timeoutMs:this.inactivityTimeoutMs}),[4,this.clearSessionStorage()];case 5:c.sent(),c.label=6;case 6:return[3,9];case 7:return a=c.sent(),this.logger.warn("Failed to restore session from storage",a),[4,this.clearSessionStorage()];case 8:return c.sent(),[3,9];case 9:return[2]}})})},t.prototype.persistSession=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r;return Zs(this,function(e){switch(e.label){case 0:if(!this.currentSession)return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),t=lu("SESSION_ID",this.brandId,this.applicationId),n=lu("SESSION_START_TIME",this.brandId,this.applicationId),i=lu("LAST_EVENT_TIME",this.brandId,this.applicationId),[4,Promise.all([this.storageManager.set(t,this.currentSession.sessionId),this.storageManager.set(n,this.currentSession.sessionStartTime.toString()),this.storageManager.set(i,this.currentSession.lastEventTime.toString())])];case 2:return e.sent(),[3,4];case 3:return r=e.sent(),this.logger.warn("Failed to persist session to storage",r),[3,4];case 4:return[2]}})})},t.prototype.clearSessionStorage=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r;return Zs(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=lu("SESSION_ID",this.brandId,this.applicationId),n=lu("SESSION_START_TIME",this.brandId,this.applicationId),i=lu("LAST_EVENT_TIME",this.brandId,this.applicationId),[4,Promise.all([this.storageManager.remove(t),this.storageManager.remove(n),this.storageManager.remove(i)])];case 1:return e.sent(),[3,3];case 2:return r=e.sent(),this.logger.warn("Failed to clear session storage",r),[3,3];case 3:return[2]}})})},t.prototype.restoreSessionNumber=function(){return Qs(this,void 0,void 0,function(){var t,n,i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t=lu("SESSION_NUMBER",this.brandId,this.applicationId),[4,this.storageManager.get(t)];case 1:return(n=r.sent())&&(this.sessionNumber=parseInt(n,10)||0,this.logger.debug("Session number restored",{sessionNumber:this.sessionNumber})),[3,3];case 2:return i=r.sent(),this.logger.warn("Failed to restore session number",i),[3,3];case 3:return[2]}})})},t.prototype.persistSessionNumber=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=lu("SESSION_NUMBER",this.brandId,this.applicationId),[4,this.storageManager.set(t,this.sessionNumber.toString())];case 1:return i.sent(),[3,3];case 2:return n=i.sent(),this.logger.warn("Failed to persist session number",n),[3,3];case 3:return[2]}})})},t}(),Wp=function(){function t(t,n){this.firedThresholds=new Set,this.pageStartTime=0,this.currentUrl="",this.scrollHandler=null,this.initialized=!1,this.logger=t,this.onDepthReached=n,this.thresholds=Ra}return t.prototype.init=function(){var t=this;"undefined"!=typeof window&&"undefined"!=typeof document&&(this.initialized||(this.pageStartTime=Date.now(),this.currentUrl=window.location.href,this.scrollHandler=function(){return t.handleScroll()},window.addEventListener("scroll",this.scrollHandler,{passive:!0}),this.checkScrollDepth(),this.initialized=!0,this.logger.debug("ScrollDepthTracker initialized")))},t.prototype.handleScroll=function(){this.checkSPANavigation(),this.checkScrollDepth()},t.prototype.checkSPANavigation=function(){var t=window.location.href;t!==this.currentUrl&&(this.firedThresholds.clear(),this.pageStartTime=Date.now(),this.currentUrl=t,this.logger.debug("ScrollDepthTracker reset for new page",{url:t}))},t.prototype.checkScrollDepth=function(){var t,n,i=window.scrollY,r=document.documentElement.scrollHeight-document.documentElement.clientHeight;if(!(r<=0)){var e=Math.min(100,Math.floor(i/r*100));try{for(var o=tu(this.thresholds),s=o.next();!s.done;s=o.next()){var u=s.value;if(!this.firedThresholds.has(u)&&e>=u){this.firedThresholds.add(u);var a=Math.floor((Date.now()-this.pageStartTime)/1e3);this.logger.debug("Scroll depth threshold reached",{threshold:u,timeToDepth:a,url:this.currentUrl}),this.onDepthReached({depth_percentage:u,url:this.currentUrl,time_to_depth:a})}}}catch(n){t={error:n}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}},t.prototype.destroy=function(){this.scrollHandler&&"undefined"!=typeof window&&window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.firedThresholds.clear(),this.initialized=!1,this.logger.debug("ScrollDepthTracker destroyed")},t}(),Kp=function(){function t(t){this.userContextSet=!1,this.initialized=!1,this.initializationPromise=null,this.visitorTrackingEnabled=!1,this.visitorId=null,this.currentUserIdentifierType=null,this.notificationManager=null,this.permissionChangeCleanup=null,this.dlrMessageCleanup=null,this.lastAuthenticatedUser=null,this.lastUserAttributes=null,this.scrollDepthTracker=null,this.sdkDisabled=!1,this.userIdentified=!1,this.userOperationChain=Promise.resolve(),this.gamificationManager=null,this.gamificationBaseUrl=th,this.config=t,this.logger=new Mp(!1),this.validateRequiredConfig(t),t.remoteConfigKey?(this.logger.info("🔧 SDK initializing in Remote Config bootstrap mode"),this.logger.info("Will fetch configuration from Remote Config key:",t.remoteConfigKey)):this.logger.info("🔧 SDK initializing in direct-config bootstrap mode (no Firebase)")}return t.initialize=function(n){return t._?(new Mp(!0).warn("WebSDK is already initialized. Returning existing instance."),t._):(t._=new t(n),t._.init(),t._)},t.getInstance=function(){return t._},t.isInitialized=function(){return null!==t._},t.requireInstance=function(){if(!t._)throw new Error("WebSDK is not initialized. Call WebSDK.initialize(config) first.");return t._},t.track=function(n,i){t.requireInstance().track(n,i)},t.pageView=function(n){t.requireInstance().pageView(n)},t.identify=function(n){t.requireInstance().identify(n)},t.getUser=function(){return t.requireInstance().getUser()},t.getAnonymousId=function(){return t.requireInstance().getAnonymousId()},t.reset=function(){t.requireInstance().reset()},t.setCapToken=function(n){t.requireInstance().setCapToken(n)},t.getCapToken=function(){return t.requireInstance().getCapToken()},t.enablePagePathTracking=function(n){t.requireInstance().enablePagePathTracking(n)},t.onScreenChanged=function(n){t.requireInstance().onScreenChanged(n)},t.disableSDK=function(){t.requireInstance().disableSDK()},t.enableSDK=function(){t.requireInstance().enableSDK()},t.destroy=function(){if(!t._)return Promise.resolve();var n=t._.destroy();return t._=null,n},t.prototype.shouldEnableLogging=function(t){return!(!t||"NONE"===t)&&["ERROR","WARN","INFO","DEBUG","VERBOSE"].includes(t)},t.prototype.resolveLogLevel=function(t){return{NONE:Ap.NONE,ERROR:Ap.ERROR,WARN:Ap.WARN,INFO:Ap.INFO,DEBUG:Ap.DEBUG,VERBOSE:Ap.VERBOSE}[null!=t?t:"NONE"]},t.prototype.restoreUserContext=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e,o,s,u,a,c=this;return Zs(this,function(f){switch(f.label){case 0:return f.trys.push([0,5,,6]),t=lu("USER_CONTEXT",this.config.brandId,this.config.applicationId),[4,this.storageManager.get(t)];case 1:return(n=f.sent())?(i=JSON.parse(n),r=i.cuid,e=i.userIdentifierType,this.currentUserIdentifierType=null!=e?e:null,o=this.config.accountId||"",[4,this.eventTracker.setUserContext(o,r,e)]):[3,3];case 2:f.sent(),this.userContextSet=!0,this.userIdentified=!0,i.attributes&&(this.lastUserAttributes=i.attributes),this.logger.info("User context restored from storage",{cuid:r,accountId:this.config.accountId}),this.gamificationManager&&this.gamificationManager.initialize(r).catch(function(t){c.logger.error("Failed to restore gamification on page refresh",t)}),f.label=3;case 3:return s=lu("LAST_AUTHENTICATED_USER",this.config.brandId,this.config.applicationId),[4,this.storageManager.get(s)];case 4:return(u=f.sent())&&(this.lastAuthenticatedUser=u,this.logger.info("Last authenticated user restored from storage",{lastAuthenticatedUser:this.lastAuthenticatedUser})),[3,6];case 5:return a=f.sent(),this.logger.warn("Failed to restore user context from storage",a),[3,6];case 6:return[2]}})})},t.prototype.validateAndClearDifferentUserContext=function(t){return Qs(this,void 0,void 0,function(){var n;return Zs(this,function(i){switch(i.label){case 0:return i.trys.push([0,5,,7]),this.lastAuthenticatedUser&&this.lastAuthenticatedUser!==t?(this.logger.info("Different user detected, ending session and clearing context",{previousCuid:this.lastAuthenticatedUser,newCuid:t}),[4,this.sessionManager.endSession("user_switch")]):[3,3];case 1:return i.sent(),[4,this.clearUserContext()];case 2:i.sent(),this.userContextSet=!1,i.label=3;case 3:return this.lastAuthenticatedUser=t,[4,this.persistLastAuthenticatedUser(t)];case 4:return i.sent(),[3,7];case 5:return n=i.sent(),this.logger.warn("Error validating different user context",n),[4,this.clearUserContext()];case 6:return i.sent(),this.userContextSet=!1,[3,7];case 7:return[2]}})})},t.prototype.persistLastAuthenticatedUser=function(t){return Qs(this,void 0,void 0,function(){var n,i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),n=lu("LAST_AUTHENTICATED_USER",this.config.brandId,this.config.applicationId),[4,this.storageManager.set(n,t)];case 1:return r.sent(),[3,3];case 2:return i=r.sent(),this.logger.warn("Failed to persist lastAuthenticatedUser",i),[3,3];case 3:return[2]}})})},t.prototype.storeUserContext=function(t,n,i){return Qs(this,void 0,void 0,function(){var r,e,o,s;return Zs(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),r=null!=n?n:this.currentUserIdentifierType,e={cuid:t,timestamp:Date.now()},r&&(e.userIdentifierType=r),i&&(e.attributes=i),o=lu("USER_CONTEXT",this.config.brandId,this.config.applicationId),[4,this.storageManager.set(o,JSON.stringify(e))];case 1:return u.sent(),[3,3];case 2:return s=u.sent(),this.logger.warn("Failed to store user context",s),[3,3];case 3:return[2]}})})},t.prototype.init=function(){var t=this;this.initialized?this.logger.warn("WebSDK already initialized"):this.initializationPromise?this.logger.warn("WebSDK initialization already in progress"):(Lm(),this.initializationPromise=this.initializeAsync().catch(function(n){t.logger.error(Iu,n),t.initializationPromise=null}))},t.prototype.tryStep=function(t,n){return Qs(this,void 0,void 0,function(){var i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,n()];case 1:return r.sent(),[3,3];case 2:return i=r.sent(),this.logger.error(t,i),[3,3];case 3:return[2]}})})},t.prototype.initializeAsync=function(){return Qs(this,void 0,void 0,function(){var t,n,i=this;return Zs(this,function(r){switch(r.label){case 0:this.logger.info("Initializing WebSDK",{version:za,config:this.config}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.bootstrapConfig()];case 2:return r.sent(),[3,4];case 3:throw t=r.sent(),new Error("".concat(pu,": ").concat(t));case 4:return[4,this.tryStep(Su,function(){return i.storageManager.init()})];case 5:return r.sent(),[4,this.tryStep(Au,function(){var t;return Promise.resolve(null===(t=i.gamificationManager)||void 0===t?void 0:t.restorePersistedPagePathTracking())})];case 6:return r.sent(),[4,this.tryStep(Ou,function(){return i.sessionManager.init()})];case 7:if(r.sent(),!this.config.notifications)return[3,11];r.label=8;case 8:return r.trys.push([8,10,,11]),this.notificationManager=new zp(this.config.notifications,this.logger,this.storageManager,this.config.brandId,this.config.applicationId),this.setupTokenUpdateCallback(),[4,this.notificationManager.init()];case 9:return r.sent(),this.logger.info("Notifications initialized early for FCM token availability"),[3,11];case 10:return n=r.sent(),this.logger.error(pa,n),this.notificationManager=null,[3,11];case 11:return[4,this.tryStep(Nu,function(){return i.initializeVisitorConfig()})];case 12:return r.sent(),[4,this.tryStep(ku,function(){return Qs(i,void 0,void 0,function(){var t=this;return Zs(this,function(n){switch(n.label){case 0:return[4,this.eventTracker.init()];case 1:return n.sent(),this.eventTracker.setSessionInfoCallback(function(){return Qs(t,void 0,void 0,function(){return Zs(this,function(t){return[2,this.sessionManager.getOrCreateSession()]})})}),[2]}})})})];case 13:return r.sent(),[4,this.tryStep(Du,function(){return i.restoreUserContext()})];case 14:return r.sent(),[4,this.tryStep(Cu,function(){return i.syncEventTrackerContext()})];case 15:return r.sent(),this.initialized=!0,this.notificationManager&&this.setupPermissionChangeDetection(),this.scrollDepthTracker=new Wp(this.logger,function(t){i.pushEvent(xa,i.buildInternalEventAttributes(Js({},t)))}),this.scrollDepthTracker.init(),this.config.notifications?[4,this.tryStep(xu,function(){return Qs(i,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.setupDLRServiceWorkerListener(),[4,this.eventTracker.processPendingServiceWorkerDLREvents()];case 1:return t.sent(),[2]}})})})]:[3,17];case 16:r.sent(),r.label=17;case 17:return this.logger.info(_u),[2]}})})},t.prototype.handleVisibilityChange=function(){return Qs(this,void 0,void 0,function(){var t,n,i;return Zs(this,function(r){switch(r.label){case 0:if("visible"!==document.visibilityState||!this.notificationManager)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),this.notificationManager.hasPermissionChanged()?(t="Notification"in window?Notification.permission:"denied",this.logger.info("Notification permission changed detected",{currentPermission:t}),[4,this.notificationManager.handlePermissionChange()]):[2];case 2:return(n=r.sent())&&this.logger.info("Notification state updated after permission change",n),[3,4];case 3:return i=r.sent(),this.logger.warn("Error handling permission change",i),[3,4];case 4:return[2]}})})},t.prototype.setupPermissionChangeDetection=function(){var t=this;if("undefined"!=typeof document&&"undefined"!=typeof window){var n=function(){return t.handleVisibilityChange()};document.addEventListener("visibilitychange",n),window.addEventListener("focus",n),this.permissionChangeCleanup=function(){document.removeEventListener("visibilitychange",n),window.removeEventListener("focus",n)},this.logger.debug("Permission change detection setup complete")}},t.prototype.setupDLRServiceWorkerListener=function(){var t=this;if("undefined"!=typeof navigator&&"serviceWorker"in navigator){var n=function(n){return Qs(t,void 0,void 0,function(){var t;return Zs(this,function(i){switch(i.label){case 0:if(!n.data||"HYDRA_DLR_EVENTS_PENDING"!==n.data.type)return[3,4];this.logger.info("Received DLR events pending notification from service worker"),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.eventTracker.processPendingServiceWorkerDLREvents()];case 2:return i.sent(),[3,4];case 3:return t=i.sent(),this.logger.error("Failed to process pending DLR events",t),[3,4];case 4:return[2]}})})};navigator.serviceWorker.addEventListener("message",n),this.dlrMessageCleanup=function(){navigator.serviceWorker.removeEventListener("message",n)},this.logger.debug("DLR service worker message listener setup complete")}},t.prototype.initializeVisitorConfig=function(){return Qs(this,void 0,void 0,function(){var t,n,i=this;return Zs(this,function(r){switch(r.label){case 0:return this.logger.info("Initializing visitor configuration"),[4,this.visitorConfigManager.init()];case 1:return r.sent(),t=this,[4,this.visitorConfigManager.isVisitorTrackingEnabled()];case 2:return t.visitorTrackingEnabled=r.sent(),this.visitorTrackingEnabled?(this.logger.info(ra),[4,this.anonymousVisitorManager.init()]):[3,5];case 3:return r.sent(),[4,this.getOrCreateVisitorId()];case 4:return r.sent(),this.anonymousVisitorManager.retryPendingMerge().catch(function(t){i.logger.warn("Failed to retry pending merge on init",t)}),[3,6];case 5:this.logger.info(ia),r.label=6;case 6:return(n=this.visitorConfigManager.getCachedConfig())&&n.warnings&&n.warnings.length>0&&n.warnings.forEach(function(t){i.logger.warn("Visitor config warning",{code:t.code,message:t.message})}),[2]}})})},t.prototype.syncEventTrackerContext=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r;return Zs(this,function(e){switch(e.label){case 0:return t=null!==(r=null===(i=this.anonymousVisitorManager)||void 0===i?void 0:i.getVisitorExternalId())&&void 0!==r?r:null,this.eventTracker.setVisitorTrackingState(this.visitorId,this.visitorTrackingEnabled,t),this.visitorTrackingEnabled?(n=this.config.accountId||"",this.userContextSet?[3,2]:[4,this.eventTracker.setUserContext(n)]):(this.logger.warn("Event tracking disabled: Visitor tracking is off"),[2]);case 1:return e.sent(),this.logger.info("Account context set for visitor tracking"),[3,3];case 2:this.logger.info("User context restored from storage"),e.label=3;case 3:return[2]}})})},t.prototype.getOrCreateVisitorId=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e,o,s,u,a,c,f;return Zs(this,function(h){switch(h.label){case 0:t=[],(n=null===(a=this.notificationManager)||void 0===a?void 0:a.getFCMToken())?(i="granted"===(null===(c=this.notificationManager)||void 0===c?void 0:c.getState().permissionStatus),t.push({type:this.getChannelType(),value:n,primary:!0,verified:!0,subscribed:i}),this.logger.info("Including FCM token in visitor creation",{tokenPreview:n.substring(0,20)+"...",subscribed:i})):this.logger.info("No FCM token available, creating visitor without commChannels"),h.label=1;case 1:return h.trys.push([1,5,,6]),this.notificationManager?[4,this.notificationManager.getTokenCreationDate()]:[3,3];case 2:return o=h.sent(),[3,4];case 3:o=null,h.label=4;case 4:return e=o,r=Rm(Js(Js({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:"granted"===(null===(f=this.notificationManager)||void 0===f?void 0:f.getState().permissionStatus),fcmTokenCreatedAt:e})),this.logger.debug("Extended fields collected",{extendedFields:r}),[3,6];case 5:return s=h.sent(),this.logger.warn("Failed to collect extended fields, proceeding without them",s),r=void 0,[3,6];case 6:return u=this,[4,this.anonymousVisitorManager.getOrCreateVisitorId(t.length>0?t:void 0,r)];case 7:return u.visitorId=h.sent(),this.logger.info("Visitor ID ready",{visitorId:this.visitorId}),[2,this.visitorId]}})})},t.prototype.setupTokenUpdateCallback=function(){var t=this;this.notificationManager&&(this.notificationManager.setTokenUpdateCallback(function(n,i){return Qs(t,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return[4,this.handleTokenUpdate(n,i)];case 1:return t.sent(),[2]}})})}),this.logger.debug("Token update callback configured for backend sync"))},t.prototype.handleTokenUpdate=function(t,n){return Qs(this,void 0,void 0,function(){var i,r,e;return Zs(this,function(o){switch(o.label){case 0:if(!this.visitorId)return this.logger.debug("Skipping token sync - no visitor ID yet (will be included in create)",{isNewToken:n}),[2];if(!n)return this.logger.debug("Skipping token sync - token unchanged"),[2];i="granted"!==(null===(e=this.notificationManager)||void 0===e?void 0:e.getState().permissionStatus),this.logTokenSyncStart(t,i),o.label=1;case 1:return o.trys.push([1,6,,7]),this.userIdentified&&this.lastAuthenticatedUser?[4,this.syncTokenForIdentifiedUser(i)]:[3,3];case 2:return o.sent(),[3,5];case 3:return[4,this.syncTokenForAnonymousUser(t,i)];case 4:o.sent(),o.label=5;case 5:return[3,7];case 6:return r=o.sent(),this.logger.error("Failed to sync FCM token with backend",r),[3,7];case 7:return[2]}})})},t.prototype.logTokenSyncStart=function(t,n){n?this.logger.info("Permission revoked, syncing push_opted:false with backend",{visitorId:this.visitorId}):this.logger.info("FCM token updated, syncing with backend",{visitorId:this.visitorId,tokenPreview:t.substring(0,20)+"..."})},t.prototype.syncTokenForIdentifiedUser=function(t){return Qs(this,void 0,void 0,function(){return Zs(this,function(n){switch(n.label){case 0:return this.lastAuthenticatedUser?[4,this.sendUserEventToApi(Da,this.lastAuthenticatedUser,this.lastUserAttributes)]:[2];case 1:return n.sent(),this.logger.info("Token state synced via User Events API (user_update)",{permissionRevoked:t}),[2]}})})},t.prototype.syncTokenForAnonymousUser=function(t,n){return Qs(this,void 0,void 0,function(){var i,r,e,o,s;return Zs(this,function(u){switch(u.label){case 0:i=t?[{type:this.getChannelType(),value:t,primary:!0,verified:!0,subscribed:!n}]:[],u.label=1;case 1:return u.trys.push([1,5,,6]),n||!this.notificationManager?[3,3]:[4,this.notificationManager.getTokenCreationDate()];case 2:return o=u.sent(),[3,4];case 3:o=null,u.label=4;case 4:return e=o,r=Rm(Js(Js({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:!n,fcmTokenCreatedAt:e})),[3,6];case 5:return s=u.sent(),this.logger.warn("Failed to collect extended fields for token update",s),r=void 0,[3,6];case 6:return[4,this.anonymousVisitorManager.updateVisitor(i,r)];case 7:return u.sent(),n?this.logger.info("Token synced with subscribed:false (permission revoked)",{visitorId:this.visitorId}):this.logger.info("FCM token synced with backend successfully",{visitorId:this.visitorId}),[2]}})})},t.prototype.getAnonymousId=function(){return this.visitorId},t.prototype.getUser=function(){var t,n,i,r,e;if(this.userIdentified)throw new Error("This data is not exposed");var o=null!==(n=null===(t=this.sessionManager)||void 0===t?void 0:t.getCurrentSessionId())&&void 0!==n?n:"",s=null!==(r=null===(i=this.sessionManager)||void 0===i?void 0:i.getSessionNumber())&&void 0!==r?r:0;return{visitorId:null!==(e=this.visitorId)&&void 0!==e?e:"",userId:null,sessionId:o,isIdentified:!1,isAnonymous:!0,profileTier:"anonymous",attributes:null,sessionNumber:s,isFirstSession:1===s,isReturningVisitor:s>1}},t.prototype.setUserContext=function(t,n){return Qs(this,void 0,void 0,function(){var i,r,e;return Zs(this,function(o){switch(o.label){case 0:if(!this.initialized)throw new Error("WebSDK must be initialized before setting user context");return[4,this.validateAndClearDifferentUserContext(t)];case 1:return o.sent(),i=null!==(e=null!=n?n:this.currentUserIdentifierType)&&void 0!==e?e:void 0,r=this.config.accountId||"",[4,this.eventTracker.setUserContext(r,t,i)];case 2:return o.sent(),this.userContextSet=!0,n&&(this.currentUserIdentifierType=n),this.visitorId&&this.logger.info("User identified - transitioning from anonymous to identified tracking",{visitorId:this.visitorId,cuid:t,trackingMode:"identified"}),[4,this.storeUserContext(t,i)];case 3:return o.sent(),this.logger.info("User context set and persisted",{cuid:t,accountId:this.config.accountId}),[2]}})})},t.prototype.clearUserContext=function(){return Qs(this,void 0,void 0,function(){var t,n;return Zs(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),t=lu("USER_CONTEXT",this.config.brandId,this.config.applicationId),[4,this.storageManager.remove(t)];case 1:return i.sent(),this.eventTracker&&this.eventTracker.clearUserContext(),this.currentUserIdentifierType=null,this.userContextSet=!1,this.userIdentified=!1,this.logger.info("User context cleared"),[3,3];case 2:return n=i.sent(),this.logger.warn("Failed to clear user context",n),this.currentUserIdentifierType=null,this.userContextSet=!1,this.userIdentified=!1,[3,3];case 3:return[2]}})})},t.prototype.track=function(t,n){this.sdkDisabled?this.logger.debug("SDK disabled, dropping track call",{eventName:t}):this.pushEvent(t,n)},t.prototype.pageView=function(t){var n,i,r;if(this.sdkDisabled)this.logger.debug("SDK disabled, dropping pageView call");else{var e=null!==(n=null==t?void 0:t.url)&&void 0!==n?n:"undefined"!=typeof window?window.location.href:void 0,o=null!==(i=null==t?void 0:t.title)&&void 0!==i?i:"undefined"!=typeof document?document.title:void 0,s=null!==(r=null==t?void 0:t.referrer)&&void 0!==r?r:"undefined"!=typeof document?document.referrer:void 0,u=Js(Js(Js(Js(Js({},e&&{url:e}),o&&{title:o}),s&&{referrer:s}),(null==t?void 0:t.category)&&{category:t.category}),null==t?void 0:t.properties);this.pushEvent("page_view",u)}},t.prototype.pickTraitFields=function(t){var n={},i=t.gender,r=t.birthday,e=t.city,o=t.country,s=t.timezone;return i&&(n.gender=i),r&&(n.birthday=r),e&&(n.city=e),o&&(n.country=o),s&&(n.timezone=s),n},t.prototype.identify=function(t){var n,i;if(this.sdkDisabled)this.logger.debug("SDK disabled, dropping identify call");else{var r=t.identifier,e=t.actionType,o=t.traits,s=void 0===o?{}:o;if(!r||!r.cuid)throw new Error("identifier with a non-empty cuid is required for identify");if(!["email","mobile","externalId"].includes(r.type))throw new Error("Invalid identifier type: ".concat(r.type,". Must be 'email', 'mobile', or 'externalId'."));var u=r.cuid;this.currentUserIdentifierType=r.type;var a=Js(Js(Js(Js({firstName:null!==(n=s.firstName)&&void 0!==n?n:"",lastName:null!==(i=s.lastName)&&void 0!==i?i:""},"email"===r.type&&{email:u}),"mobile"===r.type&&{mobile:u}),"externalId"===r.type&&{externalId:u}),void 0!==s.custom&&{customData:s.custom}),c=this.pickTraitFields(s);a.customData=Js(Js({},c),a.customData),this.userIdentified=!0;var f=r.type;switch(e){case"USER_REGISTER":this.pushUserSignin(u,a,f);break;case"USER_UPDATE":this.pushUserUpdate(u,a,f);break;default:throw this.logger.error("Invalid identify actionType",{actionType:e,cuid:u}),new Error("Invalid identify actionType: ".concat(e,". Must be 'USER_REGISTER' or 'USER_UPDATE'."))}}},t.prototype.trackEvent=function(t){return Qs(this,void 0,void 0,function(){var n;return Zs(this,function(i){switch(i.label){case 0:if(!this.initialized)throw new Error("WebSDK must be initialized before tracking events");i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.eventTracker.track(t)];case 2:return i.sent(),[3,4];case 3:throw n=i.sent(),this.logger.error(Uu,{event:t,error:n}),n;case 4:return[2]}})})},t.prototype.destroy=function(){return Qs(this,void 0,void 0,function(){var t;return Zs(this,function(n){switch(n.label){case 0:this.logger.info("Destroying WebSDK instance"),n.label=1;case 1:return n.trys.push([1,16,,17]),this.eventTracker?[4,this.eventTracker.flush()]:[3,4];case 2:return n.sent(),[4,this.eventTracker.destroy()];case 3:n.sent(),n.label=4;case 4:return this.scrollDepthTracker&&(this.scrollDepthTracker.destroy(),this.scrollDepthTracker=null),this.visitorConfigManager?[4,this.visitorConfigManager.destroy()]:[3,6];case 5:n.sent(),n.label=6;case 6:return this.anonymousVisitorManager?[4,this.anonymousVisitorManager.destroy()]:[3,8];case 7:n.sent(),n.label=8;case 8:return this.permissionChangeCleanup&&(this.permissionChangeCleanup(),this.permissionChangeCleanup=null),this.dlrMessageCleanup&&(this.dlrMessageCleanup(),this.dlrMessageCleanup=null),this.notificationManager?(this.notificationManager.clearTokenUpdateCallback(),[4,this.notificationManager.destroy()]):[3,10];case 9:n.sent(),this.notificationManager=null,n.label=10;case 10:return this.gamificationManager&&(this.gamificationManager.destroy(),this.gamificationManager=null),this.sessionManager?[4,this.sessionManager.destroy()]:[3,12];case 11:n.sent(),n.label=12;case 12:return this.storageManager?[4,this.clearUserContext()]:[3,15];case 13:return n.sent(),[4,this.storageManager.destroy()];case 14:n.sent(),n.label=15;case 15:return this.initialized=!1,this.logger.info(Tu),[3,17];case 16:throw t=n.sent(),this.logger.error(Tu,t),t;case 17:return[2]}})})},t.prototype.validateUserAttributes=function(t){if(!t.email&&!t.mobile&&!t.externalId)throw new Error("At least one of email, mobile, or externalId is required")},t.prototype.attemptVisitorMerge=function(t){return Qs(this,void 0,void 0,function(){var n,i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.visitorTrackingEnabled&&this.visitorId?t.email||t.mobile||t.externalId?[4,this.anonymousVisitorManager.mergeVisitorWithUser(t.firstName,t.lastName,t.email,t.mobile,t.externalId,t.customData)]:(this.logger.debug(la,{reason:"No email, mobile, or externalId"}),[2,!1]):[2,!1];case 1:return n=r.sent(),this.logger.info("Visitor merge attempt completed",{visitorId:this.visitorId,success:n}),[2,n];case 2:return i=r.sent(),this.logger.warn("Visitor merge attempt failed, proceeding with user flow",i),[2,!1];case 3:return[2]}})})},t.prototype.buildPushData=function(){var t,n,i,r="granted"===(null===(t=this.notificationManager)||void 0===t?void 0:t.getState().permissionStatus),e=null!==(i=null===(n=this.notificationManager)||void 0===n?void 0:n.getFCMToken())&&void 0!==i?i:null;return{pushOpted:r&&!!e,tokens:e?[{interface_id:e,gateway:La.WEB}]:[]}},t.prototype.buildUserAttributePayload=function(t){if(!t)return{};var n={};return t.firstName&&(n.firstName=t.firstName),t.lastName&&(n.lastName=t.lastName),t.email&&(n.email=t.email),t.mobile&&(n.phone=t.mobile),n},t.prototype.sendUserEventToApi=function(t,n,i,r){return Qs(this,void 0,void 0,function(){var e,o,s,u,a,c,f,h,d,v,l,g;return Zs(this,function(m){switch(m.label){case 0:return e=this.buildPushData(),o=e.pushOpted,s=e.tokens,u=null!==(h=null===(f=this.sessionManager)||void 0===f?void 0:f.getCurrentSessionId())&&void 0!==h?h:"",[4,this.apiClient.buildUserEventsRequest(t,Js(Js(Js({cuid:n,push_opted:o,tokens:s},this.visitorId&&{visitorId:this.visitorId}),this.buildUserAttributePayload(i)),r),u)];case 1:return a=m.sent(),c=null!==(v=null===(d=this.anonymousVisitorManager)||void 0===d?void 0:d.getVisitorExternalId())&&void 0!==v?v:void 0,[4,this.apiClient.sendUserEvents(a,null!==(l=this.visitorId)&&void 0!==l?l:void 0,c,n,null!==(g=this.currentUserIdentifierType)&&void 0!==g?g:void 0)];case 2:return m.sent(),this.logger.info("User event sent to User Events API",{eventName:t,cuid:n}),[2]}})})},t.prototype.pushUserSignin=function(t,n,i){var r=this;this.userIdentified=!0,this.queueUserOperation(function(){return Qs(r,void 0,void 0,function(){var r;return Zs(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.pushUserSigninAsync(t,n,i)];case 1:return e.sent(),[3,3];case 2:return r=e.sent(),this.logger.error(Xu,{cuid:t,error:r}),[3,3];case 3:return[2]}})})})},t.prototype.pushUserSigninAsync=function(t,n,i){return Qs(this,void 0,void 0,function(){var r,e,o,s,u,a,c,f,h;return Zs(this,function(d){switch(d.label){case 0:return[4,this.ensureInitialized()];case 1:return d.sent(),this.validateUserAttributes(n),r=(null!==(f=null===(c=this.sessionManager)||void 0===c?void 0:c.getSessionNumber())&&void 0!==f?f:0)>1,e=r?"returning":"new_session",[4,this.setUserContextIfNeeded(t,i)];case 2:return d.sent(),[4,this.attemptVisitorMerge(n)];case 3:return o=d.sent(),this.lastUserAttributes=n,[4,this.storeUserContext(t,i,n)];case 4:d.sent(),d.label=5;case 5:return d.trys.push([5,7,,8]),[4,this.sendUserEventToApi(ka,t,n,Js(Js({},void 0!==i&&{method:i}),{success:o,login_type:e}))];case 6:return d.sent(),this.logger.info("User signin event tracked",{cuid:t,firstName:n.firstName,lastName:n.lastName,email:n.email}),[3,8];case 7:return s=d.sent(),this.logger.error(Xu,{cuid:t,error:s}),[3,8];case 8:return u=Js(Js(Js({},n.email&&{email:n.email}),n.mobile&&{mobile:n.mobile}),n.customData&&{customAttributes:n.customData}),(a=[n.firstName,n.lastName].filter(Boolean).join(" "))&&Object.assign(u,{name:a}),null===(h=this.gamificationManager)||void 0===h||h.initialize(t,u),[2]}})})},t.prototype.pushUserSignup=function(t,n,i){var r=this;this.userIdentified=!0,this.queueUserOperation(function(){return Qs(r,void 0,void 0,function(){var r;return Zs(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.pushUserSignupAsync(t,n,i)];case 1:return e.sent(),[3,3];case 2:return r=e.sent(),this.logger.error($u,{cuid:t,error:r}),[3,3];case 3:return[2]}})})})},t.prototype.pushUserSignupAsync=function(t,n,i){return Qs(this,void 0,void 0,function(){var r;return Zs(this,function(e){switch(e.label){case 0:return[4,this.ensureInitialized()];case 1:return e.sent(),this.validateUserAttributes(n),[4,this.setUserContextIfNeeded(t,i)];case 2:return e.sent(),this.attemptVisitorMerge(n),this.lastUserAttributes=n,[4,this.storeUserContext(t,i,n)];case 3:e.sent(),e.label=4;case 4:return e.trys.push([4,6,,7]),[4,this.sendUserEventToApi(ka,t,n)];case 5:return e.sent(),this.logger.info("User signup event tracked (routed as user_signin)",{cuid:t,firstName:n.firstName,lastName:n.lastName,email:n.email}),[3,7];case 6:throw r=e.sent(),this.logger.error($u,{cuid:t,error:r}),r;case 7:return[2]}})})},t.prototype.pushUserUpdate=function(t,n,i){var r=this;this.queueUserOperation(function(){return Qs(r,void 0,void 0,function(){var r;return Zs(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.pushUserUpdateAsync(t,n,i)];case 1:return e.sent(),[3,3];case 2:return r=e.sent(),this.logger.error(Yu,{cuid:t,error:r}),[3,3];case 3:return[2]}})})})},t.prototype.pushUserUpdateAsync=function(t,n,i){return Qs(this,void 0,void 0,function(){var r;return Zs(this,function(e){switch(e.label){case 0:return[4,this.ensureInitialized()];case 1:return e.sent(),this.validateUserAttributes(n),[4,this.setUserContextIfNeeded(t,i)];case 2:return e.sent(),this.lastUserAttributes=n,[4,this.storeUserContext(t,i,n)];case 3:e.sent(),e.label=4;case 4:return e.trys.push([4,6,,7]),[4,this.sendUserEventToApi(Da,t,n)];case 5:return e.sent(),this.logger.info("User update event tracked",{cuid:t}),[3,7];case 6:throw r=e.sent(),this.logger.error(Yu,{cuid:t,error:r}),r;case 7:return[2]}})})},t.prototype.reset=function(){if(this.sdkDisabled)this.logger.debug("SDK disabled, dropping reset call");else{var t=this.lastAuthenticatedUser;t?this.pushUserSignOut(t):this.logger.warn("reset() called but no authenticated user to sign out")}},t.prototype.setCapToken=function(t){var n;null===(n=this.gamificationManager)||void 0===n||n.setCapToken(t)},t.prototype.getCapToken=function(){var t,n;return null!==(n=null===(t=this.gamificationManager)||void 0===t?void 0:t.getCapToken())&&void 0!==n?n:null},t.prototype.enablePagePathTracking=function(t){var n;null===(n=this.gamificationManager)||void 0===n||n.enablePagePathTracking(t)},t.prototype.onScreenChanged=function(t){var n;null===(n=this.gamificationManager)||void 0===n||n.onScreenChanged(t)},t.prototype.pushUserSignOut=function(t){var n=this;this.queueUserOperation(function(){return Qs(n,void 0,void 0,function(){var n;return Zs(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.pushUserSignOutAsync(t)];case 1:return i.sent(),[3,3];case 2:return n=i.sent(),this.logger.error(Ju,{cuid:t,error:n}),[3,3];case 3:return[2]}})})})},t.prototype.resetToAnonymousMode=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e,o,s,u,a,c,f,h,d,v;return Zs(this,function(l){switch(l.label){case 0:if(!this.visitorTrackingEnabled)return this.logger.info("Visitor tracking disabled per latest config, skipping anonymous mode"),this.visitorId=null,this.eventTracker.setVisitorTrackingState(null,!1),[2];null===(f=this.gamificationManager)||void 0===f||f.clean(),l.label=1;case 1:return l.trys.push([1,11,,12]),[4,this.anonymousVisitorManager.clearVisitorId()];case 2:l.sent(),this.logger.info("Visitor ID cleared on user signout"),t=[],(n=null===(h=this.notificationManager)||void 0===h?void 0:h.getFCMToken())&&(i="granted"===(null===(d=this.notificationManager)||void 0===d?void 0:d.getState().permissionStatus),t.push({type:this.getChannelType(),value:n,primary:!0,verified:!0,subscribed:i})),r=void 0,l.label=3;case 3:return l.trys.push([3,7,,8]),this.notificationManager?[4,this.notificationManager.getTokenCreationDate()]:[3,5];case 4:return o=l.sent(),[3,6];case 5:o=null,l.label=6;case 6:return e=o,r=Rm(Js(Js({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:"granted"===(null===(v=this.notificationManager)||void 0===v?void 0:v.getState().permissionStatus),fcmTokenCreatedAt:e})),[3,8];case 7:return s=l.sent(),this.logger.warn("Failed to collect extended fields on signout, proceeding without them",s),r=void 0,[3,8];case 8:return u=this,[4,this.anonymousVisitorManager.getOrCreateVisitorId(t.length>0?t:void 0,r)];case 9:return u.visitorId=l.sent(),[4,this.sessionManager.resetSessionNumber(1)];case 10:return l.sent(),this.logger.info("New anonymous visitor ID generated after signout",{visitorId:this.visitorId,hasFCMToken:!!n}),a=this.anonymousVisitorManager.getVisitorExternalId(),this.eventTracker.setVisitorTrackingState(this.visitorId,!0,a),[3,12];case 11:return c=l.sent(),this.logger.warn("Failed to regenerate visitor ID on signout",c),this.visitorId=null,this.eventTracker.setVisitorTrackingState(null,!0),[3,12];case 12:return[2]}})})},t.prototype.pushUserSignOutAsync=function(t){return Qs(this,void 0,void 0,function(){var n,i,r,e,o,s,u,a,c;return Zs(this,function(f){switch(f.label){case 0:return[4,this.ensureInitialized()];case 1:return f.sent(),[4,this.setUserContextIfNeeded(t)];case 2:f.sent(),f.label=3;case 3:return f.trys.push([3,5,,6]),n=null!==(a=null===(u=this.sessionManager)||void 0===u?void 0:u.getSessionStartTime())&&void 0!==a?a:null,i=null!==n?Math.floor((Date.now()-n)/1e3):void 0,[4,this.sendUserEventToApi(Ca,t,this.lastUserAttributes,Js(Js({},void 0!==i&&{session_duration:i}),{logout_trigger:"user_initiated"}))];case 4:return f.sent(),this.logger.info("User signout event tracked",{cuid:t}),[3,6];case 5:return r=f.sent(),this.logger.warn("Failed to track signout event (tracking may be disabled)",{cuid:t,error:r}),[3,6];case 6:return f.trys.push([6,15,,16]),[4,this.anonymousVisitorManager.clearMergedUserId()];case 7:return f.sent(),[4,this.anonymousVisitorManager.clearPendingMerge()];case 8:return f.sent(),[4,this.clearUserContext()];case 9:f.sent(),this.logger.info("User context cleared, returning to anonymous mode (session continues)"),f.label=10;case 10:return f.trys.push([10,12,,13]),[4,this.visitorConfigManager.refreshConfig()];case 11:return e=f.sent(),this.visitorTrackingEnabled=!0===(null===(c=e.data)||void 0===c?void 0:c.visitorTrackingEnabled),this.logger.info("Visitor config refreshed on signout",{visitorTrackingEnabled:this.visitorTrackingEnabled}),[3,13];case 12:return o=f.sent(),this.logger.warn("Failed to refresh visitor config on signout, using existing value",{visitorTrackingEnabled:this.visitorTrackingEnabled,error:o}),[3,13];case 13:return[4,this.resetToAnonymousMode()];case 14:return f.sent(),this.logger.info("SDK remains active for anonymous tracking"),[3,16];case 15:throw s=f.sent(),this.logger.error("Failed to clear user context on signout",s),s;case 16:return[2]}})})},t.prototype.buildInternalEventAttributes=function(t){return Js(Js(Js({},this.userIdentified&&this.lastAuthenticatedUser&&{cuid:this.lastAuthenticatedUser}),this.visitorId&&{visitorId:this.visitorId}),t)},t.prototype.pushEvent=function(t,n){var i=this;this.pushEventAsync(t,n).catch(function(n){i.logger.error(Qu,{eventName:t,error:n})})},t.prototype.pushEventAsync=function(t,n){return Qs(this,void 0,void 0,function(){var i,r,e;return Zs(this,function(o){switch(o.label){case 0:return[4,this.ensureInitialized()];case 1:if(o.sent(),!this.visitorTrackingEnabled)return this.logger.warn("Event tracking skipped: Visitor tracking is disabled",{eventName:t}),[2];if(!this.userContextSet&&!this.visitorId)return this.logger.warn("Event tracking skipped: No visitor ID available and no user context set",{eventName:t}),[2];i=Js({},null!=n?n:{}),r={type:"behavioral",name:t,timestamp:Date.now(),data:i},o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.trackEvent(r)];case 3:return o.sent(),this.logger.info("Behavioral event tracked",{eventName:t,attributes:n}),[3,5];case 4:throw e=o.sent(),this.logger.error(Qu,{eventName:t,error:e}),e;case 5:return[2]}})})},t.prototype.disableSDK=function(){this.sdkDisabled?this.logger.warn("SDK is already disabled"):(this.sdkDisabled=!0,this.eventTracker&&this.eventTracker.pause(),this.logger.info("SDK disabled — event tracking stopped"))},t.prototype.enableSDK=function(){var t=this;this.sdkDisabled?(this.sdkDisabled=!1,this.eventTracker&&this.eventTracker.resume().catch(function(n){t.logger.error("Failed to resume event tracker",n)}),this.logger.info("SDK enabled — event tracking resumed")):this.logger.warn("SDK is already enabled")},t.prototype.getChannelType=function(){return this.config.channelType||La.WEB},t.prototype.resolveGamificationBaseUrl=function(t){return t.gamificationBaseUrl?t.gamificationBaseUrl:t.gamificationRegion?nh(t.gamificationRegion):th},t.prototype.applyConfigDefaults=function(){this.config.source=this.config.source||Pa.WEBPUSH,this.config.channelType=this.config.channelType||La.WEB;var t=fu/6e4;this.config.sessionTimeoutMinutes=this.config.sessionTimeoutMinutes||t,this.config.batchSize=this.config.batchSize||hu.BATCH_SIZE,this.config.debugLevel=this.config.debugLevel||"NONE",this.gamificationBaseUrl=this.resolveGamificationBaseUrl(this.config),this.logger.setEnabled(this.shouldEnableLogging(this.config.debugLevel)),this.logger.setLevel(this.resolveLogLevel(this.config.debugLevel))},t.prototype.applyRemoteConfigValues=function(t){this.config.accountId=t.accountId,this.config.baseURL=t.baseURL,this.config.orgId=t.orgId,this.config.source=t.source,this.config.channelType=t.channelType,this.config.brandId=this.config.brandId||t.brandId,this.config.applicationId=this.config.applicationId||t.applicationId,this.config.sessionTimeoutMinutes=t.sessionTimeoutMinutes,this.config.batchSize=t.batchSize,this.config.debugLevel=t.debugLevel,this.config.gamificationWriteKey=t.gamificationWriteKey||void 0,this.config.gamificationRegion=t.gamificationRegion||void 0,this.config.gamificationBaseUrl=t.gamificationBaseUrl||void 0,this.applyConfigDefaults(),this.logger.info("Session timeout configured:",{timeoutMinutes:this.config.sessionTimeoutMinutes,source:t.sessionTimeoutMinutes?"Remote Config":"Default"}),this.logger.info("Batch size configured:",{batchSize:this.config.batchSize,source:t.batchSize?"Remote Config":"Default"}),this.logger.info("Debug level configured:",{debugLevel:this.config.debugLevel,source:t.debugLevel?"Remote Config":"Default"})},t.prototype.applyDirectConfigValues=function(){this.applyConfigDefaults(),this.logger.info("✅ SDK configuration applied directly (no Remote Config)"),this.logger.debug("Final SDK config:",this.config)},t.prototype.bootstrapConfig=function(){return Qs(this,void 0,void 0,function(){return Zs(this,function(t){switch(t.label){case 0:return this.config.remoteConfigKey?[4,this.fetchAndApplyRemoteConfig()]:[3,2];case 1:return t.sent(),[3,3];case 2:this.applyDirectConfigValues(),this.initializeManagersFromConfig(),t.label=3;case 3:return[2]}})})},t.prototype.getExtendedFieldsForMerge=function(){return Qs(this,void 0,void 0,function(){var t,n,i;return Zs(this,function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),this.notificationManager?[4,this.notificationManager.getTokenCreationDate()]:[3,2];case 1:return n=r.sent(),[3,3];case 2:n=null,r.label=3;case 3:return t=n,[2,Rm(Js(Js({},this.config.appVersion?{appVersion:this.config.appVersion}:{}),{notificationPermissionGranted:"granted"===(null===(i=this.notificationManager)||void 0===i?void 0:i.getState().permissionStatus),fcmTokenCreatedAt:t}))];case 4:return r.sent(),[2,void 0];case 5:return[2]}})})},t.prototype.initializeManagersFromConfig=function(){var t=this;this.storageManager=new Dp(this.logger,this.config.brandId,this.config.applicationId),this.sessionManager=new Hp(this.storageManager,this.logger,this.config.brandId,this.config.applicationId,this.config.sessionTimeoutMinutes),this.apiClient=new yp({baseUrl:this.config.baseURL||""},this.logger,this.config.accountId||"",this.config.orgId||"",this.config.source||Pa.WEBPUSH);var n=this.apiClient;this.eventTracker=new kp(this.config,n,this.storageManager,this.logger);var i=this.config.orgId||"",r=this.config.accountId||"";this.visitorConfigManager=new Up(i,n,this.logger,this.storageManager,this.config.brandId,this.config.applicationId),this.anonymousVisitorManager=new Lp(r,i,n,this.logger,this.storageManager,Js(Js({},void 0!==this.config.brandId?{brandId:this.config.brandId}:{}),void 0!==this.config.applicationId?{applicationId:this.config.applicationId}:{})),this.anonymousVisitorManager.setMergeDataProviders(function(){var n;return(null===(n=t.notificationManager)||void 0===n?void 0:n.getFCMToken())||null},function(){return t.getChannelType()},function(){return t.getExtendedFieldsForMerge()},function(){var n;return"granted"===(null===(n=t.notificationManager)||void 0===n?void 0:n.getState().permissionStatus)},function(){var n,i;return null!==(i=null===(n=t.sessionManager)||void 0===n?void 0:n.getCurrentSessionId())&&void 0!==i?i:""}),this.config.gamificationWriteKey&&this.gamificationBaseUrl?this.gamificationManager=new wp(this.config.gamificationWriteKey,this.gamificationBaseUrl,this.logger,this.storageManager,function(n,i){return t.pushEvent(n,i)}):this.logger.info(Rf)},t.prototype.fetchAndApplyRemoteConfig=function(){return Qs(this,void 0,void 0,function(){var t,n,i,r,e,o,s,u,a,c,f,h;return Zs(this,function(d){switch(d.label){case 0:this.logger.info("📡 Fetching configuration from Firebase Remote Config..."),d.label=1;case 1:return d.trys.push([1,5,,6]),[4,Gp()];case 2:return t=d.sent(),[4,Vp()];case 3:return n=d.sent(),i=t.initializeApp||t,r=n.getRemoteConfig||n,e=n.fetchAndActivate,o=n.getValue,s=i(this.config.firebaseConfig),(u=r(s)).settings.minimumFetchIntervalMillis=36e5,this.logger.info("🔄 Fetching Remote Config from Firebase..."),[4,e(u)];case 4:if(d.sent()||this.logger.warn("⚠️ Remote Config fetched but not activated (using cached values)"),a=o(u,this.config.remoteConfigKey),!(c=a.asString()))throw new Error('Remote Config key "'.concat(this.config.remoteConfigKey,'" is empty or not found'));f=void 0;try{f=JSON.parse(c)}catch(t){throw new Error("Failed to parse Remote Config JSON: ".concat(t))}return this.logger.info("✅ Remote Config fetched successfully:",f),this.applyRemoteConfigValues(f),this.initializeManagersFromConfig(),this.logger.info("✅ SDK configuration applied from Remote Config"),this.logger.debug("Final SDK config:",this.config),[3,6];case 5:throw h=d.sent(),this.logger.error("❌ Failed to fetch Remote Config:",h),new Error("Remote Config bootstrap failed: ".concat(h));case 6:return[2]}})})},t.prototype.validateRequiredConfig=function(t){var n=[];if(t.remoteConfigKey?t.firebaseConfig||n.push("firebaseConfig"):(t.accountId||n.push("accountId"),t.baseURL||n.push("baseURL"),t.orgId||n.push("orgId")),n.length>0)throw new Error("WebSDK initialization failed: Missing required configuration fields: ".concat(n.join(", "),". ")+'Provide either "remoteConfigKey" + "firebaseConfig" (Remote Config bootstrap) or "accountId" + "baseURL" + "orgId" directly (direct-config bootstrap).')},t.prototype.ensureInitialized=function(){return Qs(this,void 0,void 0,function(){var t;return Zs(this,function(n){switch(n.label){case 0:if(!this.initializationPromise)return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.initializationPromise];case 2:return n.sent(),[3,4];case 3:throw t=n.sent(),new Error("SDK initialization failed: ".concat(t));case 4:if(!this.initialized)throw new Error("WebSDK must be initialized before tracking events. Call init() first.");return[2]}})})},t.prototype.setUserContextIfNeeded=function(t,n){return Qs(this,void 0,void 0,function(){return Zs(this,function(i){switch(i.label){case 0:return this.userContextSet?[3,2]:[4,this.setUserContext(t,n)];case 1:i.sent(),this.logger.debug("User context set automatically",{cuid:t}),i.label=2;case 2:return[2]}})})},t.prototype.queueUserOperation=function(t){var n=this;this.userOperationChain=this.userOperationChain.then(t).catch(function(t){n.logger.error("User operation failed",t)})},t._=null,t}();t.HydraSDK=Kp,t.default=Kp,Object.defineProperty(t,"I",{value:!0})});