@letscooee/web-sdk 11.5.7 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-it.json +1 -0
- package/dist/{chunk-USXC63XZ.js → chunk-ME7TXX2T.js} +1 -1
- package/dist/{chunk-52MI4V7M.js → chunk-MLL45BRS.js} +2 -2
- package/dist/{chunk-RBIGRBPH.js → chunk-OXJQG5CR.js} +1 -1
- package/dist/main.min.js +21 -21
- package/dist/{share-dialog.component-MM73NZWU.js → share-dialog.component-BC6UU4ZB.js} +1 -1
- package/dist/{video-detail-dialog.component-QABVZ4GF.js → video-detail-dialog.component-TNO4SN6Y.js} +1 -1
- package/dist/widget.min.js +2 -2
- package/package.json +1 -1
package/dist/main.min.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{a as _,b as Z,c as Lo,d as ym,e as Mo,f as Rr,g as Si}from"./chunk-V7UGKYBN.js";var Ii=Mo((Sm,ea)=>{"use strict";(function(t){"use strict";var e={};e.VERSION="1.6.1";var r,n={},i=function(p,d){return function(){return d.apply(p,arguments)}},o=function(){var p=arguments,d=p[0],f,E;for(E=1;E<p.length;E++)for(f in p[E])!(f in d)&&p[E].hasOwnProperty(f)&&(d[f]=p[E][f]);return d},s=function(p,d){return{value:p,name:d}};e.TRACE=s(1,"TRACE"),e.DEBUG=s(2,"DEBUG"),e.INFO=s(3,"INFO"),e.TIME=s(4,"TIME"),e.WARN=s(5,"WARN"),e.ERROR=s(8,"ERROR"),e.OFF=s(99,"OFF");var a=function(p){this.context=p,this.setLevel(p.filterLevel),this.log=this.info};a.prototype={setLevel:function(p){p&&"value"in p&&(this.context.filterLevel=p)},getLevel:function(){return this.context.filterLevel},enabledFor:function(p){var d=this.context.filterLevel;return p.value>=d.value},trace:function(){this.invoke(e.TRACE,arguments)},debug:function(){this.invoke(e.DEBUG,arguments)},info:function(){this.invoke(e.INFO,arguments)},warn:function(){this.invoke(e.WARN,arguments)},error:function(){this.invoke(e.ERROR,arguments)},time:function(p){typeof p=="string"&&p.length>0&&this.invoke(e.TIME,[p,"start"])},timeEnd:function(p){typeof p=="string"&&p.length>0&&this.invoke(e.TIME,[p,"end"])},invoke:function(p,d){r&&this.enabledFor(p)&&r(d,o({level:p},this.context))}};var c=new a({filterLevel:e.OFF});(function(){var p=e;p.enabledFor=i(c,c.enabledFor),p.trace=i(c,c.trace),p.debug=i(c,c.debug),p.time=i(c,c.time),p.timeEnd=i(c,c.timeEnd),p.info=i(c,c.info),p.warn=i(c,c.warn),p.error=i(c,c.error),p.log=p.info})(),e.setHandler=function(p){r=p},e.setLevel=function(p){c.setLevel(p);for(var d in n)n.hasOwnProperty(d)&&n[d].setLevel(p)},e.getLevel=function(){return c.getLevel()},e.get=function(p){return n[p]||(n[p]=new a(o({name:p},c.context)))},e.createDefaultHandler=function(p){p=p||{},p.formatter=p.formatter||function(y,T){T.name&&y.unshift("["+T.name+"]")};var d={},f=function(E,y){Function.prototype.apply.call(E,console,y)};return typeof console>"u"?function(){}:function(E,y){E=Array.prototype.slice.call(E);var T=console.log,D;y.level===e.TIME?(D=(y.name?"["+y.name+"] ":"")+E[0],E[1]==="start"?console.time?console.time(D):d[D]=new Date().getTime():console.timeEnd?console.timeEnd(D):f(T,[D+": "+(new Date().getTime()-d[D])+"ms"])):(y.level===e.WARN&&console.warn?T=console.warn:y.level===e.ERROR&&console.error?T=console.error:y.level===e.INFO&&console.info?T=console.info:y.level===e.DEBUG&&console.debug?T=console.debug:y.level===e.TRACE&&console.trace&&(T=console.trace),p.formatter(E,y),f(T,E))}},e.useDefaults=function(p){e.setLevel(p&&p.defaultLevel||e.DEBUG),e.setHandler(e.createDefaultHandler(p))},e.setDefaults=e.useDefaults,typeof define=="function"&&define.amd?define(e):typeof ea<"u"&&ea.exports?ea.exports=e:(e._prevLogger=t.Logger,e.noConflict=function(){return t.Logger=e._prevLogger,e},t.Logger=e)})(Sm)});var cu=Mo(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});ta.URLBuilder=void 0;var Vv=(function(){function t(e){try{this.base=new URL(e),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return t.prototype.appendQueryParam=function(e,r){this.params.append(e,r?r.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(e){this.params.delete(e)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(e){if(!this.params)return"";var r=this.params.get(e);return!r||r==="undefined"||r==="null"?void 0:r},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(e){return this.base.pathname=e,this},t.prototype.setQueryParam=function(e,r){return this.params.set(e,r?r.toString():""),this},t.prototype.setQueryString=function(e){if(e)return e[0]==="?"&&(e=e.slice(1)),this.params=new URLSearchParams(e),this},t.prototype.toString=function(){var e=this.params.toString();return e===""?this.base.search="":this.base.search="?"+e,this.base.toString()},t})();ta.URLBuilder=Vv});var Pm=Mo((Om,gu)=>{"use strict";(function(t){if(typeof Om=="object"&&typeof gu<"u")gu.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return(function n(i,o,s){function a(d,f){if(!o[d]){if(!i[d]){var E=typeof Lo=="function"&&Lo;if(!f&&E)return E(d,!0);if(c)return c(d,!0);var y=new Error("Cannot find module '"+d+"'");throw y.code="MODULE_NOT_FOUND",y}var T=o[d]={exports:{}};i[d][0].call(T.exports,function(D){var N=i[d][1][D];return a(N||D)},T,T.exports,n,i,o,s)}return o[d].exports}for(var c=typeof Lo=="function"&&Lo,p=0;p<s.length;p++)a(s[p]);return a})({1:[function(n,i,o){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,c;if(a){var p=0,d=new a(D),f=s.document.createTextNode("");d.observe(f,{characterData:!0}),c=function(){f.data=p=++p%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var E=new s.MessageChannel;E.port1.onmessage=D,c=function(){E.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?c=function(){var k=s.document.createElement("script");k.onreadystatechange=function(){D(),k.onreadystatechange=null,k.parentNode.removeChild(k),k=null},s.document.documentElement.appendChild(k)}:c=function(){setTimeout(D,0)};var y,T=[];function D(){y=!0;for(var k,G,P=T.length;P;){for(G=T,T=[],k=-1;++k<P;)G[k]();P=T.length}y=!1}i.exports=N;function N(k){T.push(k)===1&&!y&&c()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,i,o){"use strict";var s=n(1);function a(){}var c={},p=["REJECTED"],d=["FULFILLED"],f=["PENDING"];i.exports=E;function E(X){if(typeof X!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,X!==a&&N(this,X)}E.prototype.catch=function(X){return this.then(null,X)},E.prototype.then=function(X,ce){if(typeof X!="function"&&this.state===d||typeof ce!="function"&&this.state===p)return this;var se=new this.constructor(a);if(this.state!==f){var de=this.state===d?X:ce;T(se,de,this.outcome)}else this.queue.push(new y(se,X,ce));return se};function y(X,ce,se){this.promise=X,typeof ce=="function"&&(this.onFulfilled=ce,this.callFulfilled=this.otherCallFulfilled),typeof se=="function"&&(this.onRejected=se,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(X){c.resolve(this.promise,X)},y.prototype.otherCallFulfilled=function(X){T(this.promise,this.onFulfilled,X)},y.prototype.callRejected=function(X){c.reject(this.promise,X)},y.prototype.otherCallRejected=function(X){T(this.promise,this.onRejected,X)};function T(X,ce,se){s(function(){var de;try{de=ce(se)}catch(Be){return c.reject(X,Be)}de===X?c.reject(X,new TypeError("Cannot resolve promise with itself")):c.resolve(X,de)})}c.resolve=function(X,ce){var se=k(D,ce);if(se.status==="error")return c.reject(X,se.value);var de=se.value;if(de)N(X,de);else{X.state=d,X.outcome=ce;for(var Be=-1,Te=X.queue.length;++Be<Te;)X.queue[Be].callFulfilled(ce)}return X},c.reject=function(X,ce){X.state=p,X.outcome=ce;for(var se=-1,de=X.queue.length;++se<de;)X.queue[se].callRejected(ce);return X};function D(X){var ce=X&&X.then;if(X&&(typeof X=="object"||typeof X=="function")&&typeof ce=="function")return function(){ce.apply(X,arguments)}}function N(X,ce){var se=!1;function de(qe){se||(se=!0,c.reject(X,qe))}function Be(qe){se||(se=!0,c.resolve(X,qe))}function Te(){ce(Be,de)}var Ae=k(Te);Ae.status==="error"&&de(Ae.value)}function k(X,ce){var se={};try{se.value=X(ce),se.status="success"}catch(de){se.status="error",se.value=de}return se}E.resolve=G;function G(X){return X instanceof this?X:c.resolve(new this(a),X)}E.reject=P;function P(X){var ce=new this(a);return c.reject(ce,X)}E.all=Q;function Q(X){var ce=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=X.length,de=!1;if(!se)return this.resolve([]);for(var Be=new Array(se),Te=0,Ae=-1,qe=new this(a);++Ae<se;)et(X[Ae],Ae);return qe;function et(kt,A){ce.resolve(kt).then(R,function(V){de||(de=!0,c.reject(qe,V))});function R(V){Be[A]=V,++Te===se&&!de&&(de=!0,c.resolve(qe,Be))}}}E.race=_e;function _e(X){var ce=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=X.length,de=!1;if(!se)return this.resolve([]);for(var Be=-1,Te=new this(a);++Be<se;)Ae(X[Be]);return Te;function Ae(qe){ce.resolve(qe).then(function(et){de||(de=!0,c.resolve(Te,et))},function(et){de||(de=!0,c.reject(Te,et))})}}},{1:1}],3:[function(n,i,o){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m};function a(m,b){if(!(m instanceof b))throw new TypeError("Cannot call a class as a function")}function c(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var p=c();function d(){try{if(!p||!p.open)return!1;var m=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),b=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!m||b)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function f(m,b){m=m||[],b=b||{};try{return new Blob(m,b)}catch(S){if(S.name!=="TypeError")throw S;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,I=new g,x=0;x<m.length;x+=1)I.append(m[x]);return I.getBlob(b.type)}}typeof Promise>"u"&&n(3);var E=Promise;function y(m,b){b&&m.then(function(g){b(null,g)},function(g){b(g)})}function T(m,b,g){typeof b=="function"&&m.then(b),typeof g=="function"&&m.catch(g)}function D(m){return typeof m!="string"&&(console.warn(m+" used as a key, but it is not a string."),m=String(m)),m}function N(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var k="local-forage-detect-blob-support",G=void 0,P={},Q=Object.prototype.toString,_e="readonly",X="readwrite";function ce(m){for(var b=m.length,g=new ArrayBuffer(b),I=new Uint8Array(g),x=0;x<b;x++)I[x]=m.charCodeAt(x);return g}function se(m){return new E(function(b){var g=m.transaction(k,X),I=f([""]);g.objectStore(k).put(I,"key"),g.onabort=function(x){x.preventDefault(),x.stopPropagation(),b(!1)},g.oncomplete=function(){var x=navigator.userAgent.match(/Chrome\/(\d+)/),S=navigator.userAgent.match(/Edge\//);b(S||!x||parseInt(x[1],10)>=43)}}).catch(function(){return!1})}function de(m){return typeof G=="boolean"?E.resolve(G):se(m).then(function(b){return G=b,G})}function Be(m){var b=P[m.name],g={};g.promise=new E(function(I,x){g.resolve=I,g.reject=x}),b.deferredOperations.push(g),b.dbReady?b.dbReady=b.dbReady.then(function(){return g.promise}):b.dbReady=g.promise}function Te(m){var b=P[m.name],g=b.deferredOperations.pop();if(g)return g.resolve(),g.promise}function Ae(m,b){var g=P[m.name],I=g.deferredOperations.pop();if(I)return I.reject(b),I.promise}function qe(m,b){return new E(function(g,I){if(P[m.name]=P[m.name]||Xe(),m.db)if(b)Be(m),m.db.close();else return g(m.db);var x=[m.name];b&&x.push(m.version);var S=p.open.apply(p,x);b&&(S.onupgradeneeded=function(M){var z=S.result;try{z.createObjectStore(m.storeName),M.oldVersion<=1&&z.createObjectStore(k)}catch(Y){if(Y.name==="ConstraintError")console.warn('The database "'+m.name+'" has been upgraded from version '+M.oldVersion+" to version "+M.newVersion+', but the storage "'+m.storeName+'" already exists.');else throw Y}}),S.onerror=function(M){M.preventDefault(),I(S.error)},S.onsuccess=function(){var M=S.result;M.onversionchange=function(z){z.target.close()},g(M),Te(m)}})}function et(m){return qe(m,!1)}function kt(m){return qe(m,!0)}function A(m,b){if(!m.db)return!0;var g=!m.db.objectStoreNames.contains(m.storeName),I=m.version<m.db.version,x=m.version>m.db.version;if(I&&(m.version!==b&&console.warn('The database "'+m.name+`" can't be downgraded from version `+m.db.version+" to version "+m.version+"."),m.version=m.db.version),x||g){if(g){var S=m.db.version+1;S>m.version&&(m.version=S)}return!0}return!1}function R(m){return new E(function(b,g){var I=new FileReader;I.onerror=g,I.onloadend=function(x){var S=btoa(x.target.result||"");b({__local_forage_encoded_blob:!0,data:S,type:m.type})},I.readAsBinaryString(m)})}function V(m){var b=ce(atob(m.data));return f([b],{type:m.type})}function U(m){return m&&m.__local_forage_encoded_blob}function H(m){var b=this,g=b._initReady().then(function(){var I=P[b._dbInfo.name];if(I&&I.dbReady)return I.dbReady});return T(g,m,m),g}function ne(m){Be(m);for(var b=P[m.name],g=b.forages,I=0;I<g.length;I++){var x=g[I];x._dbInfo.db&&(x._dbInfo.db.close(),x._dbInfo.db=null)}return m.db=null,et(m).then(function(S){return m.db=S,A(m)?kt(m):S}).then(function(S){m.db=b.db=S;for(var M=0;M<g.length;M++)g[M]._dbInfo.db=S}).catch(function(S){throw Ae(m,S),S})}function ge(m,b,g,I){I===void 0&&(I=1);try{var x=m.db.transaction(m.storeName,b);g(null,x)}catch(S){if(I>0&&(!m.db||S.name==="InvalidStateError"||S.name==="NotFoundError"))return E.resolve().then(function(){if(!m.db||S.name==="NotFoundError"&&!m.db.objectStoreNames.contains(m.storeName)&&m.version<=m.db.version)return m.db&&(m.version=m.db.version+1),kt(m)}).then(function(){return ne(m).then(function(){ge(m,b,g,I-1)})}).catch(g);g(S)}}function Xe(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function nt(m){var b=this,g={db:null};if(m)for(var I in m)g[I]=m[I];var x=P[g.name];x||(x=Xe(),P[g.name]=x),x.forages.push(b),b._initReady||(b._initReady=b.ready,b.ready=H);var S=[];function M(){return E.resolve()}for(var z=0;z<x.forages.length;z++){var Y=x.forages[z];Y!==b&&S.push(Y._initReady().catch(M))}var q=x.forages.slice(0);return E.all(S).then(function(){return g.db=x.db,et(g)}).then(function(J){return g.db=J,A(g,b._defaultConfig.version)?kt(g):J}).then(function(J){g.db=x.db=J,b._dbInfo=g;for(var te=0;te<q.length;te++){var Ee=q[te];Ee!==b&&(Ee._dbInfo.db=g.db,Ee._dbInfo.version=g.version)}})}function it(m,b){var g=this;m=D(m);var I=new E(function(x,S){g.ready().then(function(){ge(g._dbInfo,_e,function(M,z){if(M)return S(M);try{var Y=z.objectStore(g._dbInfo.storeName),q=Y.get(m);q.onsuccess=function(){var J=q.result;J===void 0&&(J=null),U(J)&&(J=V(J)),x(J)},q.onerror=function(){S(q.error)}}catch(J){S(J)}})}).catch(S)});return y(I,b),I}function bt(m,b){var g=this,I=new E(function(x,S){g.ready().then(function(){ge(g._dbInfo,_e,function(M,z){if(M)return S(M);try{var Y=z.objectStore(g._dbInfo.storeName),q=Y.openCursor(),J=1;q.onsuccess=function(){var te=q.result;if(te){var Ee=te.value;U(Ee)&&(Ee=V(Ee));var Oe=m(Ee,te.key,J++);Oe!==void 0?x(Oe):te.continue()}else x()},q.onerror=function(){S(q.error)}}catch(te){S(te)}})}).catch(S)});return y(I,b),I}function wt(m,b,g){var I=this;m=D(m);var x=new E(function(S,M){var z;I.ready().then(function(){return z=I._dbInfo,Q.call(b)==="[object Blob]"?de(z.db).then(function(Y){return Y?b:R(b)}):b}).then(function(Y){ge(I._dbInfo,X,function(q,J){if(q)return M(q);try{var te=J.objectStore(I._dbInfo.storeName);Y===null&&(Y=void 0);var Ee=te.put(Y,m);J.oncomplete=function(){Y===void 0&&(Y=null),S(Y)},J.onabort=J.onerror=function(){var Oe=Ee.error?Ee.error:Ee.transaction.error;M(Oe)}}catch(Oe){M(Oe)}})}).catch(M)});return y(x,g),x}function lt(m,b){var g=this;m=D(m);var I=new E(function(x,S){g.ready().then(function(){ge(g._dbInfo,X,function(M,z){if(M)return S(M);try{var Y=z.objectStore(g._dbInfo.storeName),q=Y.delete(m);z.oncomplete=function(){x()},z.onerror=function(){S(q.error)},z.onabort=function(){var J=q.error?q.error:q.transaction.error;S(J)}}catch(J){S(J)}})}).catch(S)});return y(I,b),I}function Se(m){var b=this,g=new E(function(I,x){b.ready().then(function(){ge(b._dbInfo,X,function(S,M){if(S)return x(S);try{var z=M.objectStore(b._dbInfo.storeName),Y=z.clear();M.oncomplete=function(){I()},M.onabort=M.onerror=function(){var q=Y.error?Y.error:Y.transaction.error;x(q)}}catch(q){x(q)}})}).catch(x)});return y(g,m),g}function Ve(m){var b=this,g=new E(function(I,x){b.ready().then(function(){ge(b._dbInfo,_e,function(S,M){if(S)return x(S);try{var z=M.objectStore(b._dbInfo.storeName),Y=z.count();Y.onsuccess=function(){I(Y.result)},Y.onerror=function(){x(Y.error)}}catch(q){x(q)}})}).catch(x)});return y(g,m),g}function De(m,b){var g=this,I=new E(function(x,S){if(m<0){x(null);return}g.ready().then(function(){ge(g._dbInfo,_e,function(M,z){if(M)return S(M);try{var Y=z.objectStore(g._dbInfo.storeName),q=!1,J=Y.openKeyCursor();J.onsuccess=function(){var te=J.result;if(!te){x(null);return}m===0||q?x(te.key):(q=!0,te.advance(m))},J.onerror=function(){S(J.error)}}catch(te){S(te)}})}).catch(S)});return y(I,b),I}function We(m){var b=this,g=new E(function(I,x){b.ready().then(function(){ge(b._dbInfo,_e,function(S,M){if(S)return x(S);try{var z=M.objectStore(b._dbInfo.storeName),Y=z.openKeyCursor(),q=[];Y.onsuccess=function(){var J=Y.result;if(!J){I(q);return}q.push(J.key),J.continue()},Y.onerror=function(){x(Y.error)}}catch(J){x(J)}})}).catch(x)});return y(g,m),g}function Ne(m,b){b=N.apply(this,arguments);var g=this.config();m=typeof m!="function"&&m||{},m.name||(m.name=m.name||g.name,m.storeName=m.storeName||g.storeName);var I=this,x;if(!m.name)x=E.reject("Invalid arguments");else{var S=m.name===g.name&&I._dbInfo.db,M=S?E.resolve(I._dbInfo.db):et(m).then(function(z){var Y=P[m.name],q=Y.forages;Y.db=z;for(var J=0;J<q.length;J++)q[J]._dbInfo.db=z;return z});m.storeName?x=M.then(function(z){if(z.objectStoreNames.contains(m.storeName)){var Y=z.version+1;Be(m);var q=P[m.name],J=q.forages;z.close();for(var te=0;te<J.length;te++){var Ee=J[te];Ee._dbInfo.db=null,Ee._dbInfo.version=Y}var Oe=new E(function(Pe,st){var tt=p.open(m.name,Y);tt.onerror=function(Zt){var Po=tt.result;Po.close(),st(Zt)},tt.onupgradeneeded=function(){var Zt=tt.result;Zt.deleteObjectStore(m.storeName)},tt.onsuccess=function(){var Zt=tt.result;Zt.close(),Pe(Zt)}});return Oe.then(function(Pe){q.db=Pe;for(var st=0;st<J.length;st++){var tt=J[st];tt._dbInfo.db=Pe,Te(tt._dbInfo)}}).catch(function(Pe){throw(Ae(m,Pe)||E.resolve()).catch(function(){}),Pe})}}):x=M.then(function(z){Be(m);var Y=P[m.name],q=Y.forages;z.close();for(var J=0;J<q.length;J++){var te=q[J];te._dbInfo.db=null}var Ee=new E(function(Oe,Pe){var st=p.deleteDatabase(m.name);st.onerror=function(){var tt=st.result;tt&&tt.close(),Pe(st.error)},st.onblocked=function(){console.warn('dropInstance blocked for database "'+m.name+'" until all open connections are closed')},st.onsuccess=function(){var tt=st.result;tt&&tt.close(),Oe(tt)}});return Ee.then(function(Oe){Y.db=Oe;for(var Pe=0;Pe<q.length;Pe++){var st=q[Pe];Te(st._dbInfo)}}).catch(function(Oe){throw(Ae(m,Oe)||E.resolve()).catch(function(){}),Oe})})}return y(x,b),x}var Gt={_driver:"asyncStorage",_initStorage:nt,_support:d(),iterate:bt,getItem:it,setItem:wt,removeItem:lt,clear:Se,length:Ve,key:De,keys:We,dropInstance:Ne};function h(){return typeof openDatabase=="function"}var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",v=/^~~local_forage_type~([^~]+)~/,C="__lfsc__:",O=C.length,W="arbf",pe="blob",be="si08",ye="ui08",ke="uic8",He="si16",ot="si32",hr="ur16",qr="ui32",bi="fl32",gr="fl64",yr=O+W.length,lm=Object.prototype.toString;function um(m){var b=m.length*.75,g=m.length,I,x=0,S,M,z,Y;m[m.length-1]==="="&&(b--,m[m.length-2]==="="&&b--);var q=new ArrayBuffer(b),J=new Uint8Array(q);for(I=0;I<g;I+=4)S=l.indexOf(m[I]),M=l.indexOf(m[I+1]),z=l.indexOf(m[I+2]),Y=l.indexOf(m[I+3]),J[x++]=S<<2|M>>4,J[x++]=(M&15)<<4|z>>2,J[x++]=(z&3)<<6|Y&63;return q}function eu(m){var b=new Uint8Array(m),g="",I;for(I=0;I<b.length;I+=3)g+=l[b[I]>>2],g+=l[(b[I]&3)<<4|b[I+1]>>4],g+=l[(b[I+1]&15)<<2|b[I+2]>>6],g+=l[b[I+2]&63];return b.length%3===2?g=g.substring(0,g.length-1)+"=":b.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function rv(m,b){var g="";if(m&&(g=lm.call(m)),m&&(g==="[object ArrayBuffer]"||m.buffer&&lm.call(m.buffer)==="[object ArrayBuffer]")){var I,x=C;m instanceof ArrayBuffer?(I=m,x+=W):(I=m.buffer,g==="[object Int8Array]"?x+=be:g==="[object Uint8Array]"?x+=ye:g==="[object Uint8ClampedArray]"?x+=ke:g==="[object Int16Array]"?x+=He:g==="[object Uint16Array]"?x+=hr:g==="[object Int32Array]"?x+=ot:g==="[object Uint32Array]"?x+=qr:g==="[object Float32Array]"?x+=bi:g==="[object Float64Array]"?x+=gr:b(new Error("Failed to get type for BinaryArray"))),b(x+eu(I))}else if(g==="[object Blob]"){var S=new FileReader;S.onload=function(){var M=u+m.type+"~"+eu(this.result);b(C+pe+M)},S.readAsArrayBuffer(m)}else try{b(JSON.stringify(m))}catch(M){console.error("Couldn't convert value into a JSON string: ",m),b(null,M)}}function nv(m){if(m.substring(0,O)!==C)return JSON.parse(m);var b=m.substring(yr),g=m.substring(O,yr),I;if(g===pe&&v.test(b)){var x=b.match(v);I=x[1],b=b.substring(x[0].length)}var S=um(b);switch(g){case W:return S;case pe:return f([S],{type:I});case be:return new Int8Array(S);case ye:return new Uint8Array(S);case ke:return new Uint8ClampedArray(S);case He:return new Int16Array(S);case hr:return new Uint16Array(S);case ot:return new Int32Array(S);case qr:return new Uint32Array(S);case bi:return new Float32Array(S);case gr:return new Float64Array(S);default:throw new Error("Unkown type: "+g)}}var tu={serialize:rv,deserialize:nv,stringToBuffer:um,bufferToString:eu};function pm(m,b,g,I){m.executeSql("CREATE TABLE IF NOT EXISTS "+b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,I)}function iv(m){var b=this,g={db:null};if(m)for(var I in m)g[I]=typeof m[I]!="string"?m[I].toString():m[I];var x=new E(function(S,M){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(z){return M(z)}g.db.transaction(function(z){pm(z,g,function(){b._dbInfo=g,S()},function(Y,q){M(q)})},M)});return g.serializer=tu,x}function gn(m,b,g,I,x,S){m.executeSql(g,I,x,function(M,z){z.code===z.SYNTAX_ERR?M.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(Y,q){q.rows.length?S(Y,z):pm(Y,b,function(){Y.executeSql(g,I,x,S)},S)},S):S(M,z)},S)}function ov(m,b){var g=this;m=D(m);var I=new E(function(x,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(z){gn(z,M,"SELECT * FROM "+M.storeName+" WHERE key = ? LIMIT 1",[m],function(Y,q){var J=q.rows.length?q.rows.item(0).value:null;J&&(J=M.serializer.deserialize(J)),x(J)},function(Y,q){S(q)})})}).catch(S)});return y(I,b),I}function sv(m,b){var g=this,I=new E(function(x,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(z){gn(z,M,"SELECT * FROM "+M.storeName,[],function(Y,q){for(var J=q.rows,te=J.length,Ee=0;Ee<te;Ee++){var Oe=J.item(Ee),Pe=Oe.value;if(Pe&&(Pe=M.serializer.deserialize(Pe)),Pe=m(Pe,Oe.key,Ee+1),Pe!==void 0){x(Pe);return}}x()},function(Y,q){S(q)})})}).catch(S)});return y(I,b),I}function fm(m,b,g,I){var x=this;m=D(m);var S=new E(function(M,z){x.ready().then(function(){b===void 0&&(b=null);var Y=b,q=x._dbInfo;q.serializer.serialize(b,function(J,te){te?z(te):q.db.transaction(function(Ee){gn(Ee,q,"INSERT OR REPLACE INTO "+q.storeName+" (key, value) VALUES (?, ?)",[m,J],function(){M(Y)},function(Oe,Pe){z(Pe)})},function(Ee){if(Ee.code===Ee.QUOTA_ERR){if(I>0){M(fm.apply(x,[m,Y,g,I-1]));return}z(Ee)}})})}).catch(z)});return y(S,g),S}function av(m,b,g){return fm.apply(this,[m,b,g,1])}function cv(m,b){var g=this;m=D(m);var I=new E(function(x,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(z){gn(z,M,"DELETE FROM "+M.storeName+" WHERE key = ?",[m],function(){x()},function(Y,q){S(q)})})}).catch(S)});return y(I,b),I}function lv(m){var b=this,g=new E(function(I,x){b.ready().then(function(){var S=b._dbInfo;S.db.transaction(function(M){gn(M,S,"DELETE FROM "+S.storeName,[],function(){I()},function(z,Y){x(Y)})})}).catch(x)});return y(g,m),g}function uv(m){var b=this,g=new E(function(I,x){b.ready().then(function(){var S=b._dbInfo;S.db.transaction(function(M){gn(M,S,"SELECT COUNT(key) as c FROM "+S.storeName,[],function(z,Y){var q=Y.rows.item(0).c;I(q)},function(z,Y){x(Y)})})}).catch(x)});return y(g,m),g}function pv(m,b){var g=this,I=new E(function(x,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(z){gn(z,M,"SELECT key FROM "+M.storeName+" WHERE id = ? LIMIT 1",[m+1],function(Y,q){var J=q.rows.length?q.rows.item(0).key:null;x(J)},function(Y,q){S(q)})})}).catch(S)});return y(I,b),I}function fv(m){var b=this,g=new E(function(I,x){b.ready().then(function(){var S=b._dbInfo;S.db.transaction(function(M){gn(M,S,"SELECT key FROM "+S.storeName,[],function(z,Y){for(var q=[],J=0;J<Y.rows.length;J++)q.push(Y.rows.item(J).key);I(q)},function(z,Y){x(Y)})})}).catch(x)});return y(g,m),g}function mv(m){return new E(function(b,g){m.transaction(function(I){I.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(x,S){for(var M=[],z=0;z<S.rows.length;z++)M.push(S.rows.item(z).name);b({db:m,storeNames:M})},function(x,S){g(S)})},function(I){g(I)})})}function dv(m,b){b=N.apply(this,arguments);var g=this.config();m=typeof m!="function"&&m||{},m.name||(m.name=m.name||g.name,m.storeName=m.storeName||g.storeName);var I=this,x;return m.name?x=new E(function(S){var M;m.name===g.name?M=I._dbInfo.db:M=openDatabase(m.name,"","",0),m.storeName?S({db:M,storeNames:[m.storeName]}):S(mv(M))}).then(function(S){return new E(function(M,z){S.db.transaction(function(Y){function q(Oe){return new E(function(Pe,st){Y.executeSql("DROP TABLE IF EXISTS "+Oe,[],function(){Pe()},function(tt,Zt){st(Zt)})})}for(var J=[],te=0,Ee=S.storeNames.length;te<Ee;te++)J.push(q(S.storeNames[te]));E.all(J).then(function(){M()}).catch(function(Oe){z(Oe)})},function(Y){z(Y)})})}):x=E.reject("Invalid arguments"),y(x,b),x}var hv={_driver:"webSQLStorage",_initStorage:iv,_support:h(),iterate:sv,getItem:ov,setItem:av,removeItem:cv,clear:lv,length:uv,key:pv,keys:fv,dropInstance:dv};function gv(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function mm(m,b){var g=m.name+"/";return m.storeName!==b.storeName&&(g+=m.storeName+"/"),g}function yv(){var m="_localforage_support_test";try{return localStorage.setItem(m,!0),localStorage.removeItem(m),!1}catch{return!0}}function vv(){return!yv()||localStorage.length>0}function Ev(m){var b=this,g={};if(m)for(var I in m)g[I]=m[I];return g.keyPrefix=mm(m,b._defaultConfig),vv()?(b._dbInfo=g,g.serializer=tu,E.resolve()):E.reject()}function _v(m){var b=this,g=b.ready().then(function(){for(var I=b._dbInfo.keyPrefix,x=localStorage.length-1;x>=0;x--){var S=localStorage.key(x);S.indexOf(I)===0&&localStorage.removeItem(S)}});return y(g,m),g}function bv(m,b){var g=this;m=D(m);var I=g.ready().then(function(){var x=g._dbInfo,S=localStorage.getItem(x.keyPrefix+m);return S&&(S=x.serializer.deserialize(S)),S});return y(I,b),I}function wv(m,b){var g=this,I=g.ready().then(function(){for(var x=g._dbInfo,S=x.keyPrefix,M=S.length,z=localStorage.length,Y=1,q=0;q<z;q++){var J=localStorage.key(q);if(J.indexOf(S)===0){var te=localStorage.getItem(J);if(te&&(te=x.serializer.deserialize(te)),te=m(te,J.substring(M),Y++),te!==void 0)return te}}});return y(I,b),I}function Sv(m,b){var g=this,I=g.ready().then(function(){var x=g._dbInfo,S;try{S=localStorage.key(m)}catch{S=null}return S&&(S=S.substring(x.keyPrefix.length)),S});return y(I,b),I}function Iv(m){var b=this,g=b.ready().then(function(){for(var I=b._dbInfo,x=localStorage.length,S=[],M=0;M<x;M++){var z=localStorage.key(M);z.indexOf(I.keyPrefix)===0&&S.push(z.substring(I.keyPrefix.length))}return S});return y(g,m),g}function Tv(m){var b=this,g=b.keys().then(function(I){return I.length});return y(g,m),g}function xv(m,b){var g=this;m=D(m);var I=g.ready().then(function(){var x=g._dbInfo;localStorage.removeItem(x.keyPrefix+m)});return y(I,b),I}function Cv(m,b,g){var I=this;m=D(m);var x=I.ready().then(function(){b===void 0&&(b=null);var S=b;return new E(function(M,z){var Y=I._dbInfo;Y.serializer.serialize(b,function(q,J){if(J)z(J);else try{localStorage.setItem(Y.keyPrefix+m,q),M(S)}catch(te){(te.name==="QuotaExceededError"||te.name==="NS_ERROR_DOM_QUOTA_REACHED")&&z(te),z(te)}})})});return y(x,g),x}function Rv(m,b){if(b=N.apply(this,arguments),m=typeof m!="function"&&m||{},!m.name){var g=this.config();m.name=m.name||g.name,m.storeName=m.storeName||g.storeName}var I=this,x;return m.name?x=new E(function(S){m.storeName?S(mm(m,I._defaultConfig)):S(m.name+"/")}).then(function(S){for(var M=localStorage.length-1;M>=0;M--){var z=localStorage.key(M);z.indexOf(S)===0&&localStorage.removeItem(z)}}):x=E.reject("Invalid arguments"),y(x,b),x}var Av={_driver:"localStorageWrapper",_initStorage:Ev,_support:gv(),iterate:wv,getItem:bv,setItem:Cv,removeItem:xv,clear:_v,length:Tv,key:Sv,keys:Iv,dropInstance:Rv},Dv=function(b,g){return b===g||typeof b=="number"&&typeof g=="number"&&isNaN(b)&&isNaN(g)},Nv=function(b,g){for(var I=b.length,x=0;x<I;){if(Dv(b[x],g))return!0;x++}return!1},dm=Array.isArray||function(m){return Object.prototype.toString.call(m)==="[object Array]"},Oo={},hm={},wi={INDEXEDDB:Gt,WEBSQL:hv,LOCALSTORAGE:Av},Ov=[wi.INDEXEDDB._driver,wi.WEBSQL._driver,wi.LOCALSTORAGE._driver],Js=["dropInstance"],ru=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Js),Pv={description:"",driver:Ov.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Lv(m,b){m[b]=function(){var g=arguments;return m.ready().then(function(){return m[b].apply(m,g)})}}function nu(){for(var m=1;m<arguments.length;m++){var b=arguments[m];if(b)for(var g in b)b.hasOwnProperty(g)&&(dm(b[g])?arguments[0][g]=b[g].slice():arguments[0][g]=b[g])}return arguments[0]}var Mv=(function(){function m(b){a(this,m);for(var g in wi)if(wi.hasOwnProperty(g)){var I=wi[g],x=I._driver;this[g]=x,Oo[x]||this.defineDriver(I)}this._defaultConfig=nu({},Pv),this._config=nu({},this._defaultConfig,b),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return m.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var I in g){if(I==="storeName"&&(g[I]=g[I].replace(/\W/g,"_")),I==="version"&&typeof g[I]!="number")return new Error("Database version must be a number.");this._config[I]=g[I]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},m.prototype.defineDriver=function(g,I,x){var S=new E(function(M,z){try{var Y=g._driver,q=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){z(q);return}for(var J=ru.concat("_initStorage"),te=0,Ee=J.length;te<Ee;te++){var Oe=J[te],Pe=!Nv(Js,Oe);if((Pe||g[Oe])&&typeof g[Oe]!="function"){z(q);return}}var st=function(){for(var Po=function(Uv){return function(){var Fv=new Error("Method "+Uv+" is not implemented by the current driver"),gm=E.reject(Fv);return y(gm,arguments[arguments.length-1]),gm}},iu=0,kv=Js.length;iu<kv;iu++){var ou=Js[iu];g[ou]||(g[ou]=Po(ou))}};st();var tt=function(Po){Oo[Y]&&console.info("Redefining LocalForage driver: "+Y),Oo[Y]=g,hm[Y]=Po,M()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(tt,z):tt(!!g._support):tt(!0)}catch(Zt){z(Zt)}});return T(S,I,x),S},m.prototype.driver=function(){return this._driver||null},m.prototype.getDriver=function(g,I,x){var S=Oo[g]?E.resolve(Oo[g]):E.reject(new Error("Driver not found."));return T(S,I,x),S},m.prototype.getSerializer=function(g){var I=E.resolve(tu);return T(I,g),I},m.prototype.ready=function(g){var I=this,x=I._driverSet.then(function(){return I._ready===null&&(I._ready=I._initDriver()),I._ready});return T(x,g,g),x},m.prototype.setDriver=function(g,I,x){var S=this;dm(g)||(g=[g]);var M=this._getSupportedDrivers(g);function z(){S._config.driver=S.driver()}function Y(te){return S._extend(te),z(),S._ready=S._initStorage(S._config),S._ready}function q(te){return function(){var Ee=0;function Oe(){for(;Ee<te.length;){var Pe=te[Ee];return Ee++,S._dbInfo=null,S._ready=null,S.getDriver(Pe).then(Y).catch(Oe)}z();var st=new Error("No available storage method found.");return S._driverSet=E.reject(st),S._driverSet}return Oe()}}var J=this._driverSet!==null?this._driverSet.catch(function(){return E.resolve()}):E.resolve();return this._driverSet=J.then(function(){var te=M[0];return S._dbInfo=null,S._ready=null,S.getDriver(te).then(function(Ee){S._driver=Ee._driver,z(),S._wrapLibraryMethodsWithReady(),S._initDriver=q(M)})}).catch(function(){z();var te=new Error("No available storage method found.");return S._driverSet=E.reject(te),S._driverSet}),T(this._driverSet,I,x),this._driverSet},m.prototype.supports=function(g){return!!hm[g]},m.prototype._extend=function(g){nu(this,g)},m.prototype._getSupportedDrivers=function(g){for(var I=[],x=0,S=g.length;x<S;x++){var M=g[x];this.supports(M)&&I.push(M)}return I},m.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,I=ru.length;g<I;g++)Lv(this,ru[g])},m.prototype.createInstance=function(g){return new m(g)},m})(),Bv=new Mv;i.exports=Bv},{3:3}]},{},[4])(4)})});var Lm=Mo((vu,Eu)=>{"use strict";(function(t,e){typeof vu=="object"&&typeof Eu<"u"?Eu.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.fetchRetry=e())})(vu,function(){"use strict";var t=function(n,i){if(i=i||{},typeof n!="function")throw new r("fetch must be a function");if(typeof i!="object")throw new r("defaults must be an object");if(i.retries!==void 0&&!e(i.retries))throw new r("retries must be a positive integer");if(i.retryDelay!==void 0&&!e(i.retryDelay)&&typeof i.retryDelay!="function")throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(i.retryOn!==void 0&&!Array.isArray(i.retryOn)&&typeof i.retryOn!="function")throw new r("retryOn property expects an array or function");var o={retries:3,retryDelay:1e3,retryOn:[]};return i=Object.assign(o,i),function(a,c){var p=i.retries,d=i.retryDelay,f=i.retryOn;if(c&&c.retries!==void 0)if(e(c.retries))p=c.retries;else throw new r("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(e(c.retryDelay)||typeof c.retryDelay=="function")d=c.retryDelay;else throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")f=c.retryOn;else throw new r("retryOn property expects an array or function");return new Promise(function(E,y){var T=function(N){var k=typeof Request<"u"&&a instanceof Request?a.clone():a;n(k,c).then(function(G){if(Array.isArray(f)&&f.indexOf(G.status)===-1)E(G);else if(typeof f=="function")try{return Promise.resolve(f(N,null,G)).then(function(P){P?D(N,null,G):E(G)}).catch(y)}catch(P){y(P)}else N<p?D(N,null,G):E(G)}).catch(function(G){if(typeof f=="function")try{Promise.resolve(f(N,G,null)).then(function(P){P?D(N,G,null):y(G)}).catch(function(P){y(P)})}catch(P){y(P)}else N<p?D(N,G,null):y(G)})};function D(N,k,G){var P=typeof d=="function"?d(N,k,G):d;setTimeout(function(){T(++N)},P)}T(0)})}};function e(n){return Number.isInteger(n)&&n>=0}function r(n){this.name="ArgumentError",this.message=n}return t})});var fg=Mo((pc,pg)=>{"use strict";(function(t,e){typeof pc=="object"&&typeof pg<"u"?e(pc):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).Sqrl={})})(pc,function(t){"use strict";function e(A){var R,V,U=new Error(A);return R=U,V=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(R,V):R.__proto__=V,U}function r(A,R,V){var U=R.slice(0,V).split(/\n/),H=U.length,ne=U[H-1].length+1;throw e(A+=" at line "+H+" col "+ne+`:
|
|
1
|
+
import{a as _,b as Z,c as No,d as wm,e as Oo,f as xr,g as wi}from"./chunk-V7UGKYBN.js";var Si=Oo((Rm,Xs)=>{"use strict";(function(t){"use strict";var e={};e.VERSION="1.6.1";var r,n={},i=function(p,d){return function(){return d.apply(p,arguments)}},o=function(){var p=arguments,d=p[0],f,E;for(E=1;E<p.length;E++)for(f in p[E])!(f in d)&&p[E].hasOwnProperty(f)&&(d[f]=p[E][f]);return d},s=function(p,d){return{value:p,name:d}};e.TRACE=s(1,"TRACE"),e.DEBUG=s(2,"DEBUG"),e.INFO=s(3,"INFO"),e.TIME=s(4,"TIME"),e.WARN=s(5,"WARN"),e.ERROR=s(8,"ERROR"),e.OFF=s(99,"OFF");var a=function(p){this.context=p,this.setLevel(p.filterLevel),this.log=this.info};a.prototype={setLevel:function(p){p&&"value"in p&&(this.context.filterLevel=p)},getLevel:function(){return this.context.filterLevel},enabledFor:function(p){var d=this.context.filterLevel;return p.value>=d.value},trace:function(){this.invoke(e.TRACE,arguments)},debug:function(){this.invoke(e.DEBUG,arguments)},info:function(){this.invoke(e.INFO,arguments)},warn:function(){this.invoke(e.WARN,arguments)},error:function(){this.invoke(e.ERROR,arguments)},time:function(p){typeof p=="string"&&p.length>0&&this.invoke(e.TIME,[p,"start"])},timeEnd:function(p){typeof p=="string"&&p.length>0&&this.invoke(e.TIME,[p,"end"])},invoke:function(p,d){r&&this.enabledFor(p)&&r(d,o({level:p},this.context))}};var c=new a({filterLevel:e.OFF});(function(){var p=e;p.enabledFor=i(c,c.enabledFor),p.trace=i(c,c.trace),p.debug=i(c,c.debug),p.time=i(c,c.time),p.timeEnd=i(c,c.timeEnd),p.info=i(c,c.info),p.warn=i(c,c.warn),p.error=i(c,c.error),p.log=p.info})(),e.setHandler=function(p){r=p},e.setLevel=function(p){c.setLevel(p);for(var d in n)n.hasOwnProperty(d)&&n[d].setLevel(p)},e.getLevel=function(){return c.getLevel()},e.get=function(p){return n[p]||(n[p]=new a(o({name:p},c.context)))},e.createDefaultHandler=function(p){p=p||{},p.formatter=p.formatter||function(y,T){T.name&&y.unshift("["+T.name+"]")};var d={},f=function(E,y){Function.prototype.apply.call(E,console,y)};return typeof console>"u"?function(){}:function(E,y){E=Array.prototype.slice.call(E);var T=console.log,D;y.level===e.TIME?(D=(y.name?"["+y.name+"] ":"")+E[0],E[1]==="start"?console.time?console.time(D):d[D]=new Date().getTime():console.timeEnd?console.timeEnd(D):f(T,[D+": "+(new Date().getTime()-d[D])+"ms"])):(y.level===e.WARN&&console.warn?T=console.warn:y.level===e.ERROR&&console.error?T=console.error:y.level===e.INFO&&console.info?T=console.info:y.level===e.DEBUG&&console.debug?T=console.debug:y.level===e.TRACE&&console.trace&&(T=console.trace),p.formatter(E,y),f(T,E))}},e.useDefaults=function(p){e.setLevel(p&&p.defaultLevel||e.DEBUG),e.setHandler(e.createDefaultHandler(p))},e.setDefaults=e.useDefaults,typeof define=="function"&&define.amd?define(e):typeof Xs<"u"&&Xs.exports?Xs.exports=e:(e._prevLogger=t.Logger,e.noConflict=function(){return t.Logger=e._prevLogger,e},t.Logger=e)})(Rm)});var su=Oo(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Js.URLBuilder=void 0;var Kv=(function(){function t(e){try{this.base=new URL(e),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return t.prototype.appendQueryParam=function(e,r){this.params.append(e,r?r.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(e){this.params.delete(e)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(e){if(!this.params)return"";var r=this.params.get(e);return!r||r==="undefined"||r==="null"?void 0:r},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(e){return this.base.pathname=e,this},t.prototype.setQueryParam=function(e,r){return this.params.set(e,r?r.toString():""),this},t.prototype.setQueryString=function(e){if(e)return e[0]==="?"&&(e=e.slice(1)),this.params=new URLSearchParams(e),this},t.prototype.toString=function(){var e=this.params.toString();return e===""?this.base.search="":this.base.search="?"+e,this.base.toString()},t})();Js.URLBuilder=Kv});var Um=Oo((km,du)=>{"use strict";(function(t){if(typeof km=="object"&&typeof du<"u")du.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return(function n(i,o,s){function a(d,f){if(!o[d]){if(!i[d]){var E=typeof No=="function"&&No;if(!f&&E)return E(d,!0);if(c)return c(d,!0);var y=new Error("Cannot find module '"+d+"'");throw y.code="MODULE_NOT_FOUND",y}var T=o[d]={exports:{}};i[d][0].call(T.exports,function(D){var N=i[d][1][D];return a(N||D)},T,T.exports,n,i,o,s)}return o[d].exports}for(var c=typeof No=="function"&&No,p=0;p<s.length;p++)a(s[p]);return a})({1:[function(n,i,o){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,c;if(a){var p=0,d=new a(D),f=s.document.createTextNode("");d.observe(f,{characterData:!0}),c=function(){f.data=p=++p%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var E=new s.MessageChannel;E.port1.onmessage=D,c=function(){E.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?c=function(){var k=s.document.createElement("script");k.onreadystatechange=function(){D(),k.onreadystatechange=null,k.parentNode.removeChild(k),k=null},s.document.documentElement.appendChild(k)}:c=function(){setTimeout(D,0)};var y,T=[];function D(){y=!0;for(var k,G,P=T.length;P;){for(G=T,T=[],k=-1;++k<P;)G[k]();P=T.length}y=!1}i.exports=N;function N(k){T.push(k)===1&&!y&&c()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,i,o){"use strict";var s=n(1);function a(){}var c={},p=["REJECTED"],d=["FULFILLED"],f=["PENDING"];i.exports=E;function E(X){if(typeof X!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,X!==a&&N(this,X)}E.prototype.catch=function(X){return this.then(null,X)},E.prototype.then=function(X,ce){if(typeof X!="function"&&this.state===d||typeof ce!="function"&&this.state===p)return this;var se=new this.constructor(a);if(this.state!==f){var fe=this.state===d?X:ce;T(se,fe,this.outcome)}else this.queue.push(new y(se,X,ce));return se};function y(X,ce,se){this.promise=X,typeof ce=="function"&&(this.onFulfilled=ce,this.callFulfilled=this.otherCallFulfilled),typeof se=="function"&&(this.onRejected=se,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(X){c.resolve(this.promise,X)},y.prototype.otherCallFulfilled=function(X){T(this.promise,this.onFulfilled,X)},y.prototype.callRejected=function(X){c.reject(this.promise,X)},y.prototype.otherCallRejected=function(X){T(this.promise,this.onRejected,X)};function T(X,ce,se){s(function(){var fe;try{fe=ce(se)}catch(Be){return c.reject(X,Be)}fe===X?c.reject(X,new TypeError("Cannot resolve promise with itself")):c.resolve(X,fe)})}c.resolve=function(X,ce){var se=k(D,ce);if(se.status==="error")return c.reject(X,se.value);var fe=se.value;if(fe)N(X,fe);else{X.state=d,X.outcome=ce;for(var Be=-1,Te=X.queue.length;++Be<Te;)X.queue[Be].callFulfilled(ce)}return X},c.reject=function(X,ce){X.state=p,X.outcome=ce;for(var se=-1,fe=X.queue.length;++se<fe;)X.queue[se].callRejected(ce);return X};function D(X){var ce=X&&X.then;if(X&&(typeof X=="object"||typeof X=="function")&&typeof ce=="function")return function(){ce.apply(X,arguments)}}function N(X,ce){var se=!1;function fe(qe){se||(se=!0,c.reject(X,qe))}function Be(qe){se||(se=!0,c.resolve(X,qe))}function Te(){ce(Be,fe)}var Ae=k(Te);Ae.status==="error"&&fe(Ae.value)}function k(X,ce){var se={};try{se.value=X(ce),se.status="success"}catch(fe){se.status="error",se.value=fe}return se}E.resolve=G;function G(X){return X instanceof this?X:c.resolve(new this(a),X)}E.reject=P;function P(X){var ce=new this(a);return c.reject(ce,X)}E.all=Q;function Q(X){var ce=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=X.length,fe=!1;if(!se)return this.resolve([]);for(var Be=new Array(se),Te=0,Ae=-1,qe=new this(a);++Ae<se;)et(X[Ae],Ae);return qe;function et(Ft,A){ce.resolve(Ft).then(R,function(V){fe||(fe=!0,c.reject(qe,V))});function R(V){Be[A]=V,++Te===se&&!fe&&(fe=!0,c.resolve(qe,Be))}}}E.race=_e;function _e(X){var ce=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=X.length,fe=!1;if(!se)return this.resolve([]);for(var Be=-1,Te=new this(a);++Be<se;)Ae(X[Be]);return Te;function Ae(qe){ce.resolve(qe).then(function(et){fe||(fe=!0,c.resolve(Te,et))},function(et){fe||(fe=!0,c.reject(Te,et))})}}},{1:1}],3:[function(n,i,o){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m};function a(m,w){if(!(m instanceof w))throw new TypeError("Cannot call a class as a function")}function c(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var p=c();function d(){try{if(!p||!p.open)return!1;var m=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),w=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!m||w)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function f(m,w){m=m||[],w=w||{};try{return new Blob(m,w)}catch(S){if(S.name!=="TypeError")throw S;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,I=new g,x=0;x<m.length;x+=1)I.append(m[x]);return I.getBlob(w.type)}}typeof Promise>"u"&&n(3);var E=Promise;function y(m,w){w&&m.then(function(g){w(null,g)},function(g){w(g)})}function T(m,w,g){typeof w=="function"&&m.then(w),typeof g=="function"&&m.catch(g)}function D(m){return typeof m!="string"&&(console.warn(m+" used as a key, but it is not a string."),m=String(m)),m}function N(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var k="local-forage-detect-blob-support",G=void 0,P={},Q=Object.prototype.toString,_e="readonly",X="readwrite";function ce(m){for(var w=m.length,g=new ArrayBuffer(w),I=new Uint8Array(g),x=0;x<w;x++)I[x]=m.charCodeAt(x);return g}function se(m){return new E(function(w){var g=m.transaction(k,X),I=f([""]);g.objectStore(k).put(I,"key"),g.onabort=function(x){x.preventDefault(),x.stopPropagation(),w(!1)},g.oncomplete=function(){var x=navigator.userAgent.match(/Chrome\/(\d+)/),S=navigator.userAgent.match(/Edge\//);w(S||!x||parseInt(x[1],10)>=43)}}).catch(function(){return!1})}function fe(m){return typeof G=="boolean"?E.resolve(G):se(m).then(function(w){return G=w,G})}function Be(m){var w=P[m.name],g={};g.promise=new E(function(I,x){g.resolve=I,g.reject=x}),w.deferredOperations.push(g),w.dbReady?w.dbReady=w.dbReady.then(function(){return g.promise}):w.dbReady=g.promise}function Te(m){var w=P[m.name],g=w.deferredOperations.pop();if(g)return g.resolve(),g.promise}function Ae(m,w){var g=P[m.name],I=g.deferredOperations.pop();if(I)return I.reject(w),I.promise}function qe(m,w){return new E(function(g,I){if(P[m.name]=P[m.name]||Ke(),m.db)if(w)Be(m),m.db.close();else return g(m.db);var x=[m.name];w&&x.push(m.version);var S=p.open.apply(p,x);w&&(S.onupgradeneeded=function(M){var z=S.result;try{z.createObjectStore(m.storeName),M.oldVersion<=1&&z.createObjectStore(k)}catch(q){if(q.name==="ConstraintError")console.warn('The database "'+m.name+'" has been upgraded from version '+M.oldVersion+" to version "+M.newVersion+', but the storage "'+m.storeName+'" already exists.');else throw q}}),S.onerror=function(M){M.preventDefault(),I(S.error)},S.onsuccess=function(){var M=S.result;M.onversionchange=function(z){z.target.close()},g(M),Te(m)}})}function et(m){return qe(m,!1)}function Ft(m){return qe(m,!0)}function A(m,w){if(!m.db)return!0;var g=!m.db.objectStoreNames.contains(m.storeName),I=m.version<m.db.version,x=m.version>m.db.version;if(I&&(m.version!==w&&console.warn('The database "'+m.name+`" can't be downgraded from version `+m.db.version+" to version "+m.version+"."),m.version=m.db.version),x||g){if(g){var S=m.db.version+1;S>m.version&&(m.version=S)}return!0}return!1}function R(m){return new E(function(w,g){var I=new FileReader;I.onerror=g,I.onloadend=function(x){var S=btoa(x.target.result||"");w({__local_forage_encoded_blob:!0,data:S,type:m.type})},I.readAsBinaryString(m)})}function V(m){var w=ce(atob(m.data));return f([w],{type:m.type})}function U(m){return m&&m.__local_forage_encoded_blob}function H(m){var w=this,g=w._initReady().then(function(){var I=P[w._dbInfo.name];if(I&&I.dbReady)return I.dbReady});return T(g,m,m),g}function ne(m){Be(m);for(var w=P[m.name],g=w.forages,I=0;I<g.length;I++){var x=g[I];x._dbInfo.db&&(x._dbInfo.db.close(),x._dbInfo.db=null)}return m.db=null,et(m).then(function(S){return m.db=S,A(m)?Ft(m):S}).then(function(S){m.db=w.db=S;for(var M=0;M<g.length;M++)g[M]._dbInfo.db=S}).catch(function(S){throw Ae(m,S),S})}function he(m,w,g,I){I===void 0&&(I=1);try{var x=m.db.transaction(m.storeName,w);g(null,x)}catch(S){if(I>0&&(!m.db||S.name==="InvalidStateError"||S.name==="NotFoundError"))return E.resolve().then(function(){if(!m.db||S.name==="NotFoundError"&&!m.db.objectStoreNames.contains(m.storeName)&&m.version<=m.db.version)return m.db&&(m.version=m.db.version+1),Ft(m)}).then(function(){return ne(m).then(function(){he(m,w,g,I-1)})}).catch(g);g(S)}}function Ke(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function nt(m){var w=this,g={db:null};if(m)for(var I in m)g[I]=m[I];var x=P[g.name];x||(x=Ke(),P[g.name]=x),x.forages.push(w),w._initReady||(w._initReady=w.ready,w.ready=H);var S=[];function M(){return E.resolve()}for(var z=0;z<x.forages.length;z++){var q=x.forages[z];q!==w&&S.push(q._initReady().catch(M))}var Y=x.forages.slice(0);return E.all(S).then(function(){return g.db=x.db,et(g)}).then(function(J){return g.db=J,A(g,w._defaultConfig.version)?Ft(g):J}).then(function(J){g.db=x.db=J,w._dbInfo=g;for(var te=0;te<Y.length;te++){var Ee=Y[te];Ee!==w&&(Ee._dbInfo.db=g.db,Ee._dbInfo.version=g.version)}})}function it(m,w){var g=this;m=D(m);var I=new E(function(x,S){g.ready().then(function(){he(g._dbInfo,_e,function(M,z){if(M)return S(M);try{var q=z.objectStore(g._dbInfo.storeName),Y=q.get(m);Y.onsuccess=function(){var J=Y.result;J===void 0&&(J=null),U(J)&&(J=V(J)),x(J)},Y.onerror=function(){S(Y.error)}}catch(J){S(J)}})}).catch(S)});return y(I,w),I}function wt(m,w){var g=this,I=new E(function(x,S){g.ready().then(function(){he(g._dbInfo,_e,function(M,z){if(M)return S(M);try{var q=z.objectStore(g._dbInfo.storeName),Y=q.openCursor(),J=1;Y.onsuccess=function(){var te=Y.result;if(te){var Ee=te.value;U(Ee)&&(Ee=V(Ee));var Oe=m(Ee,te.key,J++);Oe!==void 0?x(Oe):te.continue()}else x()},Y.onerror=function(){S(Y.error)}}catch(te){S(te)}})}).catch(S)});return y(I,w),I}function St(m,w,g){var I=this;m=D(m);var x=new E(function(S,M){var z;I.ready().then(function(){return z=I._dbInfo,Q.call(w)==="[object Blob]"?fe(z.db).then(function(q){return q?w:R(w)}):w}).then(function(q){he(I._dbInfo,X,function(Y,J){if(Y)return M(Y);try{var te=J.objectStore(I._dbInfo.storeName);q===null&&(q=void 0);var Ee=te.put(q,m);J.oncomplete=function(){q===void 0&&(q=null),S(q)},J.onabort=J.onerror=function(){var Oe=Ee.error?Ee.error:Ee.transaction.error;M(Oe)}}catch(Oe){M(Oe)}})}).catch(M)});return y(x,g),x}function ct(m,w){var g=this;m=D(m);var I=new E(function(x,S){g.ready().then(function(){he(g._dbInfo,X,function(M,z){if(M)return S(M);try{var q=z.objectStore(g._dbInfo.storeName),Y=q.delete(m);z.oncomplete=function(){x()},z.onerror=function(){S(Y.error)},z.onabort=function(){var J=Y.error?Y.error:Y.transaction.error;S(J)}}catch(J){S(J)}})}).catch(S)});return y(I,w),I}function Se(m){var w=this,g=new E(function(I,x){w.ready().then(function(){he(w._dbInfo,X,function(S,M){if(S)return x(S);try{var z=M.objectStore(w._dbInfo.storeName),q=z.clear();M.oncomplete=function(){I()},M.onabort=M.onerror=function(){var Y=q.error?q.error:q.transaction.error;x(Y)}}catch(Y){x(Y)}})}).catch(x)});return y(g,m),g}function Ve(m){var w=this,g=new E(function(I,x){w.ready().then(function(){he(w._dbInfo,_e,function(S,M){if(S)return x(S);try{var z=M.objectStore(w._dbInfo.storeName),q=z.count();q.onsuccess=function(){I(q.result)},q.onerror=function(){x(q.error)}}catch(Y){x(Y)}})}).catch(x)});return y(g,m),g}function De(m,w){var g=this,I=new E(function(x,S){if(m<0){x(null);return}g.ready().then(function(){he(g._dbInfo,_e,function(M,z){if(M)return S(M);try{var q=z.objectStore(g._dbInfo.storeName),Y=!1,J=q.openKeyCursor();J.onsuccess=function(){var te=J.result;if(!te){x(null);return}m===0||Y?x(te.key):(Y=!0,te.advance(m))},J.onerror=function(){S(J.error)}}catch(te){S(te)}})}).catch(S)});return y(I,w),I}function We(m){var w=this,g=new E(function(I,x){w.ready().then(function(){he(w._dbInfo,_e,function(S,M){if(S)return x(S);try{var z=M.objectStore(w._dbInfo.storeName),q=z.openKeyCursor(),Y=[];q.onsuccess=function(){var J=q.result;if(!J){I(Y);return}Y.push(J.key),J.continue()},q.onerror=function(){x(q.error)}}catch(J){x(J)}})}).catch(x)});return y(g,m),g}function Ne(m,w){w=N.apply(this,arguments);var g=this.config();m=typeof m!="function"&&m||{},m.name||(m.name=m.name||g.name,m.storeName=m.storeName||g.storeName);var I=this,x;if(!m.name)x=E.reject("Invalid arguments");else{var S=m.name===g.name&&I._dbInfo.db,M=S?E.resolve(I._dbInfo.db):et(m).then(function(z){var q=P[m.name],Y=q.forages;q.db=z;for(var J=0;J<Y.length;J++)Y[J]._dbInfo.db=z;return z});m.storeName?x=M.then(function(z){if(z.objectStoreNames.contains(m.storeName)){var q=z.version+1;Be(m);var Y=P[m.name],J=Y.forages;z.close();for(var te=0;te<J.length;te++){var Ee=J[te];Ee._dbInfo.db=null,Ee._dbInfo.version=q}var Oe=new E(function(Pe,st){var tt=p.open(m.name,q);tt.onerror=function(Zt){var Do=tt.result;Do.close(),st(Zt)},tt.onupgradeneeded=function(){var Zt=tt.result;Zt.deleteObjectStore(m.storeName)},tt.onsuccess=function(){var Zt=tt.result;Zt.close(),Pe(Zt)}});return Oe.then(function(Pe){Y.db=Pe;for(var st=0;st<J.length;st++){var tt=J[st];tt._dbInfo.db=Pe,Te(tt._dbInfo)}}).catch(function(Pe){throw(Ae(m,Pe)||E.resolve()).catch(function(){}),Pe})}}):x=M.then(function(z){Be(m);var q=P[m.name],Y=q.forages;z.close();for(var J=0;J<Y.length;J++){var te=Y[J];te._dbInfo.db=null}var Ee=new E(function(Oe,Pe){var st=p.deleteDatabase(m.name);st.onerror=function(){var tt=st.result;tt&&tt.close(),Pe(st.error)},st.onblocked=function(){console.warn('dropInstance blocked for database "'+m.name+'" until all open connections are closed')},st.onsuccess=function(){var tt=st.result;tt&&tt.close(),Oe(tt)}});return Ee.then(function(Oe){q.db=Oe;for(var Pe=0;Pe<Y.length;Pe++){var st=Y[Pe];Te(st._dbInfo)}}).catch(function(Oe){throw(Ae(m,Oe)||E.resolve()).catch(function(){}),Oe})})}return y(x,w),x}var jt={_driver:"asyncStorage",_initStorage:nt,_support:d(),iterate:wt,getItem:it,setItem:St,removeItem:ct,clear:Se,length:Ve,key:De,keys:We,dropInstance:Ne};function h(){return typeof openDatabase=="function"}var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",v=/^~~local_forage_type~([^~]+)~/,C="__lfsc__:",O=C.length,W="arbf",ue="blob",be="si08",ge="ui08",ke="uic8",He="si16",ot="si32",mr="ur16",Yr="ui32",_i="fl32",dr="fl64",hr=O+W.length,dm=Object.prototype.toString;function hm(m){var w=m.length*.75,g=m.length,I,x=0,S,M,z,q;m[m.length-1]==="="&&(w--,m[m.length-2]==="="&&w--);var Y=new ArrayBuffer(w),J=new Uint8Array(Y);for(I=0;I<g;I+=4)S=l.indexOf(m[I]),M=l.indexOf(m[I+1]),z=l.indexOf(m[I+2]),q=l.indexOf(m[I+3]),J[x++]=S<<2|M>>4,J[x++]=(M&15)<<4|z>>2,J[x++]=(z&3)<<6|q&63;return Y}function Ql(m){var w=new Uint8Array(m),g="",I;for(I=0;I<w.length;I+=3)g+=l[w[I]>>2],g+=l[(w[I]&3)<<4|w[I+1]>>4],g+=l[(w[I+1]&15)<<2|w[I+2]>>6],g+=l[w[I+2]&63];return w.length%3===2?g=g.substring(0,g.length-1)+"=":w.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function lv(m,w){var g="";if(m&&(g=dm.call(m)),m&&(g==="[object ArrayBuffer]"||m.buffer&&dm.call(m.buffer)==="[object ArrayBuffer]")){var I,x=C;m instanceof ArrayBuffer?(I=m,x+=W):(I=m.buffer,g==="[object Int8Array]"?x+=be:g==="[object Uint8Array]"?x+=ge:g==="[object Uint8ClampedArray]"?x+=ke:g==="[object Int16Array]"?x+=He:g==="[object Uint16Array]"?x+=mr:g==="[object Int32Array]"?x+=ot:g==="[object Uint32Array]"?x+=Yr:g==="[object Float32Array]"?x+=_i:g==="[object Float64Array]"?x+=dr:w(new Error("Failed to get type for BinaryArray"))),w(x+Ql(I))}else if(g==="[object Blob]"){var S=new FileReader;S.onload=function(){var M=u+m.type+"~"+Ql(this.result);w(C+ue+M)},S.readAsArrayBuffer(m)}else try{w(JSON.stringify(m))}catch(M){console.error("Couldn't convert value into a JSON string: ",m),w(null,M)}}function uv(m){if(m.substring(0,O)!==C)return JSON.parse(m);var w=m.substring(hr),g=m.substring(O,hr),I;if(g===ue&&v.test(w)){var x=w.match(v);I=x[1],w=w.substring(x[0].length)}var S=hm(w);switch(g){case W:return S;case ue:return f([S],{type:I});case be:return new Int8Array(S);case ge:return new Uint8Array(S);case ke:return new Uint8ClampedArray(S);case He:return new Int16Array(S);case mr:return new Uint16Array(S);case ot:return new Int32Array(S);case Yr:return new Uint32Array(S);case _i:return new Float32Array(S);case dr:return new Float64Array(S);default:throw new Error("Unkown type: "+g)}}var Zl={serialize:lv,deserialize:uv,stringToBuffer:hm,bufferToString:Ql};function gm(m,w,g,I){m.executeSql("CREATE TABLE IF NOT EXISTS "+w.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,I)}function pv(m){var w=this,g={db:null};if(m)for(var I in m)g[I]=typeof m[I]!="string"?m[I].toString():m[I];var x=new E(function(S,M){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(z){return M(z)}g.db.transaction(function(z){gm(z,g,function(){w._dbInfo=g,S()},function(q,Y){M(Y)})},M)});return g.serializer=Zl,x}function gn(m,w,g,I,x,S){m.executeSql(g,I,x,function(M,z){z.code===z.SYNTAX_ERR?M.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[w.storeName],function(q,Y){Y.rows.length?S(q,z):gm(q,w,function(){q.executeSql(g,I,x,S)},S)},S):S(M,z)},S)}function fv(m,w){var g=this;m=D(m);var I=new E(function(x,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(z){gn(z,M,"SELECT * FROM "+M.storeName+" WHERE key = ? LIMIT 1",[m],function(q,Y){var J=Y.rows.length?Y.rows.item(0).value:null;J&&(J=M.serializer.deserialize(J)),x(J)},function(q,Y){S(Y)})})}).catch(S)});return y(I,w),I}function mv(m,w){var g=this,I=new E(function(x,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(z){gn(z,M,"SELECT * FROM "+M.storeName,[],function(q,Y){for(var J=Y.rows,te=J.length,Ee=0;Ee<te;Ee++){var Oe=J.item(Ee),Pe=Oe.value;if(Pe&&(Pe=M.serializer.deserialize(Pe)),Pe=m(Pe,Oe.key,Ee+1),Pe!==void 0){x(Pe);return}}x()},function(q,Y){S(Y)})})}).catch(S)});return y(I,w),I}function ym(m,w,g,I){var x=this;m=D(m);var S=new E(function(M,z){x.ready().then(function(){w===void 0&&(w=null);var q=w,Y=x._dbInfo;Y.serializer.serialize(w,function(J,te){te?z(te):Y.db.transaction(function(Ee){gn(Ee,Y,"INSERT OR REPLACE INTO "+Y.storeName+" (key, value) VALUES (?, ?)",[m,J],function(){M(q)},function(Oe,Pe){z(Pe)})},function(Ee){if(Ee.code===Ee.QUOTA_ERR){if(I>0){M(ym.apply(x,[m,q,g,I-1]));return}z(Ee)}})})}).catch(z)});return y(S,g),S}function dv(m,w,g){return ym.apply(this,[m,w,g,1])}function hv(m,w){var g=this;m=D(m);var I=new E(function(x,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(z){gn(z,M,"DELETE FROM "+M.storeName+" WHERE key = ?",[m],function(){x()},function(q,Y){S(Y)})})}).catch(S)});return y(I,w),I}function gv(m){var w=this,g=new E(function(I,x){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){gn(M,S,"DELETE FROM "+S.storeName,[],function(){I()},function(z,q){x(q)})})}).catch(x)});return y(g,m),g}function yv(m){var w=this,g=new E(function(I,x){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){gn(M,S,"SELECT COUNT(key) as c FROM "+S.storeName,[],function(z,q){var Y=q.rows.item(0).c;I(Y)},function(z,q){x(q)})})}).catch(x)});return y(g,m),g}function vv(m,w){var g=this,I=new E(function(x,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(z){gn(z,M,"SELECT key FROM "+M.storeName+" WHERE id = ? LIMIT 1",[m+1],function(q,Y){var J=Y.rows.length?Y.rows.item(0).key:null;x(J)},function(q,Y){S(Y)})})}).catch(S)});return y(I,w),I}function Ev(m){var w=this,g=new E(function(I,x){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){gn(M,S,"SELECT key FROM "+S.storeName,[],function(z,q){for(var Y=[],J=0;J<q.rows.length;J++)Y.push(q.rows.item(J).key);I(Y)},function(z,q){x(q)})})}).catch(x)});return y(g,m),g}function _v(m){return new E(function(w,g){m.transaction(function(I){I.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(x,S){for(var M=[],z=0;z<S.rows.length;z++)M.push(S.rows.item(z).name);w({db:m,storeNames:M})},function(x,S){g(S)})},function(I){g(I)})})}function bv(m,w){w=N.apply(this,arguments);var g=this.config();m=typeof m!="function"&&m||{},m.name||(m.name=m.name||g.name,m.storeName=m.storeName||g.storeName);var I=this,x;return m.name?x=new E(function(S){var M;m.name===g.name?M=I._dbInfo.db:M=openDatabase(m.name,"","",0),m.storeName?S({db:M,storeNames:[m.storeName]}):S(_v(M))}).then(function(S){return new E(function(M,z){S.db.transaction(function(q){function Y(Oe){return new E(function(Pe,st){q.executeSql("DROP TABLE IF EXISTS "+Oe,[],function(){Pe()},function(tt,Zt){st(Zt)})})}for(var J=[],te=0,Ee=S.storeNames.length;te<Ee;te++)J.push(Y(S.storeNames[te]));E.all(J).then(function(){M()}).catch(function(Oe){z(Oe)})},function(q){z(q)})})}):x=E.reject("Invalid arguments"),y(x,w),x}var wv={_driver:"webSQLStorage",_initStorage:pv,_support:h(),iterate:mv,getItem:fv,setItem:dv,removeItem:hv,clear:gv,length:yv,key:vv,keys:Ev,dropInstance:bv};function Sv(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function vm(m,w){var g=m.name+"/";return m.storeName!==w.storeName&&(g+=m.storeName+"/"),g}function Iv(){var m="_localforage_support_test";try{return localStorage.setItem(m,!0),localStorage.removeItem(m),!1}catch{return!0}}function Tv(){return!Iv()||localStorage.length>0}function xv(m){var w=this,g={};if(m)for(var I in m)g[I]=m[I];return g.keyPrefix=vm(m,w._defaultConfig),Tv()?(w._dbInfo=g,g.serializer=Zl,E.resolve()):E.reject()}function Cv(m){var w=this,g=w.ready().then(function(){for(var I=w._dbInfo.keyPrefix,x=localStorage.length-1;x>=0;x--){var S=localStorage.key(x);S.indexOf(I)===0&&localStorage.removeItem(S)}});return y(g,m),g}function Rv(m,w){var g=this;m=D(m);var I=g.ready().then(function(){var x=g._dbInfo,S=localStorage.getItem(x.keyPrefix+m);return S&&(S=x.serializer.deserialize(S)),S});return y(I,w),I}function Av(m,w){var g=this,I=g.ready().then(function(){for(var x=g._dbInfo,S=x.keyPrefix,M=S.length,z=localStorage.length,q=1,Y=0;Y<z;Y++){var J=localStorage.key(Y);if(J.indexOf(S)===0){var te=localStorage.getItem(J);if(te&&(te=x.serializer.deserialize(te)),te=m(te,J.substring(M),q++),te!==void 0)return te}}});return y(I,w),I}function Dv(m,w){var g=this,I=g.ready().then(function(){var x=g._dbInfo,S;try{S=localStorage.key(m)}catch{S=null}return S&&(S=S.substring(x.keyPrefix.length)),S});return y(I,w),I}function Nv(m){var w=this,g=w.ready().then(function(){for(var I=w._dbInfo,x=localStorage.length,S=[],M=0;M<x;M++){var z=localStorage.key(M);z.indexOf(I.keyPrefix)===0&&S.push(z.substring(I.keyPrefix.length))}return S});return y(g,m),g}function Ov(m){var w=this,g=w.keys().then(function(I){return I.length});return y(g,m),g}function Pv(m,w){var g=this;m=D(m);var I=g.ready().then(function(){var x=g._dbInfo;localStorage.removeItem(x.keyPrefix+m)});return y(I,w),I}function Lv(m,w,g){var I=this;m=D(m);var x=I.ready().then(function(){w===void 0&&(w=null);var S=w;return new E(function(M,z){var q=I._dbInfo;q.serializer.serialize(w,function(Y,J){if(J)z(J);else try{localStorage.setItem(q.keyPrefix+m,Y),M(S)}catch(te){(te.name==="QuotaExceededError"||te.name==="NS_ERROR_DOM_QUOTA_REACHED")&&z(te),z(te)}})})});return y(x,g),x}function Mv(m,w){if(w=N.apply(this,arguments),m=typeof m!="function"&&m||{},!m.name){var g=this.config();m.name=m.name||g.name,m.storeName=m.storeName||g.storeName}var I=this,x;return m.name?x=new E(function(S){m.storeName?S(vm(m,I._defaultConfig)):S(m.name+"/")}).then(function(S){for(var M=localStorage.length-1;M>=0;M--){var z=localStorage.key(M);z.indexOf(S)===0&&localStorage.removeItem(z)}}):x=E.reject("Invalid arguments"),y(x,w),x}var Bv={_driver:"localStorageWrapper",_initStorage:xv,_support:Sv(),iterate:Av,getItem:Rv,setItem:Lv,removeItem:Pv,clear:Cv,length:Ov,key:Dv,keys:Nv,dropInstance:Mv},kv=function(w,g){return w===g||typeof w=="number"&&typeof g=="number"&&isNaN(w)&&isNaN(g)},Uv=function(w,g){for(var I=w.length,x=0;x<I;){if(kv(w[x],g))return!0;x++}return!1},Em=Array.isArray||function(m){return Object.prototype.toString.call(m)==="[object Array]"},Ao={},_m={},bi={INDEXEDDB:jt,WEBSQL:wv,LOCALSTORAGE:Bv},Fv=[bi.INDEXEDDB._driver,bi.WEBSQL._driver,bi.LOCALSTORAGE._driver],qs=["dropInstance"],eu=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(qs),Hv={description:"",driver:Fv.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function $v(m,w){m[w]=function(){var g=arguments;return m.ready().then(function(){return m[w].apply(m,g)})}}function tu(){for(var m=1;m<arguments.length;m++){var w=arguments[m];if(w)for(var g in w)w.hasOwnProperty(g)&&(Em(w[g])?arguments[0][g]=w[g].slice():arguments[0][g]=w[g])}return arguments[0]}var Vv=(function(){function m(w){a(this,m);for(var g in bi)if(bi.hasOwnProperty(g)){var I=bi[g],x=I._driver;this[g]=x,Ao[x]||this.defineDriver(I)}this._defaultConfig=tu({},Hv),this._config=tu({},this._defaultConfig,w),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return m.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var I in g){if(I==="storeName"&&(g[I]=g[I].replace(/\W/g,"_")),I==="version"&&typeof g[I]!="number")return new Error("Database version must be a number.");this._config[I]=g[I]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},m.prototype.defineDriver=function(g,I,x){var S=new E(function(M,z){try{var q=g._driver,Y=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){z(Y);return}for(var J=eu.concat("_initStorage"),te=0,Ee=J.length;te<Ee;te++){var Oe=J[te],Pe=!Uv(qs,Oe);if((Pe||g[Oe])&&typeof g[Oe]!="function"){z(Y);return}}var st=function(){for(var Do=function(Gv){return function(){var zv=new Error("Method "+Gv+" is not implemented by the current driver"),bm=E.reject(zv);return y(bm,arguments[arguments.length-1]),bm}},ru=0,jv=qs.length;ru<jv;ru++){var nu=qs[ru];g[nu]||(g[nu]=Do(nu))}};st();var tt=function(Do){Ao[q]&&console.info("Redefining LocalForage driver: "+q),Ao[q]=g,_m[q]=Do,M()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(tt,z):tt(!!g._support):tt(!0)}catch(Zt){z(Zt)}});return T(S,I,x),S},m.prototype.driver=function(){return this._driver||null},m.prototype.getDriver=function(g,I,x){var S=Ao[g]?E.resolve(Ao[g]):E.reject(new Error("Driver not found."));return T(S,I,x),S},m.prototype.getSerializer=function(g){var I=E.resolve(Zl);return T(I,g),I},m.prototype.ready=function(g){var I=this,x=I._driverSet.then(function(){return I._ready===null&&(I._ready=I._initDriver()),I._ready});return T(x,g,g),x},m.prototype.setDriver=function(g,I,x){var S=this;Em(g)||(g=[g]);var M=this._getSupportedDrivers(g);function z(){S._config.driver=S.driver()}function q(te){return S._extend(te),z(),S._ready=S._initStorage(S._config),S._ready}function Y(te){return function(){var Ee=0;function Oe(){for(;Ee<te.length;){var Pe=te[Ee];return Ee++,S._dbInfo=null,S._ready=null,S.getDriver(Pe).then(q).catch(Oe)}z();var st=new Error("No available storage method found.");return S._driverSet=E.reject(st),S._driverSet}return Oe()}}var J=this._driverSet!==null?this._driverSet.catch(function(){return E.resolve()}):E.resolve();return this._driverSet=J.then(function(){var te=M[0];return S._dbInfo=null,S._ready=null,S.getDriver(te).then(function(Ee){S._driver=Ee._driver,z(),S._wrapLibraryMethodsWithReady(),S._initDriver=Y(M)})}).catch(function(){z();var te=new Error("No available storage method found.");return S._driverSet=E.reject(te),S._driverSet}),T(this._driverSet,I,x),this._driverSet},m.prototype.supports=function(g){return!!_m[g]},m.prototype._extend=function(g){tu(this,g)},m.prototype._getSupportedDrivers=function(g){for(var I=[],x=0,S=g.length;x<S;x++){var M=g[x];this.supports(M)&&I.push(M)}return I},m.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,I=eu.length;g<I;g++)$v(this,eu[g])},m.prototype.createInstance=function(g){return new m(g)},m})(),Wv=new Vv;i.exports=Wv},{3:3}]},{},[4])(4)})});var Fm=Oo((gu,yu)=>{"use strict";(function(t,e){typeof gu=="object"&&typeof yu<"u"?yu.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self,t.fetchRetry=e())})(gu,function(){"use strict";var t=function(n,i){if(i=i||{},typeof n!="function")throw new r("fetch must be a function");if(typeof i!="object")throw new r("defaults must be an object");if(i.retries!==void 0&&!e(i.retries))throw new r("retries must be a positive integer");if(i.retryDelay!==void 0&&!e(i.retryDelay)&&typeof i.retryDelay!="function")throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(i.retryOn!==void 0&&!Array.isArray(i.retryOn)&&typeof i.retryOn!="function")throw new r("retryOn property expects an array or function");var o={retries:3,retryDelay:1e3,retryOn:[]};return i=Object.assign(o,i),function(a,c){var p=i.retries,d=i.retryDelay,f=i.retryOn;if(c&&c.retries!==void 0)if(e(c.retries))p=c.retries;else throw new r("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(e(c.retryDelay)||typeof c.retryDelay=="function")d=c.retryDelay;else throw new r("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")f=c.retryOn;else throw new r("retryOn property expects an array or function");return new Promise(function(E,y){var T=function(N){var k=typeof Request<"u"&&a instanceof Request?a.clone():a;n(k,c).then(function(G){if(Array.isArray(f)&&f.indexOf(G.status)===-1)E(G);else if(typeof f=="function")try{return Promise.resolve(f(N,null,G)).then(function(P){P?D(N,null,G):E(G)}).catch(y)}catch(P){y(P)}else N<p?D(N,null,G):E(G)}).catch(function(G){if(typeof f=="function")try{Promise.resolve(f(N,G,null)).then(function(P){P?D(N,G,null):y(G)}).catch(function(P){y(P)})}catch(P){y(P)}else N<p?D(N,G,null):y(G)})};function D(N,k,G){var P=typeof d=="function"?d(N,k,G):d;setTimeout(function(){T(++N)},P)}T(0)})}};function e(n){return Number.isInteger(n)&&n>=0}function r(n){this.name="ArgumentError",this.message=n}return t})});var yg=Oo((ac,gg)=>{"use strict";(function(t,e){typeof ac=="object"&&typeof gg<"u"?e(ac):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).Sqrl={})})(ac,function(t){"use strict";function e(A){var R,V,U=new Error(A);return R=U,V=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(R,V):R.__proto__=V,U}function r(A,R,V){var U=R.slice(0,V).split(/\n/),H=U.length,ne=U[H-1].length+1;throw e(A+=" at line "+H+" col "+ne+`:
|
|
2
2
|
|
|
3
3
|
`+R.split(/\n/)[H-1]+`
|
|
4
4
|
`+Array(ne).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var n=new Function("return this")().Promise,i=!1;try{i=new Function("return (async function(){}).constructor")()}catch(A){if(!(A instanceof SyntaxError))throw A}function o(A,R){return Object.prototype.hasOwnProperty.call(A,R)}function s(A,R,V){for(var U in R)o(R,U)&&(R[U]==null||typeof R[U]!="object"||U!=="storage"&&U!=="prefixes"||V?A[U]=R[U]:A[U]=s({},R[U]));return A}var a=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,p=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,d=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,f=/[.*+\-?^${}()|[\]\\]/g;function E(A){return f.test(A)?A.replace(f,"\\$&"):A}function y(A,R){R.rmWhitespace&&(A=A.replace(/[\r\n]+/g,`
|
|
5
|
-
`).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,p.lastIndex=0,d.lastIndex=0;var V=R.prefixes,U=[V.h,V.b,V.i,V.r,V.c,V.e].reduce(function(
|
|
6
|
-
`)}}return H}var Q=(function(){function A(R){this.cache=R}return A.prototype.define=function(R,V){this.cache[R]=V},A.prototype.get=function(R){return this.cache[R]},A.prototype.remove=function(R){delete this.cache[R]},A.prototype.reset=function(){this.cache={}},A.prototype.load=function(R){s(this.cache,R,!0)},A})();function _e(A,R,V,U){if(R&&R.length>0)throw e((U?"Native":"")+"Helper '"+A+"' doesn't accept blocks");if(V&&V.length>0)throw e((U?"Native":"")+"Helper '"+A+"' doesn't accept filters")}var X={"&":"&","<":"<",">":">",'"':""","'":"'"};function ce(A){return X[A]}var se=new Q({}),
|
|
5
|
+
`).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,p.lastIndex=0,d.lastIndex=0;var V=R.prefixes,U=[V.h,V.b,V.i,V.r,V.c,V.e].reduce(function(ct,Se){return ct&&Se?ct+"|"+E(Se):Se?E(Se):ct},""),H=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+E(R.tags[1])+")","g"),ne=new RegExp("([^]*?)"+E(R.tags[0])+"(-|_)?\\s*("+U+")?\\s*","g"),he=0,Ke=!1;function nt(ct,Se){var Ve,De={f:[]},We=0,Ne="c";function jt(ue){var be=A.slice(he,ue),ge=be.trim();if(Ne==="f")ge==="safe"?De.raw=!0:R.async&&a.test(ge)?(ge=ge.replace(a,""),De.f.push([ge,"",!0])):De.f.push([ge,""]);else if(Ne==="fp")De.f[De.f.length-1][1]+=ge;else if(Ne==="err"){if(ge){var ke=be.search(/\S/);r("invalid syntax",A,he+ke)}}else De[Ne]=ge;he=ue+1}for(Se==="h"||Se==="b"||Se==="c"?Ne="n":Se==="r"&&(De.raw=!0,Se="i"),H.lastIndex=he;(Ve=H.exec(A))!==null;){var h=Ve[1],l=Ve[2],u=Ve[3],v=Ve[4],C=Ve[5],O=Ve.index;if(h)h==="("?(We===0&&(Ne==="n"?(jt(O),Ne="p"):Ne==="f"&&(jt(O),Ne="fp")),We++):h===")"?--We===0&&Ne!=="c"&&(jt(O),Ne="err"):We===0&&h==="|"?(jt(O),Ne="f"):h==="=>"&&(jt(O),he+=1,Ne="res");else if(l)if(l==="/*"){var W=A.indexOf("*/",H.lastIndex);W===-1&&r("unclosed comment",A,Ve.index),H.lastIndex=W+2}else l==="'"?(p.lastIndex=Ve.index,p.exec(A)?H.lastIndex=p.lastIndex:r("unclosed string",A,Ve.index)):l==='"'?(d.lastIndex=Ve.index,d.exec(A)?H.lastIndex=d.lastIndex:r("unclosed string",A,Ve.index)):l==="`"&&(c.lastIndex=Ve.index,c.exec(A)?H.lastIndex=c.lastIndex:r("unclosed string",A,Ve.index));else if(u)return jt(O),he=O+Ve[0].length,ne.lastIndex=he,Ke=C,v&&Se==="h"&&(Se="s"),De.t=Se,De}return r("unclosed tag",A,ct),De}var it=(function ct(Se,Ve){Se.b=[],Se.d=[];var De,We=!1,Ne=[];function jt(ke,He){ke&&(ke=(function(ot,mr,Yr,_i){var dr,hr;return typeof mr.autoTrim=="string"?dr=hr=mr.autoTrim:Array.isArray(mr.autoTrim)&&(dr=mr.autoTrim[1],hr=mr.autoTrim[0]),(Yr||Yr===!1)&&(dr=Yr),(_i||_i===!1)&&(hr=_i),dr==="slurp"&&hr==="slurp"?ot.trim():(dr==="_"||dr==="slurp"?ot=String.prototype.trimLeft?ot.trimLeft():ot.replace(/^[\s\uFEFF\xA0]+/,""):dr!=="-"&&dr!=="nl"||(ot=ot.replace(/^(?:\n|\r|\r\n)/,"")),hr==="_"||hr==="slurp"?ot=String.prototype.trimRight?ot.trimRight():ot.replace(/[\s\uFEFF\xA0]+$/,""):hr!=="-"&&hr!=="nl"||(ot=ot.replace(/(?:\n|\r|\r\n)$/,"")),ot)})(ke,R,Ke,He))&&(ke=ke.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),Ne.push(ke))}for(;(De=ne.exec(A))!==null;){var h,l=De[1],u=De[2],v=De[3]||"";for(var C in V)if(V[C]===v){h=C;break}jt(l,u),he=De.index+De[0].length,h||r("unrecognized tag type: "+v,A,he);var O=nt(De.index,h),W=O.t;if(W==="h"){var ue=O.n||"";R.async&&a.test(ue)&&(O.a=!0,O.n=ue.replace(a,"")),O=ct(O),Ne.push(O)}else if(W==="c"){if(Se.n===O.n)return We?(We.d=Ne,Se.b.push(We)):Se.d=Ne,Se;r("Helper start and end don't match",A,De.index+De[0].length)}else if(W==="b"){We?(We.d=Ne,Se.b.push(We)):Se.d=Ne;var be=O.n||"";R.async&&a.test(be)&&(O.a=!0,O.n=be.replace(a,"")),We=O,Ne=[]}else if(W==="s"){var ge=O.n||"";R.async&&a.test(ge)&&(O.a=!0,O.n=ge.replace(a,"")),Ne.push(O)}else Ne.push(O)}if(!Ve)throw e('unclosed helper "'+Se.n+'"');return jt(A.slice(he,A.length),!1),Se.d=Ne,Se})({f:[]},!0);if(R.plugins)for(var wt=0;wt<R.plugins.length;wt++){var St=R.plugins[wt];St.processAST&&(it.d=St.processAST(it.d,R))}return it.d}function T(A,R){var V=y(A,R),U="var tR='';"+(R.useWith?"with("+R.varName+"||{}){":"")+P(V,R)+"if(cb){cb(null,tR)} return tR"+(R.useWith?"}":"");if(R.plugins)for(var H=0;H<R.plugins.length;H++){var ne=R.plugins[H];ne.processFnString&&(U=ne.processFnString(U,R))}return U}function D(A,R){for(var V=0;V<R.length;V++){var U=R[V][0],H=R[V][1];A=(R[V][2]?"await ":"")+"c.l('F','"+U+"')("+A,H&&(A+=","+H),A+=")"}return A}function N(A,R,V,U,H,ne){var he="{exec:"+(H?"async ":"")+G(V,R,A)+",params:["+U+"]";return ne&&(he+=",name:'"+ne+"'"),H&&(he+=",async:true"),he+="}"}function k(A,R){for(var V="[",U=0;U<A.length;U++){var H=A[U];V+=N(R,H.res||"",H.d,H.p||"",H.a,H.n),U<A.length&&(V+=",")}return V+="]"}function G(A,R,V){return"function("+R+"){var tR='';"+P(A,V)+"return tR}"}function P(A,R){for(var V=0,U=A.length,H="";V<U;V++){var ne=A[V];if(typeof ne=="string")H+="tR+='"+ne+"';";else{var he=ne.t,Ke=ne.c||"",nt=ne.f,it=ne.n||"",wt=ne.p||"",St=ne.res||"",ct=ne.b,Se=!!ne.a;if(he==="i"){R.defaultFilter&&(Ke="c.l('F','"+R.defaultFilter+"')("+Ke+")");var Ve=D(Ke,nt);!ne.raw&&R.autoEscape&&(Ve="c.l('F','e')("+Ve+")"),H+="tR+="+Ve+";"}else if(he==="h")if(R.storage.nativeHelpers.get(it))H+=R.storage.nativeHelpers.get(it)(ne,R);else{var De=(Se?"await ":"")+"c.l('H','"+it+"')("+N(R,St,ne.d,wt,Se);De+=ct?","+k(ct,R):",[]",H+="tR+="+D(De+=",c)",nt)+";"}else he==="s"?H+="tR+="+D((Se?"await ":"")+"c.l('H','"+it+"')({params:["+wt+"]},[],c)",nt)+";":he==="e"&&(H+=Ke+`
|
|
6
|
+
`)}}return H}var Q=(function(){function A(R){this.cache=R}return A.prototype.define=function(R,V){this.cache[R]=V},A.prototype.get=function(R){return this.cache[R]},A.prototype.remove=function(R){delete this.cache[R]},A.prototype.reset=function(){this.cache={}},A.prototype.load=function(R){s(this.cache,R,!0)},A})();function _e(A,R,V,U){if(R&&R.length>0)throw e((U?"Native":"")+"Helper '"+A+"' doesn't accept blocks");if(V&&V.length>0)throw e((U?"Native":"")+"Helper '"+A+"' doesn't accept filters")}var X={"&":"&","<":"<",">":">",'"':""","'":"'"};function ce(A){return X[A]}var se=new Q({}),fe=new Q({each:function(A,R){var V="",U=A.params[0];if(_e("each",R,!1),A.async)return new Promise(function(ne){(function he(Ke,nt,it,wt,St){it(Ke[nt],nt).then(function(ct){wt+=ct,nt===Ke.length-1?St(wt):he(Ke,nt+1,it,wt,St)})})(U,0,A.exec,V,ne)});for(var H=0;H<U.length;H++)V+=A.exec(U[H],H);return V},foreach:function(A,R){var V=A.params[0];if(_e("foreach",R,!1),A.async)return new Promise(function(ne){(function he(Ke,nt,it,wt,St,ct){wt(nt[it],Ke[nt[it]]).then(function(Se){St+=Se,it===nt.length-1?ct(St):he(Ke,nt,it+1,wt,St,ct)})})(V,Object.keys(V),0,A.exec,"",ne)});var U="";for(var H in V)o(V,H)&&(U+=A.exec(H,V[H]));return U},include:function(A,R,V){_e("include",R,!1);var U=V.storage.templates.get(A.params[0]);if(!U)throw e('Could not fetch template "'+A.params[0]+'"');return U(A.params[1],V)},extends:function(A,R,V){var U=A.params[1]||{};U.content=A.exec();for(var H=0;H<R.length;H++){var ne=R[H];U[ne.name]=ne.exec()}var he=V.storage.templates.get(A.params[0]);if(!he)throw e('Could not fetch template "'+A.params[0]+'"');return he(U,V)},useScope:function(A,R){return _e("useScope",R,!1),A.exec(A.params[0])}}),Be=new Q({if:function(A,R){_e("if",!1,A.f,!0);var V="if("+A.p+"){"+P(A.d,R)+"}";if(A.b)for(var U=0;U<A.b.length;U++){var H=A.b[U];H.n==="else"?V+="else{"+P(H.d,R)+"}":H.n==="elif"&&(V+="else if("+H.p+"){"+P(H.d,R)+"}")}return V},try:function(A,R){if(_e("try",!1,A.f,!0),!A.b||A.b.length!==1||A.b[0].n!=="catch")throw e("native helper 'try' only accepts 1 block, 'catch'");var V="try{"+P(A.d,R)+"}",U=A.b[0];return V+="catch"+(U.res?"("+U.res+")":"")+"{"+P(U.d,R)+"}"},block:function(A,R){return _e("block",A.b,A.f,!0),"if(!"+R.varName+"["+A.p+"]){tR+=("+G(A.d,"",R)+")()}else{tR+="+R.varName+"["+A.p+"]}"}}),Te=new Q({e:function(A){var R=String(A);return/[&<>"']/.test(R)?R.replace(/[&<>"']/g,ce):R}}),Ae={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(A,R){if(A==="H"){var V=this.storage.helpers.get(R);if(V)return V;throw e("Can't find helper '"+R+"'")}if(A==="F"){var U=this.storage.filters.get(R);if(U)return U;throw e("Can't find filter '"+R+"'")}},async:!1,storage:{helpers:fe,nativeHelpers:Be,filters:Te,templates:se},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function qe(A,R){var V={};return s(V,Ae),R&&s(V,R),A&&s(V,A),V.l.bind(V),V}function et(A,R){var V,U=qe(R||{}),H=Function;if(U.async){if(!i)throw e("This environment doesn't support async/await");H=i}if(U.varName&&(V=U.varName,/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)===!1))throw e("options.varName must be a valid JS identifier");try{return new H(U.varName,"c","cb",T(A,U))}catch(ne){throw ne instanceof SyntaxError?e(`Bad template syntax
|
|
7
7
|
|
|
8
8
|
`+ne.message+`
|
|
9
9
|
`+Array(ne.message.length+1).join("=")+`
|
|
10
|
-
`+T(A,U)):ne}}function
|
|
10
|
+
`+T(A,U)):ne}}function Ft(A,R){var V;return R.cache&&R.name&&R.storage.templates.get(R.name)?R.storage.templates.get(R.name):(V=typeof A=="function"?A:et(A,R),R.cache&&R.name&&R.storage.templates.define(R.name,V),V)}Ae.l.bind(Ae),t.compile=et,t.compileScope=P,t.compileScopeIntoFunction=G,t.compileToString=T,t.defaultConfig=Ae,t.filters=Te,t.getConfig=qe,t.helpers=fe,t.nativeHelpers=Be,t.parse=y,t.render=function(A,R,V,U){var H=qe(V||{});if(!H.async)return Ft(A,H)(R,H);if(!U){if(typeof n=="function")return new n(function(ne,he){try{ne(Ft(A,H)(R,H))}catch(Ke){he(Ke)}});throw e("Please provide a callback function, this env doesn't support Promises")}try{Ft(A,H)(R,H,U)}catch(ne){return U(ne)}},t.templates=se,Object.defineProperty(t,"__esModule",{value:!0})})});var iu="12.0.0";var Yv=iu.split("-")[0].split(".").slice(0,3).map(t=>t.padStart(2,"0")).join(""),Ys="WEB",Sm="CooeeSDK",Kr=iu,Im=parseInt(Yv,10);var Tm=["collection","product","cart"],xm=[{identifier:"#flo-checkout-wrapper",gateway:"Shopflow"},{identifier:"#fastrr-main-container",gateway:"Shiprocket"},{identifier:"#gokwik-modal-wrapper",gateway:"Gokwik"},{identifier:"#zecpe",gateway:"Ecom 360"}],Cm=["View Item","View Cart","View Collection"];var Ks=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${Kr}/dist`,Gt={apiURL:"https://api.sdk.letscooee.com",debug:!1,mode:"production",baseURL:Ks,styleURL:`${Ks}/widget.min.css`,widgetURL:`${Ks}/widget.min.js`,swiperStyleURL:`${Ks}/swiper-bundle.min.css`};var zt=xr(Si());var b=class{static debuggerEl;static infoLogs=[];static log(...e){zt.default.info(...e)}static verbose(...e){zt.default.debug(...e)}static error(...e){zt.default.error(...e)}static warn(...e){zt.default.warn(...e)}static info(...e){zt.default.info(...e),this.infoLogs.unshift({time:new Date,message:e.join(" ")}),this.addToDebugger()}static trace(...e){zt.default.trace(...e)}static addToDebugger(){sessionStorage.cooeeDebug&&(this.debuggerEl=this.debuggerEl??document.querySelector("cooee-debugger"),this.debuggerEl&&this.debuggerEl&&(this.debuggerEl.logs=[...this.infoLogs]))}};function Am(t=Sm){zt.default.useDefaults({formatter:function(r){r.unshift(`${t} (v${Kr}):`)}});let e=ou();(e==="1"||e==="on")&&(localStorage.cooeeLogLevel="TRACE"),localStorage.cooeeLogLevel?zt.default.setLevel(zt.default[localStorage.cooeeLogLevel]):zt.default.setLevel(Gt.debug?zt.default.TRACE:zt.default.OFF)}function ou(){return new URL(location.href).searchParams?.get("cooee-debug")}function Dm(){let t=`
|
|
11
11
|
display: inline-block;
|
|
12
12
|
font-size: 14px;
|
|
13
13
|
background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);
|
|
@@ -21,25 +21,25 @@ import{a as _,b as Z,c as Lo,d as ym,e as Mo,f as Rr,g as Si}from"./chunk-V7UGKY
|
|
|
21
21
|
`,e+=`\u{1F6CD}\uFE0F Boost purchases & repeat sales effortlessly
|
|
22
22
|
`,e+=`
|
|
23
23
|
|
|
24
|
-
`,e+="Learn more: https://www.letscooee.com",console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",t),console.log(`%c${e}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd(),w.info(`SDK v${Kr} loaded`)}var Je=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(e){return e??={},this.gaEnabled=e.gaEnabled,this.gaMeasurementID=e.gaMeasurementID,this.pixelPush=e.pixelPush,this.website=e.website??{},this.currencyCount=e.currencyCount??0,this.money=e.money,this.currency=e.currency,this.storefrontToken=e.storefrontToken,this.skipItemAttribute=e.skipItemAttribute,this}};var Cm=Rr(cu());var Wv=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"],xm={utm_source:"tw_source",utm_campaign:"tw_campaign"};var Rm=()=>{if(document.referrer)return document.referrer.replace(location.origin,"")},Am=()=>{let t;try{t=new Cm.URLBuilder(location.href)}catch{return{}}let e={};Wv.forEach(n=>{let i=t.getQueryParam(n);i&&(e[n]=i)});let r={};return Object.keys(xm).forEach(n=>{let i=t.getQueryParam(xm[n]);i&&(r[n]=i)}),_(_({},r),e)};var Ct=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(e){this.id=e.id,this.mID=e.mID,this.vID=e.vID,this.vName=e.vName,this.imageURL=e.imageURL,this.name=e.name,this.link=e.link,this.quantity=e.quantity,this.price=e.price,this.finalPrice=e.finalPrice??e.price}};function vr(t){let e=new Date(Date.UTC(0,0,0,0,0,0,t)),r=[];return e.getUTCMinutes()&&r.push(e.getUTCMinutes()+"m"),e.getUTCSeconds()&&r.push(e.getUTCSeconds()+"s"),e.getUTCMilliseconds()&&r.push(e.getUTCMilliseconds()+"ms"),r.length||r.push("0ms"),r.join(" ")}var fe=class{constructor(e){this.sdkLoadTime=e}isCartDirty=!0;cartEngagements;isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;locale;customContext={};activeExperiments;currentItem;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(e){this._currencyCode=e}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return this.lastEnterInactive==null}getCurrentItem(){return this.currentItem}setCurrentItem(e){if(this.currentItem&&this.currentItem.vID!==e.vID){let r=new CustomEvent("letscooee:variant-change",{detail:{variantID:e.vID}});document.dispatchEvent(r)}this.currentItem=new Ct(e)}getSDKLoadTimeDiff(){return vr(Date.now()-this.sdkLoadTime.getTime())}};var lu=class{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content}};function ra(){let t=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new lu(_({origin:location.origin,path:t,qs:location.search,referrer:Rm(),name:fe.get().pageName},Am()))}function Dm(){let t=fe.get(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");if(r){let i=r.split(",").map(o=>o.trim()).filter(o=>Number.isInteger(+o));i.length&&(t.previewIDs=i)}let n=e.get("cooee-variant")?.trim();n&&(t.previewVariant=n)}var er=(function(t){return t[t.NONE=0]="NONE",t[t.STATIC=1]="STATIC",t[t.UNIQUE_FLAT=2]="UNIQUE_FLAT",t[t.UNIQUE_FLAT_ITEMS=3]="UNIQUE_FLAT_ITEMS",t[t.UNIQUE_FIXED_ITEMS=4]="UNIQUE_FIXED_ITEMS",t[t.UNIQUE_CHEAPEST_ITEM_FREE=5]="UNIQUE_CHEAPEST_ITEM_FREE",t[t.BXGY=6]="BXGY",t})(er||{});var Bo=(function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t})(Bo||{});var uu=(function(t){return t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION",t})(uu||{});var Ti=(function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t})(Ti||{}),tr=(function(t){return t.SHOPIFY_CHECKOUT="shopify_checkout",t.THIRD_PARTY_CHECKOUT="third_party_checkout",t.CART_PAGE="cart_page",t.CART_DRAWER="cart_drawer",t})(tr||{});var we=(function(t){return t[t.NONE=0]="NONE",t[t.REJECT_POPUP=1]="REJECT_POPUP",t[t.ACCEPT_POPUP=2]="ACCEPT_POPUP",t[t.GO_TO_URL=4]="GO_TO_URL",t[t.SHARE=5]="SHARE",t[t.KEY_VALUE=100]="KEY_VALUE",t[t.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",t[t.ADD_TO_CART=102]="ADD_TO_CART",t[t.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",t[t.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",t[t.OPEN_CART=105]="OPEN_CART",t[t.SUBMIT_FORM=106]="SUBMIT_FORM",t[t.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",t[t.ADD_BUNDLE=108]="ADD_BUNDLE",t[t.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",t[t.BUY_NOW=110]="BUY_NOW",t[t.QUICK_VIEW=111]="QUICK_VIEW",t})(we||{}),ko=(function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t})(ko||{}),Er=(function(t){return t.PRODUCT_PROMOTION="PRODUCT_PROMOTION",t.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",t.CART_RECOVERY="CART_RECOVERY",t.ANNOUNCEMENT="ANNOUNCEMENT",t.LEAD_GENERATION="LEAD_GENERATION",t.DATA_COLLECTION="DATA_COLLECTION",t.SALE_PROMOTION="SALE_PROMOTION",t.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",t.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",t.BYOB="BYOB",t.PROGRESS_BAR="PROGRESS_BAR",t.BUY_NOW="BUY_NOW",t.STICKY_ATC="STICKY_ATC",t.EXPERIMENT="EXPERIMENT",t.SAVINGS_BAR="SAVINGS_BAR",t})(Er||{}),Uo=(function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t})(Uo||{}),pu=(function(t){return t.ICONS="ICONS",t.TILES="TILES",t})(pu||{}),fu=(function(t){return t.FREE_SHIPPING="FREE_SHIPPING",t.DISCOUNT="DISCOUNT",t.FREE_AUTO_GIFT="FREE_AUTO_GIFT",t.FREE_GIFT_SELECT="FREE_GIFT_SELECT",t.UI_ONLY="UI_ONLY",t})(fu||{});var Xr=class t{static of(e,r){return r!==void 0?new Array(e).fill(r):Array.from({length:e},(n,i)=>i)}static remove(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static swap(e,r,n){[e[r],e[n]]=[e[n],e[r]]}static sum(e,r){return e.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(e,r){return e.filter((n,i,o)=>o.findIndex(s=>s[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,t.swap(e,r,n)}}};var Nm=(()=>{class t{static toTitle(r){return r?this.titleCase(r.toLowerCase().split(/[_-]+/).join(" ")):""}static toSlug(r){return r?r.toLowerCase().replace(/[_-]+/," ").replace(/[^\w ]+/g,"").replace(/ +/g,"-"):""}static toCamelCase(r){return r.toLowerCase().split(" ").map((n,i)=>i===0?n:n.charAt(0).toUpperCase()+n.slice(1)).join("")}static format(r,...n){return r?.replace(/{(\d+)}/g,(i,o)=>{let s=n[o];return s!==void 0?s:i})}static chop(r,n){if(!(!r||!n))return r.length<=n?r:r.substring(0,n)}static titleCase=r=>r.replace(/(^|\s)\S/g,n=>n.toUpperCase())}return t})();var na=class{applyDiscountOnMinimum;constructor(e){this.applyDiscountOnMinimum=e.applyDiscountOnMinimum}};var $n=class{s;g;i;constructor(e){e.s&&(this.s=new je(e.s)),e.g&&(this.g=new Fo(e.g)),this.i=e.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var Ho="a-f\\d",jv=`#?[${Ho}]{3}[${Ho}]?`,Gv=`#?[${Ho}]{6}([${Ho}]{2})?`,zv=new RegExp(`[^#${Ho}]`,"gi"),Yv=new RegExp(`^${jv}$|^${Gv}$`,"i");function mu(t,e={}){if(typeof t!="string"||zv.test(t)||!Yv.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,o=n>>8&255,s=n&255,a=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,o,s,a];if(e.format==="css"){let c=a===1?"":` / ${Number((a*100).toFixed(2))}%`;return`rgb(${i} ${o} ${s}${c})`}return{red:i,green:o,blue:s,alpha:a}}var je=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return mu(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var Jr=class{s;r;w;c;constructor(e){this.s=e.s,this.r=e.r,this.w=e.w,e.c&&(this.c=new je(e.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return ia[this.s??1]}},ia=(r=>(r[r.SOLID=1]="SOLID",r[r.DASHED=2]="DASHED",r))(ia||{});var Fo=class t{static DEFAULT_FALLBACK=new je({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new je(e.c)),e.fb&&(this.fb=new je(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??t.DEFAULT_FALLBACK}};var $o=class{blur;spr;clr;x;y;constructor(e){e=e??{},this.blur=e.blur??0,this.spr=e.spr??0,this.x=e.x??0,this.y=e.y??0,this.clr=new je(e.clr)}getStyle(e){return`${this.x*e}px ${this.y*e}px ${this.blur*e}px ${this.spr*e}px ${this.clr.rgba}`}};var Qr=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(e){e=e??{},this.pl=e.pl??0,this.pr=e.pr??0,this.pt=e.pt??0,this.pb=e.pb??0,this.ml=e.ml??0,this.mr=e.mr??0,this.mt=e.mt??0,this.mb=e.mb??0,this.cent=e.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}};var Vn=class{rot;constructor(e){e?.rot&&(this.rot=e.rot)}get rotate(){return this.rot}};var xi=(i=>(i[i.START=0]="START",i[i.CENTER=1]="CENTER",i[i.END=2]="END",i[i.JUSTIFY=3]="JUSTIFY",i))(xi||{});var oa=class{name;fonts;constructor(e){e=e??{},e.name&&(e.name=e.name!=="Arial"?e.name:""),this.name=e.name,this.fonts=e.fonts?.map(r=>new du(r))}},du=class{style;url;constructor(e){e=e??{},this.style=e.style,this.url=e.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}};var ut=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(e){this.update(e)}get alignment(){return xi[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(e){e=e??{},e.lh&&(this.lh=e.lh),e.tdc&&(this.tdc=new je(e.tdc)),this.td=e.td,this.fs=e.s??e.fs??60,this.tc=new je(e.tc),this.ta=e.ta??1,this.fw=e.fw??400,this.ls=e.ls??0,this.tc.h??="#000000",this.fam=new oa(e.fam??e.fmly)}resize(e){this.s*=e,this.ls*=e}};var sa=class{modifications;constructor(e={}){e.modifications?.length?this.modifications=e.modifications.map(r=>new aa(r)):e.experiments?.length&&(this.modifications=e.experiments.map(r=>new aa(r)))}};var aa=class{cssSelector;type;display;bg;typo;br;text;image;constructor(e={}){this.cssSelector=e.cssSelector??"",this.type=e.type??"OTHER",this.display=e.display,e.bg&&(this.bg=new je(e.bg)),e.typo&&(this.typo=new ut(e.typo)),e.br&&(this.br=new Jr(e.br)),this.text=e.text,this.image=e.image}get style(){let e={};return this.display==="HIDE"?e.display="none":this.display==="BLOCK"?e.display="block":this.display==="INLINE"&&(e.display="inline"),this.br?.r&&(e.borderRadius=this.br.r+"px"),this.br?.w&&(e.borderWidth=this.br.w+"px"),this.br?.s&&(e.borderStyle=ia[this.br.s]?.toLowerCase()),this.br?.c?.h&&(e.borderColor=this.br.color?.rgba),this.bg?.h&&(e.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(e.fontSize=this.typo.fs+"px"),this.typo.lh&&(e.lineHeight=this.typo.lh),this.typo.fw&&(e.fontWeight=this.typo.fw),this.typo.ta&&(e.textAlign=this.typo.alignment),this.typo.tc.h&&(e.color=this.typo.tc.rgba),this.typo.ls&&(e.letterSpacing=this.typo.letterSpacing),this.typo.td&&(e.textDecoration=this.typo.td??"none")),e}toString(){return`Experiment(cssSelector=${this.cssSelector})`}};var hu=class{minValue;rewardType;label;reachingText;reachedText;discount;items;isUIOnly;allowATC;reached;calculatedAlignment;constructor(e){this.reached=e.reached??!1,this.calculatedAlignment=e.calculatedAlignment,this.minValue=e.minValue,this.rewardType=e.rewardType,this.label=e.label,this.reachingText=e.reachingText,this.reachedText=e.reachedText,this.discount=e.discount,this.items=e.items?.map(r=>new Ct(r)),this.isUIOnly=e.isUIOnly,this.allowATC=e.allowATC}};var ca=class{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(e){this.layout=e.layout??pu.ICONS,this.onlyLatestGift=e.onlyLatestGift,this.noConfetti=e.noConfetti,this.removeIneligibleItem=e.removeIneligibleItem??!0,this.restrictToLatestFreebie=e.restrictToLatestFreebie,this.rewardBasis=e.rewardBasis??"CART_AMOUNT",this.update(e)}update(e){e=e??{},this.milestones=e.milestones?.map(r=>new hu(r))??[],this.totalProgress=e.totalProgress??0,this.coupons=e.coupons,this.reachedAmountOrCount=e.reachedAmountOrCount}};var la=class{animateNumber;animationDuration;text;iconURL;animation;totalSavings;constructor(e={}){this.animateNumber=e.animateNumber??!0,this.animation=e.animation??"SLOT_MACHINE",this.animationDuration=e.animationDuration??1e3,this.text=e.text??"You are saving {{ cart.total_savings }} on this order",this.iconURL=e.iconURL,this.totalSavings=e.totalSavings??0}};var Ar=class{constructor(e,r){this._startTime=e;this._triggerData=r}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let e=this.triggerData.shortID??this.triggerData.id.slice(-6);return e==="test"&&(e="test-"+this.startTime.getTime().toString()),"cooee-wrapper-"+e}get selectedItems(){return this.triggerData.items.filter(e=>e.selected.value)}get shouldGiveFBTDiscount(){let e=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=e:e===this.triggerData.items.length}onClose(e){this.closeCallback=e}closeInApp(e,r){r??={};let n=(new Date().getTime()-this.startTime.getTime())/1e3,i=_({eventName:e,duration:n},r);this.stopIntervals(),this.closeCallback&&this.closeCallback(i)}addInputField(e,r){this.inputFields.push({id:e,type:r,isValid:!1})}updateValidation(e,r){this.inputFields.forEach(n=>{if(n.id===e){n.isValid=r;return}})}hasManipulatedProductQuantity(){let e=this.triggerData.manipulation.productQuantity;return e?.enabled&&e.min!=null&&e.max!=null}getManipulatedQuantity(e){let{min:r=1,max:n=100}=this.triggerData.manipulation.productQuantity;if(r>n)return w.error("Invalid range: min should be less than or equal to max."),e;if(e>=r&&e<=n)return e;let i=e%100;return i<r?r:i>n?n:i}stopIntervals(){this.intervals.forEach(e=>clearInterval(e))}};var rr=class{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null}static parseToAny(e){try{return JSON.parse(e.toString())}catch{}return e.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(e.toString()):e}static async sleep(e){return new Promise(r=>setTimeout(r,e))}static hasKeys(e){return e?Object.keys(e).length>=1:!1}static convertObjectToArray(e,r){return r.reduce((n,i)=>(e.hasOwnProperty(i)&&e[i]!=null&&n.push({[i]:e[i]}),n),[])}static removeNullUndefinedKeys(e){return Object.keys(e).reduce((r,n)=>(e[n]!==null&&e[n]!==void 0&&(r[n]=e[n]),r),{})}static stringify(e){return JSON.stringify(e,function(r,n){return n===void 0?null:n})}};var yu=Rr(Pm());function Ci(t){return yu.default.createInstance({name:"lc",storeName:t,driver:yu.default.LOCALSTORAGE})}var yn=class{static storage;static async get(e,r){return await this.storage?.getItem(e)??r}static set(e,r){return this.storage?.setItem(e,r)}static remove(e){return this.storage?.removeItem(e)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var Vo=class Vo extends yn{};Si(Vo,"storeName","ses"),Vo.storage=Ci(Vo.storeName);var Rt=Vo;var Wo=class Wo extends yn{};Si(Wo,"storeName","usr"),Wo.storage=Ci(Wo.storeName);var Ke=Wo;var Mm=Rr(Lm());var qv=5,Kv=500,Xv=(0,Mm.default)(fetch),Jv={retryDelay:t=>Math.pow(2,t)*Kv,retryOn:(t,e,r)=>t>=qv?!1:!!(e!==null||r?.status&&r?.status>=500)},Wn=class extends Error{request;response;status;requestBody;responseText;constructor(e="Failed to fetch"){super(e),this.name="FetchError",Object.setPrototypeOf(this,new.target.prototype)}is40x(){return!!this.response&&this.response.status>=400&&this.response.status<500}};async function Zr(t,e,r){let n=Date.now(),i=new Request(t,e),o;try{o=await Xv(i,_(_({},Jv),r))}catch{}if(!o||!o.ok){let d=new Wn;throw d.request=i.clone(),d.response=o?.clone(),d.status=o?.status,d.requestBody=e?.body,d.responseText=await Qv(o),d}let s,a=(o.headers.get("content-type")||"").toLowerCase(),c=o.headers.get("content-length"),p=i.method?.toUpperCase()||"GET";return o.status===204||o.status===205||p==="HEAD"||c==="0"?s=void 0:a.includes("application/json")||a.includes("application/problem+json")||a.includes("text/javascript")?s=await o.json():a.includes("text/")||a.includes("image/svg+xml")?s=await o.text():s=await o.arrayBuffer(),{data:s,status:o.status,statusText:o.statusText,headers:o.headers,timeTakenMs:Date.now()-n,options:e,request:i}}async function Qv(t){if(t){try{return t=t.clone(),await t.json()}catch{}try{return await t.text()}catch{}}}var oe=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var me=globalThis;var Dr="9.42.0";function jn(){return Gn(me),me}function Gn(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||Dr,e[Dr]=e[Dr]||{}}function en(t,e,r=me){let n=r.__SENTRY__=r.__SENTRY__||{},i=n[Dr]=n[Dr]||{};return i[t]||(i[t]=e())}var _u=["debug","info","warn","error","log","assert","trace"],Zv="Sentry Logger ",Ri={};function vn(t){if(!("console"in me))return t();let e=me.console,r={},n=Object.keys(Ri);n.forEach(i=>{let o=Ri[i];r[i]=e[i],e[i]=o});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function eE(){wu().enabled=!0}function tE(){wu().enabled=!1}function Bm(){return wu().enabled}function rE(...t){bu("log",...t)}function nE(...t){bu("warn",...t)}function iE(...t){bu("error",...t)}function bu(t,...e){oe&&Bm()&&vn(()=>{me.console[t](`${Zv}[${t}]:`,...e)})}function wu(){return oe?en("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var ee={enable:eE,disable:tE,isEnabled:Bm,log:rE,warn:nE,error:iE};var km=/\(error: (.*)\)/,Um=/captureMessage|captureException/;function Iu(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let o=[],s=r.split(`
|
|
25
|
-
`);for(let a=n;a<s.length;a++){let c=s[a];if(c.length>1024)continue;let p=
|
|
24
|
+
`,e+="Learn more: https://www.letscooee.com",console.group("%c Elevate your ecommerce experience with Cooee \u{1F680} ",t),console.log(`%c${e}`,"font-size: 13px; line-height: 1.8;"),console.groupEnd(),b.info(`SDK v${Kr} loaded`)}var Xe=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;currency;static get(){return window.CooeeSDK.config}update(e){return e??={},this.gaEnabled=e.gaEnabled,this.gaMeasurementID=e.gaMeasurementID,this.pixelPush=e.pixelPush,this.website=e.website??{},this.currencyCount=e.currencyCount??0,this.money=e.money,this.currency=e.currency,this.storefrontToken=e.storefrontToken,this.skipItemAttribute=e.skipItemAttribute,this}};var Om=xr(su());var Xv=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"],Nm={utm_source:"tw_source",utm_campaign:"tw_campaign"};var Pm=()=>{if(document.referrer)return document.referrer.replace(location.origin,"")},Lm=()=>{let t;try{t=new Om.URLBuilder(location.href)}catch{return{}}let e={};Xv.forEach(n=>{let i=t.getQueryParam(n);i&&(e[n]=i)});let r={};return Object.keys(Nm).forEach(n=>{let i=t.getQueryParam(Nm[n]);i&&(r[n]=i)}),_(_({},r),e)};var Rt=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(e){this.id=e.id,this.mID=e.mID,this.vID=e.vID,this.vName=e.vName,this.imageURL=e.imageURL,this.name=e.name,this.link=e.link,this.quantity=e.quantity,this.price=e.price,this.finalPrice=e.finalPrice??e.price}};function gr(t){let e=new Date(Date.UTC(0,0,0,0,0,0,t)),r=[];return e.getUTCMinutes()&&r.push(e.getUTCMinutes()+"m"),e.getUTCSeconds()&&r.push(e.getUTCSeconds()+"s"),e.getUTCMilliseconds()&&r.push(e.getUTCMilliseconds()+"ms"),r.length||r.push("0ms"),r.join(" ")}var ye=class{constructor(e){this.sdkLoadTime=e}isGoKwikPopupOpen;previewIDs;previewVariant;pageName;moneyFormat;jsLoadTime=new Date;shopCurrencyCode;locale;customContext={};activeExperiments;currentItem;inInactive=!1;lastEnterActive=new Date;lastEnterInactive=null;_currencyCode;get currencyCode(){return this._currencyCode}set currencyCode(e){this._currencyCode=e}static get(){return window.CooeeSDK.runtimeData}isInactive(){return this.inInactive}async setInactive(){return this.inInactive?0:(this.inInactive=!0,this.lastEnterInactive=new Date,Math.max((this.lastEnterInactive.getTime()-this.lastEnterActive.getTime())/1e3,0))}setActive(){return this.inInactive?(this.inInactive=!1,this.lastEnterActive=new Date,Math.max((this.lastEnterActive.getTime()-this.lastEnterInactive.getTime())/1e3,0)):0}isFirstActive(){return this.lastEnterInactive==null}getCurrentItem(){return this.currentItem}setCurrentItem(e){if(this.currentItem&&this.currentItem.vID!==e.vID){let r=new CustomEvent("letscooee:variant-change",{detail:{variantID:e.vID}});document.dispatchEvent(r)}this.currentItem=new Rt(e)}getSDKLoadTimeDiff(){return gr(Date.now()-this.sdkLoadTime.getTime())}};var au=class{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content}};function Qs(){let t=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new au(_({origin:location.origin,path:t,qs:location.search,referrer:Pm(),name:ye.get().pageName},Lm()))}function Mm(){let t=ye.get(),e=new URLSearchParams(location.search),r=e.get("cooee-preview");if(r){let i=r.split(",").map(o=>o.trim()).filter(o=>Number.isInteger(+o));i.length&&(t.previewIDs=i)}let n=e.get("cooee-variant")?.trim();n&&(t.previewVariant=n)}var er=(function(t){return t[t.NONE=0]="NONE",t[t.STATIC=1]="STATIC",t[t.UNIQUE_FLAT=2]="UNIQUE_FLAT",t[t.UNIQUE_FLAT_ITEMS=3]="UNIQUE_FLAT_ITEMS",t[t.UNIQUE_FIXED_ITEMS=4]="UNIQUE_FIXED_ITEMS",t[t.UNIQUE_CHEAPEST_ITEM_FREE=5]="UNIQUE_CHEAPEST_ITEM_FREE",t[t.BXGY=6]="BXGY",t})(er||{});var Po=(function(t){return t[t.SINGLE=1]="SINGLE",t[t.EXCLUSION=2]="EXCLUSION",t[t.ABTESTING=3]="ABTESTING",t})(Po||{});var cu=(function(t){return t[t.NONE=0]="NONE",t[t.ITEM=1]="ITEM",t[t.COLLECTION=2]="COLLECTION",t})(cu||{});var Ii=(function(t){return t.BEFORE="before",t.AFTER="after",t.INSIDE_FIRST="insideFirst",t.INSIDE_LAST="insideLast",t})(Ii||{}),tr=(function(t){return t.SHOPIFY_CHECKOUT="shopify_checkout",t.THIRD_PARTY_CHECKOUT="third_party_checkout",t.CART_PAGE="cart_page",t.CART_DRAWER="cart_drawer",t})(tr||{});var we=(function(t){return t[t.NONE=0]="NONE",t[t.REJECT_POPUP=1]="REJECT_POPUP",t[t.ACCEPT_POPUP=2]="ACCEPT_POPUP",t[t.GO_TO_URL=4]="GO_TO_URL",t[t.SHARE=5]="SHARE",t[t.KEY_VALUE=100]="KEY_VALUE",t[t.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",t[t.ADD_TO_CART=102]="ADD_TO_CART",t[t.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",t[t.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",t[t.OPEN_CART=105]="OPEN_CART",t[t.SUBMIT_FORM=106]="SUBMIT_FORM",t[t.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",t[t.ADD_BUNDLE=108]="ADD_BUNDLE",t[t.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",t[t.BUY_NOW=110]="BUY_NOW",t[t.QUICK_VIEW=111]="QUICK_VIEW",t})(we||{}),Lo=(function(t){return t.POPUP="POPUP",t.PAGE_EMBED="PAGE_EMBED",t.CART_EMBED="CART_EMBED",t.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",t})(Lo||{}),yr=(function(t){return t.PRODUCT_PROMOTION="PRODUCT_PROMOTION",t.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",t.CART_RECOVERY="CART_RECOVERY",t.ANNOUNCEMENT="ANNOUNCEMENT",t.LEAD_GENERATION="LEAD_GENERATION",t.DATA_COLLECTION="DATA_COLLECTION",t.SALE_PROMOTION="SALE_PROMOTION",t.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",t.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",t.BYOB="BYOB",t.PROGRESS_BAR="PROGRESS_BAR",t.BUY_NOW="BUY_NOW",t.STICKY_ATC="STICKY_ATC",t.EXPERIMENT="EXPERIMENT",t.SAVINGS_BAR="SAVINGS_BAR",t})(yr||{}),Mo=(function(t){return t.COOEE="COOEE",t.KLAVIYO="KLAVIYO",t})(Mo||{}),lu=(function(t){return t.ICONS="ICONS",t.TILES="TILES",t})(lu||{}),uu=(function(t){return t.FREE_SHIPPING="FREE_SHIPPING",t.DISCOUNT="DISCOUNT",t.FREE_AUTO_GIFT="FREE_AUTO_GIFT",t.FREE_GIFT_SELECT="FREE_GIFT_SELECT",t.UI_ONLY="UI_ONLY",t})(uu||{});var Xr=class t{static of(e,r){return r!==void 0?new Array(e).fill(r):Array.from({length:e},(n,i)=>i)}static remove(e,r){let n=e.indexOf(r);return n===-1?!1:(e.splice(n,1),!0)}static swap(e,r,n){[e[r],e[n]]=[e[n],e[r]]}static sum(e,r){return e.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(e,r){return e.filter((n,i,o)=>o.findIndex(s=>s[r]===n[r])===i)}static shuffle(e){let r=e.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,t.swap(e,r,n)}}};var Bm=(()=>{class t{static toTitle(r){return r?this.titleCase(r.toLowerCase().split(/[_-]+/).join(" ")):""}static toSlug(r){return r?r.toLowerCase().replace(/[_-]+/," ").replace(/[^\w ]+/g,"").replace(/ +/g,"-"):""}static toCamelCase(r){return r.toLowerCase().split(" ").map((n,i)=>i===0?n:n.charAt(0).toUpperCase()+n.slice(1)).join("")}static format(r,...n){return r?.replace(/{(\d+)}/g,(i,o)=>{let s=n[o];return s!==void 0?s:i})}static chop(r,n){if(!(!r||!n))return r.length<=n?r:r.substring(0,n)}static titleCase=r=>r.replace(/(^|\s)\S/g,n=>n.toUpperCase())}return t})();var Zs=class{applyDiscountOnMinimum;constructor(e){this.applyDiscountOnMinimum=e.applyDiscountOnMinimum}};var $n=class{s;g;i;constructor(e){e.s&&(this.s=new je(e.s)),e.g&&(this.g=new Bo(e.g)),this.i=e.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var ko="a-f\\d",Jv=`#?[${ko}]{3}[${ko}]?`,Qv=`#?[${ko}]{6}([${ko}]{2})?`,Zv=new RegExp(`[^#${ko}]`,"gi"),eE=new RegExp(`^${Jv}$|^${Qv}$`,"i");function pu(t,e={}){if(typeof t!="string"||Zv.test(t)||!eE.test(t))throw new TypeError("Expected a valid hex string");t=t.replace(/^#/,"");let r=1;t.length===8&&(r=Number.parseInt(t.slice(6,8),16)/255,t=t.slice(0,6)),t.length===4&&(r=Number.parseInt(t.slice(3,4).repeat(2),16)/255,t=t.slice(0,3)),t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);let n=Number.parseInt(t,16),i=n>>16,o=n>>8&255,s=n&255,a=typeof e.alpha=="number"?e.alpha:r;if(e.format==="array")return[i,o,s,a];if(e.format==="css"){let c=a===1?"":` / ${Number((a*100).toFixed(2))}%`;return`rgb(${i} ${o} ${s}${c})`}return{red:i,green:o,blue:s,alpha:a}}var je=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return pu(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var Jr=class{s;r;w;c;constructor(e){this.s=e.s,this.r=e.r,this.w=e.w,e.c&&(this.c=new je(e.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return ea[this.s??1]}},ea=(r=>(r[r.SOLID=1]="SOLID",r[r.DASHED=2]="DASHED",r))(ea||{});var Bo=class t{static DEFAULT_FALLBACK=new je({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new je(e.c)),e.fb&&(this.fb=new je(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??t.DEFAULT_FALLBACK}};var Uo=class{blur;spr;clr;x;y;constructor(e){e=e??{},this.blur=e.blur??0,this.spr=e.spr??0,this.x=e.x??0,this.y=e.y??0,this.clr=new je(e.clr)}getStyle(e){return`${this.x*e}px ${this.y*e}px ${this.blur*e}px ${this.spr*e}px ${this.clr.rgba}`}};var Qr=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(e){e=e??{},this.pl=e.pl??0,this.pr=e.pr??0,this.pt=e.pt??0,this.pb=e.pb??0,this.ml=e.ml??0,this.mr=e.mr??0,this.mt=e.mt??0,this.mb=e.mb??0,this.cent=e.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}};var Vn=class{rot;constructor(e){e?.rot&&(this.rot=e.rot)}get rotate(){return this.rot}};var Ti=(i=>(i[i.START=0]="START",i[i.CENTER=1]="CENTER",i[i.END=2]="END",i[i.JUSTIFY=3]="JUSTIFY",i))(Ti||{});var ta=class{name;fonts;constructor(e){e=e??{},e.name&&(e.name=e.name!=="Arial"?e.name:""),this.name=e.name,this.fonts=e.fonts?.map(r=>new fu(r))}},fu=class{style;url;constructor(e){e=e??{},this.style=e.style,this.url=e.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}};var lt=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(e){this.update(e)}get alignment(){return Ti[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(e){e=e??{},e.lh&&(this.lh=e.lh),e.tdc&&(this.tdc=new je(e.tdc)),this.td=e.td,this.fs=e.s??e.fs??60,this.tc=new je(e.tc),this.ta=e.ta??1,this.fw=e.fw??400,this.ls=e.ls??0,this.tc.h??="#000000",this.fam=new ta(e.fam??e.fmly)}resize(e){this.s*=e,this.ls*=e}};var ra=class{modifications;constructor(e={}){e.modifications?.length?this.modifications=e.modifications.map(r=>new na(r)):e.experiments?.length&&(this.modifications=e.experiments.map(r=>new na(r)))}};var na=class{cssSelector;type;display;bg;typo;br;text;image;constructor(e={}){this.cssSelector=e.cssSelector??"",this.type=e.type??"OTHER",this.display=e.display,e.bg&&(this.bg=new je(e.bg)),e.typo&&(this.typo=new lt(e.typo)),e.br&&(this.br=new Jr(e.br)),this.text=e.text,this.image=e.image}get style(){let e={};return this.display==="HIDE"?e.display="none":this.display==="BLOCK"?e.display="block":this.display==="INLINE"&&(e.display="inline"),this.br?.r&&(e.borderRadius=this.br.r+"px"),this.br?.w&&(e.borderWidth=this.br.w+"px"),this.br?.s&&(e.borderStyle=ea[this.br.s]?.toLowerCase()),this.br?.c?.h&&(e.borderColor=this.br.color?.rgba),this.bg?.h&&(e.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(e.fontSize=this.typo.fs+"px"),this.typo.lh&&(e.lineHeight=this.typo.lh),this.typo.fw&&(e.fontWeight=this.typo.fw),this.typo.ta&&(e.textAlign=this.typo.alignment),this.typo.tc.h&&(e.color=this.typo.tc.rgba),this.typo.ls&&(e.letterSpacing=this.typo.letterSpacing),this.typo.td&&(e.textDecoration=this.typo.td??"none")),e}toString(){return`Experiment(cssSelector=${this.cssSelector})`}};var mu=class{minValue;rewardType;label;reachingText;reachedText;discount;items;isUIOnly;allowATC;reached;calculatedAlignment;constructor(e){this.reached=e.reached??!1,this.calculatedAlignment=e.calculatedAlignment,this.minValue=e.minValue,this.rewardType=e.rewardType,this.label=e.label,this.reachingText=e.reachingText,this.reachedText=e.reachedText,this.discount=e.discount,this.items=e.items?.map(r=>new Rt(r)),this.isUIOnly=e.isUIOnly,this.allowATC=e.allowATC}};var ia=class{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(e){this.layout=e.layout??lu.ICONS,this.onlyLatestGift=e.onlyLatestGift,this.noConfetti=e.noConfetti,this.removeIneligibleItem=e.removeIneligibleItem??!0,this.restrictToLatestFreebie=e.restrictToLatestFreebie,this.rewardBasis=e.rewardBasis??"CART_AMOUNT",this.update(e)}update(e){e=e??{},this.milestones=e.milestones?.map(r=>new mu(r))??[],this.totalProgress=e.totalProgress??0,this.coupons=e.coupons,this.reachedAmountOrCount=e.reachedAmountOrCount}};var oa=class{animateNumber;animationDuration;text;iconURL;animation;totalSavings;constructor(e={}){this.animateNumber=e.animateNumber??!0,this.animation=e.animation??"SLOT_MACHINE",this.animationDuration=e.animationDuration??1e3,this.text=e.text??"You are saving {{ cart.total_savings }} on this order",this.iconURL=e.iconURL,this.totalSavings=e.totalSavings??0}};var Cr=class{constructor(e,r){this._startTime=e;this._triggerData=r}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let e=this.triggerData.shortID??this.triggerData.id.slice(-6);return e==="test"&&(e="test-"+this.startTime.getTime().toString()),"cooee-wrapper-"+e}get selectedItems(){return this.triggerData.items.filter(e=>e.selected.value)}get shouldGiveFBTDiscount(){let e=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=e:e===this.triggerData.items.length}onClose(e){this.closeCallback=e}closeInApp(e,r){r??={};let n=(new Date().getTime()-this.startTime.getTime())/1e3,i=_({eventName:e,duration:n},r);this.stopIntervals(),this.closeCallback&&this.closeCallback(i)}addInputField(e,r){this.inputFields.push({id:e,type:r,isValid:!1})}updateValidation(e,r){this.inputFields.forEach(n=>{if(n.id===e){n.isValid=r;return}})}hasManipulatedProductQuantity(){let e=this.triggerData.manipulation.productQuantity;return e?.enabled&&e.min!=null&&e.max!=null}getManipulatedQuantity(e){let{min:r=1,max:n=100}=this.triggerData.manipulation.productQuantity;if(r>n)return b.error("Invalid range: min should be less than or equal to max."),e;if(e>=r&&e<=n)return e;let i=e%100;return i<r?r:i>n?n:i}stopIntervals(){this.intervals.forEach(e=>clearInterval(e))}};var rr=class{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null}static parseToAny(e){try{return JSON.parse(e.toString())}catch{}return e.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(e.toString()):e}static async sleep(e){return new Promise(r=>setTimeout(r,e))}static hasKeys(e){return e?Object.keys(e).length>=1:!1}static convertObjectToArray(e,r){return r.reduce((n,i)=>(e.hasOwnProperty(i)&&e[i]!=null&&n.push({[i]:e[i]}),n),[])}static removeNullUndefinedKeys(e){return Object.keys(e).reduce((r,n)=>(e[n]!==null&&e[n]!==void 0&&(r[n]=e[n]),r),{})}static stringify(e){return JSON.stringify(e,function(r,n){return n===void 0?null:n})}};var hu=xr(Um());function xi(t){return hu.default.createInstance({name:"lc",storeName:t,driver:hu.default.LOCALSTORAGE})}var yn=class{static storage;static async get(e,r){return await this.storage?.getItem(e)??r}static set(e,r){return this.storage?.setItem(e,r)}static remove(e){return this.storage?.removeItem(e)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var Fo=class Fo extends yn{};wi(Fo,"storeName","ses"),Fo.storage=xi(Fo.storeName);var At=Fo;var Ho=class Ho extends yn{};wi(Ho,"storeName","usr"),Ho.storage=xi(Ho.storeName);var Ye=Ho;var Hm=xr(Fm());var tE=5,rE=500,nE=(0,Hm.default)(fetch),iE={retryDelay:t=>Math.pow(2,t)*rE,retryOn:(t,e,r)=>t>=tE?!1:!!(e!==null||r?.status&&r?.status>=500)},Wn=class extends Error{request;response;status;requestBody;responseText;constructor(e="Failed to fetch"){super(e),this.name="FetchError",Object.setPrototypeOf(this,new.target.prototype)}is40x(){return!!this.response&&this.response.status>=400&&this.response.status<500}};async function Zr(t,e,r){let n=Date.now(),i=new Request(t,e),o;try{o=await nE(i,_(_({},iE),r))}catch{}if(!o||!o.ok){let d=new Wn;throw d.request=i.clone(),d.response=o?.clone(),d.status=o?.status,d.requestBody=e?.body,d.responseText=await oE(o),d}let s,a=(o.headers.get("content-type")||"").toLowerCase(),c=o.headers.get("content-length"),p=i.method?.toUpperCase()||"GET";return o.status===204||o.status===205||p==="HEAD"||c==="0"?s=void 0:a.includes("application/json")||a.includes("application/problem+json")||a.includes("text/javascript")?s=await o.json():a.includes("text/")||a.includes("image/svg+xml")?s=await o.text():s=await o.arrayBuffer(),{data:s,status:o.status,statusText:o.statusText,headers:o.headers,timeTakenMs:Date.now()-n,options:e,request:i}}async function oE(t){if(t){try{return t=t.clone(),await t.json()}catch{}try{return await t.text()}catch{}}}var oe=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var pe=globalThis;var Rr="9.42.0";function jn(){return Gn(pe),pe}function Gn(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||Rr,e[Rr]=e[Rr]||{}}function en(t,e,r=pe){let n=r.__SENTRY__=r.__SENTRY__||{},i=n[Rr]=n[Rr]||{};return i[t]||(i[t]=e())}var vu=["debug","info","warn","error","log","assert","trace"],sE="Sentry Logger ",Ci={};function vn(t){if(!("console"in pe))return t();let e=pe.console,r={},n=Object.keys(Ci);n.forEach(i=>{let o=Ci[i];r[i]=e[i],e[i]=o});try{return t()}finally{n.forEach(i=>{e[i]=r[i]})}}function aE(){_u().enabled=!0}function cE(){_u().enabled=!1}function $m(){return _u().enabled}function lE(...t){Eu("log",...t)}function uE(...t){Eu("warn",...t)}function pE(...t){Eu("error",...t)}function Eu(t,...e){oe&&$m()&&vn(()=>{pe.console[t](`${sE}[${t}]:`,...e)})}function _u(){return oe?en("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var ee={enable:aE,disable:cE,isEnabled:$m,log:lE,warn:uE,error:pE};var Vm=/\(error: (.*)\)/,Wm=/captureMessage|captureException/;function wu(...t){let e=t.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{let o=[],s=r.split(`
|
|
25
|
+
`);for(let a=n;a<s.length;a++){let c=s[a];if(c.length>1024)continue;let p=Vm.test(c)?c.replace(Vm,"$1"):c;if(!p.match(/\S*Error: /)){for(let d of e){let f=d(p);if(f){o.push(f);break}}if(o.length>=50+i)break}}return jm(o.slice(i))}}function jm(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(sa(e).function||"")&&e.pop(),e.reverse(),Wm.test(sa(e).function||"")&&(e.pop(),Wm.test(sa(e).function||"")&&e.pop()),e.slice(0,50).map(r=>Z(_({},r),{filename:r.filename||sa(e).filename,function:r.function||"?"}))}function sa(t){return t[t.length-1]||{}}var bu="<anonymous>";function nr(t){try{return!t||typeof t!="function"?bu:t.name||bu}catch{return bu}}function aa(t){let e=t.exception;if(e){let r=[];try{return e.values.forEach(n=>{n.stacktrace.frames&&r.push(...n.stacktrace.frames)}),r}catch{return}}}var ca={},Gm={};function Lt(t,e){ca[t]=ca[t]||[],ca[t].push(e)}function Mt(t,e){if(!Gm[t]){Gm[t]=!0;try{e()}catch(r){oe&&ee.error(`Error while instrumenting ${t}`,r)}}}function ut(t,e){let r=t&&ca[t];if(r)for(let n of r)try{n(e)}catch(i){oe&&ee.error(`Error while triggering instrumentation handler.
|
|
26
26
|
Type: ${t}
|
|
27
27
|
Name: ${nr(n)}
|
|
28
|
-
Error:`,i)}}var Tu=null;function xu(t){let e="error";Ot(e,t),Pt(e,oE)}function oE(){Tu=me.onerror,me.onerror=function(t,e,r,n,i){return pt("error",{column:n,error:i,line:r,msg:t,url:e}),Tu?Tu.apply(this,arguments):!1},me.onerror.__SENTRY_INSTRUMENTED__=!0}var Cu=null;function Ru(t){let e="unhandledrejection";Ot(e,t),Pt(e,sE)}function sE(){Cu=me.onunhandledrejection,me.onunhandledrejection=function(t){return pt("unhandledrejection",t),Cu?Cu.apply(this,arguments):!0},me.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var $m=Object.prototype.toString;function zn(t){switch($m.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return _r(t,Error)}}function Ai(t,e){return $m.call(t)===`[object ${e}]`}function ma(t){return Ai(t,"ErrorEvent")}function da(t){return Ai(t,"DOMError")}function Au(t){return Ai(t,"DOMException")}function Lt(t){return Ai(t,"String")}function Di(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Yn(t){return t===null||Di(t)||typeof t!="object"&&typeof t!="function"}function tn(t){return Ai(t,"Object")}function qn(t){return typeof Event<"u"&&_r(t,Event)}function Du(t){return typeof Element<"u"&&_r(t,Element)}function Nu(t){return Ai(t,"RegExp")}function rn(t){return!!(t?.then&&typeof t.then=="function")}function Ou(t){return tn(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function _r(t,e){try{return t instanceof e}catch{return!1}}function jo(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function Vm(t){return typeof Request<"u"&&_r(t,Request)}var Pu=me,aE=80;function Go(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],o=0,s=0,a=" > ",c=a.length,p,d=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||aE;for(;r&&o++<n&&(p=cE(r,d),!(p==="html"||o>1&&s+i.length*c+p.length>=f));)i.push(p),s+=p.length,r=r.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function cE(t,e){let r=t,n=[];if(!r?.tagName)return"";if(Pu.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let i=e?.length?e.filter(s=>r.getAttribute(s)).map(s=>[s,r.getAttribute(s)]):null;if(i?.length)i.forEach(s=>{n.push(`[${s[0]}="${s[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let s=r.className;if(s&&Lt(s)){let a=s.split(/\s+/);for(let c of a)n.push(`.${c}`)}}let o=["aria-label","type","name","title","alt"];for(let s of o){let a=r.getAttribute(s);a&&n.push(`[${s}="${a}"]`)}return n.join("")}function zo(){try{return Pu.document.location.href}catch{return""}}function Lu(t){if(!Pu.HTMLElement)return null;let e=t,r=5;for(let n=0;n<r;n++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function En(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function ha(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{jo(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function Wm(t,e,r=!1){return Lt(t)?Nu(e)?e.test(t):Lt(e)?r?t===e:t.includes(e):!1:!1}function Ni(t,e=[],r=!1){return e.some(n=>Wm(t,n,r))}function ft(t,e,r){if(!(e in t))return;let n=t[e];if(typeof n!="function")return;let i=r(n);typeof i=="function"&&ga(i,n);try{t[e]=i}catch{oe&&ee.log(`Failed to replace method "${e}" in object`,t)}}function qt(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{oe&&ee.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function ga(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,qt(t,"__sentry_original__",e)}catch{}}function Kn(t){return t.__sentry_original__}function ya(t){if(zn(t))return _({message:t.message,name:t.name,stack:t.stack},Gm(t));if(qn(t)){let e=_({type:t.type,target:jm(t.target),currentTarget:jm(t.currentTarget)},Gm(t));return typeof CustomEvent<"u"&&_r(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function jm(t){try{return Du(t)?Go(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Gm(t){if(typeof t=="object"&&t!==null){let e={};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}else return{}}function Mu(t,e=40){let r=Object.keys(ya(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return En(n,e);for(let i=r.length;i>0;i--){let o=r.slice(0,i).join(", ");if(!(o.length>e))return i===r.length?o:En(o,e)}return""}function lE(){let t=me;return t.crypto||t.msCrypto}function mt(t=lE()){let e=()=>Math.random()*16;try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(e=()=>{let r=new Uint8Array(1);return t.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(e()&15)>>r/4).toString(16))}function zm(t){return t.exception?.values?.[0]}function Nr(t){let{message:e,event_id:r}=t;if(e)return e;let n=zm(t);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function Oi(t,e,r){let n=t.exception=t.exception||{},i=n.values=n.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type=r||"Error")}function Or(t,e){let r=zm(t);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=_(_(_({},n),i),e),e&&"data"in e){let o=_(_({},i?.data),e.data);r.mechanism.data=o}}function va(t){if(uE(t))return!0;try{qt(t,"__sentry_captured__",!0)}catch{}return!1}function uE(t){try{return t.__sentry_captured__}catch{}}var qm=1e3;function Pr(){return Date.now()/qm}function pE(){let{performance:t}=me;if(!t?.now||!t.timeOrigin)return Pr;let e=t.timeOrigin;return()=>(e+t.now())/qm}var Ym;function Ut(){return(Ym??(Ym=pE()))()}function Km(t){let e=Ut(),r={sid:mt(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>fE(r)};return t&&nn(r,t),r}function nn(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Ut(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:mt()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let r=t.timestamp-t.started;t.duration=r>=0?r:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Xm(t,e){let r={};e?r={status:e}:t.status==="ok"&&(r={status:"exited"}),nn(t,r)}function fE(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function _n(t,e,r=2){if(!e||typeof e!="object"||r<=0)return e;if(t&&Object.keys(e).length===0)return t;let n=_({},t);for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=_n(n[i],e[i],r-1));return n}function Bu(){return mt()}function Ea(){return mt().substring(16)}var ku="_sentrySpan";function Uu(t,e){e?qt(t,ku,e):delete t[ku]}function Fu(t){return t[ku]}var mE=100,St=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Bu(),sampleRand:Math.random()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags=_({},this._tags),e._extra=_({},this._extra),e._contexts=_({},this._contexts),this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata=_({},this._sdkProcessingMetadata),e._propagationContext=_({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,Uu(e,Fu(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&nn(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags=_(_({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=Z(_({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=_(_({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=Z(_({},this._extra),{[e]:r}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,r){return r===null?delete this._contexts[e]:this._contexts[e]=r,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let r=typeof e=="function"?e(this):e,n=r instanceof t?r.getScopeData():tn(r)?e:void 0,{tags:i,extra:o,user:s,contexts:a,level:c,fingerprint:p=[],propagationContext:d}=n||{};return this._tags=_(_({},this._tags),i),this._extra=_(_({},this._extra),o),this._contexts=_(_({},this._contexts),a),s&&Object.keys(s).length&&(this._user=s),c&&(this._level=c),p.length&&(this._fingerprint=p),d&&(this._propagationContext=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,Uu(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Bu(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:mE;if(n<=0)return this;let i=Z(_({timestamp:Pr()},e),{message:e.message?En(e.message,2048):e.message});return this._breadcrumbs.push(i),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Fu(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=_n(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r?.event_id||mt();if(!this._client)return oe&&ee.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,Z(_({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n?.event_id||mt();if(!this._client)return oe&&ee.warn("No client configured on scope - will not capture message!"),i;let o=new Error(e);return this._client.captureMessage(e,r,Z(_({originalException:e,syntheticException:o},n),{event_id:i}),this),i}captureEvent(e,r){let n=r?.event_id||mt();return this._client?(this._client.captureEvent(e,Z(_({},r),{event_id:n}),this),n):(oe&&ee.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};function Jm(){return en("defaultCurrentScope",()=>new St)}function Qm(){return en("defaultIsolationScope",()=>new St)}var Hu=class{constructor(e,r){let n;e?n=e:n=new St;let i;r?i=r:i=new St,this._stack=[{scope:n}],this._isolationScope=i}withScope(e){let r=this._pushScope(),n;try{n=e(r)}catch(i){throw this._popScope(),i}return rn(n)?n.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Pi(){let t=jn(),e=Gn(t);return e.stack=e.stack||new Hu(Jm(),Qm())}function dE(t){return Pi().withScope(t)}function hE(t,e){let r=Pi();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function Zm(t){return Pi().withScope(()=>t(Pi().getIsolationScope()))}function ed(){return{withIsolationScope:Zm,withScope:dE,withSetScope:hE,withSetIsolationScope:(t,e)=>Zm(e),getCurrentScope:()=>Pi().getScope(),getIsolationScope:()=>Pi().getIsolationScope()}}function _a(t){let e=Gn(t);return e.acs?e.acs:ed()}function br(){let t=jn();return _a(t).getCurrentScope()}function Lr(){let t=jn();return _a(t).getIsolationScope()}function ba(){return en("globalScope",()=>new St)}function Yo(...t){let e=jn(),r=_a(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function Ge(){return br().getClient()}function $u(t){let e=t.getPropagationContext(),{traceId:r,parentSpanId:n,propagationSpanId:i}=e,o={trace_id:r,span_id:i||Ea()};return n&&(o.parent_span_id=n),o}var wa="sentry.source",Vu="sentry.sample_rate",td="sentry.previous_trace_sample_rate",Wu="sentry.op",ju="sentry.origin";var Gu="sentry.profile_id",zu="sentry.exclusive_time";var gE="_sentryScope",yE="_sentryIsolationScope";function Sa(t){return{scope:t[gE],isolationScope:t[yE]}}var vE="sentry-",EE=/^sentry-/;function nd(t){let e=_E(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,o])=>{if(i.match(EE)){let s=i.slice(vE.length);n[s]=o}return n},{});if(Object.keys(r).length>0)return r}function _E(t){if(!(!t||!Lt(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=rd(r);return Object.entries(n).forEach(([i,o])=>{e[i]=o}),e},{}):rd(t)}function rd(t){return t.split(",").map(e=>e.split("=").map(r=>{try{return decodeURIComponent(r.trim())}catch{return}})).reduce((e,[r,n])=>(r&&n&&(e[r]=n),e),{})}function id(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}var cd=1,od=!1;function Yu(t){let{spanId:e,traceId:r,isRemote:n}=t.spanContext(),i=n?e:Li(t).parent_span_id,o=Sa(t).scope,s=n?o?.getPropagationContext().propagationSpanId||Ea():e;return{parent_span_id:i,span_id:s,trace_id:r}}function bE(t){if(t&&t.length>0)return t.map(s=>{var a=s,{context:c}=a,p=c,{spanId:e,traceId:r,traceFlags:n}=p,i=ym(p,["spanId","traceId","traceFlags"]),{attributes:o}=a;return _({span_id:e,trace_id:r,sampled:n===cd,attributes:o},i)})}function sd(t){return typeof t=="number"?ad(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?ad(t.getTime()):Ut()}function ad(t){return t>9999999999?t/1e3:t}function Li(t){if(SE(t))return t.getSpanJSON();let{spanId:e,traceId:r}=t.spanContext();if(wE(t)){let{attributes:n,startTime:i,name:o,endTime:s,status:a,links:c}=t,p="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:r,data:n,description:o,parent_span_id:p,start_timestamp:sd(i),timestamp:sd(s)||void 0,status:IE(a),op:n[Wu],origin:n[ju],links:bE(c)}}return{span_id:e,trace_id:r,start_timestamp:0,data:{}}}function wE(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function SE(t){return typeof t.getSpanJSON=="function"}function ld(t){let{traceFlags:e}=t.spanContext();return e===cd}function IE(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var TE="_sentryRootSpan";function qo(t){return t[TE]||t}function qu(){od||(vn(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),od=!0)}function ud(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||Ge()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}var Mi="production";var xE=/^o(\d+)\./,CE=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function RE(t){return t==="http"||t==="https"}function bn(t,e=!1){let{host:r,path:n,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${r}${o?`:${o}`:""}/${n&&`${n}/`}${s}`}function AE(t){let e=CE.exec(t);if(!e){vn(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",o="",s="",a=""]=e.slice(1),c="",p=a,d=p.split("/");if(d.length>1&&(c=d.slice(0,-1).join("/"),p=d.pop()),p){let f=p.match(/^\d+/);f&&(p=f[0])}return pd({host:o,pass:i,path:c,projectId:p,port:s,protocol:r,publicKey:n})}function pd(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function DE(t){if(!oe)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(s=>t[s]?!1:(ee.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?RE(n)?e&&isNaN(parseInt(e,10))?(ee.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(ee.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(ee.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function fd(t){return t.match(xE)?.[1]}function md(t){let e=typeof t=="string"?AE(t):pd(t);if(!(!e||!DE(e)))return e}var NE="_frozenDsc";function dd(t,e){let r=e.getOptions(),{publicKey:n,host:i}=e.getDsn()||{},o;r.orgId?o=String(r.orgId):i&&(o=fd(i));let s={environment:r.environment||Mi,release:r.release,public_key:n,trace_id:t,org_id:o};return e.emit("createDsc",s),s}function hd(t,e){let r=e.getPropagationContext();return r.dsc||dd(r.traceId,t)}function Ku(t){let e=Ge();if(!e)return{};let r=qo(t),n=Li(r),i=n.data,o=r.spanContext().traceState,s=o?.get("sentry.sample_rate")??i[Vu]??i[td];function a(T){return(typeof s=="number"||typeof s=="string")&&(T.sample_rate=`${s}`),T}let c=r[NE];if(c)return a(c);let p=o?.get("sentry.dsc"),d=p&&nd(p);if(d)return a(d);let f=dd(t.spanContext().traceId,e),E=i[wa],y=n.description;return E!=="url"&&y&&(f.transaction=y),ud()&&(f.sampled=String(ld(r)),f.sample_rand=o?.get("sentry.sample_rand")??Sa(r).scope?.getPropagationContext().sampleRand.toString()),a(f),e.emit("createDsc",f,r),f}function ir(t,e=100,r=1/0){try{return Xu("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function Ia(t,e=3,r=100*1024){let n=ir(t,e);return ME(n)>r?Ia(t,e-1,r):n}function Xu(t,e,r=1/0,n=1/0,i=BE()){let[o,s]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=OE(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:r;if(c===0)return a.replace("object ","");if(o(e))return"[Circular ~]";let p=e;if(p&&typeof p.toJSON=="function")try{let y=p.toJSON();return Xu("",y,c-1,n,i)}catch{}let d=Array.isArray(e)?[]:{},f=0,E=ya(e);for(let y in E){if(!Object.prototype.hasOwnProperty.call(E,y))continue;if(f>=n){d[y]="[MaxProperties ~]";break}let T=E[y];d[y]=Xu(y,T,c-1,n,i),f++}return s(e),d}function OE(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(jo(e))return"[VueViewModel]";if(Ou(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${nr(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=PE(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function PE(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function LE(t){return~-encodeURI(t).split(/%..|./).length}function ME(t){return LE(JSON.stringify(t))}function BE(){let t=new WeakSet;function e(n){return t.has(n)?!0:(t.add(n),!1)}function r(n){t.delete(n)}return[e,r]}function on(t,e=[]){return[t,e]}function gd(t,e){let[r,n]=t;return[r,[...n,e]]}function Qu(t,e){let r=t[1];for(let n of r){let i=n[0].type;if(e(n,i))return!0}return!1}function Ju(t){let e=Gn(me);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function yd(t){let[e,r]=t,n=JSON.stringify(e);function i(o){typeof n=="string"?n=typeof o=="string"?n+o:[Ju(n),o]:n.push(typeof o=="string"?Ju(o):o)}for(let o of r){let[s,a]=o;if(i(`
|
|
28
|
+
Error:`,i)}}var Su=null;function Iu(t){let e="error";Lt(e,t),Mt(e,fE)}function fE(){Su=pe.onerror,pe.onerror=function(t,e,r,n,i){return ut("error",{column:n,error:i,line:r,msg:t,url:e}),Su?Su.apply(this,arguments):!1},pe.onerror.__SENTRY_INSTRUMENTED__=!0}var Tu=null;function xu(t){let e="unhandledrejection";Lt(e,t),Mt(e,mE)}function mE(){Tu=pe.onunhandledrejection,pe.onunhandledrejection=function(t){return ut("unhandledrejection",t),Tu?Tu.apply(this,arguments):!0},pe.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var zm=Object.prototype.toString;function zn(t){switch(zm.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return vr(t,Error)}}function Ri(t,e){return zm.call(t)===`[object ${e}]`}function la(t){return Ri(t,"ErrorEvent")}function ua(t){return Ri(t,"DOMError")}function Cu(t){return Ri(t,"DOMException")}function Bt(t){return Ri(t,"String")}function Ai(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function qn(t){return t===null||Ai(t)||typeof t!="object"&&typeof t!="function"}function tn(t){return Ri(t,"Object")}function Yn(t){return typeof Event<"u"&&vr(t,Event)}function Ru(t){return typeof Element<"u"&&vr(t,Element)}function Au(t){return Ri(t,"RegExp")}function rn(t){return!!(t?.then&&typeof t.then=="function")}function Du(t){return tn(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function vr(t,e){try{return t instanceof e}catch{return!1}}function $o(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function qm(t){return typeof Request<"u"&&vr(t,Request)}var Nu=pe,dE=80;function Vo(t,e={}){if(!t)return"<unknown>";try{let r=t,n=5,i=[],o=0,s=0,a=" > ",c=a.length,p,d=Array.isArray(e)?e:e.keyAttrs,f=!Array.isArray(e)&&e.maxStringLength||dE;for(;r&&o++<n&&(p=hE(r,d),!(p==="html"||o>1&&s+i.length*c+p.length>=f));)i.push(p),s+=p.length,r=r.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function hE(t,e){let r=t,n=[];if(!r?.tagName)return"";if(Nu.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let i=e?.length?e.filter(s=>r.getAttribute(s)).map(s=>[s,r.getAttribute(s)]):null;if(i?.length)i.forEach(s=>{n.push(`[${s[0]}="${s[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let s=r.className;if(s&&Bt(s)){let a=s.split(/\s+/);for(let c of a)n.push(`.${c}`)}}let o=["aria-label","type","name","title","alt"];for(let s of o){let a=r.getAttribute(s);a&&n.push(`[${s}="${a}"]`)}return n.join("")}function Wo(){try{return Nu.document.location.href}catch{return""}}function Ou(t){if(!Nu.HTMLElement)return null;let e=t,r=5;for(let n=0;n<r;n++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function En(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function pa(t,e){if(!Array.isArray(t))return"";let r=[];for(let n=0;n<t.length;n++){let i=t[n];try{$o(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(e)}function Ym(t,e,r=!1){return Bt(t)?Au(e)?e.test(t):Bt(e)?r?t===e:t.includes(e):!1:!1}function Di(t,e=[],r=!1){return e.some(n=>Ym(t,n,r))}function pt(t,e,r){if(!(e in t))return;let n=t[e];if(typeof n!="function")return;let i=r(n);typeof i=="function"&&fa(i,n);try{t[e]=i}catch{oe&&ee.log(`Failed to replace method "${e}" in object`,t)}}function qt(t,e,r){try{Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0})}catch{oe&&ee.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function fa(t,e){try{let r=e.prototype||{};t.prototype=e.prototype=r,qt(t,"__sentry_original__",e)}catch{}}function Kn(t){return t.__sentry_original__}function ma(t){if(zn(t))return _({message:t.message,name:t.name,stack:t.stack},Xm(t));if(Yn(t)){let e=_({type:t.type,target:Km(t.target),currentTarget:Km(t.currentTarget)},Xm(t));return typeof CustomEvent<"u"&&vr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Km(t){try{return Ru(t)?Vo(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Xm(t){if(typeof t=="object"&&t!==null){let e={};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}else return{}}function Pu(t,e=40){let r=Object.keys(ma(t));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=e)return En(n,e);for(let i=r.length;i>0;i--){let o=r.slice(0,i).join(", ");if(!(o.length>e))return i===r.length?o:En(o,e)}return""}function gE(){let t=pe;return t.crypto||t.msCrypto}function ft(t=gE()){let e=()=>Math.random()*16;try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(e=()=>{let r=new Uint8Array(1);return t.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(e()&15)>>r/4).toString(16))}function Jm(t){return t.exception?.values?.[0]}function Ar(t){let{message:e,event_id:r}=t;if(e)return e;let n=Jm(t);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function Ni(t,e,r){let n=t.exception=t.exception||{},i=n.values=n.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type=r||"Error")}function Dr(t,e){let r=Jm(t);if(!r)return;let n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism=_(_(_({},n),i),e),e&&"data"in e){let o=_(_({},i?.data),e.data);r.mechanism.data=o}}function da(t){if(yE(t))return!0;try{qt(t,"__sentry_captured__",!0)}catch{}return!1}function yE(t){try{return t.__sentry_captured__}catch{}}var Zm=1e3;function Nr(){return Date.now()/Zm}function vE(){let{performance:t}=pe;if(!t?.now||!t.timeOrigin)return Nr;let e=t.timeOrigin;return()=>(e+t.now())/Zm}var Qm;function Ht(){return(Qm??(Qm=vE()))()}function ed(t){let e=Ht(),r={sid:ft(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>EE(r)};return t&&nn(r,t),r}function nn(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Ht(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:ft()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let r=t.timestamp-t.started;t.duration=r>=0?r:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function td(t,e){let r={};e?r={status:e}:t.status==="ok"&&(r={status:"exited"}),nn(t,r)}function EE(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function _n(t,e,r=2){if(!e||typeof e!="object"||r<=0)return e;if(t&&Object.keys(e).length===0)return t;let n=_({},t);for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=_n(n[i],e[i],r-1));return n}function Lu(){return ft()}function ha(){return ft().substring(16)}var Mu="_sentrySpan";function Bu(t,e){e?qt(t,Mu,e):delete t[Mu]}function ku(t){return t[Mu]}var _E=100,It=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Lu(),sampleRand:Math.random()}}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags=_({},this._tags),e._extra=_({},this._extra),e._contexts=_({},this._contexts),this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata=_({},this._sdkProcessingMetadata),e._propagationContext=_({},this._propagationContext),e._client=this._client,e._lastEventId=this._lastEventId,Bu(e,ku(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&nn(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags=_(_({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,r){return this._tags=Z(_({},this._tags),{[e]:r}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=_(_({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,r){return this._extra=Z(_({},this._extra),{[e]:r}),this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,r){return r===null?delete this._contexts[e]:this._contexts[e]=r,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let r=typeof e=="function"?e(this):e,n=r instanceof t?r.getScopeData():tn(r)?e:void 0,{tags:i,extra:o,user:s,contexts:a,level:c,fingerprint:p=[],propagationContext:d}=n||{};return this._tags=_(_({},this._tags),i),this._extra=_(_({},this._extra),o),this._contexts=_(_({},this._contexts),a),s&&Object.keys(s).length&&(this._user=s),c&&(this._level=c),p.length&&(this._fingerprint=p),d&&(this._propagationContext=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,Bu(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Lu(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,r){let n=typeof r=="number"?r:_E;if(n<=0)return this;let i=Z(_({timestamp:Nr()},e),{message:e.message?En(e.message,2048):e.message});return this._breadcrumbs.push(i),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:ku(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=_n(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,r){let n=r?.event_id||ft();if(!this._client)return oe&&ee.warn("No client configured on scope - will not capture exception!"),n;let i=new Error("Sentry syntheticException");return this._client.captureException(e,Z(_({originalException:e,syntheticException:i},r),{event_id:n}),this),n}captureMessage(e,r,n){let i=n?.event_id||ft();if(!this._client)return oe&&ee.warn("No client configured on scope - will not capture message!"),i;let o=new Error(e);return this._client.captureMessage(e,r,Z(_({originalException:e,syntheticException:o},n),{event_id:i}),this),i}captureEvent(e,r){let n=r?.event_id||ft();return this._client?(this._client.captureEvent(e,Z(_({},r),{event_id:n}),this),n):(oe&&ee.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}};function rd(){return en("defaultCurrentScope",()=>new It)}function nd(){return en("defaultIsolationScope",()=>new It)}var Uu=class{constructor(e,r){let n;e?n=e:n=new It;let i;r?i=r:i=new It,this._stack=[{scope:n}],this._isolationScope=i}withScope(e){let r=this._pushScope(),n;try{n=e(r)}catch(i){throw this._popScope(),i}return rn(n)?n.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Oi(){let t=jn(),e=Gn(t);return e.stack=e.stack||new Uu(rd(),nd())}function bE(t){return Oi().withScope(t)}function wE(t,e){let r=Oi();return r.withScope(()=>(r.getStackTop().scope=t,e(t)))}function id(t){return Oi().withScope(()=>t(Oi().getIsolationScope()))}function od(){return{withIsolationScope:id,withScope:bE,withSetScope:wE,withSetIsolationScope:(t,e)=>id(e),getCurrentScope:()=>Oi().getScope(),getIsolationScope:()=>Oi().getIsolationScope()}}function ga(t){let e=Gn(t);return e.acs?e.acs:od()}function Er(){let t=jn();return ga(t).getCurrentScope()}function Or(){let t=jn();return ga(t).getIsolationScope()}function ya(){return en("globalScope",()=>new It)}function jo(...t){let e=jn(),r=ga(e);if(t.length===2){let[n,i]=t;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(t[0])}function Ge(){return Er().getClient()}function Fu(t){let e=t.getPropagationContext(),{traceId:r,parentSpanId:n,propagationSpanId:i}=e,o={trace_id:r,span_id:i||ha()};return n&&(o.parent_span_id=n),o}var va="sentry.source",Hu="sentry.sample_rate",sd="sentry.previous_trace_sample_rate",$u="sentry.op",Vu="sentry.origin";var Wu="sentry.profile_id",ju="sentry.exclusive_time";var SE="_sentryScope",IE="_sentryIsolationScope";function Ea(t){return{scope:t[SE],isolationScope:t[IE]}}var TE="sentry-",xE=/^sentry-/;function cd(t){let e=CE(t);if(!e)return;let r=Object.entries(e).reduce((n,[i,o])=>{if(i.match(xE)){let s=i.slice(TE.length);n[s]=o}return n},{});if(Object.keys(r).length>0)return r}function CE(t){if(!(!t||!Bt(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,r)=>{let n=ad(r);return Object.entries(n).forEach(([i,o])=>{e[i]=o}),e},{}):ad(t)}function ad(t){return t.split(",").map(e=>e.split("=").map(r=>{try{return decodeURIComponent(r.trim())}catch{return}})).reduce((e,[r,n])=>(r&&n&&(e[r]=n),e),{})}function ld(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}var md=1,ud=!1;function Gu(t){let{spanId:e,traceId:r,isRemote:n}=t.spanContext(),i=n?e:Pi(t).parent_span_id,o=Ea(t).scope,s=n?o?.getPropagationContext().propagationSpanId||ha():e;return{parent_span_id:i,span_id:s,trace_id:r}}function RE(t){if(t&&t.length>0)return t.map(s=>{var a=s,{context:c}=a,p=c,{spanId:e,traceId:r,traceFlags:n}=p,i=wm(p,["spanId","traceId","traceFlags"]),{attributes:o}=a;return _({span_id:e,trace_id:r,sampled:n===md,attributes:o},i)})}function pd(t){return typeof t=="number"?fd(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?fd(t.getTime()):Ht()}function fd(t){return t>9999999999?t/1e3:t}function Pi(t){if(DE(t))return t.getSpanJSON();let{spanId:e,traceId:r}=t.spanContext();if(AE(t)){let{attributes:n,startTime:i,name:o,endTime:s,status:a,links:c}=t,p="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0;return{span_id:e,trace_id:r,data:n,description:o,parent_span_id:p,start_timestamp:pd(i),timestamp:pd(s)||void 0,status:NE(a),op:n[$u],origin:n[Vu],links:RE(c)}}return{span_id:e,trace_id:r,start_timestamp:0,data:{}}}function AE(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function DE(t){return typeof t.getSpanJSON=="function"}function dd(t){let{traceFlags:e}=t.spanContext();return e===md}function NE(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var OE="_sentryRootSpan";function Go(t){return t[OE]||t}function zu(){ud||(vn(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),ud=!0)}function hd(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let e=t||Ge()?.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}var Li="production";var PE=/^o(\d+)\./,LE=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function ME(t){return t==="http"||t==="https"}function bn(t,e=!1){let{host:r,path:n,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${r}${o?`:${o}`:""}/${n&&`${n}/`}${s}`}function BE(t){let e=LE.exec(t);if(!e){vn(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[r,n,i="",o="",s="",a=""]=e.slice(1),c="",p=a,d=p.split("/");if(d.length>1&&(c=d.slice(0,-1).join("/"),p=d.pop()),p){let f=p.match(/^\d+/);f&&(p=f[0])}return gd({host:o,pass:i,path:c,projectId:p,port:s,protocol:r,publicKey:n})}function gd(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function kE(t){if(!oe)return!0;let{port:e,projectId:r,protocol:n}=t;return["protocol","publicKey","host","projectId"].find(s=>t[s]?!1:(ee.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?ME(n)?e&&isNaN(parseInt(e,10))?(ee.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(ee.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(ee.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function yd(t){return t.match(PE)?.[1]}function vd(t){let e=typeof t=="string"?BE(t):gd(t);if(!(!e||!kE(e)))return e}var UE="_frozenDsc";function Ed(t,e){let r=e.getOptions(),{publicKey:n,host:i}=e.getDsn()||{},o;r.orgId?o=String(r.orgId):i&&(o=yd(i));let s={environment:r.environment||Li,release:r.release,public_key:n,trace_id:t,org_id:o};return e.emit("createDsc",s),s}function _d(t,e){let r=e.getPropagationContext();return r.dsc||Ed(r.traceId,t)}function qu(t){let e=Ge();if(!e)return{};let r=Go(t),n=Pi(r),i=n.data,o=r.spanContext().traceState,s=o?.get("sentry.sample_rate")??i[Hu]??i[sd];function a(T){return(typeof s=="number"||typeof s=="string")&&(T.sample_rate=`${s}`),T}let c=r[UE];if(c)return a(c);let p=o?.get("sentry.dsc"),d=p&&cd(p);if(d)return a(d);let f=Ed(t.spanContext().traceId,e),E=i[va],y=n.description;return E!=="url"&&y&&(f.transaction=y),hd()&&(f.sampled=String(dd(r)),f.sample_rand=o?.get("sentry.sample_rand")??Ea(r).scope?.getPropagationContext().sampleRand.toString()),a(f),e.emit("createDsc",f,r),f}function ir(t,e=100,r=1/0){try{return Yu("",t,e,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function _a(t,e=3,r=100*1024){let n=ir(t,e);return VE(n)>r?_a(t,e-1,r):n}function Yu(t,e,r=1/0,n=1/0,i=WE()){let[o,s]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;let a=FE(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:r;if(c===0)return a.replace("object ","");if(o(e))return"[Circular ~]";let p=e;if(p&&typeof p.toJSON=="function")try{let y=p.toJSON();return Yu("",y,c-1,n,i)}catch{}let d=Array.isArray(e)?[]:{},f=0,E=ma(e);for(let y in E){if(!Object.prototype.hasOwnProperty.call(E,y))continue;if(f>=n){d[y]="[MaxProperties ~]";break}let T=E[y];d[y]=Yu(y,T,c-1,n,i),f++}return s(e),d}function FE(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if($o(e))return"[VueViewModel]";if(Du(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${nr(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let r=HE(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function HE(t){let e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}function $E(t){return~-encodeURI(t).split(/%..|./).length}function VE(t){return $E(JSON.stringify(t))}function WE(){let t=new WeakSet;function e(n){return t.has(n)?!0:(t.add(n),!1)}function r(n){t.delete(n)}return[e,r]}function on(t,e=[]){return[t,e]}function bd(t,e){let[r,n]=t;return[r,[...n,e]]}function Xu(t,e){let r=t[1];for(let n of r){let i=n[0].type;if(e(n,i))return!0}return!1}function Ku(t){let e=Gn(pe);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function wd(t){let[e,r]=t,n=JSON.stringify(e);function i(o){typeof n=="string"?n=typeof o=="string"?n+o:[Ku(n),o]:n.push(typeof o=="string"?Ku(o):o)}for(let o of r){let[s,a]=o;if(i(`
|
|
29
29
|
${JSON.stringify(s)}
|
|
30
|
-
`),typeof a=="string"||a instanceof Uint8Array)i(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(ir(a))}i(c)}}return typeof n=="string"?n:kE(n)}function kE(t){let e=t.reduce((i,o)=>i+o.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function vd(t){let e=typeof t.data=="string"?Ju(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var UE={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Zu(t){return UE[t]}function ep(t){if(!t?.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function Ed(t,e,r,n){let i=t.sdkProcessingMetadata?.dynamicSamplingContext;return _(_(_({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:bn(n)}),i&&{trace:i})}function FE(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function _d(t,e,r,n){let i=ep(r),o=_(_({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:bn(e)}),s="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return on(o,[s])}function bd(t,e,r,n){let i=ep(r),o=t.type&&t.type!=="replay_event"?t.type:"event";FE(t,r?.sdk);let s=Ed(t,i,n,e);return delete t.sdkProcessingMetadata,on(s,[[{type:o},t]])}var tp=0,wd=1,Sd=2;function or(t){return new wr(e=>{e(t)})}function wn(t){return new wr((e,r)=>{r(t)})}var wr=class t{constructor(e){this._state=tp,this._handlers=[],this._runExecutor(e)}then(e,r){return new t((n,i)=>{this._handlers.push([!1,o=>{if(!e)n(o);else try{n(e(o))}catch(s){i(s)}},o=>{if(!r)i(o);else try{n(r(o))}catch(s){i(s)}}]),this._executeHandlers()})}catch(e){return this.then(r=>r,e)}finally(e){return new t((r,n)=>{let i,o;return this.then(s=>{o=!1,i=s,e&&e()},s=>{o=!0,i=s,e&&e()}).then(()=>{if(o){n(i);return}r(i)})})}_executeHandlers(){if(this._state===tp)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===wd&&r[1](this._value),this._state===Sd&&r[2](this._value),r[0]=!0)})}_runExecutor(e){let r=(o,s)=>{if(this._state===tp){if(rn(s)){s.then(n,i);return}this._state=o,this._value=s,this._executeHandlers()}},n=o=>{r(wd,o)},i=o=>{r(Sd,o)};try{e(n,i)}catch(o){i(o)}}};function Ta(t,e,r,n=0){return new wr((i,o)=>{let s=t[n];if(e===null||typeof s!="function")i(e);else{let a=s(_({},e),r);oe&&s.id&&a===null&&ee.log(`Event processor "${s.id}" dropped event`),rn(a)?a.then(c=>Ta(t,c,r,n+1).then(i)).then(null,o):Ta(t,a,r,n+1).then(i).then(null,o)}})}function Id(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:o}=e;HE(t,e),n&&WE(t,n),jE(t,r),$E(t,i),VE(t,o)}function rp(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:p,eventProcessors:d,attachments:f,propagationContext:E,transactionName:y,span:T}=e;xa(t,"extra",r),xa(t,"tags",n),xa(t,"user",i),xa(t,"contexts",o),t.sdkProcessingMetadata=_n(t.sdkProcessingMetadata,a,2),s&&(t.level=s),y&&(t.transactionName=y),T&&(t.span=T),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext=_(_({},t.propagationContext),E)}function xa(t,e,r){t[e]=_n(t[e],r,1)}function HE(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,transactionName:a}=e;Object.keys(r).length&&(t.extra=_(_({},r),t.extra)),Object.keys(n).length&&(t.tags=_(_({},n),t.tags)),Object.keys(i).length&&(t.user=_(_({},i),t.user)),Object.keys(o).length&&(t.contexts=_(_({},o),t.contexts)),s&&(t.level=s),a&&t.type!=="transaction"&&(t.transaction=a)}function $E(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function VE(t,e){t.sdkProcessingMetadata=_(_({},t.sdkProcessingMetadata),e)}function WE(t,e){t.contexts=_({trace:Yu(e)},t.contexts),t.sdkProcessingMetadata=_({dynamicSamplingContext:Ku(e)},t.sdkProcessingMetadata);let r=qo(e),n=Li(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function jE(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}var Ca,Td,Ra;function xd(t){let e=me._sentryDebugIds;if(!e)return{};let r=Object.keys(e);return Ra&&r.length===Td||(Td=r.length,Ra=r.reduce((n,i)=>{Ca||(Ca={});let o=Ca[i];if(o)n[o[0]]=o[1];else{let s=t(i);for(let a=s.length-1;a>=0;a--){let p=s[a]?.filename,d=e[i];if(p&&d){n[p]=d,Ca[i]=[p,d];break}}}return n},{})),Ra}function Cd(t,e,r,n,i,o){let{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,c=Z(_({},e),{event_id:e.event_id||r.event_id||mt(),timestamp:e.timestamp||Pr()}),p=r.integrations||t.integrations.map(N=>N.name);GE(c,t),qE(c,p),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&zE(c,t.stackParser);let d=XE(n,r.captureContext);r.mechanism&&Or(c,r.mechanism);let f=i?i.getEventProcessors():[],E=ba().getScopeData();if(o){let N=o.getScopeData();rp(E,N)}if(d){let N=d.getScopeData();rp(E,N)}let y=[...r.attachments||[],...E.attachments];y.length&&(r.attachments=y),Id(c,E);let T=[...f,...E.eventProcessors];return Ta(T,c,r).then(N=>(N&&YE(N),typeof s=="number"&&s>0?KE(N,s,a):N))}function GE(t,e){let{environment:r,release:n,dist:i,maxValueLength:o=250}=e;t.environment=t.environment||r||Mi,!t.release&&n&&(t.release=n),!t.dist&&i&&(t.dist=i);let s=t.request;s?.url&&(s.url=En(s.url,o))}function zE(t,e){let r=xd(e);t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=r[i.filename])})})}function YE(t){let e={};if(t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let r=t.debug_meta.images;Object.entries(e).forEach(([n,i])=>{r.push({type:"sourcemap",code_file:n,debug_id:i})})}function qE(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function KE(t,e,r){if(!t)return null;let n=_(_(_(_(_({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>_(_({},i),i.data&&{data:ir(i.data,e,r)}))}),t.user&&{user:ir(t.user,e,r)}),t.contexts&&{contexts:ir(t.contexts,e,r)}),t.extra&&{extra:ir(t.extra,e,r)});return t.contexts?.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=ir(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>_(_({},i),i.data&&{data:ir(i.data,e,r)}))),t.contexts?.flags&&n.contexts&&(n.contexts.flags=ir(t.contexts.flags,3,r)),n}function XE(t,e){if(!e)return t;let r=t?t.clone():new St;return r.update(e),r}function Rd(t){if(t)return JE(t)?{captureContext:t}:ZE(t)?{captureContext:t}:t}function JE(t){return t instanceof St||typeof t=="function"}var QE=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function ZE(t){return Object.keys(t).some(e=>QE.includes(e))}function Aa(t,e){return br().captureException(t,Rd(e))}function Da(t,e){let r=typeof e=="string"?e:void 0,n=typeof e!="string"?{captureContext:e}:void 0;return br().captureMessage(t,r,n)}function Ko(t,e){return br().captureEvent(t,e)}function Xo(t){let e=Lr(),r=br(),{userAgent:n}=me.navigator||{},i=Km(_(_({user:r.getUser()||e.getUser()},n&&{userAgent:n}),t)),o=e.getSession();return o?.status==="ok"&&nn(o,{status:"exited"}),Na(),e.setSession(i),i}function Na(){let t=Lr(),r=br().getSession()||t.getSession();r&&Xm(r),Dd(),t.setSession()}function Dd(){let t=Lr(),e=Ge(),r=t.getSession();r&&e&&e.captureSession(r)}function Jo(t=!1){if(t){Na();return}Dd()}var e_="7";function t_(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function r_(t){return`${t_(t)}${t.projectId}/envelope/`}function n_(t,e){let r={sentry_version:e_};return t.publicKey&&(r.sentry_key=t.publicKey),e&&(r.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(r).toString()}function Nd(t,e,r){return e||`${r_(t)}?${n_(t,r)}`}var Od=[];function Pd(t,e){let r={};return e.forEach(n=>{n&&ip(t,n,r)}),r}function np(t,e){for(let r of e)r?.afterAllSetup&&r.afterAllSetup(t)}function ip(t,e,r){if(r[e.name]){oe&&ee.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,Od.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),Od.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,o)=>n(i,o,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((o,s)=>n(o,s,t),{id:e.name});t.addEventProcessor(i)}oe&&ee.log(`Integration installed: ${e.name}`)}function Ld(t,e,r){let n=[{type:"client_report"},{timestamp:r||Pr(),discarded_events:t}];return on(e?{dsn:e}:{},[n])}function Oa(t){let e=[];t.message&&e.push(t.message);try{let r=t.exception.values[t.exception.values.length-1];r?.value&&(e.push(r.value),r.type&&e.push(`${r.type}: ${r.value}`))}catch{}return e}function Md(t){let{trace_id:e,parent_span_id:r,span_id:n,status:i,origin:o,data:s,op:a}=t.contexts?.trace??{};return{data:s??{},description:t.transaction,op:a,parent_span_id:r,span_id:n??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:o,profile_id:s?.[Gu],exclusive_time:s?.[zu],measurements:t.measurements,is_segment:!0}}function Bd(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:_(_(_({},t.data),t.profile_id&&{[Gu]:t.profile_id}),t.exclusive_time&&{[zu]:t.exclusive_time})}},measurements:t.measurements}}var kd="Not capturing exception because it's already been captured.",Ud="Discarded session because of missing or non-string release",$d=Symbol.for("SentryInternalError"),Vd=Symbol.for("SentryDoNotSendEventError");function Pa(t){return{message:t,[$d]:!0}}function op(t){return{message:t,[Vd]:!0}}function Fd(t){return!!t&&typeof t=="object"&&$d in t}function Hd(t){return!!t&&typeof t=="object"&&Vd in t}var Qo=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=md(e.dsn):oe&&ee.warn("No DSN provided, client will not send events."),this._dsn){let r=Nd(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport(Z(_({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:r}))}}captureException(e,r,n){let i=mt();if(va(e))return oe&&ee.log(kd),i;let o=_({event_id:i},r);return this._process(this.eventFromException(e,o).then(s=>this._captureEvent(s,o,n))),o.event_id}captureMessage(e,r,n,i){let o=_({event_id:mt()},n),s=Di(e)?e:String(e),a=Yn(e)?this.eventFromMessage(s,r,o):this.eventFromException(e,o);return this._process(a.then(c=>this._captureEvent(c,o,i))),o.event_id}captureEvent(e,r,n){let i=mt();if(r?.originalException&&va(r.originalException))return oe&&ee.log(kd),i;let o=_({event_id:i},r),s=e.sdkProcessingMetadata||{},a=s.capturedSpanScope,c=s.capturedSpanIsolationScope;return this._process(this._captureEvent(e,o,a||n,c)),o.event_id}captureSession(e){this.sendSession(e),nn(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){let r=this._transport;return r?(this.emit("flush"),this._isClientDoneProcessing(e).then(n=>r.flush(e).then(i=>n&&i))):or(!0)}close(e){return this.flush(e).then(r=>(this.getOptions().enabled=!1,this.emit("close"),r))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let r=this._integrations[e.name];ip(this,e,this._integrations),r||np(this,[e])}sendEvent(e,r={}){this.emit("beforeSendEvent",e,r);let n=bd(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of r.attachments||[])n=gd(n,vd(o));let i=this.sendEnvelope(n);i&&i.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){let{release:r,environment:n=Mi}=this._options;if("aggregates"in e){let o=e.attrs||{};if(!o.release&&!r){oe&&ee.warn(Ud);return}o.release=o.release||r,o.environment=o.environment||n,e.attrs=o}else{if(!e.release&&!r){oe&&ee.warn(Ud);return}e.release=e.release||r,e.environment=e.environment||n}this.emit("beforeSendSession",e);let i=_d(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(e,r,n=1){if(this._options.sendClientReports){let i=`${e}:${r}`;oe&&ee.log(`Recording outcome: "${i}"${n>1?` (${n} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+n}}on(e,r){let n=this._hooks[e]=this._hooks[e]||[];return n.push(r),()=>{let i=n.indexOf(r);i>-1&&n.splice(i,1)}}emit(e,...r){let n=this._hooks[e];n&&n.forEach(i=>i(...r))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,r=>(oe&&ee.error("Error while sending envelope:",r),r)):(oe&&ee.error("Transport disabled"),or({}))}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Pd(this,e),np(this,e)}_updateSessionFromEvent(e,r){let n=r.level==="fatal",i=!1,o=r.exception?.values;if(o){i=!0;for(let c of o)if(c.mechanism?.handled===!1){n=!0;break}}let s=e.status==="ok";(s&&e.errors===0||s&&n)&&(nn(e,Z(_({},n&&{status:"crashed"}),{errors:e.errors||Number(i||n)})),this.captureSession(e))}_isClientDoneProcessing(e){return new wr(r=>{let n=0,i=1,o=setInterval(()=>{this._numProcessing==0?(clearInterval(o),r(!0)):(n+=i,e&&n>=e&&(clearInterval(o),r(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,r,n,i){let o=this.getOptions(),s=Object.keys(this._integrations);return!r.integrations&&s?.length&&(r.integrations=s),this.emit("preprocessEvent",e,r),e.type||i.setLastEventId(e.event_id||r.event_id),Cd(o,e,r,n,this,i).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,r),a.contexts=_({trace:$u(n)},a.contexts);let c=hd(this,n);return a.sdkProcessingMetadata=_({dynamicSamplingContext:c},a.sdkProcessingMetadata),a})}_captureEvent(e,r={},n=br(),i=Lr()){return oe&&sp(e)&&ee.log(`Captured error event \`${Oa(e)[0]||"<unknown>"}\``),this._processEvent(e,r,n,i).then(o=>o.event_id,o=>{oe&&(Hd(o)?ee.log(o.message):Fd(o)?ee.warn(o.message):ee.warn(o))})}_processEvent(e,r,n,i){let o=this.getOptions(),{sampleRate:s}=o,a=Wd(e),c=sp(e),p=e.type||"error",d=`before send for type \`${p}\``,f=typeof s>"u"?void 0:id(s);if(c&&typeof f=="number"&&Math.random()>f)return this.recordDroppedEvent("sample_rate","error"),wn(op(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));let E=p==="replay_event"?"replay":p;return this._prepareEvent(e,r,n,i).then(y=>{if(y===null)throw this.recordDroppedEvent("event_processor",E),op("An event processor returned `null`, will not send event.");if(r.data&&r.data.__sentry__===!0)return y;let D=s_(this,o,y,r);return o_(D,d)}).then(y=>{if(y===null){if(this.recordDroppedEvent("before_send",E),a){let k=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",k)}throw op(`${d} returned \`null\`, will not send event.`)}let T=n.getSession()||i.getSession();if(c&&T&&this._updateSessionFromEvent(T,y),a){let N=y.sdkProcessingMetadata?.spanCountBeforeProcessing||0,k=y.spans?y.spans.length:0,G=N-k;G>0&&this.recordDroppedEvent("before_send","span",G)}let D=y.transaction_info;if(a&&D&&y.transaction!==e.transaction){let N="custom";y.transaction_info=Z(_({},D),{source:N})}return this.sendEvent(y,r),y}).then(null,y=>{throw Hd(y)||Fd(y)?y:(this.captureException(y,{data:{__sentry__:!0},originalException:y}),Pa(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
31
|
-
Reason: ${y}`))})}_process(e){this._numProcessing++,e.then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([r,n])=>{let[i,o]=r.split(":");return{reason:i,category:o,quantity:n}})}_flushOutcomes(){oe&&ee.log("Flushing outcomes...");let e=this._clearOutcomes();if(e.length===0){oe&&ee.log("No outcomes to send");return}if(!this._dsn){oe&&ee.log("No dsn provided, will not send outcomes");return}oe&&ee.log("Sending outcomes:",e);let r=
|
|
32
|
-
Event: ${
|
|
33
|
-
Event: ${
|
|
34
|
-
Event: ${
|
|
35
|
-
Event: ${
|
|
36
|
-
Url: ${
|
|
37
|
-
Event: ${
|
|
38
|
-
Url: ${Ba(t)}`),!0}return!1}function v_(t,e){return e?.length?Oa(t).some(r=>Ni(r,e)):!1}function E_(t,e){if(!e?.length)return!1;let r=t.transaction;return r?Ni(r,e):!1}function __(t,e){if(!e?.length)return!1;let r=Ba(t);return r?Ni(r,e):!1}function b_(t,e){if(!e?.length)return!0;let r=Ba(t);return r?Ni(r,e):!0}function w_(t=[]){for(let e=t.length-1;e>=0;e--){let r=t[e];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function Ba(t){try{let r=[...t.exception?.values??[]].reverse().find(n=>n.mechanism?.parent_id===void 0&&n.stacktrace?.frames?.length)?.stacktrace?.frames;return r?w_(r):null}catch{return oe&&ee.error(`Cannot extract url for event ${Nr(t)}`),null}}function S_(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function mp(t,e,r,n,i,o){if(!i.exception?.values||!o||!_r(o.originalException,Error))return;let s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=fp(t,e,n,o.originalException,r,i.exception.values,s,0))}function fp(t,e,r,n,i,o,s,a){if(o.length>=r+1)return o;let c=[...o];if(_r(n[i],Error)){Qd(s,a);let p=t(e,n[i]),d=c.length;Zd(p,i,d,a),c=fp(t,e,r,n[i],i,[p,...c],p,d)}return Array.isArray(n.errors)&&n.errors.forEach((p,d)=>{if(_r(p,Error)){Qd(s,a);let f=t(e,p),E=c.length;Zd(f,`errors[${d}]`,E,a),c=fp(t,e,r,p,i,[f,...c],f,E)}}),c}function Qd(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(_(_({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function Zd(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(_({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function dp(t){let e="console";Ot(e,t),Pt(e,I_)}function I_(){"console"in me&&_u.forEach(function(t){t in me.console&&ft(me.console,t,function(e){return Ri[t]=e,function(...r){pt("console",{args:r,level:t}),Ri[t]?.apply(me.console,r)}})})}function hp(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var T_="Dedupe",x_=()=>{let t;return{name:T_,processEvent(e){if(e.type)return e;try{if(C_(e,t))return oe&&ee.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},Ua=x_;function C_(t,e){return e?!!(R_(t,e)||A_(t,e)):!1}function R_(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!rh(t,e)||!th(t,e))}function A_(t,e){let r=eh(e),n=eh(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!rh(t,e)||!th(t,e))}function th(t,e){let r=pa(t),n=pa(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let i=0;i<n.length;i++){let o=n[i],s=r[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function rh(t,e){let r=t.fingerprint,n=e.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;r=r,n=n;try{return r.join("")===n.join("")}catch{return!1}}function eh(t){return t.exception?.values?.[0]}function es(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let r=e[6]||"",n=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:r,hash:n,relative:e[5]+r+n}}function Fa(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}var ts=me;function gp(){return"history"in ts&&!!ts.history}function D_(){if(!("fetch"in ts))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function rs(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function yp(){if(typeof EdgeRuntime=="string")return!0;if(!D_())return!1;if(rs(ts.fetch))return!0;let t=!1,e=ts.document;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),r.contentWindow?.fetch&&(t=rs(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){oe&&ee.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function Ep(t,e){let r="fetch";Ot(r,t),Pt(r,()=>N_(void 0,e))}function N_(t,e=!1){e&&!yp()||ft(me,"fetch",function(r){return function(...n){let i=new Error,{method:o,url:s}=O_(n),a={args:n,fetchData:{method:o,url:s},startTimestamp:Ut()*1e3,virtualError:i,headers:P_(n)};return t||pt("fetch",_({},a)),r.apply(me,n).then(async c=>(t?t(c):pt("fetch",Z(_({},a),{endTimestamp:Ut()*1e3,response:c})),c),c=>{if(pt("fetch",Z(_({},a),{endTimestamp:Ut()*1e3,error:c})),zn(c)&&c.stack===void 0&&(c.stack=i.stack,qt(c,"framesToPop",1)),c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{let p=new URL(a.fetchData.url);c.message=`${c.message} (${p.host})`}catch{}throw c})}})}function vp(t,e){return!!t&&typeof t=="object"&&!!t[e]}function nh(t){return typeof t=="string"?t:t?vp(t,"url")?t.url:t.toString?t.toString():"":""}function O_(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:nh(r),method:vp(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:nh(e),method:vp(e,"method")?String(e.method).toUpperCase():"GET"}}function P_(t){let[e,r]=t;try{if(typeof r=="object"&&r!==null&&"headers"in r&&r.headers)return new Headers(r.headers);if(Vm(e))return new Headers(e.headers)}catch{}}function _p(){return"npm"}var Qe=me,bp=0;function wp(){return bp>0}function Y_(){bp++,setTimeout(()=>{bp--})}function Xn(t,e={}){function r(i){return typeof i=="function"}if(!r(t))return t;try{let i=t.__sentry_wrapped__;if(i)return typeof i=="function"?i:t;if(Kn(t))return t}catch{return t}let n=function(...i){try{let o=i.map(s=>Xn(s,e));return t.apply(this,o)}catch(o){throw Y_(),Yo(s=>{s.addEventProcessor(a=>(e.mechanism&&(Oi(a,void 0,void 0),Or(a,e.mechanism)),a.extra=Z(_({},a.extra),{arguments:i}),a)),Aa(o)}),o}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}ga(n,t),qt(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}function ih(){let t=zo(),{referrer:e}=Qe.document||{},{userAgent:r}=Qe.navigator||{},n=_(_({},e&&{Referer:e}),r&&{"User-Agent":r});return{url:t,headers:n}}function Ha(t,e){let r=Tp(t,e),n={type:Q_(e),value:Z_(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function q_(t,e,r,n){let o=Ge()?.getOptions().normalizeDepth,s=rb(e),a={__serialized__:Ia(e,o)};if(s)return{exception:{values:[Ha(t,s)]},extra:a};let c={exception:{values:[{type:qn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:eb(e,{isUnhandledRejection:n})}]},extra:a};if(r){let p=Tp(t,r);p.length&&(c.exception.values[0].stacktrace={frames:p})}return c}function Sp(t,e){return{exception:{values:[Ha(t,e)]}}}function Tp(t,e){let r=e.stacktrace||e.stack||"",n=X_(e),i=J_(e);try{return t(r,n,i)}catch{}return[]}var K_=/Minified React error #\d+;/i;function X_(t){return t&&K_.test(t.message)?1:0}function J_(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function oh(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function Q_(t){let e=t?.name;return!e&&oh(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function Z_(t){let e=t?.message;return oh(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function sh(t,e,r,n){let i=r?.syntheticException||void 0,o=$a(t,e,i,n);return Or(o),o.level="error",r?.event_id&&(o.event_id=r.event_id),or(o)}function ah(t,e,r="info",n,i){let o=n?.syntheticException||void 0,s=Ip(t,e,o,i);return s.level=r,n?.event_id&&(s.event_id=n.event_id),or(s)}function $a(t,e,r,n,i){let o;if(ma(e)&&e.error)return Sp(t,e.error);if(da(e)||Au(e)){let s=e;if("stack"in e)o=Sp(t,e);else{let a=s.name||(da(s)?"DOMError":"DOMException"),c=s.message?`${a}: ${s.message}`:a;o=Ip(t,c,r,n),Oi(o,c)}return"code"in s&&(o.tags=Z(_({},o.tags),{"DOMException.code":`${s.code}`})),o}return zn(e)?Sp(t,e):tn(e)||qn(e)?(o=q_(t,e,r,i),Or(o,{synthetic:!0}),o):(o=Ip(t,e,r,n),Oi(o,`${e}`,void 0),Or(o,{synthetic:!0}),o)}function Ip(t,e,r,n){let i={};if(n&&r){let o=Tp(t,r);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]}),Or(i,{synthetic:!0})}if(Di(e)){let{__sentry_template_string__:o,__sentry_template_values__:s}=e;return i.logentry={message:o,params:s},i}return i.message=e,i}function eb(t,{isUnhandledRejection:e}){let r=Mu(t),n=e?"promise rejection":"exception";return ma(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:qn(t)?`Event \`${tb(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function tb(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function rb(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}var nb=5e3,ns=class extends Qo{constructor(e){let r=ib(e),n=Qe.SENTRY_SDK_SOURCE||_p();up(r,"browser",["browser"],n),super(r);let{sendDefaultPii:i,sendClientReports:o,enableLogs:s,_experiments:a}=this._options,c=s??a?.enableLogs;Qe.document&&(o||c)&&Qe.document.addEventListener("visibilitychange",()=>{Qe.document.visibilityState==="hidden"&&(o&&this._flushOutcomes(),c&&Zo(this))}),c&&(this.on("flush",()=>{Zo(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{Zo(this)},nb)})),i&&(this.on("postprocessEvent",cp),this.on("beforeSendSession",lp))}eventFromException(e,r){return sh(this._options.stackParser,e,r,this._options.attachStacktrace)}eventFromMessage(e,r="info",n){return ah(this._options.stackParser,e,r,n,this._options.attachStacktrace)}_prepareEvent(e,r,n,i){return e.platform=e.platform||"javascript",super._prepareEvent(e,r,n,i)}};function ib(t){return _({release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Qe.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0},t)}var ch=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var dt=me;var ob=1e3,lh,xp,Cp;function Rp(t){Ot("dom",t),Pt("dom",sb)}function sb(){if(!dt.document)return;let t=pt.bind(null,"dom"),e=uh(t,!0);dt.document.addEventListener("click",e,!1),dt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let i=dt[r]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(ft(i,"addEventListener",function(o){return function(s,a,c){if(s==="click"||s=="keypress")try{let p=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},d=p[s]=p[s]||{refCount:0};if(!d.handler){let f=uh(t);d.handler=f,o.call(this,s,f,c)}d.refCount++}catch{}return o.call(this,s,a,c)}}),ft(i,"removeEventListener",function(o){return function(s,a,c){if(s==="click"||s=="keypress")try{let p=this.__sentry_instrumentation_handlers__||{},d=p[s];d&&(d.refCount--,d.refCount<=0&&(o.call(this,s,d.handler,c),d.handler=void 0,delete p[s]),Object.keys(p).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return o.call(this,s,a,c)}}))})}function ab(t){if(t.type!==xp)return!1;try{if(!t.target||t.target._sentryId!==Cp)return!1}catch{}return!0}function cb(t,e){return t!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function uh(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=lb(r);if(cb(r.type,n))return;qt(r,"_sentryCaptured",!0),n&&!n._sentryId&&qt(n,"_sentryId",mt());let i=r.type==="keypress"?"input":r.type;ab(r)||(t({event:r,name:i,global:e}),xp=r.type,Cp=n?n._sentryId:void 0),clearTimeout(lh),lh=dt.setTimeout(()=>{Cp=void 0,xp=void 0},ob)}}function lb(t){try{return t.target}catch{return null}}var Va;function is(t){let e="history";Ot(e,t),Pt(e,ub)}function ub(){if(dt.addEventListener("popstate",()=>{let e=dt.location.href,r=Va;if(Va=e,r===e)return;pt("history",{from:r,to:e})}),!gp())return;function t(e){return function(...r){let n=r.length>2?r[2]:void 0;if(n){let i=Va,o=pb(String(n));if(Va=o,i===o)return e.apply(this,r);pt("history",{from:i,to:o})}return e.apply(this,r)}}ft(dt.history,"pushState",t),ft(dt.history,"replaceState",t)}function pb(t){try{return new URL(t,dt.location.origin).toString()}catch{return t}}var Wa={};function Ap(t){let e=Wa[t];if(e)return e;let r=dt[t];if(rs(r))return Wa[t]=r.bind(dt);let n=dt.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let o=i.contentWindow;o?.[t]&&(r=o[t]),n.head.removeChild(i)}catch(i){ch&&ee.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Wa[t]=r.bind(dt))}function ja(t){Wa[t]=void 0}var Jn="__sentry_xhr_v3__";function Dp(t){Ot("xhr",t),Pt("xhr",fb)}function fb(){if(!dt.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,r,n){let i=new Error,o=Ut()*1e3,s=Lt(n[0])?n[0].toUpperCase():void 0,a=mb(n[1]);if(!s||!a)return e.apply(r,n);r[Jn]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(r.__sentry_own_request__=!0);let c=()=>{let p=r[Jn];if(p&&r.readyState===4){try{p.status_code=r.status}catch{}let d={endTimestamp:Ut()*1e3,startTimestamp:o,xhr:r,virtualError:i};pt("xhr",d)}};return"onreadystatechange"in r&&typeof r.onreadystatechange=="function"?r.onreadystatechange=new Proxy(r.onreadystatechange,{apply(p,d,f){return c(),p.apply(d,f)}}):r.addEventListener("readystatechange",c),r.setRequestHeader=new Proxy(r.setRequestHeader,{apply(p,d,f){let[E,y]=f,T=d[Jn];return T&&Lt(E)&&Lt(y)&&(T.request_headers[E.toLowerCase()]=y),p.apply(d,f)}}),e.apply(r,n)}}),t.send=new Proxy(t.send,{apply(e,r,n){let i=r[Jn];if(!i)return e.apply(r,n);n[0]!==void 0&&(i.body=n[0]);let o={startTimestamp:Ut()*1e3,xhr:r};return pt("xhr",o),e.apply(r,n)}})}function mb(t){if(Lt(t))return t;try{return t.toString()}catch{}}function Np(t,e=Ap("fetch")){let r=0,n=0;function i(o){let s=o.body.length;r+=s,n++;let a=_({body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return ja("fetch"),wn("No fetch implementation available");try{return e(t.url,a).then(c=>(r-=s,n--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return ja("fetch"),r-=s,n--,wn(c)}}return La(t,i)}var db=30;var hb=50;function Op(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?"?":e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var gb=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,yb=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,vb=/\((\S*)(?::(\d+))(?::(\d+))\)/,Eb=t=>{let e=gb.exec(t);if(e){let[,n,i,o]=e;return Op(n,"?",+i,+o)}let r=yb.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=vb.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[i,o]=dh(r[1]||"?",r[2]);return Op(o,i,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},ph=[db,Eb],_b=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,bb=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,wb=t=>{let e=_b.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let o=bb.exec(e[3]);o&&(e[1]=e[1]||"eval",e[3]=o[1],e[4]=o[2],e[5]="")}let n=e[3],i=e[1]||"?";return[i,n]=dh(i,n),Op(n,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},fh=[hb,wb];var mh=[ph,fh],Pp=Iu(...mh),dh=(t,e)=>{let r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:"?",r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};var Bi=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Ga=1024,Sb="Breadcrumbs",Ib=(t={})=>{let e=_({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:Sb,setup(r){e.console&&dp(Cb(r)),e.dom&&Rp(xb(r,e.dom)),e.xhr&&Dp(Rb(r)),e.fetch&&Ep(Ab(r)),e.history&&is(Db(r)),e.sentry&&r.on("beforeSendEvent",Tb(r))}}},hh=Ib;function Tb(t){return function(r){Ge()===t&&Mr({category:`sentry.${r.type==="transaction"?"transaction":"event"}`,event_id:r.event_id,level:r.level,message:Nr(r)},{event:r})}}function xb(t,e){return function(n){if(Ge()!==t)return;let i,o,s=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>Ga&&(Bi&&ee.warn(`\`dom.maxStringLength\` cannot exceed ${Ga}, but a value of ${a} was configured. Sentry will use ${Ga} instead.`),a=Ga),typeof s=="string"&&(s=[s]);try{let p=n.event,d=Nb(p)?p.target:p;i=Go(d,{keyAttrs:s,maxStringLength:a}),o=Lu(d)}catch{i="<unknown>"}if(i.length===0)return;let c={category:`ui.${n.name}`,message:i};o&&(c.data={"ui.component_name":o}),Mr(c,{event:n.event,name:n.name,global:n.global})}}function Cb(t){return function(r){if(Ge()!==t)return;let n={category:"console",data:{arguments:r.args,logger:"console"},level:hp(r.level),message:ha(r.args," ")};if(r.level==="assert")if(r.args[0]===!1)n.message=`Assertion failed: ${ha(r.args.slice(1)," ")||"console.assert"}`,n.data.arguments=r.args.slice(1);else return;Mr(n,{input:r.args,level:r.level})}}function Rb(t){return function(r){if(Ge()!==t)return;let{startTimestamp:n,endTimestamp:i}=r,o=r.xhr[Jn];if(!n||!i||!o)return;let{method:s,url:a,status_code:c,body:p}=o,d={method:s,url:a,status_code:c},f={xhr:r.xhr,input:p,startTimestamp:n,endTimestamp:i},E={category:"xhr",data:d,type:"http",level:Fa(c)};t.emit("beforeOutgoingRequestBreadcrumb",E,f),Mr(E,f)}}function Ab(t){return function(r){if(Ge()!==t)return;let{startTimestamp:n,endTimestamp:i}=r;if(i&&!(r.fetchData.url.match(/sentry_key/)&&r.fetchData.method==="POST"))if(r.fetchData.method,r.fetchData.url,r.error){let o=r.fetchData,s={data:r.error,input:r.args,startTimestamp:n,endTimestamp:i},a={category:"fetch",data:o,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",a,s),Mr(a,s)}else{let o=r.response,s=Z(_({},r.fetchData),{status_code:o?.status});r.fetchData.request_body_size,r.fetchData.response_body_size,o?.status;let a={input:r.args,response:o,startTimestamp:n,endTimestamp:i},c={category:"fetch",data:s,type:"http",level:Fa(s.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",c,a),Mr(c,a)}}}function Db(t){return function(r){if(Ge()!==t)return;let n=r.from,i=r.to,o=es(Qe.location.href),s=n?es(n):void 0,a=es(i);s?.path||(s=o),o.protocol===a.protocol&&o.host===a.host&&(i=a.relative),o.protocol===s.protocol&&o.host===s.host&&(n=s.relative),Mr({category:"navigation",data:{from:n,to:i}})}}function Nb(t){return!!t&&!!t.target}var Ob=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Pb="BrowserApiErrors",Lb=(t={})=>{let e=_({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1},t);return{name:Pb,setupOnce(){e.setTimeout&&ft(Qe,"setTimeout",gh),e.setInterval&&ft(Qe,"setInterval",gh),e.requestAnimationFrame&&ft(Qe,"requestAnimationFrame",Mb),e.XMLHttpRequest&&"XMLHttpRequest"in Qe&&ft(XMLHttpRequest.prototype,"send",Bb);let r=e.eventTarget;r&&(Array.isArray(r)?r:Ob).forEach(i=>kb(i,e))}}},yh=Lb;function gh(t){return function(...e){let r=e[0];return e[0]=Xn(r,{mechanism:{data:{function:nr(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function Mb(t){return function(e){return t.apply(this,[Xn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:nr(t)},handled:!1,type:"instrument"}})])}}function Bb(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in r&&typeof r[i]=="function"&&ft(r,i,function(o){let s={mechanism:{data:{function:i,handler:nr(o)},handled:!1,type:"instrument"}},a=Kn(o);return a&&(s.mechanism.data.handler=nr(a)),Xn(o,s)})}),t.apply(this,e)}}function kb(t,e){let n=Qe[t]?.prototype;n?.hasOwnProperty?.("addEventListener")&&(ft(n,"addEventListener",function(i){return function(o,s,a){try{Ub(s)&&(s.handleEvent=Xn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:nr(s),target:t},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&Fb(this,o,s),i.apply(this,[o,Xn(s,{mechanism:{data:{function:"addEventListener",handler:nr(s),target:t},handled:!1,type:"instrument"}}),a])}}),ft(n,"removeEventListener",function(i){return function(o,s,a){try{let c=s.__sentry_wrapped__;c&&i.call(this,o,c,a)}catch{}return i.call(this,o,s,a)}}))}function Ub(t){return typeof t.handleEvent=="function"}function Fb(t,e,r){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,r)}var vh=()=>({name:"BrowserSession",setupOnce(){if(typeof Qe.document>"u"){Bi&&ee.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Xo({ignoreDuration:!0}),Jo(),is(({from:t,to:e})=>{t!==void 0&&t!==e&&(Xo({ignoreDuration:!0}),Jo())})}});var Hb="GlobalHandlers",$b=(t={})=>{let e=_({onerror:!0,onunhandledrejection:!0},t);return{name:Hb,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(Vb(r),Eh("onerror")),e.onunhandledrejection&&(Wb(r),Eh("onunhandledrejection"))}}},_h=$b;function Vb(t){xu(e=>{let{stackParser:r,attachStacktrace:n}=bh();if(Ge()!==t||wp())return;let{msg:i,url:o,line:s,column:a,error:c}=e,p=zb($a(r,c||i,void 0,n,!1),o,s,a);p.level="error",Ko(p,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function Wb(t){Ru(e=>{let{stackParser:r,attachStacktrace:n}=bh();if(Ge()!==t||wp())return;let i=jb(e),o=Yn(i)?Gb(i):$a(r,i,void 0,n,!0);o.level="error",Ko(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function jb(t){if(Yn(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function Gb(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function zb(t,e,r,n){let i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],p=n,d=r,f=Lt(e)&&e.length>0?e:zo();return c.length===0&&c.push({colno:p,filename:f,function:"?",in_app:!0,lineno:d}),t}function Eh(t){Bi&&ee.log(`Global Handler attached: ${t}`)}function bh(){return Ge()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var wh=()=>({name:"HttpContext",preprocessEvent(t){if(!Qe.navigator&&!Qe.location&&!Qe.document)return;let e=ih(),r=_(_({},e.headers),t.request?.headers);t.request=Z(_(_({},e),t.request),{headers:r})}});var Yb="cause",qb=5,Kb="LinkedErrors",Xb=(t={})=>{let e=t.limit||qb,r=t.key||Yb;return{name:Kb,preprocessEvent(n,i,o){let s=o.getOptions();mp(Ha,s.stackParser,r,e,n,i)}}},Sh=Xb;function Lp(t){return[ka(),Ma(),yh(),hh(),_h(),Sh(),Ua(),wh(),vh()]}var Ya={},qa,Mp,Ih;(()=>{let t=Lp({}).filter(e=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(e.name));Mp=new ns({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:Np,stackParser:Pp,integrations:t,environment:zt.mode,release:`web-sdk@${Kr}`,debug:zt.debug}),Mp.init()})();function ae(t,e,r){w.error(`${e}:`,t);let n=Ch(r);if(n.setTag("operation",e),t instanceof Wn){Jb(n,t,e);return}n.captureException(t)}function Th(t,e,r){Ch(r).captureMessage(t,e??"error")}function Jb(t,e,r){if(Qb(t,e),e.response){let n=e.response;t.setTag("http.status_code",n.status),t.setExtras({responseText:e.responseText,statusText:n.statusText,responseType:n.type,redirected:n.redirected,responseUrl:n.url}),t.captureMessage(`${r} failed with ${n.status}`,"error");return}if(e.request){t.captureMessage(`No response was received for ${r}`,"error");return}}function Qb(t,e){let r=e.request;r&&t.setExtras({body:e.requestBody,headers:r.headers,method:r.method,url:r.url})}function xh(t){Ih=t}function Ka(t,e){Ya[t]=_(_({},Ya[t]),e)}function ki(t){qa=_(_({},qa),t)}function Ch(t){t??={};let{extra:e,tags:r}=t,n=new St;if(n.setClient(Mp),n.setUser(Ih),t.triggerContext&&!t.engagementTrigger&&(t.engagementTrigger=t.triggerContext.triggerData),t.engagementTrigger){let i=t.engagementTrigger;n.setTags({"engagement.id":i.engagementID,"engagement.short_id":i.shortID,"engagement.objective":i.objective,"engagement.delivery_type":i.onsiteDeliveryType,"engagement.content_id":i.contentID,"engagement.variation":i.variation,"engagement.currency":i.currency})}return e&&n.setExtras(e),r&&n.setTags(r),qa&&n.setTags(qa),Object.keys(Ya).forEach(i=>{n.setContext(i,Ya[i])}),n.setTag("language",navigator.language),n.setTag("timezone",Rh()),Zb(n),n}function Zb(t){window.Shopify&&(t.setTag("shopify.shop",window.Shopify.shop),t.setTag("shopify.currency",window.Shopify.currency?.active),t.setTag("shopify.locale",window.Shopify.locale),t.setTag("theme.schema_name",window.Shopify.theme?.schema_name),t.setTag("theme.schema_version",window.Shopify.theme?.schema_version))}var Xa=class{static format(e,r){let n=/{{\s*(\w+)\s*}}/;return r.replace(n,(i,o)=>{switch(o){case"amount":return this.formatWithDelimiters(e,2);case"amount_no_decimals":return this.formatWithDelimiters(e,0);case"amount_with_comma_separator":return this.formatWithDelimiters(e,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(e,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(e,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(e,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(e,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(e,2," ",".");default:return i}})}static formatWithDelimiters(e,r=2,n=",",i="."){if(isNaN(e)||e==null)return"0";let s=(e/100).toFixed(r).split("."),a=s[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+n),c=s[1]?i+s[1]:"";return a+c}};function Ui(t){try{return new URL(t)}catch{return}}function Bp(t){return!t||t==="null"||t==="undefined"}function Ah(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function Mt(t,e,r){return{[t]:kp(e,r),[t+"_wo_currency"]:e}}function kp(t,e){if(t==0&&e)return"Free";let r=fe.get(),n=Je.get(),i=r.shopCurrencyCode||n.currency,o=r.currencyCode;o||w.warn("Currency code is not set in RuntimeData");let s=n.money?.format??r.moneyFormat,a;if(s&&i===o)a=Xa.format(t*100,s);else{let c;try{c=new Intl.NumberFormat(Nh(),{style:"currency",currency:o||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(p){return ae(p,"format-currency",{extra:{currentCurrency:o,shopCurrency:i}}),""}a=c.format(t),a=a.replace("\u20B9","Rs. "),n.money?.showCurrency&&o!=="INR"&&(a=a.concat(` ${o}`))}return a}function Dh(t){let e=Nh();try{return new Intl.NumberFormat(e,{notation:"compact"}).format(t)}catch(r){return ae(r,"format-number",{extra:{lang:e,value:t}}),t.toString()}}function Nh(){let t="en";return typeof navigator<"u"&&(navigator.languages!==void 0&&navigator.languages.length>0?t=navigator.languages[0]:navigator.language&&(t=navigator.language)),t=t.split(";")[0],t=t.split("-")[0],t||"en"}var Ja;function Rh(){if(Ja)return Ja;try{return Ja=Intl.DateTimeFormat().resolvedOptions().timeZone,Ja}catch{return""}}function Fi(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}function Sr(t){let e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout(()=>{e.classList.remove("show"),document.body.removeChild(e)},5e3)}async function Up(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let o=Math.min(100*2**n,5e3);if(await rr.sleep(o),i=r.querySelectorAll(t),i.length)return w.verbose(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;w.verbose(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${o}ms.`),n++}return w.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${t}.`),i}async function Hi(t,e=10,r=document){return(await Up(t,e,r)).item(0)}async function Fp(t){let[e,r,n]=await Promise.all([Ke.get("did"),Rt.get("id",""),Ke.get("sessionNumber",1)]),i={letscooee_did:e,letscooee_sid:r,letscooee_sn:n,__letscooee_time:new Date().toLocaleString()};return t&&(i.__letscooee_via=t),i}async function Qa(t){let e=await Fp(t);return Object.entries(e).map(([r,n])=>({key:r,value:n.toString()}))}function sn(t,e,r,n=!1){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:n,value:r})}function Oh(t){if(t%100>=11&&t%100<=13)return t+"th";switch(t%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd";default:return t+"th"}}var rc,xe,kh,Vp,Qn,Ph,Uh,Fh,Hh,Wp,Hp,$p,ew,ss={},$h=[],tw=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,nc=Array.isArray;function an(t,e){for(var r in e)t[r]=e[r];return t}function jp(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Gp(t,e,r){var n,i,o,s={};for(o in e)o=="key"?n=e[o]:o=="ref"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?rc.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return ec(t,s,n,i,null)}function ec(t,e,r,n,i){var o={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++kh,__i:-1,__u:0};return i==null&&xe.vnode!=null&&xe.vnode(o),o}function kr(t){return t.children}function Br(t,e){this.props=t,this.context=e}function $i(t,e){if(e==null)return t.__?$i(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?$i(t):null}function Vh(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return Vh(t)}}function Lh(t){(!t.__d&&(t.__d=!0)&&Qn.push(t)&&!tc.__r++||Ph!=xe.debounceRendering)&&((Ph=xe.debounceRendering)||Uh)(tc)}function tc(){for(var t,e,r,n,i,o,s,a=1;Qn.length;)Qn.length>a&&Qn.sort(Fh),t=Qn.shift(),a=Qn.length,t.__d&&(r=void 0,i=(n=(e=t).__v).__e,o=[],s=[],e.__P&&((r=an({},n)).__v=n.__v+1,xe.vnode&&xe.vnode(r),zp(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,o,i??$i(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,Gh(o,r,s),r.__e!=i&&Vh(r)));tc.__r=0}function Wh(t,e,r,n,i,o,s,a,c,p,d){var f,E,y,T,D,N,k=n&&n.__k||$h,G=e.length;for(c=rw(r,e,k,c,G),f=0;f<G;f++)(y=r.__k[f])!=null&&(E=y.__i==-1?ss:k[y.__i]||ss,y.__i=f,N=zp(t,y,E,i,o,s,a,c,p,d),T=y.__e,y.ref&&E.ref!=y.ref&&(E.ref&&Yp(E.ref,null,y),d.push(y.ref,y.__c||T,y)),D==null&&T!=null&&(D=T),4&y.__u||E.__k===y.__k?c=jh(y,c,t):typeof y.type=="function"&&N!==void 0?c=N:T&&(c=T.nextSibling),y.__u&=-7);return r.__e=D,c}function rw(t,e,r,n,i){var o,s,a,c,p,d=r.length,f=d,E=0;for(t.__k=new Array(i),o=0;o<i;o++)(s=e[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(c=o+E,(s=t.__k[o]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?ec(null,s,null,null,null):nc(s)?ec(kr,{children:s},null,null,null):s.constructor==null&&s.__b>0?ec(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,(p=s.__i=nw(s,r,c,f))!=-1&&(f--,(a=r[p])&&(a.__u|=2)),a==null||a.__v==null?(p==-1&&(i>d?E--:i<d&&E++),typeof s.type!="function"&&(s.__u|=4)):p!=c&&(p==c-1?E--:p==c+1?E++:(p>c?E--:E++,s.__u|=4))):t.__k[o]=null;if(f)for(o=0;o<d;o++)(a=r[o])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=$i(a)),Yh(a,a));return n}function jh(t,e,r){var n,i;if(typeof t.type=="function"){for(n=t.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=t,e=jh(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=$i(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function nw(t,e,r,n){var i,o,s=t.key,a=t.type,c=e[r];if(c===null&&t.key==null||c&&s==c.key&&a==c.type&&(2&c.__u)==0)return r;if(n>(c!=null&&(2&c.__u)==0?1:0))for(i=r-1,o=r+1;i>=0||o<e.length;){if(i>=0){if((c=e[i])&&(2&c.__u)==0&&s==c.key&&a==c.type)return i;i--}if(o<e.length){if((c=e[o])&&(2&c.__u)==0&&s==c.key&&a==c.type)return o;o++}}return-1}function Mh(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||tw.test(e)?r:r+"px"}function Za(t,e,r,n,i){var o,s;e:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||Mh(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||Mh(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(Hh,"$1")),s=e.toLowerCase(),e=s in t||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=r,r?n?r.u=n.u:(r.u=Wp,t.addEventListener(e,o?$p:Hp,o)):t.removeEventListener(e,o?$p:Hp,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function Bh(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=Wp++;else if(e.t<r.u)return;return r(xe.event?xe.event(e):e)}}}function zp(t,e,r,n,i,o,s,a,c,p){var d,f,E,y,T,D,N,k,G,P,Q,_e,X,ce,se,de,Be,Te=e.type;if(e.constructor!=null)return null;128&r.__u&&(c=!!(32&r.__u),o=[a=e.__e=r.__e]),(d=xe.__b)&&d(e);e:if(typeof Te=="function")try{if(k=e.props,G="prototype"in Te&&Te.prototype.render,P=(d=Te.contextType)&&n[d.__c],Q=d?P?P.props.value:d.__:n,r.__c?N=(f=e.__c=r.__c).__=f.__E:(G?e.__c=f=new Te(k,Q):(e.__c=f=new Br(k,Q),f.constructor=Te,f.render=ow),P&&P.sub(f),f.props=k,f.state||(f.state={}),f.context=Q,f.__n=n,E=f.__d=!0,f.__h=[],f._sb=[]),G&&f.__s==null&&(f.__s=f.state),G&&Te.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=an({},f.__s)),an(f.__s,Te.getDerivedStateFromProps(k,f.__s))),y=f.props,T=f.state,f.__v=e,E)G&&Te.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),G&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(G&&Te.getDerivedStateFromProps==null&&k!==y&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(k,Q),!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(k,f.__s,Q)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(f.props=k,f.state=f.__s,f.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(Ae){Ae&&(Ae.__=e)}),_e=0;_e<f._sb.length;_e++)f.__h.push(f._sb[_e]);f._sb=[],f.__h.length&&s.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(k,f.__s,Q),G&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(y,T,D)})}if(f.context=Q,f.props=k,f.__P=t,f.__e=!1,X=xe.__r,ce=0,G){for(f.state=f.__s,f.__d=!1,X&&X(e),d=f.render(f.props,f.state,f.context),se=0;se<f._sb.length;se++)f.__h.push(f._sb[se]);f._sb=[]}else do f.__d=!1,X&&X(e),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++ce<25);f.state=f.__s,f.getChildContext!=null&&(n=an(an({},n),f.getChildContext())),G&&!E&&f.getSnapshotBeforeUpdate!=null&&(D=f.getSnapshotBeforeUpdate(y,T)),de=d,d!=null&&d.type===kr&&d.key==null&&(de=zh(d.props.children)),a=Wh(t,nc(de)?de:[de],e,r,n,i,o,s,a,c,p),f.base=e.__e,e.__u&=-161,f.__h.length&&s.push(f),N&&(f.__E=f.__=null)}catch(Ae){if(e.__v=null,c||o!=null)if(Ae.then){for(e.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,e.__e=a}else for(Be=o.length;Be--;)jp(o[Be]);else e.__e=r.__e,e.__k=r.__k;xe.__e(Ae,e,r)}else o==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):a=e.__e=iw(r.__e,e,r,n,i,o,s,c,p);return(d=xe.diffed)&&d(e),128&e.__u?void 0:a}function Gh(t,e,r){for(var n=0;n<r.length;n++)Yp(r[n],r[++n],r[++n]);xe.__c&&xe.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){xe.__e(o,i.__v)}})}function zh(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:nc(t)?t.map(zh):an({},t)}function iw(t,e,r,n,i,o,s,a,c){var p,d,f,E,y,T,D,N=r.props,k=e.props,G=e.type;if(G=="svg"?i="http://www.w3.org/2000/svg":G=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(p=0;p<o.length;p++)if((y=o[p])&&"setAttribute"in y==!!G&&(G?y.localName==G:y.nodeType==3)){t=y,o[p]=null;break}}if(t==null){if(G==null)return document.createTextNode(k);t=document.createElementNS(i,G,k.is&&k),a&&(xe.__m&&xe.__m(e,o),a=!1),o=null}if(G==null)N===k||a&&t.data==k||(t.data=k);else{if(o=o&&rc.call(t.childNodes),N=r.props||ss,!a&&o!=null)for(N={},p=0;p<t.attributes.length;p++)N[(y=t.attributes[p]).name]=y.value;for(p in N)if(y=N[p],p!="children"){if(p=="dangerouslySetInnerHTML")f=y;else if(!(p in k)){if(p=="value"&&"defaultValue"in k||p=="checked"&&"defaultChecked"in k)continue;Za(t,p,null,y,i)}}for(p in k)y=k[p],p=="children"?E=y:p=="dangerouslySetInnerHTML"?d=y:p=="value"?T=y:p=="checked"?D=y:a&&typeof y!="function"||N[p]===y||Za(t,p,y,N[p],i);if(d)a||f&&(d.__html==f.__html||d.__html==t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(f&&(t.innerHTML=""),Wh(e.type=="template"?t.content:t,nc(E)?E:[E],e,r,n,G=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:r.__k&&$i(r,0),a,c),o!=null)for(p=o.length;p--;)jp(o[p]);a||(p="value",G=="progress"&&T==null?t.removeAttribute("value"):T!=null&&(T!==t[p]||G=="progress"&&!T||G=="option"&&T!=N[p])&&Za(t,p,T,N[p],i),p="checked",D!=null&&D!=t[p]&&Za(t,p,D,N[p],i))}return t}function Yp(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){xe.__e(i,r)}}function Yh(t,e,r){var n,i;if(xe.unmount&&xe.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Yp(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){xe.__e(o,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&Yh(n[i],e,r||typeof t.type!="function");r||jp(t.__e),t.__c=t.__=t.__e=void 0}function ow(t,e,r){return this.constructor(t,r)}function qh(t,e,r){var n,i,o,s;e==document&&(e=document.documentElement),xe.__&&xe.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,o=[],s=[],zp(e,t=(!n&&r||e).__k=Gp(kr,null,[t]),i||ss,ss,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?rc.call(e.childNodes):null,o,!n&&r?r:i?i.__e:e.firstChild,n,s),Gh(o,t,s)}rc=$h.slice,xe={__e:function(t,e,r,n){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),s=i.__d),s)return i.__E=i}catch(a){t=a}throw t}},kh=0,Vp=function(t){return t!=null&&t.constructor==null},Br.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=an({},this.state),typeof t=="function"&&(t=t(an({},r),this.props)),t&&an(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Lh(this))},Br.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Lh(this))},Br.prototype.render=kr,Qn=[],Uh=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Fh=function(t,e){return t.__v.__b-e.__v.__b},tc.__r=0,Hh=/(PointerCapture)$|Capture$/i,Wp=0,Hp=Bh(!1),$p=Bh(!0),ew=0;var Kp,Kt,qp,Kh,Xh=0,ig=[],ht=xe,Jh=ht.__b,Qh=ht.__r,Zh=ht.diffed,eg=ht.__c,tg=ht.unmount,rg=ht.__;function sw(t,e){ht.__h&&ht.__h(Kt,t,Xh||e),Xh=0;var r=Kt.__H||(Kt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function Jp(t,e){var r=sw(Kp++,7);return lw(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function aw(){for(var t;t=ig.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ic),t.__H.__h.forEach(Xp),t.__H.__h=[]}catch(e){t.__H.__h=[],ht.__e(e,t.__v)}}ht.__b=function(t){Kt=null,Jh&&Jh(t)},ht.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),rg&&rg(t,e)},ht.__r=function(t){Qh&&Qh(t),Kp=0;var e=(Kt=t.__c).__H;e&&(qp===Kt?(e.__h=[],Kt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(ic),e.__h.forEach(Xp),e.__h=[],Kp=0)),qp=Kt},ht.diffed=function(t){Zh&&Zh(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(ig.push(e)!==1&&Kh===ht.requestAnimationFrame||((Kh=ht.requestAnimationFrame)||cw)(aw)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),qp=Kt=null},ht.__c=function(t,e){e.some(function(r){try{r.__h.forEach(ic),r.__h=r.__h.filter(function(n){return!n.__||Xp(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],ht.__e(n,r.__v)}}),eg&&eg(t,e)},ht.unmount=function(t){tg&&tg(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ic(n)}catch(i){e=i}}),r.__H=void 0,e&&ht.__e(e,r.__v))};var ng=typeof requestAnimationFrame=="function";function cw(t){var e,r=function(){clearTimeout(n),ng&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);ng&&(e=requestAnimationFrame(r))}function ic(t){var e=Kt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Kt=e}function Xp(t){var e=Kt;t.__c=t.__(),Kt=e}function lw(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var uw=Symbol.for("preact-signals");function Zp(){if(Vi>1)Vi--;else{for(var t,e=!1;as!==void 0;){var r=as;for(as=void 0,Qp++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&sg(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(Qp=0,Vi--,e)throw t}}var $e=void 0;var as=void 0,Vi=0,Qp=0,oc=0;function og(t){if($e!==void 0){var e=t.n;if(e===void 0||e.t!==$e)return e={i:0,S:t,p:$e.s,n:void 0,t:$e,e:void 0,x:void 0,r:e},$e.s!==void 0&&($e.s.n=e),$e.s=e,t.n=e,32&$e.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=$e.s,e.n=void 0,$e.s.n=e,$e.s=e),e}}function gt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}gt.prototype.brand=uw;gt.prototype.h=function(){return!0};gt.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};gt.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};gt.prototype.subscribe=function(t){var e=this;return It(function(){var r=e.value,n=$e;$e=void 0;try{t(r)}finally{$e=n}})};gt.prototype.valueOf=function(){return this.value};gt.prototype.toString=function(){return this.value+""};gt.prototype.toJSON=function(){return this.value};gt.prototype.peek=function(){var t=$e;$e=void 0;try{return this.value}finally{$e=t}};Object.defineProperty(gt.prototype,"value",{get:function(){var t=og(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Qp>100)throw new Error("Cycle detected");this.v=t,this.i++,oc++,Vi++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Zp()}}}});function sr(t){return new gt(t)}function sg(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function ag(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function cg(t){for(var e=t.s,r=void 0;e!==void 0;){var n=e.p;e.i===-1?(e.S.U(e),n!==void 0&&(n.n=e.n),e.n!==void 0&&(e.n.p=n)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=n}t.s=r}function Wi(t){gt.call(this,void 0),this.x=t,this.s=void 0,this.g=oc-1,this.f=4}(Wi.prototype=new gt).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===oc))return!0;if(this.g=oc,this.f|=1,this.i>0&&!sg(this))return this.f&=-2,!0;var t=$e;try{ag(this),$e=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return $e=t,cg(this),this.f&=-2,!0};Wi.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}gt.prototype.S.call(this,t)};Wi.prototype.U=function(t){if(this.t!==void 0&&(gt.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};Wi.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(Wi.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=og(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function ef(t){return new Wi(t)}function lg(t){var e=t.u;if(t.u=void 0,typeof e=="function"){Vi++;var r=$e;$e=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,tf(t),n}finally{$e=r,Zp()}}}function tf(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,lg(t)}function pw(t){if($e!==this)throw new Error("Out-of-order effect");cg(this),$e=t,this.f&=-2,8&this.f&&tf(this),Zp()}function cs(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}cs.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};cs.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,lg(this),ag(this),Vi++;var t=$e;return $e=this,pw.bind(this,t)};cs.prototype.N=function(){2&this.f||(this.f|=2,this.o=as,as=this)};cs.prototype.d=function(){this.f|=8,1&this.f||tf(this)};function It(t){var e=new cs(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var nf,rf;function ji(t,e){xe[t]=e.bind(null,xe[t]||function(){})}function sc(t){rf&&rf(),rf=t&&t.S()}function ug(t){var e=this,r=t.data,n=mw(r);n.value=r;var i=Jp(function(){for(var o=e.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return e.__$u.c=function(){var s,a=e.__$u.S(),c=i.value;a(),Vp(c)||((s=e.base)==null?void 0:s.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=c},ef(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return i.value}ug.displayName="_st";Object.defineProperties(gt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:ug},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});ji("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof gt&&(r||(e.__np=r={}),r[i]=o,n[i]=o.peek())}}t(e)});ji("__r",function(t,e){sc();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=(function(i){var o;return It(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o})())),nf=n,sc(r),t(e)});ji("__e",function(t,e,r,n){sc(),nf=void 0,t(e,r,n)});ji("diffed",function(t,e){sc(),nf=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var o=r.U;if(o)for(var s in o){var a=o[s];a!==void 0&&!(s in n)&&(a.d(),o[s]=void 0)}else r.U=o={};for(var c in n){var p=o[c],d=n[c];p===void 0?(p=fw(r,c,d,i),o[c]=p):p.o(d,i)}}}t(e)});function fw(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,o=sr(r);return{o:function(s,a){o.value=s,n=a},d:It(function(){var s=o.value.value;n[e]!==s&&(n[e]=s,i?t[e]=s:s?t.setAttribute(e,s):t.removeAttribute(e))})}}ji("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var s=e.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(e)});ji("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});Br.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in t)if(o!=="__source"&&t[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};function mw(t){return Jp(function(){return sr(t)},[])}var ac=class{url;alt;constructor(e){e.alt&&(this.alt=e.alt),this.url=e.url}};var cc=class{d;cmp;effective;constructor(e={}){this.d=e.d,this.cmp=e.cmp,this.effective=this.d}};var of=class{id;mID;name;groupID;groupName;isSelected;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.name=e.name,this.groupID=e.groupID,this.groupName=e.groupName,this.isSelected=e.isSelected??!1}},Ur=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(e){e=e??{},this.mID=e.mID,this.name=e.name,this.imgs=e.imgs?.map(r=>new ac(r))??[],this.link=e.link,this.price=new cc(e.price),this.sku=e.sku,this.isAvailable=e.isAvailable,this.quantity=e.quantity,this.selectedOptions=e.selectedOptions??[],this.effectivePrice=sr(this.price.effective),e.sellingPlans?.length&&(this.selectedSellingPlan=sr(void 0)),this.sellingPlans=e.sellingPlans?.map(r=>{let n=new of(r);return n.isSelected&&(this.selectedSellingPlan.value=n),n})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(e){this.selectedSellingPlan.value=e}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};var At=class{id;mID;name;options;imgs;vars;desc;link;slug;quantity;category;meta;reviews;tags;selectedOrFirstVariant;selected=sr(!0);constructor(e){this.update(e),this.selectedOrFirstVariant=sr(this.selectedVariant)}get firstImageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}set variants(e){this.vars=e,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(e=>e.isAvailable)??this.vars[0]}hasVariants(){return this.vars?.length>1}setSelectedVariant(e){this.selectedOrFirstVariant.value=e}setSelectedVariantByID(e){if(!e)return;let r=this.vars.find(n=>n.mID===e.toString());r&&this.setSelectedVariant(r)}update(e){return this.id=e.id??this.id,this.mID=e.mID??this.mID,this.name=e.name??this.name,this.imgs=e.imgs??this.imgs,this.desc=e.desc??this.desc,this.link=e.link??this.link,this.slug=e.slug??this.slug,this.quantity=e.quantity??this.quantity,this.meta=e.meta??this.meta,this.category=e.category??this.category,this.reviews=e.reviews??this.reviews,this.options=e.options??this.options,this.tags=e.tags??this.tags,e.vars&&(this.vars=e.vars.map(r=>new Ur(r))),this}toEmbed(e){return e=e??this.selectedOrFirstVariant.value,new Ct({id:this.id,mID:this.mID,vID:e.mID,vName:e.name,name:this.name,link:this.link,slug:this.slug,price:e.price.d,imageURL:e.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let e=this.selectedOrFirstVariant.value,r=e.price,n=this.name,i=this.category,o=this.variantImage??this.firstImageURL,s=this.meta,a=this.tags?.join(",")??"",c=this.reviews?.rating,p=this.reviews?.totalReviews,d=r.cmp&&r.cmp>r.d,f=Z(_({name:n},Mt("price",r.d,!0)),{image_url:o,meta:s,category:i,rating:c,reviews:p,tags:a});if(e.hasEffectivePrice()){let y=Mt("effective_price",e.effectivePrice.value,!0);Object.assign(f,y)}if(d){let y=r.cmp-r.d,T={discount_percent:(y/r.cmp*100).toFixed(0)};Object.assign(f,T),Object.assign(f,Mt("compare_price",r.cmp)),Object.assign(f,Mt("discount_price",y))}let E={name:e.name,quantity:e.quantity};return{product:f,variant:E}}};var lc=class{id;alt;shortID;sources;items;durationMS;thumbnail;card;constructor(e={}){this.id=e.id,this.alt=e.alt,this.shortID=e.shortID,this.sources=e.sources?.sort((r,n)=>n.height-r.height),this.durationMS=e.durationMS,this.thumbnail=e.thumbnail,this.items=e.items?e.items.map(r=>new At(r)):[],this.card=e.card}};var sf=class{enabled;type;color;constructor(e){e??={},this.enabled=e.enabled,this.type=e.type,this.color=new je(e.color)}},af=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new je(e.color)}},cf=class{enabled;delay;constructor(e={}){this.enabled=e.enabled,e.delay&&(this.delay=e.delay>100?e.delay:e.delay*1e3)}},In=class{navigation;pagination;autoplay;loop;maxInRow;gap;maxInRowSm;gapSm;speed;marquee;constructor(e){e??={},this.navigation=new af(e.navigation),this.pagination=new sf(e.pagination),this.autoplay=new cf(e.autoplay),this.loop=e.loop??!1,this.maxInRow=e.maxInRow??4,this.gap=e.gap??0,this.maxInRowSm=e.maxInRowSm??this.maxInRow,this.gapSm=e.gapSm??this.gap,e.speed&&(this.speed=e.speed*1e3),this.marquee=e.marquee}};var uc=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;playlistConfig;constructor(e={}){this.videos=e.videos?.map(r=>new lc(r))??[],this.source=e.source,this.template=e.template,this.detailPopup=e.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=e.heading,this.showMuteButton=e.showMuteButton,this.slidePerViewCount=e.slidePerViewCount??4,this.autoPlay=e.autoPlay??"ON",this.footerContent=e.footerContent??"FIRST_ITEM",this.playlistConfig=e.playlistConfig?.videoSwiper?{videoSwiper:new In(e.playlistConfig?.videoSwiper)}:void 0}};var Bt=Rr(fg());Bt.filters.define("default",function(t){return typeof t>"u"||t==null?"":hw(t)});+Bt.filters.define("max",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r>n?e:t});Bt.filters.define("min",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r<n?e:t});Bt.filters.define("fallback",(t,e)=>t==null||t===""?e:t);Bt.filters.define("manipulate_quantity",(t,e,r)=>{if(e??=1,r??=100,e>r)return w.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%r;return n<e?e:n});Bt.filters.define("apply_discount_perc",(t,e,r=1/0)=>{if(t=+t,isNaN(t))return w.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(e<0||e>100)return w.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let n=t*e/100;return t-Math.min(r,n)});Bt.filters.define("apply_discount_fixed",(t,e)=>(t=+t,isNaN(t)?(w.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,t-e)));Bt.filters.define("currency",t=>(t=+t,isNaN(t)?(w.error("Need value as a number for `currency` filter"),NaN):kp(t)));Bt.defaultConfig.defaultFilter="default";Bt.defaultConfig.useWith=!0;Bt.defaultConfig.autoEscape=!1;var dw={'"':""","\\":"\","\n":"\\n"};function hw(t){return String(t).replace(/["\\\n]/g,e=>dw[e])}function gw(t){if(!t)return"";let e=/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g;return t.replace(e,(r,n,i,o)=>`{{ ${(i||o||"").trim()} }}`)}var Gi=(t,e,r)=>{e=_({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},e);try{return Bt.render(gw(t),e)}catch(n){throw ae(n,"squirrelly-render",{extra:{template:t,values:e},triggerContext:r}),n}},Zn=(t,e,r)=>{let n=JSON.stringify(t),i=Gi(n,e,r);try{return JSON.parse(i)}catch(o){throw ae(o,"variable-replacement",{extra:{before:t,after:i},triggerContext:r}),o}};function ls(){return!!window.Shopify}function fc(){if(ls())return window.Shopify.shop?.split(".")?.[0]}function mg(t){let n=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return n?n[1]:null}function zi(t){return(window.Shopify?.routes?.root??"/")+t.substring(1)}function mc(t){return zi(t+"?from=cooee")}var yw="2024-10",vw=`/api/${yw}/graphql.json`,dg={"Content-Type":"application/json"};async function dc(t,e,r,n){let i=Je.get().storefrontToken;if(!i)throw new Error("Storefront token not set for the store");let o=new Headers(dg);o.append("X-Shopify-Storefront-Access-Token",i);let s=JSON.stringify({query:t,variables:e});try{return await Zr(vw,{method:"POST",headers:o,body:s})}catch(a){throw ae(a,r,{engagementTrigger:n}),a}}function Yi(t,e){return Ew(mc(t),e)}async function Ew(t,e){let r={body:JSON.stringify(e),method:"POST",headers:dg};return Zr(t,r)}var hc=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(e=>this.queue.push(e));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let e=this.queue.shift();e&&e()}else this.isLocked=!1}},gc=class t{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(e,r){if(e=`__cooee_${e}_lock__`,"locks"in navigator&&!bw())try{return await _w(e,r,this.LOCK_TIMEOUT)}catch(s){w.verbose(`Web Locks API failed, falling back to localStorage: ${s}`)}let n=!1,i=0,o=Math.random().toString(36).substring(2,10);for(;i++<this.MAX_RETRIES&&(w.verbose(`Lock retry ${i} for ${e}`),n=await this.acquire(e,o,i),!n);)await this.sleep(t.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(e,o)}}static async acquire(e,r,n){let i=Date.now(),o=localStorage.getItem(e),s=o?JSON.parse(o):null;if(s&&i<=s.expiry)return!1;let a={owner:r,expiry:i+t.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(a)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||"{}").owner===r?(w.verbose(`${r}: Lock acquired for ${e} after ${n} attempts!`),!0):(w.verbose(`${r}: Race lost. Another tab acquired the lock.`),!1)}static release(e,r){let n=localStorage.getItem(e);if(!n)return;let i=JSON.parse(n);i.owner===r?(localStorage.removeItem(e),w.verbose(`${r}: Lock released`)):w.verbose(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(e){return new Promise(r=>setTimeout(r,e))}};async function _w(t,e,r){return new Promise((n,i)=>{let o=setTimeout(()=>{i(new Error(`Web Locks API timeout after ${r}ms`))},r);navigator.locks.request(t,async()=>{try{let s=await e();return clearTimeout(o),n(s),s}catch(s){throw clearTimeout(o),i(s),s}}).catch(s=>{clearTimeout(o),i(s)})})}function bw(){let t=navigator.userAgent||"";return/Safari/.test(t)&&!/Chrome/.test(t)&&!/Chromium/.test(t)||/iPhone|iPad|iPod/i.test(t)&&(/(FBAV|FBAN|Instagram|Twitter|Line|WhatsApp)/i.test(t)||!window.safari?.pushNotificaTion)||/Macintosh/.test(t)&&/Safari/.test(t)&&!/Chrome/.test(t)&&!/Chromium/.test(t)&&!window.safari?.pushNotification?!0:ww()}function ww(){try{return window.safari?.pushNotification?window.safari.pushNotification.toString()==="[object SafariRemoteNotification]":!window.indexedDB||!window.localStorage}catch{return!0}}var ve=class t{static CURRENT;token;items=[];total_price=0;original_total_price=0;items_subtotal_price=0;currency;item_count=0;attributes;cart_level_discount_applications;total_discount=0;lock=new hc;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new t),this.CURRENT}async getNormalisedCartSilently(){try{return await this.getNormalisedCart()}catch(e){w.error("Failed to get the normalised cart",e)}}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Ke.set("cart",r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await Fp();if(this.attributes?.letscooee_did===e.letscooee_did&&this.attributes?.letscooee_sn===e.letscooee_sn){w.verbose("Not calling Shopify update.js API.","Current attributes:",this.attributes),this.lock.release();return}try{let r=await Yi("/cart/update.js",{attributes:e});w.verbose("Updated cart attributes",JSON.stringify(r.data)),this.update(r.data)}catch(r){w.error("Failed to add cart attributes",r)}this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.items_subtotal_price=e.items_subtotal_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,this.total_discount=e.total_discount,fe.get().currencyCode=this.currency,w.verbose("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,originalAmount:this.original_total_price/100,itemsSubtotalPrice:this.items_subtotal_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(e){if(!e)return w.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){w.warn("Invalid item received",n);continue}let i={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,finalPrice:+n.final_price/100||0,properties:n.properties,key:n.key},o=n.selling_plan_allocation?.selling_plan;if(!o){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:o.fixed_selling_plan,id:o.id,name:o.name,recurringDeliveries:o.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){w.verbose("Not fetching cart");return}w.verbose("Fetching cart");let r=mc("/cart.js");try{let n=(await Zr(r,{},{retries:2})).data;this.update(n)}catch(n){w.error("Unable to fetch the cart",n)}}};var yc=class{id;mID;handle;title;imageURL;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.handle=e.handle,this.title=e.title,this.imageURL=e.imageURL}};var lf=class{enabled;constructor(e){this.enabled=e.enabled}},uf=class extends lf{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max}},vc=class{productQuantity;constructor(e){e??={},this.productQuantity=new uf(e.productQuantity)}};var Xt=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new $n(e.bg)),e.br&&(this.br=new Jr(e.br)),e.shd&&(this.shd=new $o(e.shd)),e.spc&&(this.spc=new Qr(e.spc)),this.trf=new Vn(e.trf),this.clc=e.clc,this.w=e.w,this.h=e.h,this.x=e.x,this.y=e.y,this.a=e.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return ze[this.t]}get click(){return this.clc}},ze=(P=>(P[P.IMAGE=1]="IMAGE",P[P.TEXT=2]="TEXT",P[P.BUTTON=3]="BUTTON",P[P.FLEXBOX=4]="FLEXBOX",P[P.MULTI_COLUMN=5]="MULTI_COLUMN",P[P.CHECKBOX=6]="CHECKBOX",P[P.PRODUCTS=11]="PRODUCTS",P[P.PRODUCT=12]="PRODUCT",P[P.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",P[P.PRODUCT_TITLE=14]="PRODUCT_TITLE",P[P.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",P[P.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",P[P.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",P[P.PRODUCT_RATING=19]="PRODUCT_RATING",P[P.EMAIL_INPUT=51]="EMAIL_INPUT",P[P.PHONE_INPUT=52]="PHONE_INPUT",P[P.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",P[P.CAROUSEL=62]="CAROUSEL",P[P.SHAPE=100]="SHAPE",P))(ze||{});var ei=class extends Xt{constructor(e){super(e)}};var cn=class extends Xt{src;constructor(e){super(e),this.src=e.src}};var Fr=class extends Xt{typo;constructor(e){super(e);let r=_(_({},e.f),e.typo);e.alg&&(r.ta=e.alg),e.c&&(r.tc=e.c),this.typo=new ut(r)}get color(){return this.typography.tc}get typography(){return this.typo}};var Tn=class extends Fr{prs;constructor(e){super(e),this.prs=e.prs}get parts(){return this.prs}};var Ec=class extends Xt{o;constructor(e){super(e),this.o=e.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}};var qi=class{dd;hh;mm;ss;date;constructor(e){e??={},this.dd=e.dd??0,this.hh=e.hh??0,this.mm=e.mm??0,this.ss=e.ss??0,this.date=e.date?new Date(e.date):void 0}start(e,r){let n=new Date;e===2?(n.setSeconds(n.getSeconds()+this.ss),n.setMinutes(n.getMinutes()+this.mm),n.setHours(n.getHours()+this.hh),n.setDate(n.getDate()+this.dd)):n=this.date??new Date;let i=window.setInterval(()=>{let o=new Date().getTime(),s=n.getTime()-o;if(s<1){clearInterval(i);return}let a=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),p=Math.floor(s%(1e3*60*60)/(1e3*60)),d=Math.floor(s%(1e3*60)/1e3);r({days:a,hours:c,minutes:p,seconds:d})},1e3);return i}};var Ki=class extends Fr{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new qi(e.timer),this.show=e.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var _c=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new je(e.c??{})}get text(){return this.txt}get color(){return this.c}};var xn=class extends Fr{ph;constructor(e){super(e),this.ph=new _c(e.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var Xi=class extends xn{constructor(e){e??={},super(e)}};var Ji=class extends xn{};var Qi=class extends xn{};var Zi=class extends cn{};var bc=class{en;ex;constructor(e){e=e??{},this.en=e.en,this.ex=e.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}};var wc=15,us=class extends Xt{gvt;max;cover;anim;embedded;constructor(e){e=e??{},super(e),this.gvt=e.gvt??5,this.max=e.max,this.cover=e.cover??!0,this.anim=new bc(e.anim),this.spc||(this.spc=new Qr({pl:wc,pr:wc,pt:wc,pb:wc}))}};var Sc=class extends us{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new Ec(e.cont),this.mob=new us(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(r=>{r.t===1?this.elems.push(new cn(r)):r.t===2?this.elems.push(new Tn(r)):r.t===3?this.elems.push(new Tn(r)):r.t===100?this.elems.push(new ei(r)):r.t===51?this.elems.push(new Ji(r)):r.t===52?this.elems.push(new Qi(r)):r.t===61?this.elems.push(new Ki(r)):r.t===15||r.t===16?this.elems.push(new Xi(r)):r.t===13&&this.elems.push(new Zi(r))})}getStylesForWrapper(){if(this.cover)return{};let e;return this.gvt===1?e={top:0,left:0}:this.gvt===2?e={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?e={top:0,right:0}:this.gvt===6?e={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?e={bottom:0,right:0}:this.gvt===8?e={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?e={bottom:0,left:0}:this.gvt===4?e={top:"50%",left:0,transform:"translateY(-50%)"}:e={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},e.overflow="visible",e}getFlexStylesForContainer(){let e={display:"flex",flexDirection:"row"},r,n;return this.gvt===1?(r="flex-start",n="flex-start"):this.gvt===2?(r="center",n="flex-start"):this.gvt===3?(r="flex-end",n="flex-start"):this.gvt===4?(r="flex-start",n="center"):this.gvt===6?(r="flex-end",n="center"):this.gvt===7?(r="flex-start",n="flex-end"):this.gvt===8?(r="center",n="flex-end"):this.gvt===9?(r="flex-end",n="flex-end"):(r="center",n="center"),e.alignItems=n,e.justifyContent=r,e.overflow="visible",e}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim}};var eo=class{gap;dir;wrap;jc;ai;scroll;constructor(e){e??={},this.gap=e.gap??0,this.dir=e.dir??"row",this.wrap=e.wrap??"nowrap",this.jc=e.jc??"flex-start",this.ai=e.ai??"flex-start",this.scroll=e.scroll}};var Ic=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(e){e??={},this.of=e.of,this.disp=e.disp,this.pos=e.pos,this.top=e.top,this.bottom=e.bottom,this.left=e.left,this.right=e.right,this.zIndex=e.zIndex}};var Tc=class{w;h;maxW;maxH;minW;minH;constructor(e){e??={},this.w=e.w??"100%",this.h=e.h??"auto",this.maxW=e.maxW,this.maxH=e.maxH,this.minW=e.minW,this.minH=e.minH}};var xc=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new Qr(e.spc),e.size&&(this.size=new Tc(e.size)),e.bg&&(this.bg=new $n(e.bg)),e.br&&(this.br=new Jr(e.br)),e.typo&&(this.typo=new ut(e.typo)),e.lout&&(this.lout=new Ic(e.lout)),e.flex&&(this.flex=new eo(e.flex))}},to=class{sm;lg;constructor(e){e??={},this.sm=new xc(e.sm),this.lg=new xc(e.lg)}};var yt=class{t;style;hide;when;clc;l;constructor(e,r){r??={},this.t=e,this.style=new to(r.style),this.hide=r.hide,this.l=r.l,r.when?.op&&(this.when=r.when),r.clc&&(this.clc=r.clc)}get stringType(){return ze[this.t]}};var vt=class extends yt{text;constructor(e,r){e?.style?.lg?.typo?.s&&delete e.style.lg.typo.s,e?.style?.sm?.typo?.s&&delete e.style.sm.typo.s,super(r??2,e),e??={},this.text=e.text}};var ti=class extends vt{constructor(e,r){super(e,r??3)}};var ro=class extends yt{value;constructor(e){super(6,e),e??={},this.value=e.value}};var no=class extends vt{showChips;optionsConfig;constructor(e=15,r){super(r,e),r??={},this.showChips=r.showChips??!1,this.optionsConfig=r.optionsConfig??{}}};var Cc=class extends yt{c;iconSize;showSingleStar;fullStar;halfStart;constructor(e){super(19,e),e??={},this.c=new je(e.c),this.iconSize=e.iconSize??24,this.showSingleStar=e.showSingleStar??!1,this.fullStar=e.fullStar,this.halfStart=e.halfStart}};var hg=Rr(Ii());var Rc=class extends yt{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e)}update(e){e??={},this.slide=Jt.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new In(e.conf),this.allowedTypes=e.allowedTypes}};var Ac=class extends vt{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new qi(e.timer),this.show=e.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var Cn=class extends yt{elems;constructor(e){super(4,e),this.update(e)}update(e){e??={},this.elems??=[],e.elems?.forEach(r=>{let n=Jt.getParsedElement(r);n&&this.elems.push(n)})}};var ri=class extends yt{src;sm;lg;constructor(e,r){super(r??1,e),e&&this.update(e)}update(e){this.src=e.src,this.sm=e.sm,this.lg=e.lg}};var Jt=class t{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=t.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new vt(e);case 3:return new ti(e);case 6:return new ro(e);case 11:return new Dc(e);case 12:return new Rn(e);case 61:return new Ac(e);case 4:return new Cn(e);case 1:return new ri(e);case 13:return new ri(e,13);case 14:return new vt(e,14);case 15:case 16:return new no(e.t,e);case 18:return new ti(e,18);case 62:return new Rc(e);case 19:return new Cc(e);default:hg.default.error("Unknown element type",e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}};var Rn=class extends yt{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(e){if(e??={},super(12,e),this.show=e.show,this.elems=Jt.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new ro(e.cBox)),this.elems.push(new ri(e.img,13));let r=new vt(e.title,14);r.hide=!e.show?.title,r.text="{{ product.name }}",this.elems.push(r);let n=new vt(e.price);n.text="{{ product.price }}",n.hide=!e.show?.price;let i=new vt(e.compareAt);i.text="{{ product.compare_price }}",i.hide=!e.show?.price,e.compareAt||(i.style=new to(n.style),i.style.lg.typo=new ut(Z(_({},i.style.lg.typo),{td:"line-through"})),i.style.sm.typo=new ut(Z(_({},i.style.sm.typo),{td:"line-through"})));let o=new Cn({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Jt.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});o.elems.push(i),o.elems.push(n),this.elems.push(o);let s=new no(15,e.variantDD);if(s.hide=!e.show?.variantDD,this.elems.push(s),e.btn){let a=new ti(e.btn,18);a.hide=!e.show?.btn,this.elems.push(a)}}e.symbol&&(this.symbol=new vt(e.symbol))}};var Dc=class extends yt{conf;prod;constructor(e){super(11,e),e??={},this.conf=new pf(e.conf),this.prod=new Rn(e.prod)}};var Nc=class extends In{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems}},pf=class{lg;sm;constructor(e){e??={},this.lg=new Nc(e.lg),this.sm=new Nc(e.sm)}};var Oc=class extends Cn{constructor(e){super(e)}};var io=class{cont;elems=[];constructor(e){e=e??{},this.cont=new Oc(e.cont),e.elems?.forEach(r=>{this.addRawElement(r)})}addRawElement(e){let r=Jt.getParsedElement(e);return r&&this.elems.push(r),r}};function Pc(t,e){return Sw(t,e,0,5)}function Sw(t,e,r=0,n=50){if(e){if(r>n){console.warn("Maximum recursion depth reached in findFirstElementOfType");return}for(let i of e){if(i.t===t)return i;let o="elems"in i?i.elems:[];if(o?.length>0){let s=Pc(t,o);if(s)return s}}}}var ff=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(e){this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.delay=e.delay??0,this.redirectBehaviour=e.redirectBehaviour,this.onsiteDeliveryType=e.onsiteDeliveryType,this.objective=e.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===Bo.EXCLUSION}isABTesting(){return this.contentType===Bo.ABTESTING}isSingleContent(){return this.contentType===Bo.SINGLE}},ps=class{videoConfig;savingsBarConfig;afterDeleteJS;afterRenderJS;constructor(e){this.update(e)}update(e){e??={},e.videoConfig&&(this.videoConfig=new uc(e.videoConfig)),e.savingsBarConfig&&(this.savingsBarConfig=new la(e.savingsBarConfig)),e.afterDeleteJS&&(this.afterDeleteJS=e.afterDeleteJS),e.afterRenderJS&&(this.afterRenderJS=e.afterRenderJS)}},Tt=class extends ff{contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;entryAnimation;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;stickyATCConfig;bundleConfig;content;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;experimentConfig;discountData=sr({});constructor(e){super(e),this.id=e.id,this.currency=fe.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new io(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.entryAnimation=e.entryAnimation??"NONE",this.embeddedItems=e.embeddedItems?.map(r=>new Ct(r)),this.items=e.items?.map(r=>new At(r))??[],this.nonMutableItems=e.items?.map(r=>new At(r))??[],this.collections=e.collections?.map(r=>new yc(r))??[],this.discount=e.discount,this.placement=e.placement,this.customerData=e.customerData,this.ian=e.ian?this.processPopup(e.ian):void 0,this.promotionType=e.promotionType,this.manipulation=new vc(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,this.stickyATCConfig=e.stickyATCConfig,e.experimentConfig&&(this.experimentConfig=new sa(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new ca(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new na(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new At(e.bundleFrom)),e.content&&(this.content=new ps(e.content))}shouldDelay(){return this.delay>0}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===Er.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===ko.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===ko.PAGE_EMBED}isProgressBar(){return this.objective===Er.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===Er.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===Er.CART_RECOVERY}isProductPromotion(){return this.objective===Er.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===uu.COLLECTION}isBYOB(){return this.objective===Er.BYOB}isStickyATC(){return this.objective===Er.STICKY_ATC}isShoppableVideo(){return this.objective===Er.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===Er.SAVINGS_BAR}processPopup(e){let r=this.items[0],n={},i={};if(r){let a=r.selectedOrFirstVariant.value;n=Z(_(_({name:r.name,id:r.mID,link:r.link,vID:a.mID,image:r.variantImage},Mt("price",a.price.d)),Mt("comparePrice",a.price.cmp)),{quantity:r.quantity}),i={quantity:a.quantity}}let o={productCount:ve.getCurrent().item_count},s=Gi(JSON.stringify(e),{product:n,variant:i,cart:o,discount:this.discount,customer:this.customerData},new Ar(new Date,this));return r&&(s=s.replace(new RegExp("https://cdn.global.letscooee.com/images/placeholders/product.png","gi"),r.variantImage??r.firstImageURL)),new Sc(JSON.parse(s))}calculateDiscountData(e,r){let n=Xr.sum(e,s=>s.selectedOrFirstVariant.value.price.d),i=Xr.sum(e,s=>{let a=s.selectedOrFirstVariant.value.price;return a.cmp??a.d}),o={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(o);return}if(er.BXGY===this.discount.type&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,o.discountPercentage,!0),o.discountAmount=o.actualPrice-Xr.sum(e,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([er.UNIQUE_FLAT_ITEMS,er.STATIC,er.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],o.discountAmount=o.actualPrice*o.discountPercentage/100,this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===er.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)o.discountAmount=o.actualPrice-this.discount.values[0],o.discountPercentage=o.discountAmount/o.actualPrice*100,this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===er.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((a,c)=>c.selectedOrFirstVariant.value.price.d-a.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.effectivePrice.value=0,o.discountAmount=s.selectedOrFirstVariant.value.price.d,o.discountPercentage=o.discountAmount/o.actualPrice*100}o.discountedPrice=o.actualPrice-o.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(o)}getPrivateAttributesForLineItem(){return Je.get().skipItemAttribute?{}:{_via:"Cooee",_letscooee_campaign:this.shortID,_letscooee_content:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Je.get().skipItemAttribute?[]:[{key:"_via",value:"Cooee"},{key:"_letscooee_campaign",value:this.shortID},{key:"_letscooee_content",value:this.contentID}]}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){if(Pc(62,this.widget?.elems))return!0;let r=Pc(11,this.widget?.elems);return r?r.conf.lg.disp===2||r.conf.sm.disp===2:!1}toString(){let e;return this.onsiteDeliveryType===ko.POPUP?e="Popup":e=Nm.toTitle(this.objective),`${e}(id=${this.shortID})`}getCartMagicVariables(){let e=ve.getCurrent(),r=Xr.sum(e.items??[],n=>n.discounts?.reduce((i,o)=>i+(o.amount??0),0)??0);return _(_(_(_({productCount:e.item_count,product_count:e.item_count},Mt("amount",e.total_price/100)),Mt("originalAmount",e.original_total_price/100)),Mt("total_line_items_discount",r/100)),Mt("total_discount",e.total_discount/100))}shouldGetVariationImmediately(){return this.hasMultiplePlacement&&!this.isProgressBar()&&!this.isSavingsBar()}shouldSkipVariation(){return this.isSingleContent()||this.isProgressBar()||this.isSavingsBar()||!!this.widget}updateEffectivePrice(e,r,n=!1){let i=fe.get().getCurrentItem();e.forEach(o=>{let s=o.selectedOrFirstVariant.value,a=s.price;if(n&&o.mID===i.mID)s.effectivePrice.value=a.d;else{let c=a.d*r/100;s.effectivePrice.value=a.d-c}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:Dh(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{Object.assign(r,Mt(n,e[n]))}),r}};function Tw(t,e){return e={exports:{}},t(e,e.exports),e.exports}var xw=Dw,Cw=Ow,Rw=Mw,$r=[],cr=[],Aw=typeof Uint8Array<"u"?Uint8Array:Array,mf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ni=0,gg=mf.length;ni<gg;++ni)$r[ni]=mf[ni],cr[mf.charCodeAt(ni)]=ni;var ni,gg;cr[45]=62;cr[95]=63;function Og(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Dw(t){var e=Og(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Nw(t,e,r){return(e+r)*3/4-r}function Ow(t){var e,r=Og(t),n=r[0],i=r[1],o=new Aw(Nw(t,n,i)),s=0,a=i>0?n-4:n,c;for(c=0;c<a;c+=4)e=cr[t.charCodeAt(c)]<<18|cr[t.charCodeAt(c+1)]<<12|cr[t.charCodeAt(c+2)]<<6|cr[t.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=cr[t.charCodeAt(c)]<<2|cr[t.charCodeAt(c+1)]>>4,o[s++]=e&255),i===1&&(e=cr[t.charCodeAt(c)]<<10|cr[t.charCodeAt(c+1)]<<4|cr[t.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Pw(t){return $r[t>>18&63]+$r[t>>12&63]+$r[t>>6&63]+$r[t&63]}function Lw(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(Pw(n));return i.join("")}function Mw(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(Lw(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push($r[e>>2]+$r[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push($r[e>>10]+$r[e>>4&63]+$r[e<<2&63]+"=")),i.join("")}var df={byteLength:xw,toByteArray:Cw,fromByteArray:Rw};var Bw=function(e,r,n,i,o){var s,a,c=o*8-i-1,p=(1<<c)-1,d=p>>1,f=-7,E=n?o-1:0,y=n?-1:1,T=e[r+E];for(E+=y,s=T&(1<<-f)-1,T>>=-f,f+=c;f>0;s=s*256+e[r+E],E+=y,f-=8);for(a=s&(1<<-f)-1,s>>=-f,f+=i;f>0;a=a*256+e[r+E],E+=y,f-=8);if(s===0)s=1-d;else{if(s===p)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-d}return(T?-1:1)*a*Math.pow(2,s-i)},kw=function(e,r,n,i,o,s){var a,c,p,d=s*8-o-1,f=(1<<d)-1,E=f>>1,y=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=i?0:s-1,D=i?1:-1,N=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+E>=1?r+=y/p:r+=y*Math.pow(2,1-E),r*p>=2&&(a++,p/=2),a+E>=f?(c=0,a=f):a+E>=1?(c=(r*p-1)*Math.pow(2,o),a=a+E):(c=r*Math.pow(2,E-1)*Math.pow(2,o),a=0));o>=8;e[n+T]=c&255,T+=D,c/=256,o-=8);for(a=a<<o|c,d+=o;d>0;e[n+T]=a&255,T+=D,a/=256,d-=8);e[n+T-D]|=N*128},oo={read:Bw,write:kw},Bc=Tw(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=k,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=i(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var h=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(h,l),h.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(h){if(h>n)throw new RangeError('The value "'+h+'" is invalid for option "size"');var l=new Uint8Array(h);return Object.setPrototypeOf(l,s.prototype),l}function s(h,l,u){if(typeof h=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(h)}return a(h,l,u)}s.poolSize=8192;function a(h,l,u){if(typeof h=="string")return f(h,l);if(ArrayBuffer.isView(h))return y(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h));if(We(h,ArrayBuffer)||h&&We(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(We(h,SharedArrayBuffer)||h&&We(h.buffer,SharedArrayBuffer)))return T(h,l,u);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var v=h.valueOf&&h.valueOf();if(v!=null&&v!==h)return s.from(v,l,u);var C=D(h);if(C)return C;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return s.from(h[Symbol.toPrimitive]("string"),l,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h))}s.from=function(h,l,u){return a(h,l,u)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function c(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function p(h,l,u){return c(h),h<=0?o(h):l!==void 0?typeof u=="string"?o(h).fill(l,u):o(h).fill(l):o(h)}s.alloc=function(h,l,u){return p(h,l,u)};function d(h){return c(h),o(h<0?0:N(h)|0)}s.allocUnsafe=function(h){return d(h)},s.allocUnsafeSlow=function(h){return d(h)};function f(h,l){if((typeof l!="string"||l==="")&&(l="utf8"),!s.isEncoding(l))throw new TypeError("Unknown encoding: "+l);var u=G(h,l)|0,v=o(u),C=v.write(h,l);return C!==u&&(v=v.slice(0,C)),v}function E(h){for(var l=h.length<0?0:N(h.length)|0,u=o(l),v=0;v<l;v+=1)u[v]=h[v]&255;return u}function y(h){if(We(h,Uint8Array)){var l=new Uint8Array(h);return T(l.buffer,l.byteOffset,l.byteLength)}return E(h)}function T(h,l,u){if(l<0||h.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<l+(u||0))throw new RangeError('"length" is outside of buffer bounds');var v;return l===void 0&&u===void 0?v=new Uint8Array(h):u===void 0?v=new Uint8Array(h,l):v=new Uint8Array(h,l,u),Object.setPrototypeOf(v,s.prototype),v}function D(h){if(s.isBuffer(h)){var l=N(h.length)|0,u=o(l);return u.length===0||h.copy(u,0,0,l),u}if(h.length!==void 0)return typeof h.length!="number"||Ne(h.length)?o(0):E(h);if(h.type==="Buffer"&&Array.isArray(h.data))return E(h.data)}function N(h){if(h>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return h|0}function k(h){return+h!=h&&(h=0),s.alloc(+h)}s.isBuffer=function(l){return l!=null&&l._isBuffer===!0&&l!==s.prototype},s.compare=function(l,u){if(We(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),We(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(l)||!s.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(l===u)return 0;for(var v=l.length,C=u.length,O=0,W=Math.min(v,C);O<W;++O)if(l[O]!==u[O]){v=l[O],C=u[O];break}return v<C?-1:C<v?1:0},s.isEncoding=function(l){switch(String(l).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(l,u){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return s.alloc(0);var v;if(u===void 0)for(u=0,v=0;v<l.length;++v)u+=l[v].length;var C=s.allocUnsafe(u),O=0;for(v=0;v<l.length;++v){var W=l[v];if(We(W,Uint8Array))O+W.length>C.length?s.from(W).copy(C,O):Uint8Array.prototype.set.call(C,W,O);else if(s.isBuffer(W))W.copy(C,O);else throw new TypeError('"list" argument must be an Array of Buffers');O+=W.length}return C};function G(h,l){if(s.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||We(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(h));var u=h.length,v=arguments.length>2&&arguments[2]===!0;if(!v&&u===0)return 0;for(var C=!1;;)switch(l){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return wt(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return Ve(h).length;default:if(C)return v?-1:wt(h).length;l=(""+l).toLowerCase(),C=!0}}s.byteLength=G;function P(h,l,u){var v=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,l>>>=0,u<=l))return"";for(h||(h="utf8");;)switch(h){case"hex":return V(this,l,u);case"utf8":case"utf-8":return qe(this,l,u);case"ascii":return A(this,l,u);case"latin1":case"binary":return R(this,l,u);case"base64":return Ae(this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,l,u);default:if(v)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),v=!0}}s.prototype._isBuffer=!0;function Q(h,l,u){var v=h[l];h[l]=h[u],h[u]=v}s.prototype.swap16=function(){var l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<l;u+=2)Q(this,u,u+1);return this},s.prototype.swap32=function(){var l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<l;u+=4)Q(this,u,u+3),Q(this,u+1,u+2);return this},s.prototype.swap64=function(){var l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<l;u+=8)Q(this,u,u+7),Q(this,u+1,u+6),Q(this,u+2,u+5),Q(this,u+3,u+4);return this},s.prototype.toString=function(){var l=this.length;return l===0?"":arguments.length===0?qe(this,0,l):P.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(l){if(!s.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:s.compare(this,l)===0},s.prototype.inspect=function(){var l="",u=e.INSPECT_MAX_BYTES;return l=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(l+=" ... "),"<Buffer "+l+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(l,u,v,C,O){if(We(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),!s.isBuffer(l))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(l));if(u===void 0&&(u=0),v===void 0&&(v=l?l.length:0),C===void 0&&(C=0),O===void 0&&(O=this.length),u<0||v>l.length||C<0||O>this.length)throw new RangeError("out of range index");if(C>=O&&u>=v)return 0;if(C>=O)return-1;if(u>=v)return 1;if(u>>>=0,v>>>=0,C>>>=0,O>>>=0,this===l)return 0;for(var W=O-C,pe=v-u,be=Math.min(W,pe),ye=this.slice(C,O),ke=l.slice(u,v),He=0;He<be;++He)if(ye[He]!==ke[He]){W=ye[He],pe=ke[He];break}return W<pe?-1:pe<W?1:0};function _e(h,l,u,v,C){if(h.length===0)return-1;if(typeof u=="string"?(v=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,Ne(u)&&(u=C?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(C)return-1;u=h.length-1}else if(u<0)if(C)u=0;else return-1;if(typeof l=="string"&&(l=s.from(l,v)),s.isBuffer(l))return l.length===0?-1:X(h,l,u,v,C);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?C?Uint8Array.prototype.indexOf.call(h,l,u):Uint8Array.prototype.lastIndexOf.call(h,l,u):X(h,[l],u,v,C);throw new TypeError("val must be string, number or Buffer")}function X(h,l,u,v,C){var O=1,W=h.length,pe=l.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(h.length<2||l.length<2)return-1;O=2,W/=2,pe/=2,u/=2}function be(hr,qr){return O===1?hr[qr]:hr.readUInt16BE(qr*O)}var ye;if(C){var ke=-1;for(ye=u;ye<W;ye++)if(be(h,ye)===be(l,ke===-1?0:ye-ke)){if(ke===-1&&(ke=ye),ye-ke+1===pe)return ke*O}else ke!==-1&&(ye-=ye-ke),ke=-1}else for(u+pe>W&&(u=W-pe),ye=u;ye>=0;ye--){for(var He=!0,ot=0;ot<pe;ot++)if(be(h,ye+ot)!==be(l,ot)){He=!1;break}if(He)return ye}return-1}s.prototype.includes=function(l,u,v){return this.indexOf(l,u,v)!==-1},s.prototype.indexOf=function(l,u,v){return _e(this,l,u,v,!0)},s.prototype.lastIndexOf=function(l,u,v){return _e(this,l,u,v,!1)};function ce(h,l,u,v){u=Number(u)||0;var C=h.length-u;v?(v=Number(v),v>C&&(v=C)):v=C;var O=l.length;v>O/2&&(v=O/2);for(var W=0;W<v;++W){var pe=parseInt(l.substr(W*2,2),16);if(Ne(pe))return W;h[u+W]=pe}return W}function se(h,l,u,v){return De(wt(l,h.length-u),h,u,v)}function de(h,l,u,v){return De(lt(l),h,u,v)}function Be(h,l,u,v){return De(Ve(l),h,u,v)}function Te(h,l,u,v){return De(Se(l,h.length-u),h,u,v)}s.prototype.write=function(l,u,v,C){if(u===void 0)C="utf8",v=this.length,u=0;else if(v===void 0&&typeof u=="string")C=u,v=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(v)?(v=v>>>0,C===void 0&&(C="utf8")):(C=v,v=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var O=this.length-u;if((v===void 0||v>O)&&(v=O),l.length>0&&(v<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");C||(C="utf8");for(var W=!1;;)switch(C){case"hex":return ce(this,l,u,v);case"utf8":case"utf-8":return se(this,l,u,v);case"ascii":case"latin1":case"binary":return de(this,l,u,v);case"base64":return Be(this,l,u,v);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Te(this,l,u,v);default:if(W)throw new TypeError("Unknown encoding: "+C);C=(""+C).toLowerCase(),W=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ae(h,l,u){return l===0&&u===h.length?df.fromByteArray(h):df.fromByteArray(h.slice(l,u))}function qe(h,l,u){u=Math.min(h.length,u);for(var v=[],C=l;C<u;){var O=h[C],W=null,pe=O>239?4:O>223?3:O>191?2:1;if(C+pe<=u){var be,ye,ke,He;switch(pe){case 1:O<128&&(W=O);break;case 2:be=h[C+1],(be&192)===128&&(He=(O&31)<<6|be&63,He>127&&(W=He));break;case 3:be=h[C+1],ye=h[C+2],(be&192)===128&&(ye&192)===128&&(He=(O&15)<<12|(be&63)<<6|ye&63,He>2047&&(He<55296||He>57343)&&(W=He));break;case 4:be=h[C+1],ye=h[C+2],ke=h[C+3],(be&192)===128&&(ye&192)===128&&(ke&192)===128&&(He=(O&15)<<18|(be&63)<<12|(ye&63)<<6|ke&63,He>65535&&He<1114112&&(W=He))}}W===null?(W=65533,pe=1):W>65535&&(W-=65536,v.push(W>>>10&1023|55296),W=56320|W&1023),v.push(W),C+=pe}return kt(v)}var et=4096;function kt(h){var l=h.length;if(l<=et)return String.fromCharCode.apply(String,h);for(var u="",v=0;v<l;)u+=String.fromCharCode.apply(String,h.slice(v,v+=et));return u}function A(h,l,u){var v="";u=Math.min(h.length,u);for(var C=l;C<u;++C)v+=String.fromCharCode(h[C]&127);return v}function R(h,l,u){var v="";u=Math.min(h.length,u);for(var C=l;C<u;++C)v+=String.fromCharCode(h[C]);return v}function V(h,l,u){var v=h.length;(!l||l<0)&&(l=0),(!u||u<0||u>v)&&(u=v);for(var C="",O=l;O<u;++O)C+=Gt[h[O]];return C}function U(h,l,u){for(var v=h.slice(l,u),C="",O=0;O<v.length-1;O+=2)C+=String.fromCharCode(v[O]+v[O+1]*256);return C}s.prototype.slice=function(l,u){var v=this.length;l=~~l,u=u===void 0?v:~~u,l<0?(l+=v,l<0&&(l=0)):l>v&&(l=v),u<0?(u+=v,u<0&&(u=0)):u>v&&(u=v),u<l&&(u=l);var C=this.subarray(l,u);return Object.setPrototypeOf(C,s.prototype),C};function H(h,l,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+l>u)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(l,u,v){l=l>>>0,u=u>>>0,v||H(l,u,this.length);for(var C=this[l],O=1,W=0;++W<u&&(O*=256);)C+=this[l+W]*O;return C},s.prototype.readUintBE=s.prototype.readUIntBE=function(l,u,v){l=l>>>0,u=u>>>0,v||H(l,u,this.length);for(var C=this[l+--u],O=1;u>0&&(O*=256);)C+=this[l+--u]*O;return C},s.prototype.readUint8=s.prototype.readUInt8=function(l,u){return l=l>>>0,u||H(l,1,this.length),this[l]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(l,u){return l=l>>>0,u||H(l,2,this.length),this[l]|this[l+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(l,u){return l=l>>>0,u||H(l,2,this.length),this[l]<<8|this[l+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(l,u){return l=l>>>0,u||H(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(l,u){return l=l>>>0,u||H(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},s.prototype.readIntLE=function(l,u,v){l=l>>>0,u=u>>>0,v||H(l,u,this.length);for(var C=this[l],O=1,W=0;++W<u&&(O*=256);)C+=this[l+W]*O;return O*=128,C>=O&&(C-=Math.pow(2,8*u)),C},s.prototype.readIntBE=function(l,u,v){l=l>>>0,u=u>>>0,v||H(l,u,this.length);for(var C=u,O=1,W=this[l+--C];C>0&&(O*=256);)W+=this[l+--C]*O;return O*=128,W>=O&&(W-=Math.pow(2,8*u)),W},s.prototype.readInt8=function(l,u){return l=l>>>0,u||H(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},s.prototype.readInt16LE=function(l,u){l=l>>>0,u||H(l,2,this.length);var v=this[l]|this[l+1]<<8;return v&32768?v|4294901760:v},s.prototype.readInt16BE=function(l,u){l=l>>>0,u||H(l,2,this.length);var v=this[l+1]|this[l]<<8;return v&32768?v|4294901760:v},s.prototype.readInt32LE=function(l,u){return l=l>>>0,u||H(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},s.prototype.readInt32BE=function(l,u){return l=l>>>0,u||H(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},s.prototype.readFloatLE=function(l,u){return l=l>>>0,u||H(l,4,this.length),oo.read(this,l,!0,23,4)},s.prototype.readFloatBE=function(l,u){return l=l>>>0,u||H(l,4,this.length),oo.read(this,l,!1,23,4)},s.prototype.readDoubleLE=function(l,u){return l=l>>>0,u||H(l,8,this.length),oo.read(this,l,!0,52,8)},s.prototype.readDoubleBE=function(l,u){return l=l>>>0,u||H(l,8,this.length),oo.read(this,l,!1,52,8)};function ne(h,l,u,v,C,O){if(!s.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>C||l<O)throw new RangeError('"value" argument is out of bounds');if(u+v>h.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(l,u,v,C){if(l=+l,u=u>>>0,v=v>>>0,!C){var O=Math.pow(2,8*v)-1;ne(this,l,u,v,O,0)}var W=1,pe=0;for(this[u]=l&255;++pe<v&&(W*=256);)this[u+pe]=l/W&255;return u+v},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(l,u,v,C){if(l=+l,u=u>>>0,v=v>>>0,!C){var O=Math.pow(2,8*v)-1;ne(this,l,u,v,O,0)}var W=v-1,pe=1;for(this[u+W]=l&255;--W>=0&&(pe*=256);)this[u+W]=l/pe&255;return u+v},s.prototype.writeUint8=s.prototype.writeUInt8=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,1,255,0),this[u]=l&255,u+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,2,65535,0),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,2,65535,0),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,4,4294967295,0),this[u+3]=l>>>24,this[u+2]=l>>>16,this[u+1]=l>>>8,this[u]=l&255,u+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,4,4294967295,0),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4},s.prototype.writeIntLE=function(l,u,v,C){if(l=+l,u=u>>>0,!C){var O=Math.pow(2,8*v-1);ne(this,l,u,v,O-1,-O)}var W=0,pe=1,be=0;for(this[u]=l&255;++W<v&&(pe*=256);)l<0&&be===0&&this[u+W-1]!==0&&(be=1),this[u+W]=(l/pe>>0)-be&255;return u+v},s.prototype.writeIntBE=function(l,u,v,C){if(l=+l,u=u>>>0,!C){var O=Math.pow(2,8*v-1);ne(this,l,u,v,O-1,-O)}var W=v-1,pe=1,be=0;for(this[u+W]=l&255;--W>=0&&(pe*=256);)l<0&&be===0&&this[u+W+1]!==0&&(be=1),this[u+W]=(l/pe>>0)-be&255;return u+v},s.prototype.writeInt8=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,1,127,-128),l<0&&(l=255+l+1),this[u]=l&255,u+1},s.prototype.writeInt16LE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,2,32767,-32768),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeInt16BE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,2,32767,-32768),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeInt32LE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,4,2147483647,-2147483648),this[u]=l&255,this[u+1]=l>>>8,this[u+2]=l>>>16,this[u+3]=l>>>24,u+4},s.prototype.writeInt32BE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4};function ge(h,l,u,v,C,O){if(u+v>h.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function Xe(h,l,u,v,C){return l=+l,u=u>>>0,C||ge(h,l,u,4),oo.write(h,l,u,v,23,4),u+4}s.prototype.writeFloatLE=function(l,u,v){return Xe(this,l,u,!0,v)},s.prototype.writeFloatBE=function(l,u,v){return Xe(this,l,u,!1,v)};function nt(h,l,u,v,C){return l=+l,u=u>>>0,C||ge(h,l,u,8),oo.write(h,l,u,v,52,8),u+8}s.prototype.writeDoubleLE=function(l,u,v){return nt(this,l,u,!0,v)},s.prototype.writeDoubleBE=function(l,u,v){return nt(this,l,u,!1,v)},s.prototype.copy=function(l,u,v,C){if(!s.isBuffer(l))throw new TypeError("argument should be a Buffer");if(v||(v=0),!C&&C!==0&&(C=this.length),u>=l.length&&(u=l.length),u||(u=0),C>0&&C<v&&(C=v),C===v||l.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(v<0||v>=this.length)throw new RangeError("Index out of range");if(C<0)throw new RangeError("sourceEnd out of bounds");C>this.length&&(C=this.length),l.length-u<C-v&&(C=l.length-u+v);var O=C-v;return this===l&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,v,C):Uint8Array.prototype.set.call(l,this.subarray(v,C),u),O},s.prototype.fill=function(l,u,v,C){if(typeof l=="string"){if(typeof u=="string"?(C=u,u=0,v=this.length):typeof v=="string"&&(C=v,v=this.length),C!==void 0&&typeof C!="string")throw new TypeError("encoding must be a string");if(typeof C=="string"&&!s.isEncoding(C))throw new TypeError("Unknown encoding: "+C);if(l.length===1){var O=l.charCodeAt(0);(C==="utf8"&&O<128||C==="latin1")&&(l=O)}}else typeof l=="number"?l=l&255:typeof l=="boolean"&&(l=Number(l));if(u<0||this.length<u||this.length<v)throw new RangeError("Out of range index");if(v<=u)return this;u=u>>>0,v=v===void 0?this.length:v>>>0,l||(l=0);var W;if(typeof l=="number")for(W=u;W<v;++W)this[W]=l;else{var pe=s.isBuffer(l)?l:s.from(l,C),be=pe.length;if(be===0)throw new TypeError('The value "'+l+'" is invalid for argument "value"');for(W=0;W<v-u;++W)this[W+u]=pe[W%be]}return this};var it=/[^+/0-9A-Za-z-_]/g;function bt(h){if(h=h.split("=")[0],h=h.trim().replace(it,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function wt(h,l){l=l||1/0;for(var u,v=h.length,C=null,O=[],W=0;W<v;++W){if(u=h.charCodeAt(W),u>55295&&u<57344){if(!C){if(u>56319){(l-=3)>-1&&O.push(239,191,189);continue}else if(W+1===v){(l-=3)>-1&&O.push(239,191,189);continue}C=u;continue}if(u<56320){(l-=3)>-1&&O.push(239,191,189),C=u;continue}u=(C-55296<<10|u-56320)+65536}else C&&(l-=3)>-1&&O.push(239,191,189);if(C=null,u<128){if((l-=1)<0)break;O.push(u)}else if(u<2048){if((l-=2)<0)break;O.push(u>>6|192,u&63|128)}else if(u<65536){if((l-=3)<0)break;O.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((l-=4)<0)break;O.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return O}function lt(h){for(var l=[],u=0;u<h.length;++u)l.push(h.charCodeAt(u)&255);return l}function Se(h,l){for(var u,v,C,O=[],W=0;W<h.length&&!((l-=2)<0);++W)u=h.charCodeAt(W),v=u>>8,C=u%256,O.push(C),O.push(v);return O}function Ve(h){return df.toByteArray(bt(h))}function De(h,l,u,v){for(var C=0;C<v&&!(C+u>=l.length||C>=h.length);++C)l[C+u]=h[C];return C}function We(h,l){return h instanceof l||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===l.name}function Ne(h){return h!==h}var Gt=(function(){for(var h="0123456789abcdef",l=new Array(256),u=0;u<16;++u)for(var v=u*16,C=0;C<16;++C)l[v+C]=h[u]+h[C];return l})()}),Ce=Bc.Buffer;Bc.SlowBuffer;Bc.INSPECT_MAX_BYTES;Bc.kMaxLength;var Ef=function(e,r){return Ef=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},Ef(e,r)};function kc(t,e){Ef(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var oi=(function(t){kc(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e})(Error),Ze=(function(t){kc(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e})(TypeError);function Lc(t){return t&&t.Math==Math&&t}function Pg(){return Lc(typeof globalThis=="object"&&globalThis)||Lc(typeof window=="object"&&window)||Lc(typeof self=="object"&&self)||Lc(typeof global=="object"&&global)||Function("return this")()}function Uw(){var t=Pg();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var Fw=function(e){var r=Uw()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(r);for(var n=Ce.alloc(e),i=0;i<e;++i)n[i]=Math.floor(Math.random()*256);return n},Hw=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(Ce.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(Ce.alloc(e))}:Fw}},Lg=Hw();function $w(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function bf(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Vw(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Ww(t){return hs(t)&&Object.prototype.toString.call(t)==="[object Date]"}function hs(t){return typeof t=="object"&&t!==null}function Uc(t,e){var r=!1;function n(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function Mc(t){if(ArrayBuffer.isView(t))return Ce.from(t.buffer,t.byteOffset,t.byteLength);if($w(t))return Ce.from(t);throw new Ze("Must use either Buffer or TypedArray")}var jw=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,Mg=function(t){return typeof t=="string"&&jw.test(t)},_f=function(t){if(!Mg(t))throw new Ze('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return Ce.from(e,"hex")},yg=function(t,e){return e===void 0&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")};var WB=Math.pow(2,63)-1,jB=-Math.pow(2,63),Gw=Math.pow(2,53),zw=-Math.pow(2,53);var Bg=4;var si=(function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(e!=null&&typeof e!="string"&&!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer)&&!Array.isArray(e))throw new Ze("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=r??t.BSON_BINARY_SUBTYPE_DEFAULT,e==null?(this.buffer=Ce.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=Ce.from(e,"binary"):Array.isArray(e)?this.buffer=Ce.from(e):this.buffer=Mc(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new Ze("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new Ze("only accepts single character Uint8Array or Array");var r;if(typeof e=="string"?r=e.charCodeAt(0):typeof e=="number"?r=e:r=e[0],r<0||r>255)throw new Ze("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=Ce.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},t.prototype.write=function(e,r){if(r=typeof r=="number"?r:this.position,this.buffer.length<r+e.length){var n=Ce.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(Mc(e),r),this.position=r+e.byteLength>this.position?r+e.length:this.position):typeof e=="string"&&(this.buffer.write(e,r,e.length,"binary"),this.position=r+e.length>this.position?r+e.length:this.position)},t.prototype.read=function(e,r){return r=r&&r>0?r:this.position,this.buffer.slice(e,e+r)},t.prototype.value=function(e){return e=!!e,e&&this.buffer.length===this.position?this.buffer:e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(e){return this.buffer.toString(e)},t.prototype.toExtendedJSON=function(e){e=e||{};var r=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return e.legacy?{$binary:r,$type:n.length===1?"0"+n:n}:{$binary:{base64:r,subType:n.length===1?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new vg(this.buffer.slice(0,this.position));throw new oi('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,r){r=r||{};var n,i;if("$binary"in e?r.legacy&&typeof e.$binary=="string"&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,n=Ce.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=Ce.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=_f(e.$uuid)),!n)throw new Ze("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===Bg?new vg(n):new t(n,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t})();Object.defineProperty(si.prototype,"_bsontype",{value:"Binary"});var hf=16,vg=(function(t){kc(e,t);function e(r){var n=this,i,o;if(r==null)i=e.generate();else if(r instanceof e)i=Ce.from(r.buffer),o=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===hf)i=Mc(r);else if(typeof r=="string")i=_f(r);else throw new Ze("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");return n=t.call(this,i,Bg)||this,n.__id=o,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=yg(r))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(r){if(r===void 0&&(r=!0),e.cacheHexString&&this.__id)return this.__id;var n=yg(this.id,r);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(r){return r?this.id.toString(r):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(r){if(!r)return!1;if(r instanceof e)return r.id.equals(this.id);try{return new e(r).id.equals(this.id)}catch{return!1}},e.prototype.toBinary=function(){return new si(this.id,si.SUBTYPE_UUID)},e.generate=function(){var r=Lg(hf);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ce.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?Mg(r):bf(r)?r.length!==hf?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=_f(r);return new e(n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e})(si),Fc=(function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},t})();Object.defineProperty(Fc.prototype,"_bsontype",{value:"Code"});function Yw(t){return hs(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var ms=(function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var o=e.split(".");o.length===2&&(n=o.shift(),e=o.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t})();Object.defineProperty(ms.prototype,"_bsontype",{value:"DBRef"});var ar=void 0;try{ar=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}var Eg=65536,qw=1<<24,ao=Eg*Eg,kg=ao*ao,_g=kg/2,bg={},wg={},ie=(function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,o;return r?(e>>>=0,(o=0<=e&&e<256)&&(i=wg[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),o&&(wg[e]=n),n)):(e|=0,(o=-128<=e&&e<128)&&(i=bg[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),o&&(bg[e]=n),n))},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=kg)return t.MAX_UNSIGNED_VALUE}else{if(e<=-_g)return t.MIN_VALUE;if(e+1>=_g)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%ao|0,e/ao|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var o=t.fromNumber(Math.pow(n,8)),s=t.ZERO,a=0;a<e.length;a+=8){var c=Math.min(8,e.length-a),p=parseInt(e.substring(a,a+c),n);if(c<8){var d=t.fromNumber(Math.pow(n,c));s=s.mul(d).add(t.fromNumber(p))}else s=s.mul(o),s=s.add(t.fromNumber(p))}return s.unsigned=r,s},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(e){return hs(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,o=this.low&65535,s=e.high>>>16,a=e.high&65535,c=e.low>>>16,p=e.low&65535,d=0,f=0,E=0,y=0;return y+=o+p,E+=y>>>16,y&=65535,E+=i+c,f+=E>>>16,E&=65535,f+=n+a,d+=f>>>16,f&=65535,d+=r+s,d&=65535,t.fromBits(E<<16|y,d<<16|f,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(e){return this.compare(e)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(ar){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?ar.div_u:ar.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,ar.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var s=this.shr(1);return n=s.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),o=n.add(i.div(e)),o)}else if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:Math.pow(2,a-48),p=t.fromNumber(n),d=p.mul(e);d.isNegative()||d.gt(i);)n-=c,p=t.fromNumber(n,this.unsigned),d=p.mul(e);p.isZero()&&(p=t.ONE),o=o.add(p),i=i.sub(d)}return o},t.prototype.div=function(e){return this.divide(e)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),ar){var r=(this.unsigned?ar.rem_u:ar.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,ar.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(e){return this.modulo(e)},t.prototype.rem=function(e){return this.modulo(e)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),ar){var r=ar.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,ar.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,o=this.low>>>16,s=this.low&65535,a=e.high>>>16,c=e.high&65535,p=e.low>>>16,d=e.low&65535,f=0,E=0,y=0,T=0;return T+=s*d,y+=T>>>16,T&=65535,y+=o*d,E+=y>>>16,y&=65535,y+=s*p,E+=y>>>16,y&=65535,E+=i*d,f+=E>>>16,E&=65535,E+=o*p,f+=E>>>16,E&=65535,E+=s*c,f+=E>>>16,E&=65535,f+=n*d+i*p+o*c+s*a,f&=65535,t.fromBits(y<<16|T,f<<16|E,this.unsigned)},t.prototype.mul=function(e){return this.multiply(e)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(e){return!this.equals(e)},t.prototype.neq=function(e){return this.notEquals(e)},t.prototype.ne=function(e){return this.notEquals(e)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(e){return this.shiftLeft(e)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(e){return this.shiftRight(e)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),e&=63,e===0)return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}else return e===32?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},t.prototype.shru=function(e){return this.shiftRightUnsigned(e)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(e){return this.subtract(e)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*ao+(this.low>>>0):this.high*ao+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var c=s.div(o),p=s.sub(c.mul(o)).toInt()>>>0,d=p.toString(e);if(s=c,s.isZero())return d+a;for(;d.length<6;)d="0"+d;a=""+d+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(qw),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t})();Object.defineProperty(ie.prototype,"__isLong__",{value:!0});Object.defineProperty(ie.prototype,"_bsontype",{value:"Long"});var Kw=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Xw=/^(\+|-)?(Infinity|inf)$/i,Jw=/^(\+|-)?NaN$/i,fs=6111,gf=-6176,Sg=6176,Qw=34,yf=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ig=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Tg=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Zw=/^([-+])?(\d+)?$/,eS=31,xg=16383,tS=30,rS=31;function Cg(t){return!isNaN(parseInt(t,10))}function nS(t){var e=ie.fromNumber(1e9),r=ie.fromNumber(0);if(!t.parts[0]&&!t.parts[1]&&!t.parts[2]&&!t.parts[3])return{quotient:t,rem:r};for(var n=0;n<=3;n++)r=r.shiftLeft(32),r=r.add(new ie(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function iS(t,e){if(!t&&!e)return{high:ie.fromNumber(0),low:ie.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new ie(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new ie(e.getLowBits(),0),s=r.multiply(i),a=r.multiply(o),c=n.multiply(i),p=n.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new ie(a.getLowBits(),0).add(c).add(p.shiftRightUnsigned(32)),s=s.add(a.shiftRightUnsigned(32)),p=a.shiftLeft(32).add(new ie(p.getLowBits(),0)),{high:s,low:p}}function oS(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,o=e.low>>>0;if(i<o)return!0}return!1}function so(t,e){throw new Ze('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var wf=(function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(bf(e)){if(e.byteLength!==16)throw new Ze("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new Ze("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,o=0,s=0,a=0,c=0,p=0,d=[0],f=0,E=0,y=0,T=0,D=0,N=0,k=new ie(0,0),G=new ie(0,0),P=0,Q=0;if(e.length>=7e3)throw new Ze(""+e+" not a valid Decimal128 string");var _e=e.match(Kw),X=e.match(Xw),ce=e.match(Jw);if(!_e&&!X&&!ce||e.length===0)throw new Ze(""+e+" not a valid Decimal128 string");if(_e){var se=_e[2],de=_e[4],Be=_e[5],Te=_e[6];de&&Te===void 0&&so(e,"missing exponent power"),de&&se===void 0&&so(e,"missing exponent base"),de===void 0&&(Be||Te)&&so(e,"missing e before exponent")}if((e[Q]==="+"||e[Q]==="-")&&(r=e[Q++]==="-"),!Cg(e[Q])&&e[Q]!=="."){if(e[Q]==="i"||e[Q]==="I")return new t(Ce.from(r?Ig:Tg));if(e[Q]==="N")return new t(Ce.from(yf))}for(;Cg(e[Q])||e[Q]===".";){if(e[Q]==="."){n&&so(e,"contains multiple periods"),n=!0,Q=Q+1;continue}f<34&&(e[Q]!=="0"||i)&&(i||(p=s),i=!0,d[E++]=parseInt(e[Q],10),f=f+1),i&&(a=a+1),n&&(c=c+1),s=s+1,Q=Q+1}if(n&&!s)throw new Ze(""+e+" not a valid Decimal128 string");if(e[Q]==="e"||e[Q]==="E"){var Ae=e.substr(++Q).match(Zw);if(!Ae||!Ae[2])return new t(Ce.from(yf));D=parseInt(Ae[0],10),Q=Q+Ae[0].length}if(e[Q])return new t(Ce.from(yf));if(y=0,!f)y=0,T=0,d[0]=0,a=1,f=1,o=0;else if(T=f-1,o=a,o!==1)for(;d[p+o-1]===0;)o=o-1;for(D<=c&&c-D>16384?D=gf:D=D-c;D>fs;){if(T=T+1,T-y>Qw){var qe=d.join("");if(qe.match(/^0+$/)){D=fs;break}so(e,"overflow")}D=D-1}for(;D<gf||f<a;){if(T===0&&o<f){D=gf,o=0;break}if(f<a?a=a-1:T=T-1,D<fs)D=D+1;else{var qe=d.join("");if(qe.match(/^0+$/)){D=fs;break}so(e,"overflow")}}if(T-y+1<o){var et=s;n&&(p=p+1,et=et+1),r&&(p=p+1,et=et+1);var kt=parseInt(e[p+T+1],10),A=0;if(kt>=5&&(A=1,kt===5)){for(A=d[T]%2===1?1:0,N=p+T+2;N<et;N++)if(parseInt(e[N],10)){A=1;break}}if(A){for(var R=T;R>=0;R--)if(++d[R]>9&&(d[R]=0,R===0))if(D<fs)D=D+1,d[R]=1;else return new t(Ce.from(r?Ig:Tg))}}if(k=ie.fromNumber(0),G=ie.fromNumber(0),o===0)k=ie.fromNumber(0),G=ie.fromNumber(0);else if(T-y<17){var R=y;for(G=ie.fromNumber(d[R++]),k=new ie(0,0);R<=T;R++)G=G.multiply(ie.fromNumber(10)),G=G.add(ie.fromNumber(d[R]))}else{var R=y;for(k=ie.fromNumber(d[R++]);R<=T-17;R++)k=k.multiply(ie.fromNumber(10)),k=k.add(ie.fromNumber(d[R]));for(G=ie.fromNumber(d[R++]);R<=T;R++)G=G.multiply(ie.fromNumber(10)),G=G.add(ie.fromNumber(d[R]))}var V=iS(k,ie.fromString("100000000000000000"));V.low=V.low.add(G),oS(V.low,G)&&(V.high=V.high.add(ie.fromNumber(1))),P=D+Sg;var U={low:ie.fromNumber(0),high:ie.fromNumber(0)};V.high.shiftRightUnsigned(49).and(ie.fromNumber(1)).equals(ie.fromNumber(1))?(U.high=U.high.or(ie.fromNumber(3).shiftLeft(61)),U.high=U.high.or(ie.fromNumber(P).and(ie.fromNumber(16383).shiftLeft(47))),U.high=U.high.or(V.high.and(ie.fromNumber(0x7fffffffffff)))):(U.high=U.high.or(ie.fromNumber(P&16383).shiftLeft(49)),U.high=U.high.or(V.high.and(ie.fromNumber(562949953421311)))),U.low=V.low,r&&(U.high=U.high.or(ie.fromString("9223372036854775808")));var H=Ce.alloc(16);return Q=0,H[Q++]=U.low.low&255,H[Q++]=U.low.low>>8&255,H[Q++]=U.low.low>>16&255,H[Q++]=U.low.low>>24&255,H[Q++]=U.low.high&255,H[Q++]=U.low.high>>8&255,H[Q++]=U.low.high>>16&255,H[Q++]=U.low.high>>24&255,H[Q++]=U.high.low&255,H[Q++]=U.high.low>>8&255,H[Q++]=U.high.low>>16&255,H[Q++]=U.high.low>>24&255,H[Q++]=U.high.high&255,H[Q++]=U.high.high>>8&255,H[Q++]=U.high.high>>16&255,H[Q++]=U.high.high>>24&255,new t(H)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var o=0,s=!1,a,c={parts:[0,0,0,0]},p,d,f=[];o=0;var E=this.bytes,y=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,T=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,D=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,N=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24;o=0;var k={low:new ie(y,T),high:new ie(D,N)};k.high.lessThan(ie.ZERO)&&f.push("-");var G=N>>26&eS;if(G>>3===3){if(G===tS)return f.join("")+"Infinity";if(G===rS)return"NaN";e=N>>15&xg,a=8+(N>>14&1)}else a=N>>14&7,e=N>>17&xg;var P=e-Sg;if(c.parts[0]=(N&16383)+((a&15)<<14),c.parts[1]=D,c.parts[2]=T,c.parts[3]=y,c.parts[0]===0&&c.parts[1]===0&&c.parts[2]===0&&c.parts[3]===0)s=!0;else for(d=3;d>=0;d--){var Q=0,_e=nS(c);if(c=_e.quotient,Q=_e.rem.low,!!Q)for(p=8;p>=0;p--)n[d*9+p]=Q%10,Q=Math.floor(Q/10)}if(s)r=1,n[o]=0;else for(r=36;!n[o];)r=r-1,o=o+1;var X=r-1+P;if(X>=34||X<=-7||P>0){if(r>34)return f.push("".concat(0)),P>0?f.push("E+".concat(P)):P<0&&f.push("E".concat(P)),f.join("");f.push("".concat(n[o++])),r=r-1,r&&f.push(".");for(var i=0;i<r;i++)f.push("".concat(n[o++]));f.push("E"),X>0?f.push("+".concat(X)):f.push("".concat(X))}else if(P>=0)for(var i=0;i<r;i++)f.push("".concat(n[o++]));else{var ce=r+P;if(ce>0)for(var i=0;i<ce;i++)f.push("".concat(n[o++]));else f.push("0");for(f.push(".");ce++<0;)f.push("0");for(var i=0;i<r-Math.max(ce-1,0);i++)f.push("".concat(n[o++]))}return f.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t})();Object.defineProperty(wf.prototype,"_bsontype",{value:"Decimal128"});var Hc=(function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toExtendedJSON();return"new Double(".concat(e.$numberDouble,")")},t})();Object.defineProperty(Hc.prototype,"_bsontype",{value:"Double"});var $c=(function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e|0}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t})();Object.defineProperty($c.prototype,"_bsontype",{value:"Int32"});var Sf=(function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t})();Object.defineProperty(Sf.prototype,"_bsontype",{value:"MaxKey"});var If=(function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t})();Object.defineProperty(If.prototype,"_bsontype",{value:"MinKey"});var sS=new RegExp("^[0-9a-fA-F]{24}$"),ii=null,Hr=Symbol("id"),Et=(function(){function t(e){if(!(this instanceof t))return new t(e);var r;if(typeof e=="object"&&e&&"id"in e){if(typeof e.id!="string"&&!ArrayBuffer.isView(e.id))throw new Ze("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=Ce.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[Hr]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Hr]=r instanceof Ce?r:Mc(r);else if(typeof r=="string")if(r.length===12){var n=Ce.from(r);if(n.byteLength===12)this[Hr]=n;else throw new Ze("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&sS.test(r))this[Hr]=Ce.from(r,"hex");else throw new Ze("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Ze("Argument passed in does not match the accepted types");t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Hr]},set:function(e){this[Hr]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(e){this.id.writeUInt32BE(e,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){typeof e!="number"&&(e=Math.floor(Date.now()/1e3));var r=t.getInc(),n=Ce.alloc(12);return n.writeUInt32BE(e,0),ii===null&&(ii=Lg(5)),n[4]=ii[0],n[5]=ii[1],n[6]=ii[2],n[7]=ii[3],n[8]=ii[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(e==null)return!1;if(e instanceof t)return this[Hr][11]===e[Hr][11]&&this[Hr].equals(e[Hr]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&bf(this.id))return e===Ce.prototype.toString.call(this.id,"latin1");if(typeof e=="string"&&t.isValid(e)&&e.length===24)return e.toLowerCase()===this.toHexString();if(typeof e=="string"&&t.isValid(e)&&e.length===12)return Ce.from(e).equals(this.id);if(typeof e=="object"&&"toHexString"in e&&typeof e.toHexString=="function"){var r=e.toHexString(),n=this.toHexString().toLowerCase();return typeof r=="string"&&r.toLowerCase()===n}return!1},t.prototype.getTimestamp=function(){var e=new Date,r=this.id.readUInt32BE(0);return e.setTime(Math.floor(r)*1e3),e},t.createPk=function(){return new t},t.createFromTime=function(e){var r=Ce.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(typeof e>"u"||e!=null&&e.length!==24)throw new Ze("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(Ce.from(e,"hex"))},t.isValid=function(e){if(e==null)return!1;try{return new t(e),!0}catch{return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(Math.random()*16777215),t})();Object.defineProperty(Et.prototype,"generate",{value:Uc(function(t){return Et.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Et.prototype,"getInc",{value:Uc(function(){return Et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Et.prototype,"get_inc",{value:Uc(function(){return Et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Et,"get_inc",{value:Uc(function(){return Et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Et.prototype,"_bsontype",{value:"ObjectID"});function aS(t){return t.split("").sort().join("")}var ds=(function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=aS(r??""),this.pattern.indexOf("\0")!==-1)throw new oi("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new oi("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var n=0;n<this.options.length;n++)if(!(this.options[n]==="i"||this.options[n]==="m"||this.options[n]==="x"||this.options[n]==="l"||this.options[n]==="s"||this.options[n]==="u"))throw new oi("The regular expression option [".concat(this.options[n],"] is not supported"))}return t.parseOptions=function(e){return e?e.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(e){return e=e||{},e.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e)if(typeof e.$regex!="string"){if(e.$regex._bsontype==="BSONRegExp")return e}else return new t(e.$regex,t.parseOptions(e.$options));if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new Ze("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t})();Object.defineProperty(ds.prototype,"_bsontype",{value:"BSONRegExp"});var Tf=(function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t})();Object.defineProperty(Tf.prototype,"_bsontype",{value:"Symbol"});var cS=ie,Ug=(function(t){kc(e,t);function e(r,n){var i=this;return i instanceof e?(ie.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:hs(r)&&typeof r.t<"u"&&typeof r.i<"u"?i=t.call(this,r.i,r.t,!0)||this:i=t.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(r,n)}return e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(r){return new e(ie.fromInt(r,!0))},e.fromNumber=function(r){return new e(ie.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(ie.fromString(r,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(r){return new e(r.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},e.MAX_VALUE=ie.MAX_UNSIGNED_VALUE,e})(cS);function lS(t){return hs(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var Fg=2147483647,Hg=-2147483648,$g=9223372036854776e3,Vg=-9223372036854776e3,uS={$oid:Et,$binary:si,$uuid:si,$symbol:Tf,$numberInt:$c,$numberDecimal:wf,$numberDouble:Hc,$numberLong:ie,$minKey:If,$maxKey:Sf,$regex:ds,$regularExpression:ds,$timestamp:Ug};function Wg(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=Hg&&t<=Fg)return new $c(t);if(t>=Vg&&t<=$g)return ie.fromNumber(t)}return new Hc(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(f){return f.startsWith("$")&&t[f]!=null}),n=0;n<r.length;n++){var i=uS[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var o=t.$date,s=new Date;return e.legacy?typeof o=="number"?s.setTime(o):typeof o=="string"&&s.setTime(Date.parse(o)):typeof o=="string"?s.setTime(Date.parse(o)):ie.isLong(o)?s.setTime(o.toNumber()):typeof o=="number"&&e.relaxed&&s.setTime(o),s}if(t.$code!=null){var a=Object.assign({},t);return t.$scope&&(a.$scope=Wg(t.$scope)),Fc.fromExtendedJSON(t)}if(Yw(t)||t.$dbPointer){var c=t.$ref?t:t.$dbPointer;if(c instanceof ms)return c;var p=Object.keys(c).filter(function(f){return f.startsWith("$")}),d=!0;if(p.forEach(function(f){["$ref","$id","$db"].indexOf(f)===-1&&(d=!1)}),d)return ms.fromExtendedJSON(c)}return t}function pS(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return An(r,e)}finally{e.seenObjects.pop()}})}function Rg(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function An(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(k){return k.obj===t});if(r!==-1){var n=e.seenObjects.map(function(k){return k.propertyName}),i=n.slice(0,r).map(function(k){return"".concat(k," -> ")}).join(""),o=n[r],s=" -> "+n.slice(r+1,n.length-1).map(function(k){return"".concat(k," -> ")}).join(""),a=n[n.length-1],c=" ".repeat(i.length+o.length/2),p="-".repeat(s.length+(o.length+a.length)/2-1);throw new Ze(`Converting circular structure to EJSON:
|
|
30
|
+
`),typeof a=="string"||a instanceof Uint8Array)i(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(ir(a))}i(c)}}return typeof n=="string"?n:jE(n)}function jE(t){let e=t.reduce((i,o)=>i+o.length,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}function Sd(t){let e=typeof t.data=="string"?Ku(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}var GE={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Ju(t){return GE[t]}function Qu(t){if(!t?.sdk)return;let{name:e,version:r}=t.sdk;return{name:e,version:r}}function Id(t,e,r,n){let i=t.sdkProcessingMetadata?.dynamicSamplingContext;return _(_(_({event_id:t.event_id,sent_at:new Date().toISOString()},e&&{sdk:e}),!!r&&n&&{dsn:bn(n)}),i&&{trace:i})}function zE(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function Td(t,e,r,n){let i=Qu(r),o=_(_({sent_at:new Date().toISOString()},i&&{sdk:i}),!!n&&e&&{dsn:bn(e)}),s="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return on(o,[s])}function xd(t,e,r,n){let i=Qu(r),o=t.type&&t.type!=="replay_event"?t.type:"event";zE(t,r?.sdk);let s=Id(t,i,n,e);return delete t.sdkProcessingMetadata,on(s,[[{type:o},t]])}var Zu=0,Cd=1,Rd=2;function or(t){return new _r(e=>{e(t)})}function wn(t){return new _r((e,r)=>{r(t)})}var _r=class t{constructor(e){this._state=Zu,this._handlers=[],this._runExecutor(e)}then(e,r){return new t((n,i)=>{this._handlers.push([!1,o=>{if(!e)n(o);else try{n(e(o))}catch(s){i(s)}},o=>{if(!r)i(o);else try{n(r(o))}catch(s){i(s)}}]),this._executeHandlers()})}catch(e){return this.then(r=>r,e)}finally(e){return new t((r,n)=>{let i,o;return this.then(s=>{o=!1,i=s,e&&e()},s=>{o=!0,i=s,e&&e()}).then(()=>{if(o){n(i);return}r(i)})})}_executeHandlers(){if(this._state===Zu)return;let e=this._handlers.slice();this._handlers=[],e.forEach(r=>{r[0]||(this._state===Cd&&r[1](this._value),this._state===Rd&&r[2](this._value),r[0]=!0)})}_runExecutor(e){let r=(o,s)=>{if(this._state===Zu){if(rn(s)){s.then(n,i);return}this._state=o,this._value=s,this._executeHandlers()}},n=o=>{r(Cd,o)},i=o=>{r(Rd,o)};try{e(n,i)}catch(o){i(o)}}};function ba(t,e,r,n=0){return new _r((i,o)=>{let s=t[n];if(e===null||typeof s!="function")i(e);else{let a=s(_({},e),r);oe&&s.id&&a===null&&ee.log(`Event processor "${s.id}" dropped event`),rn(a)?a.then(c=>ba(t,c,r,n+1).then(i)).then(null,o):ba(t,a,r,n+1).then(i).then(null,o)}})}function Ad(t,e){let{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:o}=e;qE(t,e),n&&XE(t,n),JE(t,r),YE(t,i),KE(t,o)}function ep(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:p,eventProcessors:d,attachments:f,propagationContext:E,transactionName:y,span:T}=e;wa(t,"extra",r),wa(t,"tags",n),wa(t,"user",i),wa(t,"contexts",o),t.sdkProcessingMetadata=_n(t.sdkProcessingMetadata,a,2),s&&(t.level=s),y&&(t.transactionName=y),T&&(t.span=T),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),p.length&&(t.fingerprint=[...t.fingerprint,...p]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),f.length&&(t.attachments=[...t.attachments,...f]),t.propagationContext=_(_({},t.propagationContext),E)}function wa(t,e,r){t[e]=_n(t[e],r,1)}function qE(t,e){let{extra:r,tags:n,user:i,contexts:o,level:s,transactionName:a}=e;Object.keys(r).length&&(t.extra=_(_({},r),t.extra)),Object.keys(n).length&&(t.tags=_(_({},n),t.tags)),Object.keys(i).length&&(t.user=_(_({},i),t.user)),Object.keys(o).length&&(t.contexts=_(_({},o),t.contexts)),s&&(t.level=s),a&&t.type!=="transaction"&&(t.transaction=a)}function YE(t,e){let r=[...t.breadcrumbs||[],...e];t.breadcrumbs=r.length?r:void 0}function KE(t,e){t.sdkProcessingMetadata=_(_({},t.sdkProcessingMetadata),e)}function XE(t,e){t.contexts=_({trace:Gu(e)},t.contexts),t.sdkProcessingMetadata=_({dynamicSamplingContext:qu(e)},t.sdkProcessingMetadata);let r=Go(e),n=Pi(r).description;n&&!t.transaction&&t.type==="transaction"&&(t.transaction=n)}function JE(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}var Sa,Dd,Ia;function Nd(t){let e=pe._sentryDebugIds;if(!e)return{};let r=Object.keys(e);return Ia&&r.length===Dd||(Dd=r.length,Ia=r.reduce((n,i)=>{Sa||(Sa={});let o=Sa[i];if(o)n[o[0]]=o[1];else{let s=t(i);for(let a=s.length-1;a>=0;a--){let p=s[a]?.filename,d=e[i];if(p&&d){n[p]=d,Sa[i]=[p,d];break}}}return n},{})),Ia}function Od(t,e,r,n,i,o){let{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,c=Z(_({},e),{event_id:e.event_id||r.event_id||ft(),timestamp:e.timestamp||Nr()}),p=r.integrations||t.integrations.map(N=>N.name);QE(c,t),t_(c,p),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&ZE(c,t.stackParser);let d=n_(n,r.captureContext);r.mechanism&&Dr(c,r.mechanism);let f=i?i.getEventProcessors():[],E=ya().getScopeData();if(o){let N=o.getScopeData();ep(E,N)}if(d){let N=d.getScopeData();ep(E,N)}let y=[...r.attachments||[],...E.attachments];y.length&&(r.attachments=y),Ad(c,E);let T=[...f,...E.eventProcessors];return ba(T,c,r).then(N=>(N&&e_(N),typeof s=="number"&&s>0?r_(N,s,a):N))}function QE(t,e){let{environment:r,release:n,dist:i,maxValueLength:o=250}=e;t.environment=t.environment||r||Li,!t.release&&n&&(t.release=n),!t.dist&&i&&(t.dist=i);let s=t.request;s?.url&&(s.url=En(s.url,o))}function ZE(t,e){let r=Nd(e);t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=r[i.filename])})})}function e_(t){let e={};if(t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?e[i.abs_path]=i.debug_id:i.filename&&(e[i.filename]=i.debug_id),delete i.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let r=t.debug_meta.images;Object.entries(e).forEach(([n,i])=>{r.push({type:"sourcemap",code_file:n,debug_id:i})})}function t_(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function r_(t,e,r){if(!t)return null;let n=_(_(_(_(_({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(i=>_(_({},i),i.data&&{data:ir(i.data,e,r)}))}),t.user&&{user:ir(t.user,e,r)}),t.contexts&&{contexts:ir(t.contexts,e,r)}),t.extra&&{extra:ir(t.extra,e,r)});return t.contexts?.trace&&n.contexts&&(n.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(n.contexts.trace.data=ir(t.contexts.trace.data,e,r))),t.spans&&(n.spans=t.spans.map(i=>_(_({},i),i.data&&{data:ir(i.data,e,r)}))),t.contexts?.flags&&n.contexts&&(n.contexts.flags=ir(t.contexts.flags,3,r)),n}function n_(t,e){if(!e)return t;let r=t?t.clone():new It;return r.update(e),r}function Pd(t){if(t)return i_(t)?{captureContext:t}:s_(t)?{captureContext:t}:t}function i_(t){return t instanceof It||typeof t=="function"}var o_=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function s_(t){return Object.keys(t).some(e=>o_.includes(e))}function Ta(t,e){return Er().captureException(t,Pd(e))}function xa(t,e){let r=typeof e=="string"?e:void 0,n=typeof e!="string"?{captureContext:e}:void 0;return Er().captureMessage(t,r,n)}function zo(t,e){return Er().captureEvent(t,e)}function qo(t){let e=Or(),r=Er(),{userAgent:n}=pe.navigator||{},i=ed(_(_({user:r.getUser()||e.getUser()},n&&{userAgent:n}),t)),o=e.getSession();return o?.status==="ok"&&nn(o,{status:"exited"}),Ca(),e.setSession(i),i}function Ca(){let t=Or(),r=Er().getSession()||t.getSession();r&&td(r),Md(),t.setSession()}function Md(){let t=Or(),e=Ge(),r=t.getSession();r&&e&&e.captureSession(r)}function Yo(t=!1){if(t){Ca();return}Md()}var a_="7";function c_(t){let e=t.protocol?`${t.protocol}:`:"",r=t.port?`:${t.port}`:"";return`${e}//${t.host}${r}${t.path?`/${t.path}`:""}/api/`}function l_(t){return`${c_(t)}${t.projectId}/envelope/`}function u_(t,e){let r={sentry_version:a_};return t.publicKey&&(r.sentry_key=t.publicKey),e&&(r.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(r).toString()}function Bd(t,e,r){return e||`${l_(t)}?${u_(t,r)}`}var kd=[];function Ud(t,e){let r={};return e.forEach(n=>{n&&rp(t,n,r)}),r}function tp(t,e){for(let r of e)r?.afterAllSetup&&r.afterAllSetup(t)}function rp(t,e,r){if(r[e.name]){oe&&ee.log(`Integration skipped because it was already installed: ${e.name}`);return}if(r[e.name]=e,kd.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),kd.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,o)=>n(i,o,t))}if(typeof e.processEvent=="function"){let n=e.processEvent.bind(e),i=Object.assign((o,s)=>n(o,s,t),{id:e.name});t.addEventProcessor(i)}oe&&ee.log(`Integration installed: ${e.name}`)}function Fd(t,e,r){let n=[{type:"client_report"},{timestamp:r||Nr(),discarded_events:t}];return on(e?{dsn:e}:{},[n])}function Ra(t){let e=[];t.message&&e.push(t.message);try{let r=t.exception.values[t.exception.values.length-1];r?.value&&(e.push(r.value),r.type&&e.push(`${r.type}: ${r.value}`))}catch{}return e}function Hd(t){let{trace_id:e,parent_span_id:r,span_id:n,status:i,origin:o,data:s,op:a}=t.contexts?.trace??{};return{data:s??{},description:t.transaction,op:a,parent_span_id:r,span_id:n??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:o,profile_id:s?.[Wu],exclusive_time:s?.[ju],measurements:t.measurements,is_segment:!0}}function $d(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:_(_(_({},t.data),t.profile_id&&{[Wu]:t.profile_id}),t.exclusive_time&&{[ju]:t.exclusive_time})}},measurements:t.measurements}}var Vd="Not capturing exception because it's already been captured.",Wd="Discarded session because of missing or non-string release",zd=Symbol.for("SentryInternalError"),qd=Symbol.for("SentryDoNotSendEventError");function Aa(t){return{message:t,[zd]:!0}}function np(t){return{message:t,[qd]:!0}}function jd(t){return!!t&&typeof t=="object"&&zd in t}function Gd(t){return!!t&&typeof t=="object"&&qd in t}var Ko=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=vd(e.dsn):oe&&ee.warn("No DSN provided, client will not send events."),this._dsn){let r=Bd(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport(Z(_({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:r}))}}captureException(e,r,n){let i=ft();if(da(e))return oe&&ee.log(Vd),i;let o=_({event_id:i},r);return this._process(this.eventFromException(e,o).then(s=>this._captureEvent(s,o,n))),o.event_id}captureMessage(e,r,n,i){let o=_({event_id:ft()},n),s=Ai(e)?e:String(e),a=qn(e)?this.eventFromMessage(s,r,o):this.eventFromException(e,o);return this._process(a.then(c=>this._captureEvent(c,o,i))),o.event_id}captureEvent(e,r,n){let i=ft();if(r?.originalException&&da(r.originalException))return oe&&ee.log(Vd),i;let o=_({event_id:i},r),s=e.sdkProcessingMetadata||{},a=s.capturedSpanScope,c=s.capturedSpanIsolationScope;return this._process(this._captureEvent(e,o,a||n,c)),o.event_id}captureSession(e){this.sendSession(e),nn(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){let r=this._transport;return r?(this.emit("flush"),this._isClientDoneProcessing(e).then(n=>r.flush(e).then(i=>n&&i))):or(!0)}close(e){return this.flush(e).then(r=>(this.getOptions().enabled=!1,this.emit("close"),r))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let r=this._integrations[e.name];rp(this,e,this._integrations),r||tp(this,[e])}sendEvent(e,r={}){this.emit("beforeSendEvent",e,r);let n=xd(e,this._dsn,this._options._metadata,this._options.tunnel);for(let o of r.attachments||[])n=bd(n,Sd(o));let i=this.sendEnvelope(n);i&&i.then(o=>this.emit("afterSendEvent",e,o),null)}sendSession(e){let{release:r,environment:n=Li}=this._options;if("aggregates"in e){let o=e.attrs||{};if(!o.release&&!r){oe&&ee.warn(Wd);return}o.release=o.release||r,o.environment=o.environment||n,e.attrs=o}else{if(!e.release&&!r){oe&&ee.warn(Wd);return}e.release=e.release||r,e.environment=e.environment||n}this.emit("beforeSendSession",e);let i=Td(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(e,r,n=1){if(this._options.sendClientReports){let i=`${e}:${r}`;oe&&ee.log(`Recording outcome: "${i}"${n>1?` (${n} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+n}}on(e,r){let n=this._hooks[e]=this._hooks[e]||[];return n.push(r),()=>{let i=n.indexOf(r);i>-1&&n.splice(i,1)}}emit(e,...r){let n=this._hooks[e];n&&n.forEach(i=>i(...r))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,r=>(oe&&ee.error("Error while sending envelope:",r),r)):(oe&&ee.error("Transport disabled"),or({}))}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=Ud(this,e),tp(this,e)}_updateSessionFromEvent(e,r){let n=r.level==="fatal",i=!1,o=r.exception?.values;if(o){i=!0;for(let c of o)if(c.mechanism?.handled===!1){n=!0;break}}let s=e.status==="ok";(s&&e.errors===0||s&&n)&&(nn(e,Z(_({},n&&{status:"crashed"}),{errors:e.errors||Number(i||n)})),this.captureSession(e))}_isClientDoneProcessing(e){return new _r(r=>{let n=0,i=1,o=setInterval(()=>{this._numProcessing==0?(clearInterval(o),r(!0)):(n+=i,e&&n>=e&&(clearInterval(o),r(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,r,n,i){let o=this.getOptions(),s=Object.keys(this._integrations);return!r.integrations&&s?.length&&(r.integrations=s),this.emit("preprocessEvent",e,r),e.type||i.setLastEventId(e.event_id||r.event_id),Od(o,e,r,n,this,i).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,r),a.contexts=_({trace:Fu(n)},a.contexts);let c=_d(this,n);return a.sdkProcessingMetadata=_({dynamicSamplingContext:c},a.sdkProcessingMetadata),a})}_captureEvent(e,r={},n=Er(),i=Or()){return oe&&ip(e)&&ee.log(`Captured error event \`${Ra(e)[0]||"<unknown>"}\``),this._processEvent(e,r,n,i).then(o=>o.event_id,o=>{oe&&(Gd(o)?ee.log(o.message):jd(o)?ee.warn(o.message):ee.warn(o))})}_processEvent(e,r,n,i){let o=this.getOptions(),{sampleRate:s}=o,a=Yd(e),c=ip(e),p=e.type||"error",d=`before send for type \`${p}\``,f=typeof s>"u"?void 0:ld(s);if(c&&typeof f=="number"&&Math.random()>f)return this.recordDroppedEvent("sample_rate","error"),wn(np(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));let E=p==="replay_event"?"replay":p;return this._prepareEvent(e,r,n,i).then(y=>{if(y===null)throw this.recordDroppedEvent("event_processor",E),np("An event processor returned `null`, will not send event.");if(r.data&&r.data.__sentry__===!0)return y;let D=m_(this,o,y,r);return f_(D,d)}).then(y=>{if(y===null){if(this.recordDroppedEvent("before_send",E),a){let k=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",k)}throw np(`${d} returned \`null\`, will not send event.`)}let T=n.getSession()||i.getSession();if(c&&T&&this._updateSessionFromEvent(T,y),a){let N=y.sdkProcessingMetadata?.spanCountBeforeProcessing||0,k=y.spans?y.spans.length:0,G=N-k;G>0&&this.recordDroppedEvent("before_send","span",G)}let D=y.transaction_info;if(a&&D&&y.transaction!==e.transaction){let N="custom";y.transaction_info=Z(_({},D),{source:N})}return this.sendEvent(y,r),y}).then(null,y=>{throw Gd(y)||jd(y)?y:(this.captureException(y,{data:{__sentry__:!0},originalException:y}),Aa(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
31
|
+
Reason: ${y}`))})}_process(e){this._numProcessing++,e.then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([r,n])=>{let[i,o]=r.split(":");return{reason:i,category:o,quantity:n}})}_flushOutcomes(){oe&&ee.log("Flushing outcomes...");let e=this._clearOutcomes();if(e.length===0){oe&&ee.log("No outcomes to send");return}if(!this._dsn){oe&&ee.log("No dsn provided, will not send outcomes");return}oe&&ee.log("Sending outcomes:",e);let r=Fd(e,this._options.tunnel&&bn(this._dsn));this.sendEnvelope(r)}};function f_(t,e){let r=`${e} must return \`null\` or a valid event.`;if(rn(t))return t.then(n=>{if(!tn(n)&&n!==null)throw Aa(r);return n},n=>{throw Aa(`${e} rejected with ${n}`)});if(!tn(t)&&t!==null)throw Aa(r);return t}function m_(t,e,r,n){let{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s}=e,a=r;if(ip(a)&&i)return i(a,n);if(Yd(a)){if(s){let c=s(Hd(a));if(c?a=_n(r,$d(c)):zu(),a.spans){let p=[];for(let d of a.spans){let f=s(d);f?p.push(f):(zu(),p.push(d))}a.spans=p}}if(o){if(a.spans){let c=a.spans.length;a.sdkProcessingMetadata=Z(_({},r.sdkProcessingMetadata),{spanCountBeforeProcessing:c})}return o(a,n)}}return a}function ip(t){return t.type===void 0}function Yd(t){return t.type==="transaction"}function d_(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function Kd(t,e,r,n){let i={};return e?.sdk&&(i.sdk={name:e.sdk.name,version:e.sdk.version}),r&&n&&(i.dsn=bn(n)),on(i,[d_(t)])}function Xo(t,e){let r=e??h_(t)??[];if(r.length===0)return;let n=t.getOptions(),i=Kd(r,n._metadata,n.tunnel,t.getDsn());Xd().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(i)}function h_(t){return Xd().get(t)}function Xd(){return en("clientToLogBufferMap",()=>new WeakMap)}var op=Symbol.for("SentryBufferFullError");function Jd(t){let e=[];function r(){return t===void 0||e.length<t}function n(s){return e.splice(e.indexOf(s),1)[0]||Promise.resolve(void 0)}function i(s){if(!r())return wn(op);let a=s();return e.indexOf(a)===-1&&e.push(a),a.then(()=>n(a)).then(null,()=>n(a).then(null,()=>{})),a}function o(s){return new _r((a,c)=>{let p=e.length;if(!p)return a(!0);let d=setTimeout(()=>{s&&s>0&&a(!1)},s);e.forEach(f=>{or(f).then(()=>{--p||(clearTimeout(d),a(!0))},c)})})}return{$:e,add:i,drain:o}}function g_(t,e=Date.now()){let r=parseInt(`${t}`,10);if(!isNaN(r))return r*1e3;let n=Date.parse(`${t}`);return isNaN(n)?6e4:n-e}function y_(t,e){return t[e]||t.all||0}function Qd(t,e,r=Date.now()){return y_(t,e)>r}function Zd(t,{statusCode:e,headers:r},n=Date.now()){let i=_({},t),o=r?.["x-sentry-rate-limits"],s=r?.["retry-after"];if(o)for(let a of o.trim().split(",")){let[c,p,,,d]=a.split(":",5),f=parseInt(c,10),E=(isNaN(f)?60:f)*1e3;if(!p)i.all=n+E;else for(let y of p.split(";"))y==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(i[y]=n+E):i[y]=n+E}else s?i.all=n+g_(s,n):e===429&&(i.all=n+60*1e3);return i}var v_=64;function Da(t,e,r=Jd(t.bufferSize||v_)){let n={},i=s=>r.drain(s);function o(s){let a=[];if(Xu(s,(f,E)=>{let y=Ju(E);Qd(n,y)?t.recordDroppedEvent("ratelimit_backoff",y):a.push(f)}),a.length===0)return or({});let c=on(s[0],a),p=f=>{Xu(c,(E,y)=>{t.recordDroppedEvent(f,Ju(y))})},d=()=>e({body:wd(c)}).then(f=>(f.statusCode!==void 0&&(f.statusCode<200||f.statusCode>=300)&&oe&&ee.warn(`Sentry responded with status code ${f.statusCode} to sent event.`),n=Zd(n,f),f),f=>{throw p("network_error"),oe&&ee.error("Encountered error running transport request:",f),f});return r.add(d).then(f=>f,f=>{if(f===op)return oe&&ee.error("Skipped sending event because buffer is full."),p("queue_overflow"),or({});throw f})}return{send:o,flush:i}}function sp(t){t.user?.ip_address===void 0&&(t.user=Z(_({},t.user),{ip_address:"{{auto}}"}))}function ap(t){"aggregates"in t?t.attrs?.ip_address===void 0&&(t.attrs=Z(_({},t.attrs),{ip_address:"{{auto}}"})):t.ipAddress===void 0&&(t.ipAddress="{{auto}}")}function cp(t,e,r=[e],n="npm"){let i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:r.map(o=>({name:`${n}:@sentry/${o}`,version:Rr})),version:Rr}),t._metadata=i}var E_=100;function Pr(t,e){let r=Ge(),n=Or();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:o=E_}=r.getOptions();if(o<=0)return;let s=Nr(),a=_({timestamp:s},t),c=i?vn(()=>i(a,e)):a;c!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",c,e),n.addBreadcrumb(c,o))}var eh,__="FunctionToString",th=new WeakMap,b_=()=>({name:__,setupOnce(){eh=Function.prototype.toString;try{Function.prototype.toString=function(...t){let e=Kn(this),r=th.has(Ge())&&e!==void 0?e:this;return eh.apply(r,t)}}catch{}},setup(t){th.set(t,!0)}}),Na=b_;var w_=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],S_="EventFilters",lp=(t={})=>{let e;return{name:S_,setup(r){let n=r.getOptions();e=rh(t,n)},processEvent(r,n,i){if(!e){let o=i.getOptions();e=rh(t,o)}return I_(r,e)?null:r}}},Pa=(t={})=>Z(_({},lp(t)),{name:"InboundFilters"});function rh(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:w_],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function I_(t,e){if(t.type){if(t.type==="transaction"&&x_(t,e.ignoreTransactions))return oe&&ee.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
32
|
+
Event: ${Ar(t)}`),!0}else{if(T_(t,e.ignoreErrors))return oe&&ee.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
33
|
+
Event: ${Ar(t)}`),!0;if(D_(t))return oe&&ee.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
34
|
+
Event: ${Ar(t)}`),!0;if(C_(t,e.denyUrls))return oe&&ee.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
35
|
+
Event: ${Ar(t)}.
|
|
36
|
+
Url: ${Oa(t)}`),!0;if(!R_(t,e.allowUrls))return oe&&ee.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
37
|
+
Event: ${Ar(t)}.
|
|
38
|
+
Url: ${Oa(t)}`),!0}return!1}function T_(t,e){return e?.length?Ra(t).some(r=>Di(r,e)):!1}function x_(t,e){if(!e?.length)return!1;let r=t.transaction;return r?Di(r,e):!1}function C_(t,e){if(!e?.length)return!1;let r=Oa(t);return r?Di(r,e):!1}function R_(t,e){if(!e?.length)return!0;let r=Oa(t);return r?Di(r,e):!0}function A_(t=[]){for(let e=t.length-1;e>=0;e--){let r=t[e];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function Oa(t){try{let r=[...t.exception?.values??[]].reverse().find(n=>n.mechanism?.parent_id===void 0&&n.stacktrace?.frames?.length)?.stacktrace?.frames;return r?A_(r):null}catch{return oe&&ee.error(`Cannot extract url for event ${Ar(t)}`),null}}function D_(t){return t.exception?.values?.length?!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value):!1}function pp(t,e,r,n,i,o){if(!i.exception?.values||!o||!vr(o.originalException,Error))return;let s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=up(t,e,n,o.originalException,r,i.exception.values,s,0))}function up(t,e,r,n,i,o,s,a){if(o.length>=r+1)return o;let c=[...o];if(vr(n[i],Error)){nh(s,a);let p=t(e,n[i]),d=c.length;ih(p,i,d,a),c=up(t,e,r,n[i],i,[p,...c],p,d)}return Array.isArray(n.errors)&&n.errors.forEach((p,d)=>{if(vr(p,Error)){nh(s,a);let f=t(e,p),E=c.length;ih(f,`errors[${d}]`,E,a),c=up(t,e,r,p,i,[f,...c],f,E)}}),c}function nh(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(_(_({},t.mechanism),t.type==="AggregateError"&&{is_exception_group:!0}),{exception_id:e})}function ih(t,e,r,n){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism=Z(_({},t.mechanism),{type:"chained",source:e,exception_id:r,parent_id:n})}function fp(t){let e="console";Lt(e,t),Mt(e,N_)}function N_(){"console"in pe&&vu.forEach(function(t){t in pe.console&&pt(pe.console,t,function(e){return Ci[t]=e,function(...r){ut("console",{args:r,level:t}),Ci[t]?.apply(pe.console,r)}})})}function mp(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}var O_="Dedupe",P_=()=>{let t;return{name:O_,processEvent(e){if(e.type)return e;try{if(L_(e,t))return oe&&ee.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},La=P_;function L_(t,e){return e?!!(M_(t,e)||B_(t,e)):!1}function M_(t,e){let r=t.message,n=e.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!ah(t,e)||!sh(t,e))}function B_(t,e){let r=oh(e),n=oh(t);return!(!r||!n||r.type!==n.type||r.value!==n.value||!ah(t,e)||!sh(t,e))}function sh(t,e){let r=aa(t),n=aa(e);if(!r&&!n)return!0;if(r&&!n||!r&&n||(r=r,n=n,n.length!==r.length))return!1;for(let i=0;i<n.length;i++){let o=n[i],s=r[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function ah(t,e){let r=t.fingerprint,n=e.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;r=r,n=n;try{return r.join("")===n.join("")}catch{return!1}}function oh(t){return t.exception?.values?.[0]}function Jo(t){if(!t)return{};let e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};let r=e[6]||"",n=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:r,hash:n,relative:e[5]+r+n}}function Ma(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}var Qo=pe;function dp(){return"history"in Qo&&!!Qo.history}function k_(){if(!("fetch"in Qo))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function Zo(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function hp(){if(typeof EdgeRuntime=="string")return!0;if(!k_())return!1;if(Zo(Qo.fetch))return!0;let t=!1,e=Qo.document;if(e&&typeof e.createElement=="function")try{let r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),r.contentWindow?.fetch&&(t=Zo(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){oe&&ee.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function yp(t,e){let r="fetch";Lt(r,t),Mt(r,()=>U_(void 0,e))}function U_(t,e=!1){e&&!hp()||pt(pe,"fetch",function(r){return function(...n){let i=new Error,{method:o,url:s}=F_(n),a={args:n,fetchData:{method:o,url:s},startTimestamp:Ht()*1e3,virtualError:i,headers:H_(n)};return t||ut("fetch",_({},a)),r.apply(pe,n).then(async c=>(t?t(c):ut("fetch",Z(_({},a),{endTimestamp:Ht()*1e3,response:c})),c),c=>{if(ut("fetch",Z(_({},a),{endTimestamp:Ht()*1e3,error:c})),zn(c)&&c.stack===void 0&&(c.stack=i.stack,qt(c,"framesToPop",1)),c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{let p=new URL(a.fetchData.url);c.message=`${c.message} (${p.host})`}catch{}throw c})}})}function gp(t,e){return!!t&&typeof t=="object"&&!!t[e]}function ch(t){return typeof t=="string"?t:t?gp(t,"url")?t.url:t.toString?t.toString():"":""}function F_(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){let[r,n]=t;return{url:ch(r),method:gp(n,"method")?String(n.method).toUpperCase():"GET"}}let e=t[0];return{url:ch(e),method:gp(e,"method")?String(e.method).toUpperCase():"GET"}}function H_(t){let[e,r]=t;try{if(typeof r=="object"&&r!==null&&"headers"in r&&r.headers)return new Headers(r.headers);if(qm(e))return new Headers(e.headers)}catch{}}function vp(){return"npm"}var Je=pe,Ep=0;function _p(){return Ep>0}function eb(){Ep++,setTimeout(()=>{Ep--})}function Xn(t,e={}){function r(i){return typeof i=="function"}if(!r(t))return t;try{let i=t.__sentry_wrapped__;if(i)return typeof i=="function"?i:t;if(Kn(t))return t}catch{return t}let n=function(...i){try{let o=i.map(s=>Xn(s,e));return t.apply(this,o)}catch(o){throw eb(),jo(s=>{s.addEventProcessor(a=>(e.mechanism&&(Ni(a,void 0,void 0),Dr(a,e.mechanism)),a.extra=Z(_({},a.extra),{arguments:i}),a)),Ta(o)}),o}};try{for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}catch{}fa(n,t),qt(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get(){return t.name}})}catch{}return n}function lh(){let t=Wo(),{referrer:e}=Je.document||{},{userAgent:r}=Je.navigator||{},n=_(_({},e&&{Referer:e}),r&&{"User-Agent":r});return{url:t,headers:n}}function Ba(t,e){let r=Sp(t,e),n={type:ob(e),value:sb(e)};return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function tb(t,e,r,n){let o=Ge()?.getOptions().normalizeDepth,s=lb(e),a={__serialized__:_a(e,o)};if(s)return{exception:{values:[Ba(t,s)]},extra:a};let c={exception:{values:[{type:Yn(e)?e.constructor.name:n?"UnhandledRejection":"Error",value:ab(e,{isUnhandledRejection:n})}]},extra:a};if(r){let p=Sp(t,r);p.length&&(c.exception.values[0].stacktrace={frames:p})}return c}function bp(t,e){return{exception:{values:[Ba(t,e)]}}}function Sp(t,e){let r=e.stacktrace||e.stack||"",n=nb(e),i=ib(e);try{return t(r,n,i)}catch{}return[]}var rb=/Minified React error #\d+;/i;function nb(t){return t&&rb.test(t.message)?1:0}function ib(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function uh(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function ob(t){let e=t?.name;return!e&&uh(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function sb(t){let e=t?.message;return uh(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function ph(t,e,r,n){let i=r?.syntheticException||void 0,o=ka(t,e,i,n);return Dr(o),o.level="error",r?.event_id&&(o.event_id=r.event_id),or(o)}function fh(t,e,r="info",n,i){let o=n?.syntheticException||void 0,s=wp(t,e,o,i);return s.level=r,n?.event_id&&(s.event_id=n.event_id),or(s)}function ka(t,e,r,n,i){let o;if(la(e)&&e.error)return bp(t,e.error);if(ua(e)||Cu(e)){let s=e;if("stack"in e)o=bp(t,e);else{let a=s.name||(ua(s)?"DOMError":"DOMException"),c=s.message?`${a}: ${s.message}`:a;o=wp(t,c,r,n),Ni(o,c)}return"code"in s&&(o.tags=Z(_({},o.tags),{"DOMException.code":`${s.code}`})),o}return zn(e)?bp(t,e):tn(e)||Yn(e)?(o=tb(t,e,r,i),Dr(o,{synthetic:!0}),o):(o=wp(t,e,r,n),Ni(o,`${e}`,void 0),Dr(o,{synthetic:!0}),o)}function wp(t,e,r,n){let i={};if(n&&r){let o=Sp(t,r);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]}),Dr(i,{synthetic:!0})}if(Ai(e)){let{__sentry_template_string__:o,__sentry_template_values__:s}=e;return i.logentry={message:o,params:s},i}return i.message=e,i}function ab(t,{isUnhandledRejection:e}){let r=Pu(t),n=e?"promise rejection":"exception";return la(t)?`Event \`ErrorEvent\` captured as ${n} with message \`${t.message}\``:Yn(t)?`Event \`${cb(t)}\` (type=${t.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}function cb(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function lb(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];if(r instanceof Error)return r}}var ub=5e3,es=class extends Ko{constructor(e){let r=pb(e),n=Je.SENTRY_SDK_SOURCE||vp();cp(r,"browser",["browser"],n),super(r);let{sendDefaultPii:i,sendClientReports:o,enableLogs:s,_experiments:a}=this._options,c=s??a?.enableLogs;Je.document&&(o||c)&&Je.document.addEventListener("visibilitychange",()=>{Je.document.visibilityState==="hidden"&&(o&&this._flushOutcomes(),c&&Xo(this))}),c&&(this.on("flush",()=>{Xo(this)}),this.on("afterCaptureLog",()=>{this._logFlushIdleTimeout&&clearTimeout(this._logFlushIdleTimeout),this._logFlushIdleTimeout=setTimeout(()=>{Xo(this)},ub)})),i&&(this.on("postprocessEvent",sp),this.on("beforeSendSession",ap))}eventFromException(e,r){return ph(this._options.stackParser,e,r,this._options.attachStacktrace)}eventFromMessage(e,r="info",n){return fh(this._options.stackParser,e,r,n,this._options.attachStacktrace)}_prepareEvent(e,r,n,i){return e.platform=e.platform||"javascript",super._prepareEvent(e,r,n,i)}};function pb(t){return _({release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:Je.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0},t)}var mh=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var mt=pe;var fb=1e3,dh,Ip,Tp;function xp(t){Lt("dom",t),Mt("dom",mb)}function mb(){if(!mt.document)return;let t=ut.bind(null,"dom"),e=hh(t,!0);mt.document.addEventListener("click",e,!1),mt.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(r=>{let i=mt[r]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(pt(i,"addEventListener",function(o){return function(s,a,c){if(s==="click"||s=="keypress")try{let p=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},d=p[s]=p[s]||{refCount:0};if(!d.handler){let f=hh(t);d.handler=f,o.call(this,s,f,c)}d.refCount++}catch{}return o.call(this,s,a,c)}}),pt(i,"removeEventListener",function(o){return function(s,a,c){if(s==="click"||s=="keypress")try{let p=this.__sentry_instrumentation_handlers__||{},d=p[s];d&&(d.refCount--,d.refCount<=0&&(o.call(this,s,d.handler,c),d.handler=void 0,delete p[s]),Object.keys(p).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return o.call(this,s,a,c)}}))})}function db(t){if(t.type!==Ip)return!1;try{if(!t.target||t.target._sentryId!==Tp)return!1}catch{}return!0}function hb(t,e){return t!=="keypress"?!1:e?.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function hh(t,e=!1){return r=>{if(!r||r._sentryCaptured)return;let n=gb(r);if(hb(r.type,n))return;qt(r,"_sentryCaptured",!0),n&&!n._sentryId&&qt(n,"_sentryId",ft());let i=r.type==="keypress"?"input":r.type;db(r)||(t({event:r,name:i,global:e}),Ip=r.type,Tp=n?n._sentryId:void 0),clearTimeout(dh),dh=mt.setTimeout(()=>{Tp=void 0,Ip=void 0},fb)}}function gb(t){try{return t.target}catch{return null}}var Ua;function ts(t){let e="history";Lt(e,t),Mt(e,yb)}function yb(){if(mt.addEventListener("popstate",()=>{let e=mt.location.href,r=Ua;if(Ua=e,r===e)return;ut("history",{from:r,to:e})}),!dp())return;function t(e){return function(...r){let n=r.length>2?r[2]:void 0;if(n){let i=Ua,o=vb(String(n));if(Ua=o,i===o)return e.apply(this,r);ut("history",{from:i,to:o})}return e.apply(this,r)}}pt(mt.history,"pushState",t),pt(mt.history,"replaceState",t)}function vb(t){try{return new URL(t,mt.location.origin).toString()}catch{return t}}var Fa={};function Cp(t){let e=Fa[t];if(e)return e;let r=mt[t];if(Zo(r))return Fa[t]=r.bind(mt);let n=mt.document;if(n&&typeof n.createElement=="function")try{let i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);let o=i.contentWindow;o?.[t]&&(r=o[t]),n.head.removeChild(i)}catch(i){mh&&ee.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return r&&(Fa[t]=r.bind(mt))}function Ha(t){Fa[t]=void 0}var Jn="__sentry_xhr_v3__";function Rp(t){Lt("xhr",t),Mt("xhr",Eb)}function Eb(){if(!mt.XMLHttpRequest)return;let t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,r,n){let i=new Error,o=Ht()*1e3,s=Bt(n[0])?n[0].toUpperCase():void 0,a=_b(n[1]);if(!s||!a)return e.apply(r,n);r[Jn]={method:s,url:a,request_headers:{}},s==="POST"&&a.match(/sentry_key/)&&(r.__sentry_own_request__=!0);let c=()=>{let p=r[Jn];if(p&&r.readyState===4){try{p.status_code=r.status}catch{}let d={endTimestamp:Ht()*1e3,startTimestamp:o,xhr:r,virtualError:i};ut("xhr",d)}};return"onreadystatechange"in r&&typeof r.onreadystatechange=="function"?r.onreadystatechange=new Proxy(r.onreadystatechange,{apply(p,d,f){return c(),p.apply(d,f)}}):r.addEventListener("readystatechange",c),r.setRequestHeader=new Proxy(r.setRequestHeader,{apply(p,d,f){let[E,y]=f,T=d[Jn];return T&&Bt(E)&&Bt(y)&&(T.request_headers[E.toLowerCase()]=y),p.apply(d,f)}}),e.apply(r,n)}}),t.send=new Proxy(t.send,{apply(e,r,n){let i=r[Jn];if(!i)return e.apply(r,n);n[0]!==void 0&&(i.body=n[0]);let o={startTimestamp:Ht()*1e3,xhr:r};return ut("xhr",o),e.apply(r,n)}})}function _b(t){if(Bt(t))return t;try{return t.toString()}catch{}}function Ap(t,e=Cp("fetch")){let r=0,n=0;function i(o){let s=o.body.length;r+=s,n++;let a=_({body:o.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:r<=6e4&&n<15},t.fetchOptions);if(!e)return Ha("fetch"),wn("No fetch implementation available");try{return e(t.url,a).then(c=>(r-=s,n--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return Ha("fetch"),r-=s,n--,wn(c)}}return Da(t,i)}var bb=30;var wb=50;function Dp(t,e,r,n){let i={filename:t,function:e==="<anonymous>"?"?":e,in_app:!0};return r!==void 0&&(i.lineno=r),n!==void 0&&(i.colno=n),i}var Sb=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ib=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Tb=/\((\S*)(?::(\d+))(?::(\d+))\)/,xb=t=>{let e=Sb.exec(t);if(e){let[,n,i,o]=e;return Dp(n,"?",+i,+o)}let r=Ib.exec(t);if(r){if(r[2]&&r[2].indexOf("eval")===0){let s=Tb.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}let[i,o]=Eh(r[1]||"?",r[2]);return Dp(o,i,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},gh=[bb,xb],Cb=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Rb=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ab=t=>{let e=Cb.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){let o=Rb.exec(e[3]);o&&(e[1]=e[1]||"eval",e[3]=o[1],e[4]=o[2],e[5]="")}let n=e[3],i=e[1]||"?";return[i,n]=Eh(i,n),Dp(n,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},yh=[wb,Ab];var vh=[gh,yh],Np=wu(...vh),Eh=(t,e)=>{let r=t.indexOf("safari-extension")!==-1,n=t.indexOf("safari-web-extension")!==-1;return r||n?[t.indexOf("@")!==-1?t.split("@")[0]:"?",r?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};var Mi=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var $a=1024,Db="Breadcrumbs",Nb=(t={})=>{let e=_({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t);return{name:Db,setup(r){e.console&&fp(Lb(r)),e.dom&&xp(Pb(r,e.dom)),e.xhr&&Rp(Mb(r)),e.fetch&&yp(Bb(r)),e.history&&ts(kb(r)),e.sentry&&r.on("beforeSendEvent",Ob(r))}}},_h=Nb;function Ob(t){return function(r){Ge()===t&&Pr({category:`sentry.${r.type==="transaction"?"transaction":"event"}`,event_id:r.event_id,level:r.level,message:Ar(r)},{event:r})}}function Pb(t,e){return function(n){if(Ge()!==t)return;let i,o,s=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>$a&&(Mi&&ee.warn(`\`dom.maxStringLength\` cannot exceed ${$a}, but a value of ${a} was configured. Sentry will use ${$a} instead.`),a=$a),typeof s=="string"&&(s=[s]);try{let p=n.event,d=Ub(p)?p.target:p;i=Vo(d,{keyAttrs:s,maxStringLength:a}),o=Ou(d)}catch{i="<unknown>"}if(i.length===0)return;let c={category:`ui.${n.name}`,message:i};o&&(c.data={"ui.component_name":o}),Pr(c,{event:n.event,name:n.name,global:n.global})}}function Lb(t){return function(r){if(Ge()!==t)return;let n={category:"console",data:{arguments:r.args,logger:"console"},level:mp(r.level),message:pa(r.args," ")};if(r.level==="assert")if(r.args[0]===!1)n.message=`Assertion failed: ${pa(r.args.slice(1)," ")||"console.assert"}`,n.data.arguments=r.args.slice(1);else return;Pr(n,{input:r.args,level:r.level})}}function Mb(t){return function(r){if(Ge()!==t)return;let{startTimestamp:n,endTimestamp:i}=r,o=r.xhr[Jn];if(!n||!i||!o)return;let{method:s,url:a,status_code:c,body:p}=o,d={method:s,url:a,status_code:c},f={xhr:r.xhr,input:p,startTimestamp:n,endTimestamp:i},E={category:"xhr",data:d,type:"http",level:Ma(c)};t.emit("beforeOutgoingRequestBreadcrumb",E,f),Pr(E,f)}}function Bb(t){return function(r){if(Ge()!==t)return;let{startTimestamp:n,endTimestamp:i}=r;if(i&&!(r.fetchData.url.match(/sentry_key/)&&r.fetchData.method==="POST"))if(r.fetchData.method,r.fetchData.url,r.error){let o=r.fetchData,s={data:r.error,input:r.args,startTimestamp:n,endTimestamp:i},a={category:"fetch",data:o,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",a,s),Pr(a,s)}else{let o=r.response,s=Z(_({},r.fetchData),{status_code:o?.status});r.fetchData.request_body_size,r.fetchData.response_body_size,o?.status;let a={input:r.args,response:o,startTimestamp:n,endTimestamp:i},c={category:"fetch",data:s,type:"http",level:Ma(s.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",c,a),Pr(c,a)}}}function kb(t){return function(r){if(Ge()!==t)return;let n=r.from,i=r.to,o=Jo(Je.location.href),s=n?Jo(n):void 0,a=Jo(i);s?.path||(s=o),o.protocol===a.protocol&&o.host===a.host&&(i=a.relative),o.protocol===s.protocol&&o.host===s.host&&(n=s.relative),Pr({category:"navigation",data:{from:n,to:i}})}}function Ub(t){return!!t&&!!t.target}var Fb=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Hb="BrowserApiErrors",$b=(t={})=>{let e=_({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1},t);return{name:Hb,setupOnce(){e.setTimeout&&pt(Je,"setTimeout",bh),e.setInterval&&pt(Je,"setInterval",bh),e.requestAnimationFrame&&pt(Je,"requestAnimationFrame",Vb),e.XMLHttpRequest&&"XMLHttpRequest"in Je&&pt(XMLHttpRequest.prototype,"send",Wb);let r=e.eventTarget;r&&(Array.isArray(r)?r:Fb).forEach(i=>jb(i,e))}}},wh=$b;function bh(t){return function(...e){let r=e[0];return e[0]=Xn(r,{mechanism:{data:{function:nr(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function Vb(t){return function(e){return t.apply(this,[Xn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:nr(t)},handled:!1,type:"instrument"}})])}}function Wb(t){return function(...e){let r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in r&&typeof r[i]=="function"&&pt(r,i,function(o){let s={mechanism:{data:{function:i,handler:nr(o)},handled:!1,type:"instrument"}},a=Kn(o);return a&&(s.mechanism.data.handler=nr(a)),Xn(o,s)})}),t.apply(this,e)}}function jb(t,e){let n=Je[t]?.prototype;n?.hasOwnProperty?.("addEventListener")&&(pt(n,"addEventListener",function(i){return function(o,s,a){try{Gb(s)&&(s.handleEvent=Xn(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:nr(s),target:t},handled:!1,type:"instrument"}}))}catch{}return e.unregisterOriginalCallbacks&&zb(this,o,s),i.apply(this,[o,Xn(s,{mechanism:{data:{function:"addEventListener",handler:nr(s),target:t},handled:!1,type:"instrument"}}),a])}}),pt(n,"removeEventListener",function(i){return function(o,s,a){try{let c=s.__sentry_wrapped__;c&&i.call(this,o,c,a)}catch{}return i.call(this,o,s,a)}}))}function Gb(t){return typeof t.handleEvent=="function"}function zb(t,e,r){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,r)}var Sh=()=>({name:"BrowserSession",setupOnce(){if(typeof Je.document>"u"){Mi&&ee.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}qo({ignoreDuration:!0}),Yo(),ts(({from:t,to:e})=>{t!==void 0&&t!==e&&(qo({ignoreDuration:!0}),Yo())})}});var qb="GlobalHandlers",Yb=(t={})=>{let e=_({onerror:!0,onunhandledrejection:!0},t);return{name:qb,setupOnce(){Error.stackTraceLimit=50},setup(r){e.onerror&&(Kb(r),Ih("onerror")),e.onunhandledrejection&&(Xb(r),Ih("onunhandledrejection"))}}},Th=Yb;function Kb(t){Iu(e=>{let{stackParser:r,attachStacktrace:n}=xh();if(Ge()!==t||_p())return;let{msg:i,url:o,line:s,column:a,error:c}=e,p=Zb(ka(r,c||i,void 0,n,!1),o,s,a);p.level="error",zo(p,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function Xb(t){xu(e=>{let{stackParser:r,attachStacktrace:n}=xh();if(Ge()!==t||_p())return;let i=Jb(e),o=qn(i)?Qb(i):ka(r,i,void 0,n,!0);o.level="error",zo(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function Jb(t){if(qn(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function Qb(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function Zb(t,e,r,n){let i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],p=n,d=r,f=Bt(e)&&e.length>0?e:Wo();return c.length===0&&c.push({colno:p,filename:f,function:"?",in_app:!0,lineno:d}),t}function Ih(t){Mi&&ee.log(`Global Handler attached: ${t}`)}function xh(){return Ge()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var Ch=()=>({name:"HttpContext",preprocessEvent(t){if(!Je.navigator&&!Je.location&&!Je.document)return;let e=lh(),r=_(_({},e.headers),t.request?.headers);t.request=Z(_(_({},e),t.request),{headers:r})}});var ew="cause",tw=5,rw="LinkedErrors",nw=(t={})=>{let e=t.limit||tw,r=t.key||ew;return{name:rw,preprocessEvent(n,i,o){let s=o.getOptions();pp(Ba,s.stackParser,r,e,n,i)}}},Rh=nw;function Op(t){return[Pa(),Na(),wh(),_h(),Th(),Rh(),La(),Ch(),Sh()]}var Wa={},ja,Pp,Ah;(()=>{let t=Op({}).filter(e=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(e.name));Pp=new es({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:Ap,stackParser:Np,integrations:t,environment:Gt.mode,release:`web-sdk@${Kr}`,debug:Gt.debug}),Pp.init()})();function ae(t,e,r){b.error(`${e}:`,t);let n=Oh(r);if(n.setTag("operation",e),t instanceof Wn){iw(n,t,e);return}n.captureException(t)}function Dh(t,e,r){Oh(r).captureMessage(t,e??"error")}function iw(t,e,r){if(ow(t,e),e.response){let n=e.response;t.setTag("http.status_code",n.status),t.setExtras({responseText:e.responseText,statusText:n.statusText,responseType:n.type,redirected:n.redirected,responseUrl:n.url}),t.captureMessage(`${r} failed with ${n.status}`,"error");return}if(e.request){t.captureMessage(`No response was received for ${r}`,"error");return}}function ow(t,e){let r=e.request;r&&t.setExtras({body:e.requestBody,headers:r.headers,method:r.method,url:r.url})}function Nh(t){Ah=t}function Ga(t,e){Wa[t]=_(_({},Wa[t]),e)}function Bi(t){ja=_(_({},ja),t)}function Oh(t){t??={};let{extra:e,tags:r}=t,n=new It;if(n.setClient(Pp),n.setUser(Ah),t.triggerContext&&!t.engagementTrigger&&(t.engagementTrigger=t.triggerContext.triggerData),t.engagementTrigger){let i=t.engagementTrigger;n.setTags({"engagement.id":i.engagementID,"engagement.short_id":i.shortID,"engagement.objective":i.objective,"engagement.delivery_type":i.onsiteDeliveryType,"engagement.content_id":i.contentID,"engagement.variation":i.variation,"engagement.currency":i.currency})}return e&&n.setExtras(e),r&&n.setTags(r),ja&&n.setTags(ja),Object.keys(Wa).forEach(i=>{n.setContext(i,Wa[i])}),n.setTag("language",navigator.language),n.setTag("timezone",Ph()),sw(n),n}function sw(t){window.Shopify&&(t.setTag("shopify.shop",window.Shopify.shop),t.setTag("shopify.currency",window.Shopify.currency?.active),t.setTag("shopify.locale",window.Shopify.locale),t.setTag("theme.schema_name",window.Shopify.theme?.schema_name),t.setTag("theme.schema_version",window.Shopify.theme?.schema_version))}var za=class{static format(e,r){let n=/{{\s*(\w+)\s*}}/;return r.replace(n,(i,o)=>{switch(o){case"amount":return this.formatWithDelimiters(e,2);case"amount_no_decimals":return this.formatWithDelimiters(e,0);case"amount_with_comma_separator":return this.formatWithDelimiters(e,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(e,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(e,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(e,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(e,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(e,2," ",".");default:return i}})}static formatWithDelimiters(e,r=2,n=",",i="."){if(isNaN(e)||e==null)return"0";let s=(e/100).toFixed(r).split("."),a=s[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+n),c=s[1]?i+s[1]:"";return a+c}};function ki(t){try{return new URL(t)}catch{return}}function Lp(t){return!t||t==="null"||t==="undefined"}function Lh(t,e){let r=t.indexOf(e);return r===-1?!1:(t.splice(r,1),!0)}function kt(t,e,r){return{[t]:Mp(e,r),[t+"_wo_currency"]:e}}function Mp(t,e){if(t==0&&e)return"Free";let r=ye.get(),n=Xe.get(),i=r.shopCurrencyCode||n.currency,o=r.currencyCode;o||b.warn("Currency code is not set in RuntimeData");let s=n.money?.format??r.moneyFormat,a;if(s&&i===o)a=za.format(t*100,s);else{let c;try{c=new Intl.NumberFormat(Bh(),{style:"currency",currency:o||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(p){return ae(p,"format-currency",{extra:{currentCurrency:o,shopCurrency:i}}),""}a=c.format(t),a=a.replace("\u20B9","Rs. "),n.money?.showCurrency&&o!=="INR"&&(a=a.concat(` ${o}`))}return a}function Mh(t){let e=Bh();try{return new Intl.NumberFormat(e,{notation:"compact"}).format(t)}catch(r){return ae(r,"format-number",{extra:{lang:e,value:t}}),t.toString()}}function Bh(){let t="en";return typeof navigator<"u"&&(navigator.languages!==void 0&&navigator.languages.length>0?t=navigator.languages[0]:navigator.language&&(t=navigator.language)),t=t.split(";")[0],t=t.split("-")[0],t||"en"}var qa;function Ph(){if(qa)return qa;try{return qa=Intl.DateTimeFormat().resolvedOptions().timeZone,qa}catch{return""}}function Ui(t){document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t)}function br(t){let e=document.createElement("span");e.id="snackbar",e.innerText=t,document.body.appendChild(e),e.className="show",setTimeout(()=>{e.classList.remove("show"),document.body.removeChild(e)},5e3)}async function Bp(t,e=10,r=document){let n=0,i=document.querySelectorAll("nonexistent-tag");for(;n<e;){let o=Math.min(100*2**n,5e3);if(await rr.sleep(o),i=r.querySelectorAll(t),i.length)return b.verbose(`Attempt ${n+1}: ${i.length} elements found with ${t}`),i;b.verbose(`Attempt ${n+1}: Elements not found with ${t}. Retrying after ${o}ms.`),n++}return b.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${t}.`),i}async function Fi(t,e=10,r=document){return(await Bp(t,e,r)).item(0)}async function kp(t){let[e,r,n]=await Promise.all([Ye.get("did"),At.get("id",""),Ye.get("sessionNumber",1)]),i={letscooee_did:e,letscooee_sid:r,letscooee_sn:n,__letscooee_time:new Date().toLocaleString()};return t&&(i.__letscooee_via=t),i}async function Ya(t){let e=await kp(t);return Object.entries(e).map(([r,n])=>({key:r,value:n.toString()}))}function sn(t,e,r,n=!1){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:n,value:r})}function kh(t){if(t%100>=11&&t%100<=13)return t+"th";switch(t%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd";default:return t+"th"}}var Qa,xe,Vh,Hp,Qn,Uh,Wh,jh,Gh,$p,Up,Fp,aw,ns={},zh=[],cw=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Za=Array.isArray;function an(t,e){for(var r in e)t[r]=e[r];return t}function Vp(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Wp(t,e,r){var n,i,o,s={};for(o in e)o=="key"?n=e[o]:o=="ref"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?Qa.call(arguments,2):r),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)s[o]===void 0&&(s[o]=t.defaultProps[o]);return Xa(t,s,n,i,null)}function Xa(t,e,r,n,i){var o={type:t,props:e,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Vh,__i:-1,__u:0};return i==null&&xe.vnode!=null&&xe.vnode(o),o}function Mr(t){return t.children}function Lr(t,e){this.props=t,this.context=e}function Hi(t,e){if(e==null)return t.__?Hi(t.__,t.__i+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?Hi(t):null}function qh(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return qh(t)}}function Fh(t){(!t.__d&&(t.__d=!0)&&Qn.push(t)&&!Ja.__r++||Uh!=xe.debounceRendering)&&((Uh=xe.debounceRendering)||Wh)(Ja)}function Ja(){for(var t,e,r,n,i,o,s,a=1;Qn.length;)Qn.length>a&&Qn.sort(jh),t=Qn.shift(),a=Qn.length,t.__d&&(r=void 0,i=(n=(e=t).__v).__e,o=[],s=[],e.__P&&((r=an({},n)).__v=n.__v+1,xe.vnode&&xe.vnode(r),jp(e.__P,r,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,o,i??Hi(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,Xh(o,r,s),r.__e!=i&&qh(r)));Ja.__r=0}function Yh(t,e,r,n,i,o,s,a,c,p,d){var f,E,y,T,D,N,k=n&&n.__k||zh,G=e.length;for(c=lw(r,e,k,c,G),f=0;f<G;f++)(y=r.__k[f])!=null&&(E=y.__i==-1?ns:k[y.__i]||ns,y.__i=f,N=jp(t,y,E,i,o,s,a,c,p,d),T=y.__e,y.ref&&E.ref!=y.ref&&(E.ref&&Gp(E.ref,null,y),d.push(y.ref,y.__c||T,y)),D==null&&T!=null&&(D=T),4&y.__u||E.__k===y.__k?c=Kh(y,c,t):typeof y.type=="function"&&N!==void 0?c=N:T&&(c=T.nextSibling),y.__u&=-7);return r.__e=D,c}function lw(t,e,r,n,i){var o,s,a,c,p,d=r.length,f=d,E=0;for(t.__k=new Array(i),o=0;o<i;o++)(s=e[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(c=o+E,(s=t.__k[o]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?Xa(null,s,null,null,null):Za(s)?Xa(Mr,{children:s},null,null,null):s.constructor==null&&s.__b>0?Xa(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,(p=s.__i=uw(s,r,c,f))!=-1&&(f--,(a=r[p])&&(a.__u|=2)),a==null||a.__v==null?(p==-1&&(i>d?E--:i<d&&E++),typeof s.type!="function"&&(s.__u|=4)):p!=c&&(p==c-1?E--:p==c+1?E++:(p>c?E--:E++,s.__u|=4))):t.__k[o]=null;if(f)for(o=0;o<d;o++)(a=r[o])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=Hi(a)),Qh(a,a));return n}function Kh(t,e,r){var n,i;if(typeof t.type=="function"){for(n=t.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=t,e=Kh(n[i],e,r));return e}t.__e!=e&&(e&&t.type&&!r.contains(e)&&(e=Hi(t)),r.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function uw(t,e,r,n){var i,o,s=t.key,a=t.type,c=e[r];if(c===null&&t.key==null||c&&s==c.key&&a==c.type&&(2&c.__u)==0)return r;if(n>(c!=null&&(2&c.__u)==0?1:0))for(i=r-1,o=r+1;i>=0||o<e.length;){if(i>=0){if((c=e[i])&&(2&c.__u)==0&&s==c.key&&a==c.type)return i;i--}if(o<e.length){if((c=e[o])&&(2&c.__u)==0&&s==c.key&&a==c.type)return o;o++}}return-1}function Hh(t,e,r){e[0]=="-"?t.setProperty(e,r??""):t[e]=r==null?"":typeof r!="number"||cw.test(e)?r:r+"px"}function Ka(t,e,r,n,i){var o,s;e:if(e=="style")if(typeof r=="string")t.style.cssText=r;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)r&&e in r||Hh(t.style,e,"");if(r)for(e in r)n&&r[e]==n[e]||Hh(t.style,e,r[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(Gh,"$1")),s=e.toLowerCase(),e=s in t||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=r,r?n?r.u=n.u:(r.u=$p,t.addEventListener(e,o?Fp:Up,o)):t.removeEventListener(e,o?Fp:Up,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&r==1?"":r))}}function $h(t){return function(e){if(this.l){var r=this.l[e.type+t];if(e.t==null)e.t=$p++;else if(e.t<r.u)return;return r(xe.event?xe.event(e):e)}}}function jp(t,e,r,n,i,o,s,a,c,p){var d,f,E,y,T,D,N,k,G,P,Q,_e,X,ce,se,fe,Be,Te=e.type;if(e.constructor!=null)return null;128&r.__u&&(c=!!(32&r.__u),o=[a=e.__e=r.__e]),(d=xe.__b)&&d(e);e:if(typeof Te=="function")try{if(k=e.props,G="prototype"in Te&&Te.prototype.render,P=(d=Te.contextType)&&n[d.__c],Q=d?P?P.props.value:d.__:n,r.__c?N=(f=e.__c=r.__c).__=f.__E:(G?e.__c=f=new Te(k,Q):(e.__c=f=new Lr(k,Q),f.constructor=Te,f.render=fw),P&&P.sub(f),f.props=k,f.state||(f.state={}),f.context=Q,f.__n=n,E=f.__d=!0,f.__h=[],f._sb=[]),G&&f.__s==null&&(f.__s=f.state),G&&Te.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=an({},f.__s)),an(f.__s,Te.getDerivedStateFromProps(k,f.__s))),y=f.props,T=f.state,f.__v=e,E)G&&Te.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),G&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(G&&Te.getDerivedStateFromProps==null&&k!==y&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(k,Q),!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(k,f.__s,Q)===!1||e.__v==r.__v){for(e.__v!=r.__v&&(f.props=k,f.state=f.__s,f.__d=!1),e.__e=r.__e,e.__k=r.__k,e.__k.some(function(Ae){Ae&&(Ae.__=e)}),_e=0;_e<f._sb.length;_e++)f.__h.push(f._sb[_e]);f._sb=[],f.__h.length&&s.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(k,f.__s,Q),G&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(y,T,D)})}if(f.context=Q,f.props=k,f.__P=t,f.__e=!1,X=xe.__r,ce=0,G){for(f.state=f.__s,f.__d=!1,X&&X(e),d=f.render(f.props,f.state,f.context),se=0;se<f._sb.length;se++)f.__h.push(f._sb[se]);f._sb=[]}else do f.__d=!1,X&&X(e),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++ce<25);f.state=f.__s,f.getChildContext!=null&&(n=an(an({},n),f.getChildContext())),G&&!E&&f.getSnapshotBeforeUpdate!=null&&(D=f.getSnapshotBeforeUpdate(y,T)),fe=d,d!=null&&d.type===Mr&&d.key==null&&(fe=Jh(d.props.children)),a=Yh(t,Za(fe)?fe:[fe],e,r,n,i,o,s,a,c,p),f.base=e.__e,e.__u&=-161,f.__h.length&&s.push(f),N&&(f.__E=f.__=null)}catch(Ae){if(e.__v=null,c||o!=null)if(Ae.then){for(e.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,e.__e=a}else for(Be=o.length;Be--;)Vp(o[Be]);else e.__e=r.__e,e.__k=r.__k;xe.__e(Ae,e,r)}else o==null&&e.__v==r.__v?(e.__k=r.__k,e.__e=r.__e):a=e.__e=pw(r.__e,e,r,n,i,o,s,c,p);return(d=xe.diffed)&&d(e),128&e.__u?void 0:a}function Xh(t,e,r){for(var n=0;n<r.length;n++)Gp(r[n],r[++n],r[++n]);xe.__c&&xe.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){xe.__e(o,i.__v)}})}function Jh(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:Za(t)?t.map(Jh):an({},t)}function pw(t,e,r,n,i,o,s,a,c){var p,d,f,E,y,T,D,N=r.props,k=e.props,G=e.type;if(G=="svg"?i="http://www.w3.org/2000/svg":G=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(p=0;p<o.length;p++)if((y=o[p])&&"setAttribute"in y==!!G&&(G?y.localName==G:y.nodeType==3)){t=y,o[p]=null;break}}if(t==null){if(G==null)return document.createTextNode(k);t=document.createElementNS(i,G,k.is&&k),a&&(xe.__m&&xe.__m(e,o),a=!1),o=null}if(G==null)N===k||a&&t.data==k||(t.data=k);else{if(o=o&&Qa.call(t.childNodes),N=r.props||ns,!a&&o!=null)for(N={},p=0;p<t.attributes.length;p++)N[(y=t.attributes[p]).name]=y.value;for(p in N)if(y=N[p],p!="children"){if(p=="dangerouslySetInnerHTML")f=y;else if(!(p in k)){if(p=="value"&&"defaultValue"in k||p=="checked"&&"defaultChecked"in k)continue;Ka(t,p,null,y,i)}}for(p in k)y=k[p],p=="children"?E=y:p=="dangerouslySetInnerHTML"?d=y:p=="value"?T=y:p=="checked"?D=y:a&&typeof y!="function"||N[p]===y||Ka(t,p,y,N[p],i);if(d)a||f&&(d.__html==f.__html||d.__html==t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(f&&(t.innerHTML=""),Yh(e.type=="template"?t.content:t,Za(E)?E:[E],e,r,n,G=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:r.__k&&Hi(r,0),a,c),o!=null)for(p=o.length;p--;)Vp(o[p]);a||(p="value",G=="progress"&&T==null?t.removeAttribute("value"):T!=null&&(T!==t[p]||G=="progress"&&!T||G=="option"&&T!=N[p])&&Ka(t,p,T,N[p],i),p="checked",D!=null&&D!=t[p]&&Ka(t,p,D,N[p],i))}return t}function Gp(t,e,r){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){xe.__e(i,r)}}function Qh(t,e,r){var n,i;if(xe.unmount&&xe.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Gp(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){xe.__e(o,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&Qh(n[i],e,r||typeof t.type!="function");r||Vp(t.__e),t.__c=t.__=t.__e=void 0}function fw(t,e,r){return this.constructor(t,r)}function Zh(t,e,r){var n,i,o,s;e==document&&(e=document.documentElement),xe.__&&xe.__(t,e),i=(n=typeof r=="function")?null:r&&r.__k||e.__k,o=[],s=[],jp(e,t=(!n&&r||e).__k=Wp(Mr,null,[t]),i||ns,ns,e.namespaceURI,!n&&r?[r]:i?null:e.firstChild?Qa.call(e.childNodes):null,o,!n&&r?r:i?i.__e:e.firstChild,n,s),Xh(o,t,s)}Qa=zh.slice,xe={__e:function(t,e,r,n){for(var i,o,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),s=i.__d),s)return i.__E=i}catch(a){t=a}throw t}},Vh=0,Hp=function(t){return t!=null&&t.constructor==null},Lr.prototype.setState=function(t,e){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=an({},this.state),typeof t=="function"&&(t=t(an({},r),this.props)),t&&an(r,t),t!=null&&this.__v&&(e&&this._sb.push(e),Fh(this))},Lr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Fh(this))},Lr.prototype.render=Mr,Qn=[],Wh=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,jh=function(t,e){return t.__v.__b-e.__v.__b},Ja.__r=0,Gh=/(PointerCapture)$|Capture$/i,$p=0,Up=$h(!1),Fp=$h(!0),aw=0;var qp,Yt,zp,eg,tg=0,lg=[],dt=xe,rg=dt.__b,ng=dt.__r,ig=dt.diffed,og=dt.__c,sg=dt.unmount,ag=dt.__;function mw(t,e){dt.__h&&dt.__h(Yt,t,tg||e),tg=0;var r=Yt.__H||(Yt.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function Kp(t,e){var r=mw(qp++,7);return gw(r.__H,e)&&(r.__=t(),r.__H=e,r.__h=t),r.__}function dw(){for(var t;t=lg.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ec),t.__H.__h.forEach(Yp),t.__H.__h=[]}catch(e){t.__H.__h=[],dt.__e(e,t.__v)}}dt.__b=function(t){Yt=null,rg&&rg(t)},dt.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),ag&&ag(t,e)},dt.__r=function(t){ng&&ng(t),qp=0;var e=(Yt=t.__c).__H;e&&(zp===Yt?(e.__h=[],Yt.__h=[],e.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(e.__h.forEach(ec),e.__h.forEach(Yp),e.__h=[],qp=0)),zp=Yt},dt.diffed=function(t){ig&&ig(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(lg.push(e)!==1&&eg===dt.requestAnimationFrame||((eg=dt.requestAnimationFrame)||hw)(dw)),e.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),zp=Yt=null},dt.__c=function(t,e){e.some(function(r){try{r.__h.forEach(ec),r.__h=r.__h.filter(function(n){return!n.__||Yp(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],dt.__e(n,r.__v)}}),og&&og(t,e)},dt.unmount=function(t){sg&&sg(t);var e,r=t.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ec(n)}catch(i){e=i}}),r.__H=void 0,e&&dt.__e(e,r.__v))};var cg=typeof requestAnimationFrame=="function";function hw(t){var e,r=function(){clearTimeout(n),cg&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(r,35);cg&&(e=requestAnimationFrame(r))}function ec(t){var e=Yt,r=t.__c;typeof r=="function"&&(t.__c=void 0,r()),Yt=e}function Yp(t){var e=Yt;t.__c=t.__(),Yt=e}function gw(t,e){return!t||t.length!==e.length||e.some(function(r,n){return r!==t[n]})}var yw=Symbol.for("preact-signals");function Jp(){if($i>1)$i--;else{for(var t,e=!1;is!==void 0;){var r=is;for(is=void 0,Xp++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&pg(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=n}}if(Xp=0,$i--,e)throw t}}var $e=void 0;var is=void 0,$i=0,Xp=0,tc=0;function ug(t){if($e!==void 0){var e=t.n;if(e===void 0||e.t!==$e)return e={i:0,S:t,p:$e.s,n:void 0,t:$e,e:void 0,x:void 0,r:e},$e.s!==void 0&&($e.s.n=e),$e.s=e,t.n=e,32&$e.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=$e.s,e.n=void 0,$e.s.n=e,$e.s=e),e}}function ht(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}ht.prototype.brand=yw;ht.prototype.h=function(){return!0};ht.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};ht.prototype.U=function(t){if(this.t!==void 0){var e=t.e,r=t.x;e!==void 0&&(e.x=r,t.e=void 0),r!==void 0&&(r.e=e,t.x=void 0),t===this.t&&(this.t=r)}};ht.prototype.subscribe=function(t){var e=this;return Tt(function(){var r=e.value,n=$e;$e=void 0;try{t(r)}finally{$e=n}})};ht.prototype.valueOf=function(){return this.value};ht.prototype.toString=function(){return this.value+""};ht.prototype.toJSON=function(){return this.value};ht.prototype.peek=function(){var t=$e;$e=void 0;try{return this.value}finally{$e=t}};Object.defineProperty(ht.prototype,"value",{get:function(){var t=ug(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Xp>100)throw new Error("Cycle detected");this.v=t,this.i++,tc++,$i++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Jp()}}}});function sr(t){return new ht(t)}function pg(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function fg(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function mg(t){for(var e=t.s,r=void 0;e!==void 0;){var n=e.p;e.i===-1?(e.S.U(e),n!==void 0&&(n.n=e.n),e.n!==void 0&&(e.n.p=n)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=n}t.s=r}function Vi(t){ht.call(this,void 0),this.x=t,this.s=void 0,this.g=tc-1,this.f=4}(Vi.prototype=new ht).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===tc))return!0;if(this.g=tc,this.f|=1,this.i>0&&!pg(this))return this.f&=-2,!0;var t=$e;try{fg(this),$e=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return $e=t,mg(this),this.f&=-2,!0};Vi.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}ht.prototype.S.call(this,t)};Vi.prototype.U=function(t){if(this.t!==void 0&&(ht.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};Vi.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(Vi.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=ug(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Qp(t){return new Vi(t)}function dg(t){var e=t.u;if(t.u=void 0,typeof e=="function"){$i++;var r=$e;$e=void 0;try{e()}catch(n){throw t.f&=-2,t.f|=8,Zp(t),n}finally{$e=r,Jp()}}}function Zp(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,dg(t)}function vw(t){if($e!==this)throw new Error("Out-of-order effect");mg(this),$e=t,this.f&=-2,8&this.f&&Zp(this),Jp()}function os(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}os.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};os.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,dg(this),fg(this),$i++;var t=$e;return $e=this,vw.bind(this,t)};os.prototype.N=function(){2&this.f||(this.f|=2,this.o=is,is=this)};os.prototype.d=function(){this.f|=8,1&this.f||Zp(this)};function Tt(t){var e=new os(t);try{e.c()}catch(r){throw e.d(),r}return e.d.bind(e)}var tf,ef;function Wi(t,e){xe[t]=e.bind(null,xe[t]||function(){})}function rc(t){ef&&ef(),ef=t&&t.S()}function hg(t){var e=this,r=t.data,n=_w(r);n.value=r;var i=Kp(function(){for(var o=e.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return e.__$u.c=function(){var s,a=e.__$u.S(),c=i.value;a(),Hp(c)||((s=e.base)==null?void 0:s.nodeType)!==3?(e.__$f|=1,e.setState({})):e.base.data=c},Qp(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return i.value}hg.displayName="_st";Object.defineProperties(ht.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:hg},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Wi("__b",function(t,e){if(typeof e.type=="string"){var r,n=e.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof ht&&(r||(e.__np=r={}),r[i]=o,n[i]=o.peek())}}t(e)});Wi("__r",function(t,e){rc();var r,n=e.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=(function(i){var o;return Tt(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o})())),tf=n,rc(r),t(e)});Wi("__e",function(t,e,r,n){rc(),tf=void 0,t(e,r,n)});Wi("diffed",function(t,e){rc(),tf=void 0;var r;if(typeof e.type=="string"&&(r=e.__e)){var n=e.__np,i=e.props;if(n){var o=r.U;if(o)for(var s in o){var a=o[s];a!==void 0&&!(s in n)&&(a.d(),o[s]=void 0)}else r.U=o={};for(var c in n){var p=o[c],d=n[c];p===void 0?(p=Ew(r,c,d,i),o[c]=p):p.o(d,i)}}}t(e)});function Ew(t,e,r,n){var i=e in t&&t.ownerSVGElement===void 0,o=sr(r);return{o:function(s,a){o.value=s,n=a},d:Tt(function(){var s=o.value.value;n[e]!==s&&(n[e]=s,i?t[e]=s:s?t.setAttribute(e,s):t.removeAttribute(e))})}}Wi("unmount",function(t,e){if(typeof e.type=="string"){var r=e.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var s=e.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(e)});Wi("__h",function(t,e,r,n){(n<3||n===9)&&(e.__$f|=2),t(e,r,n)});Lr.prototype.shouldComponentUpdate=function(t,e){var r=this.__$u,n=r&&r.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in t)if(o!=="__source"&&t[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in t))return!0;return!1};function _w(t){return Kp(function(){return sr(t)},[])}var nc=class{url;alt;constructor(e){e.alt&&(this.alt=e.alt),this.url=e.url}};var ic=class{d;cmp;effective;constructor(e={}){this.d=e.d,this.cmp=e.cmp,this.effective=this.d}};var rf=class{id;mID;name;groupID;groupName;isSelected;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.name=e.name,this.groupID=e.groupID,this.groupName=e.groupName,this.isSelected=e.isSelected??!1}},Br=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(e){e=e??{},this.mID=e.mID,this.name=e.name,this.imgs=e.imgs?.map(r=>new nc(r))??[],this.link=e.link,this.price=new ic(e.price),this.sku=e.sku,this.isAvailable=e.isAvailable,this.quantity=e.quantity,this.selectedOptions=e.selectedOptions??[],this.effectivePrice=sr(this.price.effective),e.sellingPlans?.length&&(this.selectedSellingPlan=sr(void 0)),this.sellingPlans=e.sellingPlans?.map(r=>{let n=new rf(r);return n.isSelected&&(this.selectedSellingPlan.value=n),n})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(e){this.selectedSellingPlan.value=e}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};var Dt=class{id;mID;name;options;imgs;vars;desc;link;slug;quantity;category;meta;reviews;tags;selectedOrFirstVariant;selected=sr(!0);constructor(e){this.update(e),this.selectedOrFirstVariant=sr(this.selectedVariant)}get firstImageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}set variants(e){this.vars=e,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(e=>e.isAvailable)??this.vars[0]}hasVariants(){return this.vars?.length>1}setSelectedVariant(e){this.selectedOrFirstVariant.value=e}setSelectedVariantByID(e){if(!e)return;let r=this.vars.find(n=>n.mID===e.toString());r&&this.setSelectedVariant(r)}update(e){return this.id=e.id??this.id,this.mID=e.mID??this.mID,this.name=e.name??this.name,this.imgs=e.imgs??this.imgs,this.desc=e.desc??this.desc,this.link=e.link??this.link,this.slug=e.slug??this.slug,this.quantity=e.quantity??this.quantity,this.meta=e.meta??this.meta,this.category=e.category??this.category,this.reviews=e.reviews??this.reviews,this.options=e.options??this.options,this.tags=e.tags??this.tags,e.vars&&(this.vars=e.vars.map(r=>new Br(r))),this}toEmbed(e){return e=e??this.selectedOrFirstVariant.value,new Rt({id:this.id,mID:this.mID,vID:e.mID,vName:e.name,name:this.name,link:this.link,slug:this.slug,price:e.price.d,imageURL:e.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let e=this.selectedOrFirstVariant.value,r=e.price,n=this.name,i=this.category,o=this.variantImage??this.firstImageURL,s=this.meta,a=this.tags?.join(",")??"",c=this.reviews?.rating,p=this.reviews?.totalReviews,d=r.cmp&&r.cmp>r.d,f=Z(_({name:n},kt("price",r.d,!0)),{image_url:o,meta:s,category:i,rating:c,reviews:p,tags:a});if(e.hasEffectivePrice()){let y=kt("effective_price",e.effectivePrice.value,!0);Object.assign(f,y)}if(d){let y=r.cmp-r.d,T={discount_percent:(y/r.cmp*100).toFixed(0)};Object.assign(f,T),Object.assign(f,kt("compare_price",r.cmp)),Object.assign(f,kt("discount_price",y))}let E={name:e.name,quantity:e.quantity};return{product:f,variant:E}}};var oc=class{id;alt;shortID;sources;items;durationMS;thumbnail;card;constructor(e={}){this.id=e.id,this.alt=e.alt,this.shortID=e.shortID,this.sources=e.sources?.sort((r,n)=>n.height-r.height),this.durationMS=e.durationMS,this.thumbnail=e.thumbnail,this.items=e.items?e.items.map(r=>new Dt(r)):[],this.card=e.card}};var nf=class{enabled;type;color;constructor(e){e??={},this.enabled=e.enabled,this.type=e.type,this.color=new je(e.color)}},of=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new je(e.color)}},sf=class{enabled;delay;constructor(e={}){this.enabled=e.enabled,e.delay&&(this.delay=e.delay>100?e.delay:e.delay*1e3)}},In=class{navigation;pagination;autoplay;loop;maxInRow;gap;maxInRowSm;gapSm;speed;marquee;constructor(e){e??={},this.navigation=new of(e.navigation),this.pagination=new nf(e.pagination),this.autoplay=new sf(e.autoplay),this.loop=e.loop??!1,this.maxInRow=e.maxInRow??4,this.gap=e.gap??0,this.maxInRowSm=e.maxInRowSm??this.maxInRow,this.gapSm=e.gapSm??this.gap,e.speed&&(this.speed=e.speed*1e3),this.marquee=e.marquee}};var sc=class{videos;source;template;heading;slidePerViewCount;autoPlay;showMuteButton;footerContent;detailPopup;playlistConfig;constructor(e={}){this.videos=e.videos?.map(r=>new oc(r))??[],this.source=e.source,this.template=e.template,this.detailPopup=e.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=e.heading,this.showMuteButton=e.showMuteButton,this.slidePerViewCount=e.slidePerViewCount??4,this.autoPlay=e.autoPlay??"ON",this.footerContent=e.footerContent??"FIRST_ITEM",this.playlistConfig=e.playlistConfig?.videoSwiper?{videoSwiper:new In(e.playlistConfig?.videoSwiper)}:void 0}};var Ut=xr(yg());Ut.filters.define("default",function(t){return typeof t>"u"||t==null?"":ww(t)});+Ut.filters.define("max",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r>n?e:t});Ut.filters.define("min",(t,e)=>{let r=Number(t),n=Number(e);return isNaN(r)||isNaN(n)?t:r<n?e:t});Ut.filters.define("fallback",(t,e)=>t==null||t===""?e:t);Ut.filters.define("manipulate_quantity",(t,e,r)=>{if(e??=1,r??=100,e>r)return b.error("Invalid range: min should be less than or equal to max."),t;if(t>=e&&t<=r)return t;let n=t%r;return n<e?e:n});Ut.filters.define("apply_discount_perc",(t,e,r=1/0)=>{if(t=+t,isNaN(t))return b.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(e<0||e>100)return b.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let n=t*e/100;return t-Math.min(r,n)});Ut.filters.define("apply_discount_fixed",(t,e)=>(t=+t,isNaN(t)?(b.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,t-e)));Ut.filters.define("currency",t=>(t=+t,isNaN(t)?(b.error("Need value as a number for `currency` filter"),NaN):Mp(t)));Ut.defaultConfig.defaultFilter="default";Ut.defaultConfig.useWith=!0;Ut.defaultConfig.autoEscape=!1;var bw={'"':""","\\":"\","\n":"\\n"};function ww(t){return String(t).replace(/["\\\n]/g,e=>bw[e])}function Sw(t){if(!t)return"";let e=/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g;return t.replace(e,(r,n,i,o)=>`{{ ${(i||o||"").trim()} }}`)}var ji=(t,e,r)=>{e=_({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},e);try{return Ut.render(Sw(t),e)}catch(n){throw ae(n,"squirrelly-render",{extra:{template:t,values:e},triggerContext:r}),n}},Zn=(t,e,r)=>{let n=JSON.stringify(t),i=ji(n,e,r);try{return JSON.parse(i)}catch(o){throw ae(o,"variable-replacement",{extra:{before:t,after:i},triggerContext:r}),o}};function ss(){return!!window.Shopify}function cc(){if(ss())return window.Shopify.shop?.split(".")?.[0]}function vg(t){let n=(t.includes("://")?new URL(t).pathname:t).match(/\/products\/([^/]+?)(?:\.html)?$/);return n?n[1]:null}function Gi(t){return(window.Shopify?.routes?.root??"/")+t.substring(1)}function lc(t){return Gi(t+"?from=cooee")}var Iw="2024-10",Tw=`/api/${Iw}/graphql.json`,Eg={"Content-Type":"application/json"};async function uc(t,e,r,n){let i=Xe.get().storefrontToken;if(!i)throw new Error("Storefront token not set for the store");let o=new Headers(Eg);o.append("X-Shopify-Storefront-Access-Token",i);let s=JSON.stringify({query:t,variables:e});try{return await Zr(Tw,{method:"POST",headers:o,body:s})}catch(a){throw ae(a,r,{engagementTrigger:n}),a}}function zi(t,e){return xw(lc(t),e)}async function xw(t,e){let r={body:JSON.stringify(e),method:"POST",headers:Eg};return Zr(t,r)}var pc=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(e=>this.queue.push(e));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let e=this.queue.shift();e&&e()}else this.isLocked=!1}},fc=class t{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(e,r){if(e=`__cooee_${e}_lock__`,"locks"in navigator&&!Rw())try{return await Cw(e,r,this.LOCK_TIMEOUT)}catch(s){b.verbose(`Web Locks API failed, falling back to localStorage: ${s}`)}let n=!1,i=0,o=Math.random().toString(36).substring(2,10);for(;i++<this.MAX_RETRIES&&(b.verbose(`Lock retry ${i} for ${e}`),n=await this.acquire(e,o,i),!n);)await this.sleep(t.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(e,o)}}static async acquire(e,r,n){let i=Date.now(),o=localStorage.getItem(e),s=o?JSON.parse(o):null;if(s&&i<=s.expiry)return!1;let a={owner:r,expiry:i+t.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(a)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||"{}").owner===r?(b.verbose(`${r}: Lock acquired for ${e} after ${n} attempts!`),!0):(b.verbose(`${r}: Race lost. Another tab acquired the lock.`),!1)}static release(e,r){let n=localStorage.getItem(e);if(!n)return;let i=JSON.parse(n);i.owner===r?(localStorage.removeItem(e),b.verbose(`${r}: Lock released`)):b.verbose(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(e){return new Promise(r=>setTimeout(r,e))}};async function Cw(t,e,r){return new Promise((n,i)=>{let o=setTimeout(()=>{i(new Error(`Web Locks API timeout after ${r}ms`))},r);navigator.locks.request(t,async()=>{try{let s=await e();return clearTimeout(o),n(s),s}catch(s){throw clearTimeout(o),i(s),s}}).catch(s=>{clearTimeout(o),i(s)})})}function Rw(){let t=navigator.userAgent||"";return/Safari/.test(t)&&!/Chrome/.test(t)&&!/Chromium/.test(t)||/iPhone|iPad|iPod/i.test(t)&&(/(FBAV|FBAN|Instagram|Twitter|Line|WhatsApp)/i.test(t)||!window.safari?.pushNotificaTion)||/Macintosh/.test(t)&&/Safari/.test(t)&&!/Chrome/.test(t)&&!/Chromium/.test(t)&&!window.safari?.pushNotification?!0:Aw()}function Aw(){try{return window.safari?.pushNotification?window.safari.pushNotification.toString()==="[object SafariRemoteNotification]":!window.indexedDB||!window.localStorage}catch{return!0}}var ve=class t{static CURRENT;token;items=[];total_price=0;original_total_price=0;items_subtotal_price=0;currency;item_count=0;attributes;cart_level_discount_applications;total_discount=0;lock=new pc;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new t),this.CURRENT}async getNormalisedCartSilently(){try{return await this.getNormalisedCart()}catch(e){b.error("Failed to get the normalised cart",e)}}async getNormalisedCart(e){await this.fetchCartFromShopify(e);let r=this.convertToCooeeCart();return e&&await Ye.set("cart",r),r}async addCooeeAttributes(){await this.lock.acquire();let e=await kp();if(this.attributes?.letscooee_did===e.letscooee_did&&this.attributes?.letscooee_sn===e.letscooee_sn){b.verbose("Not calling Shopify update.js API.","Current attributes:",this.attributes),this.lock.release();return}try{let r=await zi("/cart/update.js",{attributes:e});b.verbose("Updated cart attributes",JSON.stringify(r.data)),this.update(r.data)}catch(r){b.error("Failed to add cart attributes",r)}this.lock.release()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.items_subtotal_price=e.items_subtotal_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,this.total_discount=e.total_discount,ye.get().currencyCode=this.currency,b.verbose("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}convertToCooeeCart(){return{amount:this.total_price/100,originalAmount:this.original_total_price/100,itemsSubtotalPrice:this.items_subtotal_price/100,currency:this.currency,itemCount:this.item_count,items:this.normaliseItems(this.items),token:this.token}}normaliseItems(e){if(!e)return b.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let r=[];for(let n of e){if(!n.id||!n.title){b.warn("Invalid item received",n);continue}let i={name:n.title,quantity:+n.quantity||1,mID:n.product_id?.toString(),vID:n.id.toString(),price:+n.price/100||0,finalPrice:+n.final_price/100||0,properties:n.properties,key:n.key},o=n.selling_plan_allocation?.selling_plan;if(!o){r.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:o.fixed_selling_plan,id:o.id,name:o.name,recurringDeliveries:o.recurring_deliveries}},r.push(i)}return r}async fetchCartFromShopify(e){if(!e&&this.token){b.verbose("Not fetching cart");return}b.verbose("Fetching cart");let r=lc("/cart.js");try{let n=(await Zr(r,{},{retries:2})).data;this.update(n)}catch(n){b.error("Unable to fetch the cart",n)}}};var mc=class{id;mID;handle;title;imageURL;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.handle=e.handle,this.title=e.title,this.imageURL=e.imageURL}};var af=class{enabled;constructor(e){this.enabled=e.enabled}},cf=class extends af{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max}},dc=class{productQuantity;constructor(e){e??={},this.productQuantity=new cf(e.productQuantity)}};var Kt=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new $n(e.bg)),e.br&&(this.br=new Jr(e.br)),e.shd&&(this.shd=new Uo(e.shd)),e.spc&&(this.spc=new Qr(e.spc)),this.trf=new Vn(e.trf),this.clc=e.clc,this.w=e.w,this.h=e.h,this.x=e.x,this.y=e.y,this.a=e.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return ze[this.t]}get click(){return this.clc}},ze=(P=>(P[P.IMAGE=1]="IMAGE",P[P.TEXT=2]="TEXT",P[P.BUTTON=3]="BUTTON",P[P.FLEXBOX=4]="FLEXBOX",P[P.MULTI_COLUMN=5]="MULTI_COLUMN",P[P.CHECKBOX=6]="CHECKBOX",P[P.PRODUCTS=11]="PRODUCTS",P[P.PRODUCT=12]="PRODUCT",P[P.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",P[P.PRODUCT_TITLE=14]="PRODUCT_TITLE",P[P.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",P[P.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",P[P.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",P[P.PRODUCT_RATING=19]="PRODUCT_RATING",P[P.EMAIL_INPUT=51]="EMAIL_INPUT",P[P.PHONE_INPUT=52]="PHONE_INPUT",P[P.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",P[P.CAROUSEL=62]="CAROUSEL",P[P.SHAPE=100]="SHAPE",P))(ze||{});var ei=class extends Kt{constructor(e){super(e)}};var cn=class extends Kt{src;constructor(e){super(e),this.src=e.src}};var kr=class extends Kt{typo;constructor(e){super(e);let r=_(_({},e.f),e.typo);e.alg&&(r.ta=e.alg),e.c&&(r.tc=e.c),this.typo=new lt(r)}get color(){return this.typography.tc}get typography(){return this.typo}};var Tn=class extends kr{prs;constructor(e){super(e),this.prs=e.prs}get parts(){return this.prs}};var hc=class extends Kt{o;constructor(e){super(e),this.o=e.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}};var qi=class{dd;hh;mm;ss;date;constructor(e){e??={},this.dd=e.dd??0,this.hh=e.hh??0,this.mm=e.mm??0,this.ss=e.ss??0,this.date=e.date?new Date(e.date):void 0}start(e,r){let n=new Date;e===2?(n.setSeconds(n.getSeconds()+this.ss),n.setMinutes(n.getMinutes()+this.mm),n.setHours(n.getHours()+this.hh),n.setDate(n.getDate()+this.dd)):n=this.date??new Date;let i=window.setInterval(()=>{let o=new Date().getTime(),s=n.getTime()-o;if(s<1){clearInterval(i);return}let a=Math.floor(s/(1e3*60*60*24)),c=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),p=Math.floor(s%(1e3*60*60)/(1e3*60)),d=Math.floor(s%(1e3*60)/1e3);r({days:a,hours:c,minutes:p,seconds:d})},1e3);return i}};var Yi=class extends kr{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new qi(e.timer),this.show=e.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var gc=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new je(e.c??{})}get text(){return this.txt}get color(){return this.c}};var xn=class extends kr{ph;constructor(e){super(e),this.ph=new gc(e.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var Ki=class extends xn{constructor(e){e??={},super(e)}};var Xi=class extends xn{};var Ji=class extends xn{};var Qi=class extends cn{};var yc=class{en;ex;constructor(e){e=e??{},this.en=e.en,this.ex=e.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}};var vc=15,as=class extends Kt{gvt;max;cover;anim;embedded;constructor(e){e=e??{},super(e),this.gvt=e.gvt??5,this.max=e.max,this.cover=e.cover??!0,this.anim=new yc(e.anim),this.spc||(this.spc=new Qr({pl:vc,pr:vc,pt:vc,pb:vc}))}};var Ec=class extends as{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new hc(e.cont),this.mob=new as(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(r=>{r.t===1?this.elems.push(new cn(r)):r.t===2?this.elems.push(new Tn(r)):r.t===3?this.elems.push(new Tn(r)):r.t===100?this.elems.push(new ei(r)):r.t===51?this.elems.push(new Xi(r)):r.t===52?this.elems.push(new Ji(r)):r.t===61?this.elems.push(new Yi(r)):r.t===15||r.t===16?this.elems.push(new Ki(r)):r.t===13&&this.elems.push(new Qi(r))})}getStylesForWrapper(){if(this.cover)return{};let e;return this.gvt===1?e={top:0,left:0}:this.gvt===2?e={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?e={top:0,right:0}:this.gvt===6?e={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?e={bottom:0,right:0}:this.gvt===8?e={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?e={bottom:0,left:0}:this.gvt===4?e={top:"50%",left:0,transform:"translateY(-50%)"}:e={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},e.overflow="visible",e}getFlexStylesForContainer(){let e={display:"flex",flexDirection:"row"},r,n;return this.gvt===1?(r="flex-start",n="flex-start"):this.gvt===2?(r="center",n="flex-start"):this.gvt===3?(r="flex-end",n="flex-start"):this.gvt===4?(r="flex-start",n="center"):this.gvt===6?(r="flex-end",n="center"):this.gvt===7?(r="flex-start",n="flex-end"):this.gvt===8?(r="center",n="flex-end"):this.gvt===9?(r="flex-end",n="flex-end"):(r="center",n="center"),e.alignItems=n,e.justifyContent=r,e.overflow="visible",e}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim}};var Zi=class{gap;dir;wrap;jc;ai;scroll;constructor(e){e??={},this.gap=e.gap??0,this.dir=e.dir??"row",this.wrap=e.wrap??"nowrap",this.jc=e.jc??"flex-start",this.ai=e.ai??"flex-start",this.scroll=e.scroll}};var _c=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(e){e??={},this.of=e.of,this.disp=e.disp,this.pos=e.pos,this.top=e.top,this.bottom=e.bottom,this.left=e.left,this.right=e.right,this.zIndex=e.zIndex}};var bc=class{w;h;maxW;maxH;minW;minH;constructor(e){e??={},this.w=e.w??"100%",this.h=e.h??"auto",this.maxW=e.maxW,this.maxH=e.maxH,this.minW=e.minW,this.minH=e.minH}};var wc=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new Qr(e.spc),e.size&&(this.size=new bc(e.size)),e.bg&&(this.bg=new $n(e.bg)),e.br&&(this.br=new Jr(e.br)),e.typo&&(this.typo=new lt(e.typo)),e.lout&&(this.lout=new _c(e.lout)),e.flex&&(this.flex=new Zi(e.flex))}},eo=class{sm;lg;constructor(e){e??={},this.sm=new wc(e.sm),this.lg=new wc(e.lg)}};var yt=class{t;style;hide;when;clc;l;constructor(e,r){r??={},this.t=e,this.style=new eo(r.style),this.hide=r.hide,this.l=r.l,r.when?.op&&(this.when=r.when),r.clc&&(this.clc=r.clc)}get stringType(){return ze[this.t]}};var vt=class extends yt{text;constructor(e,r){e?.style?.lg?.typo?.s&&delete e.style.lg.typo.s,e?.style?.sm?.typo?.s&&delete e.style.sm.typo.s,super(r??2,e),e??={},this.text=e.text}};var ti=class extends vt{constructor(e,r){super(e,r??3)}};var to=class extends yt{value;constructor(e){super(6,e),e??={},this.value=e.value}};var ro=class extends vt{showChips;optionsConfig;constructor(e=15,r){super(r,e),r??={},this.showChips=r.showChips??!1,this.optionsConfig=r.optionsConfig??{}}};var Sc=class extends yt{c;iconSize;showSingleStar;fullStar;halfStart;constructor(e){super(19,e),e??={},this.c=new je(e.c),this.iconSize=e.iconSize??24,this.showSingleStar=e.showSingleStar??!1,this.fullStar=e.fullStar,this.halfStart=e.halfStart}};var _g=xr(Si());var Ic=class extends yt{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e)}update(e){e??={},this.slide=Xt.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new In(e.conf),this.allowedTypes=e.allowedTypes}};var Tc=class extends vt{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new qi(e.timer),this.show=e.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=e.horizontal,this.lblPos=e.lblPos}};var Cn=class extends yt{elems;constructor(e){super(4,e),this.update(e)}update(e){e??={},this.elems??=[],e.elems?.forEach(r=>{let n=Xt.getParsedElement(r);n&&this.elems.push(n)})}};var ri=class extends yt{src;sm;lg;constructor(e,r){super(r??1,e),e&&this.update(e)}update(e){this.src=e.src,this.sm=e.sm,this.lg=e.lg}};var Xt=class t{static getParsedElements(e){let r=[];return e?.forEach(n=>{let i=t.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(e){switch(e.t){case 2:return new vt(e);case 3:return new ti(e);case 6:return new to(e);case 11:return new xc(e);case 12:return new Rn(e);case 61:return new Tc(e);case 4:return new Cn(e);case 1:return new ri(e);case 13:return new ri(e,13);case 14:return new vt(e,14);case 15:case 16:return new ro(e.t,e);case 18:return new ti(e,18);case 62:return new Ic(e);case 19:return new Sc(e);default:_g.default.error("Unknown element type",e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}};var Rn=class extends yt{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(e){if(e??={},super(12,e),this.show=e.show,this.elems=Xt.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new to(e.cBox)),this.elems.push(new ri(e.img,13));let r=new vt(e.title,14);r.hide=!e.show?.title,r.text="{{ product.name }}",this.elems.push(r);let n=new vt(e.price);n.text="{{ product.price }}",n.hide=!e.show?.price;let i=new vt(e.compareAt);i.text="{{ product.compare_price }}",i.hide=!e.show?.price,e.compareAt||(i.style=new eo(n.style),i.style.lg.typo=new lt(Z(_({},i.style.lg.typo),{td:"line-through"})),i.style.sm.typo=new lt(Z(_({},i.style.sm.typo),{td:"line-through"})));let o=new Cn({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Xt.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});o.elems.push(i),o.elems.push(n),this.elems.push(o);let s=new ro(15,e.variantDD);if(s.hide=!e.show?.variantDD,this.elems.push(s),e.btn){let a=new ti(e.btn,18);a.hide=!e.show?.btn,this.elems.push(a)}}e.symbol&&(this.symbol=new vt(e.symbol))}};var xc=class extends yt{conf;prod;constructor(e){super(11,e),e??={},this.conf=new lf(e.conf),this.prod=new Rn(e.prod)}};var Cc=class extends In{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems}},lf=class{lg;sm;constructor(e){e??={},this.lg=new Cc(e.lg),this.sm=new Cc(e.sm)}};var Rc=class extends Cn{constructor(e){super(e)}};var no=class{cont;elems=[];constructor(e){e=e??{},this.cont=new Rc(e.cont),e.elems?.forEach(r=>{this.addRawElement(r)})}addRawElement(e){let r=Xt.getParsedElement(e);return r&&this.elems.push(r),r}};function Ac(t,e){return Dw(t,e,0,5)}function Dw(t,e,r=0,n=50){if(e){if(r>n){console.warn("Maximum recursion depth reached in findFirstElementOfType");return}for(let i of e){if(i.t===t)return i;let o="elems"in i?i.elems:[];if(o?.length>0){let s=Ac(t,o);if(s)return s}}}}var uf=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(e){this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.delay=e.delay??0,this.redirectBehaviour=e.redirectBehaviour,this.onsiteDeliveryType=e.onsiteDeliveryType,this.objective=e.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===Po.EXCLUSION}isABTesting(){return this.contentType===Po.ABTESTING}isSingleContent(){return this.contentType===Po.SINGLE}},cs=class{videoConfig;savingsBarConfig;afterDeleteJS;afterRenderJS;constructor(e){this.update(e)}update(e){e??={},e.videoConfig&&(this.videoConfig=new sc(e.videoConfig)),e.savingsBarConfig&&(this.savingsBarConfig=new oa(e.savingsBarConfig)),e.afterDeleteJS&&(this.afterDeleteJS=e.afterDeleteJS),e.afterRenderJS&&(this.afterRenderJS=e.afterRenderJS)}},xt=class extends uf{contentID;variation;ian;widget;discount;placement;promotionType;contentSource;manipulation;klaviyoFormID;entryAnimation;hasMultiplePlacement;skipSubscribedItems;progressBarConfig;stickyATCConfig;bundleConfig;content;previewType;occurred;id;currency;props;items;nonMutableItems;embeddedItems;bundleFrom;collections;customerData;experimentConfig;discountData=sr({});constructor(e){super(e),this.id=e.id,this.currency=ye.get().currencyCode??"USD",this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new no(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.entryAnimation=e.entryAnimation??"NONE",this.embeddedItems=e.embeddedItems?.map(r=>new Rt(r)),this.items=e.items?.map(r=>new Dt(r))??[],this.nonMutableItems=e.items?.map(r=>new Dt(r))??[],this.collections=e.collections?.map(r=>new mc(r))??[],this.discount=e.discount,this.placement=e.placement,this.customerData=e.customerData,this.ian=e.ian?this.processPopup(e.ian):void 0,this.promotionType=e.promotionType,this.manipulation=new dc(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,this.stickyATCConfig=e.stickyATCConfig,e.experimentConfig&&(this.experimentConfig=new ra(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new ia(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new Zs(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new Dt(e.bundleFrom)),e.content&&(this.content=new cs(e.content))}shouldDelay(){return this.delay>0}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===yr.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Lo.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Lo.PAGE_EMBED}isProgressBar(){return this.objective===yr.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===yr.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===yr.CART_RECOVERY}isProductPromotion(){return this.objective===yr.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===cu.COLLECTION}isBYOB(){return this.objective===yr.BYOB}isStickyATC(){return this.objective===yr.STICKY_ATC}isShoppableVideo(){return this.objective===yr.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===yr.SAVINGS_BAR}processPopup(e){let r=this.items[0],n={},i={};if(r){let a=r.selectedOrFirstVariant.value;n=Z(_(_({name:r.name,id:r.mID,link:r.link,vID:a.mID,image:r.variantImage},kt("price",a.price.d)),kt("comparePrice",a.price.cmp)),{quantity:r.quantity}),i={quantity:a.quantity}}let o={productCount:ve.getCurrent().item_count},s=ji(JSON.stringify(e),{product:n,variant:i,cart:o,discount:this.discount,customer:this.customerData},new Cr(new Date,this));return r&&(s=s.replace(new RegExp("https://cdn.global.letscooee.com/images/placeholders/product.png","gi"),r.variantImage??r.firstImageURL)),new Ec(JSON.parse(s))}calculateDiscountData(e,r){let n=Xr.sum(e,s=>s.selectedOrFirstVariant.value.price.d),i=Xr.sum(e,s=>{let a=s.selectedOrFirstVariant.value.price;return a.cmp??a.d}),o={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!e?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(o);return}if(er.BXGY===this.discount.type&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,o.discountPercentage,!0),o.discountAmount=o.actualPrice-Xr.sum(e,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([er.UNIQUE_FLAT_ITEMS,er.STATIC,er.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],o.discountAmount=o.actualPrice*o.discountPercentage/100,this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===er.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)o.discountAmount=o.actualPrice-this.discount.values[0],o.discountPercentage=o.discountAmount/o.actualPrice*100,this.updateEffectivePrice(e,o.discountPercentage);else if(this.discount.type===er.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((a,c)=>c.selectedOrFirstVariant.value.price.d-a.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.effectivePrice.value=0,o.discountAmount=s.selectedOrFirstVariant.value.price.d,o.discountPercentage=o.discountAmount/o.actualPrice*100}o.discountedPrice=o.actualPrice-o.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(o)}getPrivateAttributesForLineItem(){return Xe.get().skipItemAttribute?{}:{_via:"Cooee",_letscooee_campaign:this.shortID,_letscooee_content:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Xe.get().skipItemAttribute?[]:[{key:"_via",value:"Cooee"},{key:"_letscooee_campaign",value:this.shortID},{key:"_letscooee_content",value:this.contentID}]}isBundleOnCartDrawer(){return this.isBundle()&&this.isCartEmbed()}isBundleOnPDP(){return this.isPageEmbed()&&this.isBundle()}hasSwiperElement(){if(Ac(62,this.widget?.elems))return!0;let r=Ac(11,this.widget?.elems);return r?r.conf.lg.disp===2||r.conf.sm.disp===2:!1}toString(){let e;return this.onsiteDeliveryType===Lo.POPUP?e="Popup":e=Bm.toTitle(this.objective),`${e}(id=${this.shortID})`}getCartMagicVariables(){let e=ve.getCurrent(),r=Xr.sum(e.items??[],n=>n.discounts?.reduce((i,o)=>i+(o.amount??0),0)??0);return _(_(_(_({productCount:e.item_count,product_count:e.item_count},kt("amount",e.total_price/100)),kt("originalAmount",e.original_total_price/100)),kt("total_line_items_discount",r/100)),kt("total_discount",e.total_discount/100))}shouldGetVariationImmediately(){return this.hasMultiplePlacement&&!this.isProgressBar()&&!this.isSavingsBar()}shouldSkipVariation(){return this.isSingleContent()||this.isProgressBar()||this.isSavingsBar()||!!this.widget}updateEffectivePrice(e,r,n=!1){let i=ye.get().getCurrentItem();e.forEach(o=>{let s=o.selectedOrFirstVariant.value,a=s.price;if(n&&o.mID===i.mID)s.effectivePrice.value=a.d;else{let c=a.d*r/100;s.effectivePrice.value=a.d-c}})}formatCurrencyAndNumber(e){if(!e)return{};let r={discountPercentage:Mh(e.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{Object.assign(r,kt(n,e[n]))}),r}};function Ow(t,e){return e={exports:{}},t(e,e.exports),e.exports}var Pw=kw,Lw=Fw,Mw=Vw,Fr=[],cr=[],Bw=typeof Uint8Array<"u"?Uint8Array:Array,pf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ni=0,bg=pf.length;ni<bg;++ni)Fr[ni]=pf[ni],cr[pf.charCodeAt(ni)]=ni;var ni,bg;cr[45]=62;cr[95]=63;function kg(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function kw(t){var e=kg(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Uw(t,e,r){return(e+r)*3/4-r}function Fw(t){var e,r=kg(t),n=r[0],i=r[1],o=new Bw(Uw(t,n,i)),s=0,a=i>0?n-4:n,c;for(c=0;c<a;c+=4)e=cr[t.charCodeAt(c)]<<18|cr[t.charCodeAt(c+1)]<<12|cr[t.charCodeAt(c+2)]<<6|cr[t.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=cr[t.charCodeAt(c)]<<2|cr[t.charCodeAt(c+1)]>>4,o[s++]=e&255),i===1&&(e=cr[t.charCodeAt(c)]<<10|cr[t.charCodeAt(c+1)]<<4|cr[t.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Hw(t){return Fr[t>>18&63]+Fr[t>>12&63]+Fr[t>>6&63]+Fr[t&63]}function $w(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(Hw(n));return i.join("")}function Vw(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push($w(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(Fr[e>>2]+Fr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Fr[e>>10]+Fr[e>>4&63]+Fr[e<<2&63]+"=")),i.join("")}var ff={byteLength:Pw,toByteArray:Lw,fromByteArray:Mw};var Ww=function(e,r,n,i,o){var s,a,c=o*8-i-1,p=(1<<c)-1,d=p>>1,f=-7,E=n?o-1:0,y=n?-1:1,T=e[r+E];for(E+=y,s=T&(1<<-f)-1,T>>=-f,f+=c;f>0;s=s*256+e[r+E],E+=y,f-=8);for(a=s&(1<<-f)-1,s>>=-f,f+=i;f>0;a=a*256+e[r+E],E+=y,f-=8);if(s===0)s=1-d;else{if(s===p)return a?NaN:(T?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-d}return(T?-1:1)*a*Math.pow(2,s-i)},jw=function(e,r,n,i,o,s){var a,c,p,d=s*8-o-1,f=(1<<d)-1,E=f>>1,y=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=i?0:s-1,D=i?1:-1,N=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(c=isNaN(r)?1:0,a=f):(a=Math.floor(Math.log(r)/Math.LN2),r*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+E>=1?r+=y/p:r+=y*Math.pow(2,1-E),r*p>=2&&(a++,p/=2),a+E>=f?(c=0,a=f):a+E>=1?(c=(r*p-1)*Math.pow(2,o),a=a+E):(c=r*Math.pow(2,E-1)*Math.pow(2,o),a=0));o>=8;e[n+T]=c&255,T+=D,c/=256,o-=8);for(a=a<<o|c,d+=o;d>0;e[n+T]=a&255,T+=D,a/=256,d-=8);e[n+T-D]|=N*128},io={read:Ww,write:jw},Oc=Ow(function(t,e){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=k,e.INSPECT_MAX_BYTES=50;var n=2147483647;e.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=i(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var h=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(h,l),h.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(h){if(h>n)throw new RangeError('The value "'+h+'" is invalid for option "size"');var l=new Uint8Array(h);return Object.setPrototypeOf(l,s.prototype),l}function s(h,l,u){if(typeof h=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(h)}return a(h,l,u)}s.poolSize=8192;function a(h,l,u){if(typeof h=="string")return f(h,l);if(ArrayBuffer.isView(h))return y(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h));if(We(h,ArrayBuffer)||h&&We(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(We(h,SharedArrayBuffer)||h&&We(h.buffer,SharedArrayBuffer)))return T(h,l,u);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var v=h.valueOf&&h.valueOf();if(v!=null&&v!==h)return s.from(v,l,u);var C=D(h);if(C)return C;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return s.from(h[Symbol.toPrimitive]("string"),l,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(h))}s.from=function(h,l,u){return a(h,l,u)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function c(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function p(h,l,u){return c(h),h<=0?o(h):l!==void 0?typeof u=="string"?o(h).fill(l,u):o(h).fill(l):o(h)}s.alloc=function(h,l,u){return p(h,l,u)};function d(h){return c(h),o(h<0?0:N(h)|0)}s.allocUnsafe=function(h){return d(h)},s.allocUnsafeSlow=function(h){return d(h)};function f(h,l){if((typeof l!="string"||l==="")&&(l="utf8"),!s.isEncoding(l))throw new TypeError("Unknown encoding: "+l);var u=G(h,l)|0,v=o(u),C=v.write(h,l);return C!==u&&(v=v.slice(0,C)),v}function E(h){for(var l=h.length<0?0:N(h.length)|0,u=o(l),v=0;v<l;v+=1)u[v]=h[v]&255;return u}function y(h){if(We(h,Uint8Array)){var l=new Uint8Array(h);return T(l.buffer,l.byteOffset,l.byteLength)}return E(h)}function T(h,l,u){if(l<0||h.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<l+(u||0))throw new RangeError('"length" is outside of buffer bounds');var v;return l===void 0&&u===void 0?v=new Uint8Array(h):u===void 0?v=new Uint8Array(h,l):v=new Uint8Array(h,l,u),Object.setPrototypeOf(v,s.prototype),v}function D(h){if(s.isBuffer(h)){var l=N(h.length)|0,u=o(l);return u.length===0||h.copy(u,0,0,l),u}if(h.length!==void 0)return typeof h.length!="number"||Ne(h.length)?o(0):E(h);if(h.type==="Buffer"&&Array.isArray(h.data))return E(h.data)}function N(h){if(h>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return h|0}function k(h){return+h!=h&&(h=0),s.alloc(+h)}s.isBuffer=function(l){return l!=null&&l._isBuffer===!0&&l!==s.prototype},s.compare=function(l,u){if(We(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),We(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(l)||!s.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(l===u)return 0;for(var v=l.length,C=u.length,O=0,W=Math.min(v,C);O<W;++O)if(l[O]!==u[O]){v=l[O],C=u[O];break}return v<C?-1:C<v?1:0},s.isEncoding=function(l){switch(String(l).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(l,u){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return s.alloc(0);var v;if(u===void 0)for(u=0,v=0;v<l.length;++v)u+=l[v].length;var C=s.allocUnsafe(u),O=0;for(v=0;v<l.length;++v){var W=l[v];if(We(W,Uint8Array))O+W.length>C.length?s.from(W).copy(C,O):Uint8Array.prototype.set.call(C,W,O);else if(s.isBuffer(W))W.copy(C,O);else throw new TypeError('"list" argument must be an Array of Buffers');O+=W.length}return C};function G(h,l){if(s.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||We(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(h));var u=h.length,v=arguments.length>2&&arguments[2]===!0;if(!v&&u===0)return 0;for(var C=!1;;)switch(l){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return St(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return Ve(h).length;default:if(C)return v?-1:St(h).length;l=(""+l).toLowerCase(),C=!0}}s.byteLength=G;function P(h,l,u){var v=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,l>>>=0,u<=l))return"";for(h||(h="utf8");;)switch(h){case"hex":return V(this,l,u);case"utf8":case"utf-8":return qe(this,l,u);case"ascii":return A(this,l,u);case"latin1":case"binary":return R(this,l,u);case"base64":return Ae(this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,l,u);default:if(v)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),v=!0}}s.prototype._isBuffer=!0;function Q(h,l,u){var v=h[l];h[l]=h[u],h[u]=v}s.prototype.swap16=function(){var l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var u=0;u<l;u+=2)Q(this,u,u+1);return this},s.prototype.swap32=function(){var l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var u=0;u<l;u+=4)Q(this,u,u+3),Q(this,u+1,u+2);return this},s.prototype.swap64=function(){var l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var u=0;u<l;u+=8)Q(this,u,u+7),Q(this,u+1,u+6),Q(this,u+2,u+5),Q(this,u+3,u+4);return this},s.prototype.toString=function(){var l=this.length;return l===0?"":arguments.length===0?qe(this,0,l):P.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(l){if(!s.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:s.compare(this,l)===0},s.prototype.inspect=function(){var l="",u=e.INSPECT_MAX_BYTES;return l=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(l+=" ... "),"<Buffer "+l+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(l,u,v,C,O){if(We(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),!s.isBuffer(l))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(l));if(u===void 0&&(u=0),v===void 0&&(v=l?l.length:0),C===void 0&&(C=0),O===void 0&&(O=this.length),u<0||v>l.length||C<0||O>this.length)throw new RangeError("out of range index");if(C>=O&&u>=v)return 0;if(C>=O)return-1;if(u>=v)return 1;if(u>>>=0,v>>>=0,C>>>=0,O>>>=0,this===l)return 0;for(var W=O-C,ue=v-u,be=Math.min(W,ue),ge=this.slice(C,O),ke=l.slice(u,v),He=0;He<be;++He)if(ge[He]!==ke[He]){W=ge[He],ue=ke[He];break}return W<ue?-1:ue<W?1:0};function _e(h,l,u,v,C){if(h.length===0)return-1;if(typeof u=="string"?(v=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,Ne(u)&&(u=C?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(C)return-1;u=h.length-1}else if(u<0)if(C)u=0;else return-1;if(typeof l=="string"&&(l=s.from(l,v)),s.isBuffer(l))return l.length===0?-1:X(h,l,u,v,C);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?C?Uint8Array.prototype.indexOf.call(h,l,u):Uint8Array.prototype.lastIndexOf.call(h,l,u):X(h,[l],u,v,C);throw new TypeError("val must be string, number or Buffer")}function X(h,l,u,v,C){var O=1,W=h.length,ue=l.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(h.length<2||l.length<2)return-1;O=2,W/=2,ue/=2,u/=2}function be(mr,Yr){return O===1?mr[Yr]:mr.readUInt16BE(Yr*O)}var ge;if(C){var ke=-1;for(ge=u;ge<W;ge++)if(be(h,ge)===be(l,ke===-1?0:ge-ke)){if(ke===-1&&(ke=ge),ge-ke+1===ue)return ke*O}else ke!==-1&&(ge-=ge-ke),ke=-1}else for(u+ue>W&&(u=W-ue),ge=u;ge>=0;ge--){for(var He=!0,ot=0;ot<ue;ot++)if(be(h,ge+ot)!==be(l,ot)){He=!1;break}if(He)return ge}return-1}s.prototype.includes=function(l,u,v){return this.indexOf(l,u,v)!==-1},s.prototype.indexOf=function(l,u,v){return _e(this,l,u,v,!0)},s.prototype.lastIndexOf=function(l,u,v){return _e(this,l,u,v,!1)};function ce(h,l,u,v){u=Number(u)||0;var C=h.length-u;v?(v=Number(v),v>C&&(v=C)):v=C;var O=l.length;v>O/2&&(v=O/2);for(var W=0;W<v;++W){var ue=parseInt(l.substr(W*2,2),16);if(Ne(ue))return W;h[u+W]=ue}return W}function se(h,l,u,v){return De(St(l,h.length-u),h,u,v)}function fe(h,l,u,v){return De(ct(l),h,u,v)}function Be(h,l,u,v){return De(Ve(l),h,u,v)}function Te(h,l,u,v){return De(Se(l,h.length-u),h,u,v)}s.prototype.write=function(l,u,v,C){if(u===void 0)C="utf8",v=this.length,u=0;else if(v===void 0&&typeof u=="string")C=u,v=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(v)?(v=v>>>0,C===void 0&&(C="utf8")):(C=v,v=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var O=this.length-u;if((v===void 0||v>O)&&(v=O),l.length>0&&(v<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");C||(C="utf8");for(var W=!1;;)switch(C){case"hex":return ce(this,l,u,v);case"utf8":case"utf-8":return se(this,l,u,v);case"ascii":case"latin1":case"binary":return fe(this,l,u,v);case"base64":return Be(this,l,u,v);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Te(this,l,u,v);default:if(W)throw new TypeError("Unknown encoding: "+C);C=(""+C).toLowerCase(),W=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ae(h,l,u){return l===0&&u===h.length?ff.fromByteArray(h):ff.fromByteArray(h.slice(l,u))}function qe(h,l,u){u=Math.min(h.length,u);for(var v=[],C=l;C<u;){var O=h[C],W=null,ue=O>239?4:O>223?3:O>191?2:1;if(C+ue<=u){var be,ge,ke,He;switch(ue){case 1:O<128&&(W=O);break;case 2:be=h[C+1],(be&192)===128&&(He=(O&31)<<6|be&63,He>127&&(W=He));break;case 3:be=h[C+1],ge=h[C+2],(be&192)===128&&(ge&192)===128&&(He=(O&15)<<12|(be&63)<<6|ge&63,He>2047&&(He<55296||He>57343)&&(W=He));break;case 4:be=h[C+1],ge=h[C+2],ke=h[C+3],(be&192)===128&&(ge&192)===128&&(ke&192)===128&&(He=(O&15)<<18|(be&63)<<12|(ge&63)<<6|ke&63,He>65535&&He<1114112&&(W=He))}}W===null?(W=65533,ue=1):W>65535&&(W-=65536,v.push(W>>>10&1023|55296),W=56320|W&1023),v.push(W),C+=ue}return Ft(v)}var et=4096;function Ft(h){var l=h.length;if(l<=et)return String.fromCharCode.apply(String,h);for(var u="",v=0;v<l;)u+=String.fromCharCode.apply(String,h.slice(v,v+=et));return u}function A(h,l,u){var v="";u=Math.min(h.length,u);for(var C=l;C<u;++C)v+=String.fromCharCode(h[C]&127);return v}function R(h,l,u){var v="";u=Math.min(h.length,u);for(var C=l;C<u;++C)v+=String.fromCharCode(h[C]);return v}function V(h,l,u){var v=h.length;(!l||l<0)&&(l=0),(!u||u<0||u>v)&&(u=v);for(var C="",O=l;O<u;++O)C+=jt[h[O]];return C}function U(h,l,u){for(var v=h.slice(l,u),C="",O=0;O<v.length-1;O+=2)C+=String.fromCharCode(v[O]+v[O+1]*256);return C}s.prototype.slice=function(l,u){var v=this.length;l=~~l,u=u===void 0?v:~~u,l<0?(l+=v,l<0&&(l=0)):l>v&&(l=v),u<0?(u+=v,u<0&&(u=0)):u>v&&(u=v),u<l&&(u=l);var C=this.subarray(l,u);return Object.setPrototypeOf(C,s.prototype),C};function H(h,l,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+l>u)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(l,u,v){l=l>>>0,u=u>>>0,v||H(l,u,this.length);for(var C=this[l],O=1,W=0;++W<u&&(O*=256);)C+=this[l+W]*O;return C},s.prototype.readUintBE=s.prototype.readUIntBE=function(l,u,v){l=l>>>0,u=u>>>0,v||H(l,u,this.length);for(var C=this[l+--u],O=1;u>0&&(O*=256);)C+=this[l+--u]*O;return C},s.prototype.readUint8=s.prototype.readUInt8=function(l,u){return l=l>>>0,u||H(l,1,this.length),this[l]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(l,u){return l=l>>>0,u||H(l,2,this.length),this[l]|this[l+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(l,u){return l=l>>>0,u||H(l,2,this.length),this[l]<<8|this[l+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(l,u){return l=l>>>0,u||H(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(l,u){return l=l>>>0,u||H(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},s.prototype.readIntLE=function(l,u,v){l=l>>>0,u=u>>>0,v||H(l,u,this.length);for(var C=this[l],O=1,W=0;++W<u&&(O*=256);)C+=this[l+W]*O;return O*=128,C>=O&&(C-=Math.pow(2,8*u)),C},s.prototype.readIntBE=function(l,u,v){l=l>>>0,u=u>>>0,v||H(l,u,this.length);for(var C=u,O=1,W=this[l+--C];C>0&&(O*=256);)W+=this[l+--C]*O;return O*=128,W>=O&&(W-=Math.pow(2,8*u)),W},s.prototype.readInt8=function(l,u){return l=l>>>0,u||H(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},s.prototype.readInt16LE=function(l,u){l=l>>>0,u||H(l,2,this.length);var v=this[l]|this[l+1]<<8;return v&32768?v|4294901760:v},s.prototype.readInt16BE=function(l,u){l=l>>>0,u||H(l,2,this.length);var v=this[l+1]|this[l]<<8;return v&32768?v|4294901760:v},s.prototype.readInt32LE=function(l,u){return l=l>>>0,u||H(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},s.prototype.readInt32BE=function(l,u){return l=l>>>0,u||H(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},s.prototype.readFloatLE=function(l,u){return l=l>>>0,u||H(l,4,this.length),io.read(this,l,!0,23,4)},s.prototype.readFloatBE=function(l,u){return l=l>>>0,u||H(l,4,this.length),io.read(this,l,!1,23,4)},s.prototype.readDoubleLE=function(l,u){return l=l>>>0,u||H(l,8,this.length),io.read(this,l,!0,52,8)},s.prototype.readDoubleBE=function(l,u){return l=l>>>0,u||H(l,8,this.length),io.read(this,l,!1,52,8)};function ne(h,l,u,v,C,O){if(!s.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>C||l<O)throw new RangeError('"value" argument is out of bounds');if(u+v>h.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(l,u,v,C){if(l=+l,u=u>>>0,v=v>>>0,!C){var O=Math.pow(2,8*v)-1;ne(this,l,u,v,O,0)}var W=1,ue=0;for(this[u]=l&255;++ue<v&&(W*=256);)this[u+ue]=l/W&255;return u+v},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(l,u,v,C){if(l=+l,u=u>>>0,v=v>>>0,!C){var O=Math.pow(2,8*v)-1;ne(this,l,u,v,O,0)}var W=v-1,ue=1;for(this[u+W]=l&255;--W>=0&&(ue*=256);)this[u+W]=l/ue&255;return u+v},s.prototype.writeUint8=s.prototype.writeUInt8=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,1,255,0),this[u]=l&255,u+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,2,65535,0),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,2,65535,0),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,4,4294967295,0),this[u+3]=l>>>24,this[u+2]=l>>>16,this[u+1]=l>>>8,this[u]=l&255,u+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,4,4294967295,0),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4},s.prototype.writeIntLE=function(l,u,v,C){if(l=+l,u=u>>>0,!C){var O=Math.pow(2,8*v-1);ne(this,l,u,v,O-1,-O)}var W=0,ue=1,be=0;for(this[u]=l&255;++W<v&&(ue*=256);)l<0&&be===0&&this[u+W-1]!==0&&(be=1),this[u+W]=(l/ue>>0)-be&255;return u+v},s.prototype.writeIntBE=function(l,u,v,C){if(l=+l,u=u>>>0,!C){var O=Math.pow(2,8*v-1);ne(this,l,u,v,O-1,-O)}var W=v-1,ue=1,be=0;for(this[u+W]=l&255;--W>=0&&(ue*=256);)l<0&&be===0&&this[u+W+1]!==0&&(be=1),this[u+W]=(l/ue>>0)-be&255;return u+v},s.prototype.writeInt8=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,1,127,-128),l<0&&(l=255+l+1),this[u]=l&255,u+1},s.prototype.writeInt16LE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,2,32767,-32768),this[u]=l&255,this[u+1]=l>>>8,u+2},s.prototype.writeInt16BE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,2,32767,-32768),this[u]=l>>>8,this[u+1]=l&255,u+2},s.prototype.writeInt32LE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,4,2147483647,-2147483648),this[u]=l&255,this[u+1]=l>>>8,this[u+2]=l>>>16,this[u+3]=l>>>24,u+4},s.prototype.writeInt32BE=function(l,u,v){return l=+l,u=u>>>0,v||ne(this,l,u,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[u]=l>>>24,this[u+1]=l>>>16,this[u+2]=l>>>8,this[u+3]=l&255,u+4};function he(h,l,u,v,C,O){if(u+v>h.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function Ke(h,l,u,v,C){return l=+l,u=u>>>0,C||he(h,l,u,4),io.write(h,l,u,v,23,4),u+4}s.prototype.writeFloatLE=function(l,u,v){return Ke(this,l,u,!0,v)},s.prototype.writeFloatBE=function(l,u,v){return Ke(this,l,u,!1,v)};function nt(h,l,u,v,C){return l=+l,u=u>>>0,C||he(h,l,u,8),io.write(h,l,u,v,52,8),u+8}s.prototype.writeDoubleLE=function(l,u,v){return nt(this,l,u,!0,v)},s.prototype.writeDoubleBE=function(l,u,v){return nt(this,l,u,!1,v)},s.prototype.copy=function(l,u,v,C){if(!s.isBuffer(l))throw new TypeError("argument should be a Buffer");if(v||(v=0),!C&&C!==0&&(C=this.length),u>=l.length&&(u=l.length),u||(u=0),C>0&&C<v&&(C=v),C===v||l.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(v<0||v>=this.length)throw new RangeError("Index out of range");if(C<0)throw new RangeError("sourceEnd out of bounds");C>this.length&&(C=this.length),l.length-u<C-v&&(C=l.length-u+v);var O=C-v;return this===l&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,v,C):Uint8Array.prototype.set.call(l,this.subarray(v,C),u),O},s.prototype.fill=function(l,u,v,C){if(typeof l=="string"){if(typeof u=="string"?(C=u,u=0,v=this.length):typeof v=="string"&&(C=v,v=this.length),C!==void 0&&typeof C!="string")throw new TypeError("encoding must be a string");if(typeof C=="string"&&!s.isEncoding(C))throw new TypeError("Unknown encoding: "+C);if(l.length===1){var O=l.charCodeAt(0);(C==="utf8"&&O<128||C==="latin1")&&(l=O)}}else typeof l=="number"?l=l&255:typeof l=="boolean"&&(l=Number(l));if(u<0||this.length<u||this.length<v)throw new RangeError("Out of range index");if(v<=u)return this;u=u>>>0,v=v===void 0?this.length:v>>>0,l||(l=0);var W;if(typeof l=="number")for(W=u;W<v;++W)this[W]=l;else{var ue=s.isBuffer(l)?l:s.from(l,C),be=ue.length;if(be===0)throw new TypeError('The value "'+l+'" is invalid for argument "value"');for(W=0;W<v-u;++W)this[W+u]=ue[W%be]}return this};var it=/[^+/0-9A-Za-z-_]/g;function wt(h){if(h=h.split("=")[0],h=h.trim().replace(it,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function St(h,l){l=l||1/0;for(var u,v=h.length,C=null,O=[],W=0;W<v;++W){if(u=h.charCodeAt(W),u>55295&&u<57344){if(!C){if(u>56319){(l-=3)>-1&&O.push(239,191,189);continue}else if(W+1===v){(l-=3)>-1&&O.push(239,191,189);continue}C=u;continue}if(u<56320){(l-=3)>-1&&O.push(239,191,189),C=u;continue}u=(C-55296<<10|u-56320)+65536}else C&&(l-=3)>-1&&O.push(239,191,189);if(C=null,u<128){if((l-=1)<0)break;O.push(u)}else if(u<2048){if((l-=2)<0)break;O.push(u>>6|192,u&63|128)}else if(u<65536){if((l-=3)<0)break;O.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((l-=4)<0)break;O.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return O}function ct(h){for(var l=[],u=0;u<h.length;++u)l.push(h.charCodeAt(u)&255);return l}function Se(h,l){for(var u,v,C,O=[],W=0;W<h.length&&!((l-=2)<0);++W)u=h.charCodeAt(W),v=u>>8,C=u%256,O.push(C),O.push(v);return O}function Ve(h){return ff.toByteArray(wt(h))}function De(h,l,u,v){for(var C=0;C<v&&!(C+u>=l.length||C>=h.length);++C)l[C+u]=h[C];return C}function We(h,l){return h instanceof l||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===l.name}function Ne(h){return h!==h}var jt=(function(){for(var h="0123456789abcdef",l=new Array(256),u=0;u<16;++u)for(var v=u*16,C=0;C<16;++C)l[v+C]=h[u]+h[C];return l})()}),Ce=Oc.Buffer;Oc.SlowBuffer;Oc.INSPECT_MAX_BYTES;Oc.kMaxLength;var yf=function(e,r){return yf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},yf(e,r)};function Pc(t,e){yf(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var oi=(function(t){Pc(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e})(Error),Qe=(function(t){Pc(e,t);function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e})(TypeError);function Dc(t){return t&&t.Math==Math&&t}function Ug(){return Dc(typeof globalThis=="object"&&globalThis)||Dc(typeof window=="object"&&window)||Dc(typeof self=="object"&&self)||Dc(typeof global=="object"&&global)||Function("return this")()}function Gw(){var t=Ug();return typeof t.navigator=="object"&&t.navigator.product==="ReactNative"}var zw=function(e){var r=Gw()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(r);for(var n=Ce.alloc(e),i=0;i<e;++i)n[i]=Math.floor(Math.random()*256);return n},qw=function(){{if(typeof window<"u"){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(Ce.alloc(e))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(e){return global.crypto.getRandomValues(Ce.alloc(e))}:zw}},Fg=qw();function Yw(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function Ef(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Kw(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Xw(t){return fs(t)&&Object.prototype.toString.call(t)==="[object Date]"}function fs(t){return typeof t=="object"&&t!==null}function Lc(t,e){var r=!1;function n(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return r||(console.warn(e),r=!0),t.apply(this,i)}return n}function Nc(t){if(ArrayBuffer.isView(t))return Ce.from(t.buffer,t.byteOffset,t.byteLength);if(Yw(t))return Ce.from(t);throw new Qe("Must use either Buffer or TypedArray")}var Jw=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,Hg=function(t){return typeof t=="string"&&Jw.test(t)},vf=function(t){if(!Hg(t))throw new Qe('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return Ce.from(e,"hex")},wg=function(t,e){return e===void 0&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")};var QB=Math.pow(2,63)-1,ZB=-Math.pow(2,63),Qw=Math.pow(2,53),Zw=-Math.pow(2,53);var $g=4;var si=(function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(e!=null&&typeof e!="string"&&!ArrayBuffer.isView(e)&&!(e instanceof ArrayBuffer)&&!Array.isArray(e))throw new Qe("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=r??t.BSON_BINARY_SUBTYPE_DEFAULT,e==null?(this.buffer=Ce.alloc(t.BUFFER_SIZE),this.position=0):(typeof e=="string"?this.buffer=Ce.from(e,"binary"):Array.isArray(e)?this.buffer=Ce.from(e):this.buffer=Nc(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if(typeof e=="string"&&e.length!==1)throw new Qe("only accepts single character String");if(typeof e!="number"&&e.length!==1)throw new Qe("only accepts single character Uint8Array or Array");var r;if(typeof e=="string"?r=e.charCodeAt(0):typeof e=="number"?r=e:r=e[0],r<0||r>255)throw new Qe("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=Ce.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},t.prototype.write=function(e,r){if(r=typeof r=="number"?r:this.position,this.buffer.length<r+e.length){var n=Ce.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(Nc(e),r),this.position=r+e.byteLength>this.position?r+e.length:this.position):typeof e=="string"&&(this.buffer.write(e,r,e.length,"binary"),this.position=r+e.length>this.position?r+e.length:this.position)},t.prototype.read=function(e,r){return r=r&&r>0?r:this.position,this.buffer.slice(e,e+r)},t.prototype.value=function(e){return e=!!e,e&&this.buffer.length===this.position?this.buffer:e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(e){return this.buffer.toString(e)},t.prototype.toExtendedJSON=function(e){e=e||{};var r=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return e.legacy?{$binary:r,$type:n.length===1?"0"+n:n}:{$binary:{base64:r,subType:n.length===1?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new Sg(this.buffer.slice(0,this.position));throw new oi('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,r){r=r||{};var n,i;if("$binary"in e?r.legacy&&typeof e.$binary=="string"&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,n=Ce.from(e.$binary,"base64")):typeof e.$binary!="string"&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=Ce.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=vf(e.$uuid)),!n)throw new Qe("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return i===$g?new Sg(n):new t(n,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t})();Object.defineProperty(si.prototype,"_bsontype",{value:"Binary"});var mf=16,Sg=(function(t){Pc(e,t);function e(r){var n=this,i,o;if(r==null)i=e.generate();else if(r instanceof e)i=Ce.from(r.buffer),o=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===mf)i=Nc(r);else if(typeof r=="string")i=vf(r);else throw new Qe("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");return n=t.call(this,i,$g)||this,n.__id=o,n}return Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,e.cacheHexString&&(this.__id=wg(r))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(r){if(r===void 0&&(r=!0),e.cacheHexString&&this.__id)return this.__id;var n=wg(this.id,r);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(r){return r?this.id.toString(r):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(r){if(!r)return!1;if(r instanceof e)return r.id.equals(this.id);try{return new e(r).id.equals(this.id)}catch{return!1}},e.prototype.toBinary=function(){return new si(this.id,si.SUBTYPE_UUID)},e.generate=function(){var r=Fg(mf);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ce.from(r)},e.isValid=function(r){return r?r instanceof e?!0:typeof r=="string"?Hg(r):Ef(r)?r.length!==mf?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},e.createFromHexString=function(r){var n=vf(r);return new e(n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e})(si),Mc=(function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},t})();Object.defineProperty(Mc.prototype,"_bsontype",{value:"Code"});function eS(t){return fs(t)&&t.$id!=null&&typeof t.$ref=="string"&&(t.$db==null||typeof t.$db=="string")}var us=(function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var o=e.split(".");o.length===2&&(n=o.shift(),e=o.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(e.$db=this.db),e},t.prototype.toExtendedJSON=function(e){e=e||{};var r={$ref:this.collection,$id:this.oid};return e.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t})();Object.defineProperty(us.prototype,"_bsontype",{value:"DBRef"});var ar=void 0;try{ar=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}var Ig=65536,tS=1<<24,so=Ig*Ig,Vg=so*so,Tg=Vg/2,xg={},Cg={},ie=(function(){function t(e,r,n){if(e===void 0&&(e=0),!(this instanceof t))return new t(e,r,n);typeof e=="bigint"?Object.assign(this,t.fromBigInt(e,!!r)):typeof e=="string"?Object.assign(this,t.fromString(e,!!r)):(this.low=e|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,o;return r?(e>>>=0,(o=0<=e&&e<256)&&(i=Cg[e],i)?i:(n=t.fromBits(e,(e|0)<0?-1:0,!0),o&&(Cg[e]=n),n)):(e|=0,(o=-128<=e&&e<128)&&(i=xg[e],i)?i:(n=t.fromBits(e,e<0?-1:0,!1),o&&(xg[e]=n),n))},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=Vg)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Tg)return t.MIN_VALUE;if(e+1>=Tg)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%so|0,e/so|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return t.fromString(e.substring(1),r,n).neg();for(var o=t.fromNumber(Math.pow(n,8)),s=t.ZERO,a=0;a<e.length;a+=8){var c=Math.min(8,e.length-a),p=parseInt(e.substring(a,a+c),n);if(c<8){var d=t.fromNumber(Math.pow(n,c));s=s.mul(d).add(t.fromNumber(p))}else s=s.mul(o),s=s.add(t.fromNumber(p))}return s.unsigned=r,s},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(e){return fs(e)&&e.__isLong__===!0},t.fromValue=function(e,r){return typeof e=="number"?t.fromNumber(e,r):typeof e=="string"?t.fromString(e,r):t.fromBits(e.low,e.high,typeof r=="boolean"?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,o=this.low&65535,s=e.high>>>16,a=e.high&65535,c=e.low>>>16,p=e.low&65535,d=0,f=0,E=0,y=0;return y+=o+p,E+=y>>>16,y&=65535,E+=i+c,f+=E>>>16,E&=65535,f+=n+a,d+=f>>>16,f&=65535,d+=r+s,d&=65535,t.fromBits(E<<16|y,d<<16|f,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(e){return this.compare(e)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(ar){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?ar.div_u:ar.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,ar.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE)){if(e.eq(t.ONE)||e.eq(t.NEG_ONE))return t.MIN_VALUE;if(e.eq(t.MIN_VALUE))return t.ONE;var s=this.shr(1);return n=s.div(e).shl(1),n.eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),o=n.add(i.div(e)),o)}else if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:Math.pow(2,a-48),p=t.fromNumber(n),d=p.mul(e);d.isNegative()||d.gt(i);)n-=c,p=t.fromNumber(n,this.unsigned),d=p.mul(e);p.isZero()&&(p=t.ONE),o=o.add(p),i=i.sub(d)}return o},t.prototype.div=function(e){return this.divide(e)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},t.prototype.eq=function(e){return this.equals(e)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(e&1<<r)===0;r--);return this.high!==0?r+33:r+1},t.prototype.greaterThan=function(e){return this.comp(e)>0},t.prototype.gt=function(e){return this.greaterThan(e)},t.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},t.prototype.gte=function(e){return this.greaterThanOrEqual(e)},t.prototype.ge=function(e){return this.greaterThanOrEqual(e)},t.prototype.isEven=function(){return(this.low&1)===0},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return(this.low&1)===1},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return this.high===0&&this.low===0},t.prototype.lessThan=function(e){return this.comp(e)<0},t.prototype.lt=function(e){return this.lessThan(e)},t.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},t.prototype.lte=function(e){return this.lessThanOrEqual(e)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),ar){var r=(this.unsigned?ar.rem_u:ar.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,ar.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(e){return this.modulo(e)},t.prototype.rem=function(e){return this.modulo(e)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),ar){var r=ar.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,ar.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,o=this.low>>>16,s=this.low&65535,a=e.high>>>16,c=e.high&65535,p=e.low>>>16,d=e.low&65535,f=0,E=0,y=0,T=0;return T+=s*d,y+=T>>>16,T&=65535,y+=o*d,E+=y>>>16,y&=65535,y+=s*p,E+=y>>>16,y&=65535,E+=i*d,f+=E>>>16,E&=65535,E+=o*p,f+=E>>>16,E&=65535,E+=s*c,f+=E>>>16,E&=65535,f+=n*d+i*p+o*c+s*a,f&=65535,t.fromBits(y<<16|T,f<<16|E,this.unsigned)},t.prototype.mul=function(e){return this.multiply(e)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(e){return!this.equals(e)},t.prototype.neq=function(e){return this.notEquals(e)},t.prototype.ne=function(e){return this.notEquals(e)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(e){return this.shiftLeft(e)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(e){return this.shiftRight(e)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),e&=63,e===0)return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}else return e===32?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},t.prototype.shru=function(e){return this.shiftRightUnsigned(e)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(e){return this.subtract(e)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*so+(this.low>>>0):this.high*so+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},t.prototype.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var c=s.div(o),p=s.sub(c.mul(o)).toInt()>>>0,d=p.toString(e);if(s=c,s.isZero())return d+a;for(;d.length<6;)d="0"+d;a=""+d+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(e){return this.lessThanOrEqual(e)},t.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(tS),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t})();Object.defineProperty(ie.prototype,"__isLong__",{value:!0});Object.defineProperty(ie.prototype,"_bsontype",{value:"Long"});var rS=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,nS=/^(\+|-)?(Infinity|inf)$/i,iS=/^(\+|-)?NaN$/i,ls=6111,df=-6176,Rg=6176,oS=34,hf=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ag=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Dg=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),sS=/^([-+])?(\d+)?$/,aS=31,Ng=16383,cS=30,lS=31;function Og(t){return!isNaN(parseInt(t,10))}function uS(t){var e=ie.fromNumber(1e9),r=ie.fromNumber(0);if(!t.parts[0]&&!t.parts[1]&&!t.parts[2]&&!t.parts[3])return{quotient:t,rem:r};for(var n=0;n<=3;n++)r=r.shiftLeft(32),r=r.add(new ie(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function pS(t,e){if(!t&&!e)return{high:ie.fromNumber(0),low:ie.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new ie(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new ie(e.getLowBits(),0),s=r.multiply(i),a=r.multiply(o),c=n.multiply(i),p=n.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new ie(a.getLowBits(),0).add(c).add(p.shiftRightUnsigned(32)),s=s.add(a.shiftRightUnsigned(32)),p=a.shiftLeft(32).add(new ie(p.getLowBits(),0)),{high:s,low:p}}function fS(t,e){var r=t.high>>>0,n=e.high>>>0;if(r<n)return!0;if(r===n){var i=t.low>>>0,o=e.low>>>0;if(i<o)return!0}return!1}function oo(t,e){throw new Qe('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var _f=(function(){function t(e){if(!(this instanceof t))return new t(e);if(typeof e=="string")this.bytes=t.fromString(e).bytes;else if(Ef(e)){if(e.byteLength!==16)throw new Qe("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}else throw new Qe("Decimal128 must take a Buffer or string")}return t.fromString=function(e){var r=!1,n=!1,i=!1,o=0,s=0,a=0,c=0,p=0,d=[0],f=0,E=0,y=0,T=0,D=0,N=0,k=new ie(0,0),G=new ie(0,0),P=0,Q=0;if(e.length>=7e3)throw new Qe(""+e+" not a valid Decimal128 string");var _e=e.match(rS),X=e.match(nS),ce=e.match(iS);if(!_e&&!X&&!ce||e.length===0)throw new Qe(""+e+" not a valid Decimal128 string");if(_e){var se=_e[2],fe=_e[4],Be=_e[5],Te=_e[6];fe&&Te===void 0&&oo(e,"missing exponent power"),fe&&se===void 0&&oo(e,"missing exponent base"),fe===void 0&&(Be||Te)&&oo(e,"missing e before exponent")}if((e[Q]==="+"||e[Q]==="-")&&(r=e[Q++]==="-"),!Og(e[Q])&&e[Q]!=="."){if(e[Q]==="i"||e[Q]==="I")return new t(Ce.from(r?Ag:Dg));if(e[Q]==="N")return new t(Ce.from(hf))}for(;Og(e[Q])||e[Q]===".";){if(e[Q]==="."){n&&oo(e,"contains multiple periods"),n=!0,Q=Q+1;continue}f<34&&(e[Q]!=="0"||i)&&(i||(p=s),i=!0,d[E++]=parseInt(e[Q],10),f=f+1),i&&(a=a+1),n&&(c=c+1),s=s+1,Q=Q+1}if(n&&!s)throw new Qe(""+e+" not a valid Decimal128 string");if(e[Q]==="e"||e[Q]==="E"){var Ae=e.substr(++Q).match(sS);if(!Ae||!Ae[2])return new t(Ce.from(hf));D=parseInt(Ae[0],10),Q=Q+Ae[0].length}if(e[Q])return new t(Ce.from(hf));if(y=0,!f)y=0,T=0,d[0]=0,a=1,f=1,o=0;else if(T=f-1,o=a,o!==1)for(;d[p+o-1]===0;)o=o-1;for(D<=c&&c-D>16384?D=df:D=D-c;D>ls;){if(T=T+1,T-y>oS){var qe=d.join("");if(qe.match(/^0+$/)){D=ls;break}oo(e,"overflow")}D=D-1}for(;D<df||f<a;){if(T===0&&o<f){D=df,o=0;break}if(f<a?a=a-1:T=T-1,D<ls)D=D+1;else{var qe=d.join("");if(qe.match(/^0+$/)){D=ls;break}oo(e,"overflow")}}if(T-y+1<o){var et=s;n&&(p=p+1,et=et+1),r&&(p=p+1,et=et+1);var Ft=parseInt(e[p+T+1],10),A=0;if(Ft>=5&&(A=1,Ft===5)){for(A=d[T]%2===1?1:0,N=p+T+2;N<et;N++)if(parseInt(e[N],10)){A=1;break}}if(A){for(var R=T;R>=0;R--)if(++d[R]>9&&(d[R]=0,R===0))if(D<ls)D=D+1,d[R]=1;else return new t(Ce.from(r?Ag:Dg))}}if(k=ie.fromNumber(0),G=ie.fromNumber(0),o===0)k=ie.fromNumber(0),G=ie.fromNumber(0);else if(T-y<17){var R=y;for(G=ie.fromNumber(d[R++]),k=new ie(0,0);R<=T;R++)G=G.multiply(ie.fromNumber(10)),G=G.add(ie.fromNumber(d[R]))}else{var R=y;for(k=ie.fromNumber(d[R++]);R<=T-17;R++)k=k.multiply(ie.fromNumber(10)),k=k.add(ie.fromNumber(d[R]));for(G=ie.fromNumber(d[R++]);R<=T;R++)G=G.multiply(ie.fromNumber(10)),G=G.add(ie.fromNumber(d[R]))}var V=pS(k,ie.fromString("100000000000000000"));V.low=V.low.add(G),fS(V.low,G)&&(V.high=V.high.add(ie.fromNumber(1))),P=D+Rg;var U={low:ie.fromNumber(0),high:ie.fromNumber(0)};V.high.shiftRightUnsigned(49).and(ie.fromNumber(1)).equals(ie.fromNumber(1))?(U.high=U.high.or(ie.fromNumber(3).shiftLeft(61)),U.high=U.high.or(ie.fromNumber(P).and(ie.fromNumber(16383).shiftLeft(47))),U.high=U.high.or(V.high.and(ie.fromNumber(0x7fffffffffff)))):(U.high=U.high.or(ie.fromNumber(P&16383).shiftLeft(49)),U.high=U.high.or(V.high.and(ie.fromNumber(562949953421311)))),U.low=V.low,r&&(U.high=U.high.or(ie.fromString("9223372036854775808")));var H=Ce.alloc(16);return Q=0,H[Q++]=U.low.low&255,H[Q++]=U.low.low>>8&255,H[Q++]=U.low.low>>16&255,H[Q++]=U.low.low>>24&255,H[Q++]=U.low.high&255,H[Q++]=U.low.high>>8&255,H[Q++]=U.low.high>>16&255,H[Q++]=U.low.high>>24&255,H[Q++]=U.high.low&255,H[Q++]=U.high.low>>8&255,H[Q++]=U.high.low>>16&255,H[Q++]=U.high.low>>24&255,H[Q++]=U.high.high&255,H[Q++]=U.high.high>>8&255,H[Q++]=U.high.high>>16&255,H[Q++]=U.high.high>>24&255,new t(H)},t.prototype.toString=function(){for(var e,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var o=0,s=!1,a,c={parts:[0,0,0,0]},p,d,f=[];o=0;var E=this.bytes,y=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,T=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,D=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,N=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24;o=0;var k={low:new ie(y,T),high:new ie(D,N)};k.high.lessThan(ie.ZERO)&&f.push("-");var G=N>>26&aS;if(G>>3===3){if(G===cS)return f.join("")+"Infinity";if(G===lS)return"NaN";e=N>>15&Ng,a=8+(N>>14&1)}else a=N>>14&7,e=N>>17&Ng;var P=e-Rg;if(c.parts[0]=(N&16383)+((a&15)<<14),c.parts[1]=D,c.parts[2]=T,c.parts[3]=y,c.parts[0]===0&&c.parts[1]===0&&c.parts[2]===0&&c.parts[3]===0)s=!0;else for(d=3;d>=0;d--){var Q=0,_e=uS(c);if(c=_e.quotient,Q=_e.rem.low,!!Q)for(p=8;p>=0;p--)n[d*9+p]=Q%10,Q=Math.floor(Q/10)}if(s)r=1,n[o]=0;else for(r=36;!n[o];)r=r-1,o=o+1;var X=r-1+P;if(X>=34||X<=-7||P>0){if(r>34)return f.push("".concat(0)),P>0?f.push("E+".concat(P)):P<0&&f.push("E".concat(P)),f.join("");f.push("".concat(n[o++])),r=r-1,r&&f.push(".");for(var i=0;i<r;i++)f.push("".concat(n[o++]));f.push("E"),X>0?f.push("+".concat(X)):f.push("".concat(X))}else if(P>=0)for(var i=0;i<r;i++)f.push("".concat(n[o++]));else{var ce=r+P;if(ce>0)for(var i=0;i<ce;i++)f.push("".concat(n[o++]));else f.push("0");for(f.push(".");ce++<0;)f.push("0");for(var i=0;i<r-Math.max(ce-1,0);i++)f.push("".concat(n[o++]))}return f.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t})();Object.defineProperty(_f.prototype,"_bsontype",{value:"Decimal128"});var Bc=(function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var e=this.toExtendedJSON();return"new Double(".concat(e.$numberDouble,")")},t})();Object.defineProperty(Bc.prototype,"_bsontype",{value:"Double"});var kc=(function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e|0}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(e){return this.value.toString(e)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t})();Object.defineProperty(kc.prototype,"_bsontype",{value:"Int32"});var bf=(function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t})();Object.defineProperty(bf.prototype,"_bsontype",{value:"MaxKey"});var wf=(function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t})();Object.defineProperty(wf.prototype,"_bsontype",{value:"MinKey"});var mS=new RegExp("^[0-9a-fA-F]{24}$"),ii=null,Ur=Symbol("id"),Et=(function(){function t(e){if(!(this instanceof t))return new t(e);var r;if(typeof e=="object"&&e&&"id"in e){if(typeof e.id!="string"&&!ArrayBuffer.isView(e.id))throw new Qe("Argument passed in must have an id that is of type string or Buffer");"toHexString"in e&&typeof e.toHexString=="function"?r=Ce.from(e.toHexString(),"hex"):r=e.id}else r=e;if(r==null||typeof r=="number")this[Ur]=t.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Ur]=r instanceof Ce?r:Nc(r);else if(typeof r=="string")if(r.length===12){var n=Ce.from(r);if(n.byteLength===12)this[Ur]=n;else throw new Qe("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&mS.test(r))this[Ur]=Ce.from(r,"hex");else throw new Qe("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Qe("Argument passed in does not match the accepted types");t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Ur]},set:function(e){this[Ur]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(e){this.id.writeUInt32BE(e,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){typeof e!="number"&&(e=Math.floor(Date.now()/1e3));var r=t.getInc(),n=Ce.alloc(12);return n.writeUInt32BE(e,0),ii===null&&(ii=Fg(5)),n[4]=ii[0],n[5]=ii[1],n[6]=ii[2],n[7]=ii[3],n[8]=ii[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(e==null)return!1;if(e instanceof t)return this[Ur][11]===e[Ur][11]&&this[Ur].equals(e[Ur]);if(typeof e=="string"&&t.isValid(e)&&e.length===12&&Ef(this.id))return e===Ce.prototype.toString.call(this.id,"latin1");if(typeof e=="string"&&t.isValid(e)&&e.length===24)return e.toLowerCase()===this.toHexString();if(typeof e=="string"&&t.isValid(e)&&e.length===12)return Ce.from(e).equals(this.id);if(typeof e=="object"&&"toHexString"in e&&typeof e.toHexString=="function"){var r=e.toHexString(),n=this.toHexString().toLowerCase();return typeof r=="string"&&r.toLowerCase()===n}return!1},t.prototype.getTimestamp=function(){var e=new Date,r=this.id.readUInt32BE(0);return e.setTime(Math.floor(r)*1e3),e},t.createPk=function(){return new t},t.createFromTime=function(e){var r=Ce.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(typeof e>"u"||e!=null&&e.length!==24)throw new Qe("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(Ce.from(e,"hex"))},t.isValid=function(e){if(e==null)return!1;try{return new t(e),!0}catch{return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(Math.random()*16777215),t})();Object.defineProperty(Et.prototype,"generate",{value:Lc(function(t){return Et.generate(t)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Et.prototype,"getInc",{value:Lc(function(){return Et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Et.prototype,"get_inc",{value:Lc(function(){return Et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Et,"get_inc",{value:Lc(function(){return Et.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Et.prototype,"_bsontype",{value:"ObjectID"});function dS(t){return t.split("").sort().join("")}var ps=(function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=dS(r??""),this.pattern.indexOf("\0")!==-1)throw new oi("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new oi("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var n=0;n<this.options.length;n++)if(!(this.options[n]==="i"||this.options[n]==="m"||this.options[n]==="x"||this.options[n]==="l"||this.options[n]==="s"||this.options[n]==="u"))throw new oi("The regular expression option [".concat(this.options[n],"] is not supported"))}return t.parseOptions=function(e){return e?e.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(e){return e=e||{},e.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e)if(typeof e.$regex!="string"){if(e.$regex._bsontype==="BSONRegExp")return e}else return new t(e.$regex,t.parseOptions(e.$options));if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new Qe("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t})();Object.defineProperty(ps.prototype,"_bsontype",{value:"BSONRegExp"});var Sf=(function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t})();Object.defineProperty(Sf.prototype,"_bsontype",{value:"Symbol"});var hS=ie,Wg=(function(t){Pc(e,t);function e(r,n){var i=this;return i instanceof e?(ie.isLong(r)?i=t.call(this,r.low,r.high,!0)||this:fs(r)&&typeof r.t<"u"&&typeof r.i<"u"?i=t.call(this,r.i,r.t,!0)||this:i=t.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(r,n)}return e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(r){return new e(ie.fromInt(r,!0))},e.fromNumber=function(r){return new e(ie.fromNumber(r,!0))},e.fromBits=function(r,n){return new e(r,n)},e.fromString=function(r,n){return new e(ie.fromString(r,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(r){return new e(r.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},e.MAX_VALUE=ie.MAX_UNSIGNED_VALUE,e})(hS);function gS(t){return fs(t)&&Reflect.has(t,"_bsontype")&&typeof t._bsontype=="string"}var jg=2147483647,Gg=-2147483648,zg=9223372036854776e3,qg=-9223372036854776e3,yS={$oid:Et,$binary:si,$uuid:si,$symbol:Sf,$numberInt:kc,$numberDecimal:_f,$numberDouble:Bc,$numberLong:ie,$minKey:wf,$maxKey:bf,$regex:ps,$regularExpression:ps,$timestamp:Wg};function Yg(t,e){if(e===void 0&&(e={}),typeof t=="number"){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=Gg&&t<=jg)return new kc(t);if(t>=qg&&t<=zg)return ie.fromNumber(t)}return new Bc(t)}if(t==null||typeof t!="object")return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter(function(f){return f.startsWith("$")&&t[f]!=null}),n=0;n<r.length;n++){var i=yS[r[n]];if(i)return i.fromExtendedJSON(t,e)}if(t.$date!=null){var o=t.$date,s=new Date;return e.legacy?typeof o=="number"?s.setTime(o):typeof o=="string"&&s.setTime(Date.parse(o)):typeof o=="string"?s.setTime(Date.parse(o)):ie.isLong(o)?s.setTime(o.toNumber()):typeof o=="number"&&e.relaxed&&s.setTime(o),s}if(t.$code!=null){var a=Object.assign({},t);return t.$scope&&(a.$scope=Yg(t.$scope)),Mc.fromExtendedJSON(t)}if(eS(t)||t.$dbPointer){var c=t.$ref?t:t.$dbPointer;if(c instanceof us)return c;var p=Object.keys(c).filter(function(f){return f.startsWith("$")}),d=!0;if(p.forEach(function(f){["$ref","$id","$db"].indexOf(f)===-1&&(d=!1)}),d)return us.fromExtendedJSON(c)}return t}function vS(t,e){return t.map(function(r,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return An(r,e)}finally{e.seenObjects.pop()}})}function Pg(t){var e=t.toISOString();return t.getUTCMilliseconds()!==0?e:e.slice(0,-5)+"Z"}function An(t,e){if((typeof t=="object"||typeof t=="function")&&t!==null){var r=e.seenObjects.findIndex(function(k){return k.obj===t});if(r!==-1){var n=e.seenObjects.map(function(k){return k.propertyName}),i=n.slice(0,r).map(function(k){return"".concat(k," -> ")}).join(""),o=n[r],s=" -> "+n.slice(r+1,n.length-1).map(function(k){return"".concat(k," -> ")}).join(""),a=n[n.length-1],c=" ".repeat(i.length+o.length/2),p="-".repeat(s.length+(o.length+a.length)/2-1);throw new Qe(`Converting circular structure to EJSON:
|
|
39
39
|
`+" ".concat(i).concat(o).concat(s).concat(a,`
|
|
40
|
-
`)+" ".concat(c,"\\").concat(p,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return pS(t,e);if(t===void 0)return null;if(t instanceof Date||Ww(t)){var d=t.getTime(),f=d>-1&&d<2534023188e5;return e.legacy?e.relaxed&&f?{$date:t.getTime()}:{$date:Rg(t)}:e.relaxed&&f?{$date:Rg(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var E=t>=Hg&&t<=Fg,y=t>=Vg&&t<=$g;if(E)return{$numberInt:t.toString()};if(y)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||Vw(t)){var T=t.flags;if(T===void 0){var D=t.toString().match(/[gimuy]*$/);D&&(T=D[0])}var N=new ds(t.source,T);return N.toExtendedJSON(e)}return t!=null&&typeof t=="object"?mS(t,e):t}var fS={Binary:function(t){return new si(t.value(),t.sub_type)},Code:function(t){return new Fc(t.code,t.scope)},DBRef:function(t){return new ms(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new wf(t.bytes)},Double:function(t){return new Hc(t.value)},Int32:function(t){return new $c(t.value)},Long:function(t){return ie.fromBits(t.low!=null?t.low:t.low_,t.low!=null?t.high:t.high_,t.low!=null?t.unsigned:t.unsigned_)},MaxKey:function(){return new Sf},MinKey:function(){return new If},ObjectID:function(t){return new Et(t)},ObjectId:function(t){return new Et(t)},BSONRegExp:function(t){return new ds(t.pattern,t.options)},Symbol:function(t){return new Tf(t.value)},Timestamp:function(t){return Ug.fromBits(t.low,t.high)}};function mS(t,e){if(t==null||typeof t!="object")throw new oi("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var o=An(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):n[i]=o}finally{e.seenObjects.pop()}}return n}else if(lS(t)){var s=t;if(typeof s.toExtendedJSON!="function"){var a=fS[t._bsontype];if(!a)throw new Ze("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return r==="Code"&&s.scope?s=new Fc(s.code,An(s.scope,e)):r==="DBRef"&&s.oid&&(s=new ms(An(s.collection,e),An(s.oid,e),An(s.db,e),An(s.fields,e))),s.toExtendedJSON(e)}else throw new oi("_bsontype must be a string, but was: "+typeof r)}var Ag;(function(t){function e(o,s){var a=Object.assign({},{relaxed:!0,legacy:!1},s);return typeof a.relaxed=="boolean"&&(a.strict=!a.relaxed),typeof a.strict=="boolean"&&(a.relaxed=!a.strict),JSON.parse(o,function(c,p){if(c.indexOf("\0")!==-1)throw new oi("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(c)));return Wg(p,a)})}t.parse=e;function r(o,s,a,c){a!=null&&typeof a=="object"&&(c=a,a=0),s!=null&&typeof s=="object"&&!Array.isArray(s)&&(c=s,s=void 0,a=0);var p=Object.assign({relaxed:!0,legacy:!1},c,{seenObjects:[{propertyName:"(root)",obj:null}]}),d=An(o,p);return JSON.stringify(d,s,a)}t.stringify=r;function n(o,s){return s=s||{},JSON.parse(r(o,s))}t.serialize=n;function i(o,s){return s=s||{},e(JSON.stringify(o),s)}t.deserialize=i})(Ag||(Ag={}));var Dg,Ng=Pg();Ng.Map?Dg=Ng.Map:Dg=(function(){function t(e){e===void 0&&(e=[]),this._keys=[],this._values={};for(var r=0;r<e.length;r++)if(e[r]!=null){var n=e[r],i=n[0],o=n[1];this._keys.push(i),this._values[i]={v:o,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var r=this._values[e];return r==null?!1:(delete this._values[e],this._keys.splice(r.i,1),!0)},t.prototype.entries=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?[n,e._values[n].v]:void 0,done:n===void 0}}}},t.prototype.forEach=function(e,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];e.call(r,this._values[i].v,i,r)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return this._values[e]!=null},t.prototype.keys=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},t.prototype.set=function(e,r){return this._values[e]?(this._values[e].v=r,this):(this._keys.push(e),this._values[e]={v:r,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?e._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t})();var GB=ie.fromNumber(Gw),zB=ie.fromNumber(zw);var vf=new Uint8Array(8),YB=new DataView(vf.buffer,vf.byteOffset,vf.byteLength);var dS=1024*1024*17,qB=Ce.alloc(dS);var Dn=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(e){e=e||{},this.triggerID=e.id||e.triggerID,this.nudgeID=e.nudgeID,this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.contentID=e.contentID,this.variation=e.variation,this.props=e.props,this.objective=e.objective,this.onsiteDeliveryType=e.onsiteDeliveryType,this.holdout=e.holdout}};var Ie=class{constructor(e,r={},n,i){this.name=e;this.properties=r;this.id=i?new Et(i):new Et,this.occurred=new Date,n&&(this.trigger=new Dn(n)),this.newEvent=!i}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale;setVideos(e){e&&(this.videos=[e.id])}};var jg=0;function Gg(t,e){if(!t)return;let r=document.createElement("script");r.id=e??"",r.src=t,r.type="module",document.head.appendChild(r)}function xf(t=document.head){return zg(zt.styleURL,t,"cooee-global-styles")}function hS(t=document.head){return zg(zt.swiperStyleURL,t,"cooee-swiper-styles")}function zg(t,e=document.head,r){return new Promise(n=>{if(e.querySelector(`#${r}`)){n();return}let o=document.createElement("link");o.rel="stylesheet",o.href=t,o.id=r,o.onload=()=>{n()},o.onerror=()=>{console.error("Failed to load stylesheet:",t),n()},e.appendChild(o)})}function Cf(t,e=document.head){if(!t)return;jg++;let r=document.createElement("style");r.id=`cooee-app-css-${jg}`,r.textContent=t,e.appendChild(r)}function Yg(t){if(!t)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}function Rf(script){if(script)try{eval(script)}catch(t){console.error("Failed to execute script:",t)}}async function Vc(){let t=(await import("./swiper-bundle-WHJS64TU.js")).default;return window.CooeeSDK.Swiper=t}async function Af(t,e=!0){if(!t)return;let r=[];e&&r.push(hS(t)),r.push(xf(t)),await Promise.all(r);let n=Je.get().website.commonCSS;Cf(n,t)}var Wc=class{lastWidth;lastHeight;resizeTimeout=null;debounceDelay=200;onResizeCallback;constructor(e){this.onResizeCallback=e,this.lastWidth=window.innerWidth,this.lastHeight=window.innerHeight,window.addEventListener("resize",this.debouncedResize),window.addEventListener("orientationchange",this.handleImmediateResize)}destroy(){window.removeEventListener("resize",this.debouncedResize),window.removeEventListener("orientationchange",this.handleImmediateResize)}handleImmediateResize=()=>{this.triggerResize()};debouncedResize=()=>{this.resizeTimeout!==null&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.triggerResize()},this.debounceDelay)};triggerResize(){let e=window.innerWidth,r=window.innerHeight;(r!==this.lastHeight||e!==this.lastWidth)&&(this.onResizeCallback(),this.lastWidth=e,this.lastHeight=r)}};var gS="2.0.4",$f=500,qg="user-agent",fo="",Kg="?",Kc="function",Pn="undefined",mo="object",Vf="string",Ft="browser",ln="cpu",jr="device",Ir="engine",lr="os",uo="result",$="name",L="type",F="vendor",j="version",Ht="architecture",Ts="major",B="model",Ss="console",le="mobile",Ue="tablet",at="smarttv",Vr="wearable",jc="xr",Is="embedded",gs="inapp",Gf="brands",ci="formFactors",zf="fullVersionList",po="platform",Yf="platformVersion",Qc="bitness",Ln="sec-ch-ua",yS=Ln+"-full-version-list",vS=Ln+"-arch",ES=Ln+"-"+Qc,_S=Ln+"-form-factors",bS=Ln+"-"+le,wS=Ln+"-"+B,ly=Ln+"-"+po,SS=ly+"-version",uy=[Gf,zf,le,B,po,Yf,Ht,ci,Qc],Gc="Amazon",co="Apple",Xg="ASUS",Jg="BlackBerry",ai="Google",Qg="Huawei",Df="Lenovo",Zg="Honor",zc="LG",Nf="Microsoft",Of="Motorola",Pf="Nvidia",ey="OnePlus",Lf="OPPO",ys="Samsung",ty="Sharp",vs="Sony",Mf="Xiaomi",Bf="Zebra",ry="Chrome",ny="Chromium",Nn="Chromecast",qc="Edge",Es="Firefox",_s="Opera",kf="Facebook",iy="Sogou",lo="Mobile ",bs=" Browser",Wf="Windows",IS=typeof window!==Pn,$t=IS&&window.navigator?window.navigator:void 0,On=$t&&$t.userAgentData?$t.userAgentData:void 0,TS=function(t,e){var r={},n=e;if(!Xc(e)){n={};for(var i in e)for(var o in e[i])n[o]=e[i][o].concat(n[o]?n[o]:[])}for(var s in t)r[s]=n[s]&&n[s].length%2===0?n[s].concat(t[s]):t[s];return r},Zc=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},jf=function(t,e){if(typeof t===mo&&t.length>0){for(var r in t)if(un(e)==un(t[r]))return!0;return!1}return go(t)?un(e)==un(t):!1},Xc=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?Xc(t[r]):!1)},go=function(t){return typeof t===Vf},Uf=function(t){if(t){for(var e=[],r=ho(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var i=Jc(r[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=Jc(r[n]);return e}},un=function(t){return go(t)?t.toLowerCase():t},Ff=function(t){return go(t)?ho(/[^\d\.]/g,t).split(".")[0]:void 0},pn=function(t){for(var e in t){var r=t[e];typeof r==mo&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},ho=function(t,e){return go(e)?e.replace(t,fo):e},ws=function(t){return ho(/\\?\"/g,t)},Jc=function(t,e){if(go(t))return t=ho(/^\s\s*/,t),typeof e===Pn?t:t.substring(0,$f)},Hf=function(t,e){if(!(!t||!e))for(var r=0,n,i,o,s,a,c;r<e.length&&!a;){var p=e[r],d=e[r+1];for(n=i=0;n<p.length&&!a&&p[n];)if(a=p[n++].exec(t),a)for(o=0;o<d.length;o++)c=a[++i],s=d[o],typeof s===mo&&s.length>0?s.length===2?typeof s[1]==Kc?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===Kc&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=c?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=c?s[1].call(this,c,s[2]):void 0:s.length==3?this[s[0]]=c?c.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=c?s[3].apply(this,[c.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=c||void 0;r+=2}},Wr=function(t,e){for(var r in e)if(typeof e[r]===mo&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(jf(e[r][n],t))return r===Kg?void 0:r}else if(jf(e[r],t))return r===Kg?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},oy={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},sy={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},xS={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},ay={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[j,[$,lo+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[j,[$,qc+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[j,[$,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[$,j],[/opios[\/ ]+([\w\.]+)/i],[j,[$,_s+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[j,[$,_s+" GX"]],[/\bopr\/([\w\.]+)/i],[j,[$,_s]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[j,[$,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[j,[$,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[$,j],[/quark(?:pc)?\/([-\w\.]+)/i],[j,[$,"Quark"]],[/\bddg\/([\w\.]+)/i],[j,[$,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[j,[$,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[j,[$,"WeChat"]],[/konqueror\/([\w\.]+)/i],[j,[$,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[j,[$,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[j,[$,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[j,[$,"Smart "+Df+bs]],[/(avast|avg)\/([\w\.]+)/i],[[$,/(.+)/,"$1 Secure"+bs],j],[/\bfocus\/([\w\.]+)/i],[j,[$,Es+" Focus"]],[/\bopt\/([\w\.]+)/i],[j,[$,_s+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[j,[$,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[j,[$,"Dolphin"]],[/coast\/([\w\.]+)/i],[j,[$,_s+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[j,[$,"MIUI"+bs]],[/fxios\/([\w\.-]+)/i],[j,[$,lo+Es]],[/\bqihoobrowser\/?([\w\.]*)/i],[j,[$,"360"]],[/\b(qq)\/([\w\.]+)/i],[[$,/(.+)/,"$1Browser"],j],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[$,/(.+)/,"$1"+bs],j],[/samsungbrowser\/([\w\.]+)/i],[j,[$,ys+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[j,[$,iy+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[$,iy+" Mobile"],j],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[$,j],[/(lbbrowser|rekonq)/i],[$],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[j,$],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[$,kf],j,[L,gs]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[$,j,[L,gs]],[/\bgsa\/([\w\.]+) .*safari\//i],[j,[$,"GSA"],[L,gs]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[j,[$,"TikTok"],[L,gs]],[/\[(linkedin)app\]/i],[$,[L,gs]],[/(chromium)[\/ ]([-\w\.]+)/i],[$,j],[/headlesschrome(?:\/([\w\.]+)| )/i],[j,[$,ry+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[j,[$,qc+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[$,ry+" WebView"],j],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[j,[$,"Android"+bs]],[/chrome\/([\w\.]+) mobile/i],[j,[$,lo+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[$,j],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[j,[$,lo+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[$,lo+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[j,$],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[$,[j,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[$,j],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[$,lo+Es],j],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[$,"Netscape"],j],[/(wolvic|librewolf)\/([\w\.]+)/i],[$,j],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[j,[$,Es+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[$,[j,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[$,[j,/[^\d\.]+./,fo]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Ht,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Ht,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Ht,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Ht,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Ht,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[Ht,/ower/,fo,un]],[/ sun4\w[;\)]/i],[[Ht,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[Ht,un]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[B,[F,ys],[L,Ue]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[B,[F,ys],[L,le]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[B,[F,co],[L,le]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[B,[F,co],[L,Ue]],[/(macintosh);/i],[B,[F,co]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[B,[F,ty],[L,le]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[B,[F,Zg],[L,Ue]],[/honor([-\w ]+)[;\)]/i],[B,[F,Zg],[L,le]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[B,[F,Qg],[L,Ue]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[B,[F,Qg],[L,le]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[B,/_/g," "],[F,Mf],[L,Ue]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[B,/_/g," "],[F,Mf],[L,le]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[B,[F,ey],[L,le]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[B,[F,Lf],[L,le]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[B,[F,Wr,{OnePlus:["203","304","403","404","413","415"],"*":Lf}],[L,Ue]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[B,[F,"BLU"],[L,le]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[B,[F,"Vivo"],[L,le]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[B,[F,"Realme"],[L,le]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[B,[F,Df],[L,Ue]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[B,[F,Df],[L,le]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[B,[F,Of],[L,le]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[B,[F,Of],[L,Ue]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[B,[F,zc],[L,Ue]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[B,[F,zc],[L,le]],[/(nokia) (t[12][01])/i],[F,B,[L,Ue]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[B,/_/g," "],[L,le],[F,"Nokia"]],[/(pixel (c|tablet))\b/i],[B,[F,ai],[L,Ue]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[B,[F,ai],[L,le]],[/(google) (pixelbook( go)?)/i],[F,B],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[B,[F,vs],[L,le]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[B,"Xperia Tablet"],[F,vs],[L,Ue]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[B,[F,Gc],[L,Ue]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[B,/(.+)/g,"Fire Phone $1"],[F,Gc],[L,le]],[/(playbook);[-\w\),; ]+(rim)/i],[B,F,[L,Ue]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[B,[F,Jg],[L,le]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[B,[F,Xg],[L,Ue]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[B,[F,Xg],[L,le]],[/(nexus 9)/i],[B,[F,"HTC"],[L,Ue]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[F,[B,/_/g," "],[L,le]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[B,[F,"TCL"],[L,Ue]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[B,[F,"TCL"],[L,le]],[/(itel) ((\w+))/i],[[F,un],B,[L,Wr,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[B,[F,"Acer"],[L,Ue]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[B,[F,"Meizu"],[L,le]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[B,[F,"Ulefone"],[L,le]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[B,[F,"Energizer"],[L,le]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[B,[F,"Cat"],[L,le]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[B,[F,"Smartfren"],[L,le]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[B,[F,"Nothing"],[L,le]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[B,[F,"Archos"],[L,Ue]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[B,[F,"Archos"],[L,le]],[/; (n159v)/i],[B,[F,"HMD"],[L,le]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[F,B,[L,Ue]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[F,B,[L,le]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[F,B,[L,Ue]],[/(surface duo)/i],[B,[F,Nf],[L,Ue]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[B,[F,"Fairphone"],[L,le]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[B,[F,Pf],[L,Ue]],[/(sprint) (\w+)/i],[F,B,[L,le]],[/(kin\.[onetw]{3})/i],[[B,/\./g," "],[F,Nf],[L,le]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[B,[F,Bf],[L,Ue]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[B,[F,Bf],[L,le]],[/smart-tv.+(samsung)/i],[F,[L,at]],[/hbbtv.+maple;(\d+)/i],[[B,/^/,"SmartTV"],[F,ys],[L,at]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[F,B,[L,at]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[F,zc],[L,at]],[/(apple) ?tv/i],[F,[B,co+" TV"],[L,at]],[/crkey.*devicetype\/chromecast/i],[[B,Nn+" Third Generation"],[F,ai],[L,at]],[/crkey.*devicetype\/([^/]*)/i],[[B,/^/,"Chromecast "],[F,ai],[L,at]],[/fuchsia.*crkey/i],[[B,Nn+" Nest Hub"],[F,ai],[L,at]],[/crkey/i],[[B,Nn],[F,ai],[L,at]],[/(portaltv)/i],[B,[F,kf],[L,at]],[/droid.+aft(\w+)( bui|\))/i],[B,[F,Gc],[L,at]],[/(shield \w+ tv)/i],[B,[F,Pf],[L,at]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[B,[F,ty],[L,at]],[/(bravia[\w ]+)( bui|\))/i],[B,[F,vs],[L,at]],[/(mi(tv|box)-?\w+) bui/i],[B,[F,Mf],[L,at]],[/Hbbtv.*(technisat) (.*);/i],[F,B,[L,at]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[F,/.+\/(\w+)/,"$1",Wr,{LG:"lge"}],[B,Jc],[L,at]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[B,[L,at]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[L,at]],[/(playstation \w+)/i],[B,[F,vs],[L,Ss]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[B,[F,Nf],[L,Ss]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[F,B,[L,Ss]],[/droid.+; (shield)( bui|\))/i],[B,[F,Pf],[L,Ss]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[B,[F,ys],[L,Vr]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[F,B,[L,Vr]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[B,[F,Lf],[L,Vr]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[B,[F,co],[L,Vr]],[/(opwwe\d{3})/i],[B,[F,ey],[L,Vr]],[/(moto 360)/i],[B,[F,Of],[L,Vr]],[/(smartwatch 3)/i],[B,[F,vs],[L,Vr]],[/(g watch r)/i],[B,[F,zc],[L,Vr]],[/droid.+; (wt63?0{2,3})\)/i],[B,[F,Bf],[L,Vr]],[/droid.+; (glass) \d/i],[B,[F,ai],[L,jc]],[/(pico) (4|neo3(?: link|pro)?)/i],[F,B,[L,jc]],[/(quest( \d| pro)?s?).+vr/i],[B,[F,kf],[L,jc]],[/mobile vr; rv.+firefox/i],[[L,jc]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[F,[L,Is]],[/(aeobc)\b/i],[B,[F,Gc],[L,Is]],[/(homepod).+mac os/i],[B,[F,co],[L,Is]],[/windows iot/i],[[L,Is]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[B,[L,Wr,{mobile:"Mobile",xr:"VR","*":Ue}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[L,Ue]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[L,le]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[B,[F,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[j,[$,qc+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[$,j],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[j,[$,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[$,j],[/ladybird\//i],[[$,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[j,$]],os:[[/(windows nt) (6\.[23]); arm/i],[[$,/N/,"R"],[j,Wr,oy]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[$,j],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[j,/(;|\))/g,"",Wr,oy],[$,Wf]],[/(windows ce)\/?([\d\.]*)/i],[$,j],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[j,/_/g,"."],[$,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[$,"macOS"],[j,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[j,[$,Nn+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[j,[$,Nn+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[j,[$,Nn+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[j,[$,Nn+" Linux"]],[/crkey\/([\d\.]+)/i],[j,[$,Nn]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[j,$],[/(ubuntu) ([\w\.]+) like android/i],[[$,/(.+)/,"$1 Touch"],j],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[$,j],[/\(bb(10);/i],[j,[$,Jg]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[j,[$,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[j,[$,Es+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[j,[$,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[j,Wr,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[$,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[j,[$,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[$,"Chrome OS"],j],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[$,j],[/(sunos) ?([\d\.]*)/i],[[$,"Solaris"],j],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[$,j]]},Yc=(function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return pn.call(t.init,[[Ft,[$,j,Ts,L]],[ln,[Ht]],[jr,[L,B,F]],[Ir,[$,j]],[lr,[$,j]]]),pn.call(t.isIgnore,[[Ft,[j,Ts]],[Ir,[j]],[lr,[j]]]),pn.call(t.isIgnoreRgx,[[Ft,/ ?browser$/i],[lr,/ ?os$/i]]),pn.call(t.toString,[[Ft,[$,j]],[ln,[Ht]],[jr,[F,B]],[Ir,[$,j]],[lr,[$,j]]]),t})(),CS=function(t,e){var r=Yc.init[e],n=Yc.isIgnore[e]||0,i=Yc.isIgnoreRgx[e]||0,o=Yc.toString[e]||0;function s(){pn.call(this,r)}return s.prototype.getItem=function(){return t},s.prototype.withClientHints=function(){return On?On.getHighEntropyValues(uy).then(function(a){return t.setCH(new py(a,!1)).parseCH().get()}):t.parseCH().get()},s.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=uo&&(s.prototype.is=function(a){var c=!1;for(var p in this)if(this.hasOwnProperty(p)&&!jf(n,p)&&un(i?ho(i,this[p]):this[p])==un(i?ho(i,a):a)){if(c=!0,a!=Pn)break}else if(a==Pn&&c){c=!c;break}return c},s.prototype.toString=function(){var a=fo;for(var c in o)typeof this[o[c]]!==Pn&&(a+=(a?" ":fo)+this[o[c]]);return a||Pn}),On||(s.prototype.then=function(a){var c=this,p=function(){for(var f in c)c.hasOwnProperty(f)&&(this[f]=c[f])};p.prototype={is:s.prototype.is,toString:s.prototype.toString};var d=new p;return a(d),d}),new s};function py(t,e){if(t=t||{},pn.call(this,uy),e)pn.call(this,[[Gf,Uf(t[Ln])],[zf,Uf(t[yS])],[le,/\?1/.test(t[bS])],[B,ws(t[wS])],[po,ws(t[ly])],[Yf,ws(t[SS])],[Ht,ws(t[vS])],[ci,Uf(t[_S])],[Qc,ws(t[ES])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==Pn&&(this[r]=t[r])}function cy(t,e,r,n){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if($t&&$t.userAgent==this.ua)switch(this.itemType){case Ft:$t.brave&&typeof $t.brave.isBrave==Kc&&this.set($,"Brave");break;case jr:!this.get(L)&&On&&On[le]&&this.set(L,le),this.get(B)=="Macintosh"&&$t&&typeof $t.standalone!==Pn&&$t.maxTouchPoints&&$t.maxTouchPoints>2&&this.set(B,"iPad").set(L,Ue);break;case lr:!this.get($)&&On&&On[po]&&this.set($,On[po]);break;case uo:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set(Ft,o(Ft)).set(ln,o(ln)).set(jr,o(jr)).set(Ir,o(Ir)).set(lr,o(lr))}return this},this.parseUA=function(){return this.itemType!=uo&&Hf.call(this.data,this.ua,this.rgxMap),this.itemType==Ft&&this.set(Ts,Ff(this.get(j))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case Ft:case Ir:var s=i[zf]||i[Gf],a;if(s)for(var c in s){var p=s[c].brand||s[c],d=s[c].version;this.itemType==Ft&&!/not.a.brand/i.test(p)&&(!a||/Chrom/.test(a)&&p!=ny||a==qc&&/WebView2/.test(p))&&(p=Wr(p,xS),a=this.get($),a&&!/Chrom/.test(a)&&/Chrom/.test(p)||this.set($,p).set(j,d).set(Ts,Ff(d)),a=p),this.itemType==Ir&&p==ny&&this.set(j,d)}break;case ln:var f=i[Ht];f&&(f&&i[Qc]=="64"&&(f+="64"),Hf.call(this.data,f+";",o));break;case jr:if(i[le]&&this.set(L,le),i[B]&&(this.set(B,i[B]),!this.get(L)||!this.get(F))){var E={};Hf.call(E,"droid 9; "+i[B]+")",o),!this.get(L)&&E.type&&this.set(L,E.type),!this.get(F)&&E.vendor&&this.set(F,E.vendor)}if(i[ci]){var y;if(typeof i[ci]!="string")for(var T=0;!y&&T<i[ci].length;)y=Wr(i[ci][T++],sy);else y=Wr(i[ci],sy);this.set(L,y)}break;case lr:var D=i[po];if(D){var N=i[Yf];D==Wf&&(N=parseInt(Ff(N),10)>=13?"11":"10"),this.set($,D).set(j,N)}this.get($)==Wf&&i[B]=="Xbox"&&this.set($,"Xbox").set(j,void 0);break;case uo:var k=this.data,G=function(P){return k[P].getItem().setCH(i).parseCH().get()};this.set(Ft,G(Ft)).set(ln,G(ln)).set(jr,G(jr)).set(Ir,G(Ir)).set(lr,G(lr))}return this},pn.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",CS(this,t)]]),this}function Tr(t,e,r){if(typeof t===mo?(Xc(t,!0)?(typeof e===mo&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===Vf&&!Xc(e,!0)&&(r=e,e=void 0),r&&typeof r.append===Kc){var n={};r.forEach(function(c,p){n[p]=c}),r=n}if(!(this instanceof Tr))return new Tr(t,e,r).getResult();var i=typeof t===Vf?t:r&&r[qg]?r[qg]:$t&&$t.userAgent?$t.userAgent:fo,o=new py(r,!0),s=e?TS(ay,e):ay,a=function(c){return c==uo?function(){return new cy(c,i,s,o).set("ua",i).set(Ft,this.getBrowser()).set(ln,this.getCPU()).set(jr,this.getDevice()).set(Ir,this.getEngine()).set(lr,this.getOS()).get()}:function(){return new cy(c,i,s[c],o).parseUA().get()}};return pn.call(this,[["getBrowser",a(Ft)],["getCPU",a(ln)],["getDevice",a(jr)],["getEngine",a(Ir)],["getOS",a(lr)],["getResult",a(uo)],["getUA",function(){return i}],["setUA",function(c){return go(c)&&(i=c.length>$f?Jc(c,$f):c),this}]]).setUA(i),this}Tr.VERSION=gS;Tr.BROWSER=Zc([$,j,Ts,L]);Tr.CPU=Zc([Ht]);Tr.DEVICE=Zc([B,F,L,Ss,le,at,Ue,Vr,Is]);Tr.ENGINE=Tr.OS=Zc([$,j]);var fy=()=>{let t=window.ShopifyAnalytics?.meta??{},e=t.selectedVariantId;if(e)return e;if(t.product?.variants?.length>0)return t.product.variants[0].id};var ue=class{static storage=new Map;static get(e){return this.storage.has(e)||this.storage.set(e,e.getInstance()),this.storage.get(e)}};var tv=Rr(Ii());function he(t){return typeof t=="function"}function yo(t){let r=t(n=>{Error.call(n),n.stack=new Error().stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var el=yo(t=>function(r){t(this),this.message=r?`${r.length} errors occurred during unsubscription:
|
|
40
|
+
`)+" ".concat(c,"\\").concat(p,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return vS(t,e);if(t===void 0)return null;if(t instanceof Date||Xw(t)){var d=t.getTime(),f=d>-1&&d<2534023188e5;return e.legacy?e.relaxed&&f?{$date:t.getTime()}:{$date:Pg(t)}:e.relaxed&&f?{$date:Pg(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(typeof t=="number"&&(!e.relaxed||!isFinite(t))){if(Math.floor(t)===t){var E=t>=Gg&&t<=jg,y=t>=qg&&t<=zg;if(E)return{$numberInt:t.toString()};if(y)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||Kw(t)){var T=t.flags;if(T===void 0){var D=t.toString().match(/[gimuy]*$/);D&&(T=D[0])}var N=new ps(t.source,T);return N.toExtendedJSON(e)}return t!=null&&typeof t=="object"?_S(t,e):t}var ES={Binary:function(t){return new si(t.value(),t.sub_type)},Code:function(t){return new Mc(t.code,t.scope)},DBRef:function(t){return new us(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new _f(t.bytes)},Double:function(t){return new Bc(t.value)},Int32:function(t){return new kc(t.value)},Long:function(t){return ie.fromBits(t.low!=null?t.low:t.low_,t.low!=null?t.high:t.high_,t.low!=null?t.unsigned:t.unsigned_)},MaxKey:function(){return new bf},MinKey:function(){return new wf},ObjectID:function(t){return new Et(t)},ObjectId:function(t){return new Et(t)},BSONRegExp:function(t){return new ps(t.pattern,t.options)},Symbol:function(t){return new Sf(t.value)},Timestamp:function(t){return Wg.fromBits(t.low,t.high)}};function _S(t,e){if(t==null||typeof t!="object")throw new oi("not an object instance");var r=t._bsontype;if(typeof r>"u"){var n={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var o=An(t[i],e);i==="__proto__"?Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):n[i]=o}finally{e.seenObjects.pop()}}return n}else if(gS(t)){var s=t;if(typeof s.toExtendedJSON!="function"){var a=ES[t._bsontype];if(!a)throw new Qe("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return r==="Code"&&s.scope?s=new Mc(s.code,An(s.scope,e)):r==="DBRef"&&s.oid&&(s=new us(An(s.collection,e),An(s.oid,e),An(s.db,e),An(s.fields,e))),s.toExtendedJSON(e)}else throw new oi("_bsontype must be a string, but was: "+typeof r)}var Lg;(function(t){function e(o,s){var a=Object.assign({},{relaxed:!0,legacy:!1},s);return typeof a.relaxed=="boolean"&&(a.strict=!a.relaxed),typeof a.strict=="boolean"&&(a.relaxed=!a.strict),JSON.parse(o,function(c,p){if(c.indexOf("\0")!==-1)throw new oi("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(c)));return Yg(p,a)})}t.parse=e;function r(o,s,a,c){a!=null&&typeof a=="object"&&(c=a,a=0),s!=null&&typeof s=="object"&&!Array.isArray(s)&&(c=s,s=void 0,a=0);var p=Object.assign({relaxed:!0,legacy:!1},c,{seenObjects:[{propertyName:"(root)",obj:null}]}),d=An(o,p);return JSON.stringify(d,s,a)}t.stringify=r;function n(o,s){return s=s||{},JSON.parse(r(o,s))}t.serialize=n;function i(o,s){return s=s||{},e(JSON.stringify(o),s)}t.deserialize=i})(Lg||(Lg={}));var Mg,Bg=Ug();Bg.Map?Mg=Bg.Map:Mg=(function(){function t(e){e===void 0&&(e=[]),this._keys=[],this._values={};for(var r=0;r<e.length;r++)if(e[r]!=null){var n=e[r],i=n[0],o=n[1];this._keys.push(i),this._values[i]={v:o,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var r=this._values[e];return r==null?!1:(delete this._values[e],this._keys.splice(r.i,1),!0)},t.prototype.entries=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?[n,e._values[n].v]:void 0,done:n===void 0}}}},t.prototype.forEach=function(e,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];e.call(r,this._values[i].v,i,r)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return this._values[e]!=null},t.prototype.keys=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},t.prototype.set=function(e,r){return this._values[e]?(this._values[e].v=r,this):(this._keys.push(e),this._values[e]={v:r,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,r=0;return{next:function(){var n=e._keys[r++];return{value:n!==void 0?e._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t})();var ek=ie.fromNumber(Qw),tk=ie.fromNumber(Zw);var gf=new Uint8Array(8),rk=new DataView(gf.buffer,gf.byteOffset,gf.byteLength);var bS=1024*1024*17,nk=Ce.alloc(bS);var Dn=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(e){e=e||{},this.triggerID=e.id||e.triggerID,this.nudgeID=e.nudgeID,this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.contentID=e.contentID,this.variation=e.variation,this.props=e.props,this.objective=e.objective,this.onsiteDeliveryType=e.onsiteDeliveryType,this.holdout=e.holdout}};var Ie=class{constructor(e,r={},n,i){this.name=e;this.properties=r;this.id=i?new Et(i):new Et,this.occurred=new Date,n&&(this.trigger=new Dn(n)),this.newEvent=!i}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale;setVideos(e){e&&(this.videos=[e.id])}};var Kg=0;function Xg(t,e){if(!t)return;let r=document.createElement("script");r.id=e??"",r.src=t,r.type="module",document.head.appendChild(r)}function If(t=document.head){return Jg(Gt.styleURL,t,"cooee-global-styles")}function wS(t=document.head){return Jg(Gt.swiperStyleURL,t,"cooee-swiper-styles")}function Jg(t,e=document.head,r){return new Promise(n=>{if(e.querySelector(`#${r}`)){n();return}let o=document.createElement("link");o.rel="stylesheet",o.href=t,o.id=r,o.onload=()=>{n()},o.onerror=()=>{console.error("Failed to load stylesheet:",t),n()},e.appendChild(o)})}function Tf(t,e=document.head){if(!t)return;Kg++;let r=document.createElement("style");r.id=`cooee-app-css-${Kg}`,r.textContent=t,e.appendChild(r)}function Qg(t){if(!t)return;let e=document.createElement("script");e.id="cooee-app-script",e.innerHTML=t,document.head.appendChild(e)}function xf(script){if(script)try{eval(script)}catch(t){console.error("Failed to execute script:",t)}}async function Uc(){let t=(await import("./swiper-bundle-WHJS64TU.js")).default;return window.CooeeSDK.Swiper=t}async function Cf(t,e=!0){if(!t)return;let r=[];e&&r.push(wS(t)),r.push(If(t)),await Promise.all(r);let n=Xe.get().website.commonCSS;Tf(n,t)}var Fc=class{lastWidth;lastHeight;resizeTimeout=null;debounceDelay=200;onResizeCallback;constructor(e){this.onResizeCallback=e,this.lastWidth=window.innerWidth,this.lastHeight=window.innerHeight,window.addEventListener("resize",this.debouncedResize),window.addEventListener("orientationchange",this.handleImmediateResize)}destroy(){window.removeEventListener("resize",this.debouncedResize),window.removeEventListener("orientationchange",this.handleImmediateResize)}handleImmediateResize=()=>{this.triggerResize()};debouncedResize=()=>{this.resizeTimeout!==null&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.triggerResize()},this.debounceDelay)};triggerResize(){let e=window.innerWidth,r=window.innerHeight;(r!==this.lastHeight||e!==this.lastWidth)&&(this.onResizeCallback(),this.lastWidth=e,this.lastHeight=r)}};var SS="2.0.4",Ff=500,Zg="user-agent",po="",ey="?",Gc="function",Pn="undefined",fo="object",Hf="string",$t="browser",ln="cpu",Vr="device",wr="engine",lr="os",lo="result",$="name",L="type",F="vendor",j="version",Vt="architecture",ws="major",B="model",_s="console",le="mobile",Ue="tablet",at="smarttv",Hr="wearable",Hc="xr",bs="embedded",ms="inapp",Wf="brands",ci="formFactors",jf="fullVersionList",uo="platform",Gf="platformVersion",Yc="bitness",Ln="sec-ch-ua",IS=Ln+"-full-version-list",TS=Ln+"-arch",xS=Ln+"-"+Yc,CS=Ln+"-form-factors",RS=Ln+"-"+le,AS=Ln+"-"+B,dy=Ln+"-"+uo,DS=dy+"-version",hy=[Wf,jf,le,B,uo,Gf,Vt,ci,Yc],$c="Amazon",ao="Apple",ty="ASUS",ry="BlackBerry",ai="Google",ny="Huawei",Rf="Lenovo",iy="Honor",Vc="LG",Af="Microsoft",Df="Motorola",Nf="Nvidia",oy="OnePlus",Of="OPPO",ds="Samsung",sy="Sharp",hs="Sony",Pf="Xiaomi",Lf="Zebra",ay="Chrome",cy="Chromium",Nn="Chromecast",jc="Edge",gs="Firefox",ys="Opera",Mf="Facebook",ly="Sogou",co="Mobile ",vs=" Browser",$f="Windows",NS=typeof window!==Pn,Wt=NS&&window.navigator?window.navigator:void 0,On=Wt&&Wt.userAgentData?Wt.userAgentData:void 0,OS=function(t,e){var r={},n=e;if(!zc(e)){n={};for(var i in e)for(var o in e[i])n[o]=e[i][o].concat(n[o]?n[o]:[])}for(var s in t)r[s]=n[s]&&n[s].length%2===0?n[s].concat(t[s]):t[s];return r},Kc=function(t){for(var e={},r=0;r<t.length;r++)e[t[r].toUpperCase()]=t[r];return e},Vf=function(t,e){if(typeof t===fo&&t.length>0){for(var r in t)if(un(e)==un(t[r]))return!0;return!1}return ho(t)?un(e)==un(t):!1},zc=function(t,e){for(var r in t)return/^(browser|cpu|device|engine|os)$/.test(r)||(e?zc(t[r]):!1)},ho=function(t){return typeof t===Hf},Bf=function(t){if(t){for(var e=[],r=mo(/\\?\"/g,t).split(","),n=0;n<r.length;n++)if(r[n].indexOf(";")>-1){var i=qc(r[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=qc(r[n]);return e}},un=function(t){return ho(t)?t.toLowerCase():t},kf=function(t){return ho(t)?mo(/[^\d\.]/g,t).split(".")[0]:void 0},pn=function(t){for(var e in t){var r=t[e];typeof r==fo&&r.length==2?this[r[0]]=r[1]:this[r]=void 0}return this},mo=function(t,e){return ho(e)?e.replace(t,po):e},Es=function(t){return mo(/\\?\"/g,t)},qc=function(t,e){if(ho(t))return t=mo(/^\s\s*/,t),typeof e===Pn?t:t.substring(0,Ff)},Uf=function(t,e){if(!(!t||!e))for(var r=0,n,i,o,s,a,c;r<e.length&&!a;){var p=e[r],d=e[r+1];for(n=i=0;n<p.length&&!a&&p[n];)if(a=p[n++].exec(t),a)for(o=0;o<d.length;o++)c=a[++i],s=d[o],typeof s===fo&&s.length>0?s.length===2?typeof s[1]==Gc?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===Gc&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=c?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=c?s[1].call(this,c,s[2]):void 0:s.length==3?this[s[0]]=c?c.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=c?s[3].apply(this,[c.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=c||void 0;r+=2}},$r=function(t,e){for(var r in e)if(typeof e[r]===fo&&e[r].length>0){for(var n=0;n<e[r].length;n++)if(Vf(e[r][n],t))return r===ey?void 0:r}else if(Vf(e[r],t))return r===ey?void 0:r;return e.hasOwnProperty("*")?e["*"]:t},uy={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},py={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},PS={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},fy={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[j,[$,co+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[j,[$,jc+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[j,[$,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[$,j],[/opios[\/ ]+([\w\.]+)/i],[j,[$,ys+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[j,[$,ys+" GX"]],[/\bopr\/([\w\.]+)/i],[j,[$,ys]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[j,[$,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[j,[$,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[$,j],[/quark(?:pc)?\/([-\w\.]+)/i],[j,[$,"Quark"]],[/\bddg\/([\w\.]+)/i],[j,[$,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[j,[$,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[j,[$,"WeChat"]],[/konqueror\/([\w\.]+)/i],[j,[$,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[j,[$,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[j,[$,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[j,[$,"Smart "+Rf+vs]],[/(avast|avg)\/([\w\.]+)/i],[[$,/(.+)/,"$1 Secure"+vs],j],[/\bfocus\/([\w\.]+)/i],[j,[$,gs+" Focus"]],[/\bopt\/([\w\.]+)/i],[j,[$,ys+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[j,[$,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[j,[$,"Dolphin"]],[/coast\/([\w\.]+)/i],[j,[$,ys+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[j,[$,"MIUI"+vs]],[/fxios\/([\w\.-]+)/i],[j,[$,co+gs]],[/\bqihoobrowser\/?([\w\.]*)/i],[j,[$,"360"]],[/\b(qq)\/([\w\.]+)/i],[[$,/(.+)/,"$1Browser"],j],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[$,/(.+)/,"$1"+vs],j],[/samsungbrowser\/([\w\.]+)/i],[j,[$,ds+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[j,[$,ly+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[$,ly+" Mobile"],j],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[$,j],[/(lbbrowser|rekonq)/i],[$],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[j,$],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[$,Mf],j,[L,ms]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[$,j,[L,ms]],[/\bgsa\/([\w\.]+) .*safari\//i],[j,[$,"GSA"],[L,ms]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[j,[$,"TikTok"],[L,ms]],[/\[(linkedin)app\]/i],[$,[L,ms]],[/(chromium)[\/ ]([-\w\.]+)/i],[$,j],[/headlesschrome(?:\/([\w\.]+)| )/i],[j,[$,ay+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[j,[$,jc+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[$,ay+" WebView"],j],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[j,[$,"Android"+vs]],[/chrome\/([\w\.]+) mobile/i],[j,[$,co+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[$,j],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[j,[$,co+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[$,co+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[j,$],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[$,[j,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[$,j],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[$,co+gs],j],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[$,"Netscape"],j],[/(wolvic|librewolf)\/([\w\.]+)/i],[$,j],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[j,[$,gs+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[$,[j,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[$,[j,/[^\d\.]+./,po]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Vt,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Vt,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Vt,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Vt,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Vt,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[Vt,/ower/,po,un]],[/ sun4\w[;\)]/i],[[Vt,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[Vt,un]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[B,[F,ds],[L,Ue]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[B,[F,ds],[L,le]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[B,[F,ao],[L,le]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[B,[F,ao],[L,Ue]],[/(macintosh);/i],[B,[F,ao]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[B,[F,sy],[L,le]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[B,[F,iy],[L,Ue]],[/honor([-\w ]+)[;\)]/i],[B,[F,iy],[L,le]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[B,[F,ny],[L,Ue]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[B,[F,ny],[L,le]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[B,/_/g," "],[F,Pf],[L,Ue]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[B,/_/g," "],[F,Pf],[L,le]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[B,[F,oy],[L,le]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[B,[F,Of],[L,le]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[B,[F,$r,{OnePlus:["203","304","403","404","413","415"],"*":Of}],[L,Ue]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[B,[F,"BLU"],[L,le]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[B,[F,"Vivo"],[L,le]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[B,[F,"Realme"],[L,le]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[B,[F,Rf],[L,Ue]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[B,[F,Rf],[L,le]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[B,[F,Df],[L,le]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[B,[F,Df],[L,Ue]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[B,[F,Vc],[L,Ue]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[B,[F,Vc],[L,le]],[/(nokia) (t[12][01])/i],[F,B,[L,Ue]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[B,/_/g," "],[L,le],[F,"Nokia"]],[/(pixel (c|tablet))\b/i],[B,[F,ai],[L,Ue]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[B,[F,ai],[L,le]],[/(google) (pixelbook( go)?)/i],[F,B],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[B,[F,hs],[L,le]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[B,"Xperia Tablet"],[F,hs],[L,Ue]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[B,[F,$c],[L,Ue]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[B,/(.+)/g,"Fire Phone $1"],[F,$c],[L,le]],[/(playbook);[-\w\),; ]+(rim)/i],[B,F,[L,Ue]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[B,[F,ry],[L,le]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[B,[F,ty],[L,Ue]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[B,[F,ty],[L,le]],[/(nexus 9)/i],[B,[F,"HTC"],[L,Ue]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[F,[B,/_/g," "],[L,le]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[B,[F,"TCL"],[L,Ue]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[B,[F,"TCL"],[L,le]],[/(itel) ((\w+))/i],[[F,un],B,[L,$r,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[B,[F,"Acer"],[L,Ue]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[B,[F,"Meizu"],[L,le]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[B,[F,"Ulefone"],[L,le]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[B,[F,"Energizer"],[L,le]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[B,[F,"Cat"],[L,le]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[B,[F,"Smartfren"],[L,le]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[B,[F,"Nothing"],[L,le]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[B,[F,"Archos"],[L,Ue]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[B,[F,"Archos"],[L,le]],[/; (n159v)/i],[B,[F,"HMD"],[L,le]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[F,B,[L,Ue]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[F,B,[L,le]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[F,B,[L,Ue]],[/(surface duo)/i],[B,[F,Af],[L,Ue]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[B,[F,"Fairphone"],[L,le]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[B,[F,Nf],[L,Ue]],[/(sprint) (\w+)/i],[F,B,[L,le]],[/(kin\.[onetw]{3})/i],[[B,/\./g," "],[F,Af],[L,le]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[B,[F,Lf],[L,Ue]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[B,[F,Lf],[L,le]],[/smart-tv.+(samsung)/i],[F,[L,at]],[/hbbtv.+maple;(\d+)/i],[[B,/^/,"SmartTV"],[F,ds],[L,at]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[F,B,[L,at]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[F,Vc],[L,at]],[/(apple) ?tv/i],[F,[B,ao+" TV"],[L,at]],[/crkey.*devicetype\/chromecast/i],[[B,Nn+" Third Generation"],[F,ai],[L,at]],[/crkey.*devicetype\/([^/]*)/i],[[B,/^/,"Chromecast "],[F,ai],[L,at]],[/fuchsia.*crkey/i],[[B,Nn+" Nest Hub"],[F,ai],[L,at]],[/crkey/i],[[B,Nn],[F,ai],[L,at]],[/(portaltv)/i],[B,[F,Mf],[L,at]],[/droid.+aft(\w+)( bui|\))/i],[B,[F,$c],[L,at]],[/(shield \w+ tv)/i],[B,[F,Nf],[L,at]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[B,[F,sy],[L,at]],[/(bravia[\w ]+)( bui|\))/i],[B,[F,hs],[L,at]],[/(mi(tv|box)-?\w+) bui/i],[B,[F,Pf],[L,at]],[/Hbbtv.*(technisat) (.*);/i],[F,B,[L,at]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[F,/.+\/(\w+)/,"$1",$r,{LG:"lge"}],[B,qc],[L,at]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[B,[L,at]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[L,at]],[/(playstation \w+)/i],[B,[F,hs],[L,_s]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[B,[F,Af],[L,_s]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[F,B,[L,_s]],[/droid.+; (shield)( bui|\))/i],[B,[F,Nf],[L,_s]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[B,[F,ds],[L,Hr]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[F,B,[L,Hr]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[B,[F,Of],[L,Hr]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[B,[F,ao],[L,Hr]],[/(opwwe\d{3})/i],[B,[F,oy],[L,Hr]],[/(moto 360)/i],[B,[F,Df],[L,Hr]],[/(smartwatch 3)/i],[B,[F,hs],[L,Hr]],[/(g watch r)/i],[B,[F,Vc],[L,Hr]],[/droid.+; (wt63?0{2,3})\)/i],[B,[F,Lf],[L,Hr]],[/droid.+; (glass) \d/i],[B,[F,ai],[L,Hc]],[/(pico) (4|neo3(?: link|pro)?)/i],[F,B,[L,Hc]],[/(quest( \d| pro)?s?).+vr/i],[B,[F,Mf],[L,Hc]],[/mobile vr; rv.+firefox/i],[[L,Hc]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[F,[L,bs]],[/(aeobc)\b/i],[B,[F,$c],[L,bs]],[/(homepod).+mac os/i],[B,[F,ao],[L,bs]],[/windows iot/i],[[L,bs]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[B,[L,$r,{mobile:"Mobile",xr:"VR","*":Ue}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[L,Ue]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[L,le]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[B,[F,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[j,[$,jc+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[$,j],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[j,[$,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[$,j],[/ladybird\//i],[[$,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[j,$]],os:[[/(windows nt) (6\.[23]); arm/i],[[$,/N/,"R"],[j,$r,uy]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[$,j],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[j,/(;|\))/g,"",$r,uy],[$,$f]],[/(windows ce)\/?([\d\.]*)/i],[$,j],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[j,/_/g,"."],[$,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[$,"macOS"],[j,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[j,[$,Nn+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[j,[$,Nn+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[j,[$,Nn+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[j,[$,Nn+" Linux"]],[/crkey\/([\d\.]+)/i],[j,[$,Nn]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[j,$],[/(ubuntu) ([\w\.]+) like android/i],[[$,/(.+)/,"$1 Touch"],j],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[$,j],[/\(bb(10);/i],[j,[$,ry]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[j,[$,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[j,[$,gs+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[j,[$,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[j,$r,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[$,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[j,[$,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[$,"Chrome OS"],j],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[$,j],[/(sunos) ?([\d\.]*)/i],[[$,"Solaris"],j],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[$,j]]},Wc=(function(){var t={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return pn.call(t.init,[[$t,[$,j,ws,L]],[ln,[Vt]],[Vr,[L,B,F]],[wr,[$,j]],[lr,[$,j]]]),pn.call(t.isIgnore,[[$t,[j,ws]],[wr,[j]],[lr,[j]]]),pn.call(t.isIgnoreRgx,[[$t,/ ?browser$/i],[lr,/ ?os$/i]]),pn.call(t.toString,[[$t,[$,j]],[ln,[Vt]],[Vr,[F,B]],[wr,[$,j]],[lr,[$,j]]]),t})(),LS=function(t,e){var r=Wc.init[e],n=Wc.isIgnore[e]||0,i=Wc.isIgnoreRgx[e]||0,o=Wc.toString[e]||0;function s(){pn.call(this,r)}return s.prototype.getItem=function(){return t},s.prototype.withClientHints=function(){return On?On.getHighEntropyValues(hy).then(function(a){return t.setCH(new gy(a,!1)).parseCH().get()}):t.parseCH().get()},s.prototype.withFeatureCheck=function(){return t.detectFeature().get()},e!=lo&&(s.prototype.is=function(a){var c=!1;for(var p in this)if(this.hasOwnProperty(p)&&!Vf(n,p)&&un(i?mo(i,this[p]):this[p])==un(i?mo(i,a):a)){if(c=!0,a!=Pn)break}else if(a==Pn&&c){c=!c;break}return c},s.prototype.toString=function(){var a=po;for(var c in o)typeof this[o[c]]!==Pn&&(a+=(a?" ":po)+this[o[c]]);return a||Pn}),On||(s.prototype.then=function(a){var c=this,p=function(){for(var f in c)c.hasOwnProperty(f)&&(this[f]=c[f])};p.prototype={is:s.prototype.is,toString:s.prototype.toString};var d=new p;return a(d),d}),new s};function gy(t,e){if(t=t||{},pn.call(this,hy),e)pn.call(this,[[Wf,Bf(t[Ln])],[jf,Bf(t[IS])],[le,/\?1/.test(t[RS])],[B,Es(t[AS])],[uo,Es(t[dy])],[Gf,Es(t[DS])],[Vt,Es(t[TS])],[ci,Bf(t[CS])],[Yc,Es(t[xS])]]);else for(var r in t)this.hasOwnProperty(r)&&typeof t[r]!==Pn&&(this[r]=t[r])}function my(t,e,r,n){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(Wt&&Wt.userAgent==this.ua)switch(this.itemType){case $t:Wt.brave&&typeof Wt.brave.isBrave==Gc&&this.set($,"Brave");break;case Vr:!this.get(L)&&On&&On[le]&&this.set(L,le),this.get(B)=="Macintosh"&&Wt&&typeof Wt.standalone!==Pn&&Wt.maxTouchPoints&&Wt.maxTouchPoints>2&&this.set(B,"iPad").set(L,Ue);break;case lr:!this.get($)&&On&&On[uo]&&this.set($,On[uo]);break;case lo:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set($t,o($t)).set(ln,o(ln)).set(Vr,o(Vr)).set(wr,o(wr)).set(lr,o(lr))}return this},this.parseUA=function(){return this.itemType!=lo&&Uf.call(this.data,this.ua,this.rgxMap),this.itemType==$t&&this.set(ws,kf(this.get(j))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case $t:case wr:var s=i[jf]||i[Wf],a;if(s)for(var c in s){var p=s[c].brand||s[c],d=s[c].version;this.itemType==$t&&!/not.a.brand/i.test(p)&&(!a||/Chrom/.test(a)&&p!=cy||a==jc&&/WebView2/.test(p))&&(p=$r(p,PS),a=this.get($),a&&!/Chrom/.test(a)&&/Chrom/.test(p)||this.set($,p).set(j,d).set(ws,kf(d)),a=p),this.itemType==wr&&p==cy&&this.set(j,d)}break;case ln:var f=i[Vt];f&&(f&&i[Yc]=="64"&&(f+="64"),Uf.call(this.data,f+";",o));break;case Vr:if(i[le]&&this.set(L,le),i[B]&&(this.set(B,i[B]),!this.get(L)||!this.get(F))){var E={};Uf.call(E,"droid 9; "+i[B]+")",o),!this.get(L)&&E.type&&this.set(L,E.type),!this.get(F)&&E.vendor&&this.set(F,E.vendor)}if(i[ci]){var y;if(typeof i[ci]!="string")for(var T=0;!y&&T<i[ci].length;)y=$r(i[ci][T++],py);else y=$r(i[ci],py);this.set(L,y)}break;case lr:var D=i[uo];if(D){var N=i[Gf];D==$f&&(N=parseInt(kf(N),10)>=13?"11":"10"),this.set($,D).set(j,N)}this.get($)==$f&&i[B]=="Xbox"&&this.set($,"Xbox").set(j,void 0);break;case lo:var k=this.data,G=function(P){return k[P].getItem().setCH(i).parseCH().get()};this.set($t,G($t)).set(ln,G(ln)).set(Vr,G(Vr)).set(wr,G(wr)).set(lr,G(lr))}return this},pn.call(this,[["itemType",t],["ua",e],["uaCH",n],["rgxMap",r],["data",LS(this,t)]]),this}function Sr(t,e,r){if(typeof t===fo?(zc(t,!0)?(typeof e===fo&&(r=e),e=t):(r=t,e=void 0),t=void 0):typeof t===Hf&&!zc(e,!0)&&(r=e,e=void 0),r&&typeof r.append===Gc){var n={};r.forEach(function(c,p){n[p]=c}),r=n}if(!(this instanceof Sr))return new Sr(t,e,r).getResult();var i=typeof t===Hf?t:r&&r[Zg]?r[Zg]:Wt&&Wt.userAgent?Wt.userAgent:po,o=new gy(r,!0),s=e?OS(fy,e):fy,a=function(c){return c==lo?function(){return new my(c,i,s,o).set("ua",i).set($t,this.getBrowser()).set(ln,this.getCPU()).set(Vr,this.getDevice()).set(wr,this.getEngine()).set(lr,this.getOS()).get()}:function(){return new my(c,i,s[c],o).parseUA().get()}};return pn.call(this,[["getBrowser",a($t)],["getCPU",a(ln)],["getDevice",a(Vr)],["getEngine",a(wr)],["getOS",a(lr)],["getResult",a(lo)],["getUA",function(){return i}],["setUA",function(c){return ho(c)&&(i=c.length>Ff?qc(c,Ff):c),this}]]).setUA(i),this}Sr.VERSION=SS;Sr.BROWSER=Kc([$,j,ws,L]);Sr.CPU=Kc([Vt]);Sr.DEVICE=Kc([B,F,L,_s,le,at,Ue,Hr,bs]);Sr.ENGINE=Sr.OS=Kc([$,j]);var yy=()=>{let t=window.ShopifyAnalytics?.meta??{},e=t.selectedVariantId;if(e)return e;if(t.product?.variants?.length>0)return t.product.variants[0].id};var me=class{static storage=new Map;static get(e){return this.storage.has(e)||this.storage.set(e,e.getInstance()),this.storage.get(e)}};var cv=xr(Si());function de(t){return typeof t=="function"}function go(t){let r=t(n=>{Error.call(n),n.stack=new Error().stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Xc=go(t=>function(r){t(this),this.message=r?`${r.length} errors occurred during unsubscription:
|
|
41
41
|
${r.map((n,i)=>`${i+1}) ${n.toString()}`).join(`
|
|
42
|
-
`)}`:"",this.name="UnsubscriptionError",this.errors=r});function li(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var ur=class t{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let o of r)o.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(he(n))try{n()}catch(o){e=o instanceof el?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{my(o)}catch(s){e=e??[],s instanceof el?e=[...e,...s.errors]:e.push(s)}}if(e)throw new el(e)}}add(e){var r;if(e&&e!==this)if(this.closed)my(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&li(r,e)}remove(e){let{_finalizers:r}=this;r&&li(r,e),e instanceof t&&e._removeParent(this)}};ur.EMPTY=(()=>{let t=new ur;return t.closed=!0,t})();var qf=ur.EMPTY;function tl(t){return t instanceof ur||t&&"closed"in t&&he(t.remove)&&he(t.add)&&he(t.unsubscribe)}function my(t){he(t)?t():t.unsubscribe()}var xr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var vo={setTimeout(t,e,...r){let{delegate:n}=vo;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=vo;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function rl(t){vo.setTimeout(()=>{let{onUnhandledError:e}=xr;if(e)e(t);else throw t})}function Kf(){}var dy=Xf("C",void 0,void 0);function hy(t){return Xf("E",void 0,t)}function gy(t){return Xf("N",t,void 0)}function Xf(t,e,r){return{kind:t,value:e,error:r}}var ui=null;function Eo(t){if(xr.useDeprecatedSynchronousErrorHandling){let e=!ui;if(e&&(ui={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=ui;if(ui=null,r)throw n}}else t()}function yy(t){xr.useDeprecatedSynchronousErrorHandling&&ui&&(ui.errorThrown=!0,ui.error=t)}var pi=class extends ur{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,tl(e)&&e.add(this)):this.destination=DS}static create(e,r,n){return new Mn(e,r,n)}next(e){this.isStopped?Qf(gy(e),this):this._next(e)}error(e){this.isStopped?Qf(hy(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?Qf(dy,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},RS=Function.prototype.bind;function Jf(t,e){return RS.call(t,e)}var Zf=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:r}=this;if(r.next)try{r.next(e)}catch(n){nl(n)}}error(e){let{partialObserver:r}=this;if(r.error)try{r.error(e)}catch(n){nl(n)}else nl(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(r){nl(r)}}},Mn=class extends pi{constructor(e,r,n){super();let i;if(he(e)||!e)i={next:e??void 0,error:r??void 0,complete:n??void 0};else{let o;this&&xr.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&Jf(e.next,o),error:e.error&&Jf(e.error,o),complete:e.complete&&Jf(e.complete,o)}):i=e}this.destination=new Zf(i)}};function nl(t){xr.useDeprecatedSynchronousErrorHandling?yy(t):rl(t)}function AS(t){throw t}function Qf(t,e){let{onStoppedNotification:r}=xr;r&&vo.setTimeout(()=>r(t,e))}var DS={closed:!0,next:Kf,error:AS,complete:Kf};var _o=typeof Symbol=="function"&&Symbol.observable||"@@observable";function il(t){return t}function vy(t){return t.length===0?il:t.length===1?t[0]:function(r){return t.reduce((n,i)=>i(n),r)}}var Ye=(()=>{class t{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new t;return n.source=this,n.operator=r,n}subscribe(r,n,i){let o=OS(r)?r:new Mn(r,n,i);return Eo(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=Ey(n),new n((i,o)=>{let s=new Mn({next:a=>{try{r(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[_o](){return this}pipe(...r){return vy(r)(this)}toPromise(r){return r=Ey(r),new r((n,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>n(o))})}}return t.create=e=>new t(e),t})();function Ey(t){var e;return(e=t??xr.Promise)!==null&&e!==void 0?e:Promise}function NS(t){return t&&he(t.next)&&he(t.error)&&he(t.complete)}function OS(t){return t&&t instanceof pi||NS(t)&&tl(t)}function PS(t){return he(t?.lift)}function Vt(t){return e=>{if(PS(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Wt(t,e,r,n,i){return new em(t,e,r,n,i)}var em=class extends pi{constructor(e,r,n,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(a){try{r(a)}catch(c){e.error(c)}}:super._next,this._error=i?function(a){try{i(a)}catch(c){e.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};var _y=yo(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var jt=(()=>{class t extends Ye{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new ol(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new _y}next(r){Eo(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){Eo(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:n}=this;for(;n.length;)n.shift().error(r)}})}complete(){Eo(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:o}=this;return n||i?qf:(this.currentObservers=null,o.push(r),new ur(()=>{this.currentObservers=null,li(o,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:o}=this;n?r.error(i):o&&r.complete()}asObservable(){let r=new Ye;return r.source=this,r}}return t.create=(e,r)=>new ol(e,r),t})(),ol=class extends jt{constructor(e,r){super(),this.destination=e,this.source=r}next(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.next)===null||n===void 0||n.call(r,e)}error(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.error)===null||n===void 0||n.call(r,e)}complete(){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||r===void 0||r.call(e)}_subscribe(e){var r,n;return(n=(r=this.source)===null||r===void 0?void 0:r.subscribe(e))!==null&&n!==void 0?n:qf}};var xs=class extends jt{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let r=super._subscribe(e);return!r.closed&&e.next(this._value),r}getValue(){let{hasError:e,thrownError:r,_value:n}=this;if(e)throw r;return this._throwIfClosed(),n}next(e){super.next(this._value=e)}};var Cs={now(){return(Cs.delegate||Date).now()},delegate:void 0};var Rs=class extends jt{constructor(e=1/0,r=1/0,n=Cs){super(),this._bufferSize=e,this._windowTime=r,this._timestampProvider=n,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,r)}next(e){let{isStopped:r,_buffer:n,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(n.push(e),!i&&n.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(e),{_infiniteTimeWindow:n,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!e.closed;s+=n?1:2)e.next(o[s]);return this._checkFinalizedStatuses(e),r}_trimBuffer(){let{_bufferSize:e,_timestampProvider:r,_buffer:n,_infiniteTimeWindow:i}=this,o=(i?1:2)*e;if(e<1/0&&o<n.length&&n.splice(0,n.length-o),!i){let s=r.now(),a=0;for(let c=1;c<n.length&&n[c]<=s;c+=2)a=c;a&&n.splice(0,a+1)}}};var sl=class extends ur{constructor(e,r){super()}schedule(e,r=0){return this}};var As={setInterval(t,e,...r){let{delegate:n}=As;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=As;return(e?.clearInterval||clearInterval)(t)},delegate:void 0};var al=class extends sl{constructor(e,r){super(e,r),this.scheduler=e,this.work=r,this.pending=!1}schedule(e,r=0){var n;if(this.closed)return this;this.state=e;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,r)),this.pending=!0,this.delay=r,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(o,this.id,r),this}requestAsyncId(e,r,n=0){return As.setInterval(e.flush.bind(e,this),n)}recycleAsyncId(e,r,n=0){if(n!=null&&this.delay===n&&this.pending===!1)return r;r!=null&&As.clearInterval(r)}execute(e,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let n=this._execute(e,r);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,r){let n=!1,i;try{this.work(e)}catch(o){n=!0,i=o||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:e,scheduler:r}=this,{actions:n}=r;this.work=this.state=this.scheduler=null,this.pending=!1,li(n,this),e!=null&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,super.unsubscribe()}}};var bo=class t{constructor(e,r=t.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};bo.now=Cs.now;var cl=class extends bo{constructor(e,r=bo.now){super(e,r),this.actions=[],this._active=!1}flush(e){let{actions:r}=this;if(this._active){r.push(e);return}let n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,n){for(;e=r.shift();)e.unsubscribe();throw n}}};var Ds=new cl(al),by=Ds;var wy=new Ye(t=>t.complete());function ll(t){return t&&he(t.schedule)}function Sy(t){return t[t.length-1]}function Iy(t){return ll(Sy(t))?t.pop():void 0}function Ty(t,e){return typeof Sy(t)=="number"?t.pop():e}function Cy(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(d){try{p(n.next(d))}catch(f){s(f)}}function c(d){try{p(n.throw(d))}catch(f){s(f)}}function p(d){d.done?o(d.value):i(d.value).then(a,c)}p((n=n.apply(t,e||[])).next())})}function xy(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function fi(t){return this instanceof fi?(this.v=t,this):new fi(t)}function Ry(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(y){return function(T){return Promise.resolve(T).then(y,f)}}function a(y,T){n[y]&&(i[y]=function(D){return new Promise(function(N,k){o.push([y,D,N,k])>1||c(y,D)})},T&&(i[y]=T(i[y])))}function c(y,T){try{p(n[y](T))}catch(D){E(o[0][3],D)}}function p(y){y.value instanceof fi?Promise.resolve(y.value.v).then(d,f):E(o[0][2],y)}function d(y){c("next",y)}function f(y){c("throw",y)}function E(y,T){y(T),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Ay(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof xy=="function"?xy(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(s){return new Promise(function(a,c){s=t[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(p){o({value:p,done:a})},s)}}var wo=t=>t&&typeof t.length=="number"&&typeof t!="function";function ul(t){return he(t?.then)}function pl(t){return he(t[_o])}function fl(t){return Symbol.asyncIterator&&he(t?.[Symbol.asyncIterator])}function ml(t){return new TypeError(`You provided ${t!==null&&typeof t=="object"?"an invalid object":`'${t}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function LS(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var dl=LS();function hl(t){return he(t?.[dl])}function gl(t){return Ry(this,arguments,function*(){let r=t.getReader();try{for(;;){let{value:n,done:i}=yield fi(r.read());if(i)return yield fi(void 0);yield yield fi(n)}}finally{r.releaseLock()}})}function yl(t){return he(t?.getReader)}function Dt(t){if(t instanceof Ye)return t;if(t!=null){if(pl(t))return MS(t);if(wo(t))return BS(t);if(ul(t))return kS(t);if(fl(t))return Dy(t);if(hl(t))return US(t);if(yl(t))return FS(t)}throw ml(t)}function MS(t){return new Ye(e=>{let r=t[_o]();if(he(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function BS(t){return new Ye(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function kS(t){return new Ye(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,rl)})}function US(t){return new Ye(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Dy(t){return new Ye(e=>{HS(t,e).catch(r=>e.error(r))})}function FS(t){return Dy(gl(t))}function HS(t,e){var r,n,i,o;return Cy(this,void 0,void 0,function*(){try{for(r=Ay(t);n=yield r.next(),!n.done;){let s=n.value;if(e.next(s),e.closed)return}}catch(s){i={error:s}}finally{try{n&&!n.done&&(o=r.return)&&(yield o.call(r))}finally{if(i)throw i.error}}e.complete()})}function pr(t,e,r,n=0,i=!1){let o=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(o),!i)return o}function vl(t,e=0){return Vt((r,n)=>{r.subscribe(Wt(n,i=>pr(n,t,()=>n.next(i),e),()=>pr(n,t,()=>n.complete(),e),i=>pr(n,t,()=>n.error(i),e)))})}function El(t,e=0){return Vt((r,n)=>{n.add(t.schedule(()=>r.subscribe(n),e))})}function Ny(t,e){return Dt(t).pipe(El(e),vl(e))}function Oy(t,e){return Dt(t).pipe(El(e),vl(e))}function Py(t,e){return new Ye(r=>{let n=0;return e.schedule(function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())})})}function Ly(t,e){return new Ye(r=>{let n;return pr(r,e,()=>{n=t[dl](),pr(r,e,()=>{let i,o;try{({value:i,done:o}=n.next())}catch(s){r.error(s);return}o?r.complete():r.next(i)},0,!0)}),()=>he(n?.return)&&n.return()})}function _l(t,e){if(!t)throw new Error("Iterable cannot be null");return new Ye(r=>{pr(r,e,()=>{let n=t[Symbol.asyncIterator]();pr(r,e,()=>{n.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function My(t,e){return _l(gl(t),e)}function By(t,e){if(t!=null){if(pl(t))return Ny(t,e);if(wo(t))return Py(t,e);if(ul(t))return Oy(t,e);if(fl(t))return _l(t,e);if(hl(t))return Ly(t,e);if(yl(t))return My(t,e)}throw ml(t)}function ky(t,e){return e?By(t,e):Dt(t)}var Uy=yo(t=>function(){t(this),this.name="EmptyError",this.message="no elements in sequence"});function fr(t,e){let r=typeof e=="object";return new Promise((n,i)=>{let o=new Mn({next:s=>{n(s),o.unsubscribe()},error:i,complete:()=>{r?n(e.defaultValue):i(new Uy)}});t.subscribe(o)})}function Fy(t){return t instanceof Date&&!isNaN(t)}function fn(t,e){return Vt((r,n)=>{let i=0;r.subscribe(Wt(n,o=>{n.next(t.call(e,o,i++))}))})}var{isArray:$S}=Array;function VS(t,e){return $S(e)?t(...e):t(e)}function bl(t){return fn(e=>VS(t,e))}function Hy(t,e,r,n,i,o,s,a){let c=[],p=0,d=0,f=!1,E=()=>{f&&!c.length&&!p&&e.complete()},y=D=>p<n?T(D):c.push(D),T=D=>{o&&e.next(D),p++;let N=!1;Dt(r(D,d++)).subscribe(Wt(e,k=>{i?.(k),o?y(k):e.next(k)},()=>{N=!0},void 0,()=>{if(N)try{for(p--;c.length&&p<n;){let k=c.shift();s?pr(e,s,()=>T(k)):T(k)}E()}catch(k){e.error(k)}}))};return t.subscribe(Wt(e,y,()=>{f=!0,E()})),()=>{a?.()}}function Ns(t,e,r=1/0){return he(e)?Ns((n,i)=>fn((o,s)=>e(n,o,i,s))(Dt(t(n,i))),r):(typeof e=="number"&&(r=e),Vt((n,i)=>Hy(n,i,t,r)))}function $y(t=1/0){return Ns(il,t)}var WS=["addListener","removeListener"],jS=["addEventListener","removeEventListener"],GS=["on","off"];function mi(t,e,r,n){if(he(r)&&(n=r,r=void 0),n)return mi(t,e,r).pipe(bl(n));let[i,o]=qS(t)?jS.map(s=>a=>t[s](e,a,r)):zS(t)?WS.map(Vy(t,e)):YS(t)?GS.map(Vy(t,e)):[];if(!i&&wo(t))return Ns(s=>mi(s,e,r))(Dt(t));if(!i)throw new TypeError("Invalid event target");return new Ye(s=>{let a=(...c)=>s.next(1<c.length?c:c[0]);return i(a),()=>o(a)})}function Vy(t,e){return r=>n=>t[r](e,n)}function zS(t){return he(t.addListener)&&he(t.removeListener)}function YS(t){return he(t.on)&&he(t.off)}function qS(t){return he(t.addEventListener)&&he(t.removeEventListener)}function wl(t,e,r){return r?wl(t,e).pipe(bl(r)):new Ye(n=>{let i=(...s)=>n.next(s.length===1?s[0]:s),o=t(i);return he(e)?()=>e(i,o):void 0})}function Wy(t=0,e,r=by){let n=-1;return e!=null&&(ll(e)?r=e:n=e),new Ye(i=>{let o=Fy(t)?+t-r.now():t;o<0&&(o=0);let s=0;return r.schedule(function(){i.closed||(i.next(s++),0<=n?this.schedule(void 0,n):i.complete())},o)})}function tm(...t){let e=Iy(t),r=Ty(t,1/0),n=t;return n.length?n.length===1?Dt(n[0]):$y(r)(ky(n,e)):wy}function So(t,e){return Vt((r,n)=>{let i=0;r.subscribe(Wt(n,o=>t.call(e,o,i++)&&n.next(o)))})}function mr(t,e=Ds){return Vt((r,n)=>{let i=null,o=null,s=null,a=()=>{if(i){i.unsubscribe(),i=null;let p=o;o=null,n.next(p)}};function c(){let p=s+t,d=e.now();if(d<p){i=this.schedule(void 0,p-d),n.add(i);return}a()}r.subscribe(Wt(n,p=>{o=p,s=e.now(),i||(i=e.schedule(c,t),n.add(i))},()=>{a(),n.complete()},void 0,()=>{o=i=null}))})}function jy(t,e){return Vt((r,n)=>{let{leading:i=!0,trailing:o=!1}=e??{},s=!1,a=null,c=null,p=!1,d=()=>{c?.unsubscribe(),c=null,o&&(y(),p&&n.complete())},f=()=>{c=null,p&&n.complete()},E=T=>c=Dt(t(T)).subscribe(Wt(n,d,f)),y=()=>{if(s){s=!1;let T=a;a=null,n.next(T),!p&&E(T)}};r.subscribe(Wt(n,T=>{s=!0,a=T,!(c&&!c.closed)&&(i?y():E(T))},()=>{p=!0,!(o&&s&&c&&!c.closed)&&n.complete()}))})}function rm(t,e=Ds,r){let n=Wy(t,e);return jy(()=>n,r)}var di=class{static _flags={};static getFlags(){return this._flags}static setFlags(e){this._flags=e??{}}static isECommerceApp(){return ls()}};var Gy=Rr(cu()),Sl=class t{static META_REQUIRED_FIELDS=["ad_id"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source}static getAdParams(){let e;try{e=new Gy.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new t(r);if(this.GOOGLE_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"GOOGLE"},new t(r)}};function Il(){let t=fe.get();return Z(_({},t.customContext),{page:ra(),locale:t.locale,currentItem:t.getCurrentItem(),previewIDs:t.previewIDs,previewVariant:t.previewVariant,engagementIDs:KS(),cart:ve.getCurrent().convertToCooeeCart()})}function KS(){let t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&e.push(n)}),e}var XS=" daum[ /]| deusu/|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|\\||^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^azure|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|agent|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|fetcher|firephp|functionize|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/",JS=/bot|crawl|http|lighthouse|scan|search|spider/i,Os;function QS(){if(Os instanceof RegExp)return Os;try{Os=new RegExp(XS,"i")}catch{Os=JS}return Os}function zy(t){return!!t&&QS().test(t)}var nm={d:(t,e)=>{for(var r in e)nm.o(e,r)&&!nm.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},im={};nm.d(im,{A:()=>ZS,k:()=>om});var Ps=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(p){try{c(n.next(p))}catch(d){o(d)}}function a(p){try{c(n.throw(p))}catch(d){o(d)}}function c(p){var d;p.done?i(p.value):(d=p.value,d instanceof r?d:new r(function(f){f(d)})).then(s,a)}c((n=n.apply(t,e||[])).next())})},Ls=function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(p){return(function(d){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,d[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&d[0]?n.return:d[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,d[1])).done)return i;switch(n=0,i&&(d=[2&d[0],i.value]),d[0]){case 0:case 1:i=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,n=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){s.label=d[1];break}if(d[0]===6&&s.label<i[1]){s.label=i[1],i=d;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(d);break}i[2]&&s.ops.pop(),s.trys.pop();continue}d=e.call(t,s)}catch(f){d=[6,f],n=0}finally{r=i=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}})([c,p])}}};function om(){return Ps(this,void 0,Promise,function(){return Ls(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",i=!1;function o(y){i||(i=!0,e({isPrivate:y,browserName:n}))}function s(){var y=0,T=parseInt("-1");try{T.toFixed(T)}catch(D){y=D.message.length}return y}function a(){return navigator.msSaveBlob!==void 0&&(function(y){try{return y===eval.toString().length}catch{return!1}})(39)}function c(){var y;return Ps(this,void 0,void 0,function(){var T,D;return Ls(this,function(N){switch(N.label){case 0:return N.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return N.sent(),o(!1),[3,3];case 2:return T=N.sent(),D=T,T instanceof Error&&(D=(y=T.message)!==null&&y!==void 0?y:T),typeof D!="string"?(o(!1),[2]):(o(!!D.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function p(){var y;return Ps(this,void 0,Promise,function(){return Ls(this,function(T){switch(T.label){case 0:return((y=navigator.storage)===null||y===void 0?void 0:y.getDirectory)===void 0?[3,2]:[4,c()];case 1:return T.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var D=String(Math.random());try{var N=indexedDB.open(D,1);N.onupgradeneeded=function(k){var G=k.target.result,P=function(Q){o(Q)};try{G.createObjectStore("t",{autoIncrement:!0}).put(new Blob),P(!1)}catch(Q){(Q.message||"").includes("are not yet supported")?P(!0):P(!1)}finally{G.close(),indexedDB.deleteDatabase(D)}},N.onerror=function(){return o(!1)}}catch{o(!1)}})():(function(){var D=window.openDatabase,N=window.localStorage;try{D(null,null,null,null)}catch{return void o(!0)}try{N.setItem("test","1"),N.removeItem("test")}catch{return void o(!0)}o(!1)})(),T.label=3;case 3:return[2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(y,T){var D;o(Math.round(T/1048576)<2*Math.round(((D=window).performance!==void 0&&D.performance.memory!==void 0&&D.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(y){r(new Error("detectIncognito somehow failed to query storage quota: "+y.message))})}function f(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?d():(0,window.webkitRequestFileSystem)(0,1,function(){o(!1)},function(){o(!0)})}function E(){return Ps(this,void 0,Promise,function(){var y,T;return Ls(this,function(D){switch(D.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];D.label=1;case 1:return D.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return D.sent(),o(!1),[3,4];case 3:return y=D.sent(),typeof(T=y instanceof Error&&typeof y.message=="string"?y.message:String(y))!="string"?(o(!1),[2]):(o(T.includes("Security error")),[2]);case 4:return o(navigator.serviceWorker===void 0),[2]}})})}(function(){return Ps(this,void 0,Promise,function(){return Ls(this,function(y){switch(y.label){case 0:return s()!==44?[3,2]:(n="Safari",[4,p()]);case 1:return y.sent(),[3,6];case 2:return s()!==51?[3,3]:(T=navigator.userAgent,n=T.match(/Chrome/)?navigator.brave!==void 0?"Brave":T.match(/Edg/)?"Edge":T.match(/OPR/)?"Opera":"Chrome":"Chromium",f(),[3,6]);case 3:return s()!==25?[3,5]:(n="Firefox",[4,E()]);case 4:return y.sent(),[3,6];case 5:a()?(n="Internet Explorer",o(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),y.label=6;case 6:return[2]}var T})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=om);var ZS=om,Yy=im.A,CH=im.k;var qy=Rr(Ii()),Ky=async()=>{let t={};try{return await e0(t)}catch(e){return ae(e,"device-properties"),t}},e0=async t=>{let e=window.CooeeSDK.uaParser;t0(t),r0(t),n0(t),t.referrer=document.referrer,t.host=location.origin,t.path=location.pathname,t.qs=location.search,t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:i0()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(t.headless=!0,ki({headless:!0}));let r=e.getResult();return t.browser=r.browser,t.device=r.device,t.engine=r.engine,t.cpu=r.cpu,t.os=r.os,t.navigatorUA=navigator.userAgent,await Promise.all([a0(t),o0(t),c0(t)]),t},t0=t=>{let e=navigator;if(!e.deviceMemory)return;let r=e.deviceMemory;t.mem={tot:r*1024}},r0=t=>{let e=navigator,r=e.connection||e.mozConnection||e.webkitConnection;r?.effectiveType&&(t.net={type:r.effectiveType})},n0=t=>{let e=screen.orientation?.type;e&&(t.orientation=e)},i0=()=>{if(!document.body)return;let t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);let e=window.devicePixelRatio||1,r=t.offsetWidth*e;return document.body.removeChild(t),r},o0=async t=>{try{await s0(t)}catch(e){w.error("Unable to get location",e)}},s0=async t=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(r=>{navigator.geolocation.getCurrentPosition(n=>{t.coords=[n.coords.latitude,n.coords.longitude],r()},()=>r())})},a0=async t=>{if("getBattery"in navigator)try{let r=await navigator.getBattery();t.bat={l:r.level*100,c:r.charging},ki({"battery.level":t.bat.l,"battery.charging":t.bat.c})}catch{}},c0=async t=>{try{(await Yy())?.isPrivate&&(t.incognito=!0,ki({incognito:!0}))}catch(e){qy.default.error("Unable to detect private/incognito window",e)}};var Ms=class Ms extends yn{};Si(Ms,"storeName","app"),Ms.storage=Ci(Ms.storeName);var Bs=Ms;function Gr(){return window.CooeeSDK?.uaParser.getDevice().type==="mobile"}function hi(t,e){Object.assign(t.style,e)}function re(t,e,r){if(e){if(!r){t.style.removeProperty(e);return}t.style.setProperty(e,r,"important")}}function sm(t){if(!t)return!1;if(t.tagName.toLowerCase()==="cart-drawer"&&t.hasAttribute("open"))return!0;let r=t.getBoundingClientRect(),n=(window.innerHeight||document.documentElement.clientHeight)+.5,i=(window.innerWidth||document.documentElement.clientWidth)+.5,o=getComputedStyle(t);if(o.display==="none"||o.visibility==="hidden"||parseFloat(o.opacity)===0||t.hidden||!(t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0))return!1;let p=Math.max(0,Math.min(r.right,i)-Math.max(r.left,0)),d=Math.max(0,Math.min(r.bottom,n)-Math.max(r.top,0)),f=p*d,E=r.width*r.height;if(!(E>0&&f/E>=.1))return!1;let T=r.top<=n&&r.bottom>=0,D=r.left<=i&&r.right>=0,N=T&&D,k=o.transform.match(/matrix\(([^)]+)\)/),G=0,P=0;if(k){let _e=k[1].split(", ").map(parseFloat);G=_e[4],P=_e[5]}let Q=G+r.left>i||G+r.right<0||P+r.top>n||P+r.bottom<0;return N||!Q}var Jy=Rr(Ii());var gi=(n=>(n[n.LOW=1]="LOW",n[n.MEDIUM=2]="MEDIUM",n[n.HIGH=3]="HIGH",n))(gi||{});var Tl=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(r=>{r instanceof Fr&&this.loadFamily(r.typography?.fam)})}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let r=[];e.fonts.forEach(i=>{if(i.url){let o=new FontFace("cooee"+e.name,i.getURL(),i.getFontDescriptor());r.push(o.load())}}),this.loadedFonts.push(e.name),(await Promise.all(r)).forEach(i=>{document.fonts.add(i)})}};var Io=class{constructor(e){this.scalingFactor=e}getLayoutStyles(e){if(!e)return{display:"block"};let r={display:e.disp};return e.of&&(r.objectFit=e.of),e.pos==="absolute"&&(r.width="auto !important",r.position="absolute",r.right=e.right+"px",r.left=e.left+"px",r.top=e.top+"px",r.bottom=e.bottom+"px"),r}getSizeStyles(e){let r={};return e?.w&&(r.width=e.w),e?.h&&(r.height=e.h),e?.maxW&&(r.maxWidth=e.maxW),e?.maxH&&(r.maxHeight=e.maxH),e?.minW&&(r.minWidth=e.minW),e?.minH&&(r.minHeight=e.minH),r}getBorderStyles(e){if(!e)return{};let r={};return e.radius&&e.radius>0&&(r.borderRadius=this.getSizePx(e.radius)),e.width&&e.width>0&&(r.borderWidth=this.getSizePx(e.width),r.borderStyle=e.style?.toLowerCase(),e.color?this.getColourStyles(e.color,"border-color",r):r.borderColor="black"),r}getFlexStyles(e){return e?{gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai,width:"100%"}:{}}getSpaceStyles(e){let r={};return e?(r.paddingTop=this.getSizePx(e.pt),r.paddingBottom=this.getSizePx(e.pb),r.paddingLeft=this.getSizePx(e.pl),r.paddingRight=this.getSizePx(e.pr),r.marginTop=this.getSizePx(e.mt),r.marginBottom=this.getSizePx(e.mb),r.marginLeft=e.cent?"auto":this.getSizePx(e.ml),r.marginRight=e.cent?"auto":this.getSizePx(e.mr),r):(r.margin="0 !important",r.padding="unset",r)}getBackgroundStyles(e){if(!e)return{};let r={};if(e.glossy){let n="backdrop-filter",i="-webkit-"+n,o=`blur(${e.glossy.radius}px)`;if(!CSS.supports(i,o)&&!CSS.supports(n,o))return{background:e.glossy.fallback.rgba};if(r[i]=o,r[n]=o,e.glossy.color)return this.getColourStyles(e.glossy.color,"background",r)}else if(e.solid){if(e.solid.grad)return this.getGradientStyles(e.solid.grad,"background",r);if(e.solid.hex)return{backgroundColor:e.solid.rgba}}else if(e.img){if(!e.img.src)return{};let n=(e.img.a??0)/100;r.background=`linear-gradient(rgba(0, 0, 0, ${n}), rgba(0, 0, 0, ${n})),url("${e.img.src}") no-repeat center`,r.backgroundSize="cover",e.img.a&&(r["-webkit-backdrop-filter"]=`opacity(${e.img.a})`,r.backdropFilter=`opacity(${e.img.a})`)}return r}getGradientStyles(e,r,n){if(n??={},e.type==="LINEAR"){let i=`linear-gradient(${e.ang}deg, ${e.c1}, ${e.c2}`;e.c3&&(i+=`, ${e.c3}`),i+=")",n[r]=i}return n}getColourStyles(e,r="color",n){return n??={},e?e.grad?this.getGradientStyles(e.grad,r,n):(e.hex&&(n[r]=e.rgba),n):n}getSizePx(e){return this.getScaledSize(e)+"px"}getScaledSize(e){return(e??0)*this.scalingFactor}};var l0=`
|
|
42
|
+
`)}`:"",this.name="UnsubscriptionError",this.errors=r});function li(t,e){if(t){let r=t.indexOf(e);0<=r&&t.splice(r,1)}}var ur=class t{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let o of r)o.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(de(n))try{n()}catch(o){e=o instanceof Xc?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{vy(o)}catch(s){e=e??[],s instanceof Xc?e=[...e,...s.errors]:e.push(s)}}if(e)throw new Xc(e)}}add(e){var r;if(e&&e!==this)if(this.closed)vy(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}}_hasParent(e){let{_parentage:r}=this;return r===e||Array.isArray(r)&&r.includes(e)}_addParent(e){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e}_removeParent(e){let{_parentage:r}=this;r===e?this._parentage=null:Array.isArray(r)&&li(r,e)}remove(e){let{_finalizers:r}=this;r&&li(r,e),e instanceof t&&e._removeParent(this)}};ur.EMPTY=(()=>{let t=new ur;return t.closed=!0,t})();var zf=ur.EMPTY;function Jc(t){return t instanceof ur||t&&"closed"in t&&de(t.remove)&&de(t.add)&&de(t.unsubscribe)}function vy(t){de(t)?t():t.unsubscribe()}var Ir={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var yo={setTimeout(t,e,...r){let{delegate:n}=yo;return n?.setTimeout?n.setTimeout(t,e,...r):setTimeout(t,e,...r)},clearTimeout(t){let{delegate:e}=yo;return(e?.clearTimeout||clearTimeout)(t)},delegate:void 0};function Qc(t){yo.setTimeout(()=>{let{onUnhandledError:e}=Ir;if(e)e(t);else throw t})}function qf(){}var Ey=Yf("C",void 0,void 0);function _y(t){return Yf("E",void 0,t)}function by(t){return Yf("N",t,void 0)}function Yf(t,e,r){return{kind:t,value:e,error:r}}var ui=null;function vo(t){if(Ir.useDeprecatedSynchronousErrorHandling){let e=!ui;if(e&&(ui={errorThrown:!1,error:null}),t(),e){let{errorThrown:r,error:n}=ui;if(ui=null,r)throw n}}else t()}function wy(t){Ir.useDeprecatedSynchronousErrorHandling&&ui&&(ui.errorThrown=!0,ui.error=t)}var pi=class extends ur{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,Jc(e)&&e.add(this)):this.destination=kS}static create(e,r,n){return new Mn(e,r,n)}next(e){this.isStopped?Xf(by(e),this):this._next(e)}error(e){this.isStopped?Xf(_y(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?Xf(Ey,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},MS=Function.prototype.bind;function Kf(t,e){return MS.call(t,e)}var Jf=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:r}=this;if(r.next)try{r.next(e)}catch(n){Zc(n)}}error(e){let{partialObserver:r}=this;if(r.error)try{r.error(e)}catch(n){Zc(n)}else Zc(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(r){Zc(r)}}},Mn=class extends pi{constructor(e,r,n){super();let i;if(de(e)||!e)i={next:e??void 0,error:r??void 0,complete:n??void 0};else{let o;this&&Ir.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&Kf(e.next,o),error:e.error&&Kf(e.error,o),complete:e.complete&&Kf(e.complete,o)}):i=e}this.destination=new Jf(i)}};function Zc(t){Ir.useDeprecatedSynchronousErrorHandling?wy(t):Qc(t)}function BS(t){throw t}function Xf(t,e){let{onStoppedNotification:r}=Ir;r&&yo.setTimeout(()=>r(t,e))}var kS={closed:!0,next:qf,error:BS,complete:qf};var Eo=typeof Symbol=="function"&&Symbol.observable||"@@observable";function Sy(t){return t}function Iy(t){return t.length===0?Sy:t.length===1?t[0]:function(r){return t.reduce((n,i)=>i(n),r)}}var Ze=(()=>{class t{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new t;return n.source=this,n.operator=r,n}subscribe(r,n,i){let o=FS(r)?r:new Mn(r,n,i);return vo(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=Ty(n),new n((i,o)=>{let s=new Mn({next:a=>{try{r(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[Eo](){return this}pipe(...r){return Iy(r)(this)}toPromise(r){return r=Ty(r),new r((n,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>n(o))})}}return t.create=e=>new t(e),t})();function Ty(t){var e;return(e=t??Ir.Promise)!==null&&e!==void 0?e:Promise}function US(t){return t&&de(t.next)&&de(t.error)&&de(t.complete)}function FS(t){return t&&t instanceof pi||US(t)&&Jc(t)}function HS(t){return de(t?.lift)}function Nt(t){return e=>{if(HS(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Ct(t,e,r,n,i){return new Qf(t,e,r,n,i)}var Qf=class extends pi{constructor(e,r,n,i,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(a){try{r(a)}catch(c){e.error(c)}}:super._next,this._error=i?function(a){try{i(a)}catch(c){e.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};var xy=go(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var Jt=(()=>{class t extends Ze{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new el(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new xy}next(r){vo(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){vo(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:n}=this;for(;n.length;)n.shift().error(r)}})}complete(){vo(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:o}=this;return n||i?zf:(this.currentObservers=null,o.push(r),new ur(()=>{this.currentObservers=null,li(o,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:o}=this;n?r.error(i):o&&r.complete()}asObservable(){let r=new Ze;return r.source=this,r}}return t.create=(e,r)=>new el(e,r),t})(),el=class extends Jt{constructor(e,r){super(),this.destination=e,this.source=r}next(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.next)===null||n===void 0||n.call(r,e)}error(e){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.error)===null||n===void 0||n.call(r,e)}complete(){var e,r;(r=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||r===void 0||r.call(e)}_subscribe(e){var r,n;return(n=(r=this.source)===null||r===void 0?void 0:r.subscribe(e))!==null&&n!==void 0?n:zf}};var Ss=class extends Jt{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let r=super._subscribe(e);return!r.closed&&e.next(this._value),r}getValue(){let{hasError:e,thrownError:r,_value:n}=this;if(e)throw r;return this._throwIfClosed(),n}next(e){super.next(this._value=e)}};var Is={now(){return(Is.delegate||Date).now()},delegate:void 0};var Ts=class extends Jt{constructor(e=1/0,r=1/0,n=Is){super(),this._bufferSize=e,this._windowTime=r,this._timestampProvider=n,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,r)}next(e){let{isStopped:r,_buffer:n,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(n.push(e),!i&&n.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(e),{_infiniteTimeWindow:n,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!e.closed;s+=n?1:2)e.next(o[s]);return this._checkFinalizedStatuses(e),r}_trimBuffer(){let{_bufferSize:e,_timestampProvider:r,_buffer:n,_infiniteTimeWindow:i}=this,o=(i?1:2)*e;if(e<1/0&&o<n.length&&n.splice(0,n.length-o),!i){let s=r.now(),a=0;for(let c=1;c<n.length&&n[c]<=s;c+=2)a=c;a&&n.splice(0,a+1)}}};var tl=class extends ur{constructor(e,r){super()}schedule(e,r=0){return this}};var xs={setInterval(t,e,...r){let{delegate:n}=xs;return n?.setInterval?n.setInterval(t,e,...r):setInterval(t,e,...r)},clearInterval(t){let{delegate:e}=xs;return(e?.clearInterval||clearInterval)(t)},delegate:void 0};var rl=class extends tl{constructor(e,r){super(e,r),this.scheduler=e,this.work=r,this.pending=!1}schedule(e,r=0){var n;if(this.closed)return this;this.state=e;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,r)),this.pending=!0,this.delay=r,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(o,this.id,r),this}requestAsyncId(e,r,n=0){return xs.setInterval(e.flush.bind(e,this),n)}recycleAsyncId(e,r,n=0){if(n!=null&&this.delay===n&&this.pending===!1)return r;r!=null&&xs.clearInterval(r)}execute(e,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let n=this._execute(e,r);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,r){let n=!1,i;try{this.work(e)}catch(o){n=!0,i=o||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:e,scheduler:r}=this,{actions:n}=r;this.work=this.state=this.scheduler=null,this.pending=!1,li(n,this),e!=null&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,super.unsubscribe()}}};var _o=class t{constructor(e,r=t.now){this.schedulerActionCtor=e,this.now=r}schedule(e,r=0,n){return new this.schedulerActionCtor(this,e).schedule(n,r)}};_o.now=Is.now;var nl=class extends _o{constructor(e,r=_o.now){super(e,r),this.actions=[],this._active=!1}flush(e){let{actions:r}=this;if(this._active){r.push(e);return}let n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,n){for(;e=r.shift();)e.unsubscribe();throw n}}};var Cs=new nl(rl),Cy=Cs;function Ry(t){return t&&de(t.schedule)}function Dy(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(d){try{p(n.next(d))}catch(f){s(f)}}function c(d){try{p(n.throw(d))}catch(f){s(f)}}function p(d){d.done?o(d.value):i(d.value).then(a,c)}p((n=n.apply(t,e||[])).next())})}function Ay(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function fi(t){return this instanceof fi?(this.v=t,this):new fi(t)}function Ny(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(y){return function(T){return Promise.resolve(T).then(y,f)}}function a(y,T){n[y]&&(i[y]=function(D){return new Promise(function(N,k){o.push([y,D,N,k])>1||c(y,D)})},T&&(i[y]=T(i[y])))}function c(y,T){try{p(n[y](T))}catch(D){E(o[0][3],D)}}function p(y){y.value instanceof fi?Promise.resolve(y.value.v).then(d,f):E(o[0][2],y)}function d(y){c("next",y)}function f(y){c("throw",y)}function E(y,T){y(T),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Oy(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Ay=="function"?Ay(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(s){return new Promise(function(a,c){s=t[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(p){o({value:p,done:a})},s)}}var bo=t=>t&&typeof t.length=="number"&&typeof t!="function";function il(t){return de(t?.then)}function ol(t){return de(t[Eo])}function sl(t){return Symbol.asyncIterator&&de(t?.[Symbol.asyncIterator])}function al(t){return new TypeError(`You provided ${t!==null&&typeof t=="object"?"an invalid object":`'${t}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function $S(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var cl=$S();function ll(t){return de(t?.[cl])}function ul(t){return Ny(this,arguments,function*(){let r=t.getReader();try{for(;;){let{value:n,done:i}=yield fi(r.read());if(i)return yield fi(void 0);yield yield fi(n)}}finally{r.releaseLock()}})}function pl(t){return de(t?.getReader)}function Ot(t){if(t instanceof Ze)return t;if(t!=null){if(ol(t))return VS(t);if(bo(t))return WS(t);if(il(t))return jS(t);if(sl(t))return Py(t);if(ll(t))return GS(t);if(pl(t))return zS(t)}throw al(t)}function VS(t){return new Ze(e=>{let r=t[Eo]();if(de(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function WS(t){return new Ze(e=>{for(let r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function jS(t){return new Ze(e=>{t.then(r=>{e.closed||(e.next(r),e.complete())},r=>e.error(r)).then(null,Qc)})}function GS(t){return new Ze(e=>{for(let r of t)if(e.next(r),e.closed)return;e.complete()})}function Py(t){return new Ze(e=>{qS(t,e).catch(r=>e.error(r))})}function zS(t){return Py(ul(t))}function qS(t,e){var r,n,i,o;return Dy(this,void 0,void 0,function*(){try{for(r=Oy(t);n=yield r.next(),!n.done;){let s=n.value;if(e.next(s),e.closed)return}}catch(s){i={error:s}}finally{try{n&&!n.done&&(o=r.return)&&(yield o.call(r))}finally{if(i)throw i.error}}e.complete()})}function pr(t,e,r,n=0,i=!1){let o=e.schedule(function(){r(),i?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(o),!i)return o}function fl(t,e=0){return Nt((r,n)=>{r.subscribe(Ct(n,i=>pr(n,t,()=>n.next(i),e),()=>pr(n,t,()=>n.complete(),e),i=>pr(n,t,()=>n.error(i),e)))})}function ml(t,e=0){return Nt((r,n)=>{n.add(t.schedule(()=>r.subscribe(n),e))})}function Ly(t,e){return Ot(t).pipe(ml(e),fl(e))}function My(t,e){return Ot(t).pipe(ml(e),fl(e))}function By(t,e){return new Ze(r=>{let n=0;return e.schedule(function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())})})}function ky(t,e){return new Ze(r=>{let n;return pr(r,e,()=>{n=t[cl](),pr(r,e,()=>{let i,o;try{({value:i,done:o}=n.next())}catch(s){r.error(s);return}o?r.complete():r.next(i)},0,!0)}),()=>de(n?.return)&&n.return()})}function dl(t,e){if(!t)throw new Error("Iterable cannot be null");return new Ze(r=>{pr(r,e,()=>{let n=t[Symbol.asyncIterator]();pr(r,e,()=>{n.next().then(i=>{i.done?r.complete():r.next(i.value)})},0,!0)})})}function Uy(t,e){return dl(ul(t),e)}function Fy(t,e){if(t!=null){if(ol(t))return Ly(t,e);if(bo(t))return By(t,e);if(il(t))return My(t,e);if(sl(t))return dl(t,e);if(ll(t))return ky(t,e);if(pl(t))return Uy(t,e)}throw al(t)}function Zf(t,e){return e?Fy(t,e):Ot(t)}var Hy=go(t=>function(){t(this),this.name="EmptyError",this.message="no elements in sequence"});function Wr(t,e){let r=typeof e=="object";return new Promise((n,i)=>{let o=new Mn({next:s=>{n(s),o.unsubscribe()},error:i,complete:()=>{r?n(e.defaultValue):i(new Hy)}});t.subscribe(o)})}function $y(t){return t instanceof Date&&!isNaN(t)}function fn(t,e){return Nt((r,n)=>{let i=0;r.subscribe(Ct(n,o=>{n.next(t.call(e,o,i++))}))})}var{isArray:YS}=Array;function KS(t,e){return YS(e)?t(...e):t(e)}function hl(t){return fn(e=>KS(t,e))}function Vy(t,e,r,n,i,o,s,a){let c=[],p=0,d=0,f=!1,E=()=>{f&&!c.length&&!p&&e.complete()},y=D=>p<n?T(D):c.push(D),T=D=>{o&&e.next(D),p++;let N=!1;Ot(r(D,d++)).subscribe(Ct(e,k=>{i?.(k),o?y(k):e.next(k)},()=>{N=!0},void 0,()=>{if(N)try{for(p--;c.length&&p<n;){let k=c.shift();s?pr(e,s,()=>T(k)):T(k)}E()}catch(k){e.error(k)}}))};return t.subscribe(Ct(e,y,()=>{f=!0,E()})),()=>{a?.()}}function em(t,e,r=1/0){return de(e)?em((n,i)=>fn((o,s)=>e(n,o,i,s))(Ot(t(n,i))),r):(typeof e=="number"&&(r=e),Nt((n,i)=>Vy(n,i,t,r)))}var XS=["addListener","removeListener"],JS=["addEventListener","removeEventListener"],QS=["on","off"];function mi(t,e,r,n){if(de(r)&&(n=r,r=void 0),n)return mi(t,e,r).pipe(hl(n));let[i,o]=t0(t)?JS.map(s=>a=>t[s](e,a,r)):ZS(t)?XS.map(Wy(t,e)):e0(t)?QS.map(Wy(t,e)):[];if(!i&&bo(t))return em(s=>mi(s,e,r))(Ot(t));if(!i)throw new TypeError("Invalid event target");return new Ze(s=>{let a=(...c)=>s.next(1<c.length?c:c[0]);return i(a),()=>o(a)})}function Wy(t,e){return r=>n=>t[r](e,n)}function ZS(t){return de(t.addListener)&&de(t.removeListener)}function e0(t){return de(t.on)&&de(t.off)}function t0(t){return de(t.addEventListener)&&de(t.removeEventListener)}function gl(t,e,r){return r?gl(t,e).pipe(hl(r)):new Ze(n=>{let i=(...s)=>n.next(s.length===1?s[0]:s),o=t(i);return de(e)?()=>e(i,o):void 0})}function jy(t=0,e,r=Cy){let n=-1;return e!=null&&(Ry(e)?r=e:n=e),new Ze(i=>{let o=$y(t)?+t-r.now():t;o<0&&(o=0);let s=0;return r.schedule(function(){i.closed||(i.next(s++),0<=n?this.schedule(void 0,n):i.complete())},o)})}function tm(t,e){return Nt((r,n)=>{let i=0;r.subscribe(Ct(n,o=>t.call(e,o,i++)&&n.next(o)))})}function Tr(t,e=Cs){return Nt((r,n)=>{let i=null,o=null,s=null,a=()=>{if(i){i.unsubscribe(),i=null;let p=o;o=null,n.next(p)}};function c(){let p=s+t,d=e.now();if(d<p){i=this.schedule(void 0,p-d),n.add(i);return}a()}r.subscribe(Ct(n,p=>{o=p,s=e.now(),i||(i=e.schedule(c,t),n.add(i))},()=>{a(),n.complete()},void 0,()=>{o=i=null}))})}function rm(t,e){return Nt((r,n)=>{let i=null,o=0,s=!1,a=()=>s&&!i&&n.complete();r.subscribe(Ct(n,c=>{i?.unsubscribe();let p=0,d=o++;Ot(t(c,d)).subscribe(i=Ct(n,f=>n.next(e?e(c,f,d,p++):f),()=>{i=null,a()}))},()=>{s=!0,a()}))})}function Gy(t,e){return Nt((r,n)=>{let{leading:i=!0,trailing:o=!1}=e??{},s=!1,a=null,c=null,p=!1,d=()=>{c?.unsubscribe(),c=null,o&&(y(),p&&n.complete())},f=()=>{c=null,p&&n.complete()},E=T=>c=Ot(t(T)).subscribe(Ct(n,d,f)),y=()=>{if(s){s=!1;let T=a;a=null,n.next(T),!p&&E(T)}};r.subscribe(Ct(n,T=>{s=!0,a=T,!(c&&!c.closed)&&(i?y():E(T))},()=>{p=!0,!(o&&s&&c&&!c.closed)&&n.complete()}))})}function nm(t,e=Cs,r){let n=jy(t,e);return Gy(()=>n,r)}var di=class{static _flags={};static getFlags(){return this._flags}static setFlags(e){this._flags=e??{}}static isECommerceApp(){return ss()}};var zy=xr(su()),yl=class t{static META_REQUIRED_FIELDS=["ad_id"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source}static getAdParams(){let e;try{e=new zy.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"META",adID:e.getQueryParam("ad_id")?.trim(),campaignID:e.getQueryParam("campaign_id")?.trim()},new t(r);if(this.GOOGLE_REQUIRED_FIELDS.every(o=>Array.from(e.getParams().keys()).includes(o)))return r={source:"GOOGLE"},new t(r)}};function vl(){let t=ye.get();return Z(_({},t.customContext),{page:Qs(),locale:t.locale,currentItem:t.getCurrentItem(),previewIDs:t.previewIDs,previewVariant:t.previewVariant,engagementIDs:r0(),cart:ve.getCurrent().convertToCooeeCart()})}function r0(){let t=document.querySelectorAll(".letscooee-engagement"),e=[];return t.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&e.push(n)}),e}var n0=" daum[ /]| deusu/|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\btime/|\\||^<|^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^azure|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|agent|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|fetcher|firephp|functionize|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/",i0=/bot|crawl|http|lighthouse|scan|search|spider/i,Rs;function o0(){if(Rs instanceof RegExp)return Rs;try{Rs=new RegExp(n0,"i")}catch{Rs=i0}return Rs}function qy(t){return!!t&&o0().test(t)}var im={d:(t,e)=>{for(var r in e)im.o(e,r)&&!im.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},om={};im.d(om,{A:()=>s0,k:()=>sm});var As=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(p){try{c(n.next(p))}catch(d){o(d)}}function a(p){try{c(n.throw(p))}catch(d){o(d)}}function c(p){var d;p.done?i(p.value):(d=p.value,d instanceof r?d:new r(function(f){f(d)})).then(s,a)}c((n=n.apply(t,e||[])).next())})},Ds=function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(p){return(function(d){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,d[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&d[0]?n.return:d[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,d[1])).done)return i;switch(n=0,i&&(d=[2&d[0],i.value]),d[0]){case 0:case 1:i=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,n=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){s.label=d[1];break}if(d[0]===6&&s.label<i[1]){s.label=i[1],i=d;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(d);break}i[2]&&s.ops.pop(),s.trys.pop();continue}d=e.call(t,s)}catch(f){d=[6,f],n=0}finally{r=i=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}})([c,p])}}};function sm(){return As(this,void 0,Promise,function(){return Ds(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e,r){var n="Unknown",i=!1;function o(y){i||(i=!0,e({isPrivate:y,browserName:n}))}function s(){var y=0,T=parseInt("-1");try{T.toFixed(T)}catch(D){y=D.message.length}return y}function a(){return navigator.msSaveBlob!==void 0&&(function(y){try{return y===eval.toString().length}catch{return!1}})(39)}function c(){var y;return As(this,void 0,void 0,function(){var T,D;return Ds(this,function(N){switch(N.label){case 0:return N.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return N.sent(),o(!1),[3,3];case 2:return T=N.sent(),D=T,T instanceof Error&&(D=(y=T.message)!==null&&y!==void 0?y:T),typeof D!="string"?(o(!1),[2]):(o(!!D.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function p(){var y;return As(this,void 0,Promise,function(){return Ds(this,function(T){switch(T.label){case 0:return((y=navigator.storage)===null||y===void 0?void 0:y.getDirectory)===void 0?[3,2]:[4,c()];case 1:return T.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var D=String(Math.random());try{var N=indexedDB.open(D,1);N.onupgradeneeded=function(k){var G=k.target.result,P=function(Q){o(Q)};try{G.createObjectStore("t",{autoIncrement:!0}).put(new Blob),P(!1)}catch(Q){(Q.message||"").includes("are not yet supported")?P(!0):P(!1)}finally{G.close(),indexedDB.deleteDatabase(D)}},N.onerror=function(){return o(!1)}}catch{o(!1)}})():(function(){var D=window.openDatabase,N=window.localStorage;try{D(null,null,null,null)}catch{return void o(!0)}try{N.setItem("test","1"),N.removeItem("test")}catch{return void o(!0)}o(!1)})(),T.label=3;case 3:return[2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(y,T){var D;o(Math.round(T/1048576)<2*Math.round(((D=window).performance!==void 0&&D.performance.memory!==void 0&&D.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(y){r(new Error("detectIncognito somehow failed to query storage quota: "+y.message))})}function f(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?d():(0,window.webkitRequestFileSystem)(0,1,function(){o(!1)},function(){o(!0)})}function E(){return As(this,void 0,Promise,function(){var y,T;return Ds(this,function(D){switch(D.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];D.label=1;case 1:return D.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return D.sent(),o(!1),[3,4];case 3:return y=D.sent(),typeof(T=y instanceof Error&&typeof y.message=="string"?y.message:String(y))!="string"?(o(!1),[2]):(o(T.includes("Security error")),[2]);case 4:return o(navigator.serviceWorker===void 0),[2]}})})}(function(){return As(this,void 0,Promise,function(){return Ds(this,function(y){switch(y.label){case 0:return s()!==44?[3,2]:(n="Safari",[4,p()]);case 1:return y.sent(),[3,6];case 2:return s()!==51?[3,3]:(T=navigator.userAgent,n=T.match(/Chrome/)?navigator.brave!==void 0?"Brave":T.match(/Edg/)?"Edge":T.match(/OPR/)?"Opera":"Chrome":"Chromium",f(),[3,6]);case 3:return s()!==25?[3,5]:(n="Firefox",[4,E()]);case 4:return y.sent(),[3,6];case 5:a()?(n="Internet Explorer",o(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),y.label=6;case 6:return[2]}var T})})})().catch(r)})];case 1:return[2,t.sent()]}})})}typeof window<"u"&&(window.detectIncognito=sm);var s0=sm,Yy=om.A,RH=om.k;var Ky=xr(Si()),Xy=async()=>{let t={};try{return await a0(t)}catch(e){return ae(e,"device-properties"),t}},a0=async t=>{let e=window.CooeeSDK.uaParser;c0(t),l0(t),u0(t),t.referrer=document.referrer,t.host=location.origin,t.path=location.pathname,t.qs=location.search,t.locale=navigator.language,t.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:p0()},t.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(t.headless=!0,Bi({headless:!0}));let r=e.getResult();return t.browser=r.browser,t.device=r.device,t.engine=r.engine,t.cpu=r.cpu,t.os=r.os,t.navigatorUA=navigator.userAgent,await Promise.all([d0(t),f0(t),h0(t)]),t},c0=t=>{let e=navigator;if(!e.deviceMemory)return;let r=e.deviceMemory;t.mem={tot:r*1024}},l0=t=>{let e=navigator,r=e.connection||e.mozConnection||e.webkitConnection;r?.effectiveType&&(t.net={type:r.effectiveType})},u0=t=>{let e=screen.orientation?.type;e&&(t.orientation=e)},p0=()=>{if(!document.body)return;let t=document.createElement("div");t.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(t);let e=window.devicePixelRatio||1,r=t.offsetWidth*e;return document.body.removeChild(t),r},f0=async t=>{try{await m0(t)}catch(e){b.error("Unable to get location",e)}},m0=async t=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(r=>{navigator.geolocation.getCurrentPosition(n=>{t.coords=[n.coords.latitude,n.coords.longitude],r()},()=>r())})},d0=async t=>{if("getBattery"in navigator)try{let r=await navigator.getBattery();t.bat={l:r.level*100,c:r.charging},Bi({"battery.level":t.bat.l,"battery.charging":t.bat.c})}catch{}},h0=async t=>{try{(await Yy())?.isPrivate&&(t.incognito=!0,Bi({incognito:!0}))}catch(e){Ky.default.error("Unable to detect private/incognito window",e)}};var Ns=class Ns extends yn{};wi(Ns,"storeName","app"),Ns.storage=xi(Ns.storeName);var Os=Ns;function jr(){return window.CooeeSDK?.uaParser.getDevice().type==="mobile"}function hi(t,e){Object.assign(t.style,e)}function re(t,e,r){if(e){if(!r){t.style.removeProperty(e);return}t.style.setProperty(e,r,"important")}}function am(t){if(!t)return!1;if(t.tagName.toLowerCase()==="cart-drawer"&&t.hasAttribute("open"))return!0;let r=t.getBoundingClientRect(),n=(window.innerHeight||document.documentElement.clientHeight)+.5,i=(window.innerWidth||document.documentElement.clientWidth)+.5,o=getComputedStyle(t);if(o.display==="none"||o.visibility==="hidden"||parseFloat(o.opacity)===0||t.hidden||!(t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0))return!1;let p=Math.max(0,Math.min(r.right,i)-Math.max(r.left,0)),d=Math.max(0,Math.min(r.bottom,n)-Math.max(r.top,0)),f=p*d,E=r.width*r.height;if(!(E>0&&f/E>=.1))return!1;let T=r.top<=n&&r.bottom>=0,D=r.left<=i&&r.right>=0,N=T&&D,k=o.transform.match(/matrix\(([^)]+)\)/),G=0,P=0;if(k){let _e=k[1].split(", ").map(parseFloat);G=_e[4],P=_e[5]}let Q=G+r.left>i||G+r.right<0||P+r.top>n||P+r.bottom<0;return N||!Q}var tv=xr(Si());var gi=(n=>(n[n.LOW=1]="LOW",n[n.MEDIUM=2]="MEDIUM",n[n.HIGH=3]="HIGH",n))(gi||{});var El=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(r=>{r instanceof kr&&this.loadFamily(r.typography?.fam)})}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let r=[];e.fonts.forEach(i=>{if(i.url){let o=new FontFace("cooee"+e.name,i.getURL(),i.getFontDescriptor());r.push(o.load())}}),this.loadedFonts.push(e.name),(await Promise.all(r)).forEach(i=>{document.fonts.add(i)})}};var wo=class{constructor(e){this.scalingFactor=e}getLayoutStyles(e){if(!e)return{display:"block"};let r={display:e.disp};return e.of&&(r.objectFit=e.of),e.pos==="absolute"&&(r.width="auto !important",r.position="absolute",r.right=e.right+"px",r.left=e.left+"px",r.top=e.top+"px",r.bottom=e.bottom+"px"),r}getSizeStyles(e){let r={};return e?.w&&(r.width=e.w),e?.h&&(r.height=e.h),e?.maxW&&(r.maxWidth=e.maxW),e?.maxH&&(r.maxHeight=e.maxH),e?.minW&&(r.minWidth=e.minW),e?.minH&&(r.minHeight=e.minH),r}getBorderStyles(e){if(!e)return{};let r={};return e.radius&&e.radius>0&&(r.borderRadius=this.getSizePx(e.radius)),e.width&&e.width>0&&(r.borderWidth=this.getSizePx(e.width),r.borderStyle=e.style?.toLowerCase(),e.color?this.getColourStyles(e.color,"border-color",r):r.borderColor="black"),r}getFlexStyles(e){return e?{gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai,width:"100%"}:{}}getSpaceStyles(e){let r={};return e?(r.paddingTop=this.getSizePx(e.pt),r.paddingBottom=this.getSizePx(e.pb),r.paddingLeft=this.getSizePx(e.pl),r.paddingRight=this.getSizePx(e.pr),r.marginTop=this.getSizePx(e.mt),r.marginBottom=this.getSizePx(e.mb),r.marginLeft=e.cent?"auto":this.getSizePx(e.ml),r.marginRight=e.cent?"auto":this.getSizePx(e.mr),r):(r.margin="0 !important",r.padding="unset",r)}getBackgroundStyles(e){if(!e)return{};let r={};if(e.glossy){let n="backdrop-filter",i="-webkit-"+n,o=`blur(${e.glossy.radius}px)`;if(!CSS.supports(i,o)&&!CSS.supports(n,o))return{background:e.glossy.fallback.rgba};if(r[i]=o,r[n]=o,e.glossy.color)return this.getColourStyles(e.glossy.color,"background",r)}else if(e.solid){if(e.solid.grad)return this.getGradientStyles(e.solid.grad,"background",r);if(e.solid.hex)return{backgroundColor:e.solid.rgba}}else if(e.img){if(!e.img.src)return{};let n=(e.img.a??0)/100;r.background=`linear-gradient(rgba(0, 0, 0, ${n}), rgba(0, 0, 0, ${n})),url("${e.img.src}") no-repeat center`,r.backgroundSize="cover",e.img.a&&(r["-webkit-backdrop-filter"]=`opacity(${e.img.a})`,r.backdropFilter=`opacity(${e.img.a})`)}return r}getGradientStyles(e,r,n){if(n??={},e.type==="LINEAR"){let i=`linear-gradient(${e.ang}deg, ${e.c1}, ${e.c2}`;e.c3&&(i+=`, ${e.c3}`),i+=")",n[r]=i}return n}getColourStyles(e,r="color",n){return n??={},e?e.grad?this.getGradientStyles(e.grad,r,n):(e.hex&&(n[r]=e.rgba),n):n}getSizePx(e){return this.getScaledSize(e)+"px"}getScaledSize(e){return(e??0)*this.scalingFactor}};var g0=`
|
|
43
43
|
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
44
44
|
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
45
45
|
cart {
|
|
@@ -51,7 +51,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
`,
|
|
54
|
+
`,Gr=class{static navigate(e,r,n){let i=`${location.origin}/discount/${e}`;switch(b.log(`Applying discount code ${e}`,r,n),r){case tr.CART_PAGE:location.href=`${i}?redirect=/cart`;break;case tr.CART_DRAWER:location.href=`${i}?redirect=${location.pathname}#open-cart-drawer=1`;break;case tr.SHOPIFY_CHECKOUT:location.href=`${i}?redirect=/checkout`;break;case tr.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${i}?redirect=/cart#initiate-checkout=1`);break;default:location.href=`${i}?redirect=${n||location.pathname}`}}static navigateWithoutDiscount(e,r){let n=rt.get();switch(e){case tr.CART_PAGE:location.href="/cart";break;case tr.SHOPIFY_CHECKOUT:location.href="/checkout";break;case tr.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods("/cart#initiate-checkout=1");break;case tr.CART_DRAWER:{n.open();break}}r&&n.refreshUI(r)}static async applyWithStorefront(e){let r={cartId:`gid://shopify/Cart/${ve.getCurrent().token}`,discountCodes:e};b.verbose(`Applying ${e.length} coupons on cart`),await uc(g0,r,"storefront-apply-discount")}static checkThirdPartyMethods(e){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.handleFloCheckoutBtn?window.handleFloCheckoutBtn():window.openRzpCheckout?window.openRzpCheckout():location.href=e}};var y0=`
|
|
55
55
|
mutation cartCreate($input: CartInput) {
|
|
56
56
|
cartCreate(input: $input) {
|
|
57
57
|
cart {
|
|
@@ -64,11 +64,11 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
`,Bn=class{async addToCart(e,r){if(!e.length)return;let i={items:e.map(s=>{let{vID:a,quantity:c}=this.getVIDAndQuantity(s);return{id:a?+a:+s.mID,quantity:c,properties:r.getPrivateAttributesForLineItem()}})},o=rt.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections=="function")try{i.sections_url=window.location.pathname,i.sections=window.cooeeGetCartSections()}catch(s){ae(s,"execute-cooeeGetCartSections",{engagementTrigger:r})}else o.isMiniCart()?i.sections=["mini-cart"]:o.isShopifyDefaultDrawer()&&(i.sections=o.element.getSectionsToRender?.().map((s=>s.section??s.id)));try{let s=await Yi("/cart/add.js",i);return w.log(`Added ${e.length} items to Cart`),Sr("Product added to your cart"),s.data}catch(s){ae(s,"cart-item-add",{engagementTrigger:r});let a=["Failed to add product in cart."];if(s instanceof Wn&&s.is40x()&&s.responseText){let c=s.responseText;c.description&&a.push(`Reason: ${c.description}`)}a.push("Please try again later."),Sr(a.join(" "))}}async updateLineItem(e,r){if(!rr.hasKeys(r)){w.warn("No update fields provided");return}let n=_({id:e.key},r);try{let i=await Yi("/cart/change.js",n);w.log(`Updated ${e}`),ve.getCurrent().update(i.data)}catch(i){ae(i,"cart-item-update"),Sr("Failed to update item in cart")}}async copyDiscountCode(e){if(e)try{await navigator.clipboard.writeText(e),w.log(`Code-${e} copied`),Sr("Discount code copied")}catch(r){w.error("Failed to copy code",r)}}getProductURL(e){if(!e?.link)return;let r=mg(e.link);if(r)return zi("/products/"+r)}async upgradeToSubscription(e,r){if(!e){w.warn("Trying to upgrade to subscription with no item");return}let n=await ve.getCurrent().getNormalisedCart(),i=e.selectedOrFirstVariant.value,o=n.items.findIndex(c=>c.vID===i.mID),s=i.selectedSellingPlan.value,a={line:o+1,selling_plan:s?.mID||null,properties:r.getPrivateAttributesForLineItem()};try{let c=await Yi("/cart/change.js",a);return w.log(`Upgraded ${e} selling plan`),Sr("Line item updated"),ve.getCurrent().update(c.data),c.data}catch(c){ae(c,"cart-switch-subscription",{engagementTrigger:r}),Sr("Failed to update subscription")}}async createNewCart(e,r,n){if(!e?.vID){w.error("No variant ID found to perform Buy now",e);return}let i=r?[r]:[],o=[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],s=await Qa("Buy Now");return(await dc(u0,{input:{lines:o,discountCodes:i,attributes:s}},"storefront-create-cart")).data.data?.cartCreate?.cart?.checkoutUrl}async process(e){let r=e.clickAction,n=e.items,i=e.triggerData,o;if(r.at){let s=r;if(w.log(`Performing ${JSON.stringify(s)} action`),s.at===we.GO_TO_PRODUCT)o=this.getProductURL(n[0]);else if(s.at===we.ADD_TO_CART)n?.length&&await this.addToCart(n,i);else if(s.at===we.COPY_COUPON_CODE)await this.copyDiscountCode(i.discount?.code);else if(s.at===we.OPEN_CART)rt.get().open();else if(s.at===we.GO_TO_COLLECTION){let a=e.collections;if(!a?.length)return;o=zi("/collections/"+a[0].handle)}}r.applyDiscount&&i.discount?.code?zr.navigate(i.discount.code,i.redirectBehaviour,o):o&&(location.pathname=o)}getVIDAndQuantity(e){let r,n;if(e instanceof Ct)r=e.vID,n=e.quantity??1;else{if(!e.vars?.length)return{};r=e.selectedOrFirstVariant.value.mID,n=1}return{vID:r,quantity:n}}};var xl=class{static updateIdentity(e){if(!this.isInstalled())return;let r={};e.email&&(r.email=e.email),e.mobile&&(r.phone_number=e.mobile),w.verbose("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",r])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}};var Cl=class{action;triggerContext;constructor(e,r){this.action=e,this.triggerContext=r}async execute(){let e=this.containsCTA()?"CE Trigger Clicked":"CE Trigger Closed";switch(this.action.at!==we.SUBMIT_FORM&&await this.closeTriggerAndSendEvent(e),this.action.at){case we.ACCEPT_POPUP:break;case we.GO_TO_URL:this.gotoURLAction();break;case we.SHARE:this.shareAction();break;case we.SUBMIT_FORM:await this.collectFormData();break;case void 0:case we.OPEN_CART:break;default:w.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let e=this.action.gu.u;Ui(e)||(e=`//${e}`),window.open(e,"_self")}}async closeTriggerAndSendEvent(e,r){this.triggerContext.closeInApp(e,r),await this.dispatchEvent()}shareAction(){if(!this.action.share)return;if(!navigator.share){w.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(r=>console.log(r)).catch(r=>console.error(r))}containsCTA(){return this.action.at&&this.action.at!==we.REJECT_POPUP?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(e){return e?Object.keys(e).length===0:!0}async collectFormData(){let e={};for(let r of this.triggerContext.inputs){if(!r.isValid)return;let i=document.getElementById(r.id).value;r.type===51?e.email=i:r.type===52&&(e.mobile=i)}await this.closeTriggerAndSendEvent("CE Form Submitted",{form:e}),this.action.applyDiscount&&Sr("Coupon applied on cart"),xl.updateIdentity(e)}async dispatchEvent(){let e=this.triggerContext.triggerData,r={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new Bn().process(r);let n={action:this.containsCTA()?"CLICKED":"CLOSED"};document.dispatchEvent(new CustomEvent("letscooee:outbound:popup-activities",{detail:n}))}};var dr=class{renderer=kn.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,r,n){this.parentHTMLEl=e,this.inappElement=r,this.triggerContext=n,this.stylesConverter=new Io(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.parentHTMLEl.appendChild(this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let e=Z(_(_(_(_({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});hi(this.inappHTMLEl,e)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&re(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&re(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let e={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};hi(this.inappHTMLEl,e)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let e=this.inappElement.alpha;if(!isNaN(e)){let r=(e/100).toFixed(2);re(this.inappHTMLEl,"opacity",r)}}processShadow(){let e=this.inappElement.shd;e?re(this.inappHTMLEl,"box-shadow",e.getStyle(this.scalingFactor)):re(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let e=new Vn(this.inappElement.trf);e&&e.rotate&&re(this.inappHTMLEl,"transform",`rotate(${e.rotate}deg)`)}registerAction(){let e=this.inappElement.clc;!e||Object.keys(e).length===0||(this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation(),new Cl(e,this.triggerContext).execute()}),re(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}};var Yr=class extends dr{constructor(e,r,n){super(e,r,n)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let e={},r=this.inappElement.typography;return r&&(e.fontSize=this.stylesConverter.getSizePx(r.fs),e.fontFamily="cooee"+r.fam?.name,e.lineHeight=`${r.lh}`,e.letterSpacing=r.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),hi(this.inappHTMLEl,e),e}processPart(e,r){let n=[];r.u&&n.push("underline"),r.st&&n.push("line-through"),n.length||n.push("normal"),re(e,"font-weight",r.b?"bold":"normal"),re(e,"font-style",r.i?"italic":"normal"),re(e,"text-decoration",n.join(" ")),re(e,"color",r.c??"inherit"),re(e,"font-family","inherit")}processAlignment(){let e=this.inappElement.typography.ta,r=e?xi[e]?.toLowerCase():this.inappElement.typography.alignment;r||(r="start"),re(this.inappHTMLEl,"text-align",r)}};var ks=class extends Yr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(e=>{let r=document.createElement("span");r.innerHTML=e.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(r,e),this.inappHTMLEl.appendChild(r)}),this.processCommonBlocks()}};var Us=class extends dr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}};var yi=class extends dr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("img"),this.insertElement()}render(){this.inappHTMLEl.setAttribute("src",this.inappElement.src),re(this.inappHTMLEl,"max-width","none"),re(this.inappHTMLEl,"max-height","none"),re(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}};var Fs=class t extends dr{constructor(r,n,i){super(r,n,i);this.parent=r;this.inappHTMLEl=document.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add("cooee-wrapper"),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),re(this.inappHTMLEl,"z-index",t.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let r=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(re(this.inappHTMLEl,"width","100%"),re(this.inappHTMLEl,"height","100%")):(re(this.inappHTMLEl,"width","100vw"),re(this.inappHTMLEl,"height","100vh")),re(this.inappHTMLEl,"top","0"),re(this.inappHTMLEl,"left","0");else{let n=this.inappElement.spc,i=this.stylesConverter.getScaledSize(r.w)+n.getHorizontal(),o=this.stylesConverter.getScaledSize(r.h)+n.getVertical();re(this.inappHTMLEl,"width",i+"px"),re(this.inappHTMLEl,"height",o+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return _(_({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){this.renderer.isParentNotBody()?re(this.inappHTMLEl,"position","absolute"):re(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}};var p0="cooee-container",Rl=class extends dr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),re(this.inappHTMLEl,"position","relative"),re(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(p0),this}};var Al=class t extends Yr{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=Z(_(_(_({flex:"1 1 0"},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e)}getBackgroundStyles(){return{}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.addStylesToTimer(e),e}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(e){this.elements.forEach(r=>hi(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(t.DAYS)),e.hour&&this.elements.push(this.getChild(t.HOURS)),e.minute&&this.elements.push(this.getChild(t.MINUTES)),e.second&&this.elements.push(this.getChild(t.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=document.createElement("div"),n=document.createElement("span"),i=document.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,re(i,"font-size","0.5em"),re(i,"text-align","center"),re(i,"font-family","inherit"),re(n,"text-align","center"),re(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),re(r,"display","flex"),re(r,"flex-direction",this.inappElement.horizontal?"":"column"),re(r,"justify-content","center"),re(r,"align-items","center"),re(r,"gap","5px"),this.spans.push(n),r}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,r=>{this.spans.forEach(n=>{n.id===`lc-${t.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${t.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${t.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${t.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}};var Dl=class extends Yr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("select"),this.insertElement()}render(){re(this.inappHTMLEl,"background","#ffffff00"),re(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(e){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),e.addEventListener("click",r=>{r.stopPropagation()}),e.addEventListener("change",()=>{let r=new Ur(JSON.parse(e.value));this.updateItems(r)})}updateItems(e){let r=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[r.toEmbed(e)];let n=this.parentHTMLEl.querySelector("#coo-13");if(!n)return;let i=e.imgs[0]??r.imgs?.at(0);i?.url&&n.setAttribute("src",i.url)}addOptions(){let e=this.triggerContext.triggerData.items,r=this.inappHTMLEl;if(!e?.length){r.add(this.createOption(this.inappElement.placeholderText));return}let n=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(i=>{r.add(this.createOption(i.name??"Default",i,i.mID===n?.vID))})}createOption(e,r,n){let i=document.createElement("option");return i.text=e,i.value=JSON.stringify(r),n&&(i.selected=!0),r||(i.disabled=!0),i}};var To=class extends Yr{borderColor="";constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("input"),this.insertElement()}render(){let e=this.setInputType();this.inappHTMLEl.setAttribute("placeholder",this.inappElement.placeholderText),re(this.inappHTMLEl,"background","#ffffff00"),re(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,e),this.triggerContext.addInputField(e,this.inappElement.t)}};var Nl=class t extends To{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","email"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.EMAIL_REGEX)?(re(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(re(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var Ol=class t extends To{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","tel"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.MOBILE_REGEX)?(re(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(re(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var Pl=class extends yi{constructor(e,r,n){super(e,r,n)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}};var kn=class t{static DOCUMENT_STANDARD_MODE="CSS1Compat";static ACTIVE_TRIGGER_DATA;static _instance;eventAPIService;parent;rootContainer;containerHTMLElement;ian;scalingFactor=1;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.eventAPIService=Re.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}static get(){return t._instance}render(e){this.renderEngagement(new Tt(e))}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,o=e.spc,s=this.getWidth(),a=this.getHeight();r&&(s=s?Math.min(s,r):r,a=a?Math.min(a,r):r),a&&(s-=o.getHorizontal(),a-=o.getVertical(),s/a<n/i?this.scalingFactor=s/n:this.scalingFactor=a/i,this.scalingFactor=Math.min(this.scalingFactor,1))}setParentContainer(e){this.parent=e||document.body,this.isParentNotBody()&&re(this.parent,"position","relative")}isParentNotBody(){return this.parent&&this.parent!==document.body}getWidth(){return this.isParentNotBody()?this.parent.clientWidth:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parent.clientHeight:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}async renderEngagement(e){this.triggerContext=new Ar(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(Gr()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!rt.get().isOpen()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=window.CooeeSDK.cartDrawerToggle$.subscribe(({open:r})=>{!r&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){t.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData,t._instance=this;try{this.startRendering()}catch(e){ae(e,"render-popup",{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),Gr()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&t.ACTIVE_TRIGGER_DATA){let n={triggerShown:new Dn(t.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(fe.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=bm.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.calculateScalingFactor(this.ian),this.rootContainer=new Fs(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw w.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new Ie("CE Trigger Displayed",e,this.triggerContext.triggerData);this.eventAPIService.sendSilently(r);let n={action:"DISPLAYED"};document.dispatchEvent(new CustomEvent("letscooee:outbound:popup-activities",{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new Ie(r,e,this.triggerContext.triggerData);n.name==="CE Trigger Clicked"&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.eventAPIService.sendSilently(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof Ji?new Nl(e,r,n).render():r instanceof Qi?new Ol(e,r,n).render():r instanceof Tn?new ks(e,r,n).render():r instanceof Zi?new Pl(e,r,n).render():r instanceof cn?new yi(e,r,n).render():r instanceof ei?new Us(e,r,n).render():r instanceof Ki?new Al(e,r,n).render():r instanceof Xi?new Dl(e,r,n).render():w.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new Rl(this.rootContainer,r,e).render().getHTMLElement(),new Tl().loadAllFonts(this.ian),this.ian.elems?.forEach(async n=>{await this.renderElement(this.containerHTMLElement,n,e)}),this.addEnterAnimation(this.ian.anim))}closeInApp(e){let r=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),t.ACTIVE_TRIGGER_DATA=void 0;let n=this.containerHTMLElement.animate(r,{duration:500,easing:"ease-in-out"});n.onfinish=()=>{this.removeInApp(),window.removeEventListener("resize",this.resizeListener)}}screenResized(){this.removeInApp(),this.startRendering()}removeInApp(){let e=document.querySelector(`.${this.triggerContext.rootClassName}`);e&&e.parentElement.removeChild(e)}skipTrigger(e,r){let n=new Ie("CE Campaign Rejected",r,e);this.eventAPIService.sendSilently(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let o=i.bg?.img?.src;if(o&&n.push(this.getPromise(o)),i.t===1){let s=i.src;if(!s)return;n.push(this.getPromise(s))}}),r.bg?.img?.src&&n.push(this.getPromise(r.bg.img.src)),r.cont.bg?.img?.src&&n.push(this.getPromise(r.cont.bg.img.src)),await Promise.all(n)}getPromise(e){return new Promise(r=>{let n=new Image;n.onload=r,n.src=e,n.style.display="none"})}};var xo=class{static trackDeviceID(e){this.isInstalled()}static trackIntent(e){if(!this.isInstalled())return;let r=gi[e]?.toLowerCase();r&&(w.verbose(`Sending ${r} intent to MS Clarity`),window.clarity("set","Cooee Intent",r))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}};var Ll=class{triggerData;eventAPIService=Re.getInstance();backendAPIService=Nt.getInstance();render(e){e.contentSource===Uo.KLAVIYO&&(this.triggerData=e,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",e.klaviyoFormID]))}handleKlaviyoEvents(e){if(e.type!=="klaviyoForms")return;let r=e.detail;if(r.formId!==this.triggerData.klaviyoFormID){w.warn("Received invalid trigger callback");return}switch(r.type){case"open":this.eventAPIService.sendSilently(new Ie("CE Trigger Displayed",{form:{id:r.formId}},this.triggerData));break;case"stepSubmit":{let n=this.getFormDetails(r);this.eventAPIService.sendSilently(new Ie("CE Form Submitted",{form:n},this.triggerData)),this.backendAPIService.updateProfileSafe(n);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.eventAPIService.sendSilently(new Ie("CE Trigger Closed",{form:{id:r.formId}},this.triggerData));break}}getFormDetails(e){let r={id:e.formId},n=e.metaData;if(rr.hasKeys(n)){let i=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach(a=>{i.includes(a)||(r[a]=n[a])}),r.email=n.$email??n.email,r.mobile=n.$phone_number??n.phone_number;let o=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(o?.length||s?.length)&&(r.name=o+" "+s)}return r}};var Ml=class{static trackIntent(e){if(!this.isInstalled()){w.verbose("Facebook pixel not installed");return}if(!Je.get().pixelPush){w.verbose("Facebook pixel push not enabled");return}let n=gi[e.intent]?.toLowerCase(),i=e.segmentName;!n&&!i||(w.verbose(`Sending ${n} intent and ${i} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:n,segment_value:e.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}};var am=new Map,Bl=async t=>{for(let o of t.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(o,t)}catch(s){w.error(s)}if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let s=(await ve.getCurrent().getNormalisedCart()).items.map(a=>a.mID);t.items=t.items.filter(a=>!s.includes(a.mID))}if(Je.get().currencyCount<=1)return t.items;if(t.isShoppableVideo())return await f0(t.content.videoConfig,t),t.items;let e=t.items.length,r=t.items.map(o=>Xy(o,t)),i=(await Promise.all(r)).filter(o=>o!=null);if(e&&!i.length){let o="Failed to fetch any product from Ajax API",s=new Ie("CE Campaign Failed",{reason:o,currency:t.currency},t);throw ue.get(Re).sendSilently(s),new Error(o)}if(t.isCartRecovery()){let o=ve.getCurrent().items,s=[];for(let a of i)for(let c of a.vars){if(!c.isAvailable)continue;let p=o.find(E=>E.variant_id.toString()===c.mID);if(!p)continue;let d=new At(a);d.name=p.title;let f=new Ur(c);f.name=p.variant_title,f.price.d=p.discounted_price/100,d.variants=[f],s.push(d)}return s}return i},f0=async(t,e)=>{await Promise.all(t.videos.map(async r=>{r.items=await Promise.all(r.items.map(async n=>{let i=await Xy(n,e);return i||n}))}))},Xy=async(t,e)=>{if(am.has(t.mID))return am.get(t.mID);let r,n=`/products/${t.slug}.js`;try{r=(await Zr(n)).data}catch(i){return ae(i,"fetch-shopify-product",{extra:{item:t,path:n},engagementTrigger:e}),null}return r?m0(t,r):(w.error("Item not found after AJAX call for:",t),null)},m0=(t,e)=>{if(!t||!e)return t;t.name=e.title,t.tags=e.tags,t.slug=e.handle;let r=t.selectedOrFirstVariant.value;return t.vars.map(n=>{let i=e.variants.find(o=>o.id===+n.mID);i!=null&&(n.name=i.title,n.isAvailable=i.available,n.price.d=i.price?i.price/100:i.price,n.price.effective=n.price.d,n.price.cmp=i.compare_at_price?i.compare_at_price/100:i.compare_at_price,+r.mID===i.id&&(r.effectivePrice.value=n.price.d))}),am.set(t.mID,t),t};var Un=class{runtimeData=fe.get();backendAPIService=ue.get(Nt);sessionManager=ue.get(ct);constructor(){}async getAllContext(){let[e,r]=await Promise.all([Il(),this.sessionManager.checkSessionAndGetContext()]);return _(_({},e),r)}};var Re=class t extends Un{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}sendSafe(e){w.verbose(`Waiting for auth to send event ${e.name}`),fr(ct.replaySubject).then(()=>this.sendSilently(e))}sendSilently(e){this.send(e).catch(r=>ae(r,"track-event",{extra:{event:e}}))}async send(e){if(w.verbose(`Sending event: ${e.name}`,e),this.shouldReject(e)){w.warn(`Rejecting event ${e.name}`);return}this.addShopifyAttributes();let r=await this.getAllContext();Object.assign(e,r),e.name!=="CE App Background"&&this.runtimeData.setActive(),this.backendAPIService.post("/v1/event/track",e).then(async n=>{w.info("\u2705 Event tracked:",this.userFriendlyName(e.name)),this.processEventResponse(e,n.data)}).catch(n=>{w.error(`Error sending event ${e.name} to server`,n)})}userFriendlyName(e){return e.replace("CE ","").replace("Trigger","Engagement").replace("Screen","Page").replace("App ","")}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(w.warn("Not sending event as this is a test trigger"),!0):!1}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{ae(n,"process-popup-response",{extra:{event:e,response:r}})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData)return;let n=new Tt(r.triggerData);n.occurred=e.occurred,w.log(`${n} will be shown`);let i;try{i=await Bl(n)}catch(o){w.error("Failed to refresh the products",o);return}if(n.items=i,n.contentSource===Uo.KLAVIYO){new Ll().render(n);return}new kn().renderEngagement(n).catch(o=>{ae(o,"render-popup",{extra:{event:e},engagementTrigger:n})})}utiliseIntentIfCalculated(e){e.intent&&(xo.trackIntent(e.intent),Ml.trackIntent(e),w.info(`Intent is ${gi[e.intent]}`))}addShopifyAttributes(){ve.getCurrent().addCooeeAttributes().catch(e=>{w.error("Fail to add attributes in cart",e)})}};var vi=class t{static cartChange$=new jt;compareCartItemSubject=new jt;constructor(){this.compareCartItemSubject.pipe(mr(100)).subscribe(this.compareCartItems.bind(this))}listen(){this.compareCartItemSubject.next(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let e=this,r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){e.performEvent(this._url).catch(n=>w.error("Unable to process cart change in XMLHttpRequest",n))}),r.apply(this,arguments)},w.verbose("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=function(n){return r.apply(window,arguments).then(i=>(e.performEvent(n.toString()).catch(o=>w.error("Unable to process cart change in fetch",o)),i))},w.verbose("Securely overwritten window.fetch method")}async performEvent(e){this.isCartManipulationURL(e)&&(fe.get().isCartDirty=!0,this.compareCartItemSubject.next())}isCartManipulationURL(e){return/\/cart\/(add|change|update|clear)/.test(e)}sendChangesAsEvents(e,r){let n=e?.items,i=r.items,o=[],s=[];if(w.verbose(`Comparing cart change with old count ${n?.length} to new count ${i.length}`),i?.forEach(a=>{let c=n?.find(p=>p.vID===a.vID);if(c){if(c.quantity!==a.quantity){let p=c.quantity<a.quantity,d=Math.abs(c.quantity-a.quantity),f=Z(_({},a),{quantity:d});p?o.push(f):s.push(f)}n&&Ah(n,c)}else o.push(a)}),n)for(let a of n)s.push(a);w.verbose(`Cart delta: added: ${o.length}, removed: ${s.length}`),o.length&&this.sendEvent("Add To Cart",{items:o}),s.length&&e.token===r.token&&this.sendEvent("Remove From Cart",{items:s}),(s.length||o.length)&&t.cartChange$.next({itemsAdded:o,itemsRemoved:s})}sendEvent(e,r){let n=new Ie(e,r);ue.get(Re).sendSafe(n)}async compareCartItems(){let e=await Ke.get("cart",{}),r=await ve.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(e,r)}};var rt=class t{static cartDrawerToggle$=new xs({open:!1,firstOpen:!1});static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=Je.get().website??{};currentState=!1;mutationSubscription;mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;clickEventListener;refreshUIEventListener;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[t.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize(),this.refreshUIEventListener=this.updateBubble.bind(this),this.clickEventListener=this.manualCartIconClicked.bind(this),document.addEventListener("letscooee:outbound:refresh-ui",this.refreshUIEventListener),document.addEventListener("click",this.clickEventListener,{capture:!0,passive:!0})}get element(){return this.cartDrawerElement}static get(){return t._instance||(t._instance=new t),t._instance}static forceUpdate(){t._instance?.destroy(),t._instance=new t}isOpen(){let e=this.inShadow?this.isPresent():sm(this.cartDrawerElement);return w.info(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){w.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent("letscooee:outbound:open-cart"));let e=document.querySelector(this.iconSelector);if(!e){w.verbose("No clickable cart icon found with selector",this.iconSelector);return}e.click()}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===t.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(window.cooeeUpdateCartDrawer)try{window.cooeeUpdateCartDrawer(e)}catch(n){ae(n,"execute-cooeeUpdateCartDrawer")}else if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove("is-empty"),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,o=e.items[0].price;window.cartGiftUpdate(n,o,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer&&typeof window.theme?.CartDrawer=="function")window.theme?.CartDrawer.init?new window.theme.CartDrawer().init():new window.theme.CartDrawer;else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(window.cart?.getCart)window.cart.getCart();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else window.Shopify?.KT_onItemAdded?window.Shopify.KT_onItemAdded():window.sideCart?.updateCart?window.sideCart.updateCart():window.SLIDECART_UPDATE?(window.SLIDECART_UPDATE(),window.SLIDECART_OPEN?.()):window.refreshCart?ve.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(ve.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():window.CartJS?.getCart?window.CartJS?.getCart():window.updateCartItemJS?window.updateCartItemJS(1,e?.items?.[0]?.id+""):(w.info("No method found to update the cart drawer. Blindly firing some events to try"),document.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})));document.dispatchEvent(new CustomEvent("letscooee:outbound:refresh-ui",{detail:{responseJSON:e,currentCart:ve.getCurrent()}})),r&&vi.cartChange$.next({})}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(":shadow");r.length===1?(this.selector=r[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=r[0]?.trim(),this.selector=r[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!ls())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await Hi(e),!this.cartDrawerElement){Jy.default.warn("Max attempts exhausted to find cart drawer");return}w.verbose("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let r=(await Hi(this.shadowParentElementSelector))?.shadowRoot;r?.mode==="open"&&(this.cartDrawerShadowElement=r,this.createMutationObservers())}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||this.watchForCartToggle()}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new jt;this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),this.mutationSubscription=r.pipe(rm(800,void 0,{leading:!1,trailing:!0})).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,t.cartDrawerToggle$.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){if(!this.selector||!this.cartDrawerShadowElement)return!1;let e=this.cartDrawerShadowElement.querySelector(this.selector);return e?sm(e):!1}async updateBubble(){let e=(await ve.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=e+"")}manualCartIconClicked(e){!e.target.closest(this.iconSelector)||!e.isTrusted||window.CooeeSDK.events.push(["Open Cart"])}destroy(){document.removeEventListener("letscooee:outbound:refresh-ui",this.refreshUIEventListener),document.removeEventListener("click",this.clickEventListener,{capture:!0}),this.mutationSubscription?.unsubscribe(),this.mutationObserver?.disconnect()}};var kl=class{static processConfiguration(){let e=Je.get();!e.gaMeasurementID||!e.gaEnabled||this.sendClientID()}static async sendClientID(){let e=await this.getClientID();e&&Nt.getInstance().updateDevicePropsSafe({gaClientID:e})}static async getClientID(){let e=await Ke.get("gacid"),r=await this.getClientIDViaGTag();if(e!==r)return await Ke.set("gacid",r),r}static async getClientIDViaGTag(){let r=Je.get().gaMeasurementID;if(!(!r||!window.gtag))return new Promise(n=>{window.gtag("get",r,"client_id",i=>{n(i)})})}};var d0=t=>t,Qy=t=>t.filter(e=>e.removedNodes&&e.removedNodes.length>0);function Zy(t,e={childList:!0,subtree:!0},r=500,n=d0){return wl(i=>{let o=new MutationObserver(s=>i(s));return o.observe(t,e),o},(i,o)=>o.disconnect()).pipe(fn(i=>n(i)),So(i=>i.length>0),mr(r))}var Fe=class extends Br{stylesConverter=new Io(1);mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=Gr()?"sm":"lg",this.clickExecutor=new mn(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),_(_(Z(_(_(_(_(_(_({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:"border-box",outline:"none"}),this.getComponentStyles()),this.props.style)}matchWhenCondition(e){if(!e?.op)return!0;let{lhs:r,rhs:n}=e;switch(e.op){case"eq":return r===n;case"gt":return+r>+n;case"gte":return+r>=+n;case"lt":return+r<+n;case"lte":return+r<=+n;case"ne":return r!==n;case"null":return r==null;case"empty":return r.trim()==="";case"in":return new RegExp(`\\b${n}\\b`).test(r);case"nin":return!new RegExp(`\\b${n}\\b`).test(r);default:return w.error(`Invalid operator found for when condition - ${e.op}`),!1}}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,Gr()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=_(_({},this.mediaStyle),e.style.sm))}sendTriggerClicked(e,r){this.clickExecutor.sendTriggerClicked(e,r)}async onClick(e,r){e.stopPropagation(),r.clickAction||(r.clickAction=this.props.element.clc),r.clickAction?.at&&await this.clickExecutor.execute(r)}};var h0=0,A3=Array.isArray;function K(t,e,r,n,i,o){e||(e={});var s,a,c=e;if("ref"in c)for(a in c={},e)a=="ref"?s=e[a]:c[a]=e[a];var p={type:t,props:c,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--h0,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(s=t.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return xe.vnode&&xe.vnode(p),p}var Qt=class extends Fe{componentDidMount(){this.setState(()=>({text:this.props.element.text})),It(this.onChange.bind(this))}componentWillReceiveProps(e){this.props.element=e.element,this.onChange()}render(){let e=this.getCompiledStyles(),r=this.state.text;return r||(e.display="none",r=""),K("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:K("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:r}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,r={bundle:e.discountData.value,customer:e.customerData,cart:e.getCartMagicVariables()},n=Zn(this.props.element,r,this.props.triggerContext),i=new vt(n);if(!this.matchWhenCondition(i.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:i.text}))}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ut;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily=r.fam.name||"inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,e.textDecoration=r.td??"none",this.stylesConverter.getColourStyles(r.tc,"color",e),e}getComponentStyles(){return _({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}};var Ei=class extends Qt{render(){return K("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:e=>this.onClick(e,{item:this.props.item}),children:K("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return Z(_({},super.getComponentStyles()),{cursor:"pointer"})}};var cm=class extends Br{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?K("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[K("span",{children:this.props.time}),K("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):K("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[K("span",{style:this.getTimeLabelStyle(),children:this.props.label}),K("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let e={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(e.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),e}},Hs=class extends Qt{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>_({},this.labels)),this.processAndStartTimer()}render(){return K("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>K(cm,{styles:this.getCompiledStyles(),label:e,time:this.state[e],element:this.props.element}))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return _(_({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,e=>{this.labels.Days=String(e.days).padStart(2,"0"),this.labels.Hours=String(e.hours).padStart(2,"0"),this.labels.Minutes=String(e.minutes).padStart(2,"0"),this.labels.Seconds=String(e.seconds).padStart(2,"0"),this.setState(()=>_({},this.labels))})}};function Ul(t,e){if(!t)return;let r={loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(i,o)=>`
|
|
67
|
+
`,Bn=class{async addToCart(e,r){if(!e.length)return;let i={items:e.map(s=>{let{vID:a,quantity:c}=this.getVIDAndQuantity(s);return{id:a?+a:+s.mID,quantity:c,properties:r.getPrivateAttributesForLineItem()}})},o=rt.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections=="function")try{i.sections_url=window.location.pathname,i.sections=window.cooeeGetCartSections()}catch(s){ae(s,"execute-cooeeGetCartSections",{engagementTrigger:r})}else o.isMiniCart()?i.sections=["mini-cart"]:o.isShopifyDefaultDrawer()&&(i.sections=o.element.getSectionsToRender?.().map((s=>s.section??s.id)));try{let s=await zi("/cart/add.js",i);return b.log(`Added ${e.length} items to Cart`),br("Product added to your cart"),s.data}catch(s){ae(s,"cart-item-add",{engagementTrigger:r});let a=["Failed to add product in cart."];if(s instanceof Wn&&s.is40x()&&s.responseText){let c=s.responseText;c.description&&a.push(`Reason: ${c.description}`)}a.push("Please try again later."),br(a.join(" "))}}async updateLineItem(e,r){if(!rr.hasKeys(r)){b.warn("No update fields provided");return}let n=_({id:e.key},r);try{let i=await zi("/cart/change.js",n);b.log(`Updated ${e}`),ve.getCurrent().update(i.data)}catch(i){ae(i,"cart-item-update"),br("Failed to update item in cart")}}async copyDiscountCode(e){if(e)try{await navigator.clipboard.writeText(e),b.log(`Code-${e} copied`),br("Discount code copied")}catch(r){b.error("Failed to copy code",r)}}getProductURL(e){if(!e?.link)return;let r=vg(e.link);if(r)return Gi("/products/"+r)}async upgradeToSubscription(e,r){if(!e){b.warn("Trying to upgrade to subscription with no item");return}let n=await ve.getCurrent().getNormalisedCart(),i=e.selectedOrFirstVariant.value,o=n.items.findIndex(c=>c.vID===i.mID),s=i.selectedSellingPlan.value,a={line:o+1,selling_plan:s?.mID||null,properties:r.getPrivateAttributesForLineItem()};try{let c=await zi("/cart/change.js",a);return b.log(`Upgraded ${e} selling plan`),br("Line item updated"),ve.getCurrent().update(c.data),c.data}catch(c){ae(c,"cart-switch-subscription",{engagementTrigger:r}),br("Failed to update subscription")}}async createNewCart(e,r,n){if(!e?.vID){b.error("No variant ID found to perform Buy now",e);return}let i=r?[r]:[],o=[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],s=await Ya("Buy Now");return(await uc(y0,{input:{lines:o,discountCodes:i,attributes:s}},"storefront-create-cart")).data.data?.cartCreate?.cart?.checkoutUrl}async process(e){let r=e.clickAction,n=e.items,i=e.triggerData,o;if(r.at){let s=r;if(b.log(`Performing ${JSON.stringify(s)} action`),s.at===we.GO_TO_PRODUCT)o=this.getProductURL(n[0]);else if(s.at===we.ADD_TO_CART)n?.length&&await this.addToCart(n,i);else if(s.at===we.COPY_COUPON_CODE)await this.copyDiscountCode(i.discount?.code);else if(s.at===we.OPEN_CART)rt.get().open();else if(s.at===we.GO_TO_COLLECTION){let a=e.collections;if(!a?.length)return;o=Gi("/collections/"+a[0].handle)}}r.applyDiscount&&i.discount?.code?Gr.navigate(i.discount.code,i.redirectBehaviour,o):o&&(location.pathname=o)}getVIDAndQuantity(e){let r,n;if(e instanceof Rt)r=e.vID,n=e.quantity??1;else{if(!e.vars?.length)return{};r=e.selectedOrFirstVariant.value.mID,n=1}return{vID:r,quantity:n}}};var _l=class{static updateIdentity(e){if(!this.isInstalled())return;let r={};e.email&&(r.email=e.email),e.mobile&&(r.phone_number=e.mobile),b.verbose("Sending email/mobile to Klaviyo"),window.klaviyo.push(["identify",r])}static isInstalled(){return window.klaviyo&&typeof window.klaviyo=="object"}};var bl=class{action;triggerContext;constructor(e,r){this.action=e,this.triggerContext=r}async execute(){let e=this.containsCTA()?"CE Trigger Clicked":"CE Trigger Closed";switch(this.action.at!==we.SUBMIT_FORM&&await this.closeTriggerAndSendEvent(e),this.action.at){case we.ACCEPT_POPUP:break;case we.GO_TO_URL:this.gotoURLAction();break;case we.SHARE:this.shareAction();break;case we.SUBMIT_FORM:await this.collectFormData();break;case void 0:case we.OPEN_CART:break;default:b.error("Received an invalid ClickActionType: ",this.action.at);return}}externalAction(){this.action.ext?.u&&window.open(this.action.ext.u,"_blank")?.focus()}gotoURLAction(){if(this.action.gu?.u){let e=this.action.gu.u;ki(e)||(e=`//${e}`),window.open(e,"_self")}}async closeTriggerAndSendEvent(e,r){this.triggerContext.closeInApp(e,r),await this.dispatchEvent()}shareAction(){if(!this.action.share)return;if(!navigator.share){b.warn("Navigator.share is not compatible with this browser");return}navigator.share({text:this.action.share.text,title:"Share"}).then(r=>console.log(r)).catch(r=>console.error(r))}containsCTA(){return this.action.at&&this.action.at!==we.REJECT_POPUP?!0:!(this.isEmpty(this.action.custKV)&&this.isEmpty(this.action.up))}isEmpty(e){return e?Object.keys(e).length===0:!0}async collectFormData(){let e={};for(let r of this.triggerContext.inputs){if(!r.isValid)return;let i=document.getElementById(r.id).value;r.type===51?e.email=i:r.type===52&&(e.mobile=i)}await this.closeTriggerAndSendEvent("CE Form Submitted",{form:e}),this.action.applyDiscount&&br("Coupon applied on cart"),_l.updateIdentity(e)}async dispatchEvent(){let e=this.triggerContext.triggerData,r={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new Bn().process(r);let n={action:this.containsCTA()?"CLICKED":"CLOSED"};document.dispatchEvent(new CustomEvent("letscooee:outbound:popup-activities",{detail:n}))}};var fr=class{renderer=kn.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;stylesConverter;scalingFactor;constructor(e,r,n){this.parentHTMLEl=e,this.inappElement=r,this.triggerContext=n,this.stylesConverter=new wo(this.renderer.getScalingFactor())}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.parentHTMLEl.appendChild(this.inappHTMLEl)}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let e=Z(_(_(_(_({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:"border-box",outline:"none"});hi(this.inappHTMLEl,e)}getDisplayStyles(){return{display:"block"}}processWidthAndHeight(){this.inappElement.w&&re(this.inappHTMLEl,"width",this.stylesConverter.getSizePx(this.inappElement.w)),this.inappElement.h&&re(this.inappHTMLEl,"height",this.stylesConverter.getSizePx(this.inappElement.h))}processPositionBlock(){let e={position:"absolute",left:this.stylesConverter.getSizePx(this.inappElement.x),top:this.stylesConverter.getSizePx(this.inappElement.y)};hi(this.inappHTMLEl,e)}getBorderStyles(){return this.stylesConverter.getBorderStyles(this.inappElement.br)}getSpaceStyles(){return this.stylesConverter.getSpaceStyles(this.inappElement.spc)}processTransparency(){let e=this.inappElement.alpha;if(!isNaN(e)){let r=(e/100).toFixed(2);re(this.inappHTMLEl,"opacity",r)}}processShadow(){let e=this.inappElement.shd;e?re(this.inappHTMLEl,"box-shadow",e.getStyle(this.scalingFactor)):re(this.inappHTMLEl,"box-shadow","unset")}processTransformBlock(){let e=new Vn(this.inappElement.trf);e&&e.rotate&&re(this.inappHTMLEl,"transform",`rotate(${e.rotate}deg)`)}registerAction(){let e=this.inappElement.clc;!e||Object.keys(e).length===0||(this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation(),new bl(e,this.triggerContext).execute()}),re(this.inappHTMLEl,"cursor","pointer"))}getBackgroundStyles(){return this.stylesConverter.getBackgroundStyles(this.inappElement.bg)}};var zr=class extends fr{constructor(e,r,n){super(e,r,n)}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment()}processFontBlock(){let e={},r=this.inappElement.typography;return r&&(e.fontSize=this.stylesConverter.getSizePx(r.fs),e.fontFamily="cooee"+r.fam?.name,e.lineHeight=`${r.lh}`,e.letterSpacing=r.letterSpacing),this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),hi(this.inappHTMLEl,e),e}processPart(e,r){let n=[];r.u&&n.push("underline"),r.st&&n.push("line-through"),n.length||n.push("normal"),re(e,"font-weight",r.b?"bold":"normal"),re(e,"font-style",r.i?"italic":"normal"),re(e,"text-decoration",n.join(" ")),re(e,"color",r.c??"inherit"),re(e,"font-family","inherit")}processAlignment(){let e=this.inappElement.typography.ta,r=e?Ti[e]?.toLowerCase():this.inappElement.typography.alignment;r||(r="start"),re(this.inappHTMLEl,"text-align",r)}};var Ps=class extends zr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.inappElement.parts?.forEach(e=>{let r=document.createElement("span");r.innerHTML=e.txt?.toString()?.replace(/\n/g,"<br />"),this.processPart(r,e),this.inappHTMLEl.appendChild(r)}),this.processCommonBlocks()}};var Ls=class extends fr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.processCommonBlocks()}};var yi=class extends fr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("img"),this.insertElement()}render(){this.inappHTMLEl.setAttribute("src",this.inappElement.src),re(this.inappHTMLEl,"max-width","none"),re(this.inappHTMLEl,"max-height","none"),re(this.inappHTMLEl,"margin","0 auto"),this.processCommonBlocks()}};var Ms=class t extends fr{constructor(r,n,i){super(r,n,i);this.parent=r;this.inappHTMLEl=document.createElement("div")}static MAX_Z_INDEX="2147483647";render(){return this.parent||this.renderer.removeInApp(),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add("cooee-wrapper"),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),re(this.inappHTMLEl,"z-index",t.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let r=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(re(this.inappHTMLEl,"width","100%"),re(this.inappHTMLEl,"height","100%")):(re(this.inappHTMLEl,"width","100vw"),re(this.inappHTMLEl,"height","100vh")),re(this.inappHTMLEl,"top","0"),re(this.inappHTMLEl,"left","0");else{let n=this.inappElement.spc,i=this.stylesConverter.getScaledSize(r.w)+n.getHorizontal(),o=this.stylesConverter.getScaledSize(r.h)+n.getVertical();re(this.inappHTMLEl,"width",i+"px"),re(this.inappHTMLEl,"height",o+"px")}}getSpaceStyles(){return{padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return _(_({display:"flex"},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){this.renderer.isParentNotBody()?re(this.inappHTMLEl,"position","absolute"):re(this.inappHTMLEl,"position","fixed")}getBorderStyles(){return{}}processTransparency(){}processTransformBlock(){}processShadow(){}};var v0="cooee-container",wl=class extends fr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){return this.processCommonBlocks(),re(this.inappHTMLEl,"position","relative"),re(this.inappHTMLEl,"overflow","hidden"),this.inappHTMLEl.classList.add(v0),this}};var Sl=class t extends zr{static DAYS="Days";static HOURS="Hours";static MINUTES="Minutes";static SECONDS="Seconds";elements;spans=[];constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("div"),this.insertElement()}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=Z(_(_(_({flex:"1 1 0"},this.stylesConverter.getBackgroundStyles(this.inappElement.bg)),this.stylesConverter.getBorderStyles(this.inappElement.br)),this.stylesConverter.getSpaceStyles(this.inappElement.spc)),{marginLeft:this.stylesConverter.getSizePx(this.inappElement.gap),marginRight:this.stylesConverter.getSizePx(this.inappElement.gap)});this.addStylesToTimer(e)}getBackgroundStyles(){return{}}processFontBlock(){let e=super.processFontBlock();return this.stylesConverter.getColourStyles(this.inappElement.color,"color",e),this.addStylesToTimer(e),e}getSpaceStyles(){return{}}getBorderStyles(){return{}}getDisplayStyles(){return{display:"flex",flexWrap:"nowrap",justifyContent:"center"}}addStylesToTimer(e){this.elements.forEach(r=>hi(r,e))}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(t.DAYS)),e.hour&&this.elements.push(this.getChild(t.HOURS)),e.minute&&this.elements.push(this.getChild(t.MINUTES)),e.second&&this.elements.push(this.getChild(t.SECONDS)),this.elements.forEach(r=>this.inappHTMLEl.appendChild(r))}getChild(e){let r=document.createElement("div"),n=document.createElement("span"),i=document.createElement("span");return i.innerText=e,n.innerText="00",n.id=`lc-${e}`,re(i,"font-size","0.5em"),re(i,"text-align","center"),re(i,"font-family","inherit"),re(n,"text-align","center"),re(n,"font-family","inherit"),this.inappElement.lblPos==="start"?(r.appendChild(i),r.appendChild(n)):(r.appendChild(n),r.appendChild(i)),re(r,"display","flex"),re(r,"flex-direction",this.inappElement.horizontal?"":"column"),re(r,"justify-content","center"),re(r,"align-items","center"),re(r,"gap","5px"),this.spans.push(n),r}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,r=>{this.spans.forEach(n=>{n.id===`lc-${t.DAYS}`?n.innerText=String(r.days).padStart(2,"0"):n.id===`lc-${t.HOURS}`?n.innerText=String(r.hours).padStart(2,"0"):n.id===`lc-${t.MINUTES}`?n.innerText=String(r.minutes).padStart(2,"0"):n.id===`lc-${t.SECONDS}`&&(n.innerText=String(r.seconds).padStart(2,"0"))})});this.triggerContext.intervals.push(e)}};var Il=class extends zr{constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("select"),this.insertElement()}render(){re(this.inappHTMLEl,"background","#ffffff00"),re(this.inappHTMLEl,"outline","none"),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions()}addListener(e){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),e.addEventListener("click",r=>{r.stopPropagation()}),e.addEventListener("change",()=>{let r=new Br(JSON.parse(e.value));this.updateItems(r)})}updateItems(e){let r=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[r.toEmbed(e)];let n=this.parentHTMLEl.querySelector("#coo-13");if(!n)return;let i=e.imgs[0]??r.imgs?.at(0);i?.url&&n.setAttribute("src",i.url)}addOptions(){let e=this.triggerContext.triggerData.items,r=this.inappHTMLEl;if(!e?.length){r.add(this.createOption(this.inappElement.placeholderText));return}let n=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(i=>{r.add(this.createOption(i.name??"Default",i,i.mID===n?.vID))})}createOption(e,r,n){let i=document.createElement("option");return i.text=e,i.value=JSON.stringify(r),n&&(i.selected=!0),r||(i.disabled=!0),i}};var So=class extends zr{borderColor="";constructor(e,r,n){super(e,r,n),this.inappHTMLEl=document.createElement("input"),this.insertElement()}render(){let e=this.setInputType();this.inappHTMLEl.setAttribute("placeholder",this.inappElement.placeholderText),re(this.inappHTMLEl,"background","#ffffff00"),re(this.inappHTMLEl,"outline","none"),this.inappHTMLEl.addEventListener("click",r=>{r.stopPropagation()}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,e),this.triggerContext.addInputField(e,this.inappElement.t)}};var Tl=class t extends So{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","email"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.EMAIL_REGEX)?(re(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(re(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var xl=class t extends So{static MOBILE_REGEX=/^\d+$/;constructor(e,r,n){super(e,r,n)}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute("type","tel"),this.inappHTMLEl.setAttribute("id",e),e}addListener(e,r){e.addEventListener("keydown",n=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(t.MOBILE_REGEX)?(re(this.inappHTMLEl,"border-color",this.borderColor),this.triggerContext.updateValidation(r,!0)):(re(this.inappHTMLEl,"border-color","red"),this.triggerContext.updateValidation(r,!1)),n.stopPropagation()})}};var Cl=class extends yi{constructor(e,r,n){super(e,r,n)}render(){super.render(),this.inappHTMLEl.setAttribute("id",`coo-${this.inappElement.type}`)}};var kn=class t{static DOCUMENT_STANDARD_MODE="CSS1Compat";static ACTIVE_TRIGGER_DATA;static _instance;eventAPIService;parent;rootContainer;containerHTMLElement;ian;scalingFactor=1;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.eventAPIService=Re.getInstance(),this.resizeListener=()=>this.screenResized(),this.setParentContainer(e)}static get(){return t._instance}render(e){this.renderEngagement(new xt(e))}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let r=e.max,n=e.cont.w,i=e.cont.h,o=e.spc,s=this.getWidth(),a=this.getHeight();r&&(s=s?Math.min(s,r):r,a=a?Math.min(a,r):r),a&&(s-=o.getHorizontal(),a-=o.getVertical(),s/a<n/i?this.scalingFactor=s/n:this.scalingFactor=a/i,this.scalingFactor=Math.min(this.scalingFactor,1))}setParentContainer(e){this.parent=e||document.body,this.isParentNotBody()&&re(this.parent,"position","relative")}isParentNotBody(){return this.parent&&this.parent!==document.body}getWidth(){return this.isParentNotBody()?this.parent.clientWidth:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parent.clientHeight:document.compatMode===t.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}async renderEngagement(e){this.triggerContext=new Cr(new Date,e),this.triggerContext.onClose(r=>{this.closeInApp(r)}),this.ian=e.ian,(jr()||e.previewType==="mobile")&&this.ian.overrideForMobileView(),await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed()},e.getDelaySeconds()):this.withCartDrawerClosed()}withCartDrawerClosed(){if(!rt.get().isOpen()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=window.CooeeSDK.cartDrawerToggle$.subscribe(({open:r})=>{!r&&this.startRenderingOnce()})}startRenderingOnce(){if(!this.shouldSkipCampaign()){t.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData,t._instance=this;try{this.startRendering()}catch(e){ae(e,"render-popup",{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),jr()||window.addEventListener("resize",this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe()}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&t.ACTIVE_TRIGGER_DATA){let n={triggerShown:new Dn(t.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,n),!0}if(ye.get().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:"GoKwik popup is open"}),!0;let r=xm.find(n=>!!document.querySelector(n.identifier));return r?(this.skipTrigger(e,{reason:`${r.gateway} modal is open`}),!0):!1}startRendering(){this.calculateScalingFactor(this.ian),this.rootContainer=new Ms(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext)}catch(e){throw b.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(i=>i.mID));let r=new Ie("CE Trigger Displayed",e,this.triggerContext.triggerData);this.eventAPIService.sendSilently(r);let n={action:"DISPLAYED"};document.dispatchEvent(new CustomEvent("letscooee:outbound:popup-activities",{detail:n}))}sendTriggerClosed(e){let r=e.eventName;delete e.eventName;let n=new Ie(r,e,this.triggerContext.triggerData);n.name==="CE Trigger Clicked"&&(n.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(i=>i.toEmbed())),this.eventAPIService.sendSilently(n)}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500})}renderElement(e,r,n){r instanceof Xi?new Tl(e,r,n).render():r instanceof Ji?new xl(e,r,n).render():r instanceof Tn?new Ps(e,r,n).render():r instanceof Qi?new Cl(e,r,n).render():r instanceof cn?new yi(e,r,n).render():r instanceof ei?new Ls(e,r,n).render():r instanceof Yi?new Sl(e,r,n).render():r instanceof Ki?new Il(e,r,n).render():b.error("Unsupported element type- "+r.type)}renderContainer(e){let r=this.ian?.cont;r&&(this.containerHTMLElement=new wl(this.rootContainer,r,e).render().getHTMLElement(),new El().loadAllFonts(this.ian),this.ian.elems?.forEach(async n=>{await this.renderElement(this.containerHTMLElement,n,e)}),this.addEnterAnimation(this.ian.anim))}closeInApp(e){let r=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),t.ACTIVE_TRIGGER_DATA=void 0;let n=this.containerHTMLElement.animate(r,{duration:500,easing:"ease-in-out"});n.onfinish=()=>{this.removeInApp(),window.removeEventListener("resize",this.resizeListener)}}screenResized(){this.removeInApp(),this.startRendering()}removeInApp(){let e=document.querySelector(`.${this.triggerContext.rootClassName}`);e&&e.parentElement.removeChild(e)}skipTrigger(e,r){let n=new Ie("CE Campaign Rejected",r,e);this.eventAPIService.sendSilently(n)}async preloadImages(e){let r=e.ian;if(!r)return;let n=[];r.elems.forEach(i=>{let o=i.bg?.img?.src;if(o&&n.push(this.getPromise(o)),i.t===1){let s=i.src;if(!s)return;n.push(this.getPromise(s))}}),r.bg?.img?.src&&n.push(this.getPromise(r.bg.img.src)),r.cont.bg?.img?.src&&n.push(this.getPromise(r.cont.bg.img.src)),await Promise.all(n)}getPromise(e){return new Promise(r=>{let n=new Image;n.onload=r,n.src=e,n.style.display="none"})}};var Io=class{static trackDeviceID(e){this.isInstalled()}static trackIntent(e){if(!this.isInstalled())return;let r=gi[e]?.toLowerCase();r&&(b.verbose(`Sending ${r} intent to MS Clarity`),window.clarity("set","Cooee Intent",r))}static isInstalled(){return window.clarity&&typeof window.clarity=="function"}};var Rl=class{triggerData;eventAPIService=Re.getInstance();backendAPIService=Pt.getInstance();render(e){e.contentSource===Mo.KLAVIYO&&(this.triggerData=e,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",e.klaviyoFormID]))}handleKlaviyoEvents(e){if(e.type!=="klaviyoForms")return;let r=e.detail;if(r.formId!==this.triggerData.klaviyoFormID){b.warn("Received invalid trigger callback");return}switch(r.type){case"open":this.eventAPIService.sendSilently(new Ie("CE Trigger Displayed",{form:{id:r.formId}},this.triggerData));break;case"stepSubmit":{let n=this.getFormDetails(r);this.eventAPIService.sendSilently(new Ie("CE Form Submitted",{form:n},this.triggerData)),this.backendAPIService.updateProfileSafe(n);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),this.eventAPIService.sendSilently(new Ie("CE Trigger Closed",{form:{id:r.formId}},this.triggerData));break}}getFormDetails(e){let r={id:e.formId},n=e.metaData;if(rr.hasKeys(n)){let i=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach(a=>{i.includes(a)||(r[a]=n[a])}),r.email=n.$email??n.email,r.mobile=n.$phone_number??n.phone_number;let o=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(o?.length||s?.length)&&(r.name=o+" "+s)}return r}};var Al=class{static trackIntent(e){if(!this.isInstalled()){b.verbose("Facebook pixel not installed");return}if(!Xe.get().pixelPush){b.verbose("Facebook pixel push not enabled");return}let n=gi[e.intent]?.toLowerCase(),i=e.segmentName;!n&&!i||(b.verbose(`Sending ${n} intent and ${i} segment to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:n,segment_value:e.segmentName}))}static isInstalled(){return window.fbq&&typeof window.fbq=="function"}};var cm=new Map,Dl=async t=>{for(let o of t.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(o,t)}catch(s){b.error(s)}if(t.isCartEmbed()&&!t.isSubscriptionUpsell()){let s=(await ve.getCurrent().getNormalisedCart()).items.map(a=>a.mID);t.items=t.items.filter(a=>!s.includes(a.mID))}if(Xe.get().currencyCount<=1)return t.items;if(t.isShoppableVideo())return await E0(t.content.videoConfig,t),t.items;let e=t.items.length,r=t.items.map(o=>Jy(o,t)),i=(await Promise.all(r)).filter(o=>o!=null);if(e&&!i.length){let o="Failed to fetch any product from Ajax API",s=new Ie("CE Campaign Failed",{reason:o,currency:t.currency},t);throw me.get(Re).sendSilently(s),new Error(o)}if(t.isCartRecovery()){let o=ve.getCurrent().items,s=[];for(let a of i)for(let c of a.vars){if(!c.isAvailable)continue;let p=o.find(E=>E.variant_id.toString()===c.mID);if(!p)continue;let d=new Dt(a);d.name=p.title;let f=new Br(c);f.name=p.variant_title,f.price.d=p.discounted_price/100,d.variants=[f],s.push(d)}return s}return i},E0=async(t,e)=>{await Promise.all(t.videos.map(async r=>{r.items=await Promise.all(r.items.map(async n=>{let i=await Jy(n,e);return i||n}))}))},Jy=async(t,e)=>{if(cm.has(t.mID))return cm.get(t.mID);let r,n=`/products/${t.slug}.js`;try{r=(await Zr(n)).data}catch(i){return ae(i,"fetch-shopify-product",{extra:{item:t,path:n},engagementTrigger:e}),null}return r?_0(t,r):(b.error("Item not found after AJAX call for:",t),null)},_0=(t,e)=>{if(!t||!e)return t;t.name=e.title,t.tags=e.tags,t.slug=e.handle;let r=t.selectedOrFirstVariant.value;return t.vars.map(n=>{let i=e.variants.find(o=>o.id===+n.mID);i!=null&&(n.name=i.title,n.isAvailable=i.available,n.price.d=i.price?i.price/100:i.price,n.price.effective=n.price.d,n.price.cmp=i.compare_at_price?i.compare_at_price/100:i.compare_at_price,+r.mID===i.id&&(r.effectivePrice.value=n.price.d))}),cm.set(t.mID,t),t};var Un=class{runtimeData=ye.get();backendAPIService=me.get(Pt);sessionManager=me.get(_t);constructor(){}async getAllContext(){let[e,r]=await Promise.all([vl(),this.sessionManager.checkSessionAndGetContext()]);return _(_({},e),r)}};var Re=class t extends Un{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}sendSafe(e){b.verbose(`Waiting for auth to send event ${e.name}`),Wr(_t.replaySubject).then(()=>this.sendSilently(e))}sendSilently(e){this.send(e).catch(r=>ae(r,"track-event",{extra:{event:e}}))}async send(e){if(b.verbose(`Sending event: ${e.name}`,e),this.shouldReject(e)){b.warn(`Rejecting event ${e.name}`);return}this.addShopifyAttributes();let r=await this.getAllContext();Object.assign(e,r),e.name!=="CE App Background"&&this.runtimeData.setActive(),this.backendAPIService.post("/v1/event/track",e).then(async n=>{b.info("\u2705 Event tracked:",this.userFriendlyName(e.name)),this.processEventResponse(e,n.data)}).catch(n=>{b.error(`Error sending event ${e.name} to server`,n)})}userFriendlyName(e){return e.replace("CE ","").replace("Trigger","Engagement").replace("Screen","Page").replace("App ","")}shouldReject(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(b.warn("Not sending event as this is a test trigger"),!0):!1}processEventResponse(e,r){this.renderWidgetIfAny(e,r).catch(n=>{ae(n,"process-popup-response",{extra:{event:e,response:r}})}),this.utiliseIntentIfCalculated(r)}async renderWidgetIfAny(e,r){if(!r.triggerData)return;let n=new xt(r.triggerData);n.occurred=e.occurred,b.log(`${n} will be shown`);let i;try{i=await Dl(n)}catch(o){b.error("Failed to refresh the products",o);return}if(n.items=i,n.contentSource===Mo.KLAVIYO){new Rl().render(n);return}new kn().renderEngagement(n).catch(o=>{ae(o,"render-popup",{extra:{event:e},engagementTrigger:n})})}utiliseIntentIfCalculated(e){e.intent&&(Io.trackIntent(e.intent),Al.trackIntent(e),b.info(`Intent is ${gi[e.intent]}`))}addShopifyAttributes(){ve.getCurrent().addCooeeAttributes().catch(e=>{b.error("Fail to add attributes in cart",e)})}};var Qy=new Jt,Zy=new Jt;function ev(){return Zy.asObservable()}function Nl(){Qy.next()}var Ol=class{constructor(){Qy.pipe(Tr(100)).subscribe(this.compareCartItems.bind(this))}listen(){Nl(),this.overwriteXMLHttpRequest(),this.overwriteFetchMethod()}overwriteXMLHttpRequest(){let e=this,r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){e.performEvent(this._url).catch(n=>b.error("Unable to process cart change in XMLHttpRequest",n))}),r.apply(this,arguments)},b.verbose("Securely overwritten window.XMLHttpRequest.send method")}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=function(n){return r.apply(window,arguments).then(i=>(e.performEvent(n.toString()).catch(o=>b.error("Unable to process cart change in fetch",o)),i))},b.verbose("Securely overwritten window.fetch method")}async performEvent(e){this.isCartManipulationURL(e)&&Nl()}isCartManipulationURL(e){return/\/cart\/(add|change|update|clear)/.test(e)}sendChangesAsEvents(e,r){let n=e?.items,i=r.items,o=[],s=[];if(b.verbose(`Comparing cart change with old count ${n?.length} to new count ${i.length}`),i?.forEach(a=>{let c=n?.find(p=>p.vID===a.vID);if(c){if(c.quantity!==a.quantity){let p=c.quantity<a.quantity,d=Math.abs(c.quantity-a.quantity),f=Z(_({},a),{quantity:d});p?o.push(f):s.push(f)}n&&Lh(n,c)}else o.push(a)}),n)for(let a of n)s.push(a);b.verbose(`Cart delta: added: ${o.length}, removed: ${s.length}`),o.length&&this.sendEvent("Add To Cart",{items:o}),s.length&&e.token===r.token&&this.sendEvent("Remove From Cart",{items:s}),(s.length||o.length)&&Zy.next({itemsAdded:o,itemsRemoved:s})}sendEvent(e,r){let n=new Ie(e,r);me.get(Re).sendSafe(n)}async compareCartItems(){let e=await Ye.get("cart",{}),r=await ve.getCurrent().getNormalisedCart(!0);this.sendChangesAsEvents(e,r)}};var rt=class t{static cartDrawerToggle$=new Ss({open:!1,firstOpen:!1});static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=Xe.get().website??{};currentState=!1;mutationSubscription;mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;clickEventListener;refreshUIEventListener;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[t.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize(),this.refreshUIEventListener=this.updateBubble.bind(this),this.clickEventListener=this.manualCartIconClicked.bind(this),document.addEventListener("letscooee:outbound:refresh-ui",this.refreshUIEventListener),document.addEventListener("click",this.clickEventListener,{capture:!0,passive:!0})}get element(){return this.cartDrawerElement}static get(){return t._instance||(t._instance=new t),t._instance}static forceUpdate(){t._instance?.destroy(),t._instance=new t}isOpen(){let e=this.inShadow?this.isPresent():am(this.cartDrawerElement);return b.info(`Cart drawer is currently ${e?"open":"close"}`),e}open(){if(this.isOpen()){b.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent("letscooee:outbound:open-cart"));let e=document.querySelector(this.iconSelector);if(!e){b.verbose("No clickable cart icon found with selector",this.iconSelector);return}e.click()}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===t.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(e,r=!0){if(window.cooeeUpdateCartDrawer)try{window.cooeeUpdateCartDrawer(e)}catch(n){ae(n,"execute-cooeeUpdateCartDrawer")}else if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove("is-empty"),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let n=e.items[0].id,i=e.items[0].quantity,o=e.items[0].price;window.cartGiftUpdate(n,o,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer&&typeof window.theme?.CartDrawer=="function")window.theme?.CartDrawer.init?new window.theme.CartDrawer().init():new window.theme.CartDrawer;else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(window.cart?.getCart)window.cart.getCart();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else window.Shopify?.KT_onItemAdded?window.Shopify.KT_onItemAdded():window.sideCart?.updateCart?window.sideCart.updateCart():window.SLIDECART_UPDATE?(window.SLIDECART_UPDATE(),window.SLIDECART_OPEN?.()):window.refreshCart?ve.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(ve.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():window.CartJS?.getCart?window.CartJS?.getCart():window.updateCartItemJS?window.updateCartItemJS(1,e?.items?.[0]?.id+""):(b.info("No method found to update the cart drawer. Blindly firing some events to try"),document.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})));document.dispatchEvent(new CustomEvent("letscooee:outbound:refresh-ui",{detail:{responseJSON:e,currentCart:ve.getCurrent()}})),r&&Nl()}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let r=e.split(":shadow");r.length===1?(this.selector=r[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=r[0]?.trim(),this.selector=r[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!ss())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await Fi(e),!this.cartDrawerElement){tv.default.warn("Max attempts exhausted to find cart drawer");return}b.verbose("Found",this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let r=(await Fi(this.shadowParentElementSelector))?.shadowRoot;r?.mode==="open"&&(this.cartDrawerShadowElement=r,this.createMutationObservers())}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||this.watchForCartToggle()}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,r=new Jt;this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(e,{attributes:!0,subtree:!0,childList:this.inShadow}),this.mutationSubscription=r.pipe(nm(800,void 0,{leading:!1,trailing:!0})).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,t.cartDrawerToggle$.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){if(!this.selector||!this.cartDrawerShadowElement)return!1;let e=this.cartDrawerShadowElement.querySelector(this.selector);return e?am(e):!1}async updateBubble(){let e=(await ve.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=e+"")}manualCartIconClicked(e){!e.target.closest(this.iconSelector)||!e.isTrusted||window.CooeeSDK.events.push(["Open Cart"])}destroy(){document.removeEventListener("letscooee:outbound:refresh-ui",this.refreshUIEventListener),document.removeEventListener("click",this.clickEventListener,{capture:!0}),this.mutationSubscription?.unsubscribe(),this.mutationObserver?.disconnect()}};var Pl=class{static processConfiguration(){let e=Xe.get();!e.gaMeasurementID||!e.gaEnabled||this.sendClientID()}static async sendClientID(){let e=await this.getClientID();e&&Pt.getInstance().updateDevicePropsSafe({gaClientID:e})}static async getClientID(){let e=await Ye.get("gacid"),r=await this.getClientIDViaGTag();if(e!==r)return await Ye.set("gacid",r),r}static async getClientIDViaGTag(){let r=Xe.get().gaMeasurementID;if(!(!r||!window.gtag))return new Promise(n=>{window.gtag("get",r,"client_id",i=>{n(i)})})}};var Fe=class extends Lr{stylesConverter=new wo(1);mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=jr()?"sm":"lg",this.clickExecutor=new mn(this.props.triggerContext)}getCompiledStyles(){return this.putStyleAccordingToDevice(),_(_(Z(_(_(_(_(_(_({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:"border-box",outline:"none"}),this.getComponentStyles()),this.props.style)}matchWhenCondition(e){if(!e?.op)return!0;let{lhs:r,rhs:n}=e;switch(e.op){case"eq":return r===n;case"gt":return+r>+n;case"gte":return+r>=+n;case"lt":return+r<+n;case"lte":return+r<=+n;case"ne":return r!==n;case"null":return r==null;case"empty":return r.trim()==="";case"in":return new RegExp(`\\b${n}\\b`).test(r);case"nin":return!new RegExp(`\\b${n}\\b`).test(r);default:return b.error(`Invalid operator found for when condition - ${e.op}`),!1}}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,jr()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=_(_({},this.mediaStyle),e.style.sm))}sendTriggerClicked(e,r){this.clickExecutor.sendTriggerClicked(e,r)}async onClick(e,r){e.stopPropagation(),r.clickAction||(r.clickAction=this.props.element.clc),r.clickAction?.at&&await this.clickExecutor.execute(r)}};var b0=0,CW=Array.isArray;function K(t,e,r,n,i,o){e||(e={});var s,a,c=e;if("ref"in c)for(a in c={},e)a=="ref"?s=e[a]:c[a]=e[a];var p={type:t,props:c,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--b0,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(s=t.defaultProps))for(a in s)c[a]===void 0&&(c[a]=s[a]);return xe.vnode&&xe.vnode(p),p}var Qt=class extends Fe{componentDidMount(){this.setState(()=>({text:this.props.element.text})),Tt(this.onChange.bind(this))}componentWillReceiveProps(e){this.props.element=e.element,this.onChange()}render(){let e=this.getCompiledStyles(),r=this.state.text;return r||(e.display="none",r=""),K("div",{style:e,onClick:this.customOnClick.bind(this),className:"lc-text",children:K("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:r}})})}customOnClick(){this.props.onClick&&this.props.onClick("title")}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,r={bundle:e.discountData.value,customer:e.customerData,cart:e.getCartMagicVariables()},n=Zn(this.props.element,r,this.props.triggerContext),i=new vt(n);if(!this.matchWhenCondition(i.when)){this.setState(()=>({text:""}));return}this.setState(()=>({text:i.text}))}getTypoStyles(){let e={},r=this.mediaStyle.typo??new lt;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily=r.fam.name||"inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,e.textDecoration=r.td??"none",this.stylesConverter.getColourStyles(r.tc,"color",e),e}getComponentStyles(){return _({},this.getTypoStyles())}getSpanStyle(){return{overflow:"hidden",display:"-webkit-box",webkitBoxOrient:"vertical",webkitLineClamp:2,color:"inherit",fontSize:"inherit",fontWeight:"inherit",fontFamily:"inherit"}}};var vi=class extends Qt{render(){return K("div",{style:this.getCompiledStyles(),className:"lc-button",onClick:e=>this.onClick(e,{item:this.props.item}),children:K("span",{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return Z(_({},super.getComponentStyles()),{cursor:"pointer"})}};var lm=class extends Lr{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos==="end"?K("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[K("span",{children:this.props.time}),K("span",{style:this.getTimeLabelStyle(),children:this.props.label})]}):K("div",{style:_(_({},this.getElementStyle()),this.props.styles),children:[K("span",{style:this.getTimeLabelStyle(),children:this.props.label}),K("span",{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return{fontSize:"0.5em",alignContent:"center"}}getElementStyle(){let e={display:"flex",flexDirection:"column",placeContent:"center center",textAlign:"center"};return this.props.element.horizontal&&(e.gridTemplateColumns="repeat(2, minmax(0, 1fr))"),e}},Bs=class extends Qt{labels={Days:"00",Hours:"00",Minutes:"00",Seconds:"00"};componentWillMount(){super.componentWillMount(),this.setState(()=>_({},this.labels)),this.processAndStartTimer()}render(){return K("div",{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>K(lm,{styles:this.getCompiledStyles(),label:e,time:this.state[e],element:this.props.element}))})}getLabelsParentStyle(){return{display:"grid",justifyContent:"center",gridTemplateColumns:"repeat(4, auto)",gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return{display:"grid",placeContent:"center center"}}getComponentStyles(){return _(_({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,e=>{this.labels.Days=String(e.days).padStart(2,"0"),this.labels.Hours=String(e.hours).padStart(2,"0"),this.labels.Minutes=String(e.minutes).padStart(2,"0"),this.labels.Seconds=String(e.seconds).padStart(2,"0"),this.setState(()=>_({},this.labels))})}};function Ll(t,e){if(!t)return;let r={loop:!0,slidesPerView:e.maxInRow,spaceBetween:e.gap+"px",pagination:{type:e.pagination.type,el:t.querySelector(".swiper-pagination"),clickable:!0,renderBullet:(i,o)=>`
|
|
68
68
|
<span class="${o}"
|
|
69
69
|
style="background-color: ${e.pagination.color?.rgba};"></span>
|
|
70
70
|
`,renderProgressbar:i=>`
|
|
71
71
|
<span class="${i}"
|
|
72
72
|
style="background-color: ${e.pagination.color?.rgba};">
|
|
73
73
|
</span>
|
|
74
|
-
`},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1,pauseOnMouseEnter:!1}:!1,autoHeight:!0,speed:e.speed};e.marquee&&r.autoplay&&typeof r.autoplay=="object"&&(r.autoplay.pauseOnMouseEnter=!0,t.style.setProperty("--swiper-wrapper-transition-timing-function","linear"));let n=new window.CooeeSDK.Swiper(t,r);return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),n}function Fl(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),K("div",{class:"swiper-container",ref:e,style:"max-width: 100%",children:[K("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&K("div",{class:"swiper-button-next",style:n,children:K("span",{})}),t.navigation.enabled&&K("div",{class:"swiper-button-prev",style:n,children:K("span",{})}),t.pagination.enabled&&K("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var $s=class extends Fe{componentDidMount(){It(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return K("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:K("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(e){let{checked:r}=e.target;this.props.item.selected.value=r}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ut;return e.textAlign=r.alignment,e.justifyContent=r.alignment,e}getComponentStyles(){return Z(_({},this.getTypoStyles()),{display:"flex"})}};var dn=class extends Fe{constructor(e,r){super(e,r)}render(){let e=this.props.element[this.deviceTypeKey],r=e?.src||this.props.element.src||this.props.element.lg?.src;return K("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:e?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:r,style:this.getCompiledStyles()})}customOnClick(e){this.props.element.clc?.at===we.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let r={zIndex:e.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(r.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(r.height=this.mediaStyle.size.h),r}handleMouseEnter(e){let r=this.props.element[this.deviceTypeKey]?.secondarySrc;r&&(e.currentTarget.src=r)}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}};var hn=class extends Fe{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return K("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:K(Fn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new eo,r={display:"flex",gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai};return e.wrap==="nowrap"&&e.scroll&&(e.dir==="column"?r["overflow-y"]="auto":r["overflow-x"]="auto"),r}};var Vs=class extends hn{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return K("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:K(Co,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var Ws=class extends Fe{render(){return K("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){It(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ut;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility="hidden"),_(_({},e),this.getTypoStyles())}createSelectItems(){let e=[],r=this.props.selectedVariant;if(!r.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?r.selectedSellingPlan.value||(r.sellingPlans[0].isSelected=!0,r.changeSellingPlan(r.sellingPlans[0])):e.push(K("option",{value:"",selected:!r.selectedSellingPlan,children:"One time purchase"}));for(let n of r.sellingPlans??[])e.push(K("option",{value:n.mID,selected:n.isSelected,children:n.name}));return e}onChange(e){let r=e.target.value;r?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(n=>n.mID===r):this.props.selectedVariant.selectedSellingPlan.value=void 0}};var g0=new RegExp('fill="#[a-zA-Z0-9]+"'),js=class extends Fe{constructor(){super()}render(){let e=this.getCompiledStyles(),r=this.getRating();return r||(e.display="none",r=""),K("div",{style:e,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:r}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},r=Gi(this.props.element.fullStar,{svg:e},this.props.triggerContext),n=Gi(this.props.element.halfStart,{svg:e},this.props.triggerContext),i=this.props.review;if(!i?.rating)return"";let o="";if(this.props.element.showSingleStar)o=r;else{let s=5,a=`${i.rating}`.split(".");for(let c=0;c<+a[0];c++)o+=r,s--;a[1]&&(o+=n,s--);for(let c=0;c<s;c++)o+=r.replace(g0,'fill="#f1f1f1"')}return o}getComponentStyles(){return{display:"flex",alignItems:"center"}}};var Gs=class extends Fe{render(){return K("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){It(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new ut;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(e.visibility="hidden"),_(_({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let r of this.props.item.vars)e.push(K("option",{value:r.mID,disabled:!r.isAvailable,children:r.name}));return e}onChange(e){let r=e.target.value,n=this.props.item.vars.find(i=>i.mID===r);this.props.item.setSelectedVariant(n)}};var Co=class extends Fe{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let r=e;return r.l==="Star Rating"&&!this.props.item.reviews?.rating?void 0:K(Vs,{element:r,triggerContext:this.props.triggerContext,elements:r.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?K($s,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let r=e,n=this.props.item,i=n.variantImage??n.firstImageURL,o=n.variantSecondaryImage??n.secondaryImageURL;r.lg=r.sm={src:i,name:n.name,secondarySrc:o};let s=K(dn,{element:r,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:K("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let r=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:r.showChips?K("cooee-product-options-picker",{item:this.props.item}):K(Gs,{element:r,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?K(Ws,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?K(js,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?K(Ei,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):K(Fn,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}renderProductTitle(e){let r=K(Qt,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?r:K("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:r})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}};var _i=class extends Fe{productElement;constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}render(){let e=Zn(this.props.element,this.getProductData(),this.props.triggerContext);if(this.productElement=new Rn(e),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return K("div",{style:_({},this.getCompiledStyles()),class:"lc-single-product",children:K(Co,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let e=this.props.item,r=e.selectedOrFirstVariant.value,n=e.getTemplateVariables();n.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let i=this.props.triggerContext.triggerData.discount?.type===er.BXGY;return!r.hasEffectivePrice()&&i&&(n.product=Z(_(_({},n.product),Mt("effective_price",r.effectivePrice.value)),{price:""})),n.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(r.quantity):r.quantity,{product:n.product,variant:n.variant,svg:{color:"{{ svg.color }}",size:"{{ svg.size }}"}}}};var zs=class extends Fe{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,r){super(e,r),this.configuration=Gr()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&Vc().then(()=>{this.swiperInstance=Ul(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let r;if(this.configuration.disp===2){let n=o=>{this.swiperRef=o},i=()=>e?.map(o=>K("div",{class:"swiper-slide",children:this.getProductFragment(o)}));r=K("div",{style:Z(_({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:Fl(this.configuration,n,i)})}else r=K("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((n,i)=>this.getProductFragment(n,i!==e.length-1))});return r}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),r={display:e?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(r.flexDirection==="row"){if(e)r.maxWidth="100%",r.overflowY="auto";else if(this.configuration.disp===1){let n=this.props.triggerContext.triggerData,i=n.items.length,o;n.isBundle()?o=this.props.element.prod.symbol?.hide!==!0?i*2-1:i:o=this.props.element.conf[this.deviceTypeKey].maxInRow,r.gridTemplateColumns=`repeat(${o}, auto)`}}return r}getProductFragment(e,r=!1){return K(kr,{children:[K(_i,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&r&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&K("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:K(Qt,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var Ys=class extends Fe{swiperRef=null;swiperInstance=null;constructor(e,r){super(e,r)}componentDidMount(){Vc().then(()=>{this.swiperInstance=Ul(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,r=i=>{this.swiperRef=i},n=()=>{let i=e.values?.map(a=>K("div",{class:"swiper-slide",onClick:c=>this.onClick(c,{clickAction:this.getClickAction(a)}),children:this.renderElement(a)}));if(!i?.length)return[];let o=e.conf,s=i.length;if(o.marquee&&s<=Number(o.maxInRow)){let a=Number(o.maxInRow)-s+1;for(let c=0;c<a;c++)i.push(i[c%s])}return i};return Fl(e.conf,r,n)}getComponentStyles(){return{}}renderElement(e){let r=this.valueAddedSlide(this.props.element.slide,e);switch(r?.t){case 1:return K(dn,{element:r,triggerContext:this.props.triggerContext});case 4:return K(hn,{elements:r.elems,element:r,triggerContext:this.props.triggerContext});default:w.warn("Unknown slide type for carousal")}}valueAddedSlide(e,r){let n=Zn(e,{form:r},this.props.triggerContext);return Jt.getParsedElement(n)}getClickAction(e){return Zn(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var Fn=class extends Fe{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"})),It(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(e){if(!e.hide){if(e.t===4){let r=e;return K(hn,{element:r,triggerContext:this.props.triggerContext,elements:r.elems})}if(e.t===61)return K(Hs,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?K(Ei,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return K(Qt,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return K(dn,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return K(zs,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return K(_i,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return K(Ys,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var qs=class extends Fe{clickAction;isClickable;constructor(e,r){super(e,r),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===we.GO_TO_URL&&!!Ui(this.clickAction.gu?.u)||this.clickAction?.at===we.OPEN_CART||this.clickAction?.at===we.INITIATE_CHECKOUT}componentDidMount(){It(()=>{let e=this.props.triggerContext.triggerData,r=this.props.triggerContext.selectedItems;e.calculateDiscountData(r,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return K(kr,{children:[K("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:e=>{this.onClick(e,{clickAction:this.clickAction})},children:K(Fn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&K("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let e={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(e.cursor="pointer"),e}};var xt=class t{constructor(e){this.engagementTrigger=e;this.triggerContext=new Ar(new Date,this.engagementTrigger)}static renderedEngagements=new Set;static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=fe.get();widgetAPIService=ue.get(Cr);eventAPIService=ue.get(Re);renderedCount=0;scrollSubscription;variation;isExclusionWithBVariation;renderSilently(){this.render().catch(e=>{ae(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){w.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),t.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),Rf(this.engagementTrigger.content?.afterDeleteJS)}async render(){if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){w.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),await this.runChoresBeforeRender(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this,Rf(this.engagementTrigger.content?.afterRenderJS)}isSameTrigger(e){return this.engagementTrigger.shortID===e.shortID}async updateAndReRender(e){w.info(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render()}async update(e){}rerender(){this.rootContainer?.isConnected||(w.info(`${this.engagementTrigger} deleted. Will be re-rendered`),this.preDestroy(),this.renderSilently())}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()})}afterRootContainerCreated(){}isAllOkToRender(){return!!this.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){w.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(w.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new At(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new At(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new At(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&rr.hasKeys(e.props)&&(this.engagementTrigger.props=_(_({},this.engagementTrigger.props),e.props)),e.content&&(this.triggerContext.triggerData.content=new ps(e.content)),this.triggerContext.triggerData.widget=this.widget=new io(e.widget),this.triggerContext.triggerData.contentID=e.contentID,this.triggerContext.triggerData.variation=this.variation=e.variation,this.triggerContext.triggerData.placement=e.placement,this.triggerContext.triggerData.manipulation=e.manipulation,this.triggerContext.triggerData.entryAnimation=e.entryAnimation??"NONE",this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){this instanceof _t?_t.renderedEngagements.add(this):t.renderedEngagements.add(this),this.renderedCount++,w.info(`${this.engagementTrigger} rendered \u2705 ${Oh(this.renderedCount)} time`)}removeFromRendered(){this instanceof _t?_t.renderedEngagements.delete(this):t.renderedEngagements.delete(this)}async getVariation(){w.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return(await this.widgetAPIService.getVariation(e)).data}catch(r){ae(r,"get-variation",{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){w.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((o,s)=>{o.forEach(async a=>{if(a.isIntersecting){w.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let c=await this.getVariation();n(c),s.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=mi(window,"scroll").pipe(mr(t.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(t.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let i=this.isExclusionWithBVariation?"CE Campaign Holdout":"CE Trigger Displayed",o=new Ie(i,n,this.engagementTrigger);o.name==="CE Campaign Holdout"&&(o.trigger.holdout=!0),this.eventAPIService.sendSilently(o),t.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=ve.getCurrent(),r.triggerContext=this.triggerContext,r.engagementTrigger=this.engagementTrigger,r.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(r),this.addToRendered(),r}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),o=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${o} lc-${i}`,n.dataset.engagementId=o,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}startRendering(){let e=this.rootContainer;this.triggerContext.triggerData.hasSwiperElement()&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),Af(e)),qh(Gp(qs,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,i=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,o=e.width*e.height,s=i/o*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return w.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(":shadow")){let c=n.split(":shadow");i=(await Hi(c[0].trim()))?.shadowRoot,n=c[1].trim(),i&&Af(i,!1)}w.verbose(`${this.engagementTrigger} attempt to render ${r.position} "${n}"`);let o=await Hi(n,10,i??document);if(!o)return w.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),a=this.getParentElement(s);if(!e)return a;switch(r.position){case Ti.BEFORE:{o.parentElement?.insertBefore(a,o);break}case Ti.INSIDE_FIRST:{o.insertBefore(a,o.firstChild);break}case Ti.INSIDE_LAST:{o.appendChild(a);break}case Ti.AFTER:default:o.parentElement?.insertBefore(a,o.nextSibling)}return a}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){w.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}w.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await Bl(this.engagementTrigger)}catch(r){w.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){w.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,this.startRendering()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let o of i)Xr.remove(r,o)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var _t=class extends xt{static renderedEngagements=new Set;constructor(e){super(e)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!rt.get().isOpen()&&this.runtimeData.pageName!=="cart"){w.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var Hl=class t{constructor(e,r){this.engagementTrigger=e;this.element=r;this.cartItems=ve.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){w.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){w.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new t(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(d=>d.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(d=>d.mID===e.id.toString());if(!n)return;let i=new Ur(n),o=e.selling_plan_allocation?.selling_plan;if(o)for(let d of i.sellingPlans??[])d.mID===o.id.toString()&&(d.isSelected=!0,i.changeSellingPlan(d));let s=new At(r);s.vars=[i],s.selectedOrFirstVariant.value=i;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let c=new Tt(this.engagementTrigger);c.placement.selector=`.${a}`,c.items=[s];let p=new _t(c);p.renderSilently(),this.watchForCartItemDeletion(p,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(o=>{o.removedNodes.forEach(s=>{s===this.element&&(w.verbose(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}};var $l=class extends _t{ctaExecutor=new Bn;constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),await this.checkMilestoneTryCatch(),this.widgetElement.update()}isAllOkToRender(){return!!this.engagementTrigger.progressBarConfig}startRendering(){if(this.widgetElement?.isConnected){this.widgetElement.update(),this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),this.checkMilestoneTryCatch()}async checkMilestoneTryCatch(){try{await this.checkMilestone()}catch(e){ae(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})}}async checkMilestone(){let e=await ve.getCurrent().getNormalisedCart(),r=this.engagementTrigger.progressBarConfig,n,i=[],o=[],s=[],a,c,p=[...r.milestones];for(let f of p){if(f.rewardType!==fu.FREE_AUTO_GIFT)continue;if(f.isUIOnly&&!f.allowATC){w.verbose(`Skipping milestone ${f.label} as it is UI only and does not allow ATC`);continue}let E=f.items[0],y=f.reached,T=e.items.find(D=>(D.vID===E.vID||D.mID===E.mID)&&D.properties._letscooee_campaign===this.engagementTrigger.shortID);y&&(a=f,c=T),T&&i.push(T),!y&&T&&r.removeIneligibleItem?(w.verbose(`Removing free gift ${T.vID} from cart`),s.push(T)):y&&!T&&(w.verbose(`Adding free gift ${E.vID} to cart`),o.push(E))}r.restrictToLatestFreebie&&a&&(c?(i=i.filter(f=>f.vID!==c.vID),o=[]):o=[a.items[0]],s.push(...i)),s.length&&await this.removeFreeGifts(s),o.length&&(n=await this.ctaExecutor.addToCart(o,this.engagementTrigger));let d=r.coupons;if(d?.length)try{await zr.applyWithStorefront(d.map(f=>f.couponCode)),rt.get().refreshUI(n,!1)}catch(f){ae(f,"cart-apply-discount",{extra:{coupons:d},engagementTrigger:this.engagementTrigger})}}async removeFreeGifts(e){await Promise.all(e.map(r=>this.ctaExecutor.updateLineItem(r,{quantity:0})))}};var Ks=class extends _t{constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.content.update(e.content),this.widgetElement.update()}isAllOkToRender(){return!!this.engagementTrigger.content}startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}};var Vl=class extends xt{constructor(e){super(e)}isAllOkToRender(){return!!this.engagementTrigger.content?.videoConfig}startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e,r=this.engagementTrigger.content.videoConfig;r.template==="FLOATING_POPUP"?e="cooee-video-popup":r.template==="STORY"?e="cooee-video-stories":e="cooee-video-playlist",this.createAngularWidget(e)}};var Wl=class extends xt{constructor(e){super(e)}isAllOkToRender(){return!0}startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var jl=class extends xt{constructor(e){super(e)}isAllOkToRender(){return!0}startRendering(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener("letscooee:inbound:cta:add-bundle",this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,i=e.detail;if(!rr.hasKeys(i)){w.error(`No detail received for ${n}`);return}w.log("Detail received for BYOB",i);let o=i.campaignID??i.campaignId??i.campaign_id;if(o!==r.shortID&&o!==r.engagementID){w.warn(`Current ${n} is not BYOB. Received: ${o}`);return}let s=i.items;if(!s?.length)return;let a=s.map(c=>new Ct({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new mn(this.triggerContext).execute({embeddedItems:a,clickAction:{at:we.ADD_BUNDLE,applyDiscount:!0}})}};var Ro=class{runtimeData=fe.get();processCartWidgetResponse(e){this.runtimeData.isCartDirty=!1,this.runtimeData.cartEngagements=e;let r=[..._t.renderedEngagements];_t.renderedEngagements.clear();for(let n of e){w.info(`${n} received as cart embed`);let i=this.isAlreadyRendered(n,r);if(i>-1){this.rerender(i,n,r);continue}w.verbose(`${n} is new`),n.isProgressBar()?new $l(n).renderSilently():n.isSubscriptionUpsell()?Hl.renderCartUpsell(n):n.isSavingsBar()?new Ks(n).renderSilently():new _t(n).renderSilently()}this.removeOldWidgets(r)}processPageWidgetResponse(e){let r=[...xt.renderedEngagements];xt.renderedEngagements.clear();for(let n of e){w.info(`${n} received as page embed`);let i=this.isAlreadyRendered(n,r);if(i>-1){this.rerender(i,n,r);continue}w.verbose(`${n} is new`),n.isShoppableVideo()?new Vl(n).renderSilently():n.isBYOB()?new jl(n).renderSilently():n.isStickyATC()?new Wl(n).renderSilently():n.isSavingsBar()?new Ks(n).renderSilently():new xt(n).renderSilently()}this.removeOldWidgets(r)}isAlreadyRendered(e,r){let n=r.findIndex(i=>i.isSameTrigger(e));return n<0||e.isSubscriptionUpsell()?-1:n}async rerender(e,r,n){let[i]=n.splice(e,1);if(i)try{await i.updateAndReRender(r)}catch(o){ae(o,"update-and-re-render",{engagementTrigger:r})}}removeOldWidgets(e){for(let r of e)r.destroy()}};Zy(document.body,{childList:!0,subtree:!0},500,Qy).subscribe(()=>{xt.renderedEngagements.forEach(e=>e.rerender()),_t.renderedEngagements.forEach(e=>e.rerender())});var Cr=class t extends Un{static INSTANCE;loadPageWidgetsSubject=new jt;loadCartWidgetsSubject=new jt;pageWidgetLoadCount=0;constructor(){super();let e=this.loadPageWidgetsSubject.pipe(So(n=>n)),r=this.loadPageWidgetsSubject.pipe(So(n=>!n),mr(500));tm(e,r).subscribe(n=>{this.loadPageWidgetsFromServer().catch(i=>ae(i,"load-page-widgets",{extra:{firstLoad:n}}))}),this.loadCartWidgetsSubject.pipe(mr(500)).subscribe(()=>{this.loadCartWidgetsFromServer().catch(n=>ae(n,"load-cart-widgets"))}),window.CooeeSDK.cartChange$.subscribe(()=>{this.loadWidgetsSilently()})}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}loadOrRenderWidgetsAfterCartChange(){this.runtimeData.isCartDirty?this.loadWidgetsSilently():this.renderCachedCartWidgets()}loadPageWidgetsSafe(e=!1){fr(ct.replaySubject).then(()=>{this.loadPageWidgetsSubject.next(e)})}loadCartWidgetsSafe(){fr(ct.replaySubject).then(()=>{this.loadCartWidgetsSubject.next()})}loadWidgetsSilently(){fr(ct.replaySubject).then(()=>{this.loadCartWidgetsSafe(),this.loadPageWidgetsSafe()})}async getVariation(e){let r=await this.getAllContext();return Object.assign(e,r),this.backendAPIService.post("/v1/engagement/get-variant",e)}async loadPageWidgetsFromServer(){this.pageWidgetLoadCount++,this.pageWidgetLoadCount===1?w.info("Fetch page widgets (after \u23F0",fe.get().getSDKLoadTimeDiff()+" of SDK load)"):w.info("Fetch page widgets");let e=await this.getAllContext(),r=_({},e);this.backendAPIService.post("/v1/engagement/page-widgets",r).then(n=>{w.info(`Page widgets loaded in \u23F0 ${vr(n.timeTakenMs)}`);let i=n.data.widgets.map(o=>new Tt(o));new Ro().processPageWidgetResponse(i)}).catch(n=>{w.error("Error sending widget getter",n)})}async loadCartWidgetsFromServer(){w.info("Fetch cart widgets");let e=await this.getAllContext(),r=_({},e);this.backendAPIService.post("/v1/engagement/cart-widgets",r).then(n=>{w.info(`Cart widgets loaded in \u23F0 ${vr(n.timeTakenMs)}`);let i=n.data.widgets.map(o=>new Tt(o));new Ro().processCartWidgetResponse(i)}).catch(n=>{w.error("Error sending widget getter",n)})}renderCachedCartWidgets(){new Ro().processCartWidgetResponse(this.runtimeData.cartEngagements)}};var Gl=class t{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(){Bs.get("conf",{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){w.verbose("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);Bs.set("conf",r).catch(n=>w.error(n)),kl.processConfiguration(),r.website&&(Yg(r.website.commonJS),Cf(r.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.subscribe(async({open:n})=>{w.info("Cart drawer is now",n?"open":"closed"),n&&(ue.get(Cr).loadOrRenderWidgetsAfterCartChange(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=Me.globalRef.config.update(e);return rt.forceUpdate(),w.verbose("App configurations",r),r}async trackViewCartEvent(){let e=await ve.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};ue.get(Re).sendSafe(new Ie("View Cart",n))}};var ev="App ID or Shopify shop is not set",ct=class t{static replaySubject=new Rs(1);static INSTANCE;backendAPIService=Nt.getInstance();coreService=Gl.getInstance();userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}async populateAuthDataFromStorage(){await this.getOrSetDeviceIDSafe(),this.userID=await Ke.get("id"),this.updateAPIClient()}isAuthenticated(){return!!this.deviceID}authenticate(e){if(w.verbose("Initialising SDK",e),zy(navigator.userAgent)){w.info("This seems to be a bot. Disabling SDK");return}this.appID=e.appID,this.shopifyShop=e.shopifyShop,this.checkForNewSessionOnPageLoad().then(async()=>{t.replaySubject.next(!0),t.replaySubject.complete()}).catch(r=>{r?.message?.includes(ev)&&ae(r,"initiate-session",{extra:e}),w.error("Unable to initiate session",r)})}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await Ke.set("id",e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Ke.set("did",e.deviceID)),this.updateAPIClient())}async checkSessionAndGetContext(){return await this.checkForNewSessionUnsafe(!1),this.getContext()}async checkForNewSessionOnPageLoad(){await this.checkForNewSessionSafe(!0)}async getOrSetDeviceIDSafe(){await gc.request("gen_did",async()=>{let e=await Ke.get("did");e||(e=new Et().toHexString(),await Ke.set("did",e)),this.deviceID=e,w.info("Device ID:",this.deviceID)})}async getContext(){Rt.set("lastUsedTime",new Date().getTime());let[e,r,n]=await Promise.all([Rt.get("id",""),Ke.get("sessionNumber",1),Rt.get("landing",{})]);return ki({"cooee_session.number":r}),Ka("Visitor Session",{id:e,number:r,landing_page:n}),{sessionID:e,sessionNumber:r,landingPage:n}}async checkForNewSessionSafe(e){await this.checkForNewSessionUnsafe(e)}async checkForNewSessionUnsafe(e){let r=!1;if(await this.isNewSessionRequired()?(w.info("New session to be started"),await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();w.info(`Session ID: ${n.sessionID} & number: ${n.sessionNumber}`),await this.validateSessionFromServer(Z(_({},n),{newSession:r})),await Rt.set("synced",!0)}}async startNewSession(){w.verbose("Starting new session"),await Rt.clear(),w.verbose("Cleared SessionStorage before starting new session");let e=new Date,r=new Et().toHexString();w.verbose("New session ID to be used",r);let n=await Ke.get("sessionNumber",0)+1;await Promise.all([Ke.set("sessionNumber",n),Rt.set("id",r),Rt.set("lastUsedTime",e.getTime()),Rt.set("landing",ra())])}async isNewSessionRequired(){if(!await Rt.get("id"))return!0;let e=await Rt.get("lastUsedTime",0);return e?(new Date().getTime()-e)/1e3>1800:!0}async notSynced(){return!await Rt.get("synced",!1)}async getSessionValidateData(e){if(!this.appID&&!this.shopifyShop)throw new Error(ev);let r=await Ky(),n=Il();return Z(_(_({deviceID:this.deviceID,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),n),{sdk:Qs,ad:Sl.getAdParams(),occurred:y0(fe.get().jsLoadTime),properties:{}})}async validateSessionFromServer(e){w.verbose("Validating session with server"),await this.populateFirstSeen();let r=await this.getSessionValidateData(e);try{let n=await this.backendAPIService.validateSession(r),i=n.data;w.info(`Auth finished in \u23F0 ${vr(n.timeTakenMs)}`),w.verbose("Validate session Response",i),await this.coreService.processAppConfigurations(i.appSettings),await this.storeAndPopulateAuthData(i)}catch(n){throw w.error(n),n}}async populateFirstSeen(){let e=await Ke.get("firstSeen"),r=e?new Date(e):new Date;e||await Ke.set("firstSeen",r.toISOString()),this.backendAPIService.setFirstSeen(r),Ka("Visitor Info",{first_seen:r.toISOString()})}updateAPIClient(){this.userID&&w.info("User ID:",this.userID),xo.trackDeviceID(this.deviceID),this.backendAPIService.setDeviceId(this.deviceID),Ka("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),xh({id:this.deviceID})}};function y0(t){return(new Date().getTime()-t.getTime())/1e3>1800?new Date:t}var Nt=class t{static INSTANCE;deviceID="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateProfileSafe(e){fr(ct.replaySubject).then(()=>this.updateProfile(e??{}))}updateProfile(e){this.put("/v1/user/update",e).then(async r=>{w.verbose("Updated user profile"),await ct.getInstance().storeAndPopulateAuthData(r.data)}).catch(r=>{w.error("Error saving user profile",r)})}generateDiscount(e){return this.post("/v1/event/generate-discount",e)}updateDevicePropsSafe(e){fr(ct.replaySubject).then(()=>this.updateDeviceProps({props:e}))}updateDeviceProps(e){this.put("/v1/device/update",e).then(()=>{w.verbose("Updated device properties")}).catch(async r=>{w.error("Error saving device property",r)})}setDeviceId(e){this.deviceID=e??""}setFirstSeen(e){this.firstSeen=e?.toUTCString()??""}get(e){return this.requestBackend("GET",e)}post(e,r){return this.requestBackend("POST",e,r)}put(e,r){return this.requestBackend("PUT",e,r)}async requestBackend(e,r,n){if(!di.isECommerceApp()&&!di.getFlags().allowEvents)return w.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=zt.apiURL+r);let i=this.getDefaultHeaders(),o="keepalive"in new Request(""),s=n?JSON.stringify(n):void 0;if(n&&!o&&s?.includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(c){throw ae(c,"http-request",{extra:{body:s}}),c}let a={method:e,headers:i,keepalive:!0};return n&&(a.body=s),Zr(r,a)}performXMLHttpRequest(e,r,n){return new Promise((i,o)=>{let s=new XMLHttpRequest;s.open("POST",e,!0),r.forEach((a,c)=>{s.setRequestHeader(c,a)}),s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(s.status>=200&&s.status<300)try{if(s.getResponseHeader("Content-Type")?.includes("application/json")){let c=JSON.parse(s.responseText);i({data:c,headers:r,request:s,status:s.status,statusText:s.statusText})}else o(new Error("Content-Type of response header is not json"))}catch(a){o(a)}else o(new Error(`Received status - ${s.status}(${s.statusText})`))},s.onerror=()=>{o(new Error("Network error occurred during the request."))},s.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",Qs),e.set("cooee-sdk-code",Em.toString()),e.set("cooee-sdk-version",Kr),e.set("cooee-first-seen",this.firstSeen),e.set("cooee-shop-name",fc()??""),this.deviceID&&e.append("cooee-device-id",this.deviceID),zt.debug&&e.set("cooee-sdk-debug",String(1)),e}};var mn=class{constructor(e){this.triggerContext=e}backendAPIService=Nt.getInstance();eventAPIService=Re.getInstance();async execute(e){let r=fe.get().getCurrentItem(),n=e.clickAction;if(!n)return;let i=e.item,o=this.triggerContext,s=new Bn,a=o.triggerData.redirectBehaviour,c=!!o.triggerData.discount?.type&&!!n?.applyDiscount,p={selectedVariants:o.triggerData.nonMutableItems.map(N=>({itemMID:N.mID,mID:N.selectedOrFirstVariant.value.mID,variantID:N.selectedOrFirstVariant.value.mID})),eID:o.triggerData.engagementID,cID:o.triggerData.contentID},d="",f=[],E=[];if(i?E=[i.toEmbed()]:e.embeddedItem&&(E=[e.embeddedItem]),n.at===we.ADD_BUNDLE){let N=o.selectedItems;if(E=e.embeddedItems??N.map(k=>k.toEmbed()),o.shouldGiveFBTDiscount||e.embeddedItems?.length){let k;e.embeddedItems?k=e.embeddedItems.map(P=>({itemMID:P.mID,mID:P.vID,variantID:P.vID,quantity:P.quantity})):k=N.map(P=>({itemMID:P.mID,mID:P.selectedOrFirstVariant.value.mID,variantID:P.selectedOrFirstVariant.value.mID}));let G=o.triggerData.bundleFrom;o.triggerData.isBundleOnCartDrawer()&&G&&(k.push({itemMID:G.mID,mID:G.selectedOrFirstVariant.value.mID,isPrimary:!0}),E.unshift(G.toEmbed())),p.selectedVariants=k,o.triggerData.isBundleOnPDP()&&p.selectedVariants.forEach(P=>{P.mID===r.vID&&(P.isPrimary=!0)})}else p=void 0;f=e.embeddedItems??N}else if(n.at===we.INITIATE_CHECKOUT){let N=await ve.getCurrent().getNormalisedCart();E=N.items,p.selectedVariants=N.items.map(k=>({itemMID:k.mID,mID:k.vID}))}else if(n.at===we.ADD_TO_CART)f=i?[i]:[e.embeddedItem];else if(n.at===we.QUICK_VIEW){window.cooeeShowQuickItem(this.triggerContext,i),this.sendTriggerClicked(E,{from:"button"},e.video);return}else if(n.at===we.GO_TO_PRODUCT)d=i?zi("/products/"+i.slug):e.embeddedItem?.link;else if(n.at===we.GO_TO_URL){let N=Ui(n.gu?.u);N&&(d=N.href)}else if(n.at===we.UPGRADE_TO_SUBSCRIPTION){let N=await s.upgradeToSubscription(i,o.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),rt.get().refreshUI(N)}else if(n.at===we.GO_TO_COLLECTION){let N=this.triggerContext.triggerData.collections?.[0];N&&(d="collections/"+N.handle)}if(this.sendTriggerClicked(E,{from:"button"},e.video),w.verbose({redirectPath:d,redirectBehaviour:a,hasDiscount:c}),!c&&d){location.href=d;return}let y,T=!1;try{y=await this.getOrGenerateDiscountCode(p),w.verbose("Discount code (if any) to apply",y)}catch(N){if(!this.triggerContext.triggerData.isBYOB()){tv.default.error("Unable to get a discount code",N);return}}if(y&&n.at===we.COPY_COUPON_CODE)await s.copyDiscountCode(y);else if(n.at===we.BUY_NOW){let N=await s.createNewCart(r,y,o.triggerData);N&&(location.href=N);return}try{y&&await zr.applyWithStorefront([y])}catch(N){w.error(N),T=!0}let D;if(f?.length&&(D=await s.addToCart(f,o.triggerData)),T&&y){zr.navigate(y,a,d);return}if(d){location.href=d;return}zr.navigateWithoutDiscount(a,D)}sendTriggerClicked(e,r,n){let i=new Ie("CE Trigger Clicked",r,this.triggerContext.triggerData);i.items=e,i.setVideos(n),this.eventAPIService.sendSilently(i)}async getOrGenerateDiscountCode(e){let r=this.triggerContext.triggerData.discount;if(!r?.type)return;let n="";if(r.type===er.STATIC){if(!r.code)throw Th("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return r.code}if(e){if(n=await this.generateDiscount(e),!n)throw w.error("No discount code found",e),new Error("Discount code not found or generated");return n}}async generateDiscount(e){try{return(await this.backendAPIService.generateDiscount(e)).data.code}catch(r){throw Sr("Failed to generate a discount code"),ae(r,"backend-generate-discount",{triggerContext:this.triggerContext}),r}}};var zl=class{eventAPIService;modifications=[];constructor(){this.eventAPIService=ue.get(Hn)}execute(e){for(let r of e){if(!r.experimentConfig)continue;this.executeExperiment(r)&&this.trackExperimentRan(r)}if(document.querySelector("#lc-hide-body")?.remove(),!document.body){Da("No body element found","error");return}this.setupMutationObserver()}executeExperiment(e){let r=e.experimentConfig?.modifications;return r?.length?r.some(n=>{if(!n.cssSelector)return w.verbose("No CSS Selector available",e?.toString()),!1;this.modifications.push(n);let i=Array.from(document.querySelectorAll(n.cssSelector));return i?.length?(this.executeSingleModification(n,i),!0):!1}):(w.log("Nothing to experiment",e.toString()),!0)}executeSingleModification(e,r){if(r?.length)for(let n of r)Object.assign(n.style,e.style),e.type==="TEXT"&&e.text?n.innerHTML=e.text:e.type==="IMAGE"&&this.updateImage(e,n)}trackExperimentRan(e){if(e.id==="preview"){w.warn("Skipping experiment attribution as its preview",e.toString());return}this.eventAPIService.trackExperiment({name:"CE Experiment Start",experiment:new Dn(e)}).catch(r=>{w.error("Fail to track experiment",r)})}setupMutationObserver(){new MutationObserver(r=>{r.forEach(n=>{n.addedNodes.forEach(i=>{i instanceof HTMLElement&&this.modifications.forEach(o=>{i.matches&&i.matches(o.cssSelector)?(w.verbose("Re-applying experiment",o.toString()),this.executeSingleModification(o,[i])):i.querySelectorAll&&(w.verbose("Re-applying experiment",o.toString()),this.executeSingleModification(o,Array.from(i.querySelectorAll(o.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}updateImage(e,r){let n=e.image?.lg?.src,i=e.image?.sm?.src;!n&&!i||(r instanceof HTMLPictureElement?this.updatePictureElement({desktop:n,mobile:i},r):this.updateImageElement({desktop:n,mobile:i},r))}updateImageElement(e,r){Gr()&&e.mobile?(r.setAttribute("src",e.mobile),r.removeAttribute("srcset")):e.desktop&&(r.setAttribute("src",e.desktop),r.removeAttribute("srcset"))}updatePictureElement(e,r){if(r.innerHTML="",e.mobile){let i=document.createElement("source");i.srcset=e.mobile,i.media="(max-width: 767px)",r.append(i)}if(e.desktop){let i=document.createElement("source");i.srcset=e.desktop,i.media="(min-width: 768px)",r.append(i)}let n=document.createElement("img");n.src=e.desktop??e.mobile??"",r.append(n)}};var Hn=class t extends Un{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}fetchExperimentsSilently(){this.fetchExperimentsSafe().catch(e=>ae(e,"fetch-experiments"))}async trackExperiment(e){let r=await this.getAllContext(),n=_(_({},e),r);await this.backendAPIService.post("/v1/event/experiment",n)}async fetchExperimentsSafe(){if(!this.runtimeData.activeExperiments)return;ct.getInstance().isAuthenticated()?await this.fetchExperiments():(await fr(ct.replaySubject),await this.fetchExperiments())}async fetchExperiments(){w.info("Fetch experiments after \u23F0",fe.get().getSDKLoadTimeDiff()+" of SDK load");let e=await this.getAllContext(),r=_({},e);this.backendAPIService.post("/v1/engagement/experiments",r).then(async n=>{w.info(`Experiments fetched in \u23F0 ${vr(n.timeTakenMs)}`);let i=n.data.experiments.map(o=>new Tt(o));new zl().execute(i)}).catch(n=>{w.error("Error sending experiment getter",n)})}};var Yl=class{runtimeData=fe.get();widgetAPIService=ue.get(Cr);experimentAPIService=ue.get(Hn);meddle(){let e=Me.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods()}exposeMethods(){let e=Me.globalRef;e.loadPageWidgets=()=>{this.widgetAPIService.loadPageWidgetsSafe()},e.loadCartWidgets=()=>{this.widgetAPIService.loadCartWidgetsSafe()},e.loadExperiments=()=>{this.experimentAPIService.fetchExperimentsSilently()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=Me.previewWidget.bind(Me),e.previewPopup=Me.previewPopup.bind(Me),e.executeCTA=(r,n)=>{new mn(r).execute(n)},e.sendEvent=r=>{Re.getInstance().sendSafe(r)}}overwritePush(e,r){sn(e,"push",r)}meddleAccount(){this.overwritePush(Me.globalRef.account,(...e)=>{this.processAccount(e[0])}),Me.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Me.globalRef.events,(...e)=>{this.processEvent(e[0])}),Me.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Me.globalRef.profile,(...e)=>{this.processProfile(e[0])}),Me.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&Me.authenticate(e),e.flags&&di.setFlags(e.flags))}processEvent(e){e&&(wm.includes(e[0])?Me.sendEvent(e[0],e[1],_({occurred:this.runtimeData.jsLoadTime},e[2])):Me.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&Me.updateProfile(e)}processPageName(e){e&&Me.setPageName(e)}meddlePage(){this.overwritePush(Me.globalRef.page,(...e)=>{this.processPage(e[0])}),Me.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&this.runtimeData.setCurrentItem(e.currentItem),e.currency&&(this.runtimeData.currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&Me.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&ve.getCurrent().update(e.cart),e.customContext&&(this.runtimeData.customContext=_(_({},this.runtimeData.customContext),e.customContext))}async testCartUpdate(){if(this.runtimeData.pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=fy();if(e||(e=this.runtimeData.getCurrentItem()?.vID),!e){window.alert("Could not find a variant to test. Please try a different product page");return}let r=new Tt({id:"preview",shortID:"1",redirectBehaviour:tr.CART_DRAWER});await new mn(new Ar(new Date,r)).execute({clickAction:{at:we.ADD_TO_CART},embeddedItem:new Ct({vID:e})})}};var Ao=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX="cooee".concat("-");static getString(e,r){return this.getItem(e)||r}static setString(e,r){this.setItem(e,r)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,r){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),r)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}};var Do=class t{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;lastPercent=0;_lastScreenOrScroll=new Date;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}resetScrollID(e){Ao.remove("sleid"),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}Fi(()=>{this.observeWindowScroll()})}observeWindowScroll(){mi(window,"scroll").pipe(mr(t.DEBOUNCE_TIME),fn(()=>{let e=this.getPercentScrolledY();if(e>100){w.warn("Received scroll percent is more than 100",e);return}if(this.shouldSendScroll(e))return e})).subscribe(e=>{this.sendScroll(e)})}shouldSendScroll(e){return Math.abs(this.lastPercent-e)>=t.THRESHOLD||this.lastPercent!==e&&e===100}sendScroll(e){if(e==null)return;let r={percent:e,timeMS:new Date().getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=e;let n=Ao.getString("sleid",""),i=new Ie("CE Scroll",r,null,n);ue.get(Re).sendSafe(i),Ao.setString("sleid",i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let e=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/e*100)}};var ql=class t{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";runtimeData=fe.get();listen(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?this.onVisible():document.visibilityState==="hidden"&&this.onHidden()}}async onVisible(){}async onHidden(){let e=await this.runtimeData.setInactive();if(e===0){w.info("Not sending background event as user was inactive on website");return}w.info(`Sending background event with ${e} seconds`);let r={};r[t.ACTIVE_DURATION]=e,ue.get(Re).sendSafe(new Ie("CE App Background",r))}};var Kl=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=async function(n,i){try{await e.modifyRequest(n,i)}catch(o){ae(o,"modify-graphql-request",{extra:{body:JSON.stringify(i?.body)}})}return r(n,i)},w.verbose("Securely overwritten window.fetch method for graphql query")}async modifyRequest(e,r){let n=typeof e=="string"?e:e instanceof Request?e.url:"";if(!(n.includes("graphql.json")&&r?.method==="POST")||!r.body)return;let i;if(typeof r.body=="string")try{i=JSON.parse(r.body)}catch{return}else i=r.body;i?.variables?.input&&(w.verbose("Intercepted fetch request of:",n),i?.query.includes("cartCreate")&&(r.body=await this.updatedBody(i),this.sendBuyNowEvent()))}async updatedBody(e){let r=e.variables.input.attributes??[],n=await Qa("Buy Now");return e.variables.input.attributes=[...r,...n],JSON.stringify(e)}sendBuyNowEvent(){let e=fe.get().getCurrentItem();if(!e)return;let r=new Ie("Buy Now Clicked",{items:[e]});ue.get(Re).sendSafe(r)}};var No=class{constructor(e,r){this.selectors=e;this.eventName=r;this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let r=e.currentTarget,n=new Ie(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});ue.get(Re).sendSafe(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>w.error(e))}async listen(){this.elements=await Up(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var Xl=class t extends No{static selectors=[".product__thumbnail-list-inner > button","product-gallery-navigation > button",".product-media--thumb-container",".product-images-inner > img",".m-product-media",".swiper-button-control",".media__thumb",".slick-arrow",".productView-img-container.product-single__media",".product-gallery__thumbnail_item_inner"];constructor(){super(t.selectors,"Item Thumbnail Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Jl=class t extends No{static selectors=[".jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup","reviewsio-product-ratings",".ruk_rating_snippet.tracked:not(.hidden)","a > .loox-rating",".yotpo-reviews-star-ratings-widget",".yotpo.lp-hero__reviews",".pr-rating > a",".rivyoReviewWidget"];constructor(){super(t.selectors,"Review Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Ql=class{selector=[".gokwik-checkout button","button.cart__checkout-button","button.cart__checkout","button#checkout","button#checkout2",'button[id*="checkout" i]','button[name*="checkout" i]','button[class*="checkout" i]'].join(",");listen(){Fi(()=>{w.verbose("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let e=window.location.hash?.substring(1);if(e)if(e.includes("initiate-checkout")){document.dispatchEvent(new Event("letscooee:outbound:third-party-initiate-checkout"));let r=document.querySelector(this.selector);if(!r){w.verbose("No clickable cart checkout button found");return}w.verbose("Clickable cart checkout button found",r),r.click()}else e.includes("open-cart-drawer")&&rt.get().open()}};var Xs=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let e=await ve.getCurrent().getNormalisedCart(),r={via:"GoKwik",items:e.items,cartToken:e.token,amount:{value:e.amount,currency:e.currency}},n=new Ie("Checkout Started",r);ue.get(Re).sendSafe(n)})}};var Zl=class{static watch(){let e=au();(e==="1"||e==="on")&&Nt.getInstance().updateDevicePropsSafe({debugTill:this.getDebugMillis()}),e==="on"?sessionStorage.cooeeDebug="1":e==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&this.renderDebugBar()}static renderDebugBar(){let e=document.createElement("cooee-debugger");e.logs=this.logs,Fi(()=>{document.body.appendChild(e)})}static getDebugMillis(){return new Date().getTime()+360*60*1e3}};var Me=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(window.cooeeSDKPreview)return;let r=(window.CooeeSDK?.pageLoadTime??e).getTime()-e.getTime();w.info(`Initialising SDK after ${vr(r)} of page load`),this.initGlobalReference(e),await ue.get(ct).populateAuthDataFromStorage(),this.autoAuthenticate(),new Yl().meddle(),Dm(),ue.get(Cr).loadPageWidgetsSafe(!0),ue.get(Hn).fetchExperimentsSilently(),new ql().listen(),new vi().listen(),new Kl().listen(),new Ql().listen(),ue.get(Do).listen(),ue.get(Jl).listenSilently(),ue.get(Xl).listenSilently(),this.attachGoKwikListeners(),this.setupPreviewListeners(),Zl.watch()}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(e){window.CooeeSDK||sn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,sn(this.globalRef,"config",new Je),sn(this.globalRef,"runtimeData",new fe(e)),sn(this.globalRef,"uaParser",new Tr,!0),sn(this.globalRef,"cartChange$",vi.cartChange$.asObservable()),sn(this.globalRef,"cartDrawerToggle$",rt.cartDrawerToggle$.asObservable()),w.verbose("Global reference initialised"),new Wc(()=>{this.globalRef.uaParser=new Tr})}static injectWidgetAssets(){Gg(zt.widgetURL,"cooee-widget-sdk"),xf()}static autoAuthenticate(){let e=fc();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;w.info("Begin auth after \u23F0",fe.get().getSDKLoadTimeDiff(),"of SDK load");let r=e.appID?.trim(),n=e.shopifyShop;if((Bp(r)||r.length!==24)&&Bp(n)){w.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,ue.get(ct).authenticate(e)}static sendEvent(e,r,n){let i=new Ie(e,r,n?.triggerData);n?.occurred&&(i.occurred=n.occurred),ue.get(Re).sendSafe(i)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");ue.get(Nt).updateProfileSafe(e)}static setPageName(e){if(!e)return;let r=fe.get(),n=r.pageName;if(e===n)return;if(r.pageName=e,e==="cart"&&ue.get(Cr).loadOrRenderWidgetsAfterCartChange(),_m.some(s=>e.includes(s))){ue.get(Do).resetScrollID();return}let i={};n&&(i.ps=n);let o=new Ie("CE Screen View",i);o.occurred=r.jsLoadTime,ue.get(Re).sendSafe(o),ue.get(Do).resetScrollID(o.occurred)}static previewPopup(e,r){new kn(r).render(e)}static previewWidget(e){new xt(new Tt(e)).renderSilently()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(e){w.error(e)}window.addEventListener("message",e=>{if(w.verbose("Received event",e),!e.origin.includes("letscooee.com")&&!e.origin.includes("localhost"))return;let r=e.data;typeof r=="object"&&(r.action==="POPUP_PREVIEW"?(this.previewPopup(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)):r.action==="WIDGET_PREVIEW"&&(this.previewWidget(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)))})}}static attachGoKwikListeners(){let e=fe.get();window.addEventListener("kp-modal:opened",()=>{e.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",r=>{let{token:n}=r.detail;n&&this.updateProfile({goKwikToken:n})}),window.gokwikSdk?Xs.attachCheckoutListener():window.addEventListener("gokwikLoaded",Xs.attachCheckoutListener)}};var v0=new Date;Im();Tm();w.verbose("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(w.verbose("Execution order:","IIFE start"),await Me.initForMerchantWebsiteOnly(v0),await Me.initForAll(),w.verbose("Execution order:","IIFE end")))());w.verbose("Execution order:","bottom");
|
|
74
|
+
`},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1,pauseOnMouseEnter:!1}:!1,autoHeight:!0,speed:e.speed};e.marquee&&r.autoplay&&typeof r.autoplay=="object"&&(r.autoplay.pauseOnMouseEnter=!0,t.style.setProperty("--swiper-wrapper-transition-timing-function","linear"));let n=new window.CooeeSDK.Swiper(t,r);return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),n}function Ml(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),K("div",{class:"swiper-container",ref:e,style:"max-width: 100%",children:[K("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&K("div",{class:"swiper-button-next",style:n,children:K("span",{})}),t.navigation.enabled&&K("div",{class:"swiper-button-prev",style:n,children:K("span",{})}),t.pagination.enabled&&K("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var ks=class extends Fe{componentDidMount(){Tt(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return K("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:K("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(e){let{checked:r}=e.target;this.props.item.selected.value=r}getTypoStyles(){let e={},r=this.mediaStyle.typo??new lt;return e.textAlign=r.alignment,e.justifyContent=r.alignment,e}getComponentStyles(){return Z(_({},this.getTypoStyles()),{display:"flex"})}};var dn=class extends Fe{constructor(e,r){super(e,r)}render(){let e=this.props.element[this.deviceTypeKey],r=e?.src||this.props.element.src||this.props.element.lg?.src;return K("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:e?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:r,style:this.getCompiledStyles()})}customOnClick(e){this.props.element.clc?.at===we.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let r={zIndex:e.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(r.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(r.height=this.mediaStyle.size.h),r}handleMouseEnter(e){let r=this.props.element[this.deviceTypeKey]?.secondarySrc;r&&(e.currentTarget.src=r)}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}};var hn=class extends Fe{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return K("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:K(Fn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new Zi,r={display:"flex",gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai};return e.wrap==="nowrap"&&e.scroll&&(e.dir==="column"?r["overflow-y"]="auto":r["overflow-x"]="auto"),r}};var Us=class extends hn{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return K("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:K(To,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var Fs=class extends Fe{render(){return K("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){Tt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new lt;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility="hidden"),_(_({},e),this.getTypoStyles())}createSelectItems(){let e=[],r=this.props.selectedVariant;if(!r.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?r.selectedSellingPlan.value||(r.sellingPlans[0].isSelected=!0,r.changeSellingPlan(r.sellingPlans[0])):e.push(K("option",{value:"",selected:!r.selectedSellingPlan,children:"One time purchase"}));for(let n of r.sellingPlans??[])e.push(K("option",{value:n.mID,selected:n.isSelected,children:n.name}));return e}onChange(e){let r=e.target.value;r?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(n=>n.mID===r):this.props.selectedVariant.selectedSellingPlan.value=void 0}};var w0=new RegExp('fill="#[a-zA-Z0-9]+"'),Hs=class extends Fe{constructor(){super()}render(){let e=this.getCompiledStyles(),r=this.getRating();return r||(e.display="none",r=""),K("div",{style:e,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:r}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},r=ji(this.props.element.fullStar,{svg:e},this.props.triggerContext),n=ji(this.props.element.halfStart,{svg:e},this.props.triggerContext),i=this.props.review;if(!i?.rating)return"";let o="";if(this.props.element.showSingleStar)o=r;else{let s=5,a=`${i.rating}`.split(".");for(let c=0;c<+a[0];c++)o+=r,s--;a[1]&&(o+=n,s--);for(let c=0;c<s;c++)o+=r.replace(w0,'fill="#f1f1f1"')}return o}getComponentStyles(){return{display:"flex",alignItems:"center"}}};var $s=class extends Fe{render(){return K("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){Tt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new lt;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(e.visibility="hidden"),_(_({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let r of this.props.item.vars)e.push(K("option",{value:r.mID,disabled:!r.isAvailable,children:r.name}));return e}onChange(e){let r=e.target.value,n=this.props.item.vars.find(i=>i.mID===r);this.props.item.setSelectedVariant(n)}};var To=class extends Fe{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let r=e;return r.l==="Star Rating"&&!this.props.item.reviews?.rating?void 0:K(Us,{element:r,triggerContext:this.props.triggerContext,elements:r.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?K(ks,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let r=e,n=this.props.item,i=n.variantImage??n.firstImageURL,o=n.variantSecondaryImage??n.secondaryImageURL;r.lg=r.sm={src:i,name:n.name,secondarySrc:o};let s=K(dn,{element:r,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:K("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let r=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:r.showChips?K("cooee-product-options-picker",{item:this.props.item}):K($s,{element:r,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?K(Fs,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?K(Hs,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?K(vi,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):K(Fn,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}renderProductTitle(e){let r=K(Qt,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?r:K("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:r})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}};var Ei=class extends Fe{productElement;constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}render(){let e=Zn(this.props.element,this.getProductData(),this.props.triggerContext);if(this.productElement=new Rn(e),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return K("div",{style:_({},this.getCompiledStyles()),class:"lc-single-product",children:K(To,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let e=this.props.item,r=e.selectedOrFirstVariant.value,n=e.getTemplateVariables();n.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let i=this.props.triggerContext.triggerData.discount?.type===er.BXGY;return!r.hasEffectivePrice()&&i&&(n.product=Z(_(_({},n.product),kt("effective_price",r.effectivePrice.value)),{price:""})),n.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(r.quantity):r.quantity,{product:n.product,variant:n.variant,svg:{color:"{{ svg.color }}",size:"{{ svg.size }}"}}}};var Vs=class extends Fe{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,r){super(e,r),this.configuration=jr()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&Uc().then(()=>{this.swiperInstance=Ll(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let r;if(this.configuration.disp===2){let n=o=>{this.swiperRef=o},i=()=>e?.map(o=>K("div",{class:"swiper-slide",children:this.getProductFragment(o)}));r=K("div",{style:Z(_({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:Ml(this.configuration,n,i)})}else r=K("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((n,i)=>this.getProductFragment(n,i!==e.length-1))});return r}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),r={display:e?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(r.flexDirection==="row"){if(e)r.maxWidth="100%",r.overflowY="auto";else if(this.configuration.disp===1){let n=this.props.triggerContext.triggerData,i=n.items.length,o;n.isBundle()?o=this.props.element.prod.symbol?.hide!==!0?i*2-1:i:o=this.props.element.conf[this.deviceTypeKey].maxInRow,r.gridTemplateColumns=`repeat(${o}, auto)`}}return r}getProductFragment(e,r=!1){return K(Mr,{children:[K(Ei,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&r&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&K("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:K(Qt,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var Ws=class extends Fe{swiperRef=null;swiperInstance=null;constructor(e,r){super(e,r)}componentDidMount(){Uc().then(()=>{this.swiperInstance=Ll(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,r=i=>{this.swiperRef=i},n=()=>{let i=e.values?.map(a=>K("div",{class:"swiper-slide",onClick:c=>this.onClick(c,{clickAction:this.getClickAction(a)}),children:this.renderElement(a)}));if(!i?.length)return[];let o=e.conf,s=i.length;if(o.marquee&&s<=Number(o.maxInRow)){let a=Number(o.maxInRow)-s+1;for(let c=0;c<a;c++)i.push(i[c%s])}return i};return Ml(e.conf,r,n)}getComponentStyles(){return{}}renderElement(e){let r=this.valueAddedSlide(this.props.element.slide,e);switch(r?.t){case 1:return K(dn,{element:r,triggerContext:this.props.triggerContext});case 4:return K(hn,{elements:r.elems,element:r,triggerContext:this.props.triggerContext});default:b.warn("Unknown slide type for carousal")}}valueAddedSlide(e,r){let n=Zn(e,{form:r},this.props.triggerContext);return Xt.getParsedElement(n)}getClickAction(e){return Zn(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var Fn=class extends Fe{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"})),Tt(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(e){if(!e.hide){if(e.t===4){let r=e;return K(hn,{element:r,triggerContext:this.props.triggerContext,elements:r.elems})}if(e.t===61)return K(Bs,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?K(vi,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return K(Qt,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return K(dn,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return K(Vs,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return K(Ei,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return K(Ws,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var js=class extends Fe{clickAction;isClickable;constructor(e,r){super(e,r),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===we.GO_TO_URL&&!!ki(this.clickAction.gu?.u)||this.clickAction?.at===we.OPEN_CART||this.clickAction?.at===we.INITIATE_CHECKOUT}componentDidMount(){Tt(()=>{let e=this.props.triggerContext.triggerData,r=this.props.triggerContext.selectedItems;e.calculateDiscountData(r,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return K(Mr,{children:[K("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:e=>{this.onClick(e,{clickAction:this.clickAction})},children:K(Fn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&K("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let e={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(e.cursor="pointer"),e}};var bt=class t{constructor(e){this.engagementTrigger=e;this.triggerContext=new Cr(new Date,this.engagementTrigger)}static currentEngagements=new Set;static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;widget;triggerContext;observers=[];runtimeData=ye.get();widgetAPIService=me.get(qr);eventAPIService=me.get(Re);renderedCount=0;scrollSubscription;variation;isExclusionWithBVariation;isRendering=!1;renderSilently(){this.render().catch(e=>{ae(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){b.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),t.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),xf(this.engagementTrigger.content?.afterDeleteJS)}async render(){if(this.isRendering){b.verbose(`${this.engagementTrigger} rendering already in progress, skipping`);return}this.isRendering=!0;try{if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){b.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),this.widget=this.engagementTrigger.widget,await this.getVariationIfRequired(),await this.runChoresBeforeRender(),this.attachScroll(),await this.checkAndSendEvent(),this.triggerContext.renderer=this,xf(this.engagementTrigger.content?.afterRenderJS)}finally{this.isRendering=!1}}matches(e){return this.engagementTrigger.shortID===e.shortID}async updateAndReRender(e){b.info(`${this.engagementTrigger} will be updated`),this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render()}async update(e){}rerender(){this.rootContainer?.isConnected||(b.info(`${this.engagementTrigger} deleted. Will be re-rendered`),this.preDestroy(),this.renderSilently())}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()})}afterRootContainerCreated(){}isAllOkToRender(){return!!this.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){b.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){e&&(b.log(`${this.engagementTrigger} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(this.engagementTrigger.items=e.items.map(r=>new Dt(r)),this.engagementTrigger.nonMutableItems=e.items.map(r=>new Dt(r))),e.bundleFrom&&(this.engagementTrigger.bundleFrom=new Dt(e.bundleFrom)),e.discount&&(this.engagementTrigger.discount=e.discount),e.placement&&(this.triggerContext.triggerData.placement=e.placement),e.props&&rr.hasKeys(e.props)&&(this.engagementTrigger.props=_(_({},this.engagementTrigger.props),e.props)),e.content&&(this.triggerContext.triggerData.content=new cs(e.content)),this.triggerContext.triggerData.widget=this.widget=new no(e.widget),this.triggerContext.triggerData.contentID=e.contentID,this.triggerContext.triggerData.variation=this.variation=e.variation,this.triggerContext.triggerData.placement=e.placement,this.triggerContext.triggerData.manipulation=e.manipulation,this.triggerContext.triggerData.entryAnimation=e.entryAnimation??"NONE",this.isExclusionWithBVariation=this.engagementTrigger.isExclusionTesting()&&this.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px"))}addToRendered(){this.renderedCount++,b.info(`${this.engagementTrigger} rendered \u2705 ${kh(this.renderedCount)} time`)}removeFromRendered(){this instanceof gt?gt.currentEngagements.delete(this):t.currentEngagements.delete(this)}async getVariation(){b.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return(await this.widgetAPIService.getVariation(e)).data}catch(r){ae(r,"get-variation",{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){b.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let i=new IntersectionObserver((o,s)=>{o.forEach(async a=>{if(a.isIntersecting){b.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let c=await this.getVariation();n(c),s.unobserve(this.rootContainer)}})},r);i.observe(this.rootContainer),this.observers.push(i)})}attachScroll(){this.scrollSubscription=mi(window,"scroll").pipe(Tr(t.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}async checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(t.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let i=this.isExclusionWithBVariation?"CE Campaign Holdout":"CE Trigger Displayed",o=new Ie(i,n,this.engagementTrigger);o.name==="CE Campaign Holdout"&&(o.trigger.holdout=!0),this.eventAPIService.sendSilently(o),t.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=ve.getCurrent(),r.triggerContext=this.triggerContext,r.engagementTrigger=this.engagementTrigger,r.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(r),this.addToRendered(),r}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let i=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),o=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${o} lc-${i}`,n.dataset.engagementId=o,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}startRendering(){let e=this.rootContainer;this.triggerContext.triggerData.hasSwiperElement()&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),Cf(e)),Zh(Wp(js,{element:this.widget.cont,triggerContext:this.triggerContext,elements:this.widget.elems}),e),this.addToRendered()}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,i=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,o=e.width*e.height,s=i/o*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return b.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=r.selector,i;if(n.includes(":shadow")){let c=n.split(":shadow");i=(await Fi(c[0].trim()))?.shadowRoot,n=c[1].trim(),i&&Cf(i,!1)}b.verbose(`${this.engagementTrigger} attempt to render ${r.position} "${n}"`);let o=await Fi(n,10,i??document);if(!o)return b.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),a=this.getParentElement(s);if(!e)return a;switch(r.position){case Ii.BEFORE:{o.parentElement?.insertBefore(a,o);break}case Ii.INSIDE_FIRST:{o.insertBefore(a,o.firstChild);break}case Ii.INSIDE_LAST:{o.appendChild(a);break}case Ii.AFTER:default:o.parentElement?.insertBefore(a,o.nextSibling)}return a}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){b.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}b.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await Dl(this.engagementTrigger)}catch(r){b.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){b.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,this.startRendering()}updateItems(e,r){let n=this.getItemDiff(e,r),i=this.getItemDiff(r,e);r.push(...n);for(let o of i)Xr.remove(r,o)}getItemDiff(e,r){return e.filter(n=>!r.some(i=>i.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var gt=class extends bt{static currentEngagements=new Set;constructor(e){super(e)}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}async checkAndSendEvent(){if(!rt.get().isOpen()&&this.runtimeData.pageName!=="cart"){b.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var S0=t=>t,rv=t=>t.filter(e=>e.removedNodes&&e.removedNodes.length>0);function nv(t,e={childList:!0,subtree:!0},r=500,n=S0){return gl(i=>{let o=new MutationObserver(s=>i(s));return o.observe(t,e),o},(i,o)=>o.disconnect()).pipe(fn(i=>n(i)),tm(i=>i.length>0),Tr(r))}var Bl=class t{constructor(e,r){this.engagementTrigger=e;this.element=r;this.cartItems=ve.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){b.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){b.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let i of n)new t(e,i).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(d=>d.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(d=>d.mID===e.id.toString());if(!n)return;let i=new Br(n),o=e.selling_plan_allocation?.selling_plan;if(o)for(let d of i.sellingPlans??[])d.mID===o.id.toString()&&(d.isSelected=!0,i.changeSellingPlan(d));let s=new Dt(r);s.vars=[i],s.selectedOrFirstVariant.value=i;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let c=new xt(this.engagementTrigger);c.placement.selector=`.${a}`,c.items=[s];let p=new gt(c);p.renderSilently(),this.watchForCartItemDeletion(p,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(i=>{i.forEach(o=>{o.removedNodes.forEach(s=>{s===this.element&&(b.verbose(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}};var kl=class extends gt{ctaExecutor=new Bn;constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),await this.checkMilestoneTryCatch(),this.widgetElement.update()}isAllOkToRender(){return!!this.engagementTrigger.progressBarConfig}startRendering(){if(this.widgetElement?.isConnected){this.widgetElement.update(),this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),this.checkMilestoneTryCatch()}async checkMilestoneTryCatch(){try{await this.checkMilestone()}catch(e){ae(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})}}async checkMilestone(){let e=await ve.getCurrent().getNormalisedCart(),r=this.engagementTrigger.progressBarConfig,n,i=[],o=[],s=[],a,c,p=[...r.milestones];for(let f of p){if(f.rewardType!==uu.FREE_AUTO_GIFT)continue;if(f.isUIOnly&&!f.allowATC){b.verbose(`Skipping milestone ${f.label} as it is UI only and does not allow ATC`);continue}let E=f.items[0],y=f.reached,T=e.items.find(D=>(D.vID===E.vID||D.mID===E.mID)&&D.properties._letscooee_campaign===this.engagementTrigger.shortID);y&&(a=f,c=T),T&&i.push(T),!y&&T&&r.removeIneligibleItem?(b.verbose(`Removing free gift ${T.vID} from cart`),s.push(T)):y&&!T&&(b.verbose(`Adding free gift ${E.vID} to cart`),o.push(E))}r.restrictToLatestFreebie&&a&&(c?(i=i.filter(f=>f.vID!==c.vID),o=[]):o=[a.items[0]],s.push(...i)),s.length&&await this.removeFreeGifts(s),o.length&&(n=await this.ctaExecutor.addToCart(o,this.engagementTrigger));let d=r.coupons;if(d?.length)try{await Gr.applyWithStorefront(d.map(f=>f.couponCode)),rt.get().refreshUI(n,!1)}catch(f){ae(f,"cart-apply-discount",{extra:{coupons:d},engagementTrigger:this.engagementTrigger})}}async removeFreeGifts(e){await Promise.all(e.map(r=>this.ctaExecutor.updateLineItem(r,{quantity:0})))}};var Gs=class extends gt{constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.content.update(e.content),this.widgetElement.update()}isAllOkToRender(){return!!this.engagementTrigger.content}startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}};var Ul=class extends bt{constructor(e){super(e)}isAllOkToRender(){return!!this.engagementTrigger.content?.videoConfig}startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e,r=this.engagementTrigger.content.videoConfig;r.template==="FLOATING_POPUP"?e="cooee-video-popup":r.template==="STORY"?e="cooee-video-stories":e="cooee-video-playlist",this.createAngularWidget(e)}};var Fl=class extends bt{constructor(e){super(e)}isAllOkToRender(){return!0}startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var Hl=class extends bt{constructor(e){super(e)}isAllOkToRender(){return!0}startRendering(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener("letscooee:inbound:cta:add-bundle",this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,i=e.detail;if(!rr.hasKeys(i)){b.error(`No detail received for ${n}`);return}b.log("Detail received for BYOB",i);let o=i.campaignID??i.campaignId??i.campaign_id;if(o!==r.shortID&&o!==r.engagementID){b.warn(`Current ${n} is not BYOB. Received: ${o}`);return}let s=i.items;if(!s?.length)return;let a=s.map(c=>new Rt({mID:c.product_id,vID:c.variant_id,quantity:c.quantity||1}));await new mn(this.triggerContext).execute({embeddedItems:a,clickAction:{at:we.ADD_BUNDLE,applyDiscount:!0}})}};var um=!1,pm=!1,$l=null,Vl=null;nv(document.body,{childList:!0,subtree:!0},500,rv).subscribe(()=>{bt.currentEngagements.forEach(t=>t.rerender()),gt.currentEngagements.forEach(t=>t.rerender())});function fm(t){if(um){b.verbose("Cart widget processing in progress, queuing latest triggers"),$l=t;return}um=!0;try{I0(t)}finally{if(um=!1,$l){let e=$l;$l=null,b.verbose("Processing queued cart triggers"),fm(e)}}}function mm(t){if(pm){b.verbose("Page widget processing in progress, queuing latest triggers"),Vl=t;return}pm=!0;try{T0(t)}finally{if(pm=!1,Vl){let e=Vl;Vl=null,b.verbose("Processing queued page triggers"),mm(e)}}}function I0(t){ov(gt.currentEngagements,t);for(let e of t){b.info(`${e} received as cart embed`);let r=iv(gt.currentEngagements,e);if(r&&!e.isSubscriptionUpsell()){r.updateAndReRender(e).catch(i=>{ae(i,"update-and-re-render",{engagementTrigger:e})});continue}b.verbose(`${e} is new`);let n;if(e.isProgressBar())n=new kl(e);else if(e.isSubscriptionUpsell()){Bl.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new Gs(e):n=new gt(e);gt.currentEngagements.add(n),n.renderSilently()}}function T0(t){ov(bt.currentEngagements,t);for(let e of t){b.info(`${e} received as page embed`);let r=iv(bt.currentEngagements,e);if(r){r.updateAndReRender(e).catch(i=>{ae(i,"update-and-re-render",{engagementTrigger:e})});continue}b.verbose(`${e} is new`);let n;e.isShoppableVideo()?n=new Ul(e):e.isBYOB()?n=new Hl(e):e.isStickyATC()?n=new Fl(e):e.isSavingsBar()?n=new Gs(e):n=new bt(e),bt.currentEngagements.add(n),n.renderSilently()}}function iv(t,e){for(let r of t)if(r.matches(e))return r}function ov(t,e){let r=new Set(e.map(n=>n.shortID));for(let n of t)r.has(n.engagementTrigger.shortID)||n.destroy()}var sv=new Jt,qr=class t extends Un{static INSTANCE;pageWidgetLoadCount=0;constructor(){super(),sv.pipe(Tr(50),rm(e=>Zf(Promise.all([this.loadPageWidgetsFromServer().catch(r=>{ae(r,"load-page-widgets",{extra:{firstLoad:e}})}),this.loadCartWidgetsFromServer().catch(r=>{ae(r,"load-cart-widgets",{extra:{firstLoad:e}})})])))).subscribe(),window.CooeeSDK.cartChange$.subscribe(()=>{this.loadWidgetsSafe()})}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}loadWidgetsSafe(e=!1){Wr(_t.replaySubject).then(()=>{sv.next(e)})}renderCachedCartWidgets(){gt.currentEngagements.forEach(e=>e.rerender())}async getVariation(e){let r=await this.getAllContext();return Object.assign(e,r),this.backendAPIService.post("/v1/engagement/get-variant",e)}async loadPageWidgetsFromServer(){this.pageWidgetLoadCount++,this.pageWidgetLoadCount===1?b.info("Fetch page widgets (after \u23F0",ye.get().getSDKLoadTimeDiff()+" of SDK load)"):b.info("Fetch page widgets");let e=await this.getAllContext(),r=_({},e);this.backendAPIService.post("/v1/engagement/page-widgets",r).then(n=>{b.info(`Page widgets loaded in \u23F0 ${gr(n.timeTakenMs)}`);let i=n.data.widgets.map(o=>new xt(o));mm(i)}).catch(n=>{b.error("Error sending widget getter",n)})}async loadCartWidgetsFromServer(){b.info("Fetch cart widgets");let e=await this.getAllContext(),r=_({},e);this.backendAPIService.post("/v1/engagement/cart-widgets",r).then(n=>{b.info(`Cart widgets loaded in \u23F0 ${gr(n.timeTakenMs)}`);let i=n.data.widgets.map(o=>new xt(o));fm(i)}).catch(n=>{b.error("Error sending widget getter",n)})}};var Wl=class t{static INSTANCE;constructor(){this.init()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}init(){Os.get("conf",{}).then(e=>this.updateGlobalConfig(e))}async processAppConfigurations(e){b.verbose("Received app configuration",e),e.currencyCount=e.currencies?.length;let r=this.updateGlobalConfig(e);Os.set("conf",r).catch(n=>b.error(n)),Pl.processConfiguration(),r.website&&(Qg(r.website.commonJS),Tf(r.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.subscribe(async({open:n})=>{b.info("Cart drawer is now",n?"open":"closed"),n&&(qr.getInstance().renderCachedCartWidgets(),await this.trackViewCartEvent())})}updateGlobalConfig(e){let r=Me.globalRef.config.update(e);return rt.forceUpdate(),b.verbose("App configurations",r),r}async trackViewCartEvent(){let e=await ve.getCurrent().getNormalisedCart(),r={value:e.amount,currency:e.currency},n={items:e.items,amount:r,drawer:!0};me.get(Re).sendSafe(new Ie("View Cart",n))}};var av="App ID or Shopify shop is not set",_t=class t{static replaySubject=new Ts(1);static INSTANCE;backendAPIService=Pt.getInstance();coreService=Wl.getInstance();userID="";deviceID="";appID="";shopifyShop="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}async populateAuthDataFromStorage(){await this.getOrSetDeviceIDSafe(),this.userID=await Ye.get("id"),this.updateAPIClient()}isAuthenticated(){return!!this.deviceID}authenticate(e){if(b.verbose("Initialising SDK",e),qy(navigator.userAgent)){b.info("This seems to be a bot. Disabling SDK");return}this.appID=e.appID,this.shopifyShop=e.shopifyShop,this.checkForNewSessionOnPageLoad().then(async()=>{t.replaySubject.next(!0),t.replaySubject.complete()}).catch(r=>{r?.message?.includes(av)&&ae(r,"initiate-session",{extra:e}),b.error("Unable to initiate session",r)})}async storeAndPopulateAuthData(e){e&&(e.userID&&(this.userID=e.userID,await Ye.set("id",e.userID)),e.deviceID&&(this.deviceID=e.deviceID,await Ye.set("did",e.deviceID)),this.updateAPIClient())}async checkSessionAndGetContext(){return await this.checkForNewSessionUnsafe(!1),this.getContext()}async checkForNewSessionOnPageLoad(){await this.checkForNewSessionSafe(!0)}async getOrSetDeviceIDSafe(){await fc.request("gen_did",async()=>{let e=await Ye.get("did");e||(e=new Et().toHexString(),await Ye.set("did",e)),this.deviceID=e,b.info("Device ID:",this.deviceID)})}async getContext(){At.set("lastUsedTime",new Date().getTime());let[e,r,n]=await Promise.all([At.get("id",""),Ye.get("sessionNumber",1),At.get("landing",{})]);return Bi({"cooee_session.number":r}),Ga("Visitor Session",{id:e,number:r,landing_page:n}),{sessionID:e,sessionNumber:r,landingPage:n}}async checkForNewSessionSafe(e){await this.checkForNewSessionUnsafe(e)}async checkForNewSessionUnsafe(e){let r=!1;if(await this.isNewSessionRequired()?(b.info("New session to be started"),await this.startNewSession(),e=!0,r=!0):await this.notSynced()&&(r=!0),e){let n=await this.getContext();b.info(`Session ID: ${n.sessionID} & number: ${n.sessionNumber}`),await this.validateSessionFromServer(Z(_({},n),{newSession:r})),await At.set("synced",!0)}}async startNewSession(){b.verbose("Starting new session"),await At.clear(),b.verbose("Cleared SessionStorage before starting new session");let e=new Date,r=new Et().toHexString();b.verbose("New session ID to be used",r);let n=await Ye.get("sessionNumber",0)+1;await Promise.all([Ye.set("sessionNumber",n),At.set("id",r),At.set("lastUsedTime",e.getTime()),At.set("landing",Qs())])}async isNewSessionRequired(){if(!await At.get("id"))return!0;let e=await At.get("lastUsedTime",0);return e?(new Date().getTime()-e)/1e3>1800:!0}async notSynced(){return!await At.get("synced",!1)}async getSessionValidateData(e){if(!this.appID&&!this.shopifyShop)throw new Error(av);let r=await Xy(),n=vl();return Z(_(_({deviceID:this.deviceID,deviceProps:r,appID:this.appID,shopifyShop:this.shopifyShop},e),n),{sdk:Ys,ad:yl.getAdParams(),occurred:x0(ye.get().jsLoadTime),properties:{}})}async validateSessionFromServer(e){b.verbose("Validating session with server"),await this.populateFirstSeen();let r=await this.getSessionValidateData(e);try{let n=await this.backendAPIService.validateSession(r),i=n.data;b.info(`Auth finished in \u23F0 ${gr(n.timeTakenMs)}`),b.verbose("Validate session Response",i),await this.coreService.processAppConfigurations(i.appSettings),await this.storeAndPopulateAuthData(i)}catch(n){throw b.error(n),n}}async populateFirstSeen(){let e=await Ye.get("firstSeen"),r=e?new Date(e):new Date;e||await Ye.set("firstSeen",r.toISOString()),this.backendAPIService.setFirstSeen(r),Ga("Visitor Info",{first_seen:r.toISOString()})}updateAPIClient(){this.userID&&b.info("User ID:",this.userID),Io.trackDeviceID(this.deviceID),this.backendAPIService.setDeviceId(this.deviceID),Ga("Visitor Info",{device_id:this.deviceID,user_id:this.userID}),Nh({id:this.deviceID})}};function x0(t){return(new Date().getTime()-t.getTime())/1e3>1800?new Date:t}var Pt=class t{static INSTANCE;deviceID="";firstSeen="";constructor(){}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}async validateSession(e){return this.post("/v1/event/validate-session",e)}updateProfileSafe(e){Wr(_t.replaySubject).then(()=>this.updateProfile(e??{}))}updateProfile(e){this.put("/v1/user/update",e).then(async r=>{b.verbose("Updated user profile"),await _t.getInstance().storeAndPopulateAuthData(r.data)}).catch(r=>{b.error("Error saving user profile",r)})}generateDiscount(e){return this.post("/v1/event/generate-discount",e)}updateDevicePropsSafe(e){Wr(_t.replaySubject).then(()=>this.updateDeviceProps({props:e}))}updateDeviceProps(e){this.put("/v1/device/update",e).then(()=>{b.verbose("Updated device properties")}).catch(async r=>{b.error("Error saving device property",r)})}setDeviceId(e){this.deviceID=e??""}setFirstSeen(e){this.firstSeen=e?.toUTCString()??""}get(e){return this.requestBackend("GET",e)}post(e,r){return this.requestBackend("POST",e,r)}put(e,r){return this.requestBackend("PUT",e,r)}async requestBackend(e,r,n){if(!di.isECommerceApp()&&!di.getFlags().allowEvents)return b.log(`Rejecting ${e} ${r} as this is not e-commerce app`),Promise.reject();r.startsWith("http")||(r=Gt.apiURL+r);let i=this.getDefaultHeaders(),o="keepalive"in new Request(""),s=n?JSON.stringify(n):void 0;if(n&&!o&&s?.includes("CE App Background"))try{return this.performXMLHttpRequest(r,i,n)}catch(c){throw ae(c,"http-request",{extra:{body:s}}),c}let a={method:e,headers:i,keepalive:!0};return n&&(a.body=s),Zr(r,a)}performXMLHttpRequest(e,r,n){return new Promise((i,o)=>{let s=new XMLHttpRequest;s.open("POST",e,!0),r.forEach((a,c)=>{s.setRequestHeader(c,a)}),s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE)if(s.status>=200&&s.status<300)try{if(s.getResponseHeader("Content-Type")?.includes("application/json")){let c=JSON.parse(s.responseText);i({data:c,headers:r,request:s,status:s.status,statusText:s.statusText})}else o(new Error("Content-Type of response header is not json"))}catch(a){o(a)}else o(new Error(`Received status - ${s.status}(${s.statusText})`))},s.onerror=()=>{o(new Error("Network error occurred during the request."))},s.send(JSON.stringify(n))})}getDefaultHeaders(){let e=new Headers;return e.set("content-type","application/json"),e.set("cooee-sdk",Ys),e.set("cooee-sdk-code",Im.toString()),e.set("cooee-sdk-version",Kr),e.set("cooee-first-seen",this.firstSeen),e.set("cooee-shop-name",cc()??""),this.deviceID&&e.append("cooee-device-id",this.deviceID),Gt.debug&&e.set("cooee-sdk-debug",String(1)),e}};var mn=class{constructor(e){this.triggerContext=e}backendAPIService=Pt.getInstance();eventAPIService=Re.getInstance();async execute(e){let r=ye.get().getCurrentItem(),n=e.clickAction;if(!n)return;let i=e.item,o=this.triggerContext,s=new Bn,a=o.triggerData.redirectBehaviour,c=!!o.triggerData.discount?.type&&!!n?.applyDiscount,p={selectedVariants:o.triggerData.nonMutableItems.map(N=>({itemMID:N.mID,mID:N.selectedOrFirstVariant.value.mID,variantID:N.selectedOrFirstVariant.value.mID})),eID:o.triggerData.engagementID,cID:o.triggerData.contentID},d="",f=[],E=[];if(i?E=[i.toEmbed()]:e.embeddedItem&&(E=[e.embeddedItem]),n.at===we.ADD_BUNDLE){let N=o.selectedItems;if(E=e.embeddedItems??N.map(k=>k.toEmbed()),o.shouldGiveFBTDiscount||e.embeddedItems?.length){let k;e.embeddedItems?k=e.embeddedItems.map(P=>({itemMID:P.mID,mID:P.vID,variantID:P.vID,quantity:P.quantity})):k=N.map(P=>({itemMID:P.mID,mID:P.selectedOrFirstVariant.value.mID,variantID:P.selectedOrFirstVariant.value.mID}));let G=o.triggerData.bundleFrom;o.triggerData.isBundleOnCartDrawer()&&G&&(k.push({itemMID:G.mID,mID:G.selectedOrFirstVariant.value.mID,isPrimary:!0}),E.unshift(G.toEmbed())),p.selectedVariants=k,o.triggerData.isBundleOnPDP()&&p.selectedVariants.forEach(P=>{P.mID===r.vID&&(P.isPrimary=!0)})}else p=void 0;f=e.embeddedItems??N}else if(n.at===we.INITIATE_CHECKOUT){let N=await ve.getCurrent().getNormalisedCart();E=N.items,p.selectedVariants=N.items.map(k=>({itemMID:k.mID,mID:k.vID}))}else if(n.at===we.ADD_TO_CART)f=i?[i]:[e.embeddedItem];else if(n.at===we.QUICK_VIEW){window.cooeeShowQuickItem(this.triggerContext,i),this.sendTriggerClicked(E,{from:"button"},e.video);return}else if(n.at===we.GO_TO_PRODUCT)d=i?Gi("/products/"+i.slug):e.embeddedItem?.link;else if(n.at===we.GO_TO_URL){let N=ki(n.gu?.u);N&&(d=N.href)}else if(n.at===we.UPGRADE_TO_SUBSCRIPTION){let N=await s.upgradeToSubscription(i,o.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),rt.get().refreshUI(N)}else if(n.at===we.GO_TO_COLLECTION){let N=this.triggerContext.triggerData.collections?.[0];N&&(d="collections/"+N.handle)}if(this.sendTriggerClicked(E,{from:"button"},e.video),b.verbose({redirectPath:d,redirectBehaviour:a,hasDiscount:c}),!c&&d){location.href=d;return}let y,T=!1;try{y=await this.getOrGenerateDiscountCode(p),b.verbose("Discount code (if any) to apply",y)}catch(N){if(!this.triggerContext.triggerData.isBYOB()){cv.default.error("Unable to get a discount code",N);return}}if(y&&n.at===we.COPY_COUPON_CODE)await s.copyDiscountCode(y);else if(n.at===we.BUY_NOW){let N=await s.createNewCart(r,y,o.triggerData);N&&(location.href=N);return}try{y&&await Gr.applyWithStorefront([y])}catch(N){b.error(N),T=!0}let D;if(f?.length&&(D=await s.addToCart(f,o.triggerData)),T&&y){Gr.navigate(y,a,d);return}if(d){location.href=d;return}Gr.navigateWithoutDiscount(a,D)}sendTriggerClicked(e,r,n){let i=new Ie("CE Trigger Clicked",r,this.triggerContext.triggerData);i.items=e,i.setVideos(n),this.eventAPIService.sendSilently(i)}async getOrGenerateDiscountCode(e){let r=this.triggerContext.triggerData.discount;if(!r?.type)return;let n="";if(r.type===er.STATIC){if(!r.code)throw Dh("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return r.code}if(e){if(n=await this.generateDiscount(e),!n)throw b.error("No discount code found",e),new Error("Discount code not found or generated");return n}}async generateDiscount(e){try{return(await this.backendAPIService.generateDiscount(e)).data.code}catch(r){throw br("Failed to generate a discount code"),ae(r,"backend-generate-discount",{triggerContext:this.triggerContext}),r}}};var jl=class{eventAPIService;modifications=[];constructor(){this.eventAPIService=me.get(Hn)}execute(e){for(let r of e){if(!r.experimentConfig)continue;this.executeExperiment(r)&&this.trackExperimentRan(r)}if(document.querySelector("#lc-hide-body")?.remove(),!document.body){xa("No body element found","error");return}this.setupMutationObserver()}executeExperiment(e){let r=e.experimentConfig?.modifications;return r?.length?r.some(n=>{if(!n.cssSelector)return b.verbose("No CSS Selector available",e?.toString()),!1;this.modifications.push(n);let i=Array.from(document.querySelectorAll(n.cssSelector));return i?.length?(this.executeSingleModification(n,i),!0):!1}):(b.log("Nothing to experiment",e.toString()),!0)}executeSingleModification(e,r){if(r?.length)for(let n of r)Object.assign(n.style,e.style),e.type==="TEXT"&&e.text?n.innerHTML=e.text:e.type==="IMAGE"&&this.updateImage(e,n)}trackExperimentRan(e){if(e.id==="preview"){b.warn("Skipping experiment attribution as its preview",e.toString());return}this.eventAPIService.trackExperiment({name:"CE Experiment Start",experiment:new Dn(e)}).catch(r=>{b.error("Fail to track experiment",r)})}setupMutationObserver(){new MutationObserver(r=>{r.forEach(n=>{n.addedNodes.forEach(i=>{i instanceof HTMLElement&&this.modifications.forEach(o=>{i.matches&&i.matches(o.cssSelector)?(b.verbose("Re-applying experiment",o.toString()),this.executeSingleModification(o,[i])):i.querySelectorAll&&(b.verbose("Re-applying experiment",o.toString()),this.executeSingleModification(o,Array.from(i.querySelectorAll(o.cssSelector))))})})})}).observe(document.body,{childList:!0,subtree:!0})}updateImage(e,r){let n=e.image?.lg?.src,i=e.image?.sm?.src;!n&&!i||(r instanceof HTMLPictureElement?this.updatePictureElement({desktop:n,mobile:i},r):this.updateImageElement({desktop:n,mobile:i},r))}updateImageElement(e,r){jr()&&e.mobile?(r.setAttribute("src",e.mobile),r.removeAttribute("srcset")):e.desktop&&(r.setAttribute("src",e.desktop),r.removeAttribute("srcset"))}updatePictureElement(e,r){if(r.innerHTML="",e.mobile){let i=document.createElement("source");i.srcset=e.mobile,i.media="(max-width: 767px)",r.append(i)}if(e.desktop){let i=document.createElement("source");i.srcset=e.desktop,i.media="(min-width: 768px)",r.append(i)}let n=document.createElement("img");n.src=e.desktop??e.mobile??"",r.append(n)}};var Hn=class t extends Un{static INSTANCE;constructor(){super()}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}fetchExperimentsSilently(){this.fetchExperimentsSafe().catch(e=>ae(e,"fetch-experiments"))}async trackExperiment(e){let r=await this.getAllContext(),n=_(_({},e),r);await this.backendAPIService.post("/v1/event/experiment",n)}async fetchExperimentsSafe(){if(!this.runtimeData.activeExperiments)return;_t.getInstance().isAuthenticated()?await this.fetchExperiments():(await Wr(_t.replaySubject),await this.fetchExperiments())}async fetchExperiments(){b.info("Fetch experiments after \u23F0",ye.get().getSDKLoadTimeDiff()+" of SDK load");let e=await this.getAllContext(),r=_({},e);this.backendAPIService.post("/v1/engagement/experiments",r).then(async n=>{b.info(`Experiments fetched in \u23F0 ${gr(n.timeTakenMs)}`);let i=n.data.experiments.map(o=>new xt(o));new jl().execute(i)}).catch(n=>{b.error("Error sending experiment getter",n)})}};var Gl=class{runtimeData=ye.get();widgetAPIService=me.get(qr);experimentAPIService=me.get(Hn);meddle(){let e=Me.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods()}exposeMethods(){let e=Me.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{this.widgetAPIService.loadWidgetsSafe()},e.loadExperiments=()=>{this.experimentAPIService.fetchExperimentsSilently()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=Me.previewWidget.bind(Me),e.previewPopup=Me.previewPopup.bind(Me),e.executeCTA=(r,n)=>{new mn(r).execute(n)},e.sendEvent=r=>{Re.getInstance().sendSafe(r)}}overwritePush(e,r){sn(e,"push",r)}meddleAccount(){this.overwritePush(Me.globalRef.account,(...e)=>{this.processAccount(e[0])}),Me.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Me.globalRef.events,(...e)=>{this.processEvent(e[0])}),Me.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Me.globalRef.profile,(...e)=>{this.processProfile(e[0])}),Me.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&Me.authenticate(e),e.flags&&di.setFlags(e.flags))}processEvent(e){e&&(Cm.includes(e[0])?Me.sendEvent(e[0],e[1],_({occurred:this.runtimeData.jsLoadTime},e[2])):Me.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&Me.updateProfile(e)}processPageName(e){e&&Me.setPageName(e)}meddlePage(){this.overwritePush(Me.globalRef.page,(...e)=>{this.processPage(e[0])}),Me.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&this.runtimeData.setCurrentItem(e.currentItem),e.currency&&(this.runtimeData.currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&Me.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&ve.getCurrent().update(e.cart),e.customContext&&(this.runtimeData.customContext=_(_({},this.runtimeData.customContext),e.customContext))}async testCartUpdate(){if(this.runtimeData.pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=yy();if(e||(e=this.runtimeData.getCurrentItem()?.vID),!e){window.alert("Could not find a variant to test. Please try a different product page");return}let r=new xt({id:"preview",shortID:"1",redirectBehaviour:tr.CART_DRAWER});await new mn(new Cr(new Date,r)).execute({clickAction:{at:we.ADD_TO_CART},embeddedItem:new Rt({vID:e})})}};var xo=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX="cooee".concat("-");static getString(e,r){return this.getItem(e)||r}static setString(e,r){this.setItem(e,r)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,r){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),r)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}};var Co=class t{static INSTANCE;static DEBOUNCE_TIME=1e3;static THRESHOLD=10;lastPercent=0;_lastScreenOrScroll=new Date;constructor(){}set lastScreenOrScroll(e){this._lastScreenOrScroll=e}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}resetScrollID(e){xo.remove("sleid"),this.lastScreenOrScroll=e??new Date}listen(){if(window.scrollY){let e=this.getPercentScrolledY();this.shouldSendScroll(e)&&this.sendScroll(e)}Ui(()=>{this.observeWindowScroll()})}observeWindowScroll(){mi(window,"scroll").pipe(Tr(t.DEBOUNCE_TIME),fn(()=>{let e=this.getPercentScrolledY();if(e>100){b.warn("Received scroll percent is more than 100",e);return}if(this.shouldSendScroll(e))return e})).subscribe(e=>{this.sendScroll(e)})}shouldSendScroll(e){return Math.abs(this.lastPercent-e)>=t.THRESHOLD||this.lastPercent!==e&&e===100}sendScroll(e){if(e==null)return;let r={percent:e,timeMS:new Date().getTime()-this._lastScreenOrScroll.getTime()};this.lastPercent=e;let n=xo.getString("sleid",""),i=new Ie("CE Scroll",r,null,n);me.get(Re).sendSafe(i),xo.setString("sleid",i.id.toHexString()),this._lastScreenOrScroll=new Date(i.occurred)}getPercentScrolledY(){let e=window.document.body.scrollHeight,r=window.innerHeight;return Math.ceil((window.scrollY+r)/e*100)}};var zl=class t{static ACTIVE_DURATION="aDur";static INACTIVE_DURATION="iaDur";runtimeData=ye.get();listen(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?this.onVisible():document.visibilityState==="hidden"&&this.onHidden()}}async onVisible(){}async onHidden(){let e=await this.runtimeData.setInactive();if(e===0){b.info("Not sending background event as user was inactive on website");return}b.info(`Sending background event with ${e} seconds`);let r={};r[t.ACTIVE_DURATION]=e,me.get(Re).sendSafe(new Ie("CE App Background",r))}};var ql=class{listen(){return this.overwriteFetchMethod(),this}overwriteFetchMethod(){let e=this,r=window.fetch;window.fetch=async function(n,i){try{await e.modifyRequest(n,i)}catch(o){ae(o,"modify-graphql-request",{extra:{body:JSON.stringify(i?.body)}})}return r(n,i)},b.verbose("Securely overwritten window.fetch method for graphql query")}async modifyRequest(e,r){let n=typeof e=="string"?e:e instanceof Request?e.url:"";if(!(n.includes("graphql.json")&&r?.method==="POST")||!r.body)return;let i;if(typeof r.body=="string")try{i=JSON.parse(r.body)}catch{return}else i=r.body;i?.variables?.input&&(b.verbose("Intercepted fetch request of:",n),i?.query.includes("cartCreate")&&(r.body=await this.updatedBody(i),this.sendBuyNowEvent()))}async updatedBody(e){let r=e.variables.input.attributes??[],n=await Ya("Buy Now");return e.variables.input.attributes=[...r,...n],JSON.stringify(e)}sendBuyNowEvent(){let e=ye.get().getCurrentItem();if(!e)return;let r=new Ie("Buy Now Clicked",{items:[e]});me.get(Re).sendSafe(r)}};var Ro=class{constructor(e,r){this.selectors=e;this.eventName=r;this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let r=e.currentTarget,n=new Ie(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});me.get(Re).sendSafe(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>b.error(e))}async listen(){this.elements=await Bp(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var Yl=class t extends Ro{static selectors=[".product__thumbnail-list-inner > button","product-gallery-navigation > button",".product-media--thumb-container",".product-images-inner > img",".m-product-media",".swiper-button-control",".media__thumb",".slick-arrow",".productView-img-container.product-single__media",".product-gallery__thumbnail_item_inner"];constructor(){super(t.selectors,"Item Thumbnail Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Kl=class t extends Ro{static selectors=[".jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup","reviewsio-product-ratings",".ruk_rating_snippet.tracked:not(.hidden)","a > .loox-rating",".yotpo-reviews-star-ratings-widget",".yotpo.lp-hero__reviews",".pr-rating > a",".rivyoReviewWidget"];constructor(){super(t.selectors,"Review Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Xl=class{selector=[".gokwik-checkout button","button.cart__checkout-button","button.cart__checkout","button#checkout","button#checkout2",'button[id*="checkout" i]','button[name*="checkout" i]','button[class*="checkout" i]'].join(",");listen(){Ui(()=>{b.verbose("Execution order:","document ready"),this.useLocationHash()})}useLocationHash(){let e=window.location.hash?.substring(1);if(e)if(e.includes("initiate-checkout")){document.dispatchEvent(new Event("letscooee:outbound:third-party-initiate-checkout"));let r=document.querySelector(this.selector);if(!r){b.verbose("No clickable cart checkout button found");return}b.verbose("Clickable cart checkout button found",r),r.click()}else e.includes("open-cart-drawer")&&rt.get().open()}};var zs=class{static attachCheckoutListener(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let e=await ve.getCurrent().getNormalisedCart(),r={via:"GoKwik",items:e.items,cartToken:e.token,amount:{value:e.amount,currency:e.currency}},n=new Ie("Checkout Started",r);me.get(Re).sendSafe(n)})}};var Jl=class{static watch(){let e=ou();(e==="1"||e==="on")&&Pt.getInstance().updateDevicePropsSafe({debugTill:this.getDebugMillis()}),e==="on"?sessionStorage.cooeeDebug="1":e==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&this.renderDebugBar()}static renderDebugBar(){let e=document.createElement("cooee-debugger");e.logs=this.logs,Ui(()=>{document.body.appendChild(e)})}static getDebugMillis(){return new Date().getTime()+360*60*1e3}};var Me=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(window.cooeeSDKPreview)return;let r=(window.CooeeSDK?.pageLoadTime??e).getTime()-e.getTime();b.info(`Initialising SDK after ${gr(r)} of page load`),this.initGlobalReference(e),await me.get(_t).populateAuthDataFromStorage(),this.autoAuthenticate(),new Gl().meddle(),Mm(),me.get(qr).loadWidgetsSafe(!0),me.get(Hn).fetchExperimentsSilently(),new zl().listen(),new Ol().listen(),new ql().listen(),new Xl().listen(),me.get(Co).listen(),me.get(Kl).listenSilently(),me.get(Yl).listenSilently(),this.attachGoKwikListeners(),this.setupPreviewListeners(),Jl.watch()}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(e){window.CooeeSDK||sn(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,sn(this.globalRef,"config",new Xe),sn(this.globalRef,"runtimeData",new ye(e)),sn(this.globalRef,"uaParser",new Sr,!0),sn(this.globalRef,"cartChange$",ev()),sn(this.globalRef,"cartDrawerToggle$",rt.cartDrawerToggle$.asObservable()),b.verbose("Global reference initialised"),new Fc(()=>{this.globalRef.uaParser=new Sr})}static injectWidgetAssets(){Xg(Gt.widgetURL,"cooee-widget-sdk"),If()}static autoAuthenticate(){let e=cc();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;b.info("Begin auth after \u23F0",ye.get().getSDKLoadTimeDiff(),"of SDK load");let r=e.appID?.trim(),n=e.shopifyShop;if((Lp(r)||r.length!==24)&&Lp(n)){b.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,me.get(_t).authenticate(e)}static sendEvent(e,r,n){let i=new Ie(e,r,n?.triggerData);n?.occurred&&(i.occurred=n.occurred),me.get(Re).sendSafe(i)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");me.get(Pt).updateProfileSafe(e)}static setPageName(e){if(!e)return;let r=ye.get(),n=r.pageName;if(e===n)return;if(r.pageName=e,Tm.some(s=>e.includes(s))){me.get(Co).resetScrollID();return}let i={};n&&(i.ps=n);let o=new Ie("CE Screen View",i);o.occurred=r.jsLoadTime,me.get(Re).sendSafe(o),me.get(Co).resetScrollID(o.occurred)}static previewPopup(e,r){new kn(r).render(e)}static previewWidget(e){new bt(new xt(e)).renderSilently()}static setupPreviewListeners(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(e){b.error(e)}window.addEventListener("message",e=>{if(b.verbose("Received event",e),!e.origin.includes("letscooee.com")&&!e.origin.includes("localhost"))return;let r=e.data;typeof r=="object"&&(r.action==="POPUP_PREVIEW"?(this.previewPopup(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)):r.action==="WIDGET_PREVIEW"&&(this.previewWidget(r.engagementTrigger),e.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},e.origin)))})}}static attachGoKwikListeners(){let e=ye.get();window.addEventListener("kp-modal:opened",()=>{e.isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",r=>{let{token:n}=r.detail;n&&this.updateProfile({goKwikToken:n})}),window.gokwikSdk?zs.attachCheckoutListener():window.addEventListener("gokwikLoaded",zs.attachCheckoutListener)}};var C0=new Date;Am();Dm();b.verbose("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(b.verbose("Execution order:","IIFE start"),await Me.initForMerchantWebsiteOnly(C0),await Me.initForAll(),b.verbose("Execution order:","IIFE end")))());b.verbose("Execution order:","bottom");
|