@letscooee/web-sdk 13.1.12 → 13.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,39 +0,0 @@
1
- import{B as Yo,C as Ct,D as zo,E as Jo,G as ne,I as Ei,J as Xo,K as Ko,N as Gr,O as S,a as $r,b as $o,c as jo,g as Ho,i as vi,j as je,k as Tt,n as Rt,o as xt,p as jr,q as re,r as tt,s as Wo,t as Go,u as Hr,v as He,w as Wr,x as rt,z as qo}from"./chunk-NOZTSVSX.js";import{a as B,b as It,e as Vo,g as me}from"./chunk-U4XWPFUW.js";var qi=Vo((En,Ds)=>{"use strict";(function(e,t){typeof En=="object"&&typeof Ds<"u"?t(En):typeof define=="function"&&define.amd?define(["exports"],t):t((e=typeof globalThis<"u"?globalThis:e||self).Sqrl={})})(En,function(e){"use strict";function t(w){var _,T,I=new Error(w);return _=I,T=t.prototype,Object.setPrototypeOf?Object.setPrototypeOf(_,T):_.__proto__=T,I}function r(w,_,T){var I=_.slice(0,T).split(/\n/),x=I.length,L=I[x-1].length+1;throw t(w+=" at line "+x+" col "+L+`:
2
-
3
- `+_.split(/\n/)[x-1]+`
4
- `+Array(L).join(" ")+"^")}t.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(w){if(!(w instanceof SyntaxError))throw w}function o(w,_){return Object.prototype.hasOwnProperty.call(w,_)}function s(w,_,T){for(var I in _)o(_,I)&&(_[I]==null||typeof _[I]!="object"||I!=="storage"&&I!=="prefixes"||T?w[I]=_[I]:w[I]=s({},_[I]));return w}var f=/^async +/,p=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,d=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,m=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,h=/[.*+\-?^${}()|[\]\\]/g;function b(w){return h.test(w)?w.replace(h,"\\$&"):w}function y(w,_){_.rmWhitespace&&(w=w.replace(/[\r\n]+/g,`
5
- `).replace(/^\s+|\s+$/gm,"")),p.lastIndex=0,d.lastIndex=0,m.lastIndex=0;var T=_.prefixes,I=[T.h,T.b,T.i,T.r,T.c,T.e].reduce(function(gt,V){return gt&&V?gt+"|"+b(V):V?b(V):gt},""),x=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+b(_.tags[1])+")","g"),L=new RegExp("([^]*?)"+b(_.tags[0])+"(-|_)?\\s*("+I+")?\\s*","g"),j=0,it=!1;function ft(gt,V){var Q,q={f:[]},et=0,Y="c";function jt(F){var $=w.slice(j,F),k=$.trim();if(Y==="f")k==="safe"?q.raw=!0:_.async&&f.test(k)?(k=k.replace(f,""),q.f.push([k,"",!0])):q.f.push([k,""]);else if(Y==="fp")q.f[q.f.length-1][1]+=k;else if(Y==="err"){if(k){var X=$.search(/\S/);r("invalid syntax",w,j+X)}}else q[Y]=k;j=F+1}for(V==="h"||V==="b"||V==="c"?Y="n":V==="r"&&(q.raw=!0,V="i"),x.lastIndex=j;(Q=x.exec(w))!==null;){var u=Q[1],a=Q[2],c=Q[3],l=Q[4],g=Q[5],v=Q.index;if(u)u==="("?(et===0&&(Y==="n"?(jt(v),Y="p"):Y==="f"&&(jt(v),Y="fp")),et++):u===")"?--et===0&&Y!=="c"&&(jt(v),Y="err"):et===0&&u==="|"?(jt(v),Y="f"):u==="=>"&&(jt(v),j+=1,Y="res");else if(a)if(a==="/*"){var O=w.indexOf("*/",x.lastIndex);O===-1&&r("unclosed comment",w,Q.index),x.lastIndex=O+2}else a==="'"?(d.lastIndex=Q.index,d.exec(w)?x.lastIndex=d.lastIndex:r("unclosed string",w,Q.index)):a==='"'?(m.lastIndex=Q.index,m.exec(w)?x.lastIndex=m.lastIndex:r("unclosed string",w,Q.index)):a==="`"&&(p.lastIndex=Q.index,p.exec(w)?x.lastIndex=p.lastIndex:r("unclosed string",w,Q.index));else if(c)return jt(v),j=v+Q[0].length,L.lastIndex=j,it=g,l&&V==="h"&&(V="s"),q.t=V,q}return r("unclosed tag",w,gt),q}var lt=(function gt(V,Q){V.b=[],V.d=[];var q,et=!1,Y=[];function jt(X,Z){X&&(X=(function(yt,le,$e,wi){var pe,he;return typeof le.autoTrim=="string"?pe=he=le.autoTrim:Array.isArray(le.autoTrim)&&(pe=le.autoTrim[1],he=le.autoTrim[0]),($e||$e===!1)&&(pe=$e),(wi||wi===!1)&&(he=wi),pe==="slurp"&&he==="slurp"?yt.trim():(pe==="_"||pe==="slurp"?yt=String.prototype.trimLeft?yt.trimLeft():yt.replace(/^[\s\uFEFF\xA0]+/,""):pe!=="-"&&pe!=="nl"||(yt=yt.replace(/^(?:\n|\r|\r\n)/,"")),he==="_"||he==="slurp"?yt=String.prototype.trimRight?yt.trimRight():yt.replace(/[\s\uFEFF\xA0]+$/,""):he!=="-"&&he!=="nl"||(yt=yt.replace(/(?:\n|\r|\r\n)$/,"")),yt)})(X,_,it,Z))&&(X=X.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),Y.push(X))}for(;(q=L.exec(w))!==null;){var u,a=q[1],c=q[2],l=q[3]||"";for(var g in T)if(T[g]===l){u=g;break}jt(a,c),j=q.index+q[0].length,u||r("unrecognized tag type: "+l,w,j);var v=ft(q.index,u),O=v.t;if(O==="h"){var F=v.n||"";_.async&&f.test(F)&&(v.a=!0,v.n=F.replace(f,"")),v=gt(v),Y.push(v)}else if(O==="c"){if(V.n===v.n)return et?(et.d=Y,V.b.push(et)):V.d=Y,V;r("Helper start and end don't match",w,q.index+q[0].length)}else if(O==="b"){et?(et.d=Y,V.b.push(et)):V.d=Y;var $=v.n||"";_.async&&f.test($)&&(v.a=!0,v.n=$.replace(f,"")),et=v,Y=[]}else if(O==="s"){var k=v.n||"";_.async&&f.test(k)&&(v.a=!0,v.n=k.replace(f,"")),Y.push(v)}else Y.push(v)}if(!Q)throw t('unclosed helper "'+V.n+'"');return jt(w.slice(j,w.length),!1),V.d=Y,V})({f:[]},!0);if(_.plugins)for(var Et=0;Et<_.plugins.length;Et++){var bt=_.plugins[Et];bt.processAST&&(lt.d=bt.processAST(lt.d,_))}return lt.d}function E(w,_){var T=y(w,_),I="var tR='';"+(_.useWith?"with("+_.varName+"||{}){":"")+N(T,_)+"if(cb){cb(null,tR)} return tR"+(_.useWith?"}":"");if(_.plugins)for(var x=0;x<_.plugins.length;x++){var L=_.plugins[x];L.processFnString&&(I=L.processFnString(I,_))}return I}function D(w,_){for(var T=0;T<_.length;T++){var I=_[T][0],x=_[T][1];w=(_[T][2]?"await ":"")+"c.l('F','"+I+"')("+w,x&&(w+=","+x),w+=")"}return w}function C(w,_,T,I,x,L){var j="{exec:"+(x?"async ":"")+A(T,_,w)+",params:["+I+"]";return L&&(j+=",name:'"+L+"'"),x&&(j+=",async:true"),j+="}"}function R(w,_){for(var T="[",I=0;I<w.length;I++){var x=w[I];T+=C(_,x.res||"",x.d,x.p||"",x.a,x.n),I<w.length&&(T+=",")}return T+="]"}function A(w,_,T){return"function("+_+"){var tR='';"+N(w,T)+"return tR}"}function N(w,_){for(var T=0,I=w.length,x="";T<I;T++){var L=w[T];if(typeof L=="string")x+="tR+='"+L+"';";else{var j=L.t,it=L.c||"",ft=L.f,lt=L.n||"",Et=L.p||"",bt=L.res||"",gt=L.b,V=!!L.a;if(j==="i"){_.defaultFilter&&(it="c.l('F','"+_.defaultFilter+"')("+it+")");var Q=D(it,ft);!L.raw&&_.autoEscape&&(Q="c.l('F','e')("+Q+")"),x+="tR+="+Q+";"}else if(j==="h")if(_.storage.nativeHelpers.get(lt))x+=_.storage.nativeHelpers.get(lt)(L,_);else{var q=(V?"await ":"")+"c.l('H','"+lt+"')("+C(_,bt,L.d,Et,V);q+=gt?","+R(gt,_):",[]",x+="tR+="+D(q+=",c)",ft)+";"}else j==="s"?x+="tR+="+D((V?"await ":"")+"c.l('H','"+lt+"')({params:["+Et+"]},[],c)",ft)+";":j==="e"&&(x+=it+`
6
- `)}}return x}var P=(function(){function w(_){this.cache=_}return w.prototype.define=function(_,T){this.cache[_]=T},w.prototype.get=function(_){return this.cache[_]},w.prototype.remove=function(_){delete this.cache[_]},w.prototype.reset=function(){this.cache={}},w.prototype.load=function(_){s(this.cache,_,!0)},w})();function G(w,_,T,I){if(_&&_.length>0)throw t((I?"Native":"")+"Helper '"+w+"' doesn't accept blocks");if(T&&T.length>0)throw t((I?"Native":"")+"Helper '"+w+"' doesn't accept filters")}var ct={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Ot(w){return ct[w]}var Vt=new P({}),St=new P({each:function(w,_){var T="",I=w.params[0];if(G("each",_,!1),w.async)return new Promise(function(L){(function j(it,ft,lt,Et,bt){lt(it[ft],ft).then(function(gt){Et+=gt,ft===it.length-1?bt(Et):j(it,ft+1,lt,Et,bt)})})(I,0,w.exec,T,L)});for(var x=0;x<I.length;x++)T+=w.exec(I[x],x);return T},foreach:function(w,_){var T=w.params[0];if(G("foreach",_,!1),w.async)return new Promise(function(L){(function j(it,ft,lt,Et,bt,gt){Et(ft[lt],it[ft[lt]]).then(function(V){bt+=V,lt===ft.length-1?gt(bt):j(it,ft,lt+1,Et,bt,gt)})})(T,Object.keys(T),0,w.exec,"",L)});var I="";for(var x in T)o(T,x)&&(I+=w.exec(x,T[x]));return I},include:function(w,_,T){G("include",_,!1);var I=T.storage.templates.get(w.params[0]);if(!I)throw t('Could not fetch template "'+w.params[0]+'"');return I(w.params[1],T)},extends:function(w,_,T){var I=w.params[1]||{};I.content=w.exec();for(var x=0;x<_.length;x++){var L=_[x];I[L.name]=L.exec()}var j=T.storage.templates.get(w.params[0]);if(!j)throw t('Could not fetch template "'+w.params[0]+'"');return j(I,T)},useScope:function(w,_){return G("useScope",_,!1),w.exec(w.params[0])}}),Yt=new P({if:function(w,_){G("if",!1,w.f,!0);var T="if("+w.p+"){"+N(w.d,_)+"}";if(w.b)for(var I=0;I<w.b.length;I++){var x=w.b[I];x.n==="else"?T+="else{"+N(x.d,_)+"}":x.n==="elif"&&(T+="else if("+x.p+"){"+N(x.d,_)+"}")}return T},try:function(w,_){if(G("try",!1,w.f,!0),!w.b||w.b.length!==1||w.b[0].n!=="catch")throw t("native helper 'try' only accepts 1 block, 'catch'");var T="try{"+N(w.d,_)+"}",I=w.b[0];return T+="catch"+(I.res?"("+I.res+")":"")+"{"+N(I.d,_)+"}"},block:function(w,_){return G("block",w.b,w.f,!0),"if(!"+_.varName+"["+w.p+"]){tR+=("+A(w.d,"",_)+")()}else{tR+="+_.varName+"["+w.p+"]}"}}),ut=new P({e:function(w){var _=String(w);return/[&<>"']/.test(_)?_.replace(/[&<>"']/g,Ot):_}}),dt={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(w,_){if(w==="H"){var T=this.storage.helpers.get(_);if(T)return T;throw t("Can't find helper '"+_+"'")}if(w==="F"){var I=this.storage.filters.get(_);if(I)return I;throw t("Can't find filter '"+_+"'")}},async:!1,storage:{helpers:St,nativeHelpers:Yt,filters:ut,templates:Vt},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function zt(w,_){var T={};return s(T,dt),_&&s(T,_),w&&s(T,w),T.l.bind(T),T}function $t(w,_){var T,I=zt(_||{}),x=Function;if(I.async){if(!i)throw t("This environment doesn't support async/await");x=i}if(I.varName&&(T=I.varName,/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(T)===!1))throw t("options.varName must be a valid JS identifier");try{return new x(I.varName,"c","cb",E(w,I))}catch(L){throw L instanceof SyntaxError?t(`Bad template syntax
7
-
8
- `+L.message+`
9
- `+Array(L.message.length+1).join("=")+`
10
- `+E(w,I)):L}}function fe(w,_){var T;return _.cache&&_.name&&_.storage.templates.get(_.name)?_.storage.templates.get(_.name):(T=typeof w=="function"?w:$t(w,_),_.cache&&_.name&&_.storage.templates.define(_.name,T),T)}dt.l.bind(dt),e.compile=$t,e.compileScope=N,e.compileScopeIntoFunction=A,e.compileToString=E,e.defaultConfig=dt,e.filters=ut,e.getConfig=zt,e.helpers=St,e.nativeHelpers=Yt,e.parse=y,e.render=function(w,_,T,I){var x=zt(T||{});if(!x.async)return fe(w,x)(_,x);if(!I){if(typeof n=="function")return new n(function(L,j){try{L(fe(w,x)(_,x))}catch(it){j(it)}});throw t("Please provide a callback function, this env doesn't support Promises")}try{fe(w,x)(_,x,I)}catch(L){return I(L)}},e.templates=Vt,Object.defineProperty(e,"__esModule",{value:!0})})});var Ro=Vo(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.URLBuilder=void 0;var If=(function(){function e(t){try{this.base=new URL(t),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return e.prototype.appendQueryParam=function(t,r){this.params.append(t,r?r.toString():"")},e.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},e.prototype.deleteQueryParam=function(t){this.params.delete(t)},e.prototype.getBase=function(){return this.base},e.prototype.getPath=function(){return this.base.pathname},e.prototype.getHostname=function(){return this.base.hostname},e.prototype.getParams=function(){return this.params},e.prototype.getQueryParam=function(t){if(!this.params)return"";var r=this.params.get(t);return!r||r==="undefined"||r==="null"?void 0:r},e.prototype.getQueryString=function(){return this.params.toString()},e.prototype.setPath=function(t){return this.base.pathname=t,this},e.prototype.setQueryParam=function(t,r){return this.params.set(t,r?r.toString():""),this},e.prototype.setQueryString=function(t){if(t)return t[0]==="?"&&(t=t.slice(1)),this.params=new URLSearchParams(t),this},e.prototype.toString=function(){var t=this.params.toString();return t===""?this.base.search="":this.base.search="?"+t,this.base.toString()},e})();li.URLBuilder=If});var qr=class{constructor(t,r){this._startTime=t;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 t=this.triggerData.shortID??this.triggerData.id.slice(-6);return t==="test"&&(t="test-"+this.startTime.getTime().toString()),"cooee-wrapper-"+t}get selectedItems(){return this.triggerData.items.filter(t=>t.selected.value)}get shouldGiveFBTDiscount(){let t=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=t:t===this.triggerData.items.length}onClose(t){this.closeCallback=t}closeInApp(t,r){r??={};let n=(new Date().getTime()-this.startTime.getTime())/1e3,i=B({eventName:t,duration:n},r);this.stopIntervals(),this.closeCallback&&this.closeCallback(i)}addInputField(t,r){this.inputFields.push({id:t,type:r,isValid:!1})}updateValidation(t,r){this.inputFields.forEach(n=>{if(n.id===t){n.isValid=r;return}})}hasManipulatedProductQuantity(){let t=this.triggerData.manipulation.productQuantity;return t?.enabled&&t.min!=null&&t.max!=null}getManipulatedQuantity(t){let{min:r=1,max:n=100}=this.triggerData.manipulation.productQuantity;if(r>n)return S.error("Invalid range: min should be less than or equal to max."),t;if(t>=r&&t<=n)return t;let i=t%100;return i<r?r:i>n?n:i}stopIntervals(){this.intervals.forEach(t=>clearInterval(t))}};var Ie=class{s;g;i;constructor(t){t.s&&(this.s=new K(t.s)),t.g&&(this.g=new hr(t.g)),this.i=t.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var mr="a-f\\d",Dc=`#?[${mr}]{3}[${mr}]?`,Rc=`#?[${mr}]{6}([${mr}]{2})?`,Pc=new RegExp(`[^#${mr}]`,"gi"),Ac=new RegExp(`^${Dc}$|^${Rc}$`,"i");function bi(e,t={}){if(typeof e!="string"||Pc.test(e)||!Ac.test(e))throw new TypeError("Expected a valid hex string");e=e.replace(/^#/,"");let r=1;e.length===8&&(r=Number.parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)),e.length===4&&(r=Number.parseInt(e.slice(3,4).repeat(2),16)/255,e=e.slice(0,3)),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);let n=Number.parseInt(e,16),i=n>>16,o=n>>8&255,s=n&255,f=typeof t.alpha=="number"?t.alpha:r;if(t.format==="array")return[i,o,s,f];if(t.format==="css"){let p=f===1?"":` / ${Number((f*100).toFixed(2))}%`;return`rgb(${i} ${o} ${s}${p})`}return{red:i,green:o,blue:s,alpha:f}}var K=class{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return bi(this.hex,{format:"css",alpha:this.getAlpha()})}catch(t){return console.error("Invalid hex",t),"#000000"}}getAlpha(){return(this.a??100)/100}};var oe=class{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new K(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return Yr[this.s??1]}},Yr=(r=>(r[r.SOLID=1]="SOLID",r[r.DASHED=2]="DASHED",r))(Yr||{});var hr=class e{static DEFAULT_FALLBACK=new K({h:"#000000",a:50});r;c;fb;constructor(t){this.r=t.r,t.c&&(this.c=new K(t.c)),t.fb&&(this.fb=new K(t.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??e.DEFAULT_FALLBACK}};var dr=class{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new K(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}};var se=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.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 gr=class{rot;constructor(t){t?.rot&&(this.rot=t.rot)}get rotate(){return this.rot}};var Nt=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new Ie(t.bg)),t.br&&(this.br=new oe(t.br)),t.shd&&(this.shd=new dr(t.shd)),t.spc&&(this.spc=new se(t.spc)),this.trf=new gr(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return pt[this.t]}get click(){return this.clc}},pt=(N=>(N[N.IMAGE=1]="IMAGE",N[N.TEXT=2]="TEXT",N[N.BUTTON=3]="BUTTON",N[N.FLEXBOX=4]="FLEXBOX",N[N.MULTI_COLUMN=5]="MULTI_COLUMN",N[N.CHECKBOX=6]="CHECKBOX",N[N.PRODUCTS=11]="PRODUCTS",N[N.PRODUCT=12]="PRODUCT",N[N.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",N[N.PRODUCT_TITLE=14]="PRODUCT_TITLE",N[N.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",N[N.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",N[N.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",N[N.PRODUCT_RATING=19]="PRODUCT_RATING",N[N.EMAIL_INPUT=51]="EMAIL_INPUT",N[N.PHONE_INPUT=52]="PHONE_INPUT",N[N.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",N[N.CAROUSEL=62]="CAROUSEL",N[N.SHAPE=100]="SHAPE",N))(pt||{});var yr=class extends Nt{constructor(t){super(t)}};var xe=class extends Nt{src;constructor(t){super(t),this.src=t.src}};var zr=(i=>(i[i.START=0]="START",i[i.CENTER=1]="CENTER",i[i.END=2]="END",i[i.JUSTIFY=3]="JUSTIFY",i))(zr||{});var Jr=class{name;fonts;constructor(t){t=t??{},t.name&&(t.name=t.name!=="Arial"?t.name:""),this.name=t.name,this.fonts=t.fonts?.map(r=>new Si(r))}},Si=class{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.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 Ht=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t)}get alignment(){return zr[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(t){t=t??{},t.lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new K(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new K(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new Jr(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}};var de=class extends Nt{typo;constructor(t){super(t);let r=B(B({},t.f),t.typo);t.alg&&(r.ta=t.alg),t.c&&(r.tc=t.c),this.typo=new Ht(r)}get color(){return this.typography.tc}get typography(){return this.typo}};var We=class extends de{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}};var Ge=class{dd;hh;mm;ss;date;constructor(t){t??={},this.dd=t.dd??0,this.hh=t.hh??0,this.mm=t.mm??0,this.ss=t.ss??0,this.date=t.date?new Date(t.date):void 0}start(t,r){let n=new Date;t===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 f=Math.floor(s/(1e3*60*60*24)),p=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),d=Math.floor(s%(1e3*60*60)/(1e3*60)),m=Math.floor(s%(1e3*60)/1e3);r({days:f,hours:p,minutes:d,seconds:m})},1e3);return i}};var Xr=class extends de{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t),this.gap=t.gap,this.timerType=t.type,this.timer=new Ge(t.timer),this.show=t.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}};var Kr=class{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new K(t.c??{})}get text(){return this.txt}get color(){return this.c}};var ge=class extends de{ph;constructor(t){super(t),this.ph=new Kr(t.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var Qr=class extends ge{constructor(t){t??={},super(t)}};var Zr=class extends ge{};var tn=class extends ge{};var en=class extends xe{};var Jt=(function(e){return e[e.NONE=0]="NONE",e[e.STATIC=1]="STATIC",e[e.UNIQUE_FLAT=2]="UNIQUE_FLAT",e[e.UNIQUE_FLAT_ITEMS=3]="UNIQUE_FLAT_ITEMS",e[e.UNIQUE_FIXED_ITEMS=4]="UNIQUE_FIXED_ITEMS",e[e.UNIQUE_CHEAPEST_ITEM_FREE=5]="UNIQUE_CHEAPEST_ITEM_FREE",e[e.BXGY=6]="BXGY",e})(Jt||{});var _r=(function(e){return e[e.SINGLE=1]="SINGLE",e[e.EXCLUSION=2]="EXCLUSION",e[e.ABTESTING=3]="ABTESTING",e})(_r||{});var Ii=(function(e){return e[e.NONE=0]="NONE",e[e.ITEM=1]="ITEM",e[e.COLLECTION=2]="COLLECTION",e})(Ii||{});var Lc=(function(e){return e.BEFORE="before",e.AFTER="after",e.INSIDE_FIRST="insideFirst",e.INSIDE_LAST="insideLast",e.BEFORE1="BEFORE",e.AFTER1="AFTER",e.INSIDE_FIRST1="INSIDE_FIRST",e.INSIDE_LAST1="INSIDE_LAST",e})(Lc||{}),Xt=(function(e){return e.SHOPIFY_CHECKOUT="shopify_checkout",e.THIRD_PARTY_CHECKOUT="third_party_checkout",e.CART_PAGE="cart_page",e.CART_DRAWER="cart_drawer",e})(Xt||{});var ot=(function(e){return e[e.NONE=0]="NONE",e[e.REJECT_POPUP=1]="REJECT_POPUP",e[e.ACCEPT_POPUP=2]="ACCEPT_POPUP",e[e.GO_TO_URL=4]="GO_TO_URL",e[e.SHARE=5]="SHARE",e[e.KEY_VALUE=100]="KEY_VALUE",e[e.GO_TO_PRODUCT=101]="GO_TO_PRODUCT",e[e.ADD_TO_CART=102]="ADD_TO_CART",e[e.COPY_COUPON_CODE=103]="COPY_COUPON_CODE",e[e.GO_TO_COLLECTION=104]="GO_TO_COLLECTION",e[e.OPEN_CART=105]="OPEN_CART",e[e.SUBMIT_FORM=106]="SUBMIT_FORM",e[e.INITIATE_CHECKOUT=107]="INITIATE_CHECKOUT",e[e.ADD_BUNDLE=108]="ADD_BUNDLE",e[e.UPGRADE_TO_SUBSCRIPTION=109]="UPGRADE_TO_SUBSCRIPTION",e[e.BUY_NOW=110]="BUY_NOW",e[e.QUICK_VIEW=111]="QUICK_VIEW",e})(ot||{}),wr=(function(e){return e.POPUP="POPUP",e.PAGE_EMBED="PAGE_EMBED",e.CART_EMBED="CART_EMBED",e.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",e})(wr||{}),Pt=(function(e){return e.PRODUCT_PROMOTION="PRODUCT_PROMOTION",e.BUNDLE_AND_UPSELL="BUNDLE_AND_UPSELL",e.CART_RECOVERY="CART_RECOVERY",e.ANNOUNCEMENT="ANNOUNCEMENT",e.LEAD_GENERATION="LEAD_GENERATION",e.DATA_COLLECTION="DATA_COLLECTION",e.SALE_PROMOTION="SALE_PROMOTION",e.SUBSCRIPTION_UPSELL="SUBSCRIPTION_UPSELL",e.SHOPPABLE_VIDEO="SHOPPABLE_VIDEO",e.BYOB="BYOB",e.PROGRESS_BAR="PROGRESS_BAR",e.BUY_NOW="BUY_NOW",e.STICKY_ATC="STICKY_ATC",e.EXPERIMENT="EXPERIMENT",e.SAVINGS_BAR="SAVINGS_BAR",e.COLLECTION_FILTER="COLLECTION_FILTER",e})(Pt||{}),vr=(function(e){return e.COOEE="COOEE",e.KLAVIYO="KLAVIYO",e})(vr||{}),xi=(function(e){return e.ICONS="ICONS",e.TILES="TILES",e})(xi||{}),Uc=(function(e){return e.FREE_SHIPPING="FREE_SHIPPING",e.DISCOUNT="DISCOUNT",e.FREE_AUTO_GIFT="FREE_AUTO_GIFT",e.FREE_GIFT_SELECT="FREE_GIFT_SELECT",e.UI_ONLY="UI_ONLY",e})(Uc||{});var Oe=class e{static of(t,r){return r!==void 0?new Array(t).fill(r):Array.from({length:t},(n,i)=>i)}static remove(t,r){let n=t.indexOf(r);return n===-1?!1:(t.splice(n,1),!0)}static swap(t,r,n){[t[r],t[n]]=[t[n],t[r]]}static sum(t,r){return t.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(t,r){return t.filter((n,i,o)=>o.findIndex(s=>s[r]===n[r])===i)}static shuffle(t){let r=t.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,e.swap(t,r,n)}}};var Qo=(()=>{class e{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 e})();var rn=class{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}};var nn=class{modifications;constructor(t={}){t.modifications?.length?this.modifications=t.modifications.map(r=>new on(r)):t.experiments?.length&&(this.modifications=t.experiments.map(r=>new on(r)))}};var on=class{cssSelector;type;display;bg;typo;br;text;image;moveTo;constructor(t={}){this.cssSelector=t.cssSelector??"",this.type=t.type??"OTHER",this.display=t.display,t.bg&&(this.bg=new K(t.bg)),t.typo&&(this.typo=new Ht(t.typo)),t.br&&(this.br=new oe(t.br)),this.text=t.text,this.image=t.image,this.moveTo=t.moveTo}get style(){let t={};return this.br?.r&&(t.borderRadius=this.br.r+"px"),this.br?.w&&(t.borderWidth=this.br.w+"px"),this.br?.s&&(t.borderStyle=Yr[this.br.s]?.toLowerCase()),this.br?.c?.h&&(t.borderColor=this.br.color?.rgba),this.bg?.h&&(t.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(t.fontSize=this.typo.fs+"px"),this.typo.lh&&(t.lineHeight=this.typo.lh),this.typo.fw&&(t.fontWeight=this.typo.fw),this.typo.ta&&(t.textAlign=this.typo.alignment),this.typo.tc.h&&(t.color=this.typo.tc.rgba),this.typo.ls&&(t.letterSpacing=this.typo.letterSpacing),this.typo.td&&(t.textDecoration=this.typo.td??"none")),t}toString(){return`Experiment(cssSelector=${this.cssSelector})`}};var Kt=class{id;mID;vID;vName;imageURL;name;link;quantity;price;finalPrice;constructor(t){this.id=t.id,this.mID=t.mID,this.vID=t.vID,this.vName=t.vName,this.imageURL=t.imageURL,this.name=t.name,this.link=t.link,this.quantity=t.quantity,this.price=t.price,this.finalPrice=t.finalPrice??t.price}};var Oi=class{minValue;rewardType;label;reachingText;reachedText;discount;items;isUIOnly;allowATC;reached;calculatedAlignment;constructor(t){this.reached=t.reached??!1,this.calculatedAlignment=t.calculatedAlignment,this.minValue=t.minValue,this.rewardType=t.rewardType,this.label=t.label,this.reachingText=t.reachingText,this.reachedText=t.reachedText,this.discount=t.discount,this.items=t.items?.map(r=>new Kt(r)),this.isUIOnly=t.isUIOnly,this.allowATC=t.allowATC}};var sn=class{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(t){this.layout=t.layout??xi.ICONS,this.onlyLatestGift=t.onlyLatestGift,this.noConfetti=t.noConfetti,this.removeIneligibleItem=t.removeIneligibleItem??!0,this.restrictToLatestFreebie=t.restrictToLatestFreebie,this.rewardBasis=t.rewardBasis??"CART_AMOUNT",this.update(t)}update(t){t=t??{},this.milestones=t.milestones?.map(r=>new Oi(r))??[],this.totalProgress=t.totalProgress??0,this.coupons=t.coupons,this.reachedAmountOrCount=t.reachedAmountOrCount}};var an=class{animateNumber;animationDuration;text;iconURL;animation;totalSavings;constructor(t={}){this.animateNumber=t.animateNumber??!0,this.animation=t.animation??"SLOT_MACHINE",this.animationDuration=t.animationDuration??1e3,this.text=t.text??"You are saving {{ cart.total_savings }} on this order",this.iconURL=t.iconURL,this.totalSavings=t.totalSavings??0}};var ln,W,ns,Ni,Te,Zo,is,os,ss,Di,Ti,Ci,Bc,Er={},as=[],Mc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,pn=Array.isArray;function ae(e,t){for(var r in t)e[r]=t[r];return e}function Ri(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Fc(e,t,r){var n,i,o,s={};for(o in t)o=="key"?n=t[o]:o=="ref"?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?ln.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return un(e,s,n,i,null)}function un(e,t,r,n,i){var o={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++ns,__i:-1,__u:0};return i==null&&W.vnode!=null&&W.vnode(o),o}function hn(e){return e.children}function qe(e,t){this.props=e,this.context=t}function Ye(e,t){if(t==null)return e.__?Ye(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Ye(e):null}function cs(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return cs(e)}}function ts(e){(!e.__d&&(e.__d=!0)&&Te.push(e)&&!fn.__r++||Zo!=W.debounceRendering)&&((Zo=W.debounceRendering)||is)(fn)}function fn(){for(var e,t,r,n,i,o,s,f=1;Te.length;)Te.length>f&&Te.sort(os),e=Te.shift(),f=Te.length,e.__d&&(r=void 0,i=(n=(t=e).__v).__e,o=[],s=[],t.__P&&((r=ae({},n)).__v=n.__v+1,W.vnode&&W.vnode(r),Pi(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[i]:null,o,i??Ye(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,ls(o,r,s),r.__e!=i&&cs(r)));fn.__r=0}function us(e,t,r,n,i,o,s,f,p,d,m){var h,b,y,E,D,C,R=n&&n.__k||as,A=t.length;for(p=kc(r,t,R,p,A),h=0;h<A;h++)(y=r.__k[h])!=null&&(b=y.__i==-1?Er:R[y.__i]||Er,y.__i=h,C=Pi(e,y,b,i,o,s,f,p,d,m),E=y.__e,y.ref&&b.ref!=y.ref&&(b.ref&&Ai(b.ref,null,y),m.push(y.ref,y.__c||E,y)),D==null&&E!=null&&(D=E),4&y.__u||b.__k===y.__k?p=fs(y,p,e):typeof y.type=="function"&&C!==void 0?p=C:E&&(p=E.nextSibling),y.__u&=-7);return r.__e=D,p}function kc(e,t,r,n,i){var o,s,f,p,d,m=r.length,h=m,b=0;for(e.__k=new Array(i),o=0;o<i;o++)(s=t[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(p=o+b,(s=e.__k[o]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?un(null,s,null,null,null):pn(s)?un(hn,{children:s},null,null,null):s.constructor==null&&s.__b>0?un(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,f=null,(d=s.__i=Vc(s,r,p,h))!=-1&&(h--,(f=r[d])&&(f.__u|=2)),f==null||f.__v==null?(d==-1&&(i>m?b--:i<m&&b++),typeof s.type!="function"&&(s.__u|=4)):d!=p&&(d==p-1?b--:d==p+1?b++:(d>p?b--:b++,s.__u|=4))):e.__k[o]=null;if(h)for(o=0;o<m;o++)(f=r[o])!=null&&(2&f.__u)==0&&(f.__e==n&&(n=Ye(f)),hs(f,f));return n}function fs(e,t,r){var n,i;if(typeof e.type=="function"){for(n=e.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=e,t=fs(n[i],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=Ye(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Vc(e,t,r,n){var i,o,s=e.key,f=e.type,p=t[r];if(p===null&&e.key==null||p&&s==p.key&&f==p.type&&(2&p.__u)==0)return r;if(n>(p!=null&&(2&p.__u)==0?1:0))for(i=r-1,o=r+1;i>=0||o<t.length;){if(i>=0){if((p=t[i])&&(2&p.__u)==0&&s==p.key&&f==p.type)return i;i--}if(o<t.length){if((p=t[o])&&(2&p.__u)==0&&s==p.key&&f==p.type)return o;o++}}return-1}function es(e,t,r){t[0]=="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||Mc.test(t)?r:r+"px"}function cn(e,t,r,n,i){var o,s;t:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||es(e.style,t,"");if(r)for(t in r)n&&r[t]==n[t]||es(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(ss,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=r,r?n?r.u=n.u:(r.u=Di,e.addEventListener(t,o?Ci:Ti,o)):e.removeEventListener(t,o?Ci:Ti,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r??"";break t}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function rs(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.t==null)t.t=Di++;else if(t.t<r.u)return;return r(W.event?W.event(t):t)}}}function Pi(e,t,r,n,i,o,s,f,p,d){var m,h,b,y,E,D,C,R,A,N,P,G,ct,Ot,Vt,St,Yt,ut=t.type;if(t.constructor!=null)return null;128&r.__u&&(p=!!(32&r.__u),o=[f=t.__e=r.__e]),(m=W.__b)&&m(t);t:if(typeof ut=="function")try{if(R=t.props,A="prototype"in ut&&ut.prototype.render,N=(m=ut.contextType)&&n[m.__c],P=m?N?N.props.value:m.__:n,r.__c?C=(h=t.__c=r.__c).__=h.__E:(A?t.__c=h=new ut(R,P):(t.__c=h=new qe(R,P),h.constructor=ut,h.render=jc),N&&N.sub(h),h.props=R,h.state||(h.state={}),h.context=P,h.__n=n,b=h.__d=!0,h.__h=[],h._sb=[]),A&&h.__s==null&&(h.__s=h.state),A&&ut.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=ae({},h.__s)),ae(h.__s,ut.getDerivedStateFromProps(R,h.__s))),y=h.props,E=h.state,h.__v=t,b)A&&ut.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),A&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(A&&ut.getDerivedStateFromProps==null&&R!==y&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(R,P),!h.__e&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(R,h.__s,P)===!1||t.__v==r.__v){for(t.__v!=r.__v&&(h.props=R,h.state=h.__s,h.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(dt){dt&&(dt.__=t)}),G=0;G<h._sb.length;G++)h.__h.push(h._sb[G]);h._sb=[],h.__h.length&&s.push(h);break t}h.componentWillUpdate!=null&&h.componentWillUpdate(R,h.__s,P),A&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(y,E,D)})}if(h.context=P,h.props=R,h.__P=e,h.__e=!1,ct=W.__r,Ot=0,A){for(h.state=h.__s,h.__d=!1,ct&&ct(t),m=h.render(h.props,h.state,h.context),Vt=0;Vt<h._sb.length;Vt++)h.__h.push(h._sb[Vt]);h._sb=[]}else do h.__d=!1,ct&&ct(t),m=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++Ot<25);h.state=h.__s,h.getChildContext!=null&&(n=ae(ae({},n),h.getChildContext())),A&&!b&&h.getSnapshotBeforeUpdate!=null&&(D=h.getSnapshotBeforeUpdate(y,E)),St=m,m!=null&&m.type===hn&&m.key==null&&(St=ps(m.props.children)),f=us(e,pn(St)?St:[St],t,r,n,i,o,s,f,p,d),h.base=t.__e,t.__u&=-161,h.__h.length&&s.push(h),C&&(h.__E=h.__=null)}catch(dt){if(t.__v=null,p||o!=null)if(dt.then){for(t.__u|=p?160:128;f&&f.nodeType==8&&f.nextSibling;)f=f.nextSibling;o[o.indexOf(f)]=null,t.__e=f}else for(Yt=o.length;Yt--;)Ri(o[Yt]);else t.__e=r.__e,t.__k=r.__k;W.__e(dt,t,r)}else o==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):f=t.__e=$c(r.__e,t,r,n,i,o,s,p,d);return(m=W.diffed)&&m(t),128&t.__u?void 0:f}function ls(e,t,r){for(var n=0;n<r.length;n++)Ai(r[n],r[++n],r[++n]);W.__c&&W.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){W.__e(o,i.__v)}})}function ps(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:pn(e)?e.map(ps):ae({},e)}function $c(e,t,r,n,i,o,s,f,p){var d,m,h,b,y,E,D,C=r.props,R=t.props,A=t.type;if(A=="svg"?i="http://www.w3.org/2000/svg":A=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(d=0;d<o.length;d++)if((y=o[d])&&"setAttribute"in y==!!A&&(A?y.localName==A:y.nodeType==3)){e=y,o[d]=null;break}}if(e==null){if(A==null)return document.createTextNode(R);e=document.createElementNS(i,A,R.is&&R),f&&(W.__m&&W.__m(t,o),f=!1),o=null}if(A==null)C===R||f&&e.data==R||(e.data=R);else{if(o=o&&ln.call(e.childNodes),C=r.props||Er,!f&&o!=null)for(C={},d=0;d<e.attributes.length;d++)C[(y=e.attributes[d]).name]=y.value;for(d in C)if(y=C[d],d!="children"){if(d=="dangerouslySetInnerHTML")h=y;else if(!(d in R)){if(d=="value"&&"defaultValue"in R||d=="checked"&&"defaultChecked"in R)continue;cn(e,d,null,y,i)}}for(d in R)y=R[d],d=="children"?b=y:d=="dangerouslySetInnerHTML"?m=y:d=="value"?E=y:d=="checked"?D=y:f&&typeof y!="function"||C[d]===y||cn(e,d,y,C[d],i);if(m)f||h&&(m.__html==h.__html||m.__html==e.innerHTML)||(e.innerHTML=m.__html),t.__k=[];else if(h&&(e.innerHTML=""),us(t.type=="template"?e.content:e,pn(b)?b:[b],t,r,n,A=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:r.__k&&Ye(r,0),f,p),o!=null)for(d=o.length;d--;)Ri(o[d]);f||(d="value",A=="progress"&&E==null?e.removeAttribute("value"):E!=null&&(E!==e[d]||A=="progress"&&!E||A=="option"&&E!=C[d])&&cn(e,d,E,C[d],i),d="checked",D!=null&&D!=e[d]&&cn(e,d,D,C[d],i))}return e}function Ai(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(i){W.__e(i,r)}}function hs(e,t,r){var n,i;if(W.unmount&&W.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||Ai(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){W.__e(o,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&hs(n[i],t,r||typeof e.type!="function");r||Ri(e.__e),e.__c=e.__=e.__e=void 0}function jc(e,t,r){return this.constructor(e,r)}function Jp(e,t,r){var n,i,o,s;t==document&&(t=document.documentElement),W.__&&W.__(e,t),i=(n=typeof r=="function")?null:r&&r.__k||t.__k,o=[],s=[],Pi(t,e=(!n&&r||t).__k=Fc(hn,null,[e]),i||Er,Er,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?ln.call(t.childNodes):null,o,!n&&r?r:i?i.__e:t.firstChild,n,s),ls(o,e,s)}ln=as.slice,W={__e:function(e,t,r,n){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),s=i.__d),s)return i.__E=i}catch(f){e=f}throw e}},ns=0,Ni=function(e){return e!=null&&e.constructor==null},qe.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ae({},this.state),typeof e=="function"&&(e=e(ae({},r),this.props)),e&&ae(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),ts(this))},qe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ts(this))},qe.prototype.render=hn,Te=[],is=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,os=function(e,t){return e.__v.__b-t.__v.__b},fn.__r=0,ss=/(PointerCapture)$|Capture$/i,Di=0,Ti=rs(!1),Ci=rs(!0),Bc=0;var Ui,Dt,Li,ms,ds=0,Ss=[],st=W,gs=st.__b,ys=st.__r,_s=st.diffed,ws=st.__c,vs=st.unmount,Es=st.__;function Hc(e,t){st.__h&&st.__h(Dt,e,ds||t),ds=0;var r=Dt.__H||(Dt.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Mi(e,t){var r=Hc(Ui++,7);return qc(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Wc(){for(var e;e=Ss.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(mn),e.__H.__h.forEach(Bi),e.__H.__h=[]}catch(t){e.__H.__h=[],st.__e(t,e.__v)}}st.__b=function(e){Dt=null,gs&&gs(e)},st.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Es&&Es(e,t)},st.__r=function(e){ys&&ys(e),Ui=0;var t=(Dt=e.__c).__H;t&&(Li===Dt?(t.__h=[],Dt.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(mn),t.__h.forEach(Bi),t.__h=[],Ui=0)),Li=Dt},st.diffed=function(e){_s&&_s(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ss.push(t)!==1&&ms===st.requestAnimationFrame||((ms=st.requestAnimationFrame)||Gc)(Wc)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Li=Dt=null},st.__c=function(e,t){t.some(function(r){try{r.__h.forEach(mn),r.__h=r.__h.filter(function(n){return!n.__||Bi(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],st.__e(n,r.__v)}}),ws&&ws(e,t)},st.unmount=function(e){vs&&vs(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{mn(n)}catch(i){t=i}}),r.__H=void 0,t&&st.__e(t,r.__v))};var bs=typeof requestAnimationFrame=="function";function Gc(e){var t,r=function(){clearTimeout(n),bs&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,35);bs&&(t=requestAnimationFrame(r))}function mn(e){var t=Dt,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),Dt=t}function Bi(e){var t=Dt;e.__c=e.__(),Dt=t}function qc(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}var Yc=Symbol.for("preact-signals");function ki(){if(ze>1)ze--;else{for(var e,t=!1;br!==void 0;){var r=br;for(br=void 0,Fi++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&xs(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(Fi=0,ze--,t)throw e}}var J=void 0;var br=void 0,ze=0,Fi=0,dn=0;function Is(e){if(J!==void 0){var t=e.n;if(t===void 0||t.t!==J)return t={i:0,S:e,p:J.s,n:void 0,t:J,e:void 0,x:void 0,r:t},J.s!==void 0&&(J.s.n=t),J.s=t,e.n=t,32&J.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=J.s,t.n=void 0,J.s.n=t,J.s=t),t}}function at(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}at.prototype.brand=Yc;at.prototype.h=function(){return!0};at.prototype.S=function(e){this.t!==e&&e.e===void 0&&(e.x=this.t,this.t!==void 0&&(this.t.e=e),this.t=e)};at.prototype.U=function(e){if(this.t!==void 0){var t=e.e,r=e.x;t!==void 0&&(t.x=r,e.e=void 0),r!==void 0&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r)}};at.prototype.subscribe=function(e){var t=this;return Ir(function(){var r=t.value,n=J;J=void 0;try{e(r)}finally{J=n}})};at.prototype.valueOf=function(){return this.value};at.prototype.toString=function(){return this.value+""};at.prototype.toJSON=function(){return this.value};at.prototype.peek=function(){var e=J;J=void 0;try{return this.value}finally{J=e}};Object.defineProperty(at.prototype,"value",{get:function(){var e=Is(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Fi>100)throw new Error("Cycle detected");this.v=e,this.i++,dn++,ze++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{ki()}}}});function At(e){return new at(e)}function xs(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Os(e){for(var t=e.s;t!==void 0;t=t.n){var r=t.S.n;if(r!==void 0&&(t.r=r),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Ts(e){for(var t=e.s,r=void 0;t!==void 0;){var n=t.p;t.i===-1?(t.S.U(t),n!==void 0&&(n.n=t.n),t.n!==void 0&&(t.n.p=n)):r=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=n}e.s=r}function Je(e){at.call(this,void 0),this.x=e,this.s=void 0,this.g=dn-1,this.f=4}(Je.prototype=new at).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===dn))return!0;if(this.g=dn,this.f|=1,this.i>0&&!xs(this))return this.f&=-2,!0;var e=J;try{Os(this),J=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return J=e,Ts(this),this.f&=-2,!0};Je.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}at.prototype.S.call(this,e)};Je.prototype.U=function(e){if(this.t!==void 0&&(at.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Je.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Je.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Is(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Vi(e){return new Je(e)}function Cs(e){var t=e.u;if(e.u=void 0,typeof t=="function"){ze++;var r=J;J=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,$i(e),n}finally{J=r,ki()}}}function $i(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Cs(e)}function zc(e){if(J!==this)throw new Error("Out-of-order effect");Ts(this),J=e,this.f&=-2,8&this.f&&$i(this),ki()}function Sr(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Sr.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}};Sr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Cs(this),Os(this),ze++;var e=J;return J=this,zc.bind(this,e)};Sr.prototype.N=function(){2&this.f||(this.f|=2,this.o=br,br=this)};Sr.prototype.d=function(){this.f|=8,1&this.f||$i(this)};function Ir(e){var t=new Sr(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}var Hi,ji;function Xe(e,t){W[e]=t.bind(null,W[e]||function(){})}function gn(e){ji&&ji(),ji=e&&e.S()}function Ns(e){var t=this,r=e.data,n=Xc(r);n.value=r;var i=Mi(function(){for(var o=t.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return t.__$u.c=function(){var s,f=t.__$u.S(),p=i.value;f(),Ni(p)||((s=t.base)==null?void 0:s.nodeType)!==3?(t.__$f|=1,t.setState({})):t.base.data=p},Vi(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return i.value}Ns.displayName="_st";Object.defineProperties(at.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Ns},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Xe("__b",function(e,t){if(typeof t.type=="string"){var r,n=t.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof at&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});Xe("__r",function(e,t){gn();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=(function(i){var o;return Ir(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o})())),Hi=n,gn(r),e(t)});Xe("__e",function(e,t,r,n){gn(),Hi=void 0,e(t,r,n)});Xe("diffed",function(e,t){gn(),Hi=void 0;var r;if(typeof t.type=="string"&&(r=t.__e)){var n=t.__np,i=t.props;if(n){var o=r.U;if(o)for(var s in o){var f=o[s];f!==void 0&&!(s in n)&&(f.d(),o[s]=void 0)}else r.U=o={};for(var p in n){var d=o[p],m=n[p];d===void 0?(d=Jc(r,p,m,i),o[p]=d):d.o(m,i)}}}e(t)});function Jc(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=At(r);return{o:function(s,f){o.value=s,n=f},d:Ir(function(){var s=o.value.value;n[t]!==s&&(n[t]=s,i?e[t]=s:s?e.setAttribute(t,s):e.removeAttribute(t))})}}Xe("unmount",function(e,t){if(typeof t.type=="string"){var r=t.__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=t.__c;if(s){var f=s.__$u;f&&(s.__$u=void 0,f.d())}}e(t)});Xe("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});qe.prototype.shouldComponentUpdate=function(e,t){var r=this.__$u,n=r&&r.s!==void 0;for(var i in t)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 e)if(o!=="__source"&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Xc(e){return Mi(function(){return At(e)},[])}var yn=class{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}};var _n=class{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=this.d}};var Wi=class{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??!1}},Ke=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map(r=>new yn(r))??[],this.link=t.link,this.price=new _n(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,this.selectedOptions=t.selectedOptions??[],this.effectivePrice=At(this.price.effective),t.sellingPlans?.length&&(this.selectedSellingPlan=At(void 0)),this.sellingPlans=t.sellingPlans?.map(r=>{let n=new Wi(r);return n.isSelected&&(this.selectedSellingPlan.value=n),n})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};function Gi(e,t){for(let r of e){let n=t.get(r.attr),i=Array.isArray(n),o=typeof n=="string",s=typeof n=="number"&&typeof r.value=="number",f=Array.isArray(r.value),p=!0;switch(r.op){case"contains":{p=(i||o)&&n.includes(r.value);break}case"notContains":{p=(i||o)&&!n.includes(r.value);break}case"eq":{p=n===r.value;break}case"ne":{p=n!==r.value;break}case"gt":{p=s&&n>r.value;break}case"gte":{p=s&&n>=r.value;break}case"lt":{p=s&&n<r.value;break}case"lte":{p=s&&n<=r.value;break}case"in":{p=f&&r.value.includes(n);break}case"nin":{p=f&&!r.value.includes(n);break}case"between":{p=s&&f&&r.value.length===2&&n>=r.value[0]&&n<=r.value[1];break}case"all":{p=i&&f&&r.value.every(d=>n.includes(d));break}default:{p=!1;break}}if(!p)return!1}return!0}var Lt=class{id;mID;name;options;imgs;vars;desc;link;slug;quantity;category;meta;reviews;tags;templateSuffix;selectedOrFirstVariant;selected=At(!0);_showAddToCartButton;constructor(t){this.update(t),this.selectedOrFirstVariant=At(this.selectedVariant),this._showAddToCartButton=this.evaluateShowATCFlag()}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}get showAddToCartButton(){return this._showAddToCartButton}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}hasVariants(){return this.vars?.length>1}setSelectedVariant(t){this.selectedOrFirstVariant.value=t}setSelectedVariantByID(t){if(!t)return;let r=this.vars.find(n=>n.mID===t.toString());r&&this.setSelectedVariant(r)}update(t){return this.id=t.id??this.id,this.mID=t.mID??this.mID,this.name=t.name??this.name,this.imgs=t.imgs??this.imgs,this.desc=t.desc??this.desc,this.link=t.link??this.link,this.slug=t.slug??this.slug,this.quantity=t.quantity??this.quantity,this.meta=t.meta??this.meta,this.category=t.category??this.category,this.reviews=t.reviews??this.reviews,this.options=t.options??this.options,this.tags=t.tags??this.tags,this.templateSuffix=t.templateSuffix??this.templateSuffix,t.vars&&(this.vars=t.vars.map(r=>new Ke(r))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new Kt({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let t=this.selectedOrFirstVariant.value,r=t.price,n=this.name,i=this.category,o=this.variantImage??this.firstImageURL,s=this.meta,f=this.tags?.join(",")??"",p=this.reviews?.rating,d=this.reviews?.totalReviews,m=r.cmp&&r.cmp>r.d,h=It(B({name:n},Ct("price",r.d,!0)),{image_url:o,meta:s,category:i,rating:p,reviews:d,tags:f});if(t.hasEffectivePrice()){let y=Ct("effective_price",t.effectivePrice.value,!0);Object.assign(h,y)}if(m){let y=r.cmp-r.d,E={discount_percent:(y/r.cmp*100).toFixed(0)};Object.assign(h,E),Object.assign(h,Ct("compare_price",r.cmp)),Object.assign(h,Ct("discount_price",y))}let b={name:t.name,quantity:t.quantity};return{product:h,variant:b}}evaluateShowATCFlag(){let t=Tt.get().widgetCustomisation?.atcButton?.showWhen;if(!t?.predicates?.length)return!0;let r=t.predicates,n=this.getValueMap(r);return t.op==="or"?r.some(i=>Gi([i],n)):Gi(r,n)}getValueMap(t){let r=new Map;for(let n of t){let i=n.attr.split(".");switch(i[1]){case"tags":{r.set(n.attr,this.tags);break}case"type":case"category":{r.set(n.attr,this.category);break}case"meta":case"metafield":{let s=i[2];if(!s)continue;r.set(n.attr,this.meta?.[s]);break}}}return r}};var wn=class{id;alt;shortID;sources;items;durationMS;thumbnail;card;bestSource;highSource;goodSource;lowSource;m3u8Source;constructor(t={}){if(this.id=t.id,this.alt=t.alt,this.shortID=t.shortID,this.sources=t.sources?.sort((r,n)=>n.height-r.height),this.durationMS=t.durationMS,this.thumbnail=t.thumbnail,this.items=t.items?t.items.map(r=>new Lt(r)):[],this.card=t.card,this.sources){let r=[];for(let n of this.sources)n.format==="mp4"?r.push(n):n.format==="m3u8"&&!this.m3u8Source&&(this.m3u8Source=n);r.length>0&&(this.bestSource=r[0],this.highSource=r.length>1?r[1]:r[0],this.lowSource=r.length>2?r[r.length-1]:r[0])}}};var vn=class{videos;source;template;heading;autoPlay;showMuteButton;footerContent;detailPopup;playlistConfig;itemDetailConfig;constructor(t={}){this.videos=t.videos?.map(r=>new wn(r))??[],this.source=t.source,this.template=t.template,this.detailPopup=t.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=t.heading,this.showMuteButton=t.showMuteButton,this.autoPlay=t.autoPlay??"ON",this.footerContent=t.footerContent??"FIRST_ITEM",this.playlistConfig={videoSwiper:t.playlistConfig?.videoSwiper??void 0,itemCardClickBehavior:t.playlistConfig?.itemCardClickBehavior??"OPEN_VIDEO_DETAIL"},this.itemDetailConfig={template:t.itemDetailConfig?.template??"CLASSIC"}}showItems(){return this.footerContent==="FIRST_ITEM"||this.footerContent==="ITEM_SWIPER"}};var _t=me(qi());_t.filters.define("default",function(e){return typeof e>"u"||e==null?"":Qc(e)});+_t.filters.define("max",(e,t)=>{let r=Number(e),n=Number(t);return isNaN(r)||isNaN(n)?e:r>n?t:e});_t.filters.define("min",(e,t)=>{let r=Number(e),n=Number(t);return isNaN(r)||isNaN(n)?e:r<n?t:e});_t.filters.define("fallback",(e,t)=>e==null||e===""?t:e);_t.filters.define("manipulate_quantity",(e,t,r)=>{if(t??=1,r??=100,t>r)return S.error("Invalid range: min should be less than or equal to max."),e;if(e>=t&&e<=r)return e;let n=e%r;return n<t?t:n});_t.filters.define("apply_discount_perc",(e,t,r=1/0)=>{if(e=+e,isNaN(e))return S.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(t<0||t>100)return S.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let n=e*t/100;return e-Math.min(r,n)});_t.filters.define("apply_discount_fixed",(e,t)=>(e=+e,isNaN(e)?(S.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,e-t)));_t.filters.define("currency",e=>(e=+e,isNaN(e)?(S.error("Need value as a number for `currency` filter"),NaN):zo(e)));_t.filters.define("split",(e,t,r)=>{if(typeof e!="string")return S.error("Need value as a string for `split` filter"),"";if(t==null)return S.error("Need delimiter for `split` filter"),"";if(r==null||isNaN(Number(r)))return S.error("Need a valid index for `split` filter"),"";let n=e.split(String(t)),i=Number(r),o=i<0?n.length+i:i;return n[o].trim()??""});_t.defaultConfig.defaultFilter="default";_t.defaultConfig.useWith=!0;_t.defaultConfig.autoEscape=!1;var Kc={'"':"&quot;","\\":"&bsol;","\n":"\\n"," ":"\\t"};function Qc(e){return String(e).replace(/["\\\n\t]/g,t=>Kc[t])}function Zc(e){if(!e)return"";let t=/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g;return e.replace(t,(r,n,i,o)=>`{{ ${(i||o||"").trim()} }}`)}var Yi=(e,t,r)=>{t=B({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},t);try{return _t.render(Zc(e),t)}catch(n){throw tt(n,"squirrelly-render",{extra:{template:e,values:t},triggerContext:r}),n}},Uh=(e,t,r)=>{let n=JSON.stringify(e),i=Yi(n,t,r);try{return JSON.parse(i)}catch(o){throw tt(o,"variable-replacement",{extra:{before:e,after:i},triggerContext:r}),o}};function xr(){return!!window.Shopify}function Rs(){if(xr())return window.Shopify.shop?.split(".")?.[0]}function Ps(e){let n=(e.includes("://")?new URL(e).pathname:e).match(/\/products\/([^/]+?)(?:\.html)?$/);return n?n[1]:null}function Qe(e){return(window.Shopify?.routes?.root??"/")+e.substring(1)}function bn(e){return Qe(e+"?from=cooee")}var z=class e{static CURRENT;token;items=[];total_price=0;original_total_price=0;items_subtotal_price=0;currency;item_count=0;attributes;cart_level_discount_applications;discount_codes;total_discount=0;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new e),this.CURRENT}async getNormalisedCart(t){return tu(t)}getCooeeCart(){return Ji()}update(t){return this.token=t.token,this.items=t.items,this.total_price=t.total_price,this.original_total_price=t.original_total_price,this.items_subtotal_price=t.items_subtotal_price,this.currency=t.currency,this.item_count=t.item_count,this.attributes=t.attributes,this.cart_level_discount_applications=t.cart_level_discount_applications,this.discount_codes=t.discount_codes,this.total_discount=t.total_discount,rt().currencyCode=this.currency,S.verbose("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}};async function tu(e){let t=z.getCurrent();await ru(t,e);let r=As(t);return e&&await xt.set("cart",r),r}function Ji(){return As(z.getCurrent())}function As(e){return{amount:e.total_price/100,originalAmount:e.original_total_price/100,itemsSubtotalPrice:e.items_subtotal_price/100,currency:e.currency,itemCount:e.item_count,items:eu(e.items),token:e.token}}function eu(e){if(!e)return S.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let t=[];for(let r of e){if(!r.id||!r.title){S.warn("Invalid item received",r);continue}let n={name:r.title,quantity:+r.quantity||1,mID:r.product_id?.toString(),vID:r.id.toString(),price:+r.price/100||0,finalPrice:+r.final_price/100||0,properties:r.properties,key:r.key},i=r.selling_plan_allocation?.selling_plan;if(!i){t.push(n);continue}n.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:i.fixed_selling_plan,id:i.id,name:i.name,recurringDeliveries:i.recurring_deliveries}},t.push(n)}return t}async function ru(e,t){if(!t&&e.token){S.verbose("Not fetching cart");return}S.verbose("Fetching cart");let r=bn("/cart.js");try{let n=(await re(r)).data;e.update(n)}catch(n){S.error("Unable to fetch the cart",n)}}var Sn=class{id;mID;handle;title;imageURL;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.handle=t.handle,this.title=t.title,this.imageURL=t.imageURL}};var Xi=class{enabled;constructor(t){this.enabled=t.enabled}},Ki=class extends Xi{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}},In=class{productQuantity;constructor(t){t??={},this.productQuantity=new Ki(t.productQuantity)}};var xn=class extends Nt{o;constructor(t){super(t),this.o=t.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}};var On=class{en;ex;constructor(t){t=t??{},this.en=t.en,this.ex=t.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 Tn=15,Or=class extends Nt{gvt;max;cover;anim;embedded;constructor(t){t=t??{},super(t),this.gvt=t.gvt??5,this.max=t.max,this.cover=t.cover??!0,this.anim=new On(t.anim),this.spc||(this.spc=new se({pl:Tn,pr:Tn,pt:Tn,pb:Tn}))}};var Cn=class extends Or{cont;elems=[];mob;constructor(t){t=t??{},super(t),this.cont=new xn(t.cont),this.mob=new Or(t.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),t.elems.forEach(r=>{r.t===1?this.elems.push(new xe(r)):r.t===2?this.elems.push(new We(r)):r.t===3?this.elems.push(new We(r)):r.t===100?this.elems.push(new yr(r)):r.t===51?this.elems.push(new Zr(r)):r.t===52?this.elems.push(new tn(r)):r.t===61?this.elems.push(new Xr(r)):r.t===15||r.t===16?this.elems.push(new Qr(r)):r.t===13&&this.elems.push(new en(r))})}getStylesForWrapper(){if(this.cover)return{};let t;return this.gvt===1?t={top:0,left:0}:this.gvt===2?t={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?t={top:0,right:0}:this.gvt===6?t={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?t={bottom:0,right:0}:this.gvt===8?t={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?t={bottom:0,left:0}:this.gvt===4?t={top:"50%",left:0,transform:"translateY(-50%)"}:t={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},t.overflow="visible",t}getFlexStylesForContainer(){let t={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"),t.alignItems=n,t.justifyContent=r,t.overflow="visible",t}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 Nn=class{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??"row",this.wrap=t.wrap??"nowrap",this.jc=t.jc??"flex-start",this.ai=t.ai??"flex-start",this.scroll=t.scroll}};var Dn=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex}};var Rn=class{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??"100%",this.h=t.h??"auto",this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH}};var Pn=class{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new se(t.spc),t.size&&(this.size=new Rn(t.size)),t.bg&&(this.bg=new Ie(t.bg)),t.br&&(this.br=new oe(t.br)),t.typo&&(this.typo=new Ht(t.typo)),t.lout&&(this.lout=new Dn(t.lout)),t.flex&&(this.flex=new Nn(t.flex))}},Ze=class{sm;lg;constructor(t){t??={},this.sm=new Pn(t.sm),this.lg=new Pn(t.lg)}};var ht=class{t;style;hide;when;clc;l;constructor(t,r){r??={},this.t=t,this.style=new Ze(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 pt[this.t]}};var wt=class extends ht{text;constructor(t,r){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(r??2,t),t??={},this.text=t.text}};var Ce=class extends wt{constructor(t,r){super(t,r??3)}};var tr=class extends ht{value;constructor(t){super(6,t),t??={},this.value=t.value}};var er=class extends wt{showChips;optionsConfig;constructor(t=15,r){super(r,t),r??={},this.showChips=r.showChips??!1,this.optionsConfig=r.optionsConfig??{}}};var An=class extends ht{c;iconSize;showSingleStar;fullStar;halfStart;constructor(t){super(19,t),t??={},this.c=new K(t.c),this.iconSize=t.iconSize??24,this.showSingleStar=t.showSingleStar??!1,this.fullStar=t.fullStar,this.halfStart=t.halfStart}};var Ls=me(Gr());var Qi=class{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new K(t.color)}},Zi=class{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new K(t.color)}},to=class{enabled;delay;constructor(t={}){this.enabled=t.enabled,t.delay&&(this.delay=t.delay>100?t.delay:t.delay*1e3)}},rr=class{navigation;pagination;autoplay;loop;maxInRow;gap;maxInRowSm;gapSm;speed;marquee;constructor(t){t??={},this.navigation=new Zi(t.navigation),this.pagination=new Qi(t.pagination),this.autoplay=new to(t.autoplay),this.loop=t.loop??!1,this.maxInRow=t.maxInRow??4,this.gap=t.gap??0,this.maxInRowSm=t.maxInRowSm??this.maxInRow,this.gapSm=t.gapSm??this.gap,t.speed&&(this.speed=t.speed*1e3),this.marquee=t.marquee}};var Ln=class extends ht{conf;slide;formData;values;allowedTypes;constructor(t){super(62,t),t&&this.update(t)}update(t){t??={},this.slide=Wt.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new rr(t.conf),this.allowedTypes=t.allowedTypes}};var Un=class extends wt{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t,61),this.gap=t.gap,this.timerType=t.type,this.timer=new Ge(t.timer),this.show=t.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}};var ye=class extends ht{elems;constructor(t){super(4,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach(r=>{let n=Wt.getParsedElement(r);n&&this.elems.push(n)})}};var Ne=class extends ht{src;sm;lg;constructor(t,r){super(r??1,t),t&&this.update(t)}update(t){this.src=t.src,this.sm=t.sm,this.lg=t.lg}};var Wt=class e{static getParsedElements(t){let r=[];return t?.forEach(n=>{let i=e.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(t){switch(t.t){case 2:return new wt(t);case 3:return new Ce(t);case 6:return new tr(t);case 11:return new Bn(t);case 12:return new nr(t);case 61:return new Un(t);case 4:return new ye(t);case 1:return new Ne(t);case 13:return new Ne(t,13);case 14:return new wt(t,14);case 15:case 16:return new er(t.t,t);case 18:return new Ce(t,18);case 62:return new Ln(t);case 19:return new An(t);default:Ls.default.error("Unknown element type",t.t);return}}static parseAlignmentToJustifyContent(t){switch(t){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}};var nr=class extends ht{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(t){if(t??={},super(12,t),this.show=t.show,this.elems=Wt.getParsedElements(t.elems),this.noLinks=t.noLinks,!this.elems.length){t.cBox&&this.elems.push(new tr(t.cBox)),this.elems.push(new Ne(t.img,13));let r=new wt(t.title,14);r.hide=!t.show?.title,r.text="{{ product.name }}",this.elems.push(r);let n=new wt(t.price);n.text="{{ product.price }}",n.hide=!t.show?.price;let i=new wt(t.compareAt);i.text="{{ product.compare_price }}",i.hide=!t.show?.price,t.compareAt||(i.style=new Ze(n.style),i.style.lg.typo=new Ht(It(B({},i.style.lg.typo),{td:"line-through"})),i.style.sm.typo=new Ht(It(B({},i.style.sm.typo),{td:"line-through"})));let o=new ye({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:Wt.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});o.elems.push(i),o.elems.push(n),this.elems.push(o);let s=new er(15,t.variantDD);if(s.hide=!t.show?.variantDD,this.elems.push(s),t.btn){let f=new Ce(t.btn,18);f.hide=!t.show?.btn,this.elems.push(f)}}t.symbol&&(this.symbol=new wt(t.symbol))}};var Bn=class extends ht{conf;prod;constructor(t){super(11,t),t??={},this.conf=new eo(t.conf),this.prod=new nr(t.prod)}};var Mn=class extends rr{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}},eo=class{lg;sm;constructor(t){t??={},this.lg=new Mn(t.lg),this.sm=new Mn(t.sm)}};var Fn=class extends ye{constructor(t){super(t)}};var kn=class{cont;elems=[];constructor(t){t=t??{},this.cont=new Fn(t.cont),t.elems?.forEach(r=>{this.addRawElement(r)})}addRawElement(t){let r=Wt.getParsedElement(t);return r&&this.elems.push(r),r}};function Vn(e,t){return nu(e,t,0,5)}function nu(e,t,r=0,n=50){if(t){if(r>n){console.warn("Maximum recursion depth reached in findFirstElementOfType");return}for(let i of t){if(i.t===e)return i;let o="elems"in i?i.elems:[];if(o?.length>0){let s=Vn(e,o);if(s)return s}}}}var $n=class{title;subtitle;template;refreshPage;options;constructor(t={}){this.template=t.template??"IMAGE",this.refreshPage=t.refreshPage??!1,this.options=t.options??[],this.title=t.title,this.subtitle=t.subtitle}};var ro=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(t){this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.delay=t.delay??0,this.redirectBehaviour=t.redirectBehaviour,this.onsiteDeliveryType=t.onsiteDeliveryType,this.objective=t.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===_r.EXCLUSION}isABTesting(){return this.contentType===_r.ABTESTING}isSingleContent(){return this.contentType===_r.SINGLE}},no=class{videoConfig;savingsBarConfig;collectionFilterConfig;afterDeleteJS;afterRenderJS;innerCSS;outerCSS;constructor(t){this.update(t)}update(t){t??={},t.videoConfig&&(this.videoConfig=new vn(t.videoConfig)),t.savingsBarConfig&&(this.savingsBarConfig=new an(t.savingsBarConfig)),t.collectionFilterConfig&&(this.collectionFilterConfig=new $n(t.collectionFilterConfig)),this.afterDeleteJS=t.afterDeleteJS,this.afterRenderJS=t.afterRenderJS,this.innerCSS=t.innerCSS,this.outerCSS=t.outerCSS}},jn=class extends ro{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=At({});constructor(t){if(super(t),this.id=t.id,this.currency=rt().currencyCode??"USD",this.contentID=t.contentID,this.variation=t.variation,t.widget&&(this.widget=new kn(t.widget)),this.previewType=t.previewType,this.occurred=t.occurred??new Date,this.props=t.props,this.entryAnimation=t.entryAnimation??"NONE",this.embeddedItems=t.embeddedItems?.map(r=>new Kt(r)),this.items=t.items?.map(r=>new Lt(r))??[],this.nonMutableItems=t.items?.map(r=>new Lt(r))??[],this.collections=t.collections?.map(r=>new Sn(r))??[],this.discount=t.discount,this.placement=t.placement,t.customerData?.name){let r=t.customerData.name.split(" ");this.customerData={name:t.customerData.name,full_name:t.customerData.name,first_name:r[0],last_name:r[1]}}this.ian=t.ian?this.processPopup(t.ian):void 0,this.promotionType=t.promotionType,this.manipulation=new In(t.manipulation),this.contentSource=t.contentSource,this.klaviyoFormID=t.klaviyoFormID,this.hasMultiplePlacement=t.hasMultiplePlacement,this.skipSubscribedItems=t.skipSubscribedItems,this.stickyATCConfig=t.stickyATCConfig,t.experimentConfig&&(this.experimentConfig=new nn(t.experimentConfig)),t.progressBarConfig&&(this.progressBarConfig=new sn(t.progressBarConfig)),t.bundleConfig&&(this.bundleConfig=new rn(t.bundleConfig)),t.bundleFrom&&(this.bundleFrom=new Lt(t.bundleFrom)),t.content&&(this.content=new no(t.content))}shouldDelay(){return this.delay>0}getDelaySeconds(){let t=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-t}isBundle(){return this.objective===Pt.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===wr.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===wr.PAGE_EMBED}isProgressBar(){return this.objective===Pt.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===Pt.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===Pt.CART_RECOVERY}isProductPromotion(){return this.objective===Pt.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===Ii.COLLECTION}isBYOB(){return this.objective===Pt.BYOB}isStickyATC(){return this.objective===Pt.STICKY_ATC}isShoppableVideo(){return this.objective===Pt.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===Pt.SAVINGS_BAR}isCollectionFilter(){return this.objective===Pt.COLLECTION_FILTER}processPopup(t){let r=this.items[0],n={},i={};if(r){let f=r.selectedOrFirstVariant.value;n=It(B(B({name:r.name,id:r.mID,link:r.link,vID:f.mID,image:r.variantImage},Ct("price",f.price.d)),Ct("comparePrice",f.price.cmp)),{quantity:r.quantity}),i={quantity:f.quantity}}let o={productCount:z.getCurrent().item_count},s=Yi(JSON.stringify(t),{product:n,variant:i,cart:o,discount:this.discount,customer:this.customerData},new qr(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 Cn(JSON.parse(s))}calculateDiscountData(t,r){let n=Oe.sum(t,s=>s.selectedOrFirstVariant.value.price.d),i=Oe.sum(t,s=>{let f=s.selectedOrFirstVariant.value.price;return f.cmp??f.d}),o={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!t?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(o);return}if(Jt.BXGY===this.discount.type&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],this.updateEffectivePrice(t,o.discountPercentage,!0),o.discountAmount=o.actualPrice-Oe.sum(t,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([Jt.STATIC,Jt.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(t,o.discountPercentage);else if(Jt.UNIQUE_FLAT_ITEMS===this.discount.type&&this.discount.values?.length)this.discount.ruleType==="fixed_amount"?(o.discountAmount=this.discount.values[0],o.discountPercentage=o.actualPrice>0?o.discountAmount*100/o.actualPrice:0):(o.discountPercentage=this.discount.values[0],o.discountAmount=o.actualPrice*o.discountPercentage/100),this.updateEffectivePrice(t,o.discountPercentage);else if(this.discount.type===Jt.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)o.discountAmount=o.actualPrice-this.discount.values[0],o.discountPercentage=o.discountAmount/o.actualPrice*100,this.updateEffectivePrice(t,o.discountPercentage);else if(this.discount.type===Jt.UNIQUE_CHEAPEST_ITEM_FREE){t.sort((f,p)=>p.selectedOrFirstVariant.value.price.d-f.selectedOrFirstVariant.value.price.d);let s=t[t.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 Tt.get().skipItemAttribute?{}:{_via:"Cooee",_letscooee_campaign:this.shortID,_letscooee_content:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Tt.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(Vn(62,this.widget?.elems))return!0;let r=Vn(11,this.widget?.elems);return r?r.conf.lg.disp===2||r.conf.sm.disp===2:!1}toString(){let t;return this.onsiteDeliveryType===wr.POPUP?t="Popup":t=Qo.toTitle(this.objective),`${t}(id=${this.shortID})`}getCartMagicVariables(){let t=z.getCurrent(),r=Oe.sum(t.items??[],n=>n.discounts?.reduce((i,o)=>i+(o.amount??0),0)??0);return B(B(B(B({productCount:t.item_count,product_count:t.item_count},Ct("amount",t.total_price/100)),Ct("originalAmount",t.original_total_price/100)),Ct("total_line_items_discount",r/100)),Ct("total_discount",t.total_discount/100))}shouldGetVariationImmediately(){return this.hasMultiplePlacement&&!this.alwaysHaveVariations()}shouldSkipVariation(){return this.isSingleContent()||this.alwaysHaveVariations()?!0:!!this.variation}alwaysHaveVariations(){return this.isProgressBar()||this.isSavingsBar()}updateEffectivePrice(t,r,n=!1){let i=rt().currentItem;t.forEach(o=>{let s=o.selectedOrFirstVariant.value,f=s.price;if(n&&o.mID===i.mID)s.effectivePrice.value=f.d;else{let p=f.d*r/100;s.effectivePrice.value=f.d-p}})}formatCurrencyAndNumber(t){if(!t)return{};let r={discountPercentage:Jo(t.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{Object.assign(r,Ct(n,t[n]))}),r}};var Hn=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(t){t=t||{},this.triggerID=t.id||t.triggerID,this.nudgeID=t.nudgeID,this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.contentID=t.contentID,this.variation=t.variation,this.props=t.props,this.objective=t.objective,this.onsiteDeliveryType=t.onsiteDeliveryType,this.holdout=t.holdout}};function iu(e,t){return t={exports:{}},e(t,t.exports),t.exports}var ou=uu,su=lu,au=mu,Zt=[],Bt=[],cu=typeof Uint8Array<"u"?Uint8Array:Array,io="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(De=0,Us=io.length;De<Us;++De)Zt[De]=io[De],Bt[io.charCodeAt(De)]=De;var De,Us;Bt[45]=62;Bt[95]=63;function Ks(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function uu(e){var t=Ks(e),r=t[0],n=t[1];return(r+n)*3/4-n}function fu(e,t,r){return(t+r)*3/4-r}function lu(e){var t,r=Ks(e),n=r[0],i=r[1],o=new cu(fu(e,n,i)),s=0,f=i>0?n-4:n,p;for(p=0;p<f;p+=4)t=Bt[e.charCodeAt(p)]<<18|Bt[e.charCodeAt(p+1)]<<12|Bt[e.charCodeAt(p+2)]<<6|Bt[e.charCodeAt(p+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return i===2&&(t=Bt[e.charCodeAt(p)]<<2|Bt[e.charCodeAt(p+1)]>>4,o[s++]=t&255),i===1&&(t=Bt[e.charCodeAt(p)]<<10|Bt[e.charCodeAt(p+1)]<<4|Bt[e.charCodeAt(p+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function pu(e){return Zt[e>>18&63]+Zt[e>>12&63]+Zt[e>>6&63]+Zt[e&63]}function hu(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(pu(n));return i.join("")}function mu(e){for(var t,r=e.length,n=r%3,i=[],o=16383,s=0,f=r-n;s<f;s+=o)i.push(hu(e,s,s+o>f?f:s+o));return n===1?(t=e[r-1],i.push(Zt[t>>2]+Zt[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Zt[t>>10]+Zt[t>>4&63]+Zt[t<<2&63]+"=")),i.join("")}var oo={byteLength:ou,toByteArray:su,fromByteArray:au};var du=function(t,r,n,i,o){var s,f,p=o*8-i-1,d=(1<<p)-1,m=d>>1,h=-7,b=n?o-1:0,y=n?-1:1,E=t[r+b];for(b+=y,s=E&(1<<-h)-1,E>>=-h,h+=p;h>0;s=s*256+t[r+b],b+=y,h-=8);for(f=s&(1<<-h)-1,s>>=-h,h+=i;h>0;f=f*256+t[r+b],b+=y,h-=8);if(s===0)s=1-m;else{if(s===d)return f?NaN:(E?-1:1)*(1/0);f=f+Math.pow(2,i),s=s-m}return(E?-1:1)*f*Math.pow(2,s-i)},gu=function(t,r,n,i,o,s){var f,p,d,m=s*8-o-1,h=(1<<m)-1,b=h>>1,y=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=i?0:s-1,D=i?1:-1,C=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(p=isNaN(r)?1:0,f=h):(f=Math.floor(Math.log(r)/Math.LN2),r*(d=Math.pow(2,-f))<1&&(f--,d*=2),f+b>=1?r+=y/d:r+=y*Math.pow(2,1-b),r*d>=2&&(f++,d/=2),f+b>=h?(p=0,f=h):f+b>=1?(p=(r*d-1)*Math.pow(2,o),f=f+b):(p=r*Math.pow(2,b-1)*Math.pow(2,o),f=0));o>=8;t[n+E]=p&255,E+=D,p/=256,o-=8);for(f=f<<o|p,m+=o;m>0;t[n+E]=f&255,E+=D,f/=256,m-=8);t[n+E-D]|=C*128},ir={read:du,write:gu},qn=iu(function(e,t){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=R,t.INSPECT_MAX_BYTES=50;var n=2147483647;t.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 u=new Uint8Array(1),a={foo:function(){return 42}};return Object.setPrototypeOf(a,Uint8Array.prototype),Object.setPrototypeOf(u,a),u.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(u){if(u>n)throw new RangeError('The value "'+u+'" is invalid for option "size"');var a=new Uint8Array(u);return Object.setPrototypeOf(a,s.prototype),a}function s(u,a,c){if(typeof u=="number"){if(typeof a=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(u)}return f(u,a,c)}s.poolSize=8192;function f(u,a,c){if(typeof u=="string")return h(u,a);if(ArrayBuffer.isView(u))return y(u);if(u==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(u));if(et(u,ArrayBuffer)||u&&et(u.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(et(u,SharedArrayBuffer)||u&&et(u.buffer,SharedArrayBuffer)))return E(u,a,c);if(typeof u=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var l=u.valueOf&&u.valueOf();if(l!=null&&l!==u)return s.from(l,a,c);var g=D(u);if(g)return g;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof u[Symbol.toPrimitive]=="function")return s.from(u[Symbol.toPrimitive]("string"),a,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(u))}s.from=function(u,a,c){return f(u,a,c)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function p(u){if(typeof u!="number")throw new TypeError('"size" argument must be of type number');if(u<0)throw new RangeError('The value "'+u+'" is invalid for option "size"')}function d(u,a,c){return p(u),u<=0?o(u):a!==void 0?typeof c=="string"?o(u).fill(a,c):o(u).fill(a):o(u)}s.alloc=function(u,a,c){return d(u,a,c)};function m(u){return p(u),o(u<0?0:C(u)|0)}s.allocUnsafe=function(u){return m(u)},s.allocUnsafeSlow=function(u){return m(u)};function h(u,a){if((typeof a!="string"||a==="")&&(a="utf8"),!s.isEncoding(a))throw new TypeError("Unknown encoding: "+a);var c=A(u,a)|0,l=o(c),g=l.write(u,a);return g!==c&&(l=l.slice(0,g)),l}function b(u){for(var a=u.length<0?0:C(u.length)|0,c=o(a),l=0;l<a;l+=1)c[l]=u[l]&255;return c}function y(u){if(et(u,Uint8Array)){var a=new Uint8Array(u);return E(a.buffer,a.byteOffset,a.byteLength)}return b(u)}function E(u,a,c){if(a<0||u.byteLength<a)throw new RangeError('"offset" is outside of buffer bounds');if(u.byteLength<a+(c||0))throw new RangeError('"length" is outside of buffer bounds');var l;return a===void 0&&c===void 0?l=new Uint8Array(u):c===void 0?l=new Uint8Array(u,a):l=new Uint8Array(u,a,c),Object.setPrototypeOf(l,s.prototype),l}function D(u){if(s.isBuffer(u)){var a=C(u.length)|0,c=o(a);return c.length===0||u.copy(c,0,0,a),c}if(u.length!==void 0)return typeof u.length!="number"||Y(u.length)?o(0):b(u);if(u.type==="Buffer"&&Array.isArray(u.data))return b(u.data)}function C(u){if(u>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return u|0}function R(u){return+u!=u&&(u=0),s.alloc(+u)}s.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==s.prototype},s.compare=function(a,c){if(et(a,Uint8Array)&&(a=s.from(a,a.offset,a.byteLength)),et(c,Uint8Array)&&(c=s.from(c,c.offset,c.byteLength)),!s.isBuffer(a)||!s.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===c)return 0;for(var l=a.length,g=c.length,v=0,O=Math.min(l,g);v<O;++v)if(a[v]!==c[v]){l=a[v],g=c[v];break}return l<g?-1:g<l?1:0},s.isEncoding=function(a){switch(String(a).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(a,c){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(a.length===0)return s.alloc(0);var l;if(c===void 0)for(c=0,l=0;l<a.length;++l)c+=a[l].length;var g=s.allocUnsafe(c),v=0;for(l=0;l<a.length;++l){var O=a[l];if(et(O,Uint8Array))v+O.length>g.length?s.from(O).copy(g,v):Uint8Array.prototype.set.call(g,O,v);else if(s.isBuffer(O))O.copy(g,v);else throw new TypeError('"list" argument must be an Array of Buffers');v+=O.length}return g};function A(u,a){if(s.isBuffer(u))return u.length;if(ArrayBuffer.isView(u)||et(u,ArrayBuffer))return u.byteLength;if(typeof u!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(u));var c=u.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&c===0)return 0;for(var g=!1;;)switch(a){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return bt(u).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return Q(u).length;default:if(g)return l?-1:bt(u).length;a=(""+a).toLowerCase(),g=!0}}s.byteLength=A;function N(u,a,c){var l=!1;if((a===void 0||a<0)&&(a=0),a>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,a>>>=0,c<=a))return"";for(u||(u="utf8");;)switch(u){case"hex":return T(this,a,c);case"utf8":case"utf-8":return zt(this,a,c);case"ascii":return w(this,a,c);case"latin1":case"binary":return _(this,a,c);case"base64":return dt(this,a,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,a,c);default:if(l)throw new TypeError("Unknown encoding: "+u);u=(u+"").toLowerCase(),l=!0}}s.prototype._isBuffer=!0;function P(u,a,c){var l=u[a];u[a]=u[c],u[c]=l}s.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var c=0;c<a;c+=2)P(this,c,c+1);return this},s.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var c=0;c<a;c+=4)P(this,c,c+3),P(this,c+1,c+2);return this},s.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var c=0;c<a;c+=8)P(this,c,c+7),P(this,c+1,c+6),P(this,c+2,c+5),P(this,c+3,c+4);return this},s.prototype.toString=function(){var a=this.length;return a===0?"":arguments.length===0?zt(this,0,a):N.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(a){if(!s.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:s.compare(this,a)===0},s.prototype.inspect=function(){var a="",c=t.INSPECT_MAX_BYTES;return a=this.toString("hex",0,c).replace(/(.{2})/g,"$1 ").trim(),this.length>c&&(a+=" ... "),"<Buffer "+a+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(a,c,l,g,v){if(et(a,Uint8Array)&&(a=s.from(a,a.offset,a.byteLength)),!s.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(a));if(c===void 0&&(c=0),l===void 0&&(l=a?a.length:0),g===void 0&&(g=0),v===void 0&&(v=this.length),c<0||l>a.length||g<0||v>this.length)throw new RangeError("out of range index");if(g>=v&&c>=l)return 0;if(g>=v)return-1;if(c>=l)return 1;if(c>>>=0,l>>>=0,g>>>=0,v>>>=0,this===a)return 0;for(var O=v-g,F=l-c,$=Math.min(O,F),k=this.slice(g,v),X=a.slice(c,l),Z=0;Z<$;++Z)if(k[Z]!==X[Z]){O=k[Z],F=X[Z];break}return O<F?-1:F<O?1:0};function G(u,a,c,l,g){if(u.length===0)return-1;if(typeof c=="string"?(l=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,Y(c)&&(c=g?0:u.length-1),c<0&&(c=u.length+c),c>=u.length){if(g)return-1;c=u.length-1}else if(c<0)if(g)c=0;else return-1;if(typeof a=="string"&&(a=s.from(a,l)),s.isBuffer(a))return a.length===0?-1:ct(u,a,c,l,g);if(typeof a=="number")return a=a&255,typeof Uint8Array.prototype.indexOf=="function"?g?Uint8Array.prototype.indexOf.call(u,a,c):Uint8Array.prototype.lastIndexOf.call(u,a,c):ct(u,[a],c,l,g);throw new TypeError("val must be string, number or Buffer")}function ct(u,a,c,l,g){var v=1,O=u.length,F=a.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(u.length<2||a.length<2)return-1;v=2,O/=2,F/=2,c/=2}function $(le,$e){return v===1?le[$e]:le.readUInt16BE($e*v)}var k;if(g){var X=-1;for(k=c;k<O;k++)if($(u,k)===$(a,X===-1?0:k-X)){if(X===-1&&(X=k),k-X+1===F)return X*v}else X!==-1&&(k-=k-X),X=-1}else for(c+F>O&&(c=O-F),k=c;k>=0;k--){for(var Z=!0,yt=0;yt<F;yt++)if($(u,k+yt)!==$(a,yt)){Z=!1;break}if(Z)return k}return-1}s.prototype.includes=function(a,c,l){return this.indexOf(a,c,l)!==-1},s.prototype.indexOf=function(a,c,l){return G(this,a,c,l,!0)},s.prototype.lastIndexOf=function(a,c,l){return G(this,a,c,l,!1)};function Ot(u,a,c,l){c=Number(c)||0;var g=u.length-c;l?(l=Number(l),l>g&&(l=g)):l=g;var v=a.length;l>v/2&&(l=v/2);for(var O=0;O<l;++O){var F=parseInt(a.substr(O*2,2),16);if(Y(F))return O;u[c+O]=F}return O}function Vt(u,a,c,l){return q(bt(a,u.length-c),u,c,l)}function St(u,a,c,l){return q(gt(a),u,c,l)}function Yt(u,a,c,l){return q(Q(a),u,c,l)}function ut(u,a,c,l){return q(V(a,u.length-c),u,c,l)}s.prototype.write=function(a,c,l,g){if(c===void 0)g="utf8",l=this.length,c=0;else if(l===void 0&&typeof c=="string")g=c,l=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(l)?(l=l>>>0,g===void 0&&(g="utf8")):(g=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var v=this.length-c;if((l===void 0||l>v)&&(l=v),a.length>0&&(l<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");g||(g="utf8");for(var O=!1;;)switch(g){case"hex":return Ot(this,a,c,l);case"utf8":case"utf-8":return Vt(this,a,c,l);case"ascii":case"latin1":case"binary":return St(this,a,c,l);case"base64":return Yt(this,a,c,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ut(this,a,c,l);default:if(O)throw new TypeError("Unknown encoding: "+g);g=(""+g).toLowerCase(),O=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function dt(u,a,c){return a===0&&c===u.length?oo.fromByteArray(u):oo.fromByteArray(u.slice(a,c))}function zt(u,a,c){c=Math.min(u.length,c);for(var l=[],g=a;g<c;){var v=u[g],O=null,F=v>239?4:v>223?3:v>191?2:1;if(g+F<=c){var $,k,X,Z;switch(F){case 1:v<128&&(O=v);break;case 2:$=u[g+1],($&192)===128&&(Z=(v&31)<<6|$&63,Z>127&&(O=Z));break;case 3:$=u[g+1],k=u[g+2],($&192)===128&&(k&192)===128&&(Z=(v&15)<<12|($&63)<<6|k&63,Z>2047&&(Z<55296||Z>57343)&&(O=Z));break;case 4:$=u[g+1],k=u[g+2],X=u[g+3],($&192)===128&&(k&192)===128&&(X&192)===128&&(Z=(v&15)<<18|($&63)<<12|(k&63)<<6|X&63,Z>65535&&Z<1114112&&(O=Z))}}O===null?(O=65533,F=1):O>65535&&(O-=65536,l.push(O>>>10&1023|55296),O=56320|O&1023),l.push(O),g+=F}return fe(l)}var $t=4096;function fe(u){var a=u.length;if(a<=$t)return String.fromCharCode.apply(String,u);for(var c="",l=0;l<a;)c+=String.fromCharCode.apply(String,u.slice(l,l+=$t));return c}function w(u,a,c){var l="";c=Math.min(u.length,c);for(var g=a;g<c;++g)l+=String.fromCharCode(u[g]&127);return l}function _(u,a,c){var l="";c=Math.min(u.length,c);for(var g=a;g<c;++g)l+=String.fromCharCode(u[g]);return l}function T(u,a,c){var l=u.length;(!a||a<0)&&(a=0),(!c||c<0||c>l)&&(c=l);for(var g="",v=a;v<c;++v)g+=jt[u[v]];return g}function I(u,a,c){for(var l=u.slice(a,c),g="",v=0;v<l.length-1;v+=2)g+=String.fromCharCode(l[v]+l[v+1]*256);return g}s.prototype.slice=function(a,c){var l=this.length;a=~~a,c=c===void 0?l:~~c,a<0?(a+=l,a<0&&(a=0)):a>l&&(a=l),c<0?(c+=l,c<0&&(c=0)):c>l&&(c=l),c<a&&(c=a);var g=this.subarray(a,c);return Object.setPrototypeOf(g,s.prototype),g};function x(u,a,c){if(u%1!==0||u<0)throw new RangeError("offset is not uint");if(u+a>c)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(a,c,l){a=a>>>0,c=c>>>0,l||x(a,c,this.length);for(var g=this[a],v=1,O=0;++O<c&&(v*=256);)g+=this[a+O]*v;return g},s.prototype.readUintBE=s.prototype.readUIntBE=function(a,c,l){a=a>>>0,c=c>>>0,l||x(a,c,this.length);for(var g=this[a+--c],v=1;c>0&&(v*=256);)g+=this[a+--c]*v;return g},s.prototype.readUint8=s.prototype.readUInt8=function(a,c){return a=a>>>0,c||x(a,1,this.length),this[a]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(a,c){return a=a>>>0,c||x(a,2,this.length),this[a]|this[a+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(a,c){return a=a>>>0,c||x(a,2,this.length),this[a]<<8|this[a+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(a,c){return a=a>>>0,c||x(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(a,c){return a=a>>>0,c||x(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},s.prototype.readIntLE=function(a,c,l){a=a>>>0,c=c>>>0,l||x(a,c,this.length);for(var g=this[a],v=1,O=0;++O<c&&(v*=256);)g+=this[a+O]*v;return v*=128,g>=v&&(g-=Math.pow(2,8*c)),g},s.prototype.readIntBE=function(a,c,l){a=a>>>0,c=c>>>0,l||x(a,c,this.length);for(var g=c,v=1,O=this[a+--g];g>0&&(v*=256);)O+=this[a+--g]*v;return v*=128,O>=v&&(O-=Math.pow(2,8*c)),O},s.prototype.readInt8=function(a,c){return a=a>>>0,c||x(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},s.prototype.readInt16LE=function(a,c){a=a>>>0,c||x(a,2,this.length);var l=this[a]|this[a+1]<<8;return l&32768?l|4294901760:l},s.prototype.readInt16BE=function(a,c){a=a>>>0,c||x(a,2,this.length);var l=this[a+1]|this[a]<<8;return l&32768?l|4294901760:l},s.prototype.readInt32LE=function(a,c){return a=a>>>0,c||x(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},s.prototype.readInt32BE=function(a,c){return a=a>>>0,c||x(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},s.prototype.readFloatLE=function(a,c){return a=a>>>0,c||x(a,4,this.length),ir.read(this,a,!0,23,4)},s.prototype.readFloatBE=function(a,c){return a=a>>>0,c||x(a,4,this.length),ir.read(this,a,!1,23,4)},s.prototype.readDoubleLE=function(a,c){return a=a>>>0,c||x(a,8,this.length),ir.read(this,a,!0,52,8)},s.prototype.readDoubleBE=function(a,c){return a=a>>>0,c||x(a,8,this.length),ir.read(this,a,!1,52,8)};function L(u,a,c,l,g,v){if(!s.isBuffer(u))throw new TypeError('"buffer" argument must be a Buffer instance');if(a>g||a<v)throw new RangeError('"value" argument is out of bounds');if(c+l>u.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(a,c,l,g){if(a=+a,c=c>>>0,l=l>>>0,!g){var v=Math.pow(2,8*l)-1;L(this,a,c,l,v,0)}var O=1,F=0;for(this[c]=a&255;++F<l&&(O*=256);)this[c+F]=a/O&255;return c+l},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(a,c,l,g){if(a=+a,c=c>>>0,l=l>>>0,!g){var v=Math.pow(2,8*l)-1;L(this,a,c,l,v,0)}var O=l-1,F=1;for(this[c+O]=a&255;--O>=0&&(F*=256);)this[c+O]=a/F&255;return c+l},s.prototype.writeUint8=s.prototype.writeUInt8=function(a,c,l){return a=+a,c=c>>>0,l||L(this,a,c,1,255,0),this[c]=a&255,c+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(a,c,l){return a=+a,c=c>>>0,l||L(this,a,c,2,65535,0),this[c]=a&255,this[c+1]=a>>>8,c+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(a,c,l){return a=+a,c=c>>>0,l||L(this,a,c,2,65535,0),this[c]=a>>>8,this[c+1]=a&255,c+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(a,c,l){return a=+a,c=c>>>0,l||L(this,a,c,4,4294967295,0),this[c+3]=a>>>24,this[c+2]=a>>>16,this[c+1]=a>>>8,this[c]=a&255,c+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(a,c,l){return a=+a,c=c>>>0,l||L(this,a,c,4,4294967295,0),this[c]=a>>>24,this[c+1]=a>>>16,this[c+2]=a>>>8,this[c+3]=a&255,c+4},s.prototype.writeIntLE=function(a,c,l,g){if(a=+a,c=c>>>0,!g){var v=Math.pow(2,8*l-1);L(this,a,c,l,v-1,-v)}var O=0,F=1,$=0;for(this[c]=a&255;++O<l&&(F*=256);)a<0&&$===0&&this[c+O-1]!==0&&($=1),this[c+O]=(a/F>>0)-$&255;return c+l},s.prototype.writeIntBE=function(a,c,l,g){if(a=+a,c=c>>>0,!g){var v=Math.pow(2,8*l-1);L(this,a,c,l,v-1,-v)}var O=l-1,F=1,$=0;for(this[c+O]=a&255;--O>=0&&(F*=256);)a<0&&$===0&&this[c+O+1]!==0&&($=1),this[c+O]=(a/F>>0)-$&255;return c+l},s.prototype.writeInt8=function(a,c,l){return a=+a,c=c>>>0,l||L(this,a,c,1,127,-128),a<0&&(a=255+a+1),this[c]=a&255,c+1},s.prototype.writeInt16LE=function(a,c,l){return a=+a,c=c>>>0,l||L(this,a,c,2,32767,-32768),this[c]=a&255,this[c+1]=a>>>8,c+2},s.prototype.writeInt16BE=function(a,c,l){return a=+a,c=c>>>0,l||L(this,a,c,2,32767,-32768),this[c]=a>>>8,this[c+1]=a&255,c+2},s.prototype.writeInt32LE=function(a,c,l){return a=+a,c=c>>>0,l||L(this,a,c,4,2147483647,-2147483648),this[c]=a&255,this[c+1]=a>>>8,this[c+2]=a>>>16,this[c+3]=a>>>24,c+4},s.prototype.writeInt32BE=function(a,c,l){return a=+a,c=c>>>0,l||L(this,a,c,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[c]=a>>>24,this[c+1]=a>>>16,this[c+2]=a>>>8,this[c+3]=a&255,c+4};function j(u,a,c,l,g,v){if(c+l>u.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function it(u,a,c,l,g){return a=+a,c=c>>>0,g||j(u,a,c,4),ir.write(u,a,c,l,23,4),c+4}s.prototype.writeFloatLE=function(a,c,l){return it(this,a,c,!0,l)},s.prototype.writeFloatBE=function(a,c,l){return it(this,a,c,!1,l)};function ft(u,a,c,l,g){return a=+a,c=c>>>0,g||j(u,a,c,8),ir.write(u,a,c,l,52,8),c+8}s.prototype.writeDoubleLE=function(a,c,l){return ft(this,a,c,!0,l)},s.prototype.writeDoubleBE=function(a,c,l){return ft(this,a,c,!1,l)},s.prototype.copy=function(a,c,l,g){if(!s.isBuffer(a))throw new TypeError("argument should be a Buffer");if(l||(l=0),!g&&g!==0&&(g=this.length),c>=a.length&&(c=a.length),c||(c=0),g>0&&g<l&&(g=l),g===l||a.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(g<0)throw new RangeError("sourceEnd out of bounds");g>this.length&&(g=this.length),a.length-c<g-l&&(g=a.length-c+l);var v=g-l;return this===a&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,l,g):Uint8Array.prototype.set.call(a,this.subarray(l,g),c),v},s.prototype.fill=function(a,c,l,g){if(typeof a=="string"){if(typeof c=="string"?(g=c,c=0,l=this.length):typeof l=="string"&&(g=l,l=this.length),g!==void 0&&typeof g!="string")throw new TypeError("encoding must be a string");if(typeof g=="string"&&!s.isEncoding(g))throw new TypeError("Unknown encoding: "+g);if(a.length===1){var v=a.charCodeAt(0);(g==="utf8"&&v<128||g==="latin1")&&(a=v)}}else typeof a=="number"?a=a&255:typeof a=="boolean"&&(a=Number(a));if(c<0||this.length<c||this.length<l)throw new RangeError("Out of range index");if(l<=c)return this;c=c>>>0,l=l===void 0?this.length:l>>>0,a||(a=0);var O;if(typeof a=="number")for(O=c;O<l;++O)this[O]=a;else{var F=s.isBuffer(a)?a:s.from(a,g),$=F.length;if($===0)throw new TypeError('The value "'+a+'" is invalid for argument "value"');for(O=0;O<l-c;++O)this[O+c]=F[O%$]}return this};var lt=/[^+/0-9A-Za-z-_]/g;function Et(u){if(u=u.split("=")[0],u=u.trim().replace(lt,""),u.length<2)return"";for(;u.length%4!==0;)u=u+"=";return u}function bt(u,a){a=a||1/0;for(var c,l=u.length,g=null,v=[],O=0;O<l;++O){if(c=u.charCodeAt(O),c>55295&&c<57344){if(!g){if(c>56319){(a-=3)>-1&&v.push(239,191,189);continue}else if(O+1===l){(a-=3)>-1&&v.push(239,191,189);continue}g=c;continue}if(c<56320){(a-=3)>-1&&v.push(239,191,189),g=c;continue}c=(g-55296<<10|c-56320)+65536}else g&&(a-=3)>-1&&v.push(239,191,189);if(g=null,c<128){if((a-=1)<0)break;v.push(c)}else if(c<2048){if((a-=2)<0)break;v.push(c>>6|192,c&63|128)}else if(c<65536){if((a-=3)<0)break;v.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((a-=4)<0)break;v.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return v}function gt(u){for(var a=[],c=0;c<u.length;++c)a.push(u.charCodeAt(c)&255);return a}function V(u,a){for(var c,l,g,v=[],O=0;O<u.length&&!((a-=2)<0);++O)c=u.charCodeAt(O),l=c>>8,g=c%256,v.push(g),v.push(l);return v}function Q(u){return oo.toByteArray(Et(u))}function q(u,a,c,l){for(var g=0;g<l&&!(g+c>=a.length||g>=u.length);++g)a[g+c]=u[g];return g}function et(u,a){return u instanceof a||u!=null&&u.constructor!=null&&u.constructor.name!=null&&u.constructor.name===a.name}function Y(u){return u!==u}var jt=(function(){for(var u="0123456789abcdef",a=new Array(256),c=0;c<16;++c)for(var l=c*16,g=0;g<16;++g)a[l+g]=u[c]+u[g];return a})()}),H=qn.Buffer;qn.SlowBuffer;qn.INSPECT_MAX_BYTES;qn.kMaxLength;var fo=function(t,r){return fo=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])},fo(t,r)};function Yn(e,t){fo(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Pe=(function(e){Yn(t,e);function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return Object.defineProperty(t.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),t})(Error),nt=(function(e){Yn(t,e);function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return Object.defineProperty(t.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),t})(TypeError);function Wn(e){return e&&e.Math==Math&&e}function Qs(){return Wn(typeof globalThis=="object"&&globalThis)||Wn(typeof window=="object"&&window)||Wn(typeof self=="object"&&self)||Wn(typeof global=="object"&&global)||Function("return this")()}function yu(){var e=Qs();return typeof e.navigator=="object"&&e.navigator.product==="ReactNative"}var _u=function(t){var r=yu()?"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=H.alloc(t),i=0;i<t;++i)n[i]=Math.floor(Math.random()*256);return n},wu=function(){{if(typeof window<"u"){var e=window.crypto||window.msCrypto;if(e&&e.getRandomValues)return function(t){return e.getRandomValues(H.alloc(t))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(t){return global.crypto.getRandomValues(H.alloc(t))}:_u}},Zs=wu();function vu(e){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e))}function po(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}function Eu(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function bu(e){return Dr(e)&&Object.prototype.toString.call(e)==="[object Date]"}function Dr(e){return typeof e=="object"&&e!==null}function zn(e,t){var r=!1;function n(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return r||(console.warn(t),r=!0),e.apply(this,i)}return n}function Gn(e){if(ArrayBuffer.isView(e))return H.from(e.buffer,e.byteOffset,e.byteLength);if(vu(e))return H.from(e);throw new nt("Must use either Buffer or TypedArray")}var Su=/^(?:[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,ta=function(e){return typeof e=="string"&&Su.test(e)},lo=function(e){if(!ta(e))throw new nt('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var t=e.replace(/-/g,"");return H.from(t,"hex")},Bs=function(e,t){return t===void 0&&(t=!0),t?e.toString("hex",0,4)+"-"+e.toString("hex",4,6)+"-"+e.toString("hex",6,8)+"-"+e.toString("hex",8,10)+"-"+e.toString("hex",10,16):e.toString("hex")};var Ng=Math.pow(2,63)-1,Dg=-Math.pow(2,63),Iu=Math.pow(2,53),xu=-Math.pow(2,53);var ea=4;var Ae=(function(){function e(t,r){if(!(this instanceof e))return new e(t,r);if(t!=null&&typeof t!="string"&&!ArrayBuffer.isView(t)&&!(t instanceof ArrayBuffer)&&!Array.isArray(t))throw new nt("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=r??e.BSON_BINARY_SUBTYPE_DEFAULT,t==null?(this.buffer=H.alloc(e.BUFFER_SIZE),this.position=0):(typeof t=="string"?this.buffer=H.from(t,"binary"):Array.isArray(t)?this.buffer=H.from(t):this.buffer=Gn(t),this.position=this.buffer.byteLength)}return e.prototype.put=function(t){if(typeof t=="string"&&t.length!==1)throw new nt("only accepts single character String");if(typeof t!="number"&&t.length!==1)throw new nt("only accepts single character Uint8Array or Array");var r;if(typeof t=="string"?r=t.charCodeAt(0):typeof t=="number"?r=t:r=t[0],r<0||r>255)throw new nt("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=H.alloc(e.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},e.prototype.write=function(t,r){if(r=typeof r=="number"?r:this.position,this.buffer.length<r+t.length){var n=H.alloc(this.buffer.length+t.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(t)?(this.buffer.set(Gn(t),r),this.position=r+t.byteLength>this.position?r+t.length:this.position):typeof t=="string"&&(this.buffer.write(t,r,t.length,"binary"),this.position=r+t.length>this.position?r+t.length:this.position)},e.prototype.read=function(t,r){return r=r&&r>0?r:this.position,this.buffer.slice(t,t+r)},e.prototype.value=function(t){return t=!!t,t&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},e.prototype.length=function(){return this.position},e.prototype.toJSON=function(){return this.buffer.toString("base64")},e.prototype.toString=function(t){return this.buffer.toString(t)},e.prototype.toExtendedJSON=function(t){t=t||{};var r=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return t.legacy?{$binary:r,$type:n.length===1?"0"+n:n}:{$binary:{base64:r,subType:n.length===1?"0"+n:n}}},e.prototype.toUUID=function(){if(this.sub_type===e.SUBTYPE_UUID)return new Ms(this.buffer.slice(0,this.position));throw new Pe('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(e.SUBTYPE_UUID,'" is currently supported.'))},e.fromExtendedJSON=function(t,r){r=r||{};var n,i;if("$binary"in t?r.legacy&&typeof t.$binary=="string"&&"$type"in t?(i=t.$type?parseInt(t.$type,16):0,n=H.from(t.$binary,"base64")):typeof t.$binary!="string"&&(i=t.$binary.subType?parseInt(t.$binary.subType,16):0,n=H.from(t.$binary.base64,"base64")):"$uuid"in t&&(i=4,n=lo(t.$uuid)),!n)throw new nt("Unexpected Binary Extended JSON format ".concat(JSON.stringify(t)));return i===ea?new Ms(n):new e(n,i)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.value(!0);return'new Binary(Buffer.from("'.concat(t.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BUFFER_SIZE=256,e.SUBTYPE_DEFAULT=0,e.SUBTYPE_FUNCTION=1,e.SUBTYPE_BYTE_ARRAY=2,e.SUBTYPE_UUID_OLD=3,e.SUBTYPE_UUID=4,e.SUBTYPE_MD5=5,e.SUBTYPE_ENCRYPTED=6,e.SUBTYPE_COLUMN=7,e.SUBTYPE_USER_DEFINED=128,e})();Object.defineProperty(Ae.prototype,"_bsontype",{value:"Binary"});var so=16,Ms=(function(e){Yn(t,e);function t(r){var n=this,i,o;if(r==null)i=t.generate();else if(r instanceof t)i=H.from(r.buffer),o=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===so)i=Gn(r);else if(typeof r=="string")i=lo(r);else throw new nt("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=e.call(this,i,ea)||this,n.__id=o,n}return Object.defineProperty(t.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,t.cacheHexString&&(this.__id=Bs(r))},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(r){if(r===void 0&&(r=!0),t.cacheHexString&&this.__id)return this.__id;var n=Bs(this.id,r);return t.cacheHexString&&(this.__id=n),n},t.prototype.toString=function(r){return r?this.id.toString(r):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(r){if(!r)return!1;if(r instanceof t)return r.id.equals(this.id);try{return new t(r).id.equals(this.id)}catch{return!1}},t.prototype.toBinary=function(){return new Ae(this.id,Ae.SUBTYPE_UUID)},t.generate=function(){var r=Zs(so);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,H.from(r)},t.isValid=function(r){return r?r instanceof t?!0:typeof r=="string"?ta(r):po(r)?r.length!==so?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},t.createFromHexString=function(r){var n=lo(r);return new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},t})(Ae),Jn=(function(){function e(t,r){if(!(this instanceof e))return new e(t,r);this.code=t,this.scope=r}return e.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},e.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},e.fromExtendedJSON=function(t){return new e(t.$code,t.$scope)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.toJSON();return'new Code("'.concat(String(t.code),'"').concat(t.scope?", ".concat(JSON.stringify(t.scope)):"",")")},e})();Object.defineProperty(Jn.prototype,"_bsontype",{value:"Code"});function Ou(e){return Dr(e)&&e.$id!=null&&typeof e.$ref=="string"&&(e.$db==null||typeof e.$db=="string")}var Cr=(function(){function e(t,r,n,i){if(!(this instanceof e))return new e(t,r,n,i);var o=t.split(".");o.length===2&&(n=o.shift(),t=o.shift()),this.collection=t,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(e.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(t.$db=this.db),t},e.prototype.toExtendedJSON=function(t){t=t||{};var r={$ref:this.collection,$id:this.oid};return t.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},e.fromExtendedJSON=function(t){var r=Object.assign({},t);return delete r.$ref,delete r.$id,delete r.$db,new e(t.$ref,t.$id,t.$db,r)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(t),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},e})();Object.defineProperty(Cr.prototype,"_bsontype",{value:"DBRef"});var Ut=void 0;try{Ut=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 Fs=65536,Tu=1<<24,sr=Fs*Fs,ra=sr*sr,ks=ra/2,Vs={},$s={},U=(function(){function e(t,r,n){if(t===void 0&&(t=0),!(this instanceof e))return new e(t,r,n);typeof t=="bigint"?Object.assign(this,e.fromBigInt(t,!!r)):typeof t=="string"?Object.assign(this,e.fromString(t,!!r)):(this.low=t|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return e.fromBits=function(t,r,n){return new e(t,r,n)},e.fromInt=function(t,r){var n,i,o;return r?(t>>>=0,(o=0<=t&&t<256)&&(i=$s[t],i)?i:(n=e.fromBits(t,(t|0)<0?-1:0,!0),o&&($s[t]=n),n)):(t|=0,(o=-128<=t&&t<128)&&(i=Vs[t],i)?i:(n=e.fromBits(t,t<0?-1:0,!1),o&&(Vs[t]=n),n))},e.fromNumber=function(t,r){if(isNaN(t))return r?e.UZERO:e.ZERO;if(r){if(t<0)return e.UZERO;if(t>=ra)return e.MAX_UNSIGNED_VALUE}else{if(t<=-ks)return e.MIN_VALUE;if(t+1>=ks)return e.MAX_VALUE}return t<0?e.fromNumber(-t,r).neg():e.fromBits(t%sr|0,t/sr|0,r)},e.fromBigInt=function(t,r){return e.fromString(t.toString(),r)},e.fromString=function(t,r,n){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return e.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=t.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return e.fromString(t.substring(1),r,n).neg();for(var o=e.fromNumber(Math.pow(n,8)),s=e.ZERO,f=0;f<t.length;f+=8){var p=Math.min(8,t.length-f),d=parseInt(t.substring(f,f+p),n);if(p<8){var m=e.fromNumber(Math.pow(n,p));s=s.mul(m).add(e.fromNumber(d))}else s=s.mul(o),s=s.add(e.fromNumber(d))}return s.unsigned=r,s},e.fromBytes=function(t,r,n){return n?e.fromBytesLE(t,r):e.fromBytesBE(t,r)},e.fromBytesLE=function(t,r){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)},e.fromBytesBE=function(t,r){return new e(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)},e.isLong=function(t){return Dr(t)&&t.__isLong__===!0},e.fromValue=function(t,r){return typeof t=="number"?e.fromNumber(t,r):typeof t=="string"?e.fromString(t,r):e.fromBits(t.low,t.high,typeof r=="boolean"?r:t.unsigned)},e.prototype.add=function(t){e.isLong(t)||(t=e.fromValue(t));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,o=this.low&65535,s=t.high>>>16,f=t.high&65535,p=t.low>>>16,d=t.low&65535,m=0,h=0,b=0,y=0;return y+=o+d,b+=y>>>16,y&=65535,b+=i+p,h+=b>>>16,b&=65535,h+=n+f,m+=h>>>16,h&=65535,m+=r+s,m&=65535,e.fromBits(b<<16|y,m<<16|h,this.unsigned)},e.prototype.and=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low&t.low,this.high&t.high,this.unsigned)},e.prototype.compare=function(t){if(e.isLong(t)||(t=e.fromValue(t)),this.eq(t))return 0;var r=this.isNegative(),n=t.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},e.prototype.comp=function(t){return this.compare(t)},e.prototype.divide=function(t){if(e.isLong(t)||(t=e.fromValue(t)),t.isZero())throw Error("division by zero");if(Ut){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?Ut.div_u:Ut.div_s)(this.low,this.high,t.low,t.high);return e.fromBits(r,Ut.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var n,i,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return e.UZERO;if(t.gt(this.shru(1)))return e.UONE;o=e.UZERO}else{if(this.eq(e.MIN_VALUE)){if(t.eq(e.ONE)||t.eq(e.NEG_ONE))return e.MIN_VALUE;if(t.eq(e.MIN_VALUE))return e.ONE;var s=this.shr(1);return n=s.div(t).shl(1),n.eq(e.ZERO)?t.isNegative()?e.ONE:e.NEG_ONE:(i=this.sub(t.mul(n)),o=n.add(i.div(t)),o)}else if(t.eq(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=e.ZERO}for(i=this;i.gte(t);){n=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var f=Math.ceil(Math.log(n)/Math.LN2),p=f<=48?1:Math.pow(2,f-48),d=e.fromNumber(n),m=d.mul(t);m.isNegative()||m.gt(i);)n-=p,d=e.fromNumber(n,this.unsigned),m=d.mul(t);d.isZero()&&(d=e.ONE),o=o.add(d),i=i.sub(m)}return o},e.prototype.div=function(t){return this.divide(t)},e.prototype.equals=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low},e.prototype.eq=function(t){return this.equals(t)},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(e.MIN_VALUE)?64:this.neg().getNumBitsAbs();var t=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(t&1<<r)===0;r--);return this.high!==0?r+33:r+1},e.prototype.greaterThan=function(t){return this.comp(t)>0},e.prototype.gt=function(t){return this.greaterThan(t)},e.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},e.prototype.gte=function(t){return this.greaterThanOrEqual(t)},e.prototype.ge=function(t){return this.greaterThanOrEqual(t)},e.prototype.isEven=function(){return(this.low&1)===0},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isOdd=function(){return(this.low&1)===1},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isZero=function(){return this.high===0&&this.low===0},e.prototype.lessThan=function(t){return this.comp(t)<0},e.prototype.lt=function(t){return this.lessThan(t)},e.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},e.prototype.lte=function(t){return this.lessThanOrEqual(t)},e.prototype.modulo=function(t){if(e.isLong(t)||(t=e.fromValue(t)),Ut){var r=(this.unsigned?Ut.rem_u:Ut.rem_s)(this.low,this.high,t.low,t.high);return e.fromBits(r,Ut.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},e.prototype.mod=function(t){return this.modulo(t)},e.prototype.rem=function(t){return this.modulo(t)},e.prototype.multiply=function(t){if(this.isZero())return e.ZERO;if(e.isLong(t)||(t=e.fromValue(t)),Ut){var r=Ut.mul(this.low,this.high,t.low,t.high);return e.fromBits(r,Ut.get_high(),this.unsigned)}if(t.isZero())return e.ZERO;if(this.eq(e.MIN_VALUE))return t.isOdd()?e.MIN_VALUE:e.ZERO;if(t.eq(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(e.TWO_PWR_24)&&t.lt(e.TWO_PWR_24))return e.fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,o=this.low>>>16,s=this.low&65535,f=t.high>>>16,p=t.high&65535,d=t.low>>>16,m=t.low&65535,h=0,b=0,y=0,E=0;return E+=s*m,y+=E>>>16,E&=65535,y+=o*m,b+=y>>>16,y&=65535,y+=s*d,b+=y>>>16,y&=65535,b+=i*m,h+=b>>>16,b&=65535,b+=o*d,h+=b>>>16,b&=65535,b+=s*p,h+=b>>>16,b&=65535,h+=n*m+i*d+o*p+s*f,h&=65535,e.fromBits(y<<16|E,h<<16|b,this.unsigned)},e.prototype.mul=function(t){return this.multiply(t)},e.prototype.negate=function(){return!this.unsigned&&this.eq(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=function(){return this.negate()},e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.notEquals=function(t){return!this.equals(t)},e.prototype.neq=function(t){return this.notEquals(t)},e.prototype.ne=function(t){return this.notEquals(t)},e.prototype.or=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low|t.low,this.high|t.high,this.unsigned)},e.prototype.shiftLeft=function(t){return e.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?e.fromBits(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):e.fromBits(0,this.low<<t-32,this.unsigned)},e.prototype.shl=function(t){return this.shiftLeft(t)},e.prototype.shiftRight=function(t){return e.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?e.fromBits(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):e.fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=function(t){return this.shiftRight(t)},e.prototype.shiftRightUnsigned=function(t){if(e.isLong(t)&&(t=t.toInt()),t&=63,t===0)return this;var r=this.high;if(t<32){var n=this.low;return e.fromBits(n>>>t|r<<32-t,r>>>t,this.unsigned)}else return t===32?e.fromBits(r,0,this.unsigned):e.fromBits(r>>>t-32,0,this.unsigned)},e.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},e.prototype.shru=function(t){return this.shiftRightUnsigned(t)},e.prototype.subtract=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.add(t.neg())},e.prototype.sub=function(t){return this.subtract(t)},e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*sr+(this.low>>>0):this.high*sr+(this.low>>>0)},e.prototype.toBigInt=function(){return BigInt(this.toString())},e.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},e.prototype.toBytesLE=function(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]},e.prototype.toBytesBE=function(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},e.prototype.toSigned=function(){return this.unsigned?e.fromBits(this.low,this.high,!1):this},e.prototype.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(e.MIN_VALUE)){var r=e.fromNumber(t),n=this.div(r),i=n.mul(r).sub(this);return n.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var o=e.fromNumber(Math.pow(t,6),this.unsigned),s=this,f="";;){var p=s.div(o),d=s.sub(p.mul(o)).toInt()>>>0,m=d.toString(t);if(s=p,s.isZero())return m+f;for(;m.length<6;)m="0"+m;f=""+m+f}},e.prototype.toUnsigned=function(){return this.unsigned?this:e.fromBits(this.low,this.high,!0)},e.prototype.xor=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low^t.low,this.high^t.high,this.unsigned)},e.prototype.eqz=function(){return this.isZero()},e.prototype.le=function(t){return this.lessThanOrEqual(t)},e.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},e.fromExtendedJSON=function(t,r){var n=e.fromString(t.$numberLong);return r&&r.relaxed?n.toNumber():n},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},e.TWO_PWR_24=e.fromInt(Tu),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e})();Object.defineProperty(U.prototype,"__isLong__",{value:!0});Object.defineProperty(U.prototype,"_bsontype",{value:"Long"});var Cu=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Nu=/^(\+|-)?(Infinity|inf)$/i,Du=/^(\+|-)?NaN$/i,Tr=6111,ao=-6176,js=6176,Ru=34,co=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Hs=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ws=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Pu=/^([-+])?(\d+)?$/,Au=31,Gs=16383,Lu=30,Uu=31;function qs(e){return!isNaN(parseInt(e,10))}function Bu(e){var t=U.fromNumber(1e9),r=U.fromNumber(0);if(!e.parts[0]&&!e.parts[1]&&!e.parts[2]&&!e.parts[3])return{quotient:e,rem:r};for(var n=0;n<=3;n++)r=r.shiftLeft(32),r=r.add(new U(e.parts[n],0)),e.parts[n]=r.div(t).low,r=r.modulo(t);return{quotient:e,rem:r}}function Mu(e,t){if(!e&&!t)return{high:U.fromNumber(0),low:U.fromNumber(0)};var r=e.shiftRightUnsigned(32),n=new U(e.getLowBits(),0),i=t.shiftRightUnsigned(32),o=new U(t.getLowBits(),0),s=r.multiply(i),f=r.multiply(o),p=n.multiply(i),d=n.multiply(o);return s=s.add(f.shiftRightUnsigned(32)),f=new U(f.getLowBits(),0).add(p).add(d.shiftRightUnsigned(32)),s=s.add(f.shiftRightUnsigned(32)),d=f.shiftLeft(32).add(new U(d.getLowBits(),0)),{high:s,low:d}}function Fu(e,t){var r=e.high>>>0,n=t.high>>>0;if(r<n)return!0;if(r===n){var i=e.low>>>0,o=t.low>>>0;if(i<o)return!0}return!1}function or(e,t){throw new nt('"'.concat(e,'" is not a valid Decimal128 string - ').concat(t))}var ho=(function(){function e(t){if(!(this instanceof e))return new e(t);if(typeof t=="string")this.bytes=e.fromString(t).bytes;else if(po(t)){if(t.byteLength!==16)throw new nt("Decimal128 must take a Buffer of 16 bytes");this.bytes=t}else throw new nt("Decimal128 must take a Buffer or string")}return e.fromString=function(t){var r=!1,n=!1,i=!1,o=0,s=0,f=0,p=0,d=0,m=[0],h=0,b=0,y=0,E=0,D=0,C=0,R=new U(0,0),A=new U(0,0),N=0,P=0;if(t.length>=7e3)throw new nt(""+t+" not a valid Decimal128 string");var G=t.match(Cu),ct=t.match(Nu),Ot=t.match(Du);if(!G&&!ct&&!Ot||t.length===0)throw new nt(""+t+" not a valid Decimal128 string");if(G){var Vt=G[2],St=G[4],Yt=G[5],ut=G[6];St&&ut===void 0&&or(t,"missing exponent power"),St&&Vt===void 0&&or(t,"missing exponent base"),St===void 0&&(Yt||ut)&&or(t,"missing e before exponent")}if((t[P]==="+"||t[P]==="-")&&(r=t[P++]==="-"),!qs(t[P])&&t[P]!=="."){if(t[P]==="i"||t[P]==="I")return new e(H.from(r?Hs:Ws));if(t[P]==="N")return new e(H.from(co))}for(;qs(t[P])||t[P]===".";){if(t[P]==="."){n&&or(t,"contains multiple periods"),n=!0,P=P+1;continue}h<34&&(t[P]!=="0"||i)&&(i||(d=s),i=!0,m[b++]=parseInt(t[P],10),h=h+1),i&&(f=f+1),n&&(p=p+1),s=s+1,P=P+1}if(n&&!s)throw new nt(""+t+" not a valid Decimal128 string");if(t[P]==="e"||t[P]==="E"){var dt=t.substr(++P).match(Pu);if(!dt||!dt[2])return new e(H.from(co));D=parseInt(dt[0],10),P=P+dt[0].length}if(t[P])return new e(H.from(co));if(y=0,!h)y=0,E=0,m[0]=0,f=1,h=1,o=0;else if(E=h-1,o=f,o!==1)for(;m[d+o-1]===0;)o=o-1;for(D<=p&&p-D>16384?D=ao:D=D-p;D>Tr;){if(E=E+1,E-y>Ru){var zt=m.join("");if(zt.match(/^0+$/)){D=Tr;break}or(t,"overflow")}D=D-1}for(;D<ao||h<f;){if(E===0&&o<h){D=ao,o=0;break}if(h<f?f=f-1:E=E-1,D<Tr)D=D+1;else{var zt=m.join("");if(zt.match(/^0+$/)){D=Tr;break}or(t,"overflow")}}if(E-y+1<o){var $t=s;n&&(d=d+1,$t=$t+1),r&&(d=d+1,$t=$t+1);var fe=parseInt(t[d+E+1],10),w=0;if(fe>=5&&(w=1,fe===5)){for(w=m[E]%2===1?1:0,C=d+E+2;C<$t;C++)if(parseInt(t[C],10)){w=1;break}}if(w){for(var _=E;_>=0;_--)if(++m[_]>9&&(m[_]=0,_===0))if(D<Tr)D=D+1,m[_]=1;else return new e(H.from(r?Hs:Ws))}}if(R=U.fromNumber(0),A=U.fromNumber(0),o===0)R=U.fromNumber(0),A=U.fromNumber(0);else if(E-y<17){var _=y;for(A=U.fromNumber(m[_++]),R=new U(0,0);_<=E;_++)A=A.multiply(U.fromNumber(10)),A=A.add(U.fromNumber(m[_]))}else{var _=y;for(R=U.fromNumber(m[_++]);_<=E-17;_++)R=R.multiply(U.fromNumber(10)),R=R.add(U.fromNumber(m[_]));for(A=U.fromNumber(m[_++]);_<=E;_++)A=A.multiply(U.fromNumber(10)),A=A.add(U.fromNumber(m[_]))}var T=Mu(R,U.fromString("100000000000000000"));T.low=T.low.add(A),Fu(T.low,A)&&(T.high=T.high.add(U.fromNumber(1))),N=D+js;var I={low:U.fromNumber(0),high:U.fromNumber(0)};T.high.shiftRightUnsigned(49).and(U.fromNumber(1)).equals(U.fromNumber(1))?(I.high=I.high.or(U.fromNumber(3).shiftLeft(61)),I.high=I.high.or(U.fromNumber(N).and(U.fromNumber(16383).shiftLeft(47))),I.high=I.high.or(T.high.and(U.fromNumber(0x7fffffffffff)))):(I.high=I.high.or(U.fromNumber(N&16383).shiftLeft(49)),I.high=I.high.or(T.high.and(U.fromNumber(562949953421311)))),I.low=T.low,r&&(I.high=I.high.or(U.fromString("9223372036854775808")));var x=H.alloc(16);return P=0,x[P++]=I.low.low&255,x[P++]=I.low.low>>8&255,x[P++]=I.low.low>>16&255,x[P++]=I.low.low>>24&255,x[P++]=I.low.high&255,x[P++]=I.low.high>>8&255,x[P++]=I.low.high>>16&255,x[P++]=I.low.high>>24&255,x[P++]=I.high.low&255,x[P++]=I.high.low>>8&255,x[P++]=I.high.low>>16&255,x[P++]=I.high.low>>24&255,x[P++]=I.high.high&255,x[P++]=I.high.high>>8&255,x[P++]=I.high.high>>16&255,x[P++]=I.high.high>>24&255,new e(x)},e.prototype.toString=function(){for(var t,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var o=0,s=!1,f,p={parts:[0,0,0,0]},d,m,h=[];o=0;var b=this.bytes,y=b[o++]|b[o++]<<8|b[o++]<<16|b[o++]<<24,E=b[o++]|b[o++]<<8|b[o++]<<16|b[o++]<<24,D=b[o++]|b[o++]<<8|b[o++]<<16|b[o++]<<24,C=b[o++]|b[o++]<<8|b[o++]<<16|b[o++]<<24;o=0;var R={low:new U(y,E),high:new U(D,C)};R.high.lessThan(U.ZERO)&&h.push("-");var A=C>>26&Au;if(A>>3===3){if(A===Lu)return h.join("")+"Infinity";if(A===Uu)return"NaN";t=C>>15&Gs,f=8+(C>>14&1)}else f=C>>14&7,t=C>>17&Gs;var N=t-js;if(p.parts[0]=(C&16383)+((f&15)<<14),p.parts[1]=D,p.parts[2]=E,p.parts[3]=y,p.parts[0]===0&&p.parts[1]===0&&p.parts[2]===0&&p.parts[3]===0)s=!0;else for(m=3;m>=0;m--){var P=0,G=Bu(p);if(p=G.quotient,P=G.rem.low,!!P)for(d=8;d>=0;d--)n[m*9+d]=P%10,P=Math.floor(P/10)}if(s)r=1,n[o]=0;else for(r=36;!n[o];)r=r-1,o=o+1;var ct=r-1+N;if(ct>=34||ct<=-7||N>0){if(r>34)return h.push("".concat(0)),N>0?h.push("E+".concat(N)):N<0&&h.push("E".concat(N)),h.join("");h.push("".concat(n[o++])),r=r-1,r&&h.push(".");for(var i=0;i<r;i++)h.push("".concat(n[o++]));h.push("E"),ct>0?h.push("+".concat(ct)):h.push("".concat(ct))}else if(N>=0)for(var i=0;i<r;i++)h.push("".concat(n[o++]));else{var Ot=r+N;if(Ot>0)for(var i=0;i<Ot;i++)h.push("".concat(n[o++]));else h.push("0");for(h.push(".");Ot++<0;)h.push("0");for(var i=0;i<r-Math.max(Ot-1,0);i++)h.push("".concat(n[o++]))}return h.join("")},e.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},e.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},e.fromExtendedJSON=function(t){return e.fromString(t.$numberDecimal)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},e})();Object.defineProperty(ho.prototype,"_bsontype",{value:"Decimal128"});var Xn=(function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t}return e.prototype.valueOf=function(){return this.value},e.prototype.toJSON=function(){return this.value},e.prototype.toString=function(t){return this.value.toString(t)},e.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.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()}},e.fromExtendedJSON=function(t,r){var n=parseFloat(t.$numberDouble);return r&&r.relaxed?n:new e(n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.toExtendedJSON();return"new Double(".concat(t.$numberDouble,")")},e})();Object.defineProperty(Xn.prototype,"_bsontype",{value:"Double"});var Kn=(function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t|0}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(t){return this.value.toString(t)},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},e.fromExtendedJSON=function(t,r){return r&&r.relaxed?parseInt(t.$numberInt,10):new e(t.$numberInt)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},e})();Object.defineProperty(Kn.prototype,"_bsontype",{value:"Int32"});var mo=(function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$maxKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MaxKey()"},e})();Object.defineProperty(mo.prototype,"_bsontype",{value:"MaxKey"});var go=(function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$minKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MinKey()"},e})();Object.defineProperty(go.prototype,"_bsontype",{value:"MinKey"});var ku=new RegExp("^[0-9a-fA-F]{24}$"),Re=null,Qt=Symbol("id"),mt=(function(){function e(t){if(!(this instanceof e))return new e(t);var r;if(typeof t=="object"&&t&&"id"in t){if(typeof t.id!="string"&&!ArrayBuffer.isView(t.id))throw new nt("Argument passed in must have an id that is of type string or Buffer");"toHexString"in t&&typeof t.toHexString=="function"?r=H.from(t.toHexString(),"hex"):r=t.id}else r=t;if(r==null||typeof r=="number")this[Qt]=e.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Qt]=r instanceof H?r:Gn(r);else if(typeof r=="string")if(r.length===12){var n=H.from(r);if(n.byteLength===12)this[Qt]=n;else throw new nt("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&ku.test(r))this[Qt]=H.from(r,"hex");else throw new nt("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new nt("Argument passed in does not match the accepted types");e.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(e.prototype,"id",{get:function(){return this[Qt]},set:function(t){this[Qt]=t,e.cacheHexString&&(this.__id=t.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(){if(e.cacheHexString&&this.__id)return this.__id;var t=this.id.toString("hex");return e.cacheHexString&&!this.__id&&(this.__id=t),t},e.getInc=function(){return e.index=(e.index+1)%16777215},e.generate=function(t){typeof t!="number"&&(t=Math.floor(Date.now()/1e3));var r=e.getInc(),n=H.alloc(12);return n.writeUInt32BE(t,0),Re===null&&(Re=Zs(5)),n[4]=Re[0],n[5]=Re[1],n[6]=Re[2],n[7]=Re[3],n[8]=Re[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},e.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(t==null)return!1;if(t instanceof e)return this[Qt][11]===t[Qt][11]&&this[Qt].equals(t[Qt]);if(typeof t=="string"&&e.isValid(t)&&t.length===12&&po(this.id))return t===H.prototype.toString.call(this.id,"latin1");if(typeof t=="string"&&e.isValid(t)&&t.length===24)return t.toLowerCase()===this.toHexString();if(typeof t=="string"&&e.isValid(t)&&t.length===12)return H.from(t).equals(this.id);if(typeof t=="object"&&"toHexString"in t&&typeof t.toHexString=="function"){var r=t.toHexString(),n=this.toHexString().toLowerCase();return typeof r=="string"&&r.toLowerCase()===n}return!1},e.prototype.getTimestamp=function(){var t=new Date,r=this.id.readUInt32BE(0);return t.setTime(Math.floor(r)*1e3),t},e.createPk=function(){return new e},e.createFromTime=function(t){var r=H.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(t,0),new e(r)},e.createFromHexString=function(t){if(typeof t>"u"||t!=null&&t.length!==24)throw new nt("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new e(H.from(t,"hex"))},e.isValid=function(t){if(t==null)return!1;try{return new e(t),!0}catch{return!1}},e.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},e.fromExtendedJSON=function(t){return new e(t.$oid)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},e.index=Math.floor(Math.random()*16777215),e})();Object.defineProperty(mt.prototype,"generate",{value:zn(function(e){return mt.generate(e)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(mt.prototype,"getInc",{value:zn(function(){return mt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(mt.prototype,"get_inc",{value:zn(function(){return mt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(mt,"get_inc",{value:zn(function(){return mt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(mt.prototype,"_bsontype",{value:"ObjectID"});function Vu(e){return e.split("").sort().join("")}var Nr=(function(){function e(t,r){if(!(this instanceof e))return new e(t,r);if(this.pattern=t,this.options=Vu(r??""),this.pattern.indexOf("\0")!==-1)throw new Pe("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new Pe("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 Pe("The regular expression option [".concat(this.options[n],"] is not supported"))}return e.parseOptions=function(t){return t?t.split("").sort().join(""):""},e.prototype.toExtendedJSON=function(t){return t=t||{},t.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},e.fromExtendedJSON=function(t){if("$regex"in t)if(typeof t.$regex!="string"){if(t.$regex._bsontype==="BSONRegExp")return t}else return new e(t.$regex,e.parseOptions(t.$options));if("$regularExpression"in t)return new e(t.$regularExpression.pattern,e.parseOptions(t.$regularExpression.options));throw new nt("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(t)))},e})();Object.defineProperty(Nr.prototype,"_bsontype",{value:"BSONRegExp"});var yo=(function(){function e(t){if(!(this instanceof e))return new e(t);this.value=t}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(){return this.value},e.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(){return{$symbol:this.value}},e.fromExtendedJSON=function(t){return new e(t.$symbol)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e})();Object.defineProperty(yo.prototype,"_bsontype",{value:"Symbol"});var $u=U,na=(function(e){Yn(t,e);function t(r,n){var i=this;return i instanceof t?(U.isLong(r)?i=e.call(this,r.low,r.high,!0)||this:Dr(r)&&typeof r.t<"u"&&typeof r.i<"u"?i=e.call(this,r.i,r.t,!0)||this:i=e.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new t(r,n)}return t.prototype.toJSON=function(){return{$timestamp:this.toString()}},t.fromInt=function(r){return new t(U.fromInt(r,!0))},t.fromNumber=function(r){return new t(U.fromNumber(r,!0))},t.fromBits=function(r,n){return new t(r,n)},t.fromString=function(r,n){return new t(U.fromString(r,!0,n))},t.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},t.fromExtendedJSON=function(r){return new t(r.$timestamp)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},t.MAX_VALUE=U.MAX_UNSIGNED_VALUE,t})($u);function ju(e){return Dr(e)&&Reflect.has(e,"_bsontype")&&typeof e._bsontype=="string"}var ia=2147483647,oa=-2147483648,sa=9223372036854776e3,aa=-9223372036854776e3,Hu={$oid:mt,$binary:Ae,$uuid:Ae,$symbol:yo,$numberInt:Kn,$numberDecimal:ho,$numberDouble:Xn,$numberLong:U,$minKey:go,$maxKey:mo,$regex:Nr,$regularExpression:Nr,$timestamp:na};function ca(e,t){if(t===void 0&&(t={}),typeof e=="number"){if(t.relaxed||t.legacy)return e;if(Math.floor(e)===e){if(e>=oa&&e<=ia)return new Kn(e);if(e>=aa&&e<=sa)return U.fromNumber(e)}return new Xn(e)}if(e==null||typeof e!="object")return e;if(e.$undefined)return null;for(var r=Object.keys(e).filter(function(h){return h.startsWith("$")&&e[h]!=null}),n=0;n<r.length;n++){var i=Hu[r[n]];if(i)return i.fromExtendedJSON(e,t)}if(e.$date!=null){var o=e.$date,s=new Date;return t.legacy?typeof o=="number"?s.setTime(o):typeof o=="string"&&s.setTime(Date.parse(o)):typeof o=="string"?s.setTime(Date.parse(o)):U.isLong(o)?s.setTime(o.toNumber()):typeof o=="number"&&t.relaxed&&s.setTime(o),s}if(e.$code!=null){var f=Object.assign({},e);return e.$scope&&(f.$scope=ca(e.$scope)),Jn.fromExtendedJSON(e)}if(Ou(e)||e.$dbPointer){var p=e.$ref?e:e.$dbPointer;if(p instanceof Cr)return p;var d=Object.keys(p).filter(function(h){return h.startsWith("$")}),m=!0;if(d.forEach(function(h){["$ref","$id","$db"].indexOf(h)===-1&&(m=!1)}),m)return Cr.fromExtendedJSON(p)}return e}function Wu(e,t){return e.map(function(r,n){t.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return _e(r,t)}finally{t.seenObjects.pop()}})}function Ys(e){var t=e.toISOString();return e.getUTCMilliseconds()!==0?t:t.slice(0,-5)+"Z"}function _e(e,t){if((typeof e=="object"||typeof e=="function")&&e!==null){var r=t.seenObjects.findIndex(function(R){return R.obj===e});if(r!==-1){var n=t.seenObjects.map(function(R){return R.propertyName}),i=n.slice(0,r).map(function(R){return"".concat(R," -> ")}).join(""),o=n[r],s=" -> "+n.slice(r+1,n.length-1).map(function(R){return"".concat(R," -> ")}).join(""),f=n[n.length-1],p=" ".repeat(i.length+o.length/2),d="-".repeat(s.length+(o.length+f.length)/2-1);throw new nt(`Converting circular structure to EJSON:
11
- `+" ".concat(i).concat(o).concat(s).concat(f,`
12
- `)+" ".concat(p,"\\").concat(d,"/"))}t.seenObjects[t.seenObjects.length-1].obj=e}if(Array.isArray(e))return Wu(e,t);if(e===void 0)return null;if(e instanceof Date||bu(e)){var m=e.getTime(),h=m>-1&&m<2534023188e5;return t.legacy?t.relaxed&&h?{$date:e.getTime()}:{$date:Ys(e)}:t.relaxed&&h?{$date:Ys(e)}:{$date:{$numberLong:e.getTime().toString()}}}if(typeof e=="number"&&(!t.relaxed||!isFinite(e))){if(Math.floor(e)===e){var b=e>=oa&&e<=ia,y=e>=aa&&e<=sa;if(b)return{$numberInt:e.toString()};if(y)return{$numberLong:e.toString()}}return{$numberDouble:e.toString()}}if(e instanceof RegExp||Eu(e)){var E=e.flags;if(E===void 0){var D=e.toString().match(/[gimuy]*$/);D&&(E=D[0])}var C=new Nr(e.source,E);return C.toExtendedJSON(t)}return e!=null&&typeof e=="object"?qu(e,t):e}var Gu={Binary:function(e){return new Ae(e.value(),e.sub_type)},Code:function(e){return new Jn(e.code,e.scope)},DBRef:function(e){return new Cr(e.collection||e.namespace,e.oid,e.db,e.fields)},Decimal128:function(e){return new ho(e.bytes)},Double:function(e){return new Xn(e.value)},Int32:function(e){return new Kn(e.value)},Long:function(e){return U.fromBits(e.low!=null?e.low:e.low_,e.low!=null?e.high:e.high_,e.low!=null?e.unsigned:e.unsigned_)},MaxKey:function(){return new mo},MinKey:function(){return new go},ObjectID:function(e){return new mt(e)},ObjectId:function(e){return new mt(e)},BSONRegExp:function(e){return new Nr(e.pattern,e.options)},Symbol:function(e){return new yo(e.value)},Timestamp:function(e){return na.fromBits(e.low,e.high)}};function qu(e,t){if(e==null||typeof e!="object")throw new Pe("not an object instance");var r=e._bsontype;if(typeof r>"u"){var n={};for(var i in e){t.seenObjects.push({propertyName:i,obj:null});try{var o=_e(e[i],t);i==="__proto__"?Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):n[i]=o}finally{t.seenObjects.pop()}}return n}else if(ju(e)){var s=e;if(typeof s.toExtendedJSON!="function"){var f=Gu[e._bsontype];if(!f)throw new nt("Unrecognized or invalid _bsontype: "+e._bsontype);s=f(s)}return r==="Code"&&s.scope?s=new Jn(s.code,_e(s.scope,t)):r==="DBRef"&&s.oid&&(s=new Cr(_e(s.collection,t),_e(s.oid,t),_e(s.db,t),_e(s.fields,t))),s.toExtendedJSON(t)}else throw new Pe("_bsontype must be a string, but was: "+typeof r)}var zs;(function(e){function t(o,s){var f=Object.assign({},{relaxed:!0,legacy:!1},s);return typeof f.relaxed=="boolean"&&(f.strict=!f.relaxed),typeof f.strict=="boolean"&&(f.relaxed=!f.strict),JSON.parse(o,function(p,d){if(p.indexOf("\0")!==-1)throw new Pe("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(p)));return ca(d,f)})}e.parse=t;function r(o,s,f,p){f!=null&&typeof f=="object"&&(p=f,f=0),s!=null&&typeof s=="object"&&!Array.isArray(s)&&(p=s,s=void 0,f=0);var d=Object.assign({relaxed:!0,legacy:!1},p,{seenObjects:[{propertyName:"(root)",obj:null}]}),m=_e(o,d);return JSON.stringify(m,s,f)}e.stringify=r;function n(o,s){return s=s||{},JSON.parse(r(o,s))}e.serialize=n;function i(o,s){return s=s||{},t(JSON.stringify(o),s)}e.deserialize=i})(zs||(zs={}));var Js,Xs=Qs();Xs.Map?Js=Xs.Map:Js=(function(){function e(t){t===void 0&&(t=[]),this._keys=[],this._values={};for(var r=0;r<t.length;r++)if(t[r]!=null){var n=t[r],i=n[0],o=n[1];this._keys.push(i),this._values[i]={v:o,i:this._keys.length-1}}}return e.prototype.clear=function(){this._keys=[],this._values={}},e.prototype.delete=function(t){var r=this._values[t];return r==null?!1:(delete this._values[t],this._keys.splice(r.i,1),!0)},e.prototype.entries=function(){var t=this,r=0;return{next:function(){var n=t._keys[r++];return{value:n!==void 0?[n,t._values[n].v]:void 0,done:n===void 0}}}},e.prototype.forEach=function(t,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];t.call(r,this._values[i].v,i,r)}},e.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},e.prototype.has=function(t){return this._values[t]!=null},e.prototype.keys=function(){var t=this,r=0;return{next:function(){var n=t._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},e.prototype.set=function(t,r){return this._values[t]?(this._values[t].v=r,this):(this._keys.push(t),this._values[t]={v:r,i:this._keys.length-1},this)},e.prototype.values=function(){var t=this,r=0;return{next:function(){var n=t._keys[r++];return{value:n!==void 0?t._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),e})();var Rg=U.fromNumber(Iu),Pg=U.fromNumber(xu);var uo=new Uint8Array(8),Ag=new DataView(uo.buffer,uo.byteOffset,uo.byteLength);var Yu=1024*1024*17,Lg=H.alloc(Yu);var Mt=class{constructor(t,r={},n,i){this.name=t;this.properties=r;this.id=i?new mt(i):new mt,this.occurred=new Date,n&&(this.trigger=new Hn(n)),this.newEvent=!i}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale;setVideos(t){t&&(this.videos=[t.id],this.properties.current??={videoID:t.id})}};function kg(){return window.CooeeSDK?.uaParser.getDevice().type==="mobile"}function Vg(e,t){Object.assign(e.style,t)}function $g(e,t,r){if(t){if(!r){e.style.removeProperty(t);return}e.style.setProperty(t,r,"important")}}function _o(e){if(!e)return!1;if(e.tagName.toLowerCase()==="cart-drawer"&&e.hasAttribute("open"))return!0;let r=e.getBoundingClientRect(),n=(window.innerHeight||document.documentElement.clientHeight)+.5,i=(window.innerWidth||document.documentElement.clientWidth)+.5,o=getComputedStyle(e);if(o.display==="none"||o.visibility==="hidden"||parseFloat(o.opacity)===0||e.hidden||!(e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0))return!1;let d=Math.max(0,Math.min(r.right,i)-Math.max(r.left,0)),m=Math.max(0,Math.min(r.bottom,n)-Math.max(r.top,0)),h=d*m,b=r.width*r.height;if(!(b>0&&h/b>=.1))return!1;let E=r.top<=n&&r.bottom>=0,D=r.left<=i&&r.right>=0,C=E&&D,R=o.transform.match(/matrix\(([^)]+)\)/),A=0,N=0;if(R){let G=R[1].split(", ").map(parseFloat);A=G[4],N=G[5]}let P=A+r.left>i||A+r.right<0||N+r.top>n||N+r.bottom<0;return C||!P}var jg=e=>new Promise((t,r)=>{let n=new Image;n.onload=()=>{t({width:n.width,height:n.height})},n.onerror=r,n.src=e,n.style.display="none"});var Ic=me(Gr());function M(e){return typeof e=="function"}function ar(e){let r=e(n=>{Error.call(n),n.stack=new Error().stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Qn=ar(e=>function(r){e(this),this.message=r?`${r.length} errors occurred during unsubscription:
13
- ${r.map((n,i)=>`${i+1}) ${n.toString()}`).join(`
14
- `)}`:"",this.name="UnsubscriptionError",this.errors=r});function Le(e,t){if(e){let r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ft=class e{constructor(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let t;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(M(n))try{n()}catch(o){t=o instanceof Qn?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{ua(o)}catch(s){t=t??[],s instanceof Qn?t=[...t,...s.errors]:t.push(s)}}if(t)throw new Qn(t)}}add(t){var r;if(t&&t!==this)if(this.closed)ua(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}}_hasParent(t){let{_parentage:r}=this;return r===t||Array.isArray(r)&&r.includes(t)}_addParent(t){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t}_removeParent(t){let{_parentage:r}=this;r===t?this._parentage=null:Array.isArray(r)&&Le(r,t)}remove(t){let{_finalizers:r}=this;r&&Le(r,t),t instanceof e&&t._removeParent(this)}};Ft.EMPTY=(()=>{let e=new Ft;return e.closed=!0,e})();var wo=Ft.EMPTY;function Zn(e){return e instanceof Ft||e&&"closed"in e&&M(e.remove)&&M(e.add)&&M(e.unsubscribe)}function ua(e){M(e)?e():e.unsubscribe()}var Gt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var cr={setTimeout(e,t,...r){let{delegate:n}=cr;return n?.setTimeout?n.setTimeout(e,t,...r):setTimeout(e,t,...r)},clearTimeout(e){let{delegate:t}=cr;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function ti(e){cr.setTimeout(()=>{let{onUnhandledError:t}=Gt;if(t)t(e);else throw e})}function vo(){}var fa=Eo("C",void 0,void 0);function la(e){return Eo("E",void 0,e)}function pa(e){return Eo("N",e,void 0)}function Eo(e,t,r){return{kind:e,value:t,error:r}}var Ue=null;function ur(e){if(Gt.useDeprecatedSynchronousErrorHandling){let t=!Ue;if(t&&(Ue={errorThrown:!1,error:null}),e(),t){let{errorThrown:r,error:n}=Ue;if(Ue=null,r)throw n}}else e()}function ha(e){Gt.useDeprecatedSynchronousErrorHandling&&Ue&&(Ue.errorThrown=!0,Ue.error=e)}var Be=class extends Ft{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,Zn(t)&&t.add(this)):this.destination=Xu}static create(t,r,n){return new we(t,r,n)}next(t){this.isStopped?So(pa(t),this):this._next(t)}error(t){this.isStopped?So(la(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?So(fa,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},zu=Function.prototype.bind;function bo(e,t){return zu.call(e,t)}var Io=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:r}=this;if(r.next)try{r.next(t)}catch(n){ei(n)}}error(t){let{partialObserver:r}=this;if(r.error)try{r.error(t)}catch(n){ei(n)}else ei(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(r){ei(r)}}},we=class extends Be{constructor(t,r,n){super();let i;if(M(t)||!t)i={next:t??void 0,error:r??void 0,complete:n??void 0};else{let o;this&&Gt.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=()=>this.unsubscribe(),i={next:t.next&&bo(t.next,o),error:t.error&&bo(t.error,o),complete:t.complete&&bo(t.complete,o)}):i=t}this.destination=new Io(i)}};function ei(e){Gt.useDeprecatedSynchronousErrorHandling?ha(e):ti(e)}function Ju(e){throw e}function So(e,t){let{onStoppedNotification:r}=Gt;r&&cr.setTimeout(()=>r(e,t))}var Xu={closed:!0,next:vo,error:Ju,complete:vo};var fr=typeof Symbol=="function"&&Symbol.observable||"@@observable";function ma(e){return e}function da(e){return e.length===0?ma:e.length===1?e[0]:function(r){return e.reduce((n,i)=>i(n),r)}}var vt=(()=>{class e{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new e;return n.source=this,n.operator=r,n}subscribe(r,n,i){let o=Qu(r)?r:new we(r,n,i);return ur(()=>{let{operator:s,source:f}=this;o.add(s?s.call(o,f):f?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=ga(n),new n((i,o)=>{let s=new we({next:f=>{try{r(f)}catch(p){o(p),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)}[fr](){return this}pipe(...r){return da(r)(this)}toPromise(r){return r=ga(r),new r((n,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>n(o))})}}return e.create=t=>new e(t),e})();function ga(e){var t;return(t=e??Gt.Promise)!==null&&t!==void 0?t:Promise}function Ku(e){return e&&M(e.next)&&M(e.error)&&M(e.complete)}function Qu(e){return e&&e instanceof Be||Ku(e)&&Zn(e)}function Zu(e){return M(e?.lift)}function te(e){return t=>{if(Zu(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function kt(e,t,r,n,i){return new xo(e,t,r,n,i)}var xo=class extends Be{constructor(t,r,n,i,o,s){super(t),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(f){try{r(f)}catch(p){t.error(p)}}:super._next,this._error=i?function(f){try{i(f)}catch(p){t.error(p)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(f){t.error(f)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((t=this.onFinalize)===null||t===void 0||t.call(this))}}};var ya=ar(e=>function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var qt=(()=>{class e extends vt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new ri(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new ya}next(r){ur(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){ur(()=>{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(){ur(()=>{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?wo:(this.currentObservers=null,o.push(r),new Ft(()=>{this.currentObservers=null,Le(o,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:o}=this;n?r.error(i):o&&r.complete()}asObservable(){let r=new vt;return r.source=this,r}}return e.create=(t,r)=>new ri(t,r),e})(),ri=class extends qt{constructor(t,r){super(),this.destination=t,this.source=r}next(t){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.next)===null||n===void 0||n.call(r,t)}error(t){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.error)===null||n===void 0||n.call(r,t)}complete(){var t,r;(r=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||r===void 0||r.call(t)}_subscribe(t){var r,n;return(n=(r=this.source)===null||r===void 0?void 0:r.subscribe(t))!==null&&n!==void 0?n:wo}};var Rr=class extends qt{constructor(t){super(),this._value=t}get value(){return this.getValue()}_subscribe(t){let r=super._subscribe(t);return!r.closed&&t.next(this._value),r}getValue(){let{hasError:t,thrownError:r,_value:n}=this;if(t)throw r;return this._throwIfClosed(),n}next(t){super.next(this._value=t)}};var Pr={now(){return(Pr.delegate||Date).now()},delegate:void 0};var Ar=class extends qt{constructor(t=1/0,r=1/0,n=Pr){super(),this._bufferSize=t,this._windowTime=r,this._timestampProvider=n,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,t),this._windowTime=Math.max(1,r)}next(t){let{isStopped:r,_buffer:n,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(n.push(t),!i&&n.push(o.now()+s)),this._trimBuffer(),super.next(t)}_subscribe(t){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(t),{_infiniteTimeWindow:n,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!t.closed;s+=n?1:2)t.next(o[s]);return this._checkFinalizedStatuses(t),r}_trimBuffer(){let{_bufferSize:t,_timestampProvider:r,_buffer:n,_infiniteTimeWindow:i}=this,o=(i?1:2)*t;if(t<1/0&&o<n.length&&n.splice(0,n.length-o),!i){let s=r.now(),f=0;for(let p=1;p<n.length&&n[p]<=s;p+=2)f=p;f&&n.splice(0,f+1)}}};var ni=class extends Ft{constructor(t,r){super()}schedule(t,r=0){return this}};var Lr={setInterval(e,t,...r){let{delegate:n}=Lr;return n?.setInterval?n.setInterval(e,t,...r):setInterval(e,t,...r)},clearInterval(e){let{delegate:t}=Lr;return(t?.clearInterval||clearInterval)(e)},delegate:void 0};var ii=class extends ni{constructor(t,r){super(t,r),this.scheduler=t,this.work=r,this.pending=!1}schedule(t,r=0){var n;if(this.closed)return this;this.state=t;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(t,r,n=0){return Lr.setInterval(t.flush.bind(t,this),n)}recycleAsyncId(t,r,n=0){if(n!=null&&this.delay===n&&this.pending===!1)return r;r!=null&&Lr.clearInterval(r)}execute(t,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let n=this._execute(t,r);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,r){let n=!1,i;try{this.work(t)}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:t,scheduler:r}=this,{actions:n}=r;this.work=this.state=this.scheduler=null,this.pending=!1,Le(n,this),t!=null&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,super.unsubscribe()}}};var lr=class e{constructor(t,r=e.now){this.schedulerActionCtor=t,this.now=r}schedule(t,r=0,n){return new this.schedulerActionCtor(this,t).schedule(n,r)}};lr.now=Pr.now;var oi=class extends lr{constructor(t,r=lr.now){super(t,r),this.actions=[],this._active=!1}flush(t){let{actions:r}=this;if(this._active){r.push(t);return}let n;this._active=!0;do if(n=t.execute(t.state,t.delay))break;while(t=r.shift());if(this._active=!1,n){for(;t=r.shift();)t.unsubscribe();throw n}}};var Ur=new oi(ii),_a=Ur;function wa(e){return e&&M(e.schedule)}function Ea(e,t,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 f(m){try{d(n.next(m))}catch(h){s(h)}}function p(m){try{d(n.throw(m))}catch(h){s(h)}}function d(m){m.done?o(m.value):i(m.value).then(f,p)}d((n=n.apply(e,t||[])).next())})}function va(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Me(e){return this instanceof Me?(this.v=e,this):new Me(e)}function ba(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),f("next"),f("throw"),f("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(y){return function(E){return Promise.resolve(E).then(y,h)}}function f(y,E){n[y]&&(i[y]=function(D){return new Promise(function(C,R){o.push([y,D,C,R])>1||p(y,D)})},E&&(i[y]=E(i[y])))}function p(y,E){try{d(n[y](E))}catch(D){b(o[0][3],D)}}function d(y){y.value instanceof Me?Promise.resolve(y.value.v).then(m,h):b(o[0][2],y)}function m(y){p("next",y)}function h(y){p("throw",y)}function b(y,E){y(E),o.shift(),o.length&&p(o[0][0],o[0][1])}}function Sa(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof va=="function"?va(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(f,p){s=e[o](s),i(f,p,s.done,s.value)})}}function i(o,s,f,p){Promise.resolve(p).then(function(d){o({value:d,done:f})},s)}}var si=e=>e&&typeof e.length=="number"&&typeof e!="function";function Ia(e){return M(e?.then)}function xa(e){return M(e[fr])}function Oa(e){return Symbol.asyncIterator&&M(e?.[Symbol.asyncIterator])}function Ta(e){return new TypeError(`You provided ${e!==null&&typeof e=="object"?"an invalid object":`'${e}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function tf(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ca=tf();function Na(e){return M(e?.[Ca])}function Da(e){return ba(this,arguments,function*(){let r=e.getReader();try{for(;;){let{value:n,done:i}=yield Me(r.read());if(i)return yield Me(void 0);yield yield Me(n)}}finally{r.releaseLock()}})}function Ra(e){return M(e?.getReader)}function ve(e){if(e instanceof vt)return e;if(e!=null){if(xa(e))return ef(e);if(si(e))return rf(e);if(Ia(e))return nf(e);if(Oa(e))return Pa(e);if(Na(e))return of(e);if(Ra(e))return sf(e)}throw Ta(e)}function ef(e){return new vt(t=>{let r=e[fr]();if(M(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function rf(e){return new vt(t=>{for(let r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function nf(e){return new vt(t=>{e.then(r=>{t.closed||(t.next(r),t.complete())},r=>t.error(r)).then(null,ti)})}function of(e){return new vt(t=>{for(let r of e)if(t.next(r),t.closed)return;t.complete()})}function Pa(e){return new vt(t=>{af(e,t).catch(r=>t.error(r))})}function sf(e){return Pa(Da(e))}function af(e,t){var r,n,i,o;return Ea(this,void 0,void 0,function*(){try{for(r=Sa(e);n=yield r.next(),!n.done;){let s=n.value;if(t.next(s),t.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}}t.complete()})}function Aa(e,t,r,n=0,i=!1){let o=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!i)return o}var La=ar(e=>function(){e(this),this.name="EmptyError",this.message="no elements in sequence"});function Fe(e,t){let r=typeof t=="object";return new Promise((n,i)=>{let o=new we({next:s=>{n(s),o.unsubscribe()},error:i,complete:()=>{r?n(t.defaultValue):i(new La)}});e.subscribe(o)})}function Ua(e){return e instanceof Date&&!isNaN(e)}function Br(e,t){return te((r,n)=>{let i=0;r.subscribe(kt(n,o=>{n.next(e.call(t,o,i++))}))})}var{isArray:cf}=Array;function uf(e,t){return cf(t)?e(...t):e(t)}function ai(e){return Br(t=>uf(e,t))}function Ba(e,t,r,n,i,o,s,f){let p=[],d=0,m=0,h=!1,b=()=>{h&&!p.length&&!d&&t.complete()},y=D=>d<n?E(D):p.push(D),E=D=>{o&&t.next(D),d++;let C=!1;ve(r(D,m++)).subscribe(kt(t,R=>{i?.(R),o?y(R):t.next(R)},()=>{C=!0},void 0,()=>{if(C)try{for(d--;p.length&&d<n;){let R=p.shift();s?Aa(t,s,()=>E(R)):E(R)}b()}catch(R){t.error(R)}}))};return e.subscribe(kt(t,y,()=>{h=!0,b()})),()=>{f?.()}}function Oo(e,t,r=1/0){return M(t)?Oo((n,i)=>Br((o,s)=>t(n,o,i,s))(ve(e(n,i))),r):(typeof t=="number"&&(r=t),te((n,i)=>Ba(n,i,e,r)))}var ff=["addListener","removeListener"],lf=["addEventListener","removeEventListener"],pf=["on","off"];function To(e,t,r,n){if(M(r)&&(n=r,r=void 0),n)return To(e,t,r).pipe(ai(n));let[i,o]=df(e)?lf.map(s=>f=>e[s](t,f,r)):hf(e)?ff.map(Ma(e,t)):mf(e)?pf.map(Ma(e,t)):[];if(!i&&si(e))return Oo(s=>To(s,t,r))(ve(e));if(!i)throw new TypeError("Invalid event target");return new vt(s=>{let f=(...p)=>s.next(1<p.length?p:p[0]);return i(f),()=>o(f)})}function Ma(e,t){return r=>n=>e[r](t,n)}function hf(e){return M(e.addListener)&&M(e.removeListener)}function mf(e){return M(e.on)&&M(e.off)}function df(e){return M(e.addEventListener)&&M(e.removeEventListener)}function Fa(e,t,r){return r?Fa(e,t).pipe(ai(r)):new vt(n=>{let i=(...s)=>n.next(s.length===1?s[0]:s),o=e(i);return M(t)?()=>t(i,o):void 0})}function ka(e=0,t,r=_a){let n=-1;return t!=null&&(wa(t)?r=t:n=t),new vt(i=>{let o=Ua(e)?+e-r.now():e;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 gf(e,t){return te((r,n)=>{let i=0;r.subscribe(kt(n,o=>e.call(t,o,i++)&&n.next(o)))})}function Co(e,t=Ur){return te((r,n)=>{let i=null,o=null,s=null,f=()=>{if(i){i.unsubscribe(),i=null;let d=o;o=null,n.next(d)}};function p(){let d=s+e,m=t.now();if(m<d){i=this.schedule(void 0,d-m),n.add(i);return}f()}r.subscribe(kt(n,d=>{o=d,s=t.now(),i||(i=t.schedule(p,e),n.add(i))},()=>{f(),n.complete()},void 0,()=>{o=i=null}))})}function Va(e,t){return te((r,n)=>{let{leading:i=!0,trailing:o=!1}=t??{},s=!1,f=null,p=null,d=!1,m=()=>{p?.unsubscribe(),p=null,o&&(y(),d&&n.complete())},h=()=>{p=null,d&&n.complete()},b=E=>p=ve(e(E)).subscribe(kt(n,m,h)),y=()=>{if(s){s=!1;let E=f;f=null,n.next(E),!d&&b(E)}};r.subscribe(kt(n,E=>{s=!0,f=E,!(p&&!p.closed)&&(i?y():b(E))},()=>{d=!0,!(o&&s&&p&&!p.closed)&&n.complete()}))})}function No(e,t=Ur,r){let n=ka(e,t);return Va(()=>n,r)}var ke=(n=>(n[n.LOW=1]="LOW",n[n.MEDIUM=2]="MEDIUM",n[n.HIGH=3]="HIGH",n))(ke||{});var yf="2024-10",_f=`/api/${yf}/graphql.json`,$a={"Content-Type":"application/json"};async function ci(e,t,r,n){let i=Tt.get().storefrontToken;if(!i)throw new Error("Storefront token not set for the store");let o=new Headers($a);o.append("X-Shopify-Storefront-Access-Token",i);let s=JSON.stringify({query:e,variables:t});try{return await re(_f,{method:"POST",headers:o,body:s})}catch(f){throw tt(f,r,{engagementTrigger:n}),f}}function Ve(e,t){return wf(bn(e),t)}async function wf(e,t){let r={body:JSON.stringify(t),method:"POST",headers:$a};return re(e,r)}var ui=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(t=>this.queue.push(t));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let t=this.queue.shift();t&&t()}else this.isLocked=!1}},fi=class e{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(t,r){if(t=`__cooee_${t}_lock__`,"locks"in navigator&&!Ef())try{return await vf(t,r,this.LOCK_TIMEOUT)}catch(s){S.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&&(S.verbose(`Lock retry ${i} for ${t}`),n=await this.acquire(t,o,i),!n);)await this.sleep(e.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(t,o)}}static async acquire(t,r,n){let i=Date.now(),o=localStorage.getItem(t),s=o?JSON.parse(o):null;if(s&&i<=s.expiry)return!1;let f={owner:r,expiry:i+e.LOCK_TIMEOUT};return localStorage.setItem(t,JSON.stringify(f)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(t)||"{}").owner===r?(S.verbose(`${r}: Lock acquired for ${t} after ${n} attempts!`),!0):(S.verbose(`${r}: Race lost. Another tab acquired the lock.`),!1)}static release(t,r){let n=localStorage.getItem(t);if(!n)return;let i=JSON.parse(n);i.owner===r?(localStorage.removeItem(t),S.verbose(`${r}: Lock released`)):S.verbose(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(t){return new Promise(r=>setTimeout(r,t))}};async function vf(e,t,r){return new Promise((n,i)=>{let o=setTimeout(()=>{i(new Error(`Web Locks API timeout after ${r}ms`))},r);navigator.locks.request(e,async()=>{try{let s=await t();return clearTimeout(o),n(s),s}catch(s){throw clearTimeout(o),i(s),s}}).catch(s=>{clearTimeout(o),i(s)})})}function Ef(){let e=navigator.userAgent||"";return/Safari/.test(e)&&!/Chrome/.test(e)&&!/Chromium/.test(e)||/iPhone|iPad|iPod/i.test(e)&&(/(FBAV|FBAN|Instagram|Twitter|Line|WhatsApp)/i.test(e)||!window.safari?.pushNotificaTion)||/Macintosh/.test(e)&&/Safari/.test(e)&&!/Chrome/.test(e)&&!/Chromium/.test(e)&&!window.safari?.pushNotification?!0:bf()}function bf(){try{return window.safari?.pushNotification?window.safari.pushNotification.toString()==="[object SafariRemoteNotification]":!window.indexedDB||!window.localStorage}catch{return!0}}var Do=new ui;function ja(){Sf().catch(e=>{S.error("Fail to add attributes in cart",e)})}async function Sf(){await Do.acquire();let e=z.getCurrent(),t=await Xo();if(e.attributes?.letscooee_did===t.letscooee_did&&e.attributes?.letscooee_sn===t.letscooee_sn){S.verbose("Not calling Shopify update.js API.","Current attributes:",e.attributes),Do.release();return}try{let r=await Ve("/cart/update.js",{attributes:t});S.verbose("Updated cart attributes",JSON.stringify(r.data)),e.update(r.data)}catch(r){S.error("Failed to add cart attributes",r)}Do.release()}var Ha=me(Ro()),pi=class e{static META_REQUIRED_FIELDS=["ad_id"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(t){this.adID=t.adID,this.campaignID=t.campaignID,this.source=t.source}static getAdParams(){let t;try{t=new Ha.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(o=>Array.from(t.getParams().keys()).includes(o)))return r={source:"META",adID:t.getQueryParam("ad_id")?.trim(),campaignID:t.getQueryParam("campaign_id")?.trim()},new e(r);if(this.GOOGLE_REQUIRED_FIELDS.every(o=>Array.from(t.getParams().keys()).includes(o)))return r={source:"GOOGLE"},new e(r)}};var Ga=me(Ro());var xf=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"],Wa={utm_source:"tw_source",utm_campaign:"tw_campaign"};var qa=()=>{if(document.referrer)return document.referrer.replace(location.origin,"")},Ya=()=>{let e;try{e=new Ga.URLBuilder(location.href)}catch{return{}}let t={};xf.forEach(n=>{let i=e.getQueryParam(n);i&&(t[n]=i)});let r={};return Object.keys(Wa).forEach(n=>{let i=e.getQueryParam(Wa[n]);i&&(r[n]=i)}),B(B({},r),t)};var Po=class{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(t){this.name=t.name,this.path=t.path,this.qs=t.qs,this.referrer=t.referrer,this.utmSource=t.utmSource||t.utm_source,this.utmMedium=t.utmMedium||t.utm_medium,this.utmCampaign=t.utmCampaign||t.utm_campaign,this.utmId=t.utmId||t.utm_id,this.utmTerm=t.utmTerm||t.utm_term,this.utmContent=t.utmContent||t.utm_content}};function hi(){let e=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new Po(B({origin:location.origin,path:e,qs:location.search,referrer:qa(),name:rt().pageName},Ya()))}function _w(){let e=rt(),t=new URLSearchParams(location.search),r=t.get("cooee-preview");if(r){let i=r.split(",").map(o=>o.trim()).filter(o=>Number.isInteger(+o));i.length&&(e.previewIDs=i)}let n=t.get("cooee-variant")?.trim();n&&(e.previewVariant=n)}function mi(){let e=rt();return It(B(It(B({},e.customContext),{page:hi(),locale:e.locale,currentItem:e.currentItem,previewIDs:e.previewIDs,previewVariant:e.previewVariant,engagementIDs:Tf(),cart:Ji()}),Of()),{host:window.location.host})}function Of(){let e=window.CooeeSDK.uaParser.getResult();return{os:e.os,device:e.device,browser:e.browser}}function Tf(){let e=document.querySelectorAll(".letscooee-engagement"),t=[];return e.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&t.push(n)}),t}var Cf="keepalive"in new Request(""),ee=new Headers;Pf();async function Ja(){let[e]=await Promise.all([za()]);return B(B({},mi()),e)}function Xa(e){Fe(Ee).then(()=>Nf(e??{}))}function Nf(e){tc("/v1/user/update",e).then(()=>{S.verbose("Updated user profile")}).catch(t=>{S.error("Error saving user profile",t)})}function Ka(e){return pr("/v1/event/generate-discount",e)}function kw(e){Fe(Ee).then(()=>Df({props:e}))}function Df(e){tc("/v1/device/update",e).then(()=>{S.verbose("Updated device properties")}).catch(async t=>{S.error("Error saving device property",t)})}function Qa(e){e&&ee.set("cooee-device-id",e)}function Za(e){e&&ee.set("cooee-first-seen",e.toUTCString())}function pr(e,t){return ec("POST",e,t)}function tc(e,t){return ec("PUT",e,t)}function ec(e,t,r){if(!xr()&&!rt().flags?.allowEvents)return S.log(`Rejecting ${e} ${t} as this is not e-commerce app`),Promise.reject();if(t.startsWith("http")||(t=vi.apiURL+t),r&&!Cf&&t.includes(Ao))return Rf(t,ee,r);let n={method:e,headers:ee,keepalive:!1};return r&&(n.body=JSON.stringify(r)),re(t,n)}function Rf(e,t,r){return new Promise((n,i)=>{let o=new XMLHttpRequest;o.open("POST",e,!0),t.forEach((s,f)=>{o.setRequestHeader(f,s)}),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{if(o.getResponseHeader("Content-Type")?.includes("application/json")){let f=JSON.parse(o.responseText);n({data:f,headers:t,request:o,status:o.status,statusText:o.statusText})}else i(new Error("Content-Type of response header is not json"))}catch(s){i(s)}else i(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{i(new Error("Network error occurred during the request."))},o.send(JSON.stringify(r))})}function Pf(){ee.set("Content-Type","application/json; charset=utf-8"),ee.set("cooee-sdk",$r),ee.set("cooee-sdk-code",jo.toString()),ee.set("cooee-sdk-version",$o),ee.set("cooee-shop-name",Rs()??"");let e=localStorage.getItem("cooeeDebugTill");(vi.debug||e&&new Date(e)>new Date)&&ee.set("cooee-sdk-debug","true")}var Lo={d:(e,t)=>{for(var r in t)Lo.o(t,r)&&!Lo.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},Uo={};Lo.d(Uo,{A:()=>Af,k:()=>Bo});var Mr=function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(d){try{p(n.next(d))}catch(m){o(m)}}function f(d){try{p(n.throw(d))}catch(m){o(m)}}function p(d){var m;d.done?i(d.value):(m=d.value,m instanceof r?m:new r(function(h){h(m)})).then(s,f)}p((n=n.apply(e,t||[])).next())})},Fr=function(e,t){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:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function f(p){return function(d){return(function(m){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,m[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&m[0]?n.return:m[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,m[1])).done)return i;switch(n=0,i&&(m=[2&m[0],i.value]),m[0]){case 0:case 1:i=m;break;case 4:return s.label++,{value:m[1],done:!1};case 5:s.label++,n=m[1],m=[0];continue;case 7:m=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||m[0]!==6&&m[0]!==2)){s=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){s.label=m[1];break}if(m[0]===6&&s.label<i[1]){s.label=i[1],i=m;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(m);break}i[2]&&s.ops.pop(),s.trys.pop();continue}m=t.call(e,s)}catch(h){m=[6,h],n=0}finally{r=i=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}})([p,d])}}};function Bo(){return Mr(this,void 0,Promise,function(){return Fr(this,function(e){switch(e.label){case 0:return[4,new Promise(function(t,r){var n="Unknown",i=!1;function o(y){i||(i=!0,t({isPrivate:y,browserName:n}))}function s(){var y=0,E=parseInt("-1");try{E.toFixed(E)}catch(D){y=D.message.length}return y}function f(){return navigator.msSaveBlob!==void 0&&(function(y){try{return y===eval.toString().length}catch{return!1}})(39)}function p(){var y;return Mr(this,void 0,void 0,function(){var E,D;return Fr(this,function(C){switch(C.label){case 0:return C.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return C.sent(),o(!1),[3,3];case 2:return E=C.sent(),D=E,E instanceof Error&&(D=(y=E.message)!==null&&y!==void 0?y:E),typeof D!="string"?(o(!1),[2]):(o(!!D.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function d(){var y;return Mr(this,void 0,Promise,function(){return Fr(this,function(E){switch(E.label){case 0:return((y=navigator.storage)===null||y===void 0?void 0:y.getDirectory)===void 0?[3,2]:[4,p()];case 1:return E.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var D=String(Math.random());try{var C=indexedDB.open(D,1);C.onupgradeneeded=function(R){var A=R.target.result,N=function(P){o(P)};try{A.createObjectStore("t",{autoIncrement:!0}).put(new Blob),N(!1)}catch(P){(P.message||"").includes("are not yet supported")?N(!0):N(!1)}finally{A.close(),indexedDB.deleteDatabase(D)}},C.onerror=function(){return o(!1)}}catch{o(!1)}})():(function(){var D=window.openDatabase,C=window.localStorage;try{D(null,null,null,null)}catch{return void o(!0)}try{C.setItem("test","1"),C.removeItem("test")}catch{return void o(!0)}o(!1)})(),E.label=3;case 3:return[2]}})})}function m(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(y,E){var D;o(Math.round(E/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 h(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?m():(0,window.webkitRequestFileSystem)(0,1,function(){o(!1)},function(){o(!0)})}function b(){return Mr(this,void 0,Promise,function(){var y,E;return Fr(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(E=y instanceof Error&&typeof y.message=="string"?y.message:String(y))!="string"?(o(!1),[2]):(o(E.includes("Security error")),[2]);case 4:return o(navigator.serviceWorker===void 0),[2]}})})}(function(){return Mr(this,void 0,Promise,function(){return Fr(this,function(y){switch(y.label){case 0:return s()!==44?[3,2]:(n="Safari",[4,d()]);case 1:return y.sent(),[3,6];case 2:return s()!==51?[3,3]:(E=navigator.userAgent,n=E.match(/Chrome/)?navigator.brave!==void 0?"Brave":E.match(/Edg/)?"Edge":E.match(/OPR/)?"Opera":"Chrome":"Chromium",h(),[3,6]);case 3:return s()!==25?[3,5]:(n="Firefox",[4,b()]);case 4:return y.sent(),[3,6];case 5:f()?(n="Internet Explorer",o(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),y.label=6;case 6:return[2]}var E})})})().catch(r)})];case 1:return[2,e.sent()]}})})}typeof window<"u"&&(window.detectIncognito=Bo);var Af=Bo,rc=Uo.A,jw=Uo.k;var nc=me(Gr()),ic=async()=>{let e={};try{return await Lf(e)}catch(t){return tt(t,"device-properties"),e}},Lf=async e=>{let t=window.CooeeSDK.uaParser;Uf(e),Bf(e),Mf(e),e.referrer=document.referrer,e.host=location.origin,e.path=location.pathname,e.qs=location.search,e.locale=navigator.language,e.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:Ff()},e.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(e.headless=!0,He({headless:!0}));let r=t.getResult();return e.browser=r.browser,e.device=r.device,e.engine=r.engine,e.cpu=r.cpu,e.os=r.os,e.navigatorUA=navigator.userAgent,await Promise.all([$f(e),kf(e),jf(e)]),e},Uf=e=>{let t=navigator;if(!t.deviceMemory)return;let r=t.deviceMemory;e.mem={tot:r*1024}},Bf=e=>{let t=navigator,r=t.connection||t.mozConnection||t.webkitConnection;r?.effectiveType&&(e.net={type:r.effectiveType})},Mf=e=>{let t=screen.orientation?.type;t&&(e.orientation=t)},Ff=()=>{if(!document.body)return;let e=document.createElement("div");e.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(e);let t=window.devicePixelRatio||1,r=e.offsetWidth*t;return document.body.removeChild(e),r},kf=async e=>{try{await Vf(e)}catch(t){S.error("Unable to get location",t)}},Vf=async e=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(r=>{navigator.geolocation.getCurrentPosition(n=>{e.coords=[n.coords.latitude,n.coords.longitude],r()},()=>r())})},$f=async e=>{if("getBattery"in navigator)try{let r=await navigator.getBattery();e.bat={l:r.level*100,c:r.charging},He({"battery.level":e.bat.l,"battery.charging":e.bat.c})}catch{}},jf=async e=>{try{(await rc())?.isPrivate&&(e.incognito=!0,He({incognito:!0}))}catch(t){nc.default.error("Unable to detect private/incognito window",t)}};function oc(e){ac()}function sc(e){if(!ac())return;let t=ke[e]?.toLowerCase();t&&(S.verbose(`Sending ${t} intent to MS Clarity`),window.clarity("set","Cooee Intent",t))}function ac(){return window.clarity&&typeof window.clarity=="function"}var Ee=new Ar(1),uc="App ID or Shopify shop is not set",Mo="",be="",Fo="",di;function gv(e){Mo=e.appID,Fo=e.shopifyShop,Hf().then(async()=>{Ee.next(!0),Ee.complete()}).catch(t=>{t?.message?.includes(uc)&&tt(t,"initiate-session",{extra:e}),S.error("Unable to initiate session",t)})}async function za(){return await fc(),di}async function yv(){let e=Date.now();await fi.request("gen_did",async()=>{be=await xt.get("did"),be||(be=new mt().toHexString(),await xt.set("did",be)),S.info("Device ID:",be),pc(be)}),S.info(`Device ID set/get done in \u23F0 ${Wr(Date.now()-e)}`)}async function cc(){if(di)return;let[e,t,r]=await Promise.all([Rt.get("id",""),xt.get("sessionNumber",1),Rt.get("landing",{})]);lc(e,t,r)}async function Hf(){await fc()}async function fc(){let e=!1;await Gf()?(await Wf(),e=!0):await qf()?(await cc(),e=!0):await cc(),e&&await zf()}async function Wf(){S.info("Starting new session"),await Rt.clear();let e=new Date,t=new mt().toHexString(),r=await xt.get("sessionNumber",0)+1,n=hi();await Promise.all([xt.set("sessionNumber",r),Rt.set("id",t),Rt.set("lastUsedTime",e.getTime()),Rt.set("landing",n)]),lc(t,r,n)}async function Gf(){let e=await Rt.get("lastUsedTime",0);return e?(new Date().getTime()-e)/1e3>1800:!0}async function qf(){return!await Rt.get("synced",!1)}async function Yf(){if(!Mo&&!Fo)throw new Error(uc);let e=await ic(),t=mi();return It(B(B({deviceID:be,deviceProps:e,appID:Mo,shopifyShop:Fo},di),t),{sdk:$r,ad:pi.getAdParams(),occurred:Xf(rt().jsLoadTime),properties:{},uuid:await xt.get("uuid")})}async function zf(){S.info("Ensuring session on server"),await Jf();let e=Date.now(),t=await Yf();S.info(`Session data fetched in \u23F0 ${Wr(Date.now()-e)}`);try{let r=await pr("/v1/event/validate-session",t);S.info(`Auth finished in \u23F0 ${Wr(r.timeTakenMs)}`),await Rt.set("synced",!0),r.data.deviceID&&(await xt.set("did",be),pc(r.data.deviceID))}catch(r){throw S.error(r),r}}async function Jf(){let e=await xt.get("firstSeen"),t=e?new Date(e):new Date;e||await xt.set("firstSeen",t.toISOString()),Za(t),Hr("Visitor Info",{first_seen:t.toISOString()})}function lc(e,t,r){He({"cooee_session.number":t}),Hr("Visitor Session",{id:e,number:t,landing_page:r}),S.info(`Session number: ${t}, id: ${e}`),di={sessionID:e,sessionNumber:t,landingPage:r}}function pc(e){oc(e),Qa(e);let t=`device_id_${Math.floor(Math.random()*1e4)}`;Hr("Visitor Info",{device_id:e,[t]:e}),Go({id:e})}function Xf(e){return(new Date().getTime()-e.getTime())/1e3>1800?new Date:e}function Sv(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?Kf():document.visibilityState==="hidden"&&Qf()}}async function Kf(){}async function Qf(){let e=await Zf();if(e===0){S.info("Not sending duration as user was inactive on website");return}mc(e)}async function Zf(){let e=rt();return e.inInactive?0:(e.inInactive=!0,e.lastEnterInactive=new Date,Math.max(e.lastEnterInactive.getTime()-e.lastEnterActive.getTime(),0))}function hc(){let e=rt();return e.inInactive?(e.inInactive=!1,e.lastEnterActive=new Date,Math.max((e.lastEnterActive.getTime()-e.lastEnterInactive.getTime())/1e3,0)):0}var gi=class{triggerData;render(t){t.contentSource===vr.KLAVIYO&&(this.triggerData=t,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",t.klaviyoFormID]))}handleKlaviyoEvents(t){if(t.type!=="klaviyoForms")return;let r=t.detail;if(r.formId!==this.triggerData.klaviyoFormID){S.warn("Received invalid trigger callback");return}switch(r.type){case"open":ce(new Mt("CE Trigger Displayed",{form:{id:r.formId}},this.triggerData));break;case"stepSubmit":{let n=this.getFormDetails(r);ce(new Mt("CE Form Submitted",{form:n},this.triggerData)),Xa(n);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),ce(new Mt("CE Trigger Closed",{form:{id:r.formId}},this.triggerData));break}}getFormDetails(t){let r={id:t.formId},n=t.metaData;if(je.hasKeys(n)){let i=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach(f=>{i.includes(f)||(r[f]=n[f])}),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}};function dc(e){if(!tl()||!Tt.get().pixelPush)return;let r=ke[e.intent]?.toLowerCase();r&&(S.verbose(`Sending ${r} intent to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:r}))}function tl(){return window.fbq&&typeof window.fbq=="function"}var ko=new Map,yc=async e=>{for(let o of e.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(o,e)}catch(s){S.error(s)}if(e.isCartEmbed()&&!e.isSubscriptionUpsell()){let s=(await z.getCurrent().getNormalisedCart()).items.map(f=>f.mID);e.items=e.items.filter(f=>!s.includes(f.mID))}if(e.items=gc(e),Tt.get().currencyCount<=1)return e.items;if(e.isShoppableVideo())return await el(e.content.videoConfig,e),e.items;let t=e.items.length,r=e.items.map(o=>_c(o,e)),i=(await Promise.all(r)).filter(o=>o!=null);if(t&&!i.length){let o="Failed to fetch any product from Ajax API",s=new Mt("CE Campaign Failed",{reason:o,currency:e.currency},e);throw ce(s),new Error(o)}return gc(e,i)},gc=(e,t=e.items)=>{if(!e.isCartRecovery())return t;let r=z.getCurrent().items,n=[];for(let i of t)for(let o of i.vars){if(!o.isAvailable)continue;let s=r.find(d=>d.variant_id.toString()===o.mID);if(!s)continue;let f=new Lt(i);f.name=s.title;let p=new Ke(o);p.name=s.variant_title,p.price.d=s.discounted_price/100,f.variants=[p],n.push(f)}return n},el=async(e,t)=>{await Promise.all(e.videos.map(async r=>{r.items=await Promise.all(r.items.map(async n=>{let i=await _c(n,t);return i||n}))}))},_c=async(e,t)=>{if(ko.has(e.mID))return ko.get(e.mID);let r,n=`/products/${e.slug}.js`;try{r=(await re(n)).data}catch(i){return i instanceof jr&&i.response?.status===404||tt(i,"fetch-shopify-product",{extra:{item:e,path:n},engagementTrigger:t}),null}return r?rl(e,r):(S.error("Item not found after AJAX call for:",e),null)},rl=(e,t)=>{if(!e||!t)return e;e.name=t.title,e.tags=t.tags,e.slug=t.handle;let r=e.selectedOrFirstVariant.value;return e.vars.map(n=>{let i=t.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))}),ko.set(e.mID,e),e};var kr=e=>{let t=e instanceof Lt?e.selectedOrFirstVariant.value.mID:e.vID,r=e instanceof Lt?e.selectedOrFirstVariant.value.name:e.vName;return{product_id:e.mID,product_name:e.name,variant_id:t,variant_name:r}};var Ao="/v1/event/track-page-unload";function wc(e){S.verbose(`Waiting for auth to send event ${e.name}`),Fe(Ee).then(()=>ce(e))}function mc(e){Fe(Ee).then(()=>{nl(e)})}async function nl(e){let t=rt().currentPageViewEvent;if(!t){S.warn("No page view event was stored previously");return}let r={pageViewEventID:t.id,pageViewEventName:t.name,pageActiveTimeMS:e};S.verbose("Sending page unload",r);try{await pr(Ao,r)}catch(n){throw S.error(`Error sending page unload for ${t} to server`,n),n}}function ce(e){il(e)}async function il(e){if(S.verbose(`Sending event: ${e.name}`,e),fl(e)){S.warn(`Rejecting event ${e.name}`);return}ja();let t=await Ja();Object.assign(e,t),hc(),Rt.set("lastUsedTime",new Date().getTime());let r=ul(e.name),n=r.toLowerCase().replace(/\s+/g,"-");try{let i=await pr(`/v1/event/track/${n}`,e);S.info("Event tracked:",r),ol(e)&&(rt().currentPageViewEvent={id:e.id,name:e.name}),sl(e,i.data)}catch(i){throw S.error(`Error sending event ${e.name} to server`,i),i}}function ol(e){return Ho.includes(e.name)?e.name==="View Cart"?!e.properties.drawer:!0:!1}function sl(e,t){al(e,t).catch(r=>{tt(r,"process-popup-response",{extra:{event:e,response:t}})}),cl(t)}async function al(e,t){if(!t.triggerData)return;let r=new jn(t.triggerData);r.occurred=e.occurred,S.log(`${r} will be shown`);let n;try{n=await yc(r)}catch(o){S.error("Failed to refresh the products",o);return}if(r.items=n,r.contentSource===vr.KLAVIYO){new gi().render(r);return}let i=await import("./renderer-TBPM7OV3.js");new i.FreeformRenderer().renderEngagement(r).catch(o=>{tt(o,"render-popup",{extra:{event:e},engagementTrigger:r})})}function cl(e){e.intent&&(sc(e.intent),dc(e),S.info(`Intent is ${ke[e.intent]}`))}function ul(e){return e.replace("CE ","").replace("Trigger","Campaign").replace("Screen","Page").replace("App ","")}function fl(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(S.warn("Not sending event as this is a test trigger"),!0):!1}var Ec=new qt,bc=new qt;function SE(){return bc.asObservable()}function yi(){Ec.next()}Ec.pipe(Co(100)).subscribe(dl.bind(void 0));function IE(){yi(),ll(),pl()}function ll(){let e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){Sc(this._url).catch(t=>S.error("Unable to process cart change in XMLHttpRequest",t))}),e.apply(this,arguments)},S.verbose("Securely overwritten window.XMLHttpRequest.send method")}function pl(){let e=window.fetch;try{window.fetch=async function(t,r){return e(t,r).then(n=>{let i="";try{i=typeof t=="string"||t instanceof URL?t.toString():t?.url??n?.url??""}catch{}return Sc(i).catch(o=>S.error("Unable to process cart change in fetch",o)),n})},S.verbose("Securely overwritten window.fetch method")}catch(t){console.warn("Fail to override fetch.",`Cooee won't be able to track "Add To Cart" and "Remove From Cart" KPI.`),S.error(t)}}async function Sc(e){hl(e)&&yi()}function hl(e){return/\/cart\/(add|change|update|clear)/.test(e)}function ml(e,t){let r=e?.items,n=t.items,i=[],o=[];if(S.verbose(`Comparing cart change with old count ${r?.length} to new count ${n.length}`),n?.forEach(s=>{let f=r?.find(p=>p.vID===s.vID);if(f){if(f.quantity!==s.quantity){let p=f.quantity<s.quantity,d=Math.abs(f.quantity-s.quantity),m=It(B({},s),{quantity:d});p?i.push(m):o.push(m)}r&&Yo(r,f)}else i.push(s)}),r)for(let s of r)o.push(s);S.verbose(`Cart delta: added: ${i.length}, removed: ${o.length}`),i.length&&vc("Add To Cart",{items:i}),o.length&&e.token===t.token&&vc("Remove From Cart",{items:o}),(o.length||i.length)&&bc.next({itemsAdded:i,itemsRemoved:o,cart:t})}function vc(e,t){let r=new Mt(e,t);wc(r)}async function dl(){let e=await xt.get("cart",{}),t=await z.getCurrent().getNormalisedCart(!0);ml(e,t)}var ue=class e{static cartDrawerToggle$=new Rr({open:!1,firstOpen:!1});static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=Tt.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=[e.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 e._instance||(e._instance=new e),e._instance}static initialize(){e.get()}isOpen(){if(window.cooeeIsCartDrawerVisible)return window.cooeeIsCartDrawerVisible();if(this.cartDrawerElement?.id==="rebuy-cart")return!!window.Rebuy?.SmartCart?.visible;let t=this.inShadow?this.isPresent():_o(this.cartDrawerElement);return S.info(`Cart drawer is currently ${t?"open":"close"}`),t}open(){if(this.isOpen()){S.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent("letscooee:outbound:open-cart"));let t=document.querySelector(this.iconSelector);if(!t){S.verbose("No clickable cart icon found with selector",this.iconSelector);return}t.click()}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===e.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(t,r=!0){if(window.cooeeUpdateCartDrawer)try{window.cooeeUpdateCartDrawer(t)}catch(n){tt(n,"execute-cooeeUpdateCartDrawer")}else if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:t}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&t)this.element.classList.remove("is-empty"),this.element.renderContents?.(t);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!t?.items?.[0])return;let n=t.items[0].id,i=t.items[0].quantity,o=t.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?z.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(z.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,t?.items?.[0]?.id+""):(S.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:t,currentCart:z.getCurrent()}})),r&&yi()}async initialize(){let t=this.configWebsite.cartDrawerSelector;if(!t){await this.findCartDrawer();return}let r=t.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(!xr())return;let t=this.selector||this.cartSelector;if(this.cartDrawerElement=await Ei(t),!this.cartDrawerElement){Ic.default.warn("Max attempts exhausted to find cart drawer");return}S.verbose("Found",this.cartDrawerElement,`from selector: ${t}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let r=(await Ei(this.shadowParentElementSelector))?.shadowRoot;r?.mode==="open"&&(this.cartDrawerShadowElement=r,this.createMutationObservers())}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||this.watchForCartToggle()}watchForCartToggle(){let t=this.cartDrawerElement||this.cartDrawerShadowElement,r=new qt;this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(t,{attributes:!0,subtree:!0,childList:this.inShadow}),this.mutationSubscription=r.pipe(No(800,void 0,{leading:!1,trailing:!0})).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,e.cartDrawerToggle$.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){if(!this.selector||!this.cartDrawerShadowElement)return!1;let t=this.cartDrawerShadowElement.querySelector(this.selector);return t?_o(t):!1}async updateBubble(){let t=(await z.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=t+"")}manualCartIconClicked(t){!t.target.closest(this.iconSelector)||!t.isTrusted||window.CooeeSDK.events.push(["Open Cart"])}};var xc=class{constructor(t){this.scalingFactor=t}getLayoutStyles(t){if(!t)return{display:"block"};let r={display:t.disp};return t.of&&(r.objectFit=t.of),t.pos==="absolute"&&(r.width="auto !important",r.position="absolute",r.right=t.right+"px",r.left=t.left+"px",r.top=t.top+"px",r.bottom=t.bottom+"px"),r}getSizeStyles(t){let r={};return t?.w&&(r.width=t.w),t?.h&&(r.height=t.h),t?.maxW&&(r.maxWidth=t.maxW),t?.maxH&&(r.maxHeight=t.maxH),t?.minW&&(r.minWidth=t.minW),t?.minH&&(r.minHeight=t.minH),r}getBorderStyles(t){if(!t)return{};let r={};return t.radius&&t.radius>0&&(r.borderRadius=this.getSizePx(t.radius)),t.width&&t.width>0&&(r.borderWidth=this.getSizePx(t.width),r.borderStyle=t.style?.toLowerCase(),t.color?this.getColourStyles(t.color,"border-color",r):r.borderColor="black"),r}getFlexStyles(t){return t?{gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai,width:"100%"}:{}}getSpaceStyles(t){let r={};return t?(r.paddingTop=this.getSizePx(t.pt),r.paddingBottom=this.getSizePx(t.pb),r.paddingLeft=this.getSizePx(t.pl),r.paddingRight=this.getSizePx(t.pr),r.marginTop=this.getSizePx(t.mt),r.marginBottom=this.getSizePx(t.mb),r.marginLeft=t.cent?"auto":this.getSizePx(t.ml),r.marginRight=t.cent?"auto":this.getSizePx(t.mr),r):(r.margin="0 !important",r.padding="unset",r)}getBackgroundStyles(t){if(!t)return{};let r={};if(t.glossy){let n="backdrop-filter",i="-webkit-"+n,o=`blur(${t.glossy.radius}px)`;if(!CSS.supports(i,o)&&!CSS.supports(n,o))return{background:t.glossy.fallback.rgba};if(r[i]=o,r[n]=o,t.glossy.color)return this.getColourStyles(t.glossy.color,"background",r)}else if(t.solid){if(t.solid.grad)return this.getGradientStyles(t.solid.grad,"background",r);if(t.solid.hex)return{backgroundColor:t.solid.rgba}}else if(t.img){if(!t.img.src)return{};let n=(t.img.a??0)/100;r.background=`linear-gradient(rgba(0, 0, 0, ${n}), rgba(0, 0, 0, ${n})),url("${t.img.src}") no-repeat center`,r.backgroundSize="cover",t.img.a&&(r["-webkit-backdrop-filter"]=`opacity(${t.img.a})`,r.backdropFilter=`opacity(${t.img.a})`)}return r}getGradientStyles(t,r,n){if(n??={},t.type==="LINEAR"){let i=`linear-gradient(${t.ang}deg, ${t.c1}, ${t.c2}`;t.c3&&(i+=`, ${t.c3}`),i+=")",n[r]=i}return n}getColourStyles(t,r="color",n){return n??={},t?t.grad?this.getGradientStyles(t.grad,r,n):(t.hex&&(n[r]=t.rgba),n):n}getSizePx(t){return this.getScaledSize(t)+"px"}getScaledSize(t){return(t??0)*this.scalingFactor}};var Nc=me(Gr());var gl=`
15
- mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
16
- cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
17
- cart {
18
- id
19
- }
20
- userErrors {
21
- field
22
- message
23
- }
24
- }
25
- }
26
- `,Se=class{static navigate(t,r,n){let i=`${location.origin}/discount/${t}`;switch(S.log(`Applying discount code ${t}`,r,n),r){case Xt.CART_PAGE:location.href=`${i}?redirect=/cart`;break;case Xt.CART_DRAWER:location.href=`${i}?redirect=${location.pathname}#open-cart-drawer=1`;break;case Xt.SHOPIFY_CHECKOUT:location.href=`${i}?redirect=/checkout`;break;case Xt.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${i}?redirect=/cart#initiate-checkout=1`);break;default:location.href=`${i}?redirect=${n||location.pathname}`}}static navigateWithoutDiscount(t,r){let n=ue.get();switch(t){case Xt.CART_PAGE:location.href="/cart";break;case Xt.SHOPIFY_CHECKOUT:location.href="/checkout";break;case Xt.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods("/cart#initiate-checkout=1");break;case Xt.CART_DRAWER:{n.open();break}}r&&n.refreshUI(r)}static async applyWithStorefront(t){let r={cartId:`gid://shopify/Cart/${z.getCurrent().token}`,discountCodes:t};S.verbose(`Applying ${t.length} coupons on cart`),await ci(gl,r,"storefront-apply-discount")}static checkThirdPartyMethods(t){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.handleFloCheckoutBtn?window.handleFloCheckoutBtn():window.openRzpCheckout?window.openRzpCheckout():location.href=t}};var Oc=me(qi());var yl=`
27
- mutation cartCreate($input: CartInput) {
28
- cartCreate(input: $input) {
29
- cart {
30
- id
31
- checkoutUrl
32
- }
33
- userErrors {
34
- field
35
- message
36
- }
37
- }
38
- }
39
- `;function Tc(e){let t=ue.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections=="function")try{return{sections_url:window.location.pathname,sections:window.cooeeGetCartSections()}}catch(r){tt(r,"execute-cooeeGetCartSections",{engagementTrigger:e})}else{if(t.isMiniCart())return{sections:["mini-cart"]};if(t.isShopifyDefaultDrawer())return{sections:t.element.getSectionsToRender?.().map((r=>r.section??r.id))}}return{}}async function ab(e,t){if(!je.hasKeys(e)){S.warn("No update fields provided");return}let r=Tc(t),n=B(B({},e),r);try{let i=await Ve("/cart/update.js",n);return S.log("Updated cart",e),z.getCurrent().update(i.data),i.data}catch(i){tt(i,"cart-update"),ne("Failed to update item in cart")}}var _i=class{async addToCart(t,r){if(!t.length)return;let n=t.map(s=>{let{vID:f,vName:p,quantity:d}=this.getVariantDetails(s),m=r.getPrivateAttributesForLineItem();if(je.hasKeys(window.CooeeSDK.customItemProperties)){let h={name:p},b={templateSuffix:s.templateSuffix},y=Oc.render(JSON.stringify(window.CooeeSDK.customItemProperties),{variant:h,product:b});m=B(B({},JSON.parse(y)),m)}return{id:f?+f:+s.mID,quantity:d,properties:m}}),i=Tc(r),o=B({items:n},i);try{let s=await Ve("/cart/add.js",o);return S.log(`Added ${t.length} items to Cart`),ne("Product added to your cart"),s.data}catch(s){tt(s,"cart-item-add",{engagementTrigger:r});let f=["Failed to add product in cart."];if(s instanceof jr&&s.is40x()&&s.responseText){let p=s.responseText;p.description&&f.push(`Reason: ${p.description}`)}f.push("Please try again later."),ne(f.join(" "))}}async copyDiscountCode(t){if(t)try{await navigator.clipboard.writeText(t),S.log(`Code-${t} copied`),ne("Discount code copied")}catch(r){S.error("Failed to copy code",r)}}getProductURL(t){if(!t?.link)return;let r=Ps(t.link);if(r)return Qe("/products/"+r)}async upgradeToSubscription(t,r){if(!t){S.warn("Trying to upgrade to subscription with no item");return}let n=await z.getCurrent().getNormalisedCart(),i=t.selectedOrFirstVariant.value,o=n.items.findIndex(p=>p.vID===i.mID),s=i.selectedSellingPlan.value,f={line:o+1,selling_plan:s?.mID||null,properties:r.getPrivateAttributesForLineItem()};try{let p=await Ve("/cart/change.js",f);return S.log(`Upgraded ${t} selling plan`),ne("Line item updated"),z.getCurrent().update(p.data),p.data}catch(p){tt(p,"cart-switch-subscription",{engagementTrigger:r}),ne("Failed to update subscription")}}async createNewCart(t,r,n){if(!t?.vID){S.error("No variant ID found to perform Buy now",t);return}let i=r?[r]:[],o=[{merchandiseId:`gid://shopify/ProductVariant/${t.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],s=await Ko("Buy Now");return(await ci(yl,{input:{lines:o,discountCodes:i,attributes:s}},"storefront-create-cart")).data.data?.cartCreate?.cart?.checkoutUrl}async process(t){let r=t.clickAction,n=t.items,i=t.triggerData,o;if(r.at){let s=r;S.log(`Performing ${JSON.stringify(s)} action`);let f={};if(s.at===ot.GO_TO_PRODUCT)o=this.getProductURL(n[0]);else if(s.at===ot.ADD_TO_CART)n?.length&&await this.addToCart(n,i);else if(s.at===ot.COPY_COUPON_CODE)await this.copyDiscountCode(i.discount?.code),f.discountCode=i.discount?.code;else if(s.at===ot.OPEN_CART)ue.get().open();else if(s.at===ot.GO_TO_COLLECTION){let p=t.collections;if(!p?.length)return;o=Qe("/collections/"+p[0].handle)}f.products=n.map(kr),f.redirectTo=o,Vr(s.at,f)}r.applyDiscount&&i.discount?.code?Se.navigate(i.discount.code,i.redirectBehaviour,o):o&&(location.pathname=o)}getVariantDetails(t){let r,n,i;if(t instanceof Kt)r=t.vID,n=t.vName,i=t.quantity??1;else{if(!t.vars?.length)return{};r=t.selectedOrFirstVariant.value.mID,n=t.selectedOrFirstVariant.value.name,i=1}return{vID:r,quantity:i,vName:n}}};async function cb(e,t){if(!je.hasKeys(t)){S.warn("No update fields provided");return}let r=B({id:e.key},t);try{let n=await Ve("/cart/change.js",r);S.log("Updated line-item",e),z.getCurrent().update(n.data)}catch(n){tt(n,"cart-item-update")}}var Cc=class{constructor(t){this.triggerContext=t}async execute(t){let r=rt().currentItem,n=t.clickAction;if(!n)return;let i=t.item,o=this.triggerContext,s=new _i,f=o.triggerData.redirectBehaviour,p=!!o.triggerData.discount?.type&&!!n?.applyDiscount,d={selectedVariants:o.triggerData.nonMutableItems.map(C=>({itemMID:C.mID,mID:C.selectedOrFirstVariant.value.mID,variantID:C.selectedOrFirstVariant.value.mID})),eID:o.triggerData.engagementID,cID:o.triggerData.contentID},m="",h=[],b=[];if(i?b=[i.toEmbed()]:t.embeddedItem&&(b=[t.embeddedItem]),n.at===ot.ADD_BUNDLE){let C=o.selectedItems;if(b=t.embeddedItems??C.map(R=>R.toEmbed()),o.shouldGiveFBTDiscount||t.embeddedItems?.length){let R;t.embeddedItems?R=t.embeddedItems.map(N=>({itemMID:N.mID,mID:N.vID,variantID:N.vID,quantity:N.quantity})):R=C.map(N=>({itemMID:N.mID,mID:N.selectedOrFirstVariant.value.mID,variantID:N.selectedOrFirstVariant.value.mID}));let A=o.triggerData.bundleFrom;o.triggerData.isBundleOnCartDrawer()&&A&&(R.push({itemMID:A.mID,mID:A.selectedOrFirstVariant.value.mID,isPrimary:!0}),b.unshift(A.toEmbed())),d.selectedVariants=R,o.triggerData.isBundleOnPDP()&&d.selectedVariants.forEach(N=>{N.mID===r.vID&&(N.isPrimary=!0)})}else d=void 0;h=t.embeddedItems??C}else if(n.at===ot.INITIATE_CHECKOUT){let C=await z.getCurrent().getNormalisedCart();b=C.items,d.selectedVariants=C.items.map(R=>({itemMID:R.mID,mID:R.vID}))}else if(n.at===ot.ADD_TO_CART)h=i?[i]:[t.embeddedItem];else if(n.at===ot.QUICK_VIEW){window.cooeeShowQuickItem(this.triggerContext,i),this.sendTriggerClicked(b,{from:"button"},t.video);return}else if(n.at===ot.GO_TO_PRODUCT)m=i?Qe("/products/"+i.slug):t.embeddedItem?.link;else if(n.at===ot.GO_TO_URL){let C=qo(n.gu?.u);window.CooeeSDK.allowExternalURL?C&&(m=C.href):C&&(m=C.pathname+C.search+C.hash)}else if(n.at===ot.UPGRADE_TO_SUBSCRIPTION){let C=await s.upgradeToSubscription(i,o.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),ue.get().refreshUI(C)}else if(n.at===ot.GO_TO_COLLECTION){let C=this.triggerContext.triggerData.collections?.[0];C&&(m="collections/"+C.handle)}if(this.sendTriggerClicked(b,{from:"button"},t.video),S.verbose({redirectPath:m,redirectBehaviour:f,hasDiscount:p}),!p&&m){Vr(n.at,{redirectTo:m}),location.href=m;return}let y,E=!1;try{y=await this.getOrGenerateDiscountCode(d),S.verbose("Discount code (if any) to apply",y)}catch(C){if(!this.triggerContext.triggerData.isBYOB()){Nc.default.error("Unable to get a discount code",C);return}}if(y&&n.at===ot.COPY_COUPON_CODE)await s.copyDiscountCode(y);else if(n.at===ot.BUY_NOW){let C=await s.createNewCart(r,y,o.triggerData);C&&(Vr(n.at,{products:[kr(r)],redirectTo:C}),location.href=C);return}try{y&&await Se.applyWithStorefront([y])}catch(C){S.error(C),E=!0}let D;if(h?.length&&(D=await s.addToCart(h,o.triggerData)),Vr(n.at,{products:h.map(kr),redirectTo:m,discountCode:y}),E&&y){Se.navigate(y,f,m);return}if(m){location.href=m;return}Se.navigateWithoutDiscount(f,D)}sendTriggerClicked(t,r,n){let i=new Mt("CE Trigger Clicked",r,this.triggerContext.triggerData);i.items=t,i.setVideos(n),ce(i)}async getOrGenerateDiscountCode(t){let r=this.triggerContext.triggerData.discount;if(!r?.type)return;let n="";if(r.type===Jt.STATIC){if(!r.code)throw Wo("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return r.code}if(t){if(n=await _l(t,this.triggerContext),!n)throw S.error("No discount code found",t),new Error("Discount code not found or generated");return n}}};function Vr(e,t){document.dispatchEvent(new CustomEvent("letscooee:outbound:cta-executed",{detail:B({action:ot[e]},t)}))}async function _l(e,t){try{return(await Ka(e)).data.code}catch(r){throw ne("Failed to generate a discount code"),tt(r,"backend-generate-discount",{triggerContext:t}),r}}export{_w as a,Jt as b,Lc as c,Xt as d,ot as e,Uc as f,Oe as g,gr as h,zr as i,Ht as j,Kt as k,qr as l,W as m,Fc as n,hn as o,qe as p,Jp as q,Ir as r,Ke as s,Lt as t,Yi as u,Uh as v,Rs as w,z as x,yr as y,xe as z,de as A,We as B,Xr as C,Qr as D,Zr as E,tn as F,en as G,Nn as H,wt as I,Wt as J,nr as K,kn as L,no as M,jn as N,Hn as O,Mt as P,qt as Q,Fe as R,Br as S,To as T,Fa as U,gf as V,Co as W,Ee as X,gv as Y,yv as Z,Sv as _,yc as $,kg as aa,Vg as ba,$g as ca,jg as da,SE as ea,IE as fa,ue as ga,xc as ha,Cc as ia,ab as ja,_i as ka,cb as la,wc as ma,ce as na,Ja as oa,Xa as pa,kw as qa,pr as ra};
@@ -1 +0,0 @@
1
- var k=Object.create;var g=Object.defineProperty,l=Object.defineProperties,m=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,p=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var h=(a,b,c)=>b in a?g(a,b,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[b]=c,r=(a,b)=>{for(var c in b||={})i.call(b,c)&&h(a,c,b[c]);if(f)for(var c of f(b))j.call(b,c)&&h(a,c,b[c]);return a},s=(a,b)=>l(a,n(b));var t=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var u=(a,b)=>{var c={};for(var d in a)i.call(a,d)&&b.indexOf(d)<0&&(c[d]=a[d]);if(a!=null&&f)for(var d of f(a))b.indexOf(d)<0&&j.call(a,d)&&(c[d]=a[d]);return c};var v=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),w=(a,b)=>{for(var c in b)g(a,c,{get:b[c],enumerable:!0})},q=(a,b,c,d)=>{if(b&&typeof b=="object"||typeof b=="function")for(let e of o(b))!i.call(a,e)&&e!==c&&g(a,e,{get:()=>b[e],enumerable:!(d=m(b,e))||d.enumerable});return a};var x=(a,b,c)=>(c=a!=null?k(p(a)):{},q(b||!a||!a.__esModule?g(c,"default",{value:a,enumerable:!0}):c,a));var y=(a,b,c)=>h(a,typeof b!="symbol"?b+"":b,c);export{r as a,s as b,t as c,u as d,v as e,w as f,x as g,y as h};
@@ -1 +0,0 @@
1
- import{_ as n,v as i,yb as o}from"./chunk-HC6OE5XR.js";var r=class e{sanitizer=i(o);transform(t){return t?this.sanitizer.bypassSecurityTrustHtml(t):""}static \u0275fac=function(s){return new(s||e)};static \u0275pipe=n({name:"safeHtml",type:e,pure:!0})};function m(){return window.CooeeSDK?.uaParser.getDevice().type==="mobile"}var u=()=>typeof navigator<"u"&&"share"in navigator;export{r as a,m as b,u as c};