@letscooee/web-sdk 14.0.4 → 14.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.min.js CHANGED
@@ -1,8 +1,8 @@
1
- import { s, r, x as xn, h as he$3, X as Xr$3, t as te$3, c as x$2, Y as Y$1, A as Ar$1, v as v$1, k as ke$2, E as Et$3, f as fe$4, O as On$1, H as Hr$3, d as Yr$3, Q as Q$4, o as oe$5, g as ge$3, e as tn, i as Bn$1, j as Qr$3, l as An$1, a as Be$3, m as Hn$1, M as Mn$1, C as Cn, n as jr$2, N as Nn$2, q as qr$3, p as vt$2, y as pe$4, V as Vn$1, D as ie$4, b as zn$1, F as no$1, G as ro, R as Rn$1, I as to, J as xr$1, K as ve$2, L as Ln$1, P as Pn, S as oo$1, T as Kr$3, U as Nr$2, W as z$3, Z as Ve$4, _ as d$3, $ as $n$1, a0 as Gn$1, a1 as Lr$1 } from './chunk-BxeSb631-CAitwQDp.js';
1
+ import { s, r, A as An$1, h as he$3, K as Kr$3, e as ee$4, x as x$2, Y as Y$1, C as Cr$2, v as v$1, k as ke$2, y as yt$1, f as fe$4, L as Ln$1, n as ne$2, g as ge$3, c as en, V as Vn$1, J as Jr$3, d as Cn, a as Be$3, G as Gn$1, P as Pn, R as Rn, i as Yr$3, l as xn, z as zr$3, m as ht$2, p as pe$4, M as Mn$1, o as oe$5, Q as Q$4, H as Hr$3, q as Gr$3, b as jn$1, t as to, E as eo, D as Dn, Z as Zn$1, F as Ar$1, I as ve$2, N as Nn$2, O as On$1, S as ro, T as qr$3, U as xr$1, W as z$3, X as Ve$4, _ as d$3, $ as Wn$1, a0 as $n$1, a1 as Nr$2 } from './chunk-DbQ39eGC-BuuE3sKA.js';
2
2
 
3
- var o=`a-f\\d`,I$1=`#?[${o}]{3}[${o}]?`,S$3=`#?[${o}]{6}([${o}]{2})?`,R$1=new RegExp(`[^#${o}]`,`gi`),A$3=new RegExp(`^${I$1}$|^${S$3}$`,`i`);function c(e,r={}){if(typeof e!=`string`||R$1.test(e)||!A$3.test(e))throw new TypeError(`Expected a valid hex string`);e=e.replace(/^#/,``);let t=1;e.length===8&&(t=Number.parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)),e.length===4&&(t=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 l=Number.parseInt(e,16),u=l>>16,p=l>>8&255,m=l&255,s=typeof r.alpha==`number`?r.alpha:t;if(r.format===`array`)return [u,p,m,s];if(r.format===`css`)return `rgb(${u} ${p} ${m}${s===1?``:` / ${Number((s*100).toFixed(2))}%`})`;return {red:u,green:p,blue:m,alpha:s}}var n$1=class n{h;a=100;g;constructor(r){r??={},this.h=r.h,this.a=r.a,this.g=r.g;}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return ``;try{return c(this.hex,{format:`css`,alpha:this.getAlpha()})}catch(r){return console.error(`Invalid hex`,r),`#000000`}}getAlpha(){return (this.a??100)/100}};var h$2=class h{s;g;i;constructor(r){r.s&&(this.s=new n$1(r.s)),r.g&&(this.g=new i(r.g)),this.i=r.i;}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var a$2=class a{s;r;w;c;constructor(r){this.s=r.s,this.r=r.r,this.w=r.w,r.c&&(this.c=new n$1(r.c));}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return w$2[this.s??1]}},w$2=(t=>(t[t.SOLID=1]=`SOLID`,t[t.DASHED=2]=`DASHED`,t))(w$2||{});var i=class e{static DEFAULT_FALLBACK=new n$1({h:`#000000`,a:50});r;c;fb;constructor(r){this.r=r.r,r.c&&(this.c=new n$1(r.c)),r.fb&&(this.fb=new n$1(r.fb));}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??e.DEFAULT_FALLBACK}};var g$2=class g{blur;spr;clr;x;y;constructor(r){r=r??{},this.blur=r.blur??0,this.spr=r.spr??0,this.x=r.x??0,this.y=r.y??0,this.clr=new n$1(r.clr);}getStyle(r){return `${this.x*r}px ${this.y*r}px ${this.blur*r}px ${this.spr*r}px ${this.clr.rgba}`}};var b$2=class b{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(r){r=r??{},this.pl=r.pl??0,this.pr=r.pr??0,this.pt=r.pt??0,this.pb=r.pb??0,this.ml=r.ml??0,this.mr=r.mr??0,this.mt=r.mt??0,this.mb=r.mb??0,this.cent=r.cent??false;}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 f$1=class f{rot;constructor(r){r?.rot&&(this.rot=r.rot);}get rotate(){return this.rot}};var y$1=class y{enabled;type;color;constructor(r){r??={},this.enabled=r.enabled,this.type=r.type,this.color=new n$1(r.color);}},d$2=class d{size;enabled;color;constructor(r){r??={},this.enabled=r.enabled,this.size=r.size,this.color=new n$1(r.color);}},x$1=class x{enabled;delay;constructor(r={}){this.enabled=r.enabled,r.delay&&(this.delay=r.delay>100?r.delay:r.delay*1e3);}},C$4=class C{navigation;pagination;autoplay;loop;maxInRow;gap;maxInRowSm;gapSm;speed;marquee;constructor(r){r??={},this.navigation=new d$2(r.navigation),this.pagination=new y$1(r.pagination),this.autoplay=new x$1(r.autoplay),this.loop=r.loop??false,this.maxInRow=r.maxInRow??4,this.gap=r.gap??0,this.maxInRowSm=r.maxInRowSm??this.maxInRow,this.gapSm=r.gapSm??this.gap,r.speed&&(this.speed=r.speed*1e3),this.marquee=r.marquee;}};
3
+ var o=`a-f\\d`,I$1=`#?[${o}]{3}[${o}]?`,S$3=`#?[${o}]{6}([${o}]{2})?`,R$1=new RegExp(`[^#${o}]`,`gi`),A$3=new RegExp(`^${I$1}$|^${S$3}$`,`i`);function c(e,r={}){if(typeof e!=`string`||R$1.test(e)||!A$3.test(e))throw new TypeError(`Expected a valid hex string`);e=e.replace(/^#/,``);let t=1;e.length===8&&(t=Number.parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)),e.length===4&&(t=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 l=Number.parseInt(e,16),u=l>>16,p=l>>8&255,m=l&255,s=typeof r.alpha==`number`?r.alpha:t;if(r.format===`array`)return [u,p,m,s];if(r.format===`css`)return `rgb(${u} ${p} ${m}${s===1?``:` / ${Number((s*100).toFixed(2))}%`})`;return {red:u,green:p,blue:m,alpha:s}}var n$1=class n{h;a=100;g;constructor(r){r??={},this.h=r.h,this.a=r.a,this.g=r.g;}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return ``;try{return c(this.hex,{format:`css`,alpha:this.getAlpha()})}catch(r){return console.error(`Invalid hex`,r),`#000000`}}getAlpha(){return (this.a??100)/100}};var h$3=class h{s;g;i;constructor(r){r.s&&(this.s=new n$1(r.s)),r.g&&(this.g=new i(r.g)),this.i=r.i;}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var a$2=class a{s;r;w;c;constructor(r){this.s=r.s,this.r=r.r,this.w=r.w,r.c&&(this.c=new n$1(r.c));}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return w$2[this.s??1]}},w$2=(t=>(t[t.SOLID=1]=`SOLID`,t[t.DASHED=2]=`DASHED`,t))(w$2||{});var i=class e{static DEFAULT_FALLBACK=new n$1({h:`#000000`,a:50});r;c;fb;constructor(r){this.r=r.r,r.c&&(this.c=new n$1(r.c)),r.fb&&(this.fb=new n$1(r.fb));}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??e.DEFAULT_FALLBACK}};var g$2=class g{blur;spr;clr;x;y;constructor(r){r=r??{},this.blur=r.blur??0,this.spr=r.spr??0,this.x=r.x??0,this.y=r.y??0,this.clr=new n$1(r.clr);}getStyle(r){return `${this.x*r}px ${this.y*r}px ${this.blur*r}px ${this.spr*r}px ${this.clr.rgba}`}};var b$2=class b{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(r){r=r??{},this.pl=r.pl??0,this.pr=r.pr??0,this.pt=r.pt??0,this.pb=r.pb??0,this.ml=r.ml??0,this.mr=r.mr??0,this.mt=r.mt??0,this.mb=r.mb??0,this.cent=r.cent??false;}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 f=class{rot;constructor(r){r?.rot&&(this.rot=r.rot);}get rotate(){return this.rot}};var y$1=class y{enabled;type;color;constructor(r){r??={},this.enabled=r.enabled,this.type=r.type,this.color=new n$1(r.color);}},d$2=class d{size;enabled;color;constructor(r){r??={},this.enabled=r.enabled,this.size=r.size,this.color=new n$1(r.color);}},x$1=class x{enabled;delay;constructor(r={}){this.enabled=r.enabled,r.delay&&(this.delay=r.delay>100?r.delay:r.delay*1e3);}},C$4=class C{navigation;pagination;autoplay;loop;maxInRow;gap;maxInRowSm;gapSm;speed;marquee;constructor(r){r??={},this.navigation=new d$2(r.navigation),this.pagination=new y$1(r.pagination),this.autoplay=new x$1(r.autoplay),this.loop=r.loop??false,this.maxInRow=r.maxInRow??4,this.gap=r.gap??0,this.maxInRowSm=r.maxInRowSm??this.maxInRow,this.gapSm=r.gapSm??this.gap,r.speed&&(this.speed=r.speed*1e3),this.marquee=r.marquee;}};
4
4
 
5
- var X$3,h$1,Vt$2,ft$1,D$2,wt,Mt$2,Ht$2,Gt$1,ct$2,ut$1,lt$2,G$2={},kt$2=[],de$2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,q$2=Array.isArray;function A$2(e,t){for(var i in t)e[i]=t[i];return e}function ht$1(e){e&&e.parentNode&&e.parentNode.removeChild(e);}function pe$3(e,t,i){var r,o,n,s={};for(n in t)n==`key`?r=t[n]:n==`ref`?o=t[n]:s[n]=t[n];if(arguments.length>2&&(s.children=arguments.length>3?X$3.call(arguments,2):i),typeof e==`function`&&e.defaultProps!=null)for(n in e.defaultProps)s[n]===void 0&&(s[n]=e.defaultProps[n]);return K$3(e,s,r,o,null)}function K$3(e,t,i,r,o){var n={type:e,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Vt$2,__i:-1,__u:0};return o==null&&h$1.vnode!=null&&h$1.vnode(n),n}function j$2(e){return e.children}function g$1(e,t){this.props=e,this.context=t;}function y(e,t){if(t==null)return e.__?y(e.__,e.__i+1):null;for(var i;t<e.__k.length;t++)if((i=e.__k[t])!=null&&i.__e!=null)return i.__e;return typeof e.type==`function`?y(e):null}function Bt$2(e){var t,i;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((i=e.__k[t])!=null&&i.__e!=null){e.__e=e.__c.base=i.__e;break}return Bt$2(e)}}function Ct$1(e){(!e.__d&&(e.__d=true)&&D$2.push(e)&&!Q$3.__r++||wt!=h$1.debounceRendering)&&((wt=h$1.debounceRendering)||Mt$2)(Q$3);}function Q$3(){for(var e,t,i,r,o,n,s,u=1;D$2.length;)D$2.length>u&&D$2.sort(Ht$2),e=D$2.shift(),u=D$2.length,e.__d&&(i=void 0,o=(r=(t=e).__v).__e,n=[],s=[],t.__P&&((i=A$2({},r)).__v=r.__v+1,h$1.vnode&&h$1.vnode(i),dt(t.__P,i,r,t.__n,t.__P.namespaceURI,32&r.__u?[o]:null,n,o??y(r),!!(32&r.__u),s),i.__v=r.__v,i.__.__k[i.__i]=i,Yt$2(n,i,s),i.__e!=o&&Bt$2(i)));Q$3.__r=0;}function Wt$1(e,t,i,r,o,n,s,u,a,l,c){var _,E,f,N,R,I,p=r&&r.__k||kt$2,v=t.length;for(a=ve$1(i,t,p,a,v),_=0;_<v;_++)(f=i.__k[_])!=null&&(E=f.__i==-1?G$2:p[f.__i]||G$2,f.__i=_,I=dt(e,f,E,o,n,s,u,a,l,c),N=f.__e,f.ref&&E.ref!=f.ref&&(E.ref&&pt$1(E.ref,null,f),c.push(f.ref,f.__c||N,f)),R==null&&N!=null&&(R=N),4&f.__u||E.__k===f.__k?a=Ft$2(f,a,e):typeof f.type==`function`&&I!==void 0?a=I:N&&(a=N.nextSibling),f.__u&=-7);return i.__e=R,a}function ve$1(e,t,i,r,o){var n,s,u,a,l,c=i.length,_=c,E=0;for(e.__k=new Array(o),n=0;n<o;n++)(s=t[n])!=null&&typeof s!=`boolean`&&typeof s!=`function`?(a=n+E,(s=e.__k[n]=typeof s==`string`||typeof s==`number`||typeof s==`bigint`||s.constructor==String?K$3(null,s,null,null,null):q$2(s)?K$3(j$2,{children:s},null,null,null):s.constructor==null&&s.__b>0?K$3(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,u=null,(l=s.__i=Ee$3(s,i,a,_))!=-1&&(_--,(u=i[l])&&(u.__u|=2)),u==null||u.__v==null?(l==-1&&(o>c?E--:o<c&&E++),typeof s.type!=`function`&&(s.__u|=4)):l!=a&&(l==a-1?E--:l==a+1?E++:(l>a?E--:E++,s.__u|=4))):e.__k[n]=null;if(_)for(n=0;n<c;n++)(u=i[n])!=null&&!(2&u.__u)&&(u.__e==r&&(r=y(u)),zt(u,u));return r}function Ft$2(e,t,i){var r,o;if(typeof e.type==`function`){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=Ft$2(r[o],t,i));return t}e.__e!=t&&(t&&e.type&&!i.contains(t)&&(t=y(e)),i.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Ee$3(e,t,i,r){var o,n,s=e.key,u=e.type,a=t[i];if(a===null&&e.key==null||a&&s==a.key&&u==a.type&&(2&a.__u)==0)return i;if(r>(a!=null&&(2&a.__u)==0?1:0))for(o=i-1,n=i+1;o>=0||n<t.length;){if(o>=0){if((a=t[o])&&(2&a.__u)==0&&s==a.key&&u==a.type)return o;o--;}if(n<t.length){if((a=t[n])&&(2&a.__u)==0&&s==a.key&&u==a.type)return n;n++;}}return -1}function Ut$1(e,t,i){t[0]==`-`?e.setProperty(t,i??``):e[t]=i==null?``:typeof i!=`number`||de$2.test(t)?i:i+`px`;}function z$2(e,t,i,r,o){var n,s;t:if(t==`style`)if(typeof i==`string`)e.style.cssText=i;else {if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)i&&t in i||Ut$1(e.style,t,``);if(i)for(t in i)r&&i[t]==r[t]||Ut$1(e.style,t,i[t]);}else if(t[0]==`o`&&t[1]==`n`)n=t!=(t=t.replace(Gt$1,`$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+n]=i,i?r?i.u=r.u:(i.u=ct$2,e.addEventListener(t,n?lt$2:ut$1,n)):e.removeEventListener(t,n?lt$2:ut$1,n);else {if(o==`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]=i??``;break t}catch{}typeof i==`function`||(i==null||i===false&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&i==1?``:i));}}function xt$1(e){return function(t){if(this.l){var i=this.l[t.type+e];if(t.t==null)t.t=ct$2++;else if(t.t<i.u)return;return i(h$1.event?h$1.event(t):t)}}}function dt(e,t,i,r,o,n,s,u,a,l){var c,_,E,f,N,R,I,p,v,U,P,F,x,Dt,Y,V,st,L=t.type;if(t.constructor!=null)return null;128&i.__u&&(a=!!(32&i.__u),n=[u=t.__e=i.__e]),(c=h$1.__b)&&c(t);t:if(typeof L==`function`)try{if(p=t.props,v=`prototype`in L&&L.prototype.render,U=(c=L.contextType)&&r[c.__c],P=c?U?U.props.value:c.__:r,i.__c?I=(_=t.__c=i.__c).__=_.__E:(v?t.__c=_=new L(p,P):(t.__c=_=new g$1(p,P),_.constructor=L,_.render=me$3),U&&U.sub(_),_.props=p,_.state||(_.state={}),_.context=P,_.__n=r,E=_.__d=!0,_.__h=[],_._sb=[]),v&&_.__s==null&&(_.__s=_.state),v&&L.getDerivedStateFromProps!=null&&(_.__s==_.state&&(_.__s=A$2({},_.__s)),A$2(_.__s,L.getDerivedStateFromProps(p,_.__s))),f=_.props,N=_.state,_.__v=t,E)v&&L.getDerivedStateFromProps==null&&_.componentWillMount!=null&&_.componentWillMount(),v&&_.componentDidMount!=null&&_.__h.push(_.componentDidMount);else {if(v&&L.getDerivedStateFromProps==null&&p!==f&&_.componentWillReceiveProps!=null&&_.componentWillReceiveProps(p,P),!_.__e&&_.shouldComponentUpdate!=null&&_.shouldComponentUpdate(p,_.__s,P)===!1||t.__v==i.__v){for(t.__v!=i.__v&&(_.props=p,_.state=_.__s,_.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.some(function(M){M&&(M.__=t);}),F=0;F<_._sb.length;F++)_.__h.push(_._sb[F]);_._sb=[],_.__h.length&&s.push(_);break t}_.componentWillUpdate!=null&&_.componentWillUpdate(p,_.__s,P),v&&_.componentDidUpdate!=null&&_.__h.push(function(){_.componentDidUpdate(f,N,R);});}if(_.context=P,_.props=p,_.__P=e,_.__e=!1,x=h$1.__r,Dt=0,v){for(_.state=_.__s,_.__d=!1,x&&x(t),c=_.render(_.props,_.state,_.context),Y=0;Y<_._sb.length;Y++)_.__h.push(_._sb[Y]);_._sb=[];}else do _.__d=!1,x&&x(t),c=_.render(_.props,_.state,_.context),_.state=_.__s;while(_.__d&&++Dt<25);_.state=_.__s,_.getChildContext!=null&&(r=A$2(A$2({},r),_.getChildContext())),v&&!E&&_.getSnapshotBeforeUpdate!=null&&(R=_.getSnapshotBeforeUpdate(f,N)),V=c,c!=null&&c.type===j$2&&c.key==null&&(V=$t$2(c.props.children)),u=Wt$1(e,q$2(V)?V:[V],t,i,r,o,n,s,u,a,l),_.base=t.__e,t.__u&=-161,_.__h.length&&s.push(_),I&&(_.__E=_.__=null);}catch(M){if(t.__v=null,a||n!=null)if(M.then){for(t.__u|=a?160:128;u&&u.nodeType==8&&u.nextSibling;)u=u.nextSibling;n[n.indexOf(u)]=null,t.__e=u;}else for(st=n.length;st--;)ht$1(n[st]);else t.__e=i.__e,t.__k=i.__k;h$1.__e(M,t,i);}else n==null&&t.__v==i.__v?(t.__k=i.__k,t.__e=i.__e):u=t.__e=Ne$3(i.__e,t,i,r,o,n,s,a,l);return (c=h$1.diffed)&&c(t),128&t.__u?void 0:u}function Yt$2(e,t,i){for(var r=0;r<i.length;r++)pt$1(i[r],i[++r],i[++r]);h$1.__c&&h$1.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(n){n.call(o);});}catch(n){h$1.__e(n,o.__v);}});}function $t$2(e){return typeof e!=`object`||e==null||e.__b&&e.__b>0?e:q$2(e)?e.map($t$2):A$2({},e)}function Ne$3(e,t,i,r,o,n,s,u,a){var l,c,_,E,f,N,R,I=i.props,p=t.props,v=t.type;if(v==`svg`?o=`http://www.w3.org/2000/svg`:v==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||(o=`http://www.w3.org/1999/xhtml`),n!=null){for(l=0;l<n.length;l++)if((f=n[l])&&`setAttribute`in f==!!v&&(v?f.localName==v:f.nodeType==3)){e=f,n[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(p);e=document.createElementNS(o,v,p.is&&p),u&&(h$1.__m&&h$1.__m(t,n),u=false),n=null;}if(v==null)I===p||u&&e.data==p||(e.data=p);else {if(n=n&&X$3.call(e.childNodes),I=i.props||G$2,!u&&n!=null)for(I={},l=0;l<e.attributes.length;l++)I[(f=e.attributes[l]).name]=f.value;for(l in I)if(f=I[l],l!=`children`){if(l==`dangerouslySetInnerHTML`)_=f;else if(!(l in p)){if(l==`value`&&`defaultValue`in p||l==`checked`&&`defaultChecked`in p)continue;z$2(e,l,null,f,o);}}for(l in p)f=p[l],l==`children`?E=f:l==`dangerouslySetInnerHTML`?c=f:l==`value`?N=f:l==`checked`?R=f:u&&typeof f!=`function`||I[l]===f||z$2(e,l,f,I[l],o);if(c)u||_&&(c.__html==_.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(_&&(e.innerHTML=``),Wt$1(t.type==`template`?e.content:e,q$2(E)?E:[E],t,i,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,n,s,n?n[0]:i.__k&&y(i,0),u,a),n!=null)for(l=n.length;l--;)ht$1(n[l]);u||(l=`value`,v==`progress`&&N==null?e.removeAttribute(`value`):N!=null&&(N!==e[l]||v==`progress`&&!N||v==`option`&&N!=I[l])&&z$2(e,l,N,I[l],o),l=`checked`,R!=null&&R!=e[l]&&z$2(e,l,R,I[l],o));}return e}function pt$1(e,t,i){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t));}else e.current=t;}catch(o){h$1.__e(o,i);}}function zt(e,t,i){var r,o;if(h$1.unmount&&h$1.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||pt$1(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount();}catch(n){h$1.__e(n,t);}r.base=r.__P=null;}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&zt(r[o],t,i||typeof e.type!=`function`);i||ht$1(e.__e),e.__c=e.__=e.__e=void 0;}function me$3(e,t,i){return this.constructor(e,i)}function ze$1(e,t,i){var r,o,n,s;t==document&&(t=document.documentElement),h$1.__&&h$1.__(e,t),o=(r="undefined"==`function`)?null:t.__k,n=[],s=[],dt(t,e=(t).__k=pe$3(j$2,null,[e]),o||G$2,G$2,t.namespaceURI,o?null:t.firstChild?X$3.call(t.childNodes):null,n,o?o.__e:t.firstChild,r,s),Yt$2(n,e,s);}X$3=kt$2.slice,h$1={__e:function(e,t,i,r){for(var o,n,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((n=o.constructor)&&n.getDerivedStateFromError!=null&&(o.setState(n.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(u){e=u;}throw e}},Vt$2=0,ft$1=function(e){return e!=null&&e.constructor==null},g$1.prototype.setState=function(e,t){var i=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=A$2({},this.state);typeof e==`function`&&(e=e(A$2({},i),this.props)),e&&A$2(i,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ct$1(this));},g$1.prototype.forceUpdate=function(e){this.__v&&(this.__e=true,e&&this.__h.push(e),Ct$1(this));},g$1.prototype.render=j$2,D$2=[],Mt$2=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ht$2=function(e,t){return e.__v.__b-t.__v.__b},Q$3.__r=0,Gt$1=/(PointerCapture)$|Capture$/i,ct$2=0,ut$1=xt$1(false),lt$2=xt$1(true);var Et$2,S$2,vt$1,Kt$2,Qt$2=0,ie$3=[],m$1=h$1,Xt$1=m$1.__b,qt=m$1.__r,jt$2=m$1.diffed,Jt$2=m$1.__c,Zt$1=m$1.unmount,te$2=m$1.__;function Oe$3(e,t){m$1.__h&&m$1.__h(S$2,e,Qt$2||t),Qt$2=0;var i=S$2.__H||(S$2.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function mt$2(e,t){var i=Oe$3(Et$2++,7);return Re$2(i.__H,t)&&(i.__=e(),i.__H=t,i.__h=e),i.__}function Ie$3(){for(var e;e=ie$3.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(J$2),e.__H.__h.forEach(Nt$2),e.__H.__h=[];}catch(t){e.__H.__h=[],m$1.__e(t,e.__v);}}m$1.__b=function(e){S$2=null,Xt$1&&Xt$1(e);},m$1.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),te$2&&te$2(e,t);},m$1.__r=function(e){qt&&qt(e),Et$2=0;var t=(S$2=e.__c).__H;t&&(vt$1===S$2?(t.__h=[],S$2.__h=[],t.__.forEach(function(i){i.__N&&(i.__=i.__N),i.u=i.__N=void 0;})):(t.__h.forEach(J$2),t.__h.forEach(Nt$2),t.__h=[],Et$2=0)),vt$1=S$2;},m$1.diffed=function(e){jt$2&&jt$2(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ie$3.push(t)!==1&&Kt$2===m$1.requestAnimationFrame||((Kt$2=m$1.requestAnimationFrame)||Se$3)(Ie$3)),t.__H.__.forEach(function(i){i.u&&(i.__H=i.u),i.u=void 0;})),vt$1=S$2=null;},m$1.__c=function(e,t){t.some(function(i){try{i.__h.forEach(J$2),i.__h=i.__h.filter(function(r){return !r.__||Nt$2(r)});}catch(r){t.some(function(o){o.__h&&(o.__h=[]);}),t=[],m$1.__e(r,i.__v);}}),Jt$2&&Jt$2(e,t);},m$1.unmount=function(e){Zt$1&&Zt$1(e);var t,i=e.__c;i&&i.__H&&(i.__H.__.forEach(function(r){try{J$2(r);}catch(o){t=o;}}),i.__H=void 0,t&&m$1.__e(t,i.__v));};var ee$3=typeof requestAnimationFrame==`function`;function Se$3(e){var t,i=function(){clearTimeout(r),ee$3&&cancelAnimationFrame(t),setTimeout(e);},r=setTimeout(i,35);ee$3&&(t=requestAnimationFrame(i));}function J$2(e){var t=S$2,i=e.__c;typeof i==`function`&&(e.__c=void 0,i()),S$2=t;}function Nt$2(e){var t=S$2;e.__c=e.__(),S$2=t;}function Re$2(e,t){return !e||e.length!==t.length||t.some(function(i,r){return i!==e[r]})}var Le$2=Symbol.for(`preact-signals`);function It$2(){if(b$1>1)b$1--;else {for(var e,t=false;k$3!==void 0;){var i=k$3;for(k$3=void 0,Ot$2++;i!==void 0;){var r=i.o;if(i.o=void 0,i.f&=-3,!(8&i.f)&&ne$1(i))try{i.c();}catch(o){t||(e=o,t=true);}i=r;}}if(Ot$2=0,b$1--,t)throw e}}var d$1=void 0;var k$3=void 0,b$1=0,Ot$2=0,Z$2=0;function re$3(e){if(d$1!==void 0){var t=e.n;if(t===void 0||t.t!==d$1)return t={i:0,S:e,p:d$1.s,n:void 0,t:d$1,e:void 0,x:void 0,r:t},d$1.s!==void 0&&(d$1.s.n=t),d$1.s=t,e.n=t,32&d$1.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=d$1.s,t.n=void 0,d$1.s.n=t,d$1.s=t),t}}function O$1(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0;}O$1.prototype.brand=Le$2;O$1.prototype.h=function(){return true};O$1.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);};O$1.prototype.U=function(e){if(this.t!==void 0){var t=e.e,i=e.x;t!==void 0&&(t.x=i,e.e=void 0),i!==void 0&&(i.e=t,e.x=void 0),e===this.t&&(this.t=i);}};O$1.prototype.subscribe=function(e){var t=this;return W$2(function(){var i=t.value,r=d$1;d$1=void 0;try{e(i);}finally{d$1=r;}})};O$1.prototype.valueOf=function(){return this.value};O$1.prototype.toString=function(){return this.value+``};O$1.prototype.toJSON=function(){return this.value};O$1.prototype.peek=function(){var e=d$1;d$1=void 0;try{return this.value}finally{d$1=e;}};Object.defineProperty(O$1.prototype,`value`,{get:function(){var e=re$3(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Ot$2>100)throw new Error(`Cycle detected`);this.v=e,this.i++,Z$2++,b$1++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N();}finally{It$2();}}}});function T$1(e){return new O$1(e)}function ne$1(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 true;return false}function oe$4(e){for(var t=e.s;t!==void 0;t=t.n){var i=t.S.n;if(i!==void 0&&(t.r=i),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function _e$3(e){for(var t=e.s,i=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):i=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r;}e.s=i;}function w$1(e){O$1.call(this,void 0),this.x=e,this.s=void 0,this.g=Z$2-1,this.f=4;}(w$1.prototype=new O$1).h=function(){if(this.f&=-3,1&this.f)return false;if((36&this.f)==32||(this.f&=-5,this.g===Z$2))return true;if(this.g=Z$2,this.f|=1,this.i>0&&!ne$1(this))return this.f&=-2,true;var e=d$1;try{oe$4(this),d$1=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++);}catch(i){this.v=i,this.f|=16,this.i++;}return d$1=e,_e$3(this),this.f&=-2,true};w$1.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);}O$1.prototype.S.call(this,e);};w$1.prototype.U=function(e){if(this.t!==void 0&&(O$1.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);}};w$1.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(w$1.prototype,`value`,{get:function(){if(1&this.f)throw new Error(`Cycle detected`);var e=re$3(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function St$2(e){return new w$1(e)}function se$2(e){var t=e.u;if(e.u=void 0,typeof t==`function`){b$1++;var i=d$1;d$1=void 0;try{t();}catch(r){throw e.f&=-2,e.f|=8,Rt$2(e),r}finally{d$1=i,It$2();}}}function Rt$2(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,se$2(e);}function Te$2(e){if(d$1!==this)throw new Error(`Out-of-order effect`);_e$3(this),d$1=e,this.f&=-2,8&this.f&&Rt$2(this),It$2();}function B$1(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32;}B$1.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();}};B$1.prototype.S=function(){if(1&this.f)throw new Error(`Cycle detected`);this.f|=1,this.f&=-9,se$2(this),oe$4(this),b$1++;var e=d$1;return d$1=this,Te$2.bind(this,e)};B$1.prototype.N=function(){2&this.f||(this.f|=2,this.o=k$3,k$3=this);};B$1.prototype.d=function(){this.f|=8,1&this.f||Rt$2(this);};function W$2(e){var t=new B$1(e);try{t.c();}catch(i){throw t.d(),i}return t.d.bind(t)}var Lt$2;function C$3(e,t){h$1[e]=t.bind(null,h$1[e]||function(){});}function tt$1(e){Lt$2&&Lt$2(),Lt$2=e&&e.S();}function ae$2(e){var t=this,i=e.data,r=Pe$2(i);r.value=i;var o=mt$2(function(){for(var n=t.__v;n=n.__;)if(n.__c){n.__c.__$f|=4;break}return t.__$u.c=function(){var s,u=t.__$u.S(),a=o.value;u(),ft$1(a)||((s=t.base)==null?void 0:s.nodeType)!==3?(t.__$f|=1,t.setState({})):t.base.data=a;},St$2(function(){var s=r.value.value;return s===0?0:s===true?``:s||``})},[]);return o.value}ae$2.displayName=`_st`;Object.defineProperties(O$1.prototype,{constructor:{configurable:true,value:void 0},type:{configurable:true,value:ae$2},props:{configurable:true,get:function(){return {data:this}}},__b:{configurable:true,value:1}});C$3(`__b`,function(e,t){if(typeof t.type==`string`){var i,r=t.props;for(var o in r)if(o!==`children`){var n=r[o];n instanceof O$1&&(i||(t.__np=i={}),i[o]=n,r[o]=n.peek());}}e(t);});C$3(`__r`,function(e,t){tt$1();var i,r=t.__c;r&&(r.__$f&=-2,(i=r.__$u)===void 0&&(r.__$u=i=(function(o){var n;return W$2(function(){n=this;}),n.c=function(){r.__$f|=1,r.setState({});},n})())),tt$1(i),e(t);});C$3(`__e`,function(e,t,i,r){tt$1(),e(t,i,r);});C$3(`diffed`,function(e,t){tt$1();var i;if(typeof t.type==`string`&&(i=t.__e)){var r=t.__np,o=t.props;if(r){var n=i.U;if(n)for(var s in n){var u=n[s];u!==void 0&&!(s in r)&&(u.d(),n[s]=void 0);}else i.U=n={};for(var a in r){var l=n[a],c=r[a];l===void 0?(l=Ae$3(i,a,c,o),n[a]=l):l.o(c,o);}}}e(t);});function Ae$3(e,t,i,r){var o=t in e&&e.ownerSVGElement===void 0,n=T$1(i);return {o:function(s,u){n.value=s,r=u;},d:W$2(function(){var s=n.value.value;r[t]!==s&&(r[t]=s,o?e[t]=s:s?e.setAttribute(t,s):e.removeAttribute(t));})}}C$3(`unmount`,function(e,t){if(typeof t.type==`string`){var i=t.__e;if(i){var r=i.U;if(r){i.U=void 0;for(var o in r){var n=r[o];n&&n.d();}}}}else {var s=t.__c;if(s){var u=s.__$u;u&&(s.__$u=void 0,u.d());}}e(t);});C$3(`__h`,function(e,t,i,r){(r<3||r===9)&&(t.__$f|=2),e(t,i,r);});g$1.prototype.shouldComponentUpdate=function(e,t){var i=this.__$u,r=i&&i.s!==void 0;for(var o in t)return true;if(this.__f||typeof this.u==`boolean`&&this.u===true){if(!(r||2&this.__$f||4&this.__$f)||1&this.__$f)return true}else if(!(r||4&this.__$f)||3&this.__$f)return true;for(var n in e)if(n!==`__source`&&e[n]!==this.props[n])return true;for(var s in this.props)if(!(s in e))return true;return false};function Pe$2(e){return mt$2(function(){return T$1(e)},[])}var et=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 it$1=class it{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url;}};var rt$1=class rt{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=this.d;}};var At$1=class At{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??false;}},nt$1=class nt{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(i=>new it$1(i))??[],this.link=t.link,this.price=new rt$1(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,this.selectedOptions=t.selectedOptions??[],this.effectivePrice=T$1(this.price.effective),t.sellingPlans?.length&&(this.selectedSellingPlan=T$1(void 0)),this.sellingPlans=t.sellingPlans?.map(i=>{let r=new At$1(i);return r.isSelected&&(this.selectedSellingPlan.value=r),r});}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t;}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};function Pt$2(e,t){for(let i of e){let r=t.get(i.attr),o=Array.isArray(r),n=typeof r==`string`,s=typeof r==`number`&&typeof i.value==`number`,u=Array.isArray(i.value),a=true;switch(i.op){case `contains`:a=(o||n)&&r.includes(i.value);break;case `notContains`:a=(o||n)&&!r.includes(i.value);break;case `eq`:a=r===i.value;break;case `ne`:a=r!==i.value;break;case `gt`:a=s&&r>i.value;break;case `gte`:a=s&&r>=i.value;break;case `lt`:a=s&&r<i.value;break;case `lte`:a=s&&r<=i.value;break;case `in`:a=u&&i.value.includes(r);break;case `nin`:a=u&&!i.value.includes(r);break;case `between`:a=s&&u&&i.value.length===2&&r>=i.value[0]&&r<=i.value[1];break;case `all`:a=o&&u&&i.value.every(l=>r.includes(l));break;default:a=false;break}if(!a)return false}return true}var ot$2=class ot{id;mID;name;options;imgs;vars;desc;link;slug;quantity;category;meta;reviews;tags;templateSuffix;selectedOrFirstVariant;selected=T$1(true);_showAddToCartButton;constructor(t){this.update(t),this.selectedOrFirstVariant=T$1(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 i=this.vars.find(r=>r.mID===t.toString());i&&this.setSelectedVariant(i);}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(i=>new nt$1(i))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new et({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,i=t.price,r$1=this.name,o=this.category,n=this.variantImage??this.firstImageURL,s$1=this.meta,u=this.tags?.join(`,`)??``,a=this.reviews?.rating,l=this.reviews?.totalReviews,c=i.cmp&&i.cmp>i.d,_=s(r({name:r$1},xn(`price`,i.d,true)),{image_url:n,meta:s$1,category:o,rating:a,reviews:l,tags:u});if(t.hasEffectivePrice()){let f=xn(`effective_price`,t.effectivePrice.value,true);Object.assign(_,f);}if(c){let f=i.cmp-i.d,N={discount_percent:(f/i.cmp*100).toFixed(0)};Object.assign(_,N),Object.assign(_,xn(`compare_price`,i.cmp)),Object.assign(_,xn(`discount_price`,f));}return {product:_,variant:{name:t.name,quantity:t.quantity}}}evaluateShowATCFlag(){let t=he$3.get().widgetCustomisation?.atcButton?.showWhen;if(!t?.predicates?.length)return true;let i=t.predicates,r=this.getValueMap(i);return t.op===`or`?i.some(o=>Pt$2([o],r)):Pt$2(i,r)}getValueMap(t){let i=new Map;for(let r of t){let o=r.attr.split(`.`);switch(o[1]){case `tags`:i.set(r.attr,this.tags);break;case `type`:case `category`:i.set(r.attr,this.category);break;case `meta`:case `metafield`:{let s=o[2];if(!s)continue;i.set(r.attr,this.meta?.[s]);break}}}return i}};var _t$2=class _t{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((i,r)=>r.height-i.height),this.durationMS=t.durationMS,this.thumbnail=t.thumbnail,this.items=t.items?t.items.map(i=>new ot$2(i)):[],this.card=t.card,this.sources){let i=[];for(let r of this.sources)r.format===`mp4`?i.push(r):r.format===`m3u8`&&!this.m3u8Source&&(this.m3u8Source=r);i.length>0&&(this.bestSource=i[0],this.highSource=i.length>1?i[1]:i[0],this.lowSource=i.length>2?i[i.length-1]:i[0]);}}};var De=(i=>(i.CLASSIC=`CLASSIC`,i.ITEM_CARD_HEADER=`ITEM_CARD_HEADER`,i))(De||{});var ge$2=(r=>(r.ON=`ON`,r.OFF=`OFF`,r.ON_HOVER=`ON_HOVER`,r))(ge$2||{}),ye$3=(o=>(o.FIRST_ITEM=`FIRST_ITEM`,o.ITEM_SWIPER=`ITEM_SWIPER`,o.CARD=`CARD`,o.NONE=`NONE`,o))(ye$3||{});var ue$2=class ue{videos;source;template;heading;autoPlay;showMuteButton;footerContent;detailPopup;playlistConfig;itemDetailConfig;constructor(t={}){this.videos=t.videos?.map(i=>new _t$2(i))??[],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 le$3=class le{lastWidth;lastHeight;resizeTimeout=null;debounceDelay=200;onResizeCallback;constructor(t){this.onResizeCallback=t,this.lastWidth=window.innerWidth,this.lastHeight=window.innerHeight,window.addEventListener(`resize`,this.debouncedResize),window.addEventListener(`orientationchange`,this.handleImmediateResize);}destroy(){window.removeEventListener(`resize`,this.debouncedResize),window.removeEventListener(`orientationchange`,this.handleImmediateResize);}handleImmediateResize=()=>{this.triggerResize();};debouncedResize=()=>{this.resizeTimeout!==null&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.triggerResize();},this.debounceDelay);};triggerResize(){let t=window.innerWidth,i=window.innerHeight;(i!==this.lastHeight||t!==this.lastWidth)&&(this.onResizeCallback(),this.lastWidth=t,this.lastHeight=i);}};var fe$3=0;function be$2(e=document.head){return ce$3(te$3.styleURL,e,`cooee-global-styles`)}function we$3(e=document.head){return ce$3(`${Xr$3}/swiper-bundle.min.css`,e,`swiper-styles`)}function ce$3(e,t=document.head,i){return new Promise(r=>{if(t.querySelector(`#${i}`)){r();return}let n=document.createElement(`link`);n.rel=`stylesheet`,n.href=e,n.id=i,n.onload=()=>{r();},n.onerror=()=>{console.error(`Failed to load stylesheet:`,e),r();},t.appendChild(n);})}function Ce$1(e,t=document.head){if(!e)return;fe$3++;let i=document.createElement(`style`);i.id=`cooee-app-css-${fe$3}`,i.textContent=e,t.appendChild(i);}function Ui$1(e){if(!e)return;let t=document.createElement(`script`);t.id=`cooee-app-script`,t.innerHTML=e,document.head.appendChild(t);}function xi$1(e){if(e)try{(0,eval)(e);}catch(t){console.error(`Failed to execute script:`,t);}}async function Vi$1(){let e=(await import(`${Xr$3}/swiper-bundle.min.mjs`)).Swiper;return window.CooeeSDK.Swiper=e}async function Mi$1(e,t=true){if(!e)return;let i=[];t&&i.push(we$3(e)),i.push(be$2(e)),await Promise.all(i);let r=he$3.get().website.commonCSS;Ce$1(r,e);}var Ue=(function(e){return e[e.SINGLE=1]=`SINGLE`,e[e.EXCLUSION=2]=`EXCLUSION`,e[e.ABTESTING=3]=`ABTESTING`,e})(Ue||{});var xe$2=(function(e){return e[e.NONE=0]=`NONE`,e[e.ITEM=1]=`ITEM`,e[e.COLLECTION=2]=`COLLECTION`,e})(xe$2||{});var Ve$3=(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})(Ve$3||{}),Me$1=(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})(Me$1||{});var He$3=(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})(He$3||{}),Ge$1=(function(e){return e.POPUP=`POPUP`,e.PAGE_EMBED=`PAGE_EMBED`,e.CART_EMBED=`CART_EMBED`,e.ANNOUNCEMENT_BAR=`ANNOUNCEMENT_BAR`,e})(Ge$1||{}),ke$1=(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})(ke$1||{}),Be$2=(function(e){return e.COOEE=`COOEE`,e.KLAVIYO=`KLAVIYO`,e})(Be$2||{}),We$2=(function(e){return e.ICONS=`ICONS`,e.TILES=`TILES`,e})(We$2||{}),Fe$1=(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})(Fe$1||{});var Ye$2=(r=>(r[r.LOW=1]=`LOW`,r[r.MEDIUM=2]=`MEDIUM`,r[r.HIGH=3]=`HIGH`,r))(Ye$2||{}),$e$1=(i=>(i.SINGLE_PANE=`SINGLE_PANE`,i.TWO_PANE=`TWO_PANE`,i))($e$1||{});
5
+ var X$3,h$2,Vt$2,ft$1,D$2,wt,Mt$2,Ht$2,Gt$1,ct$2,ut$1,lt$2,G$2={},kt$2=[],de$2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,q$2=Array.isArray;function A$2(e,t){for(var i in t)e[i]=t[i];return e}function ht$1(e){e&&e.parentNode&&e.parentNode.removeChild(e);}function pe$3(e,t,i){var r,o,n,s={};for(n in t)n==`key`?r=t[n]:n==`ref`?o=t[n]:s[n]=t[n];if(arguments.length>2&&(s.children=arguments.length>3?X$3.call(arguments,2):i),typeof e==`function`&&e.defaultProps!=null)for(n in e.defaultProps)s[n]===void 0&&(s[n]=e.defaultProps[n]);return K$3(e,s,r,o,null)}function K$3(e,t,i,r,o){var n={type:e,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Vt$2,__i:-1,__u:0};return o==null&&h$2.vnode!=null&&h$2.vnode(n),n}function j$2(e){return e.children}function g$1(e,t){this.props=e,this.context=t;}function y(e,t){if(t==null)return e.__?y(e.__,e.__i+1):null;for(var i;t<e.__k.length;t++)if((i=e.__k[t])!=null&&i.__e!=null)return i.__e;return typeof e.type==`function`?y(e):null}function Bt$2(e){var t,i;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((i=e.__k[t])!=null&&i.__e!=null){e.__e=e.__c.base=i.__e;break}return Bt$2(e)}}function Ct$2(e){(!e.__d&&(e.__d=true)&&D$2.push(e)&&!Q$3.__r++||wt!=h$2.debounceRendering)&&((wt=h$2.debounceRendering)||Mt$2)(Q$3);}function Q$3(){for(var e,t,i,r,o,n,s,u=1;D$2.length;)D$2.length>u&&D$2.sort(Ht$2),e=D$2.shift(),u=D$2.length,e.__d&&(i=void 0,o=(r=(t=e).__v).__e,n=[],s=[],t.__P&&((i=A$2({},r)).__v=r.__v+1,h$2.vnode&&h$2.vnode(i),dt(t.__P,i,r,t.__n,t.__P.namespaceURI,32&r.__u?[o]:null,n,o??y(r),!!(32&r.__u),s),i.__v=r.__v,i.__.__k[i.__i]=i,Yt$2(n,i,s),i.__e!=o&&Bt$2(i)));Q$3.__r=0;}function Wt$1(e,t,i,r,o,n,s,u,a,l,c){var _,E,f,N,R,I,p=r&&r.__k||kt$2,v=t.length;for(a=ve$1(i,t,p,a,v),_=0;_<v;_++)(f=i.__k[_])!=null&&(E=f.__i==-1?G$2:p[f.__i]||G$2,f.__i=_,I=dt(e,f,E,o,n,s,u,a,l,c),N=f.__e,f.ref&&E.ref!=f.ref&&(E.ref&&pt(E.ref,null,f),c.push(f.ref,f.__c||N,f)),R==null&&N!=null&&(R=N),4&f.__u||E.__k===f.__k?a=Ft$2(f,a,e):typeof f.type==`function`&&I!==void 0?a=I:N&&(a=N.nextSibling),f.__u&=-7);return i.__e=R,a}function ve$1(e,t,i,r,o){var n,s,u,a,l,c=i.length,_=c,E=0;for(e.__k=new Array(o),n=0;n<o;n++)(s=t[n])!=null&&typeof s!=`boolean`&&typeof s!=`function`?(a=n+E,(s=e.__k[n]=typeof s==`string`||typeof s==`number`||typeof s==`bigint`||s.constructor==String?K$3(null,s,null,null,null):q$2(s)?K$3(j$2,{children:s},null,null,null):s.constructor==null&&s.__b>0?K$3(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,u=null,(l=s.__i=Ee$3(s,i,a,_))!=-1&&(_--,(u=i[l])&&(u.__u|=2)),u==null||u.__v==null?(l==-1&&(o>c?E--:o<c&&E++),typeof s.type!=`function`&&(s.__u|=4)):l!=a&&(l==a-1?E--:l==a+1?E++:(l>a?E--:E++,s.__u|=4))):e.__k[n]=null;if(_)for(n=0;n<c;n++)(u=i[n])!=null&&!(2&u.__u)&&(u.__e==r&&(r=y(u)),zt$1(u,u));return r}function Ft$2(e,t,i){var r,o;if(typeof e.type==`function`){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=Ft$2(r[o],t,i));return t}e.__e!=t&&(t&&e.type&&!i.contains(t)&&(t=y(e)),i.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Ee$3(e,t,i,r){var o,n,s=e.key,u=e.type,a=t[i];if(a===null&&e.key==null||a&&s==a.key&&u==a.type&&(2&a.__u)==0)return i;if(r>(a!=null&&(2&a.__u)==0?1:0))for(o=i-1,n=i+1;o>=0||n<t.length;){if(o>=0){if((a=t[o])&&(2&a.__u)==0&&s==a.key&&u==a.type)return o;o--;}if(n<t.length){if((a=t[n])&&(2&a.__u)==0&&s==a.key&&u==a.type)return n;n++;}}return -1}function Ut$1(e,t,i){t[0]==`-`?e.setProperty(t,i??``):e[t]=i==null?``:typeof i!=`number`||de$2.test(t)?i:i+`px`;}function z$2(e,t,i,r,o){var n,s;t:if(t==`style`)if(typeof i==`string`)e.style.cssText=i;else {if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)i&&t in i||Ut$1(e.style,t,``);if(i)for(t in i)r&&i[t]==r[t]||Ut$1(e.style,t,i[t]);}else if(t[0]==`o`&&t[1]==`n`)n=t!=(t=t.replace(Gt$1,`$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+n]=i,i?r?i.u=r.u:(i.u=ct$2,e.addEventListener(t,n?lt$2:ut$1,n)):e.removeEventListener(t,n?lt$2:ut$1,n);else {if(o==`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]=i??``;break t}catch{}typeof i==`function`||(i==null||i===false&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&i==1?``:i));}}function xt$1(e){return function(t){if(this.l){var i=this.l[t.type+e];if(t.t==null)t.t=ct$2++;else if(t.t<i.u)return;return i(h$2.event?h$2.event(t):t)}}}function dt(e,t,i,r,o,n,s,u,a,l){var c,_,E,f,N,R,I,p,v,U,P,F,x,Dt,Y,V,st,L=t.type;if(t.constructor!=null)return null;128&i.__u&&(a=!!(32&i.__u),n=[u=t.__e=i.__e]),(c=h$2.__b)&&c(t);t:if(typeof L==`function`)try{if(p=t.props,v=`prototype`in L&&L.prototype.render,U=(c=L.contextType)&&r[c.__c],P=c?U?U.props.value:c.__:r,i.__c?I=(_=t.__c=i.__c).__=_.__E:(v?t.__c=_=new L(p,P):(t.__c=_=new g$1(p,P),_.constructor=L,_.render=me$3),U&&U.sub(_),_.props=p,_.state||(_.state={}),_.context=P,_.__n=r,E=_.__d=!0,_.__h=[],_._sb=[]),v&&_.__s==null&&(_.__s=_.state),v&&L.getDerivedStateFromProps!=null&&(_.__s==_.state&&(_.__s=A$2({},_.__s)),A$2(_.__s,L.getDerivedStateFromProps(p,_.__s))),f=_.props,N=_.state,_.__v=t,E)v&&L.getDerivedStateFromProps==null&&_.componentWillMount!=null&&_.componentWillMount(),v&&_.componentDidMount!=null&&_.__h.push(_.componentDidMount);else {if(v&&L.getDerivedStateFromProps==null&&p!==f&&_.componentWillReceiveProps!=null&&_.componentWillReceiveProps(p,P),!_.__e&&_.shouldComponentUpdate!=null&&_.shouldComponentUpdate(p,_.__s,P)===!1||t.__v==i.__v){for(t.__v!=i.__v&&(_.props=p,_.state=_.__s,_.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.some(function(M){M&&(M.__=t);}),F=0;F<_._sb.length;F++)_.__h.push(_._sb[F]);_._sb=[],_.__h.length&&s.push(_);break t}_.componentWillUpdate!=null&&_.componentWillUpdate(p,_.__s,P),v&&_.componentDidUpdate!=null&&_.__h.push(function(){_.componentDidUpdate(f,N,R);});}if(_.context=P,_.props=p,_.__P=e,_.__e=!1,x=h$2.__r,Dt=0,v){for(_.state=_.__s,_.__d=!1,x&&x(t),c=_.render(_.props,_.state,_.context),Y=0;Y<_._sb.length;Y++)_.__h.push(_._sb[Y]);_._sb=[];}else do _.__d=!1,x&&x(t),c=_.render(_.props,_.state,_.context),_.state=_.__s;while(_.__d&&++Dt<25);_.state=_.__s,_.getChildContext!=null&&(r=A$2(A$2({},r),_.getChildContext())),v&&!E&&_.getSnapshotBeforeUpdate!=null&&(R=_.getSnapshotBeforeUpdate(f,N)),V=c,c!=null&&c.type===j$2&&c.key==null&&(V=$t$1(c.props.children)),u=Wt$1(e,q$2(V)?V:[V],t,i,r,o,n,s,u,a,l),_.base=t.__e,t.__u&=-161,_.__h.length&&s.push(_),I&&(_.__E=_.__=null);}catch(M){if(t.__v=null,a||n!=null)if(M.then){for(t.__u|=a?160:128;u&&u.nodeType==8&&u.nextSibling;)u=u.nextSibling;n[n.indexOf(u)]=null,t.__e=u;}else for(st=n.length;st--;)ht$1(n[st]);else t.__e=i.__e,t.__k=i.__k;h$2.__e(M,t,i);}else n==null&&t.__v==i.__v?(t.__k=i.__k,t.__e=i.__e):u=t.__e=Ne$2(i.__e,t,i,r,o,n,s,a,l);return (c=h$2.diffed)&&c(t),128&t.__u?void 0:u}function Yt$2(e,t,i){for(var r=0;r<i.length;r++)pt(i[r],i[++r],i[++r]);h$2.__c&&h$2.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(n){n.call(o);});}catch(n){h$2.__e(n,o.__v);}});}function $t$1(e){return typeof e!=`object`||e==null||e.__b&&e.__b>0?e:q$2(e)?e.map($t$1):A$2({},e)}function Ne$2(e,t,i,r,o,n,s,u,a){var l,c,_,E,f,N,R,I=i.props,p=t.props,v=t.type;if(v==`svg`?o=`http://www.w3.org/2000/svg`:v==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||(o=`http://www.w3.org/1999/xhtml`),n!=null){for(l=0;l<n.length;l++)if((f=n[l])&&`setAttribute`in f==!!v&&(v?f.localName==v:f.nodeType==3)){e=f,n[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(p);e=document.createElementNS(o,v,p.is&&p),u&&(h$2.__m&&h$2.__m(t,n),u=false),n=null;}if(v==null)I===p||u&&e.data==p||(e.data=p);else {if(n=n&&X$3.call(e.childNodes),I=i.props||G$2,!u&&n!=null)for(I={},l=0;l<e.attributes.length;l++)I[(f=e.attributes[l]).name]=f.value;for(l in I)if(f=I[l],l!=`children`){if(l==`dangerouslySetInnerHTML`)_=f;else if(!(l in p)){if(l==`value`&&`defaultValue`in p||l==`checked`&&`defaultChecked`in p)continue;z$2(e,l,null,f,o);}}for(l in p)f=p[l],l==`children`?E=f:l==`dangerouslySetInnerHTML`?c=f:l==`value`?N=f:l==`checked`?R=f:u&&typeof f!=`function`||I[l]===f||z$2(e,l,f,I[l],o);if(c)u||_&&(c.__html==_.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(_&&(e.innerHTML=``),Wt$1(t.type==`template`?e.content:e,q$2(E)?E:[E],t,i,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,n,s,n?n[0]:i.__k&&y(i,0),u,a),n!=null)for(l=n.length;l--;)ht$1(n[l]);u||(l=`value`,v==`progress`&&N==null?e.removeAttribute(`value`):N!=null&&(N!==e[l]||v==`progress`&&!N||v==`option`&&N!=I[l])&&z$2(e,l,N,I[l],o),l=`checked`,R!=null&&R!=e[l]&&z$2(e,l,R,I[l],o));}return e}function pt(e,t,i){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t));}else e.current=t;}catch(o){h$2.__e(o,i);}}function zt$1(e,t,i){var r,o;if(h$2.unmount&&h$2.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||pt(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount();}catch(n){h$2.__e(n,t);}r.base=r.__P=null;}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&zt$1(r[o],t,i||typeof e.type!=`function`);i||ht$1(e.__e),e.__c=e.__=e.__e=void 0;}function me$3(e,t,i){return this.constructor(e,i)}function ze$1(e,t,i){var r,o,n,s;t==document&&(t=document.documentElement),h$2.__&&h$2.__(e,t),o=(r="undefined"==`function`)?null:t.__k,n=[],s=[],dt(t,e=(t).__k=pe$3(j$2,null,[e]),o||G$2,G$2,t.namespaceURI,o?null:t.firstChild?X$3.call(t.childNodes):null,n,o?o.__e:t.firstChild,r,s),Yt$2(n,e,s);}X$3=kt$2.slice,h$2={__e:function(e,t,i,r){for(var o,n,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((n=o.constructor)&&n.getDerivedStateFromError!=null&&(o.setState(n.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(u){e=u;}throw e}},Vt$2=0,ft$1=function(e){return e!=null&&e.constructor==null},g$1.prototype.setState=function(e,t){var i=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=A$2({},this.state);typeof e==`function`&&(e=e(A$2({},i),this.props)),e&&A$2(i,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ct$2(this));},g$1.prototype.forceUpdate=function(e){this.__v&&(this.__e=true,e&&this.__h.push(e),Ct$2(this));},g$1.prototype.render=j$2,D$2=[],Mt$2=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ht$2=function(e,t){return e.__v.__b-t.__v.__b},Q$3.__r=0,Gt$1=/(PointerCapture)$|Capture$/i,ct$2=0,ut$1=xt$1(false),lt$2=xt$1(true);var Et$2,S$2,vt$1,Kt$2,Qt$2=0,ie$3=[],m$1=h$2,Xt$1=m$1.__b,qt$1=m$1.__r,jt$1=m$1.diffed,Jt$2=m$1.__c,Zt$1=m$1.unmount,te$2=m$1.__;function Oe$3(e,t){m$1.__h&&m$1.__h(S$2,e,Qt$2||t),Qt$2=0;var i=S$2.__H||(S$2.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function mt$2(e,t){var i=Oe$3(Et$2++,7);return Re$2(i.__H,t)&&(i.__=e(),i.__H=t,i.__h=e),i.__}function Ie$2(){for(var e;e=ie$3.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(J$2),e.__H.__h.forEach(Nt$2),e.__H.__h=[];}catch(t){e.__H.__h=[],m$1.__e(t,e.__v);}}m$1.__b=function(e){S$2=null,Xt$1&&Xt$1(e);},m$1.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),te$2&&te$2(e,t);},m$1.__r=function(e){qt$1&&qt$1(e),Et$2=0;var t=(S$2=e.__c).__H;t&&(vt$1===S$2?(t.__h=[],S$2.__h=[],t.__.forEach(function(i){i.__N&&(i.__=i.__N),i.u=i.__N=void 0;})):(t.__h.forEach(J$2),t.__h.forEach(Nt$2),t.__h=[],Et$2=0)),vt$1=S$2;},m$1.diffed=function(e){jt$1&&jt$1(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ie$3.push(t)!==1&&Kt$2===m$1.requestAnimationFrame||((Kt$2=m$1.requestAnimationFrame)||Se$3)(Ie$2)),t.__H.__.forEach(function(i){i.u&&(i.__H=i.u),i.u=void 0;})),vt$1=S$2=null;},m$1.__c=function(e,t){t.some(function(i){try{i.__h.forEach(J$2),i.__h=i.__h.filter(function(r){return !r.__||Nt$2(r)});}catch(r){t.some(function(o){o.__h&&(o.__h=[]);}),t=[],m$1.__e(r,i.__v);}}),Jt$2&&Jt$2(e,t);},m$1.unmount=function(e){Zt$1&&Zt$1(e);var t,i=e.__c;i&&i.__H&&(i.__H.__.forEach(function(r){try{J$2(r);}catch(o){t=o;}}),i.__H=void 0,t&&m$1.__e(t,i.__v));};var ee$3=typeof requestAnimationFrame==`function`;function Se$3(e){var t,i=function(){clearTimeout(r),ee$3&&cancelAnimationFrame(t),setTimeout(e);},r=setTimeout(i,35);ee$3&&(t=requestAnimationFrame(i));}function J$2(e){var t=S$2,i=e.__c;typeof i==`function`&&(e.__c=void 0,i()),S$2=t;}function Nt$2(e){var t=S$2;e.__c=e.__(),S$2=t;}function Re$2(e,t){return !e||e.length!==t.length||t.some(function(i,r){return i!==e[r]})}var Le$2=Symbol.for(`preact-signals`);function It$2(){if(b$1>1)b$1--;else {for(var e,t=false;k$3!==void 0;){var i=k$3;for(k$3=void 0,Ot$2++;i!==void 0;){var r=i.o;if(i.o=void 0,i.f&=-3,!(8&i.f)&&ne$1(i))try{i.c();}catch(o){t||(e=o,t=true);}i=r;}}if(Ot$2=0,b$1--,t)throw e}}var d$1=void 0;var k$3=void 0,b$1=0,Ot$2=0,Z$2=0;function re$3(e){if(d$1!==void 0){var t=e.n;if(t===void 0||t.t!==d$1)return t={i:0,S:e,p:d$1.s,n:void 0,t:d$1,e:void 0,x:void 0,r:t},d$1.s!==void 0&&(d$1.s.n=t),d$1.s=t,e.n=t,32&d$1.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=d$1.s,t.n=void 0,d$1.s.n=t,d$1.s=t),t}}function O$1(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0;}O$1.prototype.brand=Le$2;O$1.prototype.h=function(){return true};O$1.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);};O$1.prototype.U=function(e){if(this.t!==void 0){var t=e.e,i=e.x;t!==void 0&&(t.x=i,e.e=void 0),i!==void 0&&(i.e=t,e.x=void 0),e===this.t&&(this.t=i);}};O$1.prototype.subscribe=function(e){var t=this;return W$2(function(){var i=t.value,r=d$1;d$1=void 0;try{e(i);}finally{d$1=r;}})};O$1.prototype.valueOf=function(){return this.value};O$1.prototype.toString=function(){return this.value+``};O$1.prototype.toJSON=function(){return this.value};O$1.prototype.peek=function(){var e=d$1;d$1=void 0;try{return this.value}finally{d$1=e;}};Object.defineProperty(O$1.prototype,`value`,{get:function(){var e=re$3(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Ot$2>100)throw new Error(`Cycle detected`);this.v=e,this.i++,Z$2++,b$1++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N();}finally{It$2();}}}});function T$1(e){return new O$1(e)}function ne$1(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 true;return false}function oe$4(e){for(var t=e.s;t!==void 0;t=t.n){var i=t.S.n;if(i!==void 0&&(t.r=i),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function _e$3(e){for(var t=e.s,i=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):i=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r;}e.s=i;}function w$1(e){O$1.call(this,void 0),this.x=e,this.s=void 0,this.g=Z$2-1,this.f=4;}(w$1.prototype=new O$1).h=function(){if(this.f&=-3,1&this.f)return false;if((36&this.f)==32||(this.f&=-5,this.g===Z$2))return true;if(this.g=Z$2,this.f|=1,this.i>0&&!ne$1(this))return this.f&=-2,true;var e=d$1;try{oe$4(this),d$1=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++);}catch(i){this.v=i,this.f|=16,this.i++;}return d$1=e,_e$3(this),this.f&=-2,true};w$1.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);}O$1.prototype.S.call(this,e);};w$1.prototype.U=function(e){if(this.t!==void 0&&(O$1.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);}};w$1.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(w$1.prototype,`value`,{get:function(){if(1&this.f)throw new Error(`Cycle detected`);var e=re$3(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function St$2(e){return new w$1(e)}function se$2(e){var t=e.u;if(e.u=void 0,typeof t==`function`){b$1++;var i=d$1;d$1=void 0;try{t();}catch(r){throw e.f&=-2,e.f|=8,Rt$2(e),r}finally{d$1=i,It$2();}}}function Rt$2(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,se$2(e);}function Te$2(e){if(d$1!==this)throw new Error(`Out-of-order effect`);_e$3(this),d$1=e,this.f&=-2,8&this.f&&Rt$2(this),It$2();}function B$1(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32;}B$1.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();}};B$1.prototype.S=function(){if(1&this.f)throw new Error(`Cycle detected`);this.f|=1,this.f&=-9,se$2(this),oe$4(this),b$1++;var e=d$1;return d$1=this,Te$2.bind(this,e)};B$1.prototype.N=function(){2&this.f||(this.f|=2,this.o=k$3,k$3=this);};B$1.prototype.d=function(){this.f|=8,1&this.f||Rt$2(this);};function W$2(e){var t=new B$1(e);try{t.c();}catch(i){throw t.d(),i}return t.d.bind(t)}var Lt$2;function C$3(e,t){h$2[e]=t.bind(null,h$2[e]||function(){});}function tt$1(e){Lt$2&&Lt$2(),Lt$2=e&&e.S();}function ae$2(e){var t=this,i=e.data,r=Pe$3(i);r.value=i;var o=mt$2(function(){for(var n=t.__v;n=n.__;)if(n.__c){n.__c.__$f|=4;break}return t.__$u.c=function(){var s,u=t.__$u.S(),a=o.value;u(),ft$1(a)||((s=t.base)==null?void 0:s.nodeType)!==3?(t.__$f|=1,t.setState({})):t.base.data=a;},St$2(function(){var s=r.value.value;return s===0?0:s===true?``:s||``})},[]);return o.value}ae$2.displayName=`_st`;Object.defineProperties(O$1.prototype,{constructor:{configurable:true,value:void 0},type:{configurable:true,value:ae$2},props:{configurable:true,get:function(){return {data:this}}},__b:{configurable:true,value:1}});C$3(`__b`,function(e,t){if(typeof t.type==`string`){var i,r=t.props;for(var o in r)if(o!==`children`){var n=r[o];n instanceof O$1&&(i||(t.__np=i={}),i[o]=n,r[o]=n.peek());}}e(t);});C$3(`__r`,function(e,t){tt$1();var i,r=t.__c;r&&(r.__$f&=-2,(i=r.__$u)===void 0&&(r.__$u=i=(function(o){var n;return W$2(function(){n=this;}),n.c=function(){r.__$f|=1,r.setState({});},n})())),tt$1(i),e(t);});C$3(`__e`,function(e,t,i,r){tt$1(),e(t,i,r);});C$3(`diffed`,function(e,t){tt$1();var i;if(typeof t.type==`string`&&(i=t.__e)){var r=t.__np,o=t.props;if(r){var n=i.U;if(n)for(var s in n){var u=n[s];u!==void 0&&!(s in r)&&(u.d(),n[s]=void 0);}else i.U=n={};for(var a in r){var l=n[a],c=r[a];l===void 0?(l=Ae$3(i,a,c,o),n[a]=l):l.o(c,o);}}}e(t);});function Ae$3(e,t,i,r){var o=t in e&&e.ownerSVGElement===void 0,n=T$1(i);return {o:function(s,u){n.value=s,r=u;},d:W$2(function(){var s=n.value.value;r[t]!==s&&(r[t]=s,o?e[t]=s:s?e.setAttribute(t,s):e.removeAttribute(t));})}}C$3(`unmount`,function(e,t){if(typeof t.type==`string`){var i=t.__e;if(i){var r=i.U;if(r){i.U=void 0;for(var o in r){var n=r[o];n&&n.d();}}}}else {var s=t.__c;if(s){var u=s.__$u;u&&(s.__$u=void 0,u.d());}}e(t);});C$3(`__h`,function(e,t,i,r){(r<3||r===9)&&(t.__$f|=2),e(t,i,r);});g$1.prototype.shouldComponentUpdate=function(e,t){var i=this.__$u,r=i&&i.s!==void 0;for(var o in t)return true;if(this.__f||typeof this.u==`boolean`&&this.u===true){if(!(r||2&this.__$f||4&this.__$f)||1&this.__$f)return true}else if(!(r||4&this.__$f)||3&this.__$f)return true;for(var n in e)if(n!==`__source`&&e[n]!==this.props[n])return true;for(var s in this.props)if(!(s in e))return true;return false};function Pe$3(e){return mt$2(function(){return T$1(e)},[])}var et=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 it$1=class it{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url;}};var rt$2=class rt{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=this.d;}};var At$1=class At{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??false;}},nt$1=class nt{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(i=>new it$1(i))??[],this.link=t.link,this.price=new rt$2(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,this.selectedOptions=t.selectedOptions??[],this.effectivePrice=T$1(this.price.effective),t.sellingPlans?.length&&(this.selectedSellingPlan=T$1(void 0)),this.sellingPlans=t.sellingPlans?.map(i=>{let r=new At$1(i);return r.isSelected&&(this.selectedSellingPlan.value=r),r});}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t;}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};function Pt$2(e,t){for(let i of e){let r=t.get(i.attr),o=Array.isArray(r),n=typeof r==`string`,s=typeof r==`number`&&typeof i.value==`number`,u=Array.isArray(i.value),a=true;switch(i.op){case `contains`:a=(o||n)&&r.includes(i.value);break;case `notContains`:a=(o||n)&&!r.includes(i.value);break;case `eq`:a=r===i.value;break;case `ne`:a=r!==i.value;break;case `gt`:a=s&&r>i.value;break;case `gte`:a=s&&r>=i.value;break;case `lt`:a=s&&r<i.value;break;case `lte`:a=s&&r<=i.value;break;case `in`:a=u&&i.value.includes(r);break;case `nin`:a=u&&!i.value.includes(r);break;case `between`:a=s&&u&&i.value.length===2&&r>=i.value[0]&&r<=i.value[1];break;case `all`:a=o&&u&&i.value.every(l=>r.includes(l));break;default:a=false;break}if(!a)return false}return true}var ot$2=class ot{id;mID;name;options;imgs;vars;desc;link;slug;quantity;category;meta;reviews;tags;templateSuffix;selectedOrFirstVariant;selected=T$1(true);_showAddToCartButton;constructor(t){this.update(t),this.selectedOrFirstVariant=T$1(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 i=this.vars.find(r=>r.mID===t.toString());i&&this.setSelectedVariant(i);}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(i=>new nt$1(i))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new et({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,i=t.price,r$1=this.name,o=this.category,n=this.variantImage??this.firstImageURL,s$1=this.meta,u=this.tags?.join(`,`)??``,a=this.reviews?.rating,l=this.reviews?.totalReviews,c=i.cmp&&i.cmp>i.d,_=s(r({name:r$1},An$1(`price`,i.d,true)),{image_url:n,meta:s$1,category:o,rating:a,reviews:l,tags:u});if(t.hasEffectivePrice()){let f=An$1(`effective_price`,t.effectivePrice.value,true);Object.assign(_,f);}if(c){let f=i.cmp-i.d,N={discount_percent:(f/i.cmp*100).toFixed(0)};Object.assign(_,N),Object.assign(_,An$1(`compare_price`,i.cmp)),Object.assign(_,An$1(`discount_price`,f));}return {product:_,variant:{name:t.name,quantity:t.quantity}}}evaluateShowATCFlag(){let t=he$3.get().widgetCustomisation?.atcButton?.showWhen;if(!t?.predicates?.length)return true;let i=t.predicates,r=this.getValueMap(i);return t.op===`or`?i.some(o=>Pt$2([o],r)):Pt$2(i,r)}getValueMap(t){let i=new Map;for(let r of t){let o=r.attr.split(`.`);switch(o[1]){case `tags`:i.set(r.attr,this.tags);break;case `type`:case `category`:i.set(r.attr,this.category);break;case `meta`:case `metafield`:{let s=o[2];if(!s)continue;i.set(r.attr,this.meta?.[s]);break}}}return i}};var _t$2=class _t{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((i,r)=>r.height-i.height),this.durationMS=t.durationMS,this.thumbnail=t.thumbnail,this.items=t.items?t.items.map(i=>new ot$2(i)):[],this.card=t.card,this.sources){let i=[];for(let r of this.sources)r.format===`mp4`?i.push(r):r.format===`m3u8`&&!this.m3u8Source&&(this.m3u8Source=r);i.length>0&&(this.bestSource=i[0],this.highSource=i.length>1?i[1]:i[0],this.lowSource=i.length>2?i[i.length-1]:i[0]);}}};var De=(i=>(i.CLASSIC=`CLASSIC`,i.ITEM_CARD_HEADER=`ITEM_CARD_HEADER`,i))(De||{});var ge$2=(r=>(r.ON=`ON`,r.OFF=`OFF`,r.ON_HOVER=`ON_HOVER`,r))(ge$2||{}),ye$3=(o=>(o.FIRST_ITEM=`FIRST_ITEM`,o.ITEM_SWIPER=`ITEM_SWIPER`,o.CARD=`CARD`,o.NONE=`NONE`,o))(ye$3||{});var ue$2=class ue{videos;source;template;heading;autoPlay;showMuteButton;footerContent;detailPopup;playlistConfig;itemDetailConfig;constructor(t={}){this.videos=t.videos?.map(i=>new _t$2(i))??[],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 le$3=class le{lastWidth;lastHeight;resizeTimeout=null;debounceDelay=200;onResizeCallback;constructor(t){this.onResizeCallback=t,this.lastWidth=window.innerWidth,this.lastHeight=window.innerHeight,window.addEventListener(`resize`,this.debouncedResize),window.addEventListener(`orientationchange`,this.handleImmediateResize);}destroy(){window.removeEventListener(`resize`,this.debouncedResize),window.removeEventListener(`orientationchange`,this.handleImmediateResize);}handleImmediateResize=()=>{this.triggerResize();};debouncedResize=()=>{this.resizeTimeout!==null&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.triggerResize();},this.debounceDelay);};triggerResize(){let t=window.innerWidth,i=window.innerHeight;(i!==this.lastHeight||t!==this.lastWidth)&&(this.onResizeCallback(),this.lastWidth=t,this.lastHeight=i);}};var fe$3=0;function be$2(e=document.head){return ce$3(ee$4.styleURL,e,`cooee-global-styles`)}function we$3(e=document.head){return ce$3(`${Kr$3}/swiper-bundle.min.css`,e,`swiper-styles`)}function ce$3(e,t=document.head,i){return new Promise(r=>{if(t.querySelector(`#${i}`)){r();return}let n=document.createElement(`link`);n.rel=`stylesheet`,n.href=e,n.id=i,n.onload=()=>{r();},n.onerror=()=>{console.error(`Failed to load stylesheet:`,e),r();},t.appendChild(n);})}function Ce$1(e,t=document.head){if(!e)return;fe$3++;let i=document.createElement(`style`);i.id=`cooee-app-css-${fe$3}`,i.textContent=e,t.appendChild(i);}function Ui$1(e){if(!e)return;let t=document.createElement(`script`);t.id=`cooee-app-script`,t.innerHTML=e,document.head.appendChild(t);}function xi$1(e){if(e)try{(0,eval)(e);}catch(t){console.error(`Failed to execute script:`,t);}}async function Vi$1(){let e=(await import(`${Kr$3}/swiper-bundle.min.mjs`)).Swiper;return window.CooeeSDK.Swiper=e}async function Mi$1(e,t=true){if(!e)return;let i=[];t&&i.push(we$3(e)),i.push(be$2(e)),await Promise.all(i);let r=he$3.get().website.commonCSS;Ce$1(r,e);}var Ue=(function(e){return e[e.SINGLE=1]=`SINGLE`,e[e.EXCLUSION=2]=`EXCLUSION`,e[e.ABTESTING=3]=`ABTESTING`,e})(Ue||{});var xe$2=(function(e){return e[e.NONE=0]=`NONE`,e[e.ITEM=1]=`ITEM`,e[e.COLLECTION=2]=`COLLECTION`,e})(xe$2||{});var Ve$3=(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})(Ve$3||{}),Me$1=(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})(Me$1||{});var He$3=(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})(He$3||{}),Ge$1=(function(e){return e.POPUP=`POPUP`,e.PAGE_EMBED=`PAGE_EMBED`,e.CART_EMBED=`CART_EMBED`,e.ANNOUNCEMENT_BAR=`ANNOUNCEMENT_BAR`,e})(Ge$1||{}),ke$1=(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})(ke$1||{}),Be$2=(function(e){return e.COOEE=`COOEE`,e.KLAVIYO=`KLAVIYO`,e})(Be$2||{}),We$2=(function(e){return e.ICONS=`ICONS`,e.TILES=`TILES`,e})(We$2||{}),Fe$2=(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})(Fe$2||{});var Ye$2=(r=>(r[r.LOW=1]=`LOW`,r[r.MEDIUM=2]=`MEDIUM`,r[r.HIGH=3]=`HIGH`,r))(Ye$2||{}),$e$1=(i=>(i.SINGLE_PANE=`SINGLE_PANE`,i.TWO_PANE=`TWO_PANE`,i))($e$1||{});
6
6
 
7
7
  var Te$1=v$1((Y,we)=>{(function(i,r){typeof Y==`object`&&typeof we<`u`?r(Y):typeof define==`function`&&define.amd?define([`exports`],r):r((i=typeof globalThis<`u`?globalThis:i||self).Sqrl={});})(Y,function(i){function r(e){var t,n,a=new Error(e);return t=a,n=r.prototype,Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n,a}function o(e,t,n){var a=t.slice(0,n).split(/\n/),s=a.length,l=a[s-1].length+1;throw r(e+=` at line `+s+` col `+l+`:
8
8
 
@@ -13,19 +13,19 @@ var Te$1=v$1((Y,we)=>{(function(i,r){typeof Y==`object`&&typeof we<`u`?r(Y):type
13
13
 
14
14
  `+l.message+`
15
15
  `+Array(l.message.length+1).join(`=`)+`
16
- `+K(e,a)):l}}function re(e,t){var n;return t.cache&&t.name&&t.storage.templates.get(t.name)?t.storage.templates.get(t.name):(n=typeof e==`function`?e:he(e,t),t.cache&&t.name&&t.storage.templates.define(t.name,n),n)}J.l.bind(J),i.compile=he,i.compileScope=P,i.compileScopeIntoFunction=ee,i.compileToString=K,i.defaultConfig=J,i.filters=me,i.getConfig=te,i.helpers=de,i.nativeHelpers=ge,i.parse=ue,i.render=function(e,t,n,a){var s=te(n||{});if(!s.async)return re(e,s)(t,s);if(!a){if(typeof m==`function`)return new m(function(l,c){try{l(re(e,s)(t,s));}catch(p){c(p);}});throw r(`Please provide a callback function, this env doesn't support Promises`)}try{re(e,s)(t,s,a);}catch(l){return a(l)}},i.templates=fe,Object.defineProperty(i,`__esModule`,{value:true});});});var oe$3=class oe{minValue;rewardType;label;reachingText;reachedText;discount;items;isUIOnly;allowATC;reached;calculatedAlignment;images;constructor(r){this.reached=r.reached??false,this.calculatedAlignment=r.calculatedAlignment,this.minValue=r.minValue,this.rewardType=r.rewardType,this.label=r.label,this.reachingText=r.reachingText,this.reachedText=r.reachedText,this.discount=r.discount,this.items=r.items?.map(o=>new et(o)),this.isUIOnly=r.isUIOnly,this.allowATC=r.allowATC,this.images=r.images;}},Re$1=(o=>(o.CART_AMOUNT=`CART_AMOUNT`,o.ITEM_COUNT=`ITEM_COUNT`,o))(Re$1||{}),xe$1=class xe{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(r){this.layout=r.layout??We$2.ICONS,this.onlyLatestGift=r.onlyLatestGift,this.noConfetti=r.noConfetti,this.removeIneligibleItem=r.removeIneligibleItem??true,this.restrictToLatestFreebie=r.restrictToLatestFreebie,this.rewardBasis=r.rewardBasis??`CART_AMOUNT`,this.update(r);}update(r){r=r??{},this.milestones=r.milestones?.map(o=>new oe$3(o))??[],this.totalProgress=r.totalProgress??0,this.coupons=r.coupons,this.reachedAmountOrCount=r.reachedAmountOrCount;}};var Ne$2=class Ne{animateNumber;animationDuration;text;iconURL;animation;totalSavings;constructor(r={}){this.animateNumber=r.animateNumber??true,this.animation=r.animation??`SLOT_MACHINE`,this.animationDuration=r.animationDuration??1e3,this.text=r.text??`You are saving {{ cart.total_savings }} on this order`,this.iconURL=r.iconURL,this.totalSavings=r.totalSavings??0;}};var b=x$2(Te$1());b.filters.define(`default`,function(i){return typeof i>`u`||i==null?``:Me(i)});+b.filters.define(`max`,(i,r)=>{let o=Number(i),m=Number(r);return isNaN(o)||isNaN(m)?i:o>m?r:i});b.filters.define(`min`,(i,r)=>{let o=Number(i),m=Number(r);return isNaN(o)||isNaN(m)?i:o<m?r:i});b.filters.define(`fallback`,(i,r)=>i==null||i===``?r:i);b.filters.define(`manipulate_quantity`,(i,r,o)=>{if(r??=1,o??=100,r>o)return Y$1.error(`Invalid range: min should be less than or equal to max.`),i;if(i>=r&&i<=o)return i;let m=i%o;return m<r?r:m});b.filters.define(`apply_discount_perc`,(i,r,o=Infinity)=>{if(i=+i,isNaN(i))return Y$1.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(r<0||r>100)return Y$1.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let m=i*r/100;return i-Math.min(o,m)});b.filters.define(`apply_discount_fixed`,(i,r)=>(i=+i,isNaN(i)?(Y$1.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,i-r)));b.filters.define(`currency`,i=>(i=+i,isNaN(i)?(Y$1.error("Need value as a number for `currency` filter"),NaN):Ar$1(i)));b.filters.define(`split`,(i,r,o)=>{if(typeof i!=`string`)return Y$1.error("Need value as a string for `split` filter"),``;if(r==null)return Y$1.error("Need delimiter for `split` filter"),``;if(o==null||isNaN(Number(o)))return Y$1.error("Need a valid index for `split` filter"),``;let m=i.split(String(r)),w=Number(o);return m[w<0?m.length+w:w].trim()??``});b.defaultConfig.defaultFilter=`default`;b.defaultConfig.useWith=true;b.defaultConfig.autoEscape=false;var Pe$1={'"':`&quot;`,"\\":`&bsol;`,"\n":`\\n`," ":`\\t`};function Me(i){return String(i).replace(/["\\\n\t]/g,r=>Pe$1[r])}function Le$1(i){if(!i)return ``;return i.replace(/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g,(o,m,w,C)=>`{{ ${(w||C||``).trim()} }}`)}var qe$1=(i,r$1,o)=>{r$1=r({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},r$1);try{return b.render(Le$1(i),r$1)}catch(m){throw ke$2(m,`squirrelly-render`,{extra:{template:i,values:r$1},triggerContext:o}),m}},Ve$2=(i,r,o)=>{let w=qe$1(JSON.stringify(i),r,o);try{return JSON.parse(w)}catch(C){throw ke$2(C,`variable-replacement`,{extra:{before:i,after:w},triggerContext:o}),C}};var He$2=(o=>(o.IMAGE=`IMAGE`,o.BUTTON=`BUTTON`,o))(He$2||{}),Ie$2=class Ie{title;subtitle;template;refreshPage;options;constructor(r={}){this.template=r.template??`IMAGE`,this.refreshPage=r.refreshPage??false,this.options=r.options??[],this.title=r.title,this.subtitle=r.subtitle;}};
16
+ `+K(e,a)):l}}function re(e,t){var n;return t.cache&&t.name&&t.storage.templates.get(t.name)?t.storage.templates.get(t.name):(n=typeof e==`function`?e:he(e,t),t.cache&&t.name&&t.storage.templates.define(t.name,n),n)}J.l.bind(J),i.compile=he,i.compileScope=P,i.compileScopeIntoFunction=ee,i.compileToString=K,i.defaultConfig=J,i.filters=me,i.getConfig=te,i.helpers=de,i.nativeHelpers=ge,i.parse=ue,i.render=function(e,t,n,a){var s=te(n||{});if(!s.async)return re(e,s)(t,s);if(!a){if(typeof m==`function`)return new m(function(l,c){try{l(re(e,s)(t,s));}catch(p){c(p);}});throw r(`Please provide a callback function, this env doesn't support Promises`)}try{re(e,s)(t,s,a);}catch(l){return a(l)}},i.templates=fe,Object.defineProperty(i,`__esModule`,{value:true});});});var oe$3=class oe{minValue;rewardType;label;reachingText;reachedText;discount;items;isUIOnly;allowATC;reached;calculatedAlignment;images;constructor(r){this.reached=r.reached??false,this.calculatedAlignment=r.calculatedAlignment,this.minValue=r.minValue,this.rewardType=r.rewardType,this.label=r.label,this.reachingText=r.reachingText,this.reachedText=r.reachedText,this.discount=r.discount,this.items=r.items?.map(o=>new et(o)),this.isUIOnly=r.isUIOnly,this.allowATC=r.allowATC,this.images=r.images;}},Re$1=(o=>(o.CART_AMOUNT=`CART_AMOUNT`,o.ITEM_COUNT=`ITEM_COUNT`,o))(Re$1||{}),xe$1=class xe{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(r){this.layout=r.layout??We$2.ICONS,this.onlyLatestGift=r.onlyLatestGift,this.noConfetti=r.noConfetti,this.removeIneligibleItem=r.removeIneligibleItem??true,this.restrictToLatestFreebie=r.restrictToLatestFreebie,this.rewardBasis=r.rewardBasis??`CART_AMOUNT`,this.update(r);}update(r){r=r??{},this.milestones=r.milestones?.map(o=>new oe$3(o))??[],this.totalProgress=r.totalProgress??0,this.coupons=r.coupons,this.reachedAmountOrCount=r.reachedAmountOrCount;}};var Ne$1=class Ne{animateNumber;animationDuration;text;iconURL;animation;totalSavings;constructor(r={}){this.animateNumber=r.animateNumber??true,this.animation=r.animation??`SLOT_MACHINE`,this.animationDuration=r.animationDuration??1e3,this.text=r.text??`You are saving {{ cart.total_savings }} on this order`,this.iconURL=r.iconURL,this.totalSavings=r.totalSavings??0;}};var b=x$2(Te$1());b.filters.define(`default`,function(i){return typeof i>`u`||i==null?``:Me(i)});+b.filters.define(`max`,(i,r)=>{let o=Number(i),m=Number(r);return isNaN(o)||isNaN(m)?i:o>m?r:i});b.filters.define(`min`,(i,r)=>{let o=Number(i),m=Number(r);return isNaN(o)||isNaN(m)?i:o<m?r:i});b.filters.define(`fallback`,(i,r)=>i==null||i===``?r:i);b.filters.define(`manipulate_quantity`,(i,r,o)=>{if(r??=1,o??=100,r>o)return Y$1.error(`Invalid range: min should be less than or equal to max.`),i;if(i>=r&&i<=o)return i;let m=i%o;return m<r?r:m});b.filters.define(`apply_discount_perc`,(i,r,o=Infinity)=>{if(i=+i,isNaN(i))return Y$1.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(r<0||r>100)return Y$1.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let m=i*r/100;return i-Math.min(o,m)});b.filters.define(`apply_discount_fixed`,(i,r)=>(i=+i,isNaN(i)?(Y$1.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,i-r)));b.filters.define(`currency`,i=>(i=+i,isNaN(i)?(Y$1.error("Need value as a number for `currency` filter"),NaN):Cr$2(i)));b.filters.define(`split`,(i,r,o)=>{if(typeof i!=`string`)return Y$1.error("Need value as a string for `split` filter"),``;if(r==null)return Y$1.error("Need delimiter for `split` filter"),``;if(o==null||isNaN(Number(o)))return Y$1.error("Need a valid index for `split` filter"),``;let m=i.split(String(r)),w=Number(o);return m[w<0?m.length+w:w].trim()??``});b.defaultConfig.defaultFilter=`default`;b.defaultConfig.useWith=true;b.defaultConfig.autoEscape=false;var Pe$2={'"':`&quot;`,"\\":`&bsol;`,"\n":`\\n`," ":`\\t`};function Me(i){return String(i).replace(/["\\\n\t]/g,r=>Pe$2[r])}function Le$1(i){if(!i)return ``;return i.replace(/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g,(o,m,w,C)=>`{{ ${(w||C||``).trim()} }}`)}var qe$1=(i,r$1,o)=>{r$1=r({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},r$1);try{return b.render(Le$1(i),r$1)}catch(m){throw ke$2(m,`squirrelly-render`,{extra:{template:i,values:r$1},triggerContext:o}),m}},Ve$2=(i,r,o)=>{let w=qe$1(JSON.stringify(i),r,o);try{return JSON.parse(w)}catch(C){throw ke$2(C,`variable-replacement`,{extra:{before:i,after:w},triggerContext:o}),C}};var He$2=(o=>(o.IMAGE=`IMAGE`,o.BUTTON=`BUTTON`,o))(He$2||{}),Ie$1=class Ie{title;subtitle;template;refreshPage;options;constructor(r={}){this.template=r.template??`IMAGE`,this.refreshPage=r.refreshPage??false,this.options=r.options??[],this.title=r.title,this.subtitle=r.subtitle;}};
17
17
 
18
- var dr$2=v$1(dt=>{Object.defineProperty(dt,`__esModule`,{value:true});dt.URLBuilder=void 0;dt.URLBuilder=(function(){function r(t){try{this.base=new URL(t),this.params=new URLSearchParams(this.base.search.slice(1));}catch(i){console.error(`Un-parsable URL`,i);}}return r.prototype.appendQueryParam=function(t,i){this.params.append(t,i?i.toString():``);},r.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},r.prototype.deleteQueryParam=function(t){this.params.delete(t);},r.prototype.getBase=function(){return this.base},r.prototype.getPath=function(){return this.base.pathname},r.prototype.getHostname=function(){return this.base.hostname},r.prototype.getParams=function(){return this.params},r.prototype.getQueryParam=function(t){if(!this.params)return ``;var i=this.params.get(t);return !i||i===`undefined`||i===`null`?void 0:i},r.prototype.getQueryString=function(){return this.params.toString()},r.prototype.setPath=function(t){return this.base.pathname=t,this},r.prototype.setQueryParam=function(t,i){return this.params.set(t,i?i.toString():``),this},r.prototype.setQueryString=function(t){if(t)return t[0]===`?`&&(t=t.slice(1)),this.params=new URLSearchParams(t),this},r.prototype.toString=function(){var t=this.params.toString();return t===``?this.base.search=``:this.base.search=`?`+t,this.base.toString()},r})();});var mt$1=class mt{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 Mr$1(r,t){return t={exports:{}},r(t,t.exports),t.exports}var jr$1=Yr$2,$r$2=Hr$2,Pr$1=Zr$2,X$2=[],H$3=[],Cr$1=typeof Uint8Array<`u`?Uint8Array:Array,Rt$1=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;for(K$2=0,kt$1=Rt$1.length;K$2<kt$1;++K$2)X$2[K$2]=Rt$1[K$2],H$3[Rt$1.charCodeAt(K$2)]=K$2;var K$2,kt$1;H$3[45]=62;H$3[95]=63;function pr$2(r){var t=r.length;if(t%4>0)throw new Error(`Invalid string. Length must be a multiple of 4`);var i=r.indexOf(`=`);i===-1&&(i=t);var f=i===t?0:4-i%4;return [i,f]}function Yr$2(r){var t=pr$2(r),i=t[0],f=t[1];return (i+f)*3/4-f}function Jr$2(r,t,i){return (t+i)*3/4-i}function Hr$2(r){var t,i=pr$2(r),f=i[0],c=i[1],h=new Cr$1(Jr$2(r,f,c)),a=0,p=c>0?f-4:f,y;for(y=0;y<p;y+=4)t=H$3[r.charCodeAt(y)]<<18|H$3[r.charCodeAt(y+1)]<<12|H$3[r.charCodeAt(y+2)]<<6|H$3[r.charCodeAt(y+3)],h[a++]=t>>16&255,h[a++]=t>>8&255,h[a++]=t&255;return c===2&&(t=H$3[r.charCodeAt(y)]<<2|H$3[r.charCodeAt(y+1)]>>4,h[a++]=t&255),c===1&&(t=H$3[r.charCodeAt(y)]<<10|H$3[r.charCodeAt(y+1)]<<4|H$3[r.charCodeAt(y+2)]>>2,h[a++]=t>>8&255,h[a++]=t&255),h}function Vr$2(r){return X$2[r>>18&63]+X$2[r>>12&63]+X$2[r>>6&63]+X$2[r&63]}function Wr$2(r,t,i){for(var f,c=[],h=t;h<i;h+=3)f=(r[h]<<16&16711680)+(r[h+1]<<8&65280)+(r[h+2]&255),c.push(Vr$2(f));return c.join(``)}function Zr$2(r){for(var t,i=r.length,f=i%3,c=[],h=16383,a=0,p=i-f;a<p;a+=h)c.push(Wr$2(r,a,a+h>p?p:a+h));return f===1?(t=r[i-1],c.push(X$2[t>>2]+X$2[t<<4&63]+`==`)):f===2&&(t=(r[i-2]<<8)+r[i-1],c.push(X$2[t>>10]+X$2[t>>4&63]+X$2[t<<2&63]+`=`)),c.join(``)}var Lt$1={byteLength:jr$1,toByteArray:$r$2,fromByteArray:Pr$1};var zr$2=function(t,i,f,c,h){var a,p,y=h*8-c-1,v=(1<<y)-1,m=v>>1,w=-7,_=f?h-1:0,O=f?-1:1,S=t[i+_];for(_+=O,a=S&(1<<-w)-1,S>>=-w,w+=y;w>0;a=a*256+t[i+_],_+=O,w-=8);for(p=a&(1<<-w)-1,a>>=-w,w+=c;w>0;p=p*256+t[i+_],_+=O,w-=8);if(a===0)a=1-m;else {if(a===v)return p?NaN:(S?-1:1)*Infinity;p=p+Math.pow(2,c),a=a-m;}return (S?-1:1)*p*Math.pow(2,a-c)},Xr$2=function(t,i,f,c,h,a){var p,y,v,m=a*8-h-1,w=(1<<m)-1,_=w>>1,O=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=c?0:a-1,d=c?1:-1,M=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===Infinity?(y=isNaN(i)?1:0,p=w):(p=Math.floor(Math.log(i)/Math.LN2),i*(v=Math.pow(2,-p))<1&&(p--,v*=2),p+_>=1?i+=O/v:i+=O*Math.pow(2,1-_),i*v>=2&&(p++,v/=2),p+_>=w?(y=0,p=w):p+_>=1?(y=(i*v-1)*Math.pow(2,h),p=p+_):(y=i*Math.pow(2,_-1)*Math.pow(2,h),p=0));h>=8;t[f+S]=y&255,S+=d,y/=256,h-=8);for(p=p<<h|y,m+=h;m>0;t[f+S]=p&255,S+=d,p/=256,m-=8);t[f+S-d]|=M*128;},ot$1={read:zr$2,write:Xr$2},Et$1=Mr$1(function(r,t){var i=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;t.Buffer=a,t.SlowBuffer=D,t.INSPECT_MAX_BYTES=50;var f=2147483647;t.kMaxLength=f,a.TYPED_ARRAY_SUPPORT=c(),!a.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 c(){try{var o=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(o,e),o.foo()===42}catch{return false}}Object.defineProperty(a.prototype,`parent`,{enumerable:true,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,`offset`,{enumerable:true,get:function(){if(a.isBuffer(this))return this.byteOffset}});function h(o){if(o>f)throw new RangeError(`The value "`+o+`" is invalid for option "size"`);var e=new Uint8Array(o);return Object.setPrototypeOf(e,a.prototype),e}function a(o,e,n){if(typeof o==`number`){if(typeof e==`string`)throw new TypeError(`The "string" argument must be of type string. Received type number`);return m(o)}return p(o,e,n)}a.poolSize=8192;function p(o,e,n){if(typeof o==`string`)return w(o,e);if(ArrayBuffer.isView(o))return O(o);if(o==null)throw new TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+babelHelpers.typeof(o));if(Z(o,ArrayBuffer)||o&&Z(o.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(Z(o,SharedArrayBuffer)||o&&Z(o.buffer,SharedArrayBuffer)))return S(o,e,n);if(typeof o==`number`)throw new TypeError(`The "value" argument must not be of type number. Received type number`);var s=o.valueOf&&o.valueOf();if(s!=null&&s!==o)return a.from(s,e,n);var u=d(o);if(u)return u;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof o[Symbol.toPrimitive]==`function`)return a.from(o[Symbol.toPrimitive](`string`),e,n);throw new TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+babelHelpers.typeof(o))}a.from=function(o,e,n){return p(o,e,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function y(o){if(typeof o!=`number`)throw new TypeError(`"size" argument must be of type number`);if(o<0)throw new RangeError(`The value "`+o+`" is invalid for option "size"`)}function v(o,e,n){return y(o),o<=0?h(o):e!==void 0?typeof n==`string`?h(o).fill(e,n):h(o).fill(e):h(o)}a.alloc=function(o,e,n){return v(o,e,n)};function m(o){return y(o),h(o<0?0:M(o)|0)}a.allocUnsafe=function(o){return m(o)},a.allocUnsafeSlow=function(o){return m(o)};function w(o,e){if((typeof e!=`string`||e===``)&&(e=`utf8`),!a.isEncoding(e))throw new TypeError(`Unknown encoding: `+e);var n=F(o,e)|0,s=h(n),u=s.write(o,e);return u!==n&&(s=s.slice(0,u)),s}function _(o){for(var e=o.length<0?0:M(o.length)|0,n=h(e),s=0;s<e;s+=1)n[s]=o[s]&255;return n}function O(o){if(Z(o,Uint8Array)){var e=new Uint8Array(o);return S(e.buffer,e.byteOffset,e.byteLength)}return _(o)}function S(o,e,n){if(e<0||o.byteLength<e)throw new RangeError(`"offset" is outside of buffer bounds`);if(o.byteLength<e+(n||0))throw new RangeError(`"length" is outside of buffer bounds`);var s;return e===void 0&&n===void 0?s=new Uint8Array(o):n===void 0?s=new Uint8Array(o,e):s=new Uint8Array(o,e,n),Object.setPrototypeOf(s,a.prototype),s}function d(o){if(a.isBuffer(o)){var e=M(o.length)|0,n=h(e);return n.length===0||o.copy(n,0,0,e),n}if(o.length!==void 0)return typeof o.length!=`number`||Ut(o.length)?h(0):_(o);if(o.type===`Buffer`&&Array.isArray(o.data))return _(o.data)}function M(o){if(o>=f)throw new RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+f.toString(16)+` bytes`);return o|0}function D(o){return +o!=o&&(o=0),a.alloc(+o)}a.isBuffer=function(e){return e!=null&&e._isBuffer===true&&e!==a.prototype},a.compare=function(e,n){if(Z(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),Z(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),!a.isBuffer(e)||!a.isBuffer(n))throw new TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===n)return 0;for(var s=e.length,u=n.length,l=0,g=Math.min(s,u);l<g;++l)if(e[l]!==n[l]){s=e[l],u=n[l];break}return s<u?-1:u<s?1:0},a.isEncoding=function(e){switch(String(e).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 true;default:return false}},a.concat=function(e,n){if(!Array.isArray(e))throw new TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return a.alloc(0);var s;if(n===void 0)for(n=0,s=0;s<e.length;++s)n+=e[s].length;var u=a.allocUnsafe(n),l=0;for(s=0;s<e.length;++s){var g=e[s];if(Z(g,Uint8Array))l+g.length>u.length?a.from(g).copy(u,l):Uint8Array.prototype.set.call(u,g,l);else if(a.isBuffer(g))g.copy(u,l);else throw new TypeError(`"list" argument must be an Array of Buffers`);l+=g.length;}return u};function F(o,e){if(a.isBuffer(o))return o.length;if(ArrayBuffer.isView(o)||Z(o,ArrayBuffer))return o.byteLength;if(typeof o!=`string`)throw new TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+babelHelpers.typeof(o));var n=o.length,s=arguments.length>2&&arguments[2]===true;if(!s&&n===0)return 0;for(var u=false;;)switch(e){case `ascii`:case `latin1`:case `binary`:return n;case `utf8`:case `utf-8`:return xt(o).length;case `ucs2`:case `ucs-2`:case `utf16le`:case `utf-16le`:return n*2;case `hex`:return n>>>1;case `base64`:return Xt(o).length;default:if(u)return s?-1:xt(o).length;e=(``+e).toLowerCase(),u=true;}}a.byteLength=F;function P(o,e,n){var s=false;if((e===void 0||e<0)&&(e=0),e>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,e>>>=0,n<=e))return ``;for(o||(o=`utf8`);;)switch(o){case `hex`:return V(this,e,n);case `utf8`:case `utf-8`:return nt(this,e,n);case `ascii`:return it(this,e,n);case `latin1`:case `binary`:return T(this,e,n);case `base64`:return et(this,e,n);case `ucs2`:case `ucs-2`:case `utf16le`:case `utf-16le`:return b(this,e,n);default:if(s)throw new TypeError(`Unknown encoding: `+o);o=(o+``).toLowerCase(),s=true;}}a.prototype._isBuffer=true;function B(o,e,n){var s=o[e];o[e]=o[n],o[n]=s;}a.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError(`Buffer size must be a multiple of 16-bits`);for(var n=0;n<e;n+=2)B(this,n,n+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError(`Buffer size must be a multiple of 32-bits`);for(var n=0;n<e;n+=4)B(this,n,n+3),B(this,n+1,n+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError(`Buffer size must be a multiple of 64-bits`);for(var n=0;n<e;n+=8)B(this,n,n+7),B(this,n+1,n+6),B(this,n+2,n+5),B(this,n+3,n+4);return this},a.prototype.toString=function(){var e=this.length;return e===0?``:arguments.length===0?nt(this,0,e):P.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError(`Argument must be a Buffer`);return this===e?true:a.compare(this,e)===0},a.prototype.inspect=function(){var e=``,n=t.INSPECT_MAX_BYTES;return e=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(e+=` ... `),`<Buffer `+e+`>`},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(e,n,s,u,l){if(Z(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+babelHelpers.typeof(e));if(n===void 0&&(n=0),s===void 0&&(s=e?e.length:0),u===void 0&&(u=0),l===void 0&&(l=this.length),n<0||s>e.length||u<0||l>this.length)throw new RangeError(`out of range index`);if(u>=l&&n>=s)return 0;if(u>=l)return -1;if(n>=s)return 1;if(n>>>=0,s>>>=0,u>>>=0,l>>>=0,this===e)return 0;for(var g=l-u,I=s-n,x=Math.min(g,I),U=this.slice(u,l),j=e.slice(n,s),R=0;R<x;++R)if(U[R]!==j[R]){g=U[R],I=j[R];break}return g<I?-1:I<g?1:0};function Y(o,e,n,s,u){if(o.length===0)return -1;if(typeof n==`string`?(s=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ut(n)&&(n=u?0:o.length-1),n<0&&(n=o.length+n),n>=o.length){if(u)return -1;n=o.length-1;}else if(n<0)if(u)n=0;else return -1;if(typeof e==`string`&&(e=a.from(e,s)),a.isBuffer(e))return e.length===0?-1:W(o,e,n,s,u);if(typeof e==`number`)return e=e&255,typeof Uint8Array.prototype.indexOf==`function`?u?Uint8Array.prototype.indexOf.call(o,e,n):Uint8Array.prototype.lastIndexOf.call(o,e,n):W(o,[e],n,s,u);throw new TypeError(`val must be string, number or Buffer`)}function W(o,e,n,s,u){var l=1,g=o.length,I=e.length;if(s!==void 0&&(s=String(s).toLowerCase(),s===`ucs2`||s===`ucs-2`||s===`utf16le`||s===`utf-16le`)){if(o.length<2||e.length<2)return -1;l=2,g/=2,I/=2,n/=2;}function x(qt,Gt){return l===1?qt[Gt]:qt.readUInt16BE(Gt*l)}var U;if(u){var j=-1;for(U=n;U<g;U++)if(x(o,U)===x(e,j===-1?0:U-j)){if(j===-1&&(j=U),U-j+1===I)return j*l}else j!==-1&&(U-=U-j),j=-1;}else for(n+I>g&&(n=g-I),U=n;U>=0;U--){for(var R=true,wt=0;wt<I;wt++)if(x(o,U+wt)!==x(e,wt)){R=false;break}if(R)return U}return -1}a.prototype.includes=function(e,n,s){return this.indexOf(e,n,s)!==-1},a.prototype.indexOf=function(e,n,s){return Y(this,e,n,s,true)},a.prototype.lastIndexOf=function(e,n,s){return Y(this,e,n,s,false)};function q(o,e,n,s){n=Number(n)||0;var u=o.length-n;s?(s=Number(s),s>u&&(s=u)):s=u;var l=e.length;s>l/2&&(s=l/2);for(var g=0;g<s;++g){var I=parseInt(e.substr(g*2,2),16);if(Ut(I))return g;o[n+g]=I;}return g}function bt(o,e,n,s){return yt(xt(e,o.length-n),o,n,s)}function at(o,e,n,s){return yt(Tr(e),o,n,s)}function At(o,e,n,s){return yt(Xt(e),o,n,s)}function pt(o,e,n,s){return yt(Rr(e,o.length-n),o,n,s)}a.prototype.write=function(e,n,s,u){if(n===void 0)u=`utf8`,s=this.length,n=0;else if(s===void 0&&typeof n==`string`)u=n,s=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(s)?(s=s>>>0,u===void 0&&(u=`utf8`)):(u=s,s=void 0);else throw new Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);var l=this.length-n;if((s===void 0||s>l)&&(s=l),e.length>0&&(s<0||n<0)||n>this.length)throw new RangeError(`Attempt to write outside buffer bounds`);u||(u=`utf8`);for(var g=false;;)switch(u){case `hex`:return q(this,e,n,s);case `utf8`:case `utf-8`:return bt(this,e,n,s);case `ascii`:case `latin1`:case `binary`:return at(this,e,n,s);case `base64`:return At(this,e,n,s);case `ucs2`:case `ucs-2`:case `utf16le`:case `utf-16le`:return pt(this,e,n,s);default:if(g)throw new TypeError(`Unknown encoding: `+u);u=(``+u).toLowerCase(),g=true;}},a.prototype.toJSON=function(){return {type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function et(o,e,n){return e===0&&n===o.length?Lt$1.fromByteArray(o):Lt$1.fromByteArray(o.slice(e,n))}function nt(o,e,n){n=Math.min(o.length,n);for(var s=[],u=e;u<n;){var l=o[u],g=null,I=l>239?4:l>223?3:l>191?2:1;if(u+I<=n){var x,U,j,R;switch(I){case 1:l<128&&(g=l);break;case 2:x=o[u+1],(x&192)===128&&(R=(l&31)<<6|x&63,R>127&&(g=R));break;case 3:x=o[u+1],U=o[u+2],(x&192)===128&&(U&192)===128&&(R=(l&15)<<12|(x&63)<<6|U&63,R>2047&&(R<55296||R>57343)&&(g=R));break;case 4:x=o[u+1],U=o[u+2],j=o[u+3],(x&192)===128&&(U&192)===128&&(j&192)===128&&(R=(l&15)<<18|(x&63)<<12|(U&63)<<6|j&63,R>65535&&R<1114112&&(g=R));}}g===null?(g=65533,I=1):g>65535&&(g-=65536,s.push(g>>>10&1023|55296),g=56320|g&1023),s.push(g),u+=I;}return gt(s)}var G=4096;function gt(o){var e=o.length;if(e<=G)return String.fromCharCode.apply(String,o);for(var n=``,s=0;s<e;)n+=String.fromCharCode.apply(String,o.slice(s,s+=G));return n}function it(o,e,n){var s=``;n=Math.min(o.length,n);for(var u=e;u<n;++u)s+=String.fromCharCode(o[u]&127);return s}function T(o,e,n){var s=``;n=Math.min(o.length,n);for(var u=e;u<n;++u)s+=String.fromCharCode(o[u]);return s}function V(o,e,n){var s=o.length;(!e||e<0)&&(e=0),(!n||n<0||n>s)&&(n=s);for(var u=``,l=e;l<n;++l)u+=Lr[o[l]];return u}function b(o,e,n){for(var s=o.slice(e,n),u=``,l=0;l<s.length-1;l+=2)u+=String.fromCharCode(s[l]+s[l+1]*256);return u}a.prototype.slice=function(e,n){var s=this.length;e=~~e,n=n===void 0?s:~~n,e<0?(e+=s,e<0&&(e=0)):e>s&&(e=s),n<0?(n+=s,n<0&&(n=0)):n>s&&(n=s),n<e&&(n=e);var u=this.subarray(e,n);return Object.setPrototypeOf(u,a.prototype),u};function N(o,e,n){if(o%1!==0||o<0)throw new RangeError(`offset is not uint`);if(o+e>n)throw new RangeError(`Trying to access beyond buffer length`)}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,n,s){e=e>>>0,n=n>>>0,s||N(e,n,this.length);for(var u=this[e],l=1,g=0;++g<n&&(l*=256);)u+=this[e+g]*l;return u},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,n,s){e=e>>>0,n=n>>>0,s||N(e,n,this.length);for(var u=this[e+--n],l=1;n>0&&(l*=256);)u+=this[e+--n]*l;return u},a.prototype.readUint8=a.prototype.readUInt8=function(e,n){return e=e>>>0,n||N(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,n){return e=e>>>0,n||N(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,n){return e=e>>>0,n||N(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,n){return e=e>>>0,n||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,n){return e=e>>>0,n||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,n,s){e=e>>>0,n=n>>>0,s||N(e,n,this.length);for(var u=this[e],l=1,g=0;++g<n&&(l*=256);)u+=this[e+g]*l;return l*=128,u>=l&&(u-=Math.pow(2,8*n)),u},a.prototype.readIntBE=function(e,n,s){e=e>>>0,n=n>>>0,s||N(e,n,this.length);for(var u=n,l=1,g=this[e+--u];u>0&&(l*=256);)g+=this[e+--u]*l;return l*=128,g>=l&&(g-=Math.pow(2,8*n)),g},a.prototype.readInt8=function(e,n){return e=e>>>0,n||N(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,n){e=e>>>0,n||N(e,2,this.length);var s=this[e]|this[e+1]<<8;return s&32768?s|4294901760:s},a.prototype.readInt16BE=function(e,n){e=e>>>0,n||N(e,2,this.length);var s=this[e+1]|this[e]<<8;return s&32768?s|4294901760:s},a.prototype.readInt32LE=function(e,n){return e=e>>>0,n||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,n){return e=e>>>0,n||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,n){return e=e>>>0,n||N(e,4,this.length),ot$1.read(this,e,true,23,4)},a.prototype.readFloatBE=function(e,n){return e=e>>>0,n||N(e,4,this.length),ot$1.read(this,e,false,23,4)},a.prototype.readDoubleLE=function(e,n){return e=e>>>0,n||N(e,8,this.length),ot$1.read(this,e,true,52,8)},a.prototype.readDoubleBE=function(e,n){return e=e>>>0,n||N(e,8,this.length),ot$1.read(this,e,false,52,8)};function C(o,e,n,s,u,l){if(!a.isBuffer(o))throw new TypeError(`"buffer" argument must be a Buffer instance`);if(e>u||e<l)throw new RangeError(`"value" argument is out of bounds`);if(n+s>o.length)throw new RangeError(`Index out of range`)}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,n,s,u){if(e=+e,n=n>>>0,s=s>>>0,!u){var l=Math.pow(2,8*s)-1;C(this,e,n,s,l,0);}var g=1,I=0;for(this[n]=e&255;++I<s&&(g*=256);)this[n+I]=e/g&255;return n+s},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,n,s,u){if(e=+e,n=n>>>0,s=s>>>0,!u){var l=Math.pow(2,8*s)-1;C(this,e,n,s,l,0);}var g=s-1,I=1;for(this[n+g]=e&255;--g>=0&&(I*=256);)this[n+g]=e/I&255;return n+s},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,1,255,0),this[n]=e&255,n+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,2,65535,0),this[n]=e&255,this[n+1]=e>>>8,n+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,2,65535,0),this[n]=e>>>8,this[n+1]=e&255,n+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,4,4294967295,0),this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=e&255,n+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,4,4294967295,0),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4},a.prototype.writeIntLE=function(e,n,s,u){if(e=+e,n=n>>>0,!u){var l=Math.pow(2,8*s-1);C(this,e,n,s,l-1,-l);}var g=0,I=1,x=0;for(this[n]=e&255;++g<s&&(I*=256);)e<0&&x===0&&this[n+g-1]!==0&&(x=1),this[n+g]=(e/I>>0)-x&255;return n+s},a.prototype.writeIntBE=function(e,n,s,u){if(e=+e,n=n>>>0,!u){var l=Math.pow(2,8*s-1);C(this,e,n,s,l-1,-l);}var g=s-1,I=1,x=0;for(this[n+g]=e&255;--g>=0&&(I*=256);)e<0&&x===0&&this[n+g+1]!==0&&(x=1),this[n+g]=(e/I>>0)-x&255;return n+s},a.prototype.writeInt8=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,1,127,-128),e<0&&(e=255+e+1),this[n]=e&255,n+1},a.prototype.writeInt16LE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,2,32767,-32768),this[n]=e&255,this[n+1]=e>>>8,n+2},a.prototype.writeInt16BE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,2,32767,-32768),this[n]=e>>>8,this[n+1]=e&255,n+2},a.prototype.writeInt32LE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,4,2147483647,-2147483648),this[n]=e&255,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24,n+4},a.prototype.writeInt32BE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};function Wt(o,e,n,s,u,l){if(n+s>o.length)throw new RangeError(`Index out of range`);if(n<0)throw new RangeError(`Index out of range`)}function Zt(o,e,n,s,u){return e=+e,n=n>>>0,u||Wt(o,e,n,4),ot$1.write(o,e,n,s,23,4),n+4}a.prototype.writeFloatLE=function(e,n,s){return Zt(this,e,n,true,s)},a.prototype.writeFloatBE=function(e,n,s){return Zt(this,e,n,false,s)};function zt(o,e,n,s,u){return e=+e,n=n>>>0,u||Wt(o,e,n,8),ot$1.write(o,e,n,s,52,8),n+8}a.prototype.writeDoubleLE=function(e,n,s){return zt(this,e,n,true,s)},a.prototype.writeDoubleBE=function(e,n,s){return zt(this,e,n,false,s)},a.prototype.copy=function(e,n,s,u){if(!a.isBuffer(e))throw new TypeError(`argument should be a Buffer`);if(s||(s=0),!u&&u!==0&&(u=this.length),n>=e.length&&(n=e.length),n||(n=0),u>0&&u<s&&(u=s),u===s||e.length===0||this.length===0)return 0;if(n<0)throw new RangeError(`targetStart out of bounds`);if(s<0||s>=this.length)throw new RangeError(`Index out of range`);if(u<0)throw new RangeError(`sourceEnd out of bounds`);u>this.length&&(u=this.length),e.length-n<u-s&&(u=e.length-n+s);var l=u-s;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(n,s,u):Uint8Array.prototype.set.call(e,this.subarray(s,u),n),l},a.prototype.fill=function(e,n,s,u){if(typeof e==`string`){if(typeof n==`string`?(u=n,n=0,s=this.length):typeof s==`string`&&(u=s,s=this.length),u!==void 0&&typeof u!=`string`)throw new TypeError(`encoding must be a string`);if(typeof u==`string`&&!a.isEncoding(u))throw new TypeError(`Unknown encoding: `+u);if(e.length===1){var l=e.charCodeAt(0);(u===`utf8`&&l<128||u===`latin1`)&&(e=l);}}else typeof e==`number`?e=e&255:typeof e==`boolean`&&(e=Number(e));if(n<0||this.length<n||this.length<s)throw new RangeError(`Out of range index`);if(s<=n)return this;n=n>>>0,s=s===void 0?this.length:s>>>0,e||(e=0);var g;if(typeof e==`number`)for(g=n;g<s;++g)this[g]=e;else {var I=a.isBuffer(e)?e:a.from(e,u),x=I.length;if(x===0)throw new TypeError(`The value "`+e+`" is invalid for argument "value"`);for(g=0;g<s-n;++g)this[g+n]=I[g%x];}return this};var xr=/[^+/0-9A-Za-z-_]/g;function Ur(o){if(o=o.split(`=`)[0],o=o.trim().replace(xr,``),o.length<2)return ``;for(;o.length%4!==0;)o=o+`=`;return o}function xt(o,e){e=e||Infinity;for(var n,s=o.length,u=null,l=[],g=0;g<s;++g){if(n=o.charCodeAt(g),n>55295&&n<57344){if(!u){if(n>56319){(e-=3)>-1&&l.push(239,191,189);continue}else if(g+1===s){(e-=3)>-1&&l.push(239,191,189);continue}u=n;continue}if(n<56320){(e-=3)>-1&&l.push(239,191,189),u=n;continue}n=(u-55296<<10|n-56320)+65536;}else u&&(e-=3)>-1&&l.push(239,191,189);if(u=null,n<128){if((e-=1)<0)break;l.push(n);}else if(n<2048){if((e-=2)<0)break;l.push(n>>6|192,n&63|128);}else if(n<65536){if((e-=3)<0)break;l.push(n>>12|224,n>>6&63|128,n&63|128);}else if(n<1114112){if((e-=4)<0)break;l.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128);}else throw new Error(`Invalid code point`)}return l}function Tr(o){for(var e=[],n=0;n<o.length;++n)e.push(o.charCodeAt(n)&255);return e}function Rr(o,e){for(var n,s,u,l=[],g=0;g<o.length&&!((e-=2)<0);++g)n=o.charCodeAt(g),s=n>>8,u=n%256,l.push(u),l.push(s);return l}function Xt(o){return Lt$1.toByteArray(Ur(o))}function yt(o,e,n,s){for(var u=0;u<s&&!(u+n>=e.length||u>=o.length);++u)e[u+n]=o[u];return u}function Z(o,e){return o instanceof e||o!=null&&o.constructor!=null&&o.constructor.name!=null&&o.constructor.name===e.name}function Ut(o){return o!==o}var Lr=(function(){for(var o=`0123456789abcdef`,e=new Array(256),n=0;n<16;++n)for(var s=n*16,u=0;u<16;++u)e[s+u]=o[n]+o[u];return e})();}),A$1=Et$1.Buffer;Et$1.SlowBuffer;Et$1.INSPECT_MAX_BYTES;Et$1.kMaxLength;var $t$1=function(t,i){return $t$1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,c){f.__proto__=c;}||function(f,c){for(var h in c)c.hasOwnProperty(h)&&(f[h]=c[h]);},$t$1(t,i)};function Bt$1(r,t){$t$1(r,t);function i(){this.constructor=r;}r.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i);}var tt=(function(r){Bt$1(t,r);function t(i){var f=r.call(this,i)||this;return Object.setPrototypeOf(f,t.prototype),f}return Object.defineProperty(t.prototype,`name`,{get:function(){return `BSONError`},enumerable:false,configurable:true}),t})(Error),L$2=(function(r){Bt$1(t,r);function t(i){var f=r.call(this,i)||this;return Object.setPrototypeOf(f,t.prototype),f}return Object.defineProperty(t.prototype,`name`,{get:function(){return `BSONTypeError`},enumerable:false,configurable:true}),t})(TypeError);function _t$1(r){return r&&r.Math==Math&&r}function gr$2(){return _t$1(typeof globalThis==`object`&&globalThis)||_t$1(typeof window==`object`&&window)||_t$1(typeof self==`object`&&self)||_t$1(typeof global==`object`&&global)||Function(`return this`)()}function qr$2(){var r=gr$2();return typeof r.navigator==`object`&&r.navigator.product===`ReactNative`}var Gr$2=function(t){var i=qr$2()?`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(i);for(var f=A$1.alloc(t),c=0;c<t;++c)f[c]=Math.floor(Math.random()*256);return f},kr$1=function(){if(typeof window<`u`){var r=window.crypto||window.msCrypto;if(r&&r.getRandomValues)return function(t){return r.getRandomValues(A$1.alloc(t))}}return typeof global<`u`&&global.crypto&&global.crypto.getRandomValues?function(t){return global.crypto.getRandomValues(A$1.alloc(t))}:Gr$2},yr$1=kr$1();function Kr$2(r){return [`[object ArrayBuffer]`,`[object SharedArrayBuffer]`].includes(Object.prototype.toString.call(r))}function Ct(r){return Object.prototype.toString.call(r)===`[object Uint8Array]`}function Qr$2(r){return Object.prototype.toString.call(r)===`[object RegExp]`}function te$1(r){return lt$1(r)&&Object.prototype.toString.call(r)===`[object Date]`}function lt$1(r){return typeof r==`object`&&r!==null}function St$1(r,t){var i=false;function f(){for(var c=[],h=0;h<arguments.length;h++)c[h]=arguments[h];return i||(console.warn(t),i=true),r.apply(this,c)}return f}function vt(r){if(ArrayBuffer.isView(r))return A$1.from(r.buffer,r.byteOffset,r.byteLength);if(Kr$2(r))return A$1.from(r);throw new L$2(`Must use either Buffer or TypedArray`)}var re$2=/^(?:[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,wr$2=function(r){return typeof r==`string`&&re$2.test(r)},Pt$1=function(r){if(!wr$2(r))throw new L$2(`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=r.replace(/-/g,``);return A$1.from(t,`hex`)},Kt$1=function(r,t){return t===void 0&&(t=true),t?r.toString(`hex`,0,4)+`-`+r.toString(`hex`,4,6)+`-`+r.toString(`hex`,6,8)+`-`+r.toString(`hex`,8,10)+`-`+r.toString(`hex`,10,16):r.toString(`hex`)};var ee$2=Math.pow(2,53),ne=-Math.pow(2,53);var mr$2=4;var rt=(function(){function r(t,i){if(!(this instanceof r))return new r(t,i);if(t!=null&&typeof t!=`string`&&!ArrayBuffer.isView(t)&&!(t instanceof ArrayBuffer)&&!Array.isArray(t))throw new L$2(`Binary can only be constructed from string, Buffer, TypedArray, or Array<number>`);this.sub_type=i??r.BSON_BINARY_SUBTYPE_DEFAULT,t==null?(this.buffer=A$1.alloc(r.BUFFER_SIZE),this.position=0):(typeof t==`string`?this.buffer=A$1.from(t,`binary`):Array.isArray(t)?this.buffer=A$1.from(t):this.buffer=vt(t),this.position=this.buffer.byteLength);}return r.prototype.put=function(t){if(typeof t==`string`&&t.length!==1)throw new L$2(`only accepts single character String`);if(typeof t!=`number`&&t.length!==1)throw new L$2(`only accepts single character Uint8Array or Array`);var i;if(typeof t==`string`?i=t.charCodeAt(0):typeof t==`number`?i=t:i=t[0],i<0||i>255)throw new L$2(`only accepts number in a valid unsigned byte range 0-255`);if(this.buffer.length>this.position)this.buffer[this.position++]=i;else {var f=A$1.alloc(r.BUFFER_SIZE+this.buffer.length);this.buffer.copy(f,0,0,this.buffer.length),this.buffer=f,this.buffer[this.position++]=i;}},r.prototype.write=function(t,i){if(i=typeof i==`number`?i:this.position,this.buffer.length<i+t.length){var f=A$1.alloc(this.buffer.length+t.length);this.buffer.copy(f,0,0,this.buffer.length),this.buffer=f;}ArrayBuffer.isView(t)?(this.buffer.set(vt(t),i),this.position=i+t.byteLength>this.position?i+t.length:this.position):typeof t==`string`&&(this.buffer.write(t,i,t.length,`binary`),this.position=i+t.length>this.position?i+t.length:this.position);},r.prototype.read=function(t,i){return i=i&&i>0?i:this.position,this.buffer.slice(t,t+i)},r.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)},r.prototype.length=function(){return this.position},r.prototype.toJSON=function(){return this.buffer.toString(`base64`)},r.prototype.toString=function(t){return this.buffer.toString(t)},r.prototype.toExtendedJSON=function(t){t=t||{};var i=this.buffer.toString(`base64`),f=Number(this.sub_type).toString(16);return t.legacy?{$binary:i,$type:f.length===1?`0`+f:f}:{$binary:{base64:i,subType:f.length===1?`0`+f:f}}},r.prototype.toUUID=function(){if(this.sub_type===r.SUBTYPE_UUID)return new Qt$1(this.buffer.slice(0,this.position));throw new tt(`Binary sub_type "`.concat(this.sub_type,`" is not supported for converting to UUID. Only "`).concat(r.SUBTYPE_UUID,`" is currently supported.`))},r.fromExtendedJSON=function(t,i){i=i||{};var f,c;if(`$binary`in t?i.legacy&&typeof t.$binary==`string`&&`$type`in t?(c=t.$type?parseInt(t.$type,16):0,f=A$1.from(t.$binary,`base64`)):typeof t.$binary!=`string`&&(c=t.$binary.subType?parseInt(t.$binary.subType,16):0,f=A$1.from(t.$binary.base64,`base64`)):`$uuid`in t&&(c=4,f=Pt$1(t.$uuid)),!f)throw new L$2(`Unexpected Binary Extended JSON format `.concat(JSON.stringify(t)));return c===mr$2?new Qt$1(f):new r(f,c)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){var t=this.value(true);return `new Binary(Buffer.from("`.concat(t.toString(`hex`),`", "hex"), `).concat(this.sub_type,`)`)},r.BSON_BINARY_SUBTYPE_DEFAULT=0,r.BUFFER_SIZE=256,r.SUBTYPE_DEFAULT=0,r.SUBTYPE_FUNCTION=1,r.SUBTYPE_BYTE_ARRAY=2,r.SUBTYPE_UUID_OLD=3,r.SUBTYPE_UUID=4,r.SUBTYPE_MD5=5,r.SUBTYPE_ENCRYPTED=6,r.SUBTYPE_COLUMN=7,r.SUBTYPE_USER_DEFINED=128,r})();Object.defineProperty(rt.prototype,`_bsontype`,{value:`Binary`});var Dt$1=16,Qt$1=(function(r){Bt$1(t,r);function t(i){var f=this,c,h;if(i==null)c=t.generate();else if(i instanceof t)c=A$1.from(i.buffer),h=i.__id;else if(ArrayBuffer.isView(i)&&i.byteLength===Dt$1)c=vt(i);else if(typeof i==`string`)c=Pt$1(i);else throw new L$2(`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 f=r.call(this,c,mr$2)||this,f.__id=h,f}return Object.defineProperty(t.prototype,`id`,{get:function(){return this.buffer},set:function(i){this.buffer=i,t.cacheHexString&&(this.__id=Kt$1(i));},enumerable:false,configurable:true}),t.prototype.toHexString=function(i){if(i===void 0&&(i=true),t.cacheHexString&&this.__id)return this.__id;var f=Kt$1(this.id,i);return t.cacheHexString&&(this.__id=f),f},t.prototype.toString=function(i){return i?this.id.toString(i):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(i){if(!i)return false;if(i instanceof t)return i.id.equals(this.id);try{return new t(i).id.equals(this.id)}catch{return false}},t.prototype.toBinary=function(){return new rt(this.id,rt.SUBTYPE_UUID)},t.generate=function(){var i=yr$1(Dt$1);return i[6]=i[6]&15|64,i[8]=i[8]&63|128,A$1.from(i)},t.isValid=function(i){return i?i instanceof t?true:typeof i==`string`?wr$2(i):Ct(i)?i.length!==Dt$1?false:(i[6]&240)===64&&(i[8]&128)===128:false:false},t.createFromHexString=function(i){return new t(Pt$1(i))},t.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},t.prototype.inspect=function(){return `new UUID("`.concat(this.toHexString(),`")`)},t})(rt),Nt$1=(function(){function r(t,i){if(!(this instanceof r))return new r(t,i);this.code=t,this.scope=i;}return r.prototype.toJSON=function(){return {code:this.code,scope:this.scope}},r.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},r.fromExtendedJSON=function(t){return new r(t.$code,t.$scope)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){var t=this.toJSON();return `new Code("`.concat(String(t.code),`"`).concat(t.scope?`, `.concat(JSON.stringify(t.scope)):``,`)`)},r})();Object.defineProperty(Nt$1.prototype,`_bsontype`,{value:`Code`});function ie$2(r){return lt$1(r)&&r.$id!=null&&typeof r.$ref==`string`&&(r.$db==null||typeof r.$db==`string`)}var ht=(function(){function r(t,i,f,c){if(!(this instanceof r))return new r(t,i,f,c);var h=t.split(`.`);h.length===2&&(f=h.shift(),t=h.shift()),this.collection=t,this.oid=i,this.db=f,this.fields=c||{};}return Object.defineProperty(r.prototype,`namespace`,{get:function(){return this.collection},set:function(t){this.collection=t;},enumerable:false,configurable:true}),r.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(t.$db=this.db),t},r.prototype.toExtendedJSON=function(t){t=t||{};var i={$ref:this.collection,$id:this.oid};return t.legacy||(this.db&&(i.$db=this.db),i=Object.assign(i,this.fields)),i},r.fromExtendedJSON=function(t){var i=Object.assign({},t);return delete i.$ref,delete i.$id,delete i.$db,new r(t.$ref,t.$id,t.$db,i)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.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,`"`):``,`)`)},r})();Object.defineProperty(ht.prototype,`_bsontype`,{value:`DBRef`});var J$1=void 0;try{J$1=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 tr$2=65536,oe$2=1<<24,ft=tr$2*tr$2,_r$1=ft*ft,rr$2=_r$1/2,er$2={},nr$2={},E$1=(function(){function r(t,i,f){if(t===void 0&&(t=0),!(this instanceof r))return new r(t,i,f);typeof t==`bigint`?Object.assign(this,r.fromBigInt(t,!!i)):typeof t==`string`?Object.assign(this,r.fromString(t,!!i)):(this.low=t|0,this.high=i|0,this.unsigned=!!f),Object.defineProperty(this,`__isLong__`,{value:true,configurable:false,writable:false,enumerable:false});}return r.fromBits=function(t,i,f){return new r(t,i,f)},r.fromInt=function(t,i){var f,c,h;return i?(t>>>=0,(h=0<=t&&t<256)&&(c=nr$2[t],c)?c:(f=r.fromBits(t,(t|0)<0?-1:0,true),h&&(nr$2[t]=f),f)):(t|=0,(h=-128<=t&&t<128)&&(c=er$2[t],c)?c:(f=r.fromBits(t,t<0?-1:0,false),h&&(er$2[t]=f),f))},r.fromNumber=function(t,i){if(isNaN(t))return i?r.UZERO:r.ZERO;if(i){if(t<0)return r.UZERO;if(t>=_r$1)return r.MAX_UNSIGNED_VALUE}else {if(t<=-rr$2)return r.MIN_VALUE;if(t+1>=rr$2)return r.MAX_VALUE}return t<0?r.fromNumber(-t,i).neg():r.fromBits(t%ft|0,t/ft|0,i)},r.fromBigInt=function(t,i){return r.fromString(t.toString(),i)},r.fromString=function(t,i,f){if(t.length===0)throw Error(`empty string`);if(t===`NaN`||t===`Infinity`||t===`+Infinity`||t===`-Infinity`)return r.ZERO;if(typeof i==`number`?(f=i,i=false):i=!!i,f=f||10,f<2||36<f)throw RangeError(`radix`);var c;if((c=t.indexOf(`-`))>0)throw Error(`interior hyphen`);if(c===0)return r.fromString(t.substring(1),i,f).neg();for(var h=r.fromNumber(Math.pow(f,8)),a=r.ZERO,p=0;p<t.length;p+=8){var y=Math.min(8,t.length-p),v=parseInt(t.substring(p,p+y),f);if(y<8){var m=r.fromNumber(Math.pow(f,y));a=a.mul(m).add(r.fromNumber(v));}else a=a.mul(h),a=a.add(r.fromNumber(v));}return a.unsigned=i,a},r.fromBytes=function(t,i,f){return f?r.fromBytesLE(t,i):r.fromBytesBE(t,i)},r.fromBytesLE=function(t,i){return new r(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,i)},r.fromBytesBE=function(t,i){return new r(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],i)},r.isLong=function(t){return lt$1(t)&&t.__isLong__===true},r.fromValue=function(t,i){return typeof t==`number`?r.fromNumber(t,i):typeof t==`string`?r.fromString(t,i):r.fromBits(t.low,t.high,typeof i==`boolean`?i:t.unsigned)},r.prototype.add=function(t){r.isLong(t)||(t=r.fromValue(t));var i=this.high>>>16,f=this.high&65535,c=this.low>>>16,h=this.low&65535,a=t.high>>>16,p=t.high&65535,y=t.low>>>16,v=t.low&65535,m=0,w=0,_=0,O=0;return O+=h+v,_+=O>>>16,O&=65535,_+=c+y,w+=_>>>16,_&=65535,w+=f+p,m+=w>>>16,w&=65535,m+=i+a,m&=65535,r.fromBits(_<<16|O,m<<16|w,this.unsigned)},r.prototype.and=function(t){return r.isLong(t)||(t=r.fromValue(t)),r.fromBits(this.low&t.low,this.high&t.high,this.unsigned)},r.prototype.compare=function(t){if(r.isLong(t)||(t=r.fromValue(t)),this.eq(t))return 0;var i=this.isNegative(),f=t.isNegative();return i&&!f?-1:!i&&f?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},r.prototype.comp=function(t){return this.compare(t)},r.prototype.divide=function(t){if(r.isLong(t)||(t=r.fromValue(t)),t.isZero())throw Error(`division by zero`);if(J$1){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var i=(this.unsigned?J$1.div_u:J$1.div_s)(this.low,this.high,t.low,t.high);return r.fromBits(i,J$1.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?r.UZERO:r.ZERO;var f,c,h;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return r.UZERO;if(t.gt(this.shru(1)))return r.UONE;h=r.UZERO;}else {if(this.eq(r.MIN_VALUE)){if(t.eq(r.ONE)||t.eq(r.NEG_ONE))return r.MIN_VALUE;if(t.eq(r.MIN_VALUE))return r.ONE;return f=this.shr(1).div(t).shl(1),f.eq(r.ZERO)?t.isNegative()?r.ONE:r.NEG_ONE:(c=this.sub(t.mul(f)),h=f.add(c.div(t)),h)}else if(t.eq(r.MIN_VALUE))return this.unsigned?r.UZERO:r.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();h=r.ZERO;}for(c=this;c.gte(t);){f=Math.max(1,Math.floor(c.toNumber()/t.toNumber()));for(var p=Math.ceil(Math.log(f)/Math.LN2),y=p<=48?1:Math.pow(2,p-48),v=r.fromNumber(f),m=v.mul(t);m.isNegative()||m.gt(c);)f-=y,v=r.fromNumber(f,this.unsigned),m=v.mul(t);v.isZero()&&(v=r.ONE),h=h.add(v),c=c.sub(m);}return h},r.prototype.div=function(t){return this.divide(t)},r.prototype.equals=function(t){return r.isLong(t)||(t=r.fromValue(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?false:this.high===t.high&&this.low===t.low},r.prototype.eq=function(t){return this.equals(t)},r.prototype.getHighBits=function(){return this.high},r.prototype.getHighBitsUnsigned=function(){return this.high>>>0},r.prototype.getLowBits=function(){return this.low},r.prototype.getLowBitsUnsigned=function(){return this.low>>>0},r.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(r.MIN_VALUE)?64:this.neg().getNumBitsAbs();var t=this.high!==0?this.high:this.low,i;for(i=31;i>0&&(t&1<<i)===0;i--);return this.high!==0?i+33:i+1},r.prototype.greaterThan=function(t){return this.comp(t)>0},r.prototype.gt=function(t){return this.greaterThan(t)},r.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},r.prototype.gte=function(t){return this.greaterThanOrEqual(t)},r.prototype.ge=function(t){return this.greaterThanOrEqual(t)},r.prototype.isEven=function(){return (this.low&1)===0},r.prototype.isNegative=function(){return !this.unsigned&&this.high<0},r.prototype.isOdd=function(){return (this.low&1)===1},r.prototype.isPositive=function(){return this.unsigned||this.high>=0},r.prototype.isZero=function(){return this.high===0&&this.low===0},r.prototype.lessThan=function(t){return this.comp(t)<0},r.prototype.lt=function(t){return this.lessThan(t)},r.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},r.prototype.lte=function(t){return this.lessThanOrEqual(t)},r.prototype.modulo=function(t){if(r.isLong(t)||(t=r.fromValue(t)),J$1){var i=(this.unsigned?J$1.rem_u:J$1.rem_s)(this.low,this.high,t.low,t.high);return r.fromBits(i,J$1.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},r.prototype.mod=function(t){return this.modulo(t)},r.prototype.rem=function(t){return this.modulo(t)},r.prototype.multiply=function(t){if(this.isZero())return r.ZERO;if(r.isLong(t)||(t=r.fromValue(t)),J$1){var i=J$1.mul(this.low,this.high,t.low,t.high);return r.fromBits(i,J$1.get_high(),this.unsigned)}if(t.isZero())return r.ZERO;if(this.eq(r.MIN_VALUE))return t.isOdd()?r.MIN_VALUE:r.ZERO;if(t.eq(r.MIN_VALUE))return this.isOdd()?r.MIN_VALUE:r.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(r.TWO_PWR_24)&&t.lt(r.TWO_PWR_24))return r.fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var f=this.high>>>16,c=this.high&65535,h=this.low>>>16,a=this.low&65535,p=t.high>>>16,y=t.high&65535,v=t.low>>>16,m=t.low&65535,w=0,_=0,O=0,S=0;return S+=a*m,O+=S>>>16,S&=65535,O+=h*m,_+=O>>>16,O&=65535,O+=a*v,_+=O>>>16,O&=65535,_+=c*m,w+=_>>>16,_&=65535,_+=h*v,w+=_>>>16,_&=65535,_+=a*y,w+=_>>>16,_&=65535,w+=f*m+c*v+h*y+a*p,w&=65535,r.fromBits(O<<16|S,w<<16|_,this.unsigned)},r.prototype.mul=function(t){return this.multiply(t)},r.prototype.negate=function(){return !this.unsigned&&this.eq(r.MIN_VALUE)?r.MIN_VALUE:this.not().add(r.ONE)},r.prototype.neg=function(){return this.negate()},r.prototype.not=function(){return r.fromBits(~this.low,~this.high,this.unsigned)},r.prototype.notEquals=function(t){return !this.equals(t)},r.prototype.neq=function(t){return this.notEquals(t)},r.prototype.ne=function(t){return this.notEquals(t)},r.prototype.or=function(t){return r.isLong(t)||(t=r.fromValue(t)),r.fromBits(this.low|t.low,this.high|t.high,this.unsigned)},r.prototype.shiftLeft=function(t){return r.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?r.fromBits(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):r.fromBits(0,this.low<<t-32,this.unsigned)},r.prototype.shl=function(t){return this.shiftLeft(t)},r.prototype.shiftRight=function(t){return r.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?r.fromBits(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):r.fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},r.prototype.shr=function(t){return this.shiftRight(t)},r.prototype.shiftRightUnsigned=function(t){if(r.isLong(t)&&(t=t.toInt()),t&=63,t===0)return this;var i=this.high;if(t<32){var f=this.low;return r.fromBits(f>>>t|i<<32-t,i>>>t,this.unsigned)}else return t===32?r.fromBits(i,0,this.unsigned):r.fromBits(i>>>t-32,0,this.unsigned)},r.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},r.prototype.shru=function(t){return this.shiftRightUnsigned(t)},r.prototype.subtract=function(t){return r.isLong(t)||(t=r.fromValue(t)),this.add(t.neg())},r.prototype.sub=function(t){return this.subtract(t)},r.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},r.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*ft+(this.low>>>0):this.high*ft+(this.low>>>0)},r.prototype.toBigInt=function(){return BigInt(this.toString())},r.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},r.prototype.toBytesLE=function(){var t=this.high,i=this.low;return [i&255,i>>>8&255,i>>>16&255,i>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]},r.prototype.toBytesBE=function(){var t=this.high,i=this.low;return [t>>>24,t>>>16&255,t>>>8&255,t&255,i>>>24,i>>>16&255,i>>>8&255,i&255]},r.prototype.toSigned=function(){return this.unsigned?r.fromBits(this.low,this.high,false):this},r.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(r.MIN_VALUE)){var i=r.fromNumber(t),f=this.div(i),c=f.mul(i).sub(this);return f.toString(t)+c.toInt().toString(t)}else return `-`+this.neg().toString(t);for(var h=r.fromNumber(Math.pow(t,6),this.unsigned),a=this,p=``;;){var y=a.div(h),m=(a.sub(y.mul(h)).toInt()>>>0).toString(t);if(a=y,a.isZero())return m+p;for(;m.length<6;)m=`0`+m;p=``+m+p;}},r.prototype.toUnsigned=function(){return this.unsigned?this:r.fromBits(this.low,this.high,true)},r.prototype.xor=function(t){return r.isLong(t)||(t=r.fromValue(t)),r.fromBits(this.low^t.low,this.high^t.high,this.unsigned)},r.prototype.eqz=function(){return this.isZero()},r.prototype.le=function(t){return this.lessThanOrEqual(t)},r.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},r.fromExtendedJSON=function(t,i){var f=r.fromString(t.$numberLong);return i&&i.relaxed?f.toNumber():f},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){return `new Long("`.concat(this.toString(),`"`).concat(this.unsigned?`, true`:``,`)`)},r.TWO_PWR_24=r.fromInt(oe$2),r.MAX_UNSIGNED_VALUE=r.fromBits(-1,-1,true),r.ZERO=r.fromInt(0),r.UZERO=r.fromInt(0,true),r.ONE=r.fromInt(1),r.UONE=r.fromInt(1,true),r.NEG_ONE=r.fromInt(-1),r.MAX_VALUE=r.fromBits(-1,2147483647,false),r.MIN_VALUE=r.fromBits(0,-2147483648,false),r})();Object.defineProperty(E$1.prototype,`__isLong__`,{value:true});Object.defineProperty(E$1.prototype,`_bsontype`,{value:`Long`});var se$1=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,fe$2=/^(\+|-)?(Infinity|inf)$/i,ae$1=/^(\+|-)?NaN$/i,ut=6111,Ft$1=-6176,ir$2=6176,ue$1=34,Mt$1=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),or$2=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),sr$2=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),he$2=/^([-+])?(\d+)?$/,ce$2=31,fr$2=16383,le$2=30,pe$2=31;function ar$2(r){return !isNaN(parseInt(r,10))}function ge$1(r){var t=E$1.fromNumber(1e9),i=E$1.fromNumber(0);if(!r.parts[0]&&!r.parts[1]&&!r.parts[2]&&!r.parts[3])return {quotient:r,rem:i};for(var f=0;f<=3;f++)i=i.shiftLeft(32),i=i.add(new E$1(r.parts[f],0)),r.parts[f]=i.div(t).low,i=i.modulo(t);return {quotient:r,rem:i}}function ye$2(r,t){if(!r&&!t)return {high:E$1.fromNumber(0),low:E$1.fromNumber(0)};var i=r.shiftRightUnsigned(32),f=new E$1(r.getLowBits(),0),c=t.shiftRightUnsigned(32),h=new E$1(t.getLowBits(),0),a=i.multiply(c),p=i.multiply(h),y=f.multiply(c),v=f.multiply(h);return a=a.add(p.shiftRightUnsigned(32)),p=new E$1(p.getLowBits(),0).add(y).add(v.shiftRightUnsigned(32)),a=a.add(p.shiftRightUnsigned(32)),v=p.shiftLeft(32).add(new E$1(v.getLowBits(),0)),{high:a,low:v}}function we$2(r,t){var i=r.high>>>0,f=t.high>>>0;if(i<f)return true;if(i===f){if(r.low>>>0<t.low>>>0)return true}return false}function st$1(r,t){throw new L$2(`"`.concat(r,`" is not a valid Decimal128 string - `).concat(t))}var Yt$1=(function(){function r(t){if(!(this instanceof r))return new r(t);if(typeof t==`string`)this.bytes=r.fromString(t).bytes;else if(Ct(t)){if(t.byteLength!==16)throw new L$2(`Decimal128 must take a Buffer of 16 bytes`);this.bytes=t;}else throw new L$2(`Decimal128 must take a Buffer or string`)}return r.fromString=function(t){var i=false,f=false,c=false,h=0,a=0,p=0,y=0,v=0,m=[0],w=0,_=0,O=0,S=0,d=0,M=0,D=new E$1(0,0),F=new E$1(0,0),P=0,B=0;if(t.length>=7e3)throw new L$2(``+t+` not a valid Decimal128 string`);var Y=t.match(se$1),W=t.match(fe$2),q=t.match(ae$1);if(!Y&&!W&&!q||t.length===0)throw new L$2(``+t+` not a valid Decimal128 string`);if(Y){var bt=Y[2],at=Y[4],At=Y[5],pt=Y[6];at&&pt===void 0&&st$1(t,`missing exponent power`),at&&bt===void 0&&st$1(t,`missing exponent base`),at===void 0&&(At||pt)&&st$1(t,`missing e before exponent`);}if((t[B]===`+`||t[B]===`-`)&&(i=t[B++]===`-`),!ar$2(t[B])&&t[B]!==`.`){if(t[B]===`i`||t[B]===`I`)return new r(A$1.from(i?or$2:sr$2));if(t[B]===`N`)return new r(A$1.from(Mt$1))}for(;ar$2(t[B])||t[B]===`.`;){if(t[B]===`.`){f&&st$1(t,`contains multiple periods`),f=true,B=B+1;continue}w<34&&(t[B]!==`0`||c)&&(c||(v=a),c=true,m[_++]=parseInt(t[B],10),w=w+1),c&&(p=p+1),f&&(y=y+1),a=a+1,B=B+1;}if(f&&!a)throw new L$2(``+t+` not a valid Decimal128 string`);if(t[B]===`e`||t[B]===`E`){var et=t.substr(++B).match(he$2);if(!et||!et[2])return new r(A$1.from(Mt$1));d=parseInt(et[0],10),B=B+et[0].length;}if(t[B])return new r(A$1.from(Mt$1));if(O=0,!w)O=0,S=0,m[0]=0,p=1,w=1,h=0;else if(S=w-1,h=p,h!==1)for(;m[v+h-1]===0;)h=h-1;for(d<=y&&y-d>16384?d=Ft$1:d=d-y;d>ut;){if(S=S+1,S-O>ue$1){var nt=m.join(``);if(nt.match(/^0+$/)){d=ut;break}st$1(t,`overflow`);}d=d-1;}for(;d<Ft$1||w<p;){if(S===0&&h<w){d=Ft$1,h=0;break}if(w<p?p=p-1:S=S-1,d<ut)d=d+1;else {var nt=m.join(``);if(nt.match(/^0+$/)){d=ut;break}st$1(t,`overflow`);}}if(S-O+1<h){var G=a;f&&(v=v+1,G=G+1),i&&(v=v+1,G=G+1);var gt=parseInt(t[v+S+1],10),it=0;if(gt>=5&&(it=1,gt===5)){for(it=m[S]%2===1?1:0,M=v+S+2;M<G;M++)if(parseInt(t[M],10)){it=1;break}}if(it){for(var T=S;T>=0;T--)if(++m[T]>9&&(m[T]=0,T===0))if(d<ut)d=d+1,m[T]=1;else return new r(A$1.from(i?or$2:sr$2))}}if(D=E$1.fromNumber(0),F=E$1.fromNumber(0),h===0)D=E$1.fromNumber(0),F=E$1.fromNumber(0);else if(S-O<17){var T=O;for(F=E$1.fromNumber(m[T++]),D=new E$1(0,0);T<=S;T++)F=F.multiply(E$1.fromNumber(10)),F=F.add(E$1.fromNumber(m[T]));}else {var T=O;for(D=E$1.fromNumber(m[T++]);T<=S-17;T++)D=D.multiply(E$1.fromNumber(10)),D=D.add(E$1.fromNumber(m[T]));for(F=E$1.fromNumber(m[T++]);T<=S;T++)F=F.multiply(E$1.fromNumber(10)),F=F.add(E$1.fromNumber(m[T]));}var V=ye$2(D,E$1.fromString(`100000000000000000`));V.low=V.low.add(F),we$2(V.low,F)&&(V.high=V.high.add(E$1.fromNumber(1))),P=d+ir$2;var b={low:E$1.fromNumber(0),high:E$1.fromNumber(0)};V.high.shiftRightUnsigned(49).and(E$1.fromNumber(1)).equals(E$1.fromNumber(1))?(b.high=b.high.or(E$1.fromNumber(3).shiftLeft(61)),b.high=b.high.or(E$1.fromNumber(P).and(E$1.fromNumber(16383).shiftLeft(47))),b.high=b.high.or(V.high.and(E$1.fromNumber(0x7fffffffffff)))):(b.high=b.high.or(E$1.fromNumber(P&16383).shiftLeft(49)),b.high=b.high.or(V.high.and(E$1.fromNumber(562949953421311)))),b.low=V.low,i&&(b.high=b.high.or(E$1.fromString(`9223372036854775808`)));var N=A$1.alloc(16);return B=0,N[B++]=b.low.low&255,N[B++]=b.low.low>>8&255,N[B++]=b.low.low>>16&255,N[B++]=b.low.low>>24&255,N[B++]=b.low.high&255,N[B++]=b.low.high>>8&255,N[B++]=b.low.high>>16&255,N[B++]=b.low.high>>24&255,N[B++]=b.high.low&255,N[B++]=b.high.low>>8&255,N[B++]=b.high.low>>16&255,N[B++]=b.high.low>>24&255,N[B++]=b.high.high&255,N[B++]=b.high.high>>8&255,N[B++]=b.high.high>>16&255,N[B++]=b.high.high>>24&255,new r(N)},r.prototype.toString=function(){for(var t,i=0,f=new Array(36),c=0;c<f.length;c++)f[c]=0;var h=0,a=false,p,y={parts:[0,0,0,0]},v,m,w=[];h=0;var _=this.bytes,O=_[h++]|_[h++]<<8|_[h++]<<16|_[h++]<<24,S=_[h++]|_[h++]<<8|_[h++]<<16|_[h++]<<24,d=_[h++]|_[h++]<<8|_[h++]<<16|_[h++]<<24,M=_[h++]|_[h++]<<8|_[h++]<<16|_[h++]<<24;h=0;({low:new E$1(O,S),high:new E$1(d,M)}).high.lessThan(E$1.ZERO)&&w.push(`-`);var F=M>>26&ce$2;if(F>>3===3){if(F===le$2)return w.join(``)+`Infinity`;if(F===pe$2)return `NaN`;t=M>>15&fr$2,p=8+(M>>14&1);}else p=M>>14&7,t=M>>17&fr$2;var P=t-ir$2;if(y.parts[0]=(M&16383)+((p&15)<<14),y.parts[1]=d,y.parts[2]=S,y.parts[3]=O,y.parts[0]===0&&y.parts[1]===0&&y.parts[2]===0&&y.parts[3]===0)a=true;else for(m=3;m>=0;m--){var B=0,Y=ge$1(y);if(y=Y.quotient,B=Y.rem.low,!!B)for(v=8;v>=0;v--)f[m*9+v]=B%10,B=Math.floor(B/10);}if(a)i=1,f[h]=0;else for(i=36;!f[h];)i=i-1,h=h+1;var W=i-1+P;if(W>=34||W<=-7||P>0){if(i>34)return w.push(``.concat(0)),P>0?w.push(`E+`.concat(P)):P<0&&w.push(`E`.concat(P)),w.join(``);w.push(``.concat(f[h++])),i=i-1,i&&w.push(`.`);for(var c=0;c<i;c++)w.push(``.concat(f[h++]));w.push(`E`),W>0?w.push(`+`.concat(W)):w.push(``.concat(W));}else if(P>=0)for(var c=0;c<i;c++)w.push(``.concat(f[h++]));else {var q=i+P;if(q>0)for(var c=0;c<q;c++)w.push(``.concat(f[h++]));else w.push(`0`);for(w.push(`.`);q++<0;)w.push(`0`);for(var c=0;c<i-Math.max(q-1,0);c++)w.push(``.concat(f[h++]));}return w.join(``)},r.prototype.toJSON=function(){return {$numberDecimal:this.toString()}},r.prototype.toExtendedJSON=function(){return {$numberDecimal:this.toString()}},r.fromExtendedJSON=function(t){return r.fromString(t.$numberDecimal)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){return `new Decimal128("`.concat(this.toString(),`")`)},r})();Object.defineProperty(Yt$1.prototype,`_bsontype`,{value:`Decimal128`});var Ot$1=(function(){function r(t){if(!(this instanceof r))return new r(t);t instanceof Number&&(t=t.valueOf()),this.value=+t;}return r.prototype.valueOf=function(){return this.value},r.prototype.toJSON=function(){return this.value},r.prototype.toString=function(t){return this.value.toString(t)},r.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()}},r.fromExtendedJSON=function(t,i){var f=parseFloat(t.$numberDouble);return i&&i.relaxed?f:new r(f)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){var t=this.toExtendedJSON();return `new Double(`.concat(t.$numberDouble,`)`)},r})();Object.defineProperty(Ot$1.prototype,`_bsontype`,{value:`Double`});var It$1=(function(){function r(t){if(!(this instanceof r))return new r(t);t instanceof Number&&(t=t.valueOf()),this.value=+t|0;}return r.prototype.valueOf=function(){return this.value},r.prototype.toString=function(t){return this.value.toString(t)},r.prototype.toJSON=function(){return this.value},r.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},r.fromExtendedJSON=function(t,i){return i&&i.relaxed?parseInt(t.$numberInt,10):new r(t.$numberInt)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){return `new Int32(`.concat(this.valueOf(),`)`)},r})();Object.defineProperty(It$1.prototype,`_bsontype`,{value:`Int32`});var Jt$1=(function(){function r(){if(!(this instanceof r))return new r}return r.prototype.toExtendedJSON=function(){return {$maxKey:1}},r.fromExtendedJSON=function(){return new r},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){return `new MaxKey()`},r})();Object.defineProperty(Jt$1.prototype,`_bsontype`,{value:`MaxKey`});var Ht$1=(function(){function r(){if(!(this instanceof r))return new r}return r.prototype.toExtendedJSON=function(){return {$minKey:1}},r.fromExtendedJSON=function(){return new r},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){return `new MinKey()`},r})();Object.defineProperty(Ht$1.prototype,`_bsontype`,{value:`MinKey`});var me$2=new RegExp(`^[0-9a-fA-F]{24}$`),Q$2=null,z$1=Symbol(`id`),$$1=(function(){function r(t){if(!(this instanceof r))return new r(t);var i;if(typeof t==`object`&&t&&`id`in t){if(typeof t.id!=`string`&&!ArrayBuffer.isView(t.id))throw new L$2(`Argument passed in must have an id that is of type string or Buffer`);`toHexString`in t&&typeof t.toHexString==`function`?i=A$1.from(t.toHexString(),`hex`):i=t.id;}else i=t;if(i==null||typeof i==`number`)this[z$1]=r.generate(typeof i==`number`?i:void 0);else if(ArrayBuffer.isView(i)&&i.byteLength===12)this[z$1]=i instanceof A$1?i:vt(i);else if(typeof i==`string`)if(i.length===12){var f=A$1.from(i);if(f.byteLength===12)this[z$1]=f;else throw new L$2(`Argument passed in must be a string of 12 bytes`)}else if(i.length===24&&me$2.test(i))this[z$1]=A$1.from(i,`hex`);else throw new L$2(`Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer`);else throw new L$2(`Argument passed in does not match the accepted types`);r.cacheHexString&&(this.__id=this.id.toString(`hex`));}return Object.defineProperty(r.prototype,`id`,{get:function(){return this[z$1]},set:function(t){this[z$1]=t,r.cacheHexString&&(this.__id=t.toString(`hex`));},enumerable:false,configurable:true}),Object.defineProperty(r.prototype,`generationTime`,{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0);},enumerable:false,configurable:true}),r.prototype.toHexString=function(){if(r.cacheHexString&&this.__id)return this.__id;var t=this.id.toString(`hex`);return r.cacheHexString&&!this.__id&&(this.__id=t),t},r.getInc=function(){return r.index=(r.index+1)%16777215},r.generate=function(t){typeof t!=`number`&&(t=Math.floor(Date.now()/1e3));var i=r.getInc(),f=A$1.alloc(12);return f.writeUInt32BE(t,0),Q$2===null&&(Q$2=yr$1(5)),f[4]=Q$2[0],f[5]=Q$2[1],f[6]=Q$2[2],f[7]=Q$2[3],f[8]=Q$2[4],f[11]=i&255,f[10]=i>>8&255,f[9]=i>>16&255,f},r.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},r.prototype.toJSON=function(){return this.toHexString()},r.prototype.equals=function(t){if(t==null)return false;if(t instanceof r)return this[z$1][11]===t[z$1][11]&&this[z$1].equals(t[z$1]);if(typeof t==`string`&&r.isValid(t)&&t.length===12&&Ct(this.id))return t===A$1.prototype.toString.call(this.id,`latin1`);if(typeof t==`string`&&r.isValid(t)&&t.length===24)return t.toLowerCase()===this.toHexString();if(typeof t==`string`&&r.isValid(t)&&t.length===12)return A$1.from(t).equals(this.id);if(typeof t==`object`&&`toHexString`in t&&typeof t.toHexString==`function`){var i=t.toHexString(),f=this.toHexString().toLowerCase();return typeof i==`string`&&i.toLowerCase()===f}return false},r.prototype.getTimestamp=function(){var t=new Date,i=this.id.readUInt32BE(0);return t.setTime(Math.floor(i)*1e3),t},r.createPk=function(){return new r},r.createFromTime=function(t){var i=A$1.from([0,0,0,0,0,0,0,0,0,0,0,0]);return i.writeUInt32BE(t,0),new r(i)},r.createFromHexString=function(t){if(typeof t>`u`||t!=null&&t.length!==24)throw new L$2(`Argument passed in must be a single String of 12 bytes or a string of 24 hex characters`);return new r(A$1.from(t,`hex`))},r.isValid=function(t){if(t==null)return false;try{return new r(t),!0}catch{return false}},r.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString(`hex`)}},r.fromExtendedJSON=function(t){return new r(t.$oid)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){return `new ObjectId("`.concat(this.toHexString(),`")`)},r.index=Math.floor(Math.random()*16777215),r})();Object.defineProperty($$1.prototype,`generate`,{value:St$1(function(r){return $$1.generate(r)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty($$1.prototype,`getInc`,{value:St$1(function(){return $$1.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty($$1.prototype,`get_inc`,{value:St$1(function(){return $$1.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty($$1,`get_inc`,{value:St$1(function(){return $$1.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty($$1.prototype,`_bsontype`,{value:`ObjectID`});function _e$2(r){return r.split(``).sort().join(``)}var ct$1=(function(){function r(t,i){if(!(this instanceof r))return new r(t,i);if(this.pattern=t,this.options=_e$2(i??``),this.pattern.indexOf(`\0`)!==-1)throw new tt(`BSON Regex patterns cannot contain null bytes, found: `.concat(JSON.stringify(this.pattern)));if(this.options.indexOf(`\0`)!==-1)throw new tt(`BSON Regex options cannot contain null bytes, found: `.concat(JSON.stringify(this.options)));for(var f=0;f<this.options.length;f++)if(!(this.options[f]===`i`||this.options[f]===`m`||this.options[f]===`x`||this.options[f]===`l`||this.options[f]===`s`||this.options[f]===`u`))throw new tt(`The regular expression option [`.concat(this.options[f],`] is not supported`))}return r.parseOptions=function(t){return t?t.split(``).sort().join(``):``},r.prototype.toExtendedJSON=function(t){return t=t||{},t.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},r.fromExtendedJSON=function(t){if(`$regex`in t)if(typeof t.$regex!=`string`){if(t.$regex._bsontype===`BSONRegExp`)return t}else return new r(t.$regex,r.parseOptions(t.$options));if(`$regularExpression`in t)return new r(t.$regularExpression.pattern,r.parseOptions(t.$regularExpression.options));throw new L$2(`Unexpected BSONRegExp EJSON object form: `.concat(JSON.stringify(t)))},r})();Object.defineProperty(ct$1.prototype,`_bsontype`,{value:`BSONRegExp`});var Vt$1=(function(){function r(t){if(!(this instanceof r))return new r(t);this.value=t;}return r.prototype.valueOf=function(){return this.value},r.prototype.toString=function(){return this.value},r.prototype.inspect=function(){return `new BSONSymbol("`.concat(this.value,`")`)},r.prototype.toJSON=function(){return this.value},r.prototype.toExtendedJSON=function(){return {$symbol:this.value}},r.fromExtendedJSON=function(t){return new r(t.$symbol)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r})();Object.defineProperty(Vt$1.prototype,`_bsontype`,{value:`Symbol`});var vr$1=(function(r){Bt$1(t,r);function t(i,f){var c=this;return c instanceof t?(E$1.isLong(i)?c=r.call(this,i.low,i.high,true)||this:lt$1(i)&&typeof i.t<`u`&&typeof i.i<`u`?c=r.call(this,i.i,i.t,true)||this:c=r.call(this,i,f,true)||this,Object.defineProperty(c,`_bsontype`,{value:`Timestamp`,writable:false,configurable:false,enumerable:false}),c):new t(i,f)}return t.prototype.toJSON=function(){return {$timestamp:this.toString()}},t.fromInt=function(i){return new t(E$1.fromInt(i,true))},t.fromNumber=function(i){return new t(E$1.fromNumber(i,true))},t.fromBits=function(i,f){return new t(i,f)},t.fromString=function(i,f){return new t(E$1.fromString(i,true,f))},t.prototype.toExtendedJSON=function(){return {$timestamp:{t:this.high>>>0,i:this.low>>>0}}},t.fromExtendedJSON=function(i){return new t(i.$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=E$1.MAX_UNSIGNED_VALUE,t})(E$1);function Ee$2(r){return lt$1(r)&&Reflect.has(r,`_bsontype`)&&typeof r._bsontype==`string`}var Er$2=2147483647,Br$2=-2147483648,Sr$1=0x8000000000000000,Nr$1=-9223372036854776e3,Be$1={$oid:$$1,$binary:rt,$uuid:rt,$symbol:Vt$1,$numberInt:It$1,$numberDecimal:Yt$1,$numberDouble:Ot$1,$numberLong:E$1,$minKey:Ht$1,$maxKey:Jt$1,$regex:ct$1,$regularExpression:ct$1,$timestamp:vr$1};function Or$1(r,t){if(t===void 0&&(t={}),typeof r==`number`){if(t.relaxed||t.legacy)return r;if(Math.floor(r)===r){if(r>=Br$2&&r<=Er$2)return new It$1(r);if(r>=Nr$1&&r<=Sr$1)return E$1.fromNumber(r)}return new Ot$1(r)}if(r==null||typeof r!=`object`)return r;if(r.$undefined)return null;for(var i=Object.keys(r).filter(function(w){return w.startsWith(`$`)&&r[w]!=null}),f=0;f<i.length;f++){var c=Be$1[i[f]];if(c)return c.fromExtendedJSON(r,t)}if(r.$date!=null){var h=r.$date,a=new Date;return t.legacy?typeof h==`number`?a.setTime(h):typeof h==`string`&&a.setTime(Date.parse(h)):typeof h==`string`?a.setTime(Date.parse(h)):E$1.isLong(h)?a.setTime(h.toNumber()):typeof h==`number`&&t.relaxed&&a.setTime(h),a}if(r.$code!=null){var p=Object.assign({},r);return r.$scope&&(p.$scope=Or$1(r.$scope)),Nt$1.fromExtendedJSON(r)}if(ie$2(r)||r.$dbPointer){var y=r.$ref?r:r.$dbPointer;if(y instanceof ht)return y;var v=Object.keys(y).filter(function(w){return w.startsWith(`$`)}),m=true;if(v.forEach(function(w){[`$ref`,`$id`,`$db`].indexOf(w)===-1&&(m=false);}),m)return ht.fromExtendedJSON(y)}return r}function Se$2(r,t){return r.map(function(i,f){t.seenObjects.push({propertyName:`index `.concat(f),obj:null});try{return k$2(i,t)}finally{t.seenObjects.pop();}})}function ur$2(r){var t=r.toISOString();return r.getUTCMilliseconds()!==0?t:t.slice(0,-5)+`Z`}function k$2(r,t){if((typeof r==`object`||typeof r==`function`)&&r!==null){var i=t.seenObjects.findIndex(function(D){return D.obj===r});if(i!==-1){var f=t.seenObjects.map(function(D){return D.propertyName}),c=f.slice(0,i).map(function(D){return ``.concat(D,` -> `)}).join(``),h=f[i],a=` -> `+f.slice(i+1,f.length-1).map(function(D){return ``.concat(D,` -> `)}).join(``),p=f[f.length-1],y=` `.repeat(c.length+h.length/2),v=`-`.repeat(a.length+(h.length+p.length)/2-1);throw new L$2(`Converting circular structure to EJSON:
18
+ var dr$2=v$1(dt=>{Object.defineProperty(dt,`__esModule`,{value:true});dt.URLBuilder=void 0;dt.URLBuilder=(function(){function r(t){try{this.base=new URL(t),this.params=new URLSearchParams(this.base.search.slice(1));}catch(i){console.error(`Un-parsable URL`,i);}}return r.prototype.appendQueryParam=function(t,i){this.params.append(t,i?i.toString():``);},r.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},r.prototype.deleteQueryParam=function(t){this.params.delete(t);},r.prototype.getBase=function(){return this.base},r.prototype.getPath=function(){return this.base.pathname},r.prototype.getHostname=function(){return this.base.hostname},r.prototype.getParams=function(){return this.params},r.prototype.getQueryParam=function(t){if(!this.params)return ``;var i=this.params.get(t);return !i||i===`undefined`||i===`null`?void 0:i},r.prototype.getQueryString=function(){return this.params.toString()},r.prototype.setPath=function(t){return this.base.pathname=t,this},r.prototype.setQueryParam=function(t,i){return this.params.set(t,i?i.toString():``),this},r.prototype.setQueryString=function(t){if(t)return t[0]===`?`&&(t=t.slice(1)),this.params=new URLSearchParams(t),this},r.prototype.toString=function(){var t=this.params.toString();return t===``?this.base.search=``:this.base.search=`?`+t,this.base.toString()},r})();});var mt$1=class mt{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 Mr$1(r,t){return t={exports:{}},r(t,t.exports),t.exports}var jr$1=Yr$2,$r$2=Hr$2,Pr$1=Zr$2,X$2=[],H$3=[],Cr$1=typeof Uint8Array<`u`?Uint8Array:Array,Rt$1=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;for(K$2=0,kt$1=Rt$1.length;K$2<kt$1;++K$2)X$2[K$2]=Rt$1[K$2],H$3[Rt$1.charCodeAt(K$2)]=K$2;var K$2,kt$1;H$3[45]=62;H$3[95]=63;function pr$2(r){var t=r.length;if(t%4>0)throw new Error(`Invalid string. Length must be a multiple of 4`);var i=r.indexOf(`=`);i===-1&&(i=t);var f=i===t?0:4-i%4;return [i,f]}function Yr$2(r){var t=pr$2(r),i=t[0],f=t[1];return (i+f)*3/4-f}function Jr$2(r,t,i){return (t+i)*3/4-i}function Hr$2(r){var t,i=pr$2(r),f=i[0],c=i[1],h=new Cr$1(Jr$2(r,f,c)),a=0,p=c>0?f-4:f,y;for(y=0;y<p;y+=4)t=H$3[r.charCodeAt(y)]<<18|H$3[r.charCodeAt(y+1)]<<12|H$3[r.charCodeAt(y+2)]<<6|H$3[r.charCodeAt(y+3)],h[a++]=t>>16&255,h[a++]=t>>8&255,h[a++]=t&255;return c===2&&(t=H$3[r.charCodeAt(y)]<<2|H$3[r.charCodeAt(y+1)]>>4,h[a++]=t&255),c===1&&(t=H$3[r.charCodeAt(y)]<<10|H$3[r.charCodeAt(y+1)]<<4|H$3[r.charCodeAt(y+2)]>>2,h[a++]=t>>8&255,h[a++]=t&255),h}function Vr$2(r){return X$2[r>>18&63]+X$2[r>>12&63]+X$2[r>>6&63]+X$2[r&63]}function Wr$2(r,t,i){for(var f,c=[],h=t;h<i;h+=3)f=(r[h]<<16&16711680)+(r[h+1]<<8&65280)+(r[h+2]&255),c.push(Vr$2(f));return c.join(``)}function Zr$2(r){for(var t,i=r.length,f=i%3,c=[],h=16383,a=0,p=i-f;a<p;a+=h)c.push(Wr$2(r,a,a+h>p?p:a+h));return f===1?(t=r[i-1],c.push(X$2[t>>2]+X$2[t<<4&63]+`==`)):f===2&&(t=(r[i-2]<<8)+r[i-1],c.push(X$2[t>>10]+X$2[t>>4&63]+X$2[t<<2&63]+`=`)),c.join(``)}var Lt$1={byteLength:jr$1,toByteArray:$r$2,fromByteArray:Pr$1};var zr$2=function(t,i,f,c,h){var a,p,y=h*8-c-1,v=(1<<y)-1,m=v>>1,w=-7,_=f?h-1:0,O=f?-1:1,S=t[i+_];for(_+=O,a=S&(1<<-w)-1,S>>=-w,w+=y;w>0;a=a*256+t[i+_],_+=O,w-=8);for(p=a&(1<<-w)-1,a>>=-w,w+=c;w>0;p=p*256+t[i+_],_+=O,w-=8);if(a===0)a=1-m;else {if(a===v)return p?NaN:(S?-1:1)*Infinity;p=p+Math.pow(2,c),a=a-m;}return (S?-1:1)*p*Math.pow(2,a-c)},Xr$2=function(t,i,f,c,h,a){var p,y,v,m=a*8-h-1,w=(1<<m)-1,_=w>>1,O=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=c?0:a-1,d=c?1:-1,M=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===Infinity?(y=isNaN(i)?1:0,p=w):(p=Math.floor(Math.log(i)/Math.LN2),i*(v=Math.pow(2,-p))<1&&(p--,v*=2),p+_>=1?i+=O/v:i+=O*Math.pow(2,1-_),i*v>=2&&(p++,v/=2),p+_>=w?(y=0,p=w):p+_>=1?(y=(i*v-1)*Math.pow(2,h),p=p+_):(y=i*Math.pow(2,_-1)*Math.pow(2,h),p=0));h>=8;t[f+S]=y&255,S+=d,y/=256,h-=8);for(p=p<<h|y,m+=h;m>0;t[f+S]=p&255,S+=d,p/=256,m-=8);t[f+S-d]|=M*128;},ot$1={read:zr$2,write:Xr$2},Et$1=Mr$1(function(r,t){var i=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;t.Buffer=a,t.SlowBuffer=D,t.INSPECT_MAX_BYTES=50;var f=2147483647;t.kMaxLength=f,a.TYPED_ARRAY_SUPPORT=c(),!a.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 c(){try{var o=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(o,e),o.foo()===42}catch{return false}}Object.defineProperty(a.prototype,`parent`,{enumerable:true,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,`offset`,{enumerable:true,get:function(){if(a.isBuffer(this))return this.byteOffset}});function h(o){if(o>f)throw new RangeError(`The value "`+o+`" is invalid for option "size"`);var e=new Uint8Array(o);return Object.setPrototypeOf(e,a.prototype),e}function a(o,e,n){if(typeof o==`number`){if(typeof e==`string`)throw new TypeError(`The "string" argument must be of type string. Received type number`);return m(o)}return p(o,e,n)}a.poolSize=8192;function p(o,e,n){if(typeof o==`string`)return w(o,e);if(ArrayBuffer.isView(o))return O(o);if(o==null)throw new TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+babelHelpers.typeof(o));if(Z(o,ArrayBuffer)||o&&Z(o.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(Z(o,SharedArrayBuffer)||o&&Z(o.buffer,SharedArrayBuffer)))return S(o,e,n);if(typeof o==`number`)throw new TypeError(`The "value" argument must not be of type number. Received type number`);var s=o.valueOf&&o.valueOf();if(s!=null&&s!==o)return a.from(s,e,n);var u=d(o);if(u)return u;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof o[Symbol.toPrimitive]==`function`)return a.from(o[Symbol.toPrimitive](`string`),e,n);throw new TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+babelHelpers.typeof(o))}a.from=function(o,e,n){return p(o,e,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function y(o){if(typeof o!=`number`)throw new TypeError(`"size" argument must be of type number`);if(o<0)throw new RangeError(`The value "`+o+`" is invalid for option "size"`)}function v(o,e,n){return y(o),o<=0?h(o):e!==void 0?typeof n==`string`?h(o).fill(e,n):h(o).fill(e):h(o)}a.alloc=function(o,e,n){return v(o,e,n)};function m(o){return y(o),h(o<0?0:M(o)|0)}a.allocUnsafe=function(o){return m(o)},a.allocUnsafeSlow=function(o){return m(o)};function w(o,e){if((typeof e!=`string`||e===``)&&(e=`utf8`),!a.isEncoding(e))throw new TypeError(`Unknown encoding: `+e);var n=F(o,e)|0,s=h(n),u=s.write(o,e);return u!==n&&(s=s.slice(0,u)),s}function _(o){for(var e=o.length<0?0:M(o.length)|0,n=h(e),s=0;s<e;s+=1)n[s]=o[s]&255;return n}function O(o){if(Z(o,Uint8Array)){var e=new Uint8Array(o);return S(e.buffer,e.byteOffset,e.byteLength)}return _(o)}function S(o,e,n){if(e<0||o.byteLength<e)throw new RangeError(`"offset" is outside of buffer bounds`);if(o.byteLength<e+(n||0))throw new RangeError(`"length" is outside of buffer bounds`);var s;return e===void 0&&n===void 0?s=new Uint8Array(o):n===void 0?s=new Uint8Array(o,e):s=new Uint8Array(o,e,n),Object.setPrototypeOf(s,a.prototype),s}function d(o){if(a.isBuffer(o)){var e=M(o.length)|0,n=h(e);return n.length===0||o.copy(n,0,0,e),n}if(o.length!==void 0)return typeof o.length!=`number`||Ut(o.length)?h(0):_(o);if(o.type===`Buffer`&&Array.isArray(o.data))return _(o.data)}function M(o){if(o>=f)throw new RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+f.toString(16)+` bytes`);return o|0}function D(o){return +o!=o&&(o=0),a.alloc(+o)}a.isBuffer=function(e){return e!=null&&e._isBuffer===true&&e!==a.prototype},a.compare=function(e,n){if(Z(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),Z(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),!a.isBuffer(e)||!a.isBuffer(n))throw new TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===n)return 0;for(var s=e.length,u=n.length,l=0,g=Math.min(s,u);l<g;++l)if(e[l]!==n[l]){s=e[l],u=n[l];break}return s<u?-1:u<s?1:0},a.isEncoding=function(e){switch(String(e).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 true;default:return false}},a.concat=function(e,n){if(!Array.isArray(e))throw new TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return a.alloc(0);var s;if(n===void 0)for(n=0,s=0;s<e.length;++s)n+=e[s].length;var u=a.allocUnsafe(n),l=0;for(s=0;s<e.length;++s){var g=e[s];if(Z(g,Uint8Array))l+g.length>u.length?a.from(g).copy(u,l):Uint8Array.prototype.set.call(u,g,l);else if(a.isBuffer(g))g.copy(u,l);else throw new TypeError(`"list" argument must be an Array of Buffers`);l+=g.length;}return u};function F(o,e){if(a.isBuffer(o))return o.length;if(ArrayBuffer.isView(o)||Z(o,ArrayBuffer))return o.byteLength;if(typeof o!=`string`)throw new TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+babelHelpers.typeof(o));var n=o.length,s=arguments.length>2&&arguments[2]===true;if(!s&&n===0)return 0;for(var u=false;;)switch(e){case `ascii`:case `latin1`:case `binary`:return n;case `utf8`:case `utf-8`:return xt(o).length;case `ucs2`:case `ucs-2`:case `utf16le`:case `utf-16le`:return n*2;case `hex`:return n>>>1;case `base64`:return Xt(o).length;default:if(u)return s?-1:xt(o).length;e=(``+e).toLowerCase(),u=true;}}a.byteLength=F;function P(o,e,n){var s=false;if((e===void 0||e<0)&&(e=0),e>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,e>>>=0,n<=e))return ``;for(o||(o=`utf8`);;)switch(o){case `hex`:return V(this,e,n);case `utf8`:case `utf-8`:return nt(this,e,n);case `ascii`:return it(this,e,n);case `latin1`:case `binary`:return T(this,e,n);case `base64`:return et(this,e,n);case `ucs2`:case `ucs-2`:case `utf16le`:case `utf-16le`:return b(this,e,n);default:if(s)throw new TypeError(`Unknown encoding: `+o);o=(o+``).toLowerCase(),s=true;}}a.prototype._isBuffer=true;function B(o,e,n){var s=o[e];o[e]=o[n],o[n]=s;}a.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError(`Buffer size must be a multiple of 16-bits`);for(var n=0;n<e;n+=2)B(this,n,n+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError(`Buffer size must be a multiple of 32-bits`);for(var n=0;n<e;n+=4)B(this,n,n+3),B(this,n+1,n+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError(`Buffer size must be a multiple of 64-bits`);for(var n=0;n<e;n+=8)B(this,n,n+7),B(this,n+1,n+6),B(this,n+2,n+5),B(this,n+3,n+4);return this},a.prototype.toString=function(){var e=this.length;return e===0?``:arguments.length===0?nt(this,0,e):P.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError(`Argument must be a Buffer`);return this===e?true:a.compare(this,e)===0},a.prototype.inspect=function(){var e=``,n=t.INSPECT_MAX_BYTES;return e=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(e+=` ... `),`<Buffer `+e+`>`},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(e,n,s,u,l){if(Z(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+babelHelpers.typeof(e));if(n===void 0&&(n=0),s===void 0&&(s=e?e.length:0),u===void 0&&(u=0),l===void 0&&(l=this.length),n<0||s>e.length||u<0||l>this.length)throw new RangeError(`out of range index`);if(u>=l&&n>=s)return 0;if(u>=l)return -1;if(n>=s)return 1;if(n>>>=0,s>>>=0,u>>>=0,l>>>=0,this===e)return 0;for(var g=l-u,I=s-n,x=Math.min(g,I),U=this.slice(u,l),j=e.slice(n,s),R=0;R<x;++R)if(U[R]!==j[R]){g=U[R],I=j[R];break}return g<I?-1:I<g?1:0};function Y(o,e,n,s,u){if(o.length===0)return -1;if(typeof n==`string`?(s=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ut(n)&&(n=u?0:o.length-1),n<0&&(n=o.length+n),n>=o.length){if(u)return -1;n=o.length-1;}else if(n<0)if(u)n=0;else return -1;if(typeof e==`string`&&(e=a.from(e,s)),a.isBuffer(e))return e.length===0?-1:W(o,e,n,s,u);if(typeof e==`number`)return e=e&255,typeof Uint8Array.prototype.indexOf==`function`?u?Uint8Array.prototype.indexOf.call(o,e,n):Uint8Array.prototype.lastIndexOf.call(o,e,n):W(o,[e],n,s,u);throw new TypeError(`val must be string, number or Buffer`)}function W(o,e,n,s,u){var l=1,g=o.length,I=e.length;if(s!==void 0&&(s=String(s).toLowerCase(),s===`ucs2`||s===`ucs-2`||s===`utf16le`||s===`utf-16le`)){if(o.length<2||e.length<2)return -1;l=2,g/=2,I/=2,n/=2;}function x(qt,Gt){return l===1?qt[Gt]:qt.readUInt16BE(Gt*l)}var U;if(u){var j=-1;for(U=n;U<g;U++)if(x(o,U)===x(e,j===-1?0:U-j)){if(j===-1&&(j=U),U-j+1===I)return j*l}else j!==-1&&(U-=U-j),j=-1;}else for(n+I>g&&(n=g-I),U=n;U>=0;U--){for(var R=true,wt=0;wt<I;wt++)if(x(o,U+wt)!==x(e,wt)){R=false;break}if(R)return U}return -1}a.prototype.includes=function(e,n,s){return this.indexOf(e,n,s)!==-1},a.prototype.indexOf=function(e,n,s){return Y(this,e,n,s,true)},a.prototype.lastIndexOf=function(e,n,s){return Y(this,e,n,s,false)};function q(o,e,n,s){n=Number(n)||0;var u=o.length-n;s?(s=Number(s),s>u&&(s=u)):s=u;var l=e.length;s>l/2&&(s=l/2);for(var g=0;g<s;++g){var I=parseInt(e.substr(g*2,2),16);if(Ut(I))return g;o[n+g]=I;}return g}function bt(o,e,n,s){return yt(xt(e,o.length-n),o,n,s)}function at(o,e,n,s){return yt(Tr(e),o,n,s)}function At(o,e,n,s){return yt(Xt(e),o,n,s)}function pt(o,e,n,s){return yt(Rr(e,o.length-n),o,n,s)}a.prototype.write=function(e,n,s,u){if(n===void 0)u=`utf8`,s=this.length,n=0;else if(s===void 0&&typeof n==`string`)u=n,s=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(s)?(s=s>>>0,u===void 0&&(u=`utf8`)):(u=s,s=void 0);else throw new Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);var l=this.length-n;if((s===void 0||s>l)&&(s=l),e.length>0&&(s<0||n<0)||n>this.length)throw new RangeError(`Attempt to write outside buffer bounds`);u||(u=`utf8`);for(var g=false;;)switch(u){case `hex`:return q(this,e,n,s);case `utf8`:case `utf-8`:return bt(this,e,n,s);case `ascii`:case `latin1`:case `binary`:return at(this,e,n,s);case `base64`:return At(this,e,n,s);case `ucs2`:case `ucs-2`:case `utf16le`:case `utf-16le`:return pt(this,e,n,s);default:if(g)throw new TypeError(`Unknown encoding: `+u);u=(``+u).toLowerCase(),g=true;}},a.prototype.toJSON=function(){return {type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function et(o,e,n){return e===0&&n===o.length?Lt$1.fromByteArray(o):Lt$1.fromByteArray(o.slice(e,n))}function nt(o,e,n){n=Math.min(o.length,n);for(var s=[],u=e;u<n;){var l=o[u],g=null,I=l>239?4:l>223?3:l>191?2:1;if(u+I<=n){var x,U,j,R;switch(I){case 1:l<128&&(g=l);break;case 2:x=o[u+1],(x&192)===128&&(R=(l&31)<<6|x&63,R>127&&(g=R));break;case 3:x=o[u+1],U=o[u+2],(x&192)===128&&(U&192)===128&&(R=(l&15)<<12|(x&63)<<6|U&63,R>2047&&(R<55296||R>57343)&&(g=R));break;case 4:x=o[u+1],U=o[u+2],j=o[u+3],(x&192)===128&&(U&192)===128&&(j&192)===128&&(R=(l&15)<<18|(x&63)<<12|(U&63)<<6|j&63,R>65535&&R<1114112&&(g=R));}}g===null?(g=65533,I=1):g>65535&&(g-=65536,s.push(g>>>10&1023|55296),g=56320|g&1023),s.push(g),u+=I;}return gt(s)}var G=4096;function gt(o){var e=o.length;if(e<=G)return String.fromCharCode.apply(String,o);for(var n=``,s=0;s<e;)n+=String.fromCharCode.apply(String,o.slice(s,s+=G));return n}function it(o,e,n){var s=``;n=Math.min(o.length,n);for(var u=e;u<n;++u)s+=String.fromCharCode(o[u]&127);return s}function T(o,e,n){var s=``;n=Math.min(o.length,n);for(var u=e;u<n;++u)s+=String.fromCharCode(o[u]);return s}function V(o,e,n){var s=o.length;(!e||e<0)&&(e=0),(!n||n<0||n>s)&&(n=s);for(var u=``,l=e;l<n;++l)u+=Lr[o[l]];return u}function b(o,e,n){for(var s=o.slice(e,n),u=``,l=0;l<s.length-1;l+=2)u+=String.fromCharCode(s[l]+s[l+1]*256);return u}a.prototype.slice=function(e,n){var s=this.length;e=~~e,n=n===void 0?s:~~n,e<0?(e+=s,e<0&&(e=0)):e>s&&(e=s),n<0?(n+=s,n<0&&(n=0)):n>s&&(n=s),n<e&&(n=e);var u=this.subarray(e,n);return Object.setPrototypeOf(u,a.prototype),u};function N(o,e,n){if(o%1!==0||o<0)throw new RangeError(`offset is not uint`);if(o+e>n)throw new RangeError(`Trying to access beyond buffer length`)}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,n,s){e=e>>>0,n=n>>>0,s||N(e,n,this.length);for(var u=this[e],l=1,g=0;++g<n&&(l*=256);)u+=this[e+g]*l;return u},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,n,s){e=e>>>0,n=n>>>0,s||N(e,n,this.length);for(var u=this[e+--n],l=1;n>0&&(l*=256);)u+=this[e+--n]*l;return u},a.prototype.readUint8=a.prototype.readUInt8=function(e,n){return e=e>>>0,n||N(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,n){return e=e>>>0,n||N(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,n){return e=e>>>0,n||N(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,n){return e=e>>>0,n||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,n){return e=e>>>0,n||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,n,s){e=e>>>0,n=n>>>0,s||N(e,n,this.length);for(var u=this[e],l=1,g=0;++g<n&&(l*=256);)u+=this[e+g]*l;return l*=128,u>=l&&(u-=Math.pow(2,8*n)),u},a.prototype.readIntBE=function(e,n,s){e=e>>>0,n=n>>>0,s||N(e,n,this.length);for(var u=n,l=1,g=this[e+--u];u>0&&(l*=256);)g+=this[e+--u]*l;return l*=128,g>=l&&(g-=Math.pow(2,8*n)),g},a.prototype.readInt8=function(e,n){return e=e>>>0,n||N(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,n){e=e>>>0,n||N(e,2,this.length);var s=this[e]|this[e+1]<<8;return s&32768?s|4294901760:s},a.prototype.readInt16BE=function(e,n){e=e>>>0,n||N(e,2,this.length);var s=this[e+1]|this[e]<<8;return s&32768?s|4294901760:s},a.prototype.readInt32LE=function(e,n){return e=e>>>0,n||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,n){return e=e>>>0,n||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,n){return e=e>>>0,n||N(e,4,this.length),ot$1.read(this,e,true,23,4)},a.prototype.readFloatBE=function(e,n){return e=e>>>0,n||N(e,4,this.length),ot$1.read(this,e,false,23,4)},a.prototype.readDoubleLE=function(e,n){return e=e>>>0,n||N(e,8,this.length),ot$1.read(this,e,true,52,8)},a.prototype.readDoubleBE=function(e,n){return e=e>>>0,n||N(e,8,this.length),ot$1.read(this,e,false,52,8)};function C(o,e,n,s,u,l){if(!a.isBuffer(o))throw new TypeError(`"buffer" argument must be a Buffer instance`);if(e>u||e<l)throw new RangeError(`"value" argument is out of bounds`);if(n+s>o.length)throw new RangeError(`Index out of range`)}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,n,s,u){if(e=+e,n=n>>>0,s=s>>>0,!u){var l=Math.pow(2,8*s)-1;C(this,e,n,s,l,0);}var g=1,I=0;for(this[n]=e&255;++I<s&&(g*=256);)this[n+I]=e/g&255;return n+s},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,n,s,u){if(e=+e,n=n>>>0,s=s>>>0,!u){var l=Math.pow(2,8*s)-1;C(this,e,n,s,l,0);}var g=s-1,I=1;for(this[n+g]=e&255;--g>=0&&(I*=256);)this[n+g]=e/I&255;return n+s},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,1,255,0),this[n]=e&255,n+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,2,65535,0),this[n]=e&255,this[n+1]=e>>>8,n+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,2,65535,0),this[n]=e>>>8,this[n+1]=e&255,n+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,4,4294967295,0),this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=e&255,n+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,4,4294967295,0),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4},a.prototype.writeIntLE=function(e,n,s,u){if(e=+e,n=n>>>0,!u){var l=Math.pow(2,8*s-1);C(this,e,n,s,l-1,-l);}var g=0,I=1,x=0;for(this[n]=e&255;++g<s&&(I*=256);)e<0&&x===0&&this[n+g-1]!==0&&(x=1),this[n+g]=(e/I>>0)-x&255;return n+s},a.prototype.writeIntBE=function(e,n,s,u){if(e=+e,n=n>>>0,!u){var l=Math.pow(2,8*s-1);C(this,e,n,s,l-1,-l);}var g=s-1,I=1,x=0;for(this[n+g]=e&255;--g>=0&&(I*=256);)e<0&&x===0&&this[n+g+1]!==0&&(x=1),this[n+g]=(e/I>>0)-x&255;return n+s},a.prototype.writeInt8=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,1,127,-128),e<0&&(e=255+e+1),this[n]=e&255,n+1},a.prototype.writeInt16LE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,2,32767,-32768),this[n]=e&255,this[n+1]=e>>>8,n+2},a.prototype.writeInt16BE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,2,32767,-32768),this[n]=e>>>8,this[n+1]=e&255,n+2},a.prototype.writeInt32LE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,4,2147483647,-2147483648),this[n]=e&255,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24,n+4},a.prototype.writeInt32BE=function(e,n,s){return e=+e,n=n>>>0,s||C(this,e,n,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};function Wt(o,e,n,s,u,l){if(n+s>o.length)throw new RangeError(`Index out of range`);if(n<0)throw new RangeError(`Index out of range`)}function Zt(o,e,n,s,u){return e=+e,n=n>>>0,u||Wt(o,e,n,4),ot$1.write(o,e,n,s,23,4),n+4}a.prototype.writeFloatLE=function(e,n,s){return Zt(this,e,n,true,s)},a.prototype.writeFloatBE=function(e,n,s){return Zt(this,e,n,false,s)};function zt(o,e,n,s,u){return e=+e,n=n>>>0,u||Wt(o,e,n,8),ot$1.write(o,e,n,s,52,8),n+8}a.prototype.writeDoubleLE=function(e,n,s){return zt(this,e,n,true,s)},a.prototype.writeDoubleBE=function(e,n,s){return zt(this,e,n,false,s)},a.prototype.copy=function(e,n,s,u){if(!a.isBuffer(e))throw new TypeError(`argument should be a Buffer`);if(s||(s=0),!u&&u!==0&&(u=this.length),n>=e.length&&(n=e.length),n||(n=0),u>0&&u<s&&(u=s),u===s||e.length===0||this.length===0)return 0;if(n<0)throw new RangeError(`targetStart out of bounds`);if(s<0||s>=this.length)throw new RangeError(`Index out of range`);if(u<0)throw new RangeError(`sourceEnd out of bounds`);u>this.length&&(u=this.length),e.length-n<u-s&&(u=e.length-n+s);var l=u-s;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(n,s,u):Uint8Array.prototype.set.call(e,this.subarray(s,u),n),l},a.prototype.fill=function(e,n,s,u){if(typeof e==`string`){if(typeof n==`string`?(u=n,n=0,s=this.length):typeof s==`string`&&(u=s,s=this.length),u!==void 0&&typeof u!=`string`)throw new TypeError(`encoding must be a string`);if(typeof u==`string`&&!a.isEncoding(u))throw new TypeError(`Unknown encoding: `+u);if(e.length===1){var l=e.charCodeAt(0);(u===`utf8`&&l<128||u===`latin1`)&&(e=l);}}else typeof e==`number`?e=e&255:typeof e==`boolean`&&(e=Number(e));if(n<0||this.length<n||this.length<s)throw new RangeError(`Out of range index`);if(s<=n)return this;n=n>>>0,s=s===void 0?this.length:s>>>0,e||(e=0);var g;if(typeof e==`number`)for(g=n;g<s;++g)this[g]=e;else {var I=a.isBuffer(e)?e:a.from(e,u),x=I.length;if(x===0)throw new TypeError(`The value "`+e+`" is invalid for argument "value"`);for(g=0;g<s-n;++g)this[g+n]=I[g%x];}return this};var xr=/[^+/0-9A-Za-z-_]/g;function Ur(o){if(o=o.split(`=`)[0],o=o.trim().replace(xr,``),o.length<2)return ``;for(;o.length%4!==0;)o=o+`=`;return o}function xt(o,e){e=e||Infinity;for(var n,s=o.length,u=null,l=[],g=0;g<s;++g){if(n=o.charCodeAt(g),n>55295&&n<57344){if(!u){if(n>56319){(e-=3)>-1&&l.push(239,191,189);continue}else if(g+1===s){(e-=3)>-1&&l.push(239,191,189);continue}u=n;continue}if(n<56320){(e-=3)>-1&&l.push(239,191,189),u=n;continue}n=(u-55296<<10|n-56320)+65536;}else u&&(e-=3)>-1&&l.push(239,191,189);if(u=null,n<128){if((e-=1)<0)break;l.push(n);}else if(n<2048){if((e-=2)<0)break;l.push(n>>6|192,n&63|128);}else if(n<65536){if((e-=3)<0)break;l.push(n>>12|224,n>>6&63|128,n&63|128);}else if(n<1114112){if((e-=4)<0)break;l.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128);}else throw new Error(`Invalid code point`)}return l}function Tr(o){for(var e=[],n=0;n<o.length;++n)e.push(o.charCodeAt(n)&255);return e}function Rr(o,e){for(var n,s,u,l=[],g=0;g<o.length&&!((e-=2)<0);++g)n=o.charCodeAt(g),s=n>>8,u=n%256,l.push(u),l.push(s);return l}function Xt(o){return Lt$1.toByteArray(Ur(o))}function yt(o,e,n,s){for(var u=0;u<s&&!(u+n>=e.length||u>=o.length);++u)e[u+n]=o[u];return u}function Z(o,e){return o instanceof e||o!=null&&o.constructor!=null&&o.constructor.name!=null&&o.constructor.name===e.name}function Ut(o){return o!==o}var Lr=(function(){for(var o=`0123456789abcdef`,e=new Array(256),n=0;n<16;++n)for(var s=n*16,u=0;u<16;++u)e[s+u]=o[n]+o[u];return e})();}),A$1=Et$1.Buffer;Et$1.SlowBuffer;Et$1.INSPECT_MAX_BYTES;Et$1.kMaxLength;var $t=function(t,i){return $t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,c){f.__proto__=c;}||function(f,c){for(var h in c)c.hasOwnProperty(h)&&(f[h]=c[h]);},$t(t,i)};function Bt$1(r,t){$t(r,t);function i(){this.constructor=r;}r.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i);}var tt=(function(r){Bt$1(t,r);function t(i){var f=r.call(this,i)||this;return Object.setPrototypeOf(f,t.prototype),f}return Object.defineProperty(t.prototype,`name`,{get:function(){return `BSONError`},enumerable:false,configurable:true}),t})(Error),L$2=(function(r){Bt$1(t,r);function t(i){var f=r.call(this,i)||this;return Object.setPrototypeOf(f,t.prototype),f}return Object.defineProperty(t.prototype,`name`,{get:function(){return `BSONTypeError`},enumerable:false,configurable:true}),t})(TypeError);function _t$1(r){return r&&r.Math==Math&&r}function gr$2(){return _t$1(typeof globalThis==`object`&&globalThis)||_t$1(typeof window==`object`&&window)||_t$1(typeof self==`object`&&self)||_t$1(typeof global==`object`&&global)||Function(`return this`)()}function qr$2(){var r=gr$2();return typeof r.navigator==`object`&&r.navigator.product===`ReactNative`}var Gr$2=function(t){var i=qr$2()?`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(i);for(var f=A$1.alloc(t),c=0;c<t;++c)f[c]=Math.floor(Math.random()*256);return f},kr$1=function(){if(typeof window<`u`){var r=window.crypto||window.msCrypto;if(r&&r.getRandomValues)return function(t){return r.getRandomValues(A$1.alloc(t))}}return typeof global<`u`&&global.crypto&&global.crypto.getRandomValues?function(t){return global.crypto.getRandomValues(A$1.alloc(t))}:Gr$2},yr$1=kr$1();function Kr$2(r){return [`[object ArrayBuffer]`,`[object SharedArrayBuffer]`].includes(Object.prototype.toString.call(r))}function Ct$1(r){return Object.prototype.toString.call(r)===`[object Uint8Array]`}function Qr$2(r){return Object.prototype.toString.call(r)===`[object RegExp]`}function te$1(r){return lt$1(r)&&Object.prototype.toString.call(r)===`[object Date]`}function lt$1(r){return typeof r==`object`&&r!==null}function St$1(r,t){var i=false;function f(){for(var c=[],h=0;h<arguments.length;h++)c[h]=arguments[h];return i||(console.warn(t),i=true),r.apply(this,c)}return f}function vt(r){if(ArrayBuffer.isView(r))return A$1.from(r.buffer,r.byteOffset,r.byteLength);if(Kr$2(r))return A$1.from(r);throw new L$2(`Must use either Buffer or TypedArray`)}var re$2=/^(?:[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,wr$2=function(r){return typeof r==`string`&&re$2.test(r)},Pt$1=function(r){if(!wr$2(r))throw new L$2(`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=r.replace(/-/g,``);return A$1.from(t,`hex`)},Kt$1=function(r,t){return t===void 0&&(t=true),t?r.toString(`hex`,0,4)+`-`+r.toString(`hex`,4,6)+`-`+r.toString(`hex`,6,8)+`-`+r.toString(`hex`,8,10)+`-`+r.toString(`hex`,10,16):r.toString(`hex`)};var ee$2=Math.pow(2,53),ne=-Math.pow(2,53);var mr$2=4;var rt$1=(function(){function r(t,i){if(!(this instanceof r))return new r(t,i);if(t!=null&&typeof t!=`string`&&!ArrayBuffer.isView(t)&&!(t instanceof ArrayBuffer)&&!Array.isArray(t))throw new L$2(`Binary can only be constructed from string, Buffer, TypedArray, or Array<number>`);this.sub_type=i??r.BSON_BINARY_SUBTYPE_DEFAULT,t==null?(this.buffer=A$1.alloc(r.BUFFER_SIZE),this.position=0):(typeof t==`string`?this.buffer=A$1.from(t,`binary`):Array.isArray(t)?this.buffer=A$1.from(t):this.buffer=vt(t),this.position=this.buffer.byteLength);}return r.prototype.put=function(t){if(typeof t==`string`&&t.length!==1)throw new L$2(`only accepts single character String`);if(typeof t!=`number`&&t.length!==1)throw new L$2(`only accepts single character Uint8Array or Array`);var i;if(typeof t==`string`?i=t.charCodeAt(0):typeof t==`number`?i=t:i=t[0],i<0||i>255)throw new L$2(`only accepts number in a valid unsigned byte range 0-255`);if(this.buffer.length>this.position)this.buffer[this.position++]=i;else {var f=A$1.alloc(r.BUFFER_SIZE+this.buffer.length);this.buffer.copy(f,0,0,this.buffer.length),this.buffer=f,this.buffer[this.position++]=i;}},r.prototype.write=function(t,i){if(i=typeof i==`number`?i:this.position,this.buffer.length<i+t.length){var f=A$1.alloc(this.buffer.length+t.length);this.buffer.copy(f,0,0,this.buffer.length),this.buffer=f;}ArrayBuffer.isView(t)?(this.buffer.set(vt(t),i),this.position=i+t.byteLength>this.position?i+t.length:this.position):typeof t==`string`&&(this.buffer.write(t,i,t.length,`binary`),this.position=i+t.length>this.position?i+t.length:this.position);},r.prototype.read=function(t,i){return i=i&&i>0?i:this.position,this.buffer.slice(t,t+i)},r.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)},r.prototype.length=function(){return this.position},r.prototype.toJSON=function(){return this.buffer.toString(`base64`)},r.prototype.toString=function(t){return this.buffer.toString(t)},r.prototype.toExtendedJSON=function(t){t=t||{};var i=this.buffer.toString(`base64`),f=Number(this.sub_type).toString(16);return t.legacy?{$binary:i,$type:f.length===1?`0`+f:f}:{$binary:{base64:i,subType:f.length===1?`0`+f:f}}},r.prototype.toUUID=function(){if(this.sub_type===r.SUBTYPE_UUID)return new Qt$1(this.buffer.slice(0,this.position));throw new tt(`Binary sub_type "`.concat(this.sub_type,`" is not supported for converting to UUID. Only "`).concat(r.SUBTYPE_UUID,`" is currently supported.`))},r.fromExtendedJSON=function(t,i){i=i||{};var f,c;if(`$binary`in t?i.legacy&&typeof t.$binary==`string`&&`$type`in t?(c=t.$type?parseInt(t.$type,16):0,f=A$1.from(t.$binary,`base64`)):typeof t.$binary!=`string`&&(c=t.$binary.subType?parseInt(t.$binary.subType,16):0,f=A$1.from(t.$binary.base64,`base64`)):`$uuid`in t&&(c=4,f=Pt$1(t.$uuid)),!f)throw new L$2(`Unexpected Binary Extended JSON format `.concat(JSON.stringify(t)));return c===mr$2?new Qt$1(f):new r(f,c)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){var t=this.value(true);return `new Binary(Buffer.from("`.concat(t.toString(`hex`),`", "hex"), `).concat(this.sub_type,`)`)},r.BSON_BINARY_SUBTYPE_DEFAULT=0,r.BUFFER_SIZE=256,r.SUBTYPE_DEFAULT=0,r.SUBTYPE_FUNCTION=1,r.SUBTYPE_BYTE_ARRAY=2,r.SUBTYPE_UUID_OLD=3,r.SUBTYPE_UUID=4,r.SUBTYPE_MD5=5,r.SUBTYPE_ENCRYPTED=6,r.SUBTYPE_COLUMN=7,r.SUBTYPE_USER_DEFINED=128,r})();Object.defineProperty(rt$1.prototype,`_bsontype`,{value:`Binary`});var Dt$1=16,Qt$1=(function(r){Bt$1(t,r);function t(i){var f=this,c,h;if(i==null)c=t.generate();else if(i instanceof t)c=A$1.from(i.buffer),h=i.__id;else if(ArrayBuffer.isView(i)&&i.byteLength===Dt$1)c=vt(i);else if(typeof i==`string`)c=Pt$1(i);else throw new L$2(`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 f=r.call(this,c,mr$2)||this,f.__id=h,f}return Object.defineProperty(t.prototype,`id`,{get:function(){return this.buffer},set:function(i){this.buffer=i,t.cacheHexString&&(this.__id=Kt$1(i));},enumerable:false,configurable:true}),t.prototype.toHexString=function(i){if(i===void 0&&(i=true),t.cacheHexString&&this.__id)return this.__id;var f=Kt$1(this.id,i);return t.cacheHexString&&(this.__id=f),f},t.prototype.toString=function(i){return i?this.id.toString(i):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(i){if(!i)return false;if(i instanceof t)return i.id.equals(this.id);try{return new t(i).id.equals(this.id)}catch{return false}},t.prototype.toBinary=function(){return new rt$1(this.id,rt$1.SUBTYPE_UUID)},t.generate=function(){var i=yr$1(Dt$1);return i[6]=i[6]&15|64,i[8]=i[8]&63|128,A$1.from(i)},t.isValid=function(i){return i?i instanceof t?true:typeof i==`string`?wr$2(i):Ct$1(i)?i.length!==Dt$1?false:(i[6]&240)===64&&(i[8]&128)===128:false:false},t.createFromHexString=function(i){return new t(Pt$1(i))},t.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},t.prototype.inspect=function(){return `new UUID("`.concat(this.toHexString(),`")`)},t})(rt$1),Nt$1=(function(){function r(t,i){if(!(this instanceof r))return new r(t,i);this.code=t,this.scope=i;}return r.prototype.toJSON=function(){return {code:this.code,scope:this.scope}},r.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},r.fromExtendedJSON=function(t){return new r(t.$code,t.$scope)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){var t=this.toJSON();return `new Code("`.concat(String(t.code),`"`).concat(t.scope?`, `.concat(JSON.stringify(t.scope)):``,`)`)},r})();Object.defineProperty(Nt$1.prototype,`_bsontype`,{value:`Code`});function ie$2(r){return lt$1(r)&&r.$id!=null&&typeof r.$ref==`string`&&(r.$db==null||typeof r.$db==`string`)}var ht=(function(){function r(t,i,f,c){if(!(this instanceof r))return new r(t,i,f,c);var h=t.split(`.`);h.length===2&&(f=h.shift(),t=h.shift()),this.collection=t,this.oid=i,this.db=f,this.fields=c||{};}return Object.defineProperty(r.prototype,`namespace`,{get:function(){return this.collection},set:function(t){this.collection=t;},enumerable:false,configurable:true}),r.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(t.$db=this.db),t},r.prototype.toExtendedJSON=function(t){t=t||{};var i={$ref:this.collection,$id:this.oid};return t.legacy||(this.db&&(i.$db=this.db),i=Object.assign(i,this.fields)),i},r.fromExtendedJSON=function(t){var i=Object.assign({},t);return delete i.$ref,delete i.$id,delete i.$db,new r(t.$ref,t.$id,t.$db,i)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.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,`"`):``,`)`)},r})();Object.defineProperty(ht.prototype,`_bsontype`,{value:`DBRef`});var J$1=void 0;try{J$1=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 tr$2=65536,oe$2=1<<24,ft=tr$2*tr$2,_r$1=ft*ft,rr$2=_r$1/2,er$2={},nr$2={},E$1=(function(){function r(t,i,f){if(t===void 0&&(t=0),!(this instanceof r))return new r(t,i,f);typeof t==`bigint`?Object.assign(this,r.fromBigInt(t,!!i)):typeof t==`string`?Object.assign(this,r.fromString(t,!!i)):(this.low=t|0,this.high=i|0,this.unsigned=!!f),Object.defineProperty(this,`__isLong__`,{value:true,configurable:false,writable:false,enumerable:false});}return r.fromBits=function(t,i,f){return new r(t,i,f)},r.fromInt=function(t,i){var f,c,h;return i?(t>>>=0,(h=0<=t&&t<256)&&(c=nr$2[t],c)?c:(f=r.fromBits(t,(t|0)<0?-1:0,true),h&&(nr$2[t]=f),f)):(t|=0,(h=-128<=t&&t<128)&&(c=er$2[t],c)?c:(f=r.fromBits(t,t<0?-1:0,false),h&&(er$2[t]=f),f))},r.fromNumber=function(t,i){if(isNaN(t))return i?r.UZERO:r.ZERO;if(i){if(t<0)return r.UZERO;if(t>=_r$1)return r.MAX_UNSIGNED_VALUE}else {if(t<=-rr$2)return r.MIN_VALUE;if(t+1>=rr$2)return r.MAX_VALUE}return t<0?r.fromNumber(-t,i).neg():r.fromBits(t%ft|0,t/ft|0,i)},r.fromBigInt=function(t,i){return r.fromString(t.toString(),i)},r.fromString=function(t,i,f){if(t.length===0)throw Error(`empty string`);if(t===`NaN`||t===`Infinity`||t===`+Infinity`||t===`-Infinity`)return r.ZERO;if(typeof i==`number`?(f=i,i=false):i=!!i,f=f||10,f<2||36<f)throw RangeError(`radix`);var c;if((c=t.indexOf(`-`))>0)throw Error(`interior hyphen`);if(c===0)return r.fromString(t.substring(1),i,f).neg();for(var h=r.fromNumber(Math.pow(f,8)),a=r.ZERO,p=0;p<t.length;p+=8){var y=Math.min(8,t.length-p),v=parseInt(t.substring(p,p+y),f);if(y<8){var m=r.fromNumber(Math.pow(f,y));a=a.mul(m).add(r.fromNumber(v));}else a=a.mul(h),a=a.add(r.fromNumber(v));}return a.unsigned=i,a},r.fromBytes=function(t,i,f){return f?r.fromBytesLE(t,i):r.fromBytesBE(t,i)},r.fromBytesLE=function(t,i){return new r(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,i)},r.fromBytesBE=function(t,i){return new r(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],i)},r.isLong=function(t){return lt$1(t)&&t.__isLong__===true},r.fromValue=function(t,i){return typeof t==`number`?r.fromNumber(t,i):typeof t==`string`?r.fromString(t,i):r.fromBits(t.low,t.high,typeof i==`boolean`?i:t.unsigned)},r.prototype.add=function(t){r.isLong(t)||(t=r.fromValue(t));var i=this.high>>>16,f=this.high&65535,c=this.low>>>16,h=this.low&65535,a=t.high>>>16,p=t.high&65535,y=t.low>>>16,v=t.low&65535,m=0,w=0,_=0,O=0;return O+=h+v,_+=O>>>16,O&=65535,_+=c+y,w+=_>>>16,_&=65535,w+=f+p,m+=w>>>16,w&=65535,m+=i+a,m&=65535,r.fromBits(_<<16|O,m<<16|w,this.unsigned)},r.prototype.and=function(t){return r.isLong(t)||(t=r.fromValue(t)),r.fromBits(this.low&t.low,this.high&t.high,this.unsigned)},r.prototype.compare=function(t){if(r.isLong(t)||(t=r.fromValue(t)),this.eq(t))return 0;var i=this.isNegative(),f=t.isNegative();return i&&!f?-1:!i&&f?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},r.prototype.comp=function(t){return this.compare(t)},r.prototype.divide=function(t){if(r.isLong(t)||(t=r.fromValue(t)),t.isZero())throw Error(`division by zero`);if(J$1){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var i=(this.unsigned?J$1.div_u:J$1.div_s)(this.low,this.high,t.low,t.high);return r.fromBits(i,J$1.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?r.UZERO:r.ZERO;var f,c,h;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return r.UZERO;if(t.gt(this.shru(1)))return r.UONE;h=r.UZERO;}else {if(this.eq(r.MIN_VALUE)){if(t.eq(r.ONE)||t.eq(r.NEG_ONE))return r.MIN_VALUE;if(t.eq(r.MIN_VALUE))return r.ONE;return f=this.shr(1).div(t).shl(1),f.eq(r.ZERO)?t.isNegative()?r.ONE:r.NEG_ONE:(c=this.sub(t.mul(f)),h=f.add(c.div(t)),h)}else if(t.eq(r.MIN_VALUE))return this.unsigned?r.UZERO:r.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();h=r.ZERO;}for(c=this;c.gte(t);){f=Math.max(1,Math.floor(c.toNumber()/t.toNumber()));for(var p=Math.ceil(Math.log(f)/Math.LN2),y=p<=48?1:Math.pow(2,p-48),v=r.fromNumber(f),m=v.mul(t);m.isNegative()||m.gt(c);)f-=y,v=r.fromNumber(f,this.unsigned),m=v.mul(t);v.isZero()&&(v=r.ONE),h=h.add(v),c=c.sub(m);}return h},r.prototype.div=function(t){return this.divide(t)},r.prototype.equals=function(t){return r.isLong(t)||(t=r.fromValue(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?false:this.high===t.high&&this.low===t.low},r.prototype.eq=function(t){return this.equals(t)},r.prototype.getHighBits=function(){return this.high},r.prototype.getHighBitsUnsigned=function(){return this.high>>>0},r.prototype.getLowBits=function(){return this.low},r.prototype.getLowBitsUnsigned=function(){return this.low>>>0},r.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(r.MIN_VALUE)?64:this.neg().getNumBitsAbs();var t=this.high!==0?this.high:this.low,i;for(i=31;i>0&&(t&1<<i)===0;i--);return this.high!==0?i+33:i+1},r.prototype.greaterThan=function(t){return this.comp(t)>0},r.prototype.gt=function(t){return this.greaterThan(t)},r.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},r.prototype.gte=function(t){return this.greaterThanOrEqual(t)},r.prototype.ge=function(t){return this.greaterThanOrEqual(t)},r.prototype.isEven=function(){return (this.low&1)===0},r.prototype.isNegative=function(){return !this.unsigned&&this.high<0},r.prototype.isOdd=function(){return (this.low&1)===1},r.prototype.isPositive=function(){return this.unsigned||this.high>=0},r.prototype.isZero=function(){return this.high===0&&this.low===0},r.prototype.lessThan=function(t){return this.comp(t)<0},r.prototype.lt=function(t){return this.lessThan(t)},r.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},r.prototype.lte=function(t){return this.lessThanOrEqual(t)},r.prototype.modulo=function(t){if(r.isLong(t)||(t=r.fromValue(t)),J$1){var i=(this.unsigned?J$1.rem_u:J$1.rem_s)(this.low,this.high,t.low,t.high);return r.fromBits(i,J$1.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},r.prototype.mod=function(t){return this.modulo(t)},r.prototype.rem=function(t){return this.modulo(t)},r.prototype.multiply=function(t){if(this.isZero())return r.ZERO;if(r.isLong(t)||(t=r.fromValue(t)),J$1){var i=J$1.mul(this.low,this.high,t.low,t.high);return r.fromBits(i,J$1.get_high(),this.unsigned)}if(t.isZero())return r.ZERO;if(this.eq(r.MIN_VALUE))return t.isOdd()?r.MIN_VALUE:r.ZERO;if(t.eq(r.MIN_VALUE))return this.isOdd()?r.MIN_VALUE:r.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(r.TWO_PWR_24)&&t.lt(r.TWO_PWR_24))return r.fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var f=this.high>>>16,c=this.high&65535,h=this.low>>>16,a=this.low&65535,p=t.high>>>16,y=t.high&65535,v=t.low>>>16,m=t.low&65535,w=0,_=0,O=0,S=0;return S+=a*m,O+=S>>>16,S&=65535,O+=h*m,_+=O>>>16,O&=65535,O+=a*v,_+=O>>>16,O&=65535,_+=c*m,w+=_>>>16,_&=65535,_+=h*v,w+=_>>>16,_&=65535,_+=a*y,w+=_>>>16,_&=65535,w+=f*m+c*v+h*y+a*p,w&=65535,r.fromBits(O<<16|S,w<<16|_,this.unsigned)},r.prototype.mul=function(t){return this.multiply(t)},r.prototype.negate=function(){return !this.unsigned&&this.eq(r.MIN_VALUE)?r.MIN_VALUE:this.not().add(r.ONE)},r.prototype.neg=function(){return this.negate()},r.prototype.not=function(){return r.fromBits(~this.low,~this.high,this.unsigned)},r.prototype.notEquals=function(t){return !this.equals(t)},r.prototype.neq=function(t){return this.notEquals(t)},r.prototype.ne=function(t){return this.notEquals(t)},r.prototype.or=function(t){return r.isLong(t)||(t=r.fromValue(t)),r.fromBits(this.low|t.low,this.high|t.high,this.unsigned)},r.prototype.shiftLeft=function(t){return r.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?r.fromBits(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):r.fromBits(0,this.low<<t-32,this.unsigned)},r.prototype.shl=function(t){return this.shiftLeft(t)},r.prototype.shiftRight=function(t){return r.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?r.fromBits(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):r.fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},r.prototype.shr=function(t){return this.shiftRight(t)},r.prototype.shiftRightUnsigned=function(t){if(r.isLong(t)&&(t=t.toInt()),t&=63,t===0)return this;var i=this.high;if(t<32){var f=this.low;return r.fromBits(f>>>t|i<<32-t,i>>>t,this.unsigned)}else return t===32?r.fromBits(i,0,this.unsigned):r.fromBits(i>>>t-32,0,this.unsigned)},r.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},r.prototype.shru=function(t){return this.shiftRightUnsigned(t)},r.prototype.subtract=function(t){return r.isLong(t)||(t=r.fromValue(t)),this.add(t.neg())},r.prototype.sub=function(t){return this.subtract(t)},r.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},r.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*ft+(this.low>>>0):this.high*ft+(this.low>>>0)},r.prototype.toBigInt=function(){return BigInt(this.toString())},r.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},r.prototype.toBytesLE=function(){var t=this.high,i=this.low;return [i&255,i>>>8&255,i>>>16&255,i>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]},r.prototype.toBytesBE=function(){var t=this.high,i=this.low;return [t>>>24,t>>>16&255,t>>>8&255,t&255,i>>>24,i>>>16&255,i>>>8&255,i&255]},r.prototype.toSigned=function(){return this.unsigned?r.fromBits(this.low,this.high,false):this},r.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(r.MIN_VALUE)){var i=r.fromNumber(t),f=this.div(i),c=f.mul(i).sub(this);return f.toString(t)+c.toInt().toString(t)}else return `-`+this.neg().toString(t);for(var h=r.fromNumber(Math.pow(t,6),this.unsigned),a=this,p=``;;){var y=a.div(h),m=(a.sub(y.mul(h)).toInt()>>>0).toString(t);if(a=y,a.isZero())return m+p;for(;m.length<6;)m=`0`+m;p=``+m+p;}},r.prototype.toUnsigned=function(){return this.unsigned?this:r.fromBits(this.low,this.high,true)},r.prototype.xor=function(t){return r.isLong(t)||(t=r.fromValue(t)),r.fromBits(this.low^t.low,this.high^t.high,this.unsigned)},r.prototype.eqz=function(){return this.isZero()},r.prototype.le=function(t){return this.lessThanOrEqual(t)},r.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},r.fromExtendedJSON=function(t,i){var f=r.fromString(t.$numberLong);return i&&i.relaxed?f.toNumber():f},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){return `new Long("`.concat(this.toString(),`"`).concat(this.unsigned?`, true`:``,`)`)},r.TWO_PWR_24=r.fromInt(oe$2),r.MAX_UNSIGNED_VALUE=r.fromBits(-1,-1,true),r.ZERO=r.fromInt(0),r.UZERO=r.fromInt(0,true),r.ONE=r.fromInt(1),r.UONE=r.fromInt(1,true),r.NEG_ONE=r.fromInt(-1),r.MAX_VALUE=r.fromBits(-1,2147483647,false),r.MIN_VALUE=r.fromBits(0,-2147483648,false),r})();Object.defineProperty(E$1.prototype,`__isLong__`,{value:true});Object.defineProperty(E$1.prototype,`_bsontype`,{value:`Long`});var se$1=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,fe$2=/^(\+|-)?(Infinity|inf)$/i,ae$1=/^(\+|-)?NaN$/i,ut=6111,Ft$1=-6176,ir$2=6176,ue$1=34,Mt$1=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),or$2=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),sr$2=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),he$2=/^([-+])?(\d+)?$/,ce$2=31,fr$2=16383,le$2=30,pe$2=31;function ar$2(r){return !isNaN(parseInt(r,10))}function ge$1(r){var t=E$1.fromNumber(1e9),i=E$1.fromNumber(0);if(!r.parts[0]&&!r.parts[1]&&!r.parts[2]&&!r.parts[3])return {quotient:r,rem:i};for(var f=0;f<=3;f++)i=i.shiftLeft(32),i=i.add(new E$1(r.parts[f],0)),r.parts[f]=i.div(t).low,i=i.modulo(t);return {quotient:r,rem:i}}function ye$2(r,t){if(!r&&!t)return {high:E$1.fromNumber(0),low:E$1.fromNumber(0)};var i=r.shiftRightUnsigned(32),f=new E$1(r.getLowBits(),0),c=t.shiftRightUnsigned(32),h=new E$1(t.getLowBits(),0),a=i.multiply(c),p=i.multiply(h),y=f.multiply(c),v=f.multiply(h);return a=a.add(p.shiftRightUnsigned(32)),p=new E$1(p.getLowBits(),0).add(y).add(v.shiftRightUnsigned(32)),a=a.add(p.shiftRightUnsigned(32)),v=p.shiftLeft(32).add(new E$1(v.getLowBits(),0)),{high:a,low:v}}function we$2(r,t){var i=r.high>>>0,f=t.high>>>0;if(i<f)return true;if(i===f){if(r.low>>>0<t.low>>>0)return true}return false}function st$1(r,t){throw new L$2(`"`.concat(r,`" is not a valid Decimal128 string - `).concat(t))}var Yt$1=(function(){function r(t){if(!(this instanceof r))return new r(t);if(typeof t==`string`)this.bytes=r.fromString(t).bytes;else if(Ct$1(t)){if(t.byteLength!==16)throw new L$2(`Decimal128 must take a Buffer of 16 bytes`);this.bytes=t;}else throw new L$2(`Decimal128 must take a Buffer or string`)}return r.fromString=function(t){var i=false,f=false,c=false,h=0,a=0,p=0,y=0,v=0,m=[0],w=0,_=0,O=0,S=0,d=0,M=0,D=new E$1(0,0),F=new E$1(0,0),P=0,B=0;if(t.length>=7e3)throw new L$2(``+t+` not a valid Decimal128 string`);var Y=t.match(se$1),W=t.match(fe$2),q=t.match(ae$1);if(!Y&&!W&&!q||t.length===0)throw new L$2(``+t+` not a valid Decimal128 string`);if(Y){var bt=Y[2],at=Y[4],At=Y[5],pt=Y[6];at&&pt===void 0&&st$1(t,`missing exponent power`),at&&bt===void 0&&st$1(t,`missing exponent base`),at===void 0&&(At||pt)&&st$1(t,`missing e before exponent`);}if((t[B]===`+`||t[B]===`-`)&&(i=t[B++]===`-`),!ar$2(t[B])&&t[B]!==`.`){if(t[B]===`i`||t[B]===`I`)return new r(A$1.from(i?or$2:sr$2));if(t[B]===`N`)return new r(A$1.from(Mt$1))}for(;ar$2(t[B])||t[B]===`.`;){if(t[B]===`.`){f&&st$1(t,`contains multiple periods`),f=true,B=B+1;continue}w<34&&(t[B]!==`0`||c)&&(c||(v=a),c=true,m[_++]=parseInt(t[B],10),w=w+1),c&&(p=p+1),f&&(y=y+1),a=a+1,B=B+1;}if(f&&!a)throw new L$2(``+t+` not a valid Decimal128 string`);if(t[B]===`e`||t[B]===`E`){var et=t.substr(++B).match(he$2);if(!et||!et[2])return new r(A$1.from(Mt$1));d=parseInt(et[0],10),B=B+et[0].length;}if(t[B])return new r(A$1.from(Mt$1));if(O=0,!w)O=0,S=0,m[0]=0,p=1,w=1,h=0;else if(S=w-1,h=p,h!==1)for(;m[v+h-1]===0;)h=h-1;for(d<=y&&y-d>16384?d=Ft$1:d=d-y;d>ut;){if(S=S+1,S-O>ue$1){var nt=m.join(``);if(nt.match(/^0+$/)){d=ut;break}st$1(t,`overflow`);}d=d-1;}for(;d<Ft$1||w<p;){if(S===0&&h<w){d=Ft$1,h=0;break}if(w<p?p=p-1:S=S-1,d<ut)d=d+1;else {var nt=m.join(``);if(nt.match(/^0+$/)){d=ut;break}st$1(t,`overflow`);}}if(S-O+1<h){var G=a;f&&(v=v+1,G=G+1),i&&(v=v+1,G=G+1);var gt=parseInt(t[v+S+1],10),it=0;if(gt>=5&&(it=1,gt===5)){for(it=m[S]%2===1?1:0,M=v+S+2;M<G;M++)if(parseInt(t[M],10)){it=1;break}}if(it){for(var T=S;T>=0;T--)if(++m[T]>9&&(m[T]=0,T===0))if(d<ut)d=d+1,m[T]=1;else return new r(A$1.from(i?or$2:sr$2))}}if(D=E$1.fromNumber(0),F=E$1.fromNumber(0),h===0)D=E$1.fromNumber(0),F=E$1.fromNumber(0);else if(S-O<17){var T=O;for(F=E$1.fromNumber(m[T++]),D=new E$1(0,0);T<=S;T++)F=F.multiply(E$1.fromNumber(10)),F=F.add(E$1.fromNumber(m[T]));}else {var T=O;for(D=E$1.fromNumber(m[T++]);T<=S-17;T++)D=D.multiply(E$1.fromNumber(10)),D=D.add(E$1.fromNumber(m[T]));for(F=E$1.fromNumber(m[T++]);T<=S;T++)F=F.multiply(E$1.fromNumber(10)),F=F.add(E$1.fromNumber(m[T]));}var V=ye$2(D,E$1.fromString(`100000000000000000`));V.low=V.low.add(F),we$2(V.low,F)&&(V.high=V.high.add(E$1.fromNumber(1))),P=d+ir$2;var b={low:E$1.fromNumber(0),high:E$1.fromNumber(0)};V.high.shiftRightUnsigned(49).and(E$1.fromNumber(1)).equals(E$1.fromNumber(1))?(b.high=b.high.or(E$1.fromNumber(3).shiftLeft(61)),b.high=b.high.or(E$1.fromNumber(P).and(E$1.fromNumber(16383).shiftLeft(47))),b.high=b.high.or(V.high.and(E$1.fromNumber(0x7fffffffffff)))):(b.high=b.high.or(E$1.fromNumber(P&16383).shiftLeft(49)),b.high=b.high.or(V.high.and(E$1.fromNumber(562949953421311)))),b.low=V.low,i&&(b.high=b.high.or(E$1.fromString(`9223372036854775808`)));var N=A$1.alloc(16);return B=0,N[B++]=b.low.low&255,N[B++]=b.low.low>>8&255,N[B++]=b.low.low>>16&255,N[B++]=b.low.low>>24&255,N[B++]=b.low.high&255,N[B++]=b.low.high>>8&255,N[B++]=b.low.high>>16&255,N[B++]=b.low.high>>24&255,N[B++]=b.high.low&255,N[B++]=b.high.low>>8&255,N[B++]=b.high.low>>16&255,N[B++]=b.high.low>>24&255,N[B++]=b.high.high&255,N[B++]=b.high.high>>8&255,N[B++]=b.high.high>>16&255,N[B++]=b.high.high>>24&255,new r(N)},r.prototype.toString=function(){for(var t,i=0,f=new Array(36),c=0;c<f.length;c++)f[c]=0;var h=0,a=false,p,y={parts:[0,0,0,0]},v,m,w=[];h=0;var _=this.bytes,O=_[h++]|_[h++]<<8|_[h++]<<16|_[h++]<<24,S=_[h++]|_[h++]<<8|_[h++]<<16|_[h++]<<24,d=_[h++]|_[h++]<<8|_[h++]<<16|_[h++]<<24,M=_[h++]|_[h++]<<8|_[h++]<<16|_[h++]<<24;h=0;({low:new E$1(O,S),high:new E$1(d,M)}).high.lessThan(E$1.ZERO)&&w.push(`-`);var F=M>>26&ce$2;if(F>>3===3){if(F===le$2)return w.join(``)+`Infinity`;if(F===pe$2)return `NaN`;t=M>>15&fr$2,p=8+(M>>14&1);}else p=M>>14&7,t=M>>17&fr$2;var P=t-ir$2;if(y.parts[0]=(M&16383)+((p&15)<<14),y.parts[1]=d,y.parts[2]=S,y.parts[3]=O,y.parts[0]===0&&y.parts[1]===0&&y.parts[2]===0&&y.parts[3]===0)a=true;else for(m=3;m>=0;m--){var B=0,Y=ge$1(y);if(y=Y.quotient,B=Y.rem.low,!!B)for(v=8;v>=0;v--)f[m*9+v]=B%10,B=Math.floor(B/10);}if(a)i=1,f[h]=0;else for(i=36;!f[h];)i=i-1,h=h+1;var W=i-1+P;if(W>=34||W<=-7||P>0){if(i>34)return w.push(``.concat(0)),P>0?w.push(`E+`.concat(P)):P<0&&w.push(`E`.concat(P)),w.join(``);w.push(``.concat(f[h++])),i=i-1,i&&w.push(`.`);for(var c=0;c<i;c++)w.push(``.concat(f[h++]));w.push(`E`),W>0?w.push(`+`.concat(W)):w.push(``.concat(W));}else if(P>=0)for(var c=0;c<i;c++)w.push(``.concat(f[h++]));else {var q=i+P;if(q>0)for(var c=0;c<q;c++)w.push(``.concat(f[h++]));else w.push(`0`);for(w.push(`.`);q++<0;)w.push(`0`);for(var c=0;c<i-Math.max(q-1,0);c++)w.push(``.concat(f[h++]));}return w.join(``)},r.prototype.toJSON=function(){return {$numberDecimal:this.toString()}},r.prototype.toExtendedJSON=function(){return {$numberDecimal:this.toString()}},r.fromExtendedJSON=function(t){return r.fromString(t.$numberDecimal)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){return `new Decimal128("`.concat(this.toString(),`")`)},r})();Object.defineProperty(Yt$1.prototype,`_bsontype`,{value:`Decimal128`});var Ot$1=(function(){function r(t){if(!(this instanceof r))return new r(t);t instanceof Number&&(t=t.valueOf()),this.value=+t;}return r.prototype.valueOf=function(){return this.value},r.prototype.toJSON=function(){return this.value},r.prototype.toString=function(t){return this.value.toString(t)},r.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()}},r.fromExtendedJSON=function(t,i){var f=parseFloat(t.$numberDouble);return i&&i.relaxed?f:new r(f)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){var t=this.toExtendedJSON();return `new Double(`.concat(t.$numberDouble,`)`)},r})();Object.defineProperty(Ot$1.prototype,`_bsontype`,{value:`Double`});var It$1=(function(){function r(t){if(!(this instanceof r))return new r(t);t instanceof Number&&(t=t.valueOf()),this.value=+t|0;}return r.prototype.valueOf=function(){return this.value},r.prototype.toString=function(t){return this.value.toString(t)},r.prototype.toJSON=function(){return this.value},r.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},r.fromExtendedJSON=function(t,i){return i&&i.relaxed?parseInt(t.$numberInt,10):new r(t.$numberInt)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){return `new Int32(`.concat(this.valueOf(),`)`)},r})();Object.defineProperty(It$1.prototype,`_bsontype`,{value:`Int32`});var Jt$1=(function(){function r(){if(!(this instanceof r))return new r}return r.prototype.toExtendedJSON=function(){return {$maxKey:1}},r.fromExtendedJSON=function(){return new r},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){return `new MaxKey()`},r})();Object.defineProperty(Jt$1.prototype,`_bsontype`,{value:`MaxKey`});var Ht$1=(function(){function r(){if(!(this instanceof r))return new r}return r.prototype.toExtendedJSON=function(){return {$minKey:1}},r.fromExtendedJSON=function(){return new r},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){return `new MinKey()`},r})();Object.defineProperty(Ht$1.prototype,`_bsontype`,{value:`MinKey`});var me$2=new RegExp(`^[0-9a-fA-F]{24}$`),Q$2=null,z$1=Symbol(`id`),$$1=(function(){function r(t){if(!(this instanceof r))return new r(t);var i;if(typeof t==`object`&&t&&`id`in t){if(typeof t.id!=`string`&&!ArrayBuffer.isView(t.id))throw new L$2(`Argument passed in must have an id that is of type string or Buffer`);`toHexString`in t&&typeof t.toHexString==`function`?i=A$1.from(t.toHexString(),`hex`):i=t.id;}else i=t;if(i==null||typeof i==`number`)this[z$1]=r.generate(typeof i==`number`?i:void 0);else if(ArrayBuffer.isView(i)&&i.byteLength===12)this[z$1]=i instanceof A$1?i:vt(i);else if(typeof i==`string`)if(i.length===12){var f=A$1.from(i);if(f.byteLength===12)this[z$1]=f;else throw new L$2(`Argument passed in must be a string of 12 bytes`)}else if(i.length===24&&me$2.test(i))this[z$1]=A$1.from(i,`hex`);else throw new L$2(`Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer`);else throw new L$2(`Argument passed in does not match the accepted types`);r.cacheHexString&&(this.__id=this.id.toString(`hex`));}return Object.defineProperty(r.prototype,`id`,{get:function(){return this[z$1]},set:function(t){this[z$1]=t,r.cacheHexString&&(this.__id=t.toString(`hex`));},enumerable:false,configurable:true}),Object.defineProperty(r.prototype,`generationTime`,{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0);},enumerable:false,configurable:true}),r.prototype.toHexString=function(){if(r.cacheHexString&&this.__id)return this.__id;var t=this.id.toString(`hex`);return r.cacheHexString&&!this.__id&&(this.__id=t),t},r.getInc=function(){return r.index=(r.index+1)%16777215},r.generate=function(t){typeof t!=`number`&&(t=Math.floor(Date.now()/1e3));var i=r.getInc(),f=A$1.alloc(12);return f.writeUInt32BE(t,0),Q$2===null&&(Q$2=yr$1(5)),f[4]=Q$2[0],f[5]=Q$2[1],f[6]=Q$2[2],f[7]=Q$2[3],f[8]=Q$2[4],f[11]=i&255,f[10]=i>>8&255,f[9]=i>>16&255,f},r.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},r.prototype.toJSON=function(){return this.toHexString()},r.prototype.equals=function(t){if(t==null)return false;if(t instanceof r)return this[z$1][11]===t[z$1][11]&&this[z$1].equals(t[z$1]);if(typeof t==`string`&&r.isValid(t)&&t.length===12&&Ct$1(this.id))return t===A$1.prototype.toString.call(this.id,`latin1`);if(typeof t==`string`&&r.isValid(t)&&t.length===24)return t.toLowerCase()===this.toHexString();if(typeof t==`string`&&r.isValid(t)&&t.length===12)return A$1.from(t).equals(this.id);if(typeof t==`object`&&`toHexString`in t&&typeof t.toHexString==`function`){var i=t.toHexString(),f=this.toHexString().toLowerCase();return typeof i==`string`&&i.toLowerCase()===f}return false},r.prototype.getTimestamp=function(){var t=new Date,i=this.id.readUInt32BE(0);return t.setTime(Math.floor(i)*1e3),t},r.createPk=function(){return new r},r.createFromTime=function(t){var i=A$1.from([0,0,0,0,0,0,0,0,0,0,0,0]);return i.writeUInt32BE(t,0),new r(i)},r.createFromHexString=function(t){if(typeof t>`u`||t!=null&&t.length!==24)throw new L$2(`Argument passed in must be a single String of 12 bytes or a string of 24 hex characters`);return new r(A$1.from(t,`hex`))},r.isValid=function(t){if(t==null)return false;try{return new r(t),!0}catch{return false}},r.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString(`hex`)}},r.fromExtendedJSON=function(t){return new r(t.$oid)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r.prototype.inspect=function(){return `new ObjectId("`.concat(this.toHexString(),`")`)},r.index=Math.floor(Math.random()*16777215),r})();Object.defineProperty($$1.prototype,`generate`,{value:St$1(function(r){return $$1.generate(r)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty($$1.prototype,`getInc`,{value:St$1(function(){return $$1.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty($$1.prototype,`get_inc`,{value:St$1(function(){return $$1.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty($$1,`get_inc`,{value:St$1(function(){return $$1.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty($$1.prototype,`_bsontype`,{value:`ObjectID`});function _e$2(r){return r.split(``).sort().join(``)}var ct$1=(function(){function r(t,i){if(!(this instanceof r))return new r(t,i);if(this.pattern=t,this.options=_e$2(i??``),this.pattern.indexOf(`\0`)!==-1)throw new tt(`BSON Regex patterns cannot contain null bytes, found: `.concat(JSON.stringify(this.pattern)));if(this.options.indexOf(`\0`)!==-1)throw new tt(`BSON Regex options cannot contain null bytes, found: `.concat(JSON.stringify(this.options)));for(var f=0;f<this.options.length;f++)if(!(this.options[f]===`i`||this.options[f]===`m`||this.options[f]===`x`||this.options[f]===`l`||this.options[f]===`s`||this.options[f]===`u`))throw new tt(`The regular expression option [`.concat(this.options[f],`] is not supported`))}return r.parseOptions=function(t){return t?t.split(``).sort().join(``):``},r.prototype.toExtendedJSON=function(t){return t=t||{},t.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},r.fromExtendedJSON=function(t){if(`$regex`in t)if(typeof t.$regex!=`string`){if(t.$regex._bsontype===`BSONRegExp`)return t}else return new r(t.$regex,r.parseOptions(t.$options));if(`$regularExpression`in t)return new r(t.$regularExpression.pattern,r.parseOptions(t.$regularExpression.options));throw new L$2(`Unexpected BSONRegExp EJSON object form: `.concat(JSON.stringify(t)))},r})();Object.defineProperty(ct$1.prototype,`_bsontype`,{value:`BSONRegExp`});var Vt$1=(function(){function r(t){if(!(this instanceof r))return new r(t);this.value=t;}return r.prototype.valueOf=function(){return this.value},r.prototype.toString=function(){return this.value},r.prototype.inspect=function(){return `new BSONSymbol("`.concat(this.value,`")`)},r.prototype.toJSON=function(){return this.value},r.prototype.toExtendedJSON=function(){return {$symbol:this.value}},r.fromExtendedJSON=function(t){return new r(t.$symbol)},r.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=function(){return this.inspect()},r})();Object.defineProperty(Vt$1.prototype,`_bsontype`,{value:`Symbol`});var vr$1=(function(r){Bt$1(t,r);function t(i,f){var c=this;return c instanceof t?(E$1.isLong(i)?c=r.call(this,i.low,i.high,true)||this:lt$1(i)&&typeof i.t<`u`&&typeof i.i<`u`?c=r.call(this,i.i,i.t,true)||this:c=r.call(this,i,f,true)||this,Object.defineProperty(c,`_bsontype`,{value:`Timestamp`,writable:false,configurable:false,enumerable:false}),c):new t(i,f)}return t.prototype.toJSON=function(){return {$timestamp:this.toString()}},t.fromInt=function(i){return new t(E$1.fromInt(i,true))},t.fromNumber=function(i){return new t(E$1.fromNumber(i,true))},t.fromBits=function(i,f){return new t(i,f)},t.fromString=function(i,f){return new t(E$1.fromString(i,true,f))},t.prototype.toExtendedJSON=function(){return {$timestamp:{t:this.high>>>0,i:this.low>>>0}}},t.fromExtendedJSON=function(i){return new t(i.$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=E$1.MAX_UNSIGNED_VALUE,t})(E$1);function Ee$2(r){return lt$1(r)&&Reflect.has(r,`_bsontype`)&&typeof r._bsontype==`string`}var Er$1=2147483647,Br$2=-2147483648,Sr$1=0x8000000000000000,Nr$1=-9223372036854776e3,Be$1={$oid:$$1,$binary:rt$1,$uuid:rt$1,$symbol:Vt$1,$numberInt:It$1,$numberDecimal:Yt$1,$numberDouble:Ot$1,$numberLong:E$1,$minKey:Ht$1,$maxKey:Jt$1,$regex:ct$1,$regularExpression:ct$1,$timestamp:vr$1};function Or$1(r,t){if(t===void 0&&(t={}),typeof r==`number`){if(t.relaxed||t.legacy)return r;if(Math.floor(r)===r){if(r>=Br$2&&r<=Er$1)return new It$1(r);if(r>=Nr$1&&r<=Sr$1)return E$1.fromNumber(r)}return new Ot$1(r)}if(r==null||typeof r!=`object`)return r;if(r.$undefined)return null;for(var i=Object.keys(r).filter(function(w){return w.startsWith(`$`)&&r[w]!=null}),f=0;f<i.length;f++){var c=Be$1[i[f]];if(c)return c.fromExtendedJSON(r,t)}if(r.$date!=null){var h=r.$date,a=new Date;return t.legacy?typeof h==`number`?a.setTime(h):typeof h==`string`&&a.setTime(Date.parse(h)):typeof h==`string`?a.setTime(Date.parse(h)):E$1.isLong(h)?a.setTime(h.toNumber()):typeof h==`number`&&t.relaxed&&a.setTime(h),a}if(r.$code!=null){var p=Object.assign({},r);return r.$scope&&(p.$scope=Or$1(r.$scope)),Nt$1.fromExtendedJSON(r)}if(ie$2(r)||r.$dbPointer){var y=r.$ref?r:r.$dbPointer;if(y instanceof ht)return y;var v=Object.keys(y).filter(function(w){return w.startsWith(`$`)}),m=true;if(v.forEach(function(w){[`$ref`,`$id`,`$db`].indexOf(w)===-1&&(m=false);}),m)return ht.fromExtendedJSON(y)}return r}function Se$2(r,t){return r.map(function(i,f){t.seenObjects.push({propertyName:`index `.concat(f),obj:null});try{return k$2(i,t)}finally{t.seenObjects.pop();}})}function ur$2(r){var t=r.toISOString();return r.getUTCMilliseconds()!==0?t:t.slice(0,-5)+`Z`}function k$2(r,t){if((typeof r==`object`||typeof r==`function`)&&r!==null){var i=t.seenObjects.findIndex(function(D){return D.obj===r});if(i!==-1){var f=t.seenObjects.map(function(D){return D.propertyName}),c=f.slice(0,i).map(function(D){return ``.concat(D,` -> `)}).join(``),h=f[i],a=` -> `+f.slice(i+1,f.length-1).map(function(D){return ``.concat(D,` -> `)}).join(``),p=f[f.length-1],y=` `.repeat(c.length+h.length/2),v=`-`.repeat(a.length+(h.length+p.length)/2-1);throw new L$2(`Converting circular structure to EJSON:
19
19
  `+` `.concat(c).concat(h).concat(a).concat(p,`
20
- `)+` `.concat(y,`\\`).concat(v,`/`))}t.seenObjects[t.seenObjects.length-1].obj=r;}if(Array.isArray(r))return Se$2(r,t);if(r===void 0)return null;if(r instanceof Date||te$1(r)){var m=r.getTime(),w=m>-1&&m<0xe677d3328480;return t.legacy?t.relaxed&&w?{$date:r.getTime()}:{$date:ur$2(r)}:t.relaxed&&w?{$date:ur$2(r)}:{$date:{$numberLong:r.getTime().toString()}}}if(typeof r==`number`&&(!t.relaxed||!isFinite(r))){if(Math.floor(r)===r){var _=r>=Br$2&&r<=Er$2,O=r>=Nr$1&&r<=Sr$1;if(_)return {$numberInt:r.toString()};if(O)return {$numberLong:r.toString()}}return {$numberDouble:r.toString()}}if(r instanceof RegExp||Qr$2(r)){var S=r.flags;if(S===void 0){var d=r.toString().match(/[gimuy]*$/);d&&(S=d[0]);}return new ct$1(r.source,S).toExtendedJSON(t)}return r!=null&&typeof r==`object`?Oe$2(r,t):r}var Ne$1={Binary:function(r){return new rt(r.value(),r.sub_type)},Code:function(r){return new Nt$1(r.code,r.scope)},DBRef:function(r){return new ht(r.collection||r.namespace,r.oid,r.db,r.fields)},Decimal128:function(r){return new Yt$1(r.bytes)},Double:function(r){return new Ot$1(r.value)},Int32:function(r){return new It$1(r.value)},Long:function(r){return E$1.fromBits(r.low!=null?r.low:r.low_,r.low!=null?r.high:r.high_,r.low!=null?r.unsigned:r.unsigned_)},MaxKey:function(){return new Jt$1},MinKey:function(){return new Ht$1},ObjectID:function(r){return new $$1(r)},ObjectId:function(r){return new $$1(r)},BSONRegExp:function(r){return new ct$1(r.pattern,r.options)},Symbol:function(r){return new Vt$1(r.value)},Timestamp:function(r){return vr$1.fromBits(r.low,r.high)}};function Oe$2(r,t){if(r==null||typeof r!=`object`)throw new tt(`not an object instance`);var i=r._bsontype;if(typeof i>`u`){var f={};for(var c in r){t.seenObjects.push({propertyName:c,obj:null});try{var h=k$2(r[c],t);c===`__proto__`?Object.defineProperty(f,c,{value:h,writable:!0,enumerable:!0,configurable:!0}):f[c]=h;}finally{t.seenObjects.pop();}}return f}else if(Ee$2(r)){var a=r;if(typeof a.toExtendedJSON!=`function`){var p=Ne$1[r._bsontype];if(!p)throw new L$2(`Unrecognized or invalid _bsontype: `+r._bsontype);a=p(a);}return i===`Code`&&a.scope?a=new Nt$1(a.code,k$2(a.scope,t)):i===`DBRef`&&a.oid&&(a=new ht(k$2(a.collection,t),k$2(a.oid,t),k$2(a.db,t),k$2(a.fields,t))),a.toExtendedJSON(t)}else throw new tt(`_bsontype must be a string, but was: `+typeof i)}var hr$2;(function(r){function t(h,a){var p=Object.assign({},{relaxed:true,legacy:false},a);return typeof p.relaxed==`boolean`&&(p.strict=!p.relaxed),typeof p.strict==`boolean`&&(p.relaxed=!p.strict),JSON.parse(h,function(y,v){if(y.indexOf(`\0`)!==-1)throw new tt(`BSON Document field names cannot contain null bytes, found: `.concat(JSON.stringify(y)));return Or$1(v,p)})}r.parse=t;function i(h,a,p,y){p!=null&&typeof p==`object`&&(y=p,p=0),a!=null&&typeof a==`object`&&!Array.isArray(a)&&(y=a,a=void 0,p=0);var m=k$2(h,Object.assign({relaxed:true,legacy:false},y,{seenObjects:[{propertyName:`(root)`,obj:null}]}));return JSON.stringify(m,a,p)}r.stringify=i;function f(h,a){return a=a||{},JSON.parse(i(h,a))}r.serialize=f;function c(h,a){return a=a||{},t(JSON.stringify(h),a)}r.deserialize=c;})(hr$2||(hr$2={}));var lr$2=gr$2();lr$2.Map?lr$2.Map:(function(){function r(t){t===void 0&&(t=[]),this._keys=[],this._values={};for(var i=0;i<t.length;i++)if(t[i]!=null){var f=t[i],c=f[0],h=f[1];this._keys.push(c),this._values[c]={v:h,i:this._keys.length-1};}}return r.prototype.clear=function(){this._keys=[],this._values={};},r.prototype.delete=function(t){var i=this._values[t];return i==null?false:(delete this._values[t],this._keys.splice(i.i,1),true)},r.prototype.entries=function(){var t=this,i=0;return {next:function(){var f=t._keys[i++];return {value:f!==void 0?[f,t._values[f].v]:void 0,done:f===void 0}}}},r.prototype.forEach=function(t,i){i=i||this;for(var f=0;f<this._keys.length;f++){var c=this._keys[f];t.call(i,this._values[c].v,c,i);}},r.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},r.prototype.has=function(t){return this._values[t]!=null},r.prototype.keys=function(){var t=this,i=0;return {next:function(){var f=t._keys[i++];return {value:f!==void 0?f:void 0,done:f===void 0}}}},r.prototype.set=function(t,i){return this._values[t]?(this._values[t].v=i,this):(this._keys.push(t),this._values[t]={v:i,i:this._keys.length-1},this)},r.prototype.values=function(){var t=this,i=0;return {next:function(){var f=t._keys[i++];return {value:f!==void 0?t._values[f].v:void 0,done:f===void 0}}}},Object.defineProperty(r.prototype,`size`,{get:function(){return this._keys.length},enumerable:false,configurable:true}),r})();E$1.fromNumber(ee$2);E$1.fromNumber(ne);var jt$1=new Uint8Array(8);new DataView(jt$1.buffer,jt$1.byteOffset,jt$1.byteLength);A$1.alloc(1024*1024*17);var Ir$1=class Ir{constructor(t,i={},f,c){this.name=t;this.properties=i;this.id=c?new $$1(c):new $$1,this.occurred=new Date,f&&(this.trigger=new mt$1(f)),this.newEvent=!c;}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});}};var Ar=x$2(dr$2());var be$1=[`utm_source`,`utm_medium`,`utm_campaign`,`utm_term`,`utm_content`,`utm_id`],br$2={utm_source:`tw_source`,utm_campaign:`tw_campaign`},Ae$2=`cooee_ai`,Ye$1=()=>{if(document.referrer)return document.referrer.replace(location.origin,``)},Je$1=()=>{let r$1;try{r$1=new Ar.URLBuilder(location.href);}catch{return {}}let t={};be$1.forEach(f=>{let c=r$1.getQueryParam(f);c&&(t[f]=c);});let i={};return Object.keys(br$2).forEach(f=>{let c=r$1.getQueryParam(br$2[f]);c&&(i[f]=c);}),r(r({},i),t)};function He$1(r,t){if(!r)return ``;let i=t?t.objective.toLowerCase().toString():`cooee_widget`,f=t?t.shortID:``,c=new URL(r,location.origin);return c.searchParams.set(`utm_source`,Ae$2),c.searchParams.set(`utm_medium`,`onsite_widget`),c.searchParams.set(`utm_campaign`,i),c.searchParams.set(`utm_content`,f),c.toString()}var Ve$1=(r,t)=>{let i=new URL(r);return t.shortID&&i.searchParams.set(`ceevid`,t.shortID+``),i.toString()},We$1=()=>new URLSearchParams(location.search).get(`ceevid`);
20
+ `)+` `.concat(y,`\\`).concat(v,`/`))}t.seenObjects[t.seenObjects.length-1].obj=r;}if(Array.isArray(r))return Se$2(r,t);if(r===void 0)return null;if(r instanceof Date||te$1(r)){var m=r.getTime(),w=m>-1&&m<0xe677d3328480;return t.legacy?t.relaxed&&w?{$date:r.getTime()}:{$date:ur$2(r)}:t.relaxed&&w?{$date:ur$2(r)}:{$date:{$numberLong:r.getTime().toString()}}}if(typeof r==`number`&&(!t.relaxed||!isFinite(r))){if(Math.floor(r)===r){var _=r>=Br$2&&r<=Er$1,O=r>=Nr$1&&r<=Sr$1;if(_)return {$numberInt:r.toString()};if(O)return {$numberLong:r.toString()}}return {$numberDouble:r.toString()}}if(r instanceof RegExp||Qr$2(r)){var S=r.flags;if(S===void 0){var d=r.toString().match(/[gimuy]*$/);d&&(S=d[0]);}return new ct$1(r.source,S).toExtendedJSON(t)}return r!=null&&typeof r==`object`?Oe$2(r,t):r}var Ne={Binary:function(r){return new rt$1(r.value(),r.sub_type)},Code:function(r){return new Nt$1(r.code,r.scope)},DBRef:function(r){return new ht(r.collection||r.namespace,r.oid,r.db,r.fields)},Decimal128:function(r){return new Yt$1(r.bytes)},Double:function(r){return new Ot$1(r.value)},Int32:function(r){return new It$1(r.value)},Long:function(r){return E$1.fromBits(r.low!=null?r.low:r.low_,r.low!=null?r.high:r.high_,r.low!=null?r.unsigned:r.unsigned_)},MaxKey:function(){return new Jt$1},MinKey:function(){return new Ht$1},ObjectID:function(r){return new $$1(r)},ObjectId:function(r){return new $$1(r)},BSONRegExp:function(r){return new ct$1(r.pattern,r.options)},Symbol:function(r){return new Vt$1(r.value)},Timestamp:function(r){return vr$1.fromBits(r.low,r.high)}};function Oe$2(r,t){if(r==null||typeof r!=`object`)throw new tt(`not an object instance`);var i=r._bsontype;if(typeof i>`u`){var f={};for(var c in r){t.seenObjects.push({propertyName:c,obj:null});try{var h=k$2(r[c],t);c===`__proto__`?Object.defineProperty(f,c,{value:h,writable:!0,enumerable:!0,configurable:!0}):f[c]=h;}finally{t.seenObjects.pop();}}return f}else if(Ee$2(r)){var a=r;if(typeof a.toExtendedJSON!=`function`){var p=Ne[r._bsontype];if(!p)throw new L$2(`Unrecognized or invalid _bsontype: `+r._bsontype);a=p(a);}return i===`Code`&&a.scope?a=new Nt$1(a.code,k$2(a.scope,t)):i===`DBRef`&&a.oid&&(a=new ht(k$2(a.collection,t),k$2(a.oid,t),k$2(a.db,t),k$2(a.fields,t))),a.toExtendedJSON(t)}else throw new tt(`_bsontype must be a string, but was: `+typeof i)}var hr$2;(function(r){function t(h,a){var p=Object.assign({},{relaxed:true,legacy:false},a);return typeof p.relaxed==`boolean`&&(p.strict=!p.relaxed),typeof p.strict==`boolean`&&(p.relaxed=!p.strict),JSON.parse(h,function(y,v){if(y.indexOf(`\0`)!==-1)throw new tt(`BSON Document field names cannot contain null bytes, found: `.concat(JSON.stringify(y)));return Or$1(v,p)})}r.parse=t;function i(h,a,p,y){p!=null&&typeof p==`object`&&(y=p,p=0),a!=null&&typeof a==`object`&&!Array.isArray(a)&&(y=a,a=void 0,p=0);var m=k$2(h,Object.assign({relaxed:true,legacy:false},y,{seenObjects:[{propertyName:`(root)`,obj:null}]}));return JSON.stringify(m,a,p)}r.stringify=i;function f(h,a){return a=a||{},JSON.parse(i(h,a))}r.serialize=f;function c(h,a){return a=a||{},t(JSON.stringify(h),a)}r.deserialize=c;})(hr$2||(hr$2={}));var lr$2=gr$2();lr$2.Map?lr$2.Map:(function(){function r(t){t===void 0&&(t=[]),this._keys=[],this._values={};for(var i=0;i<t.length;i++)if(t[i]!=null){var f=t[i],c=f[0],h=f[1];this._keys.push(c),this._values[c]={v:h,i:this._keys.length-1};}}return r.prototype.clear=function(){this._keys=[],this._values={};},r.prototype.delete=function(t){var i=this._values[t];return i==null?false:(delete this._values[t],this._keys.splice(i.i,1),true)},r.prototype.entries=function(){var t=this,i=0;return {next:function(){var f=t._keys[i++];return {value:f!==void 0?[f,t._values[f].v]:void 0,done:f===void 0}}}},r.prototype.forEach=function(t,i){i=i||this;for(var f=0;f<this._keys.length;f++){var c=this._keys[f];t.call(i,this._values[c].v,c,i);}},r.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},r.prototype.has=function(t){return this._values[t]!=null},r.prototype.keys=function(){var t=this,i=0;return {next:function(){var f=t._keys[i++];return {value:f!==void 0?f:void 0,done:f===void 0}}}},r.prototype.set=function(t,i){return this._values[t]?(this._values[t].v=i,this):(this._keys.push(t),this._values[t]={v:i,i:this._keys.length-1},this)},r.prototype.values=function(){var t=this,i=0;return {next:function(){var f=t._keys[i++];return {value:f!==void 0?t._values[f].v:void 0,done:f===void 0}}}},Object.defineProperty(r.prototype,`size`,{get:function(){return this._keys.length},enumerable:false,configurable:true}),r})();E$1.fromNumber(ee$2);E$1.fromNumber(ne);var jt=new Uint8Array(8);new DataView(jt.buffer,jt.byteOffset,jt.byteLength);A$1.alloc(1024*1024*17);var Ir$1=class Ir{constructor(t,i={},f,c){this.name=t;this.properties=i;this.id=c?new $$1(c):new $$1,this.occurred=new Date,f&&(this.trigger=new mt$1(f)),this.newEvent=!c;}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});}};var Ar=x$2(dr$2());var be$1=[`utm_source`,`utm_medium`,`utm_campaign`,`utm_term`,`utm_content`,`utm_id`],br$2={utm_source:`tw_source`,utm_campaign:`tw_campaign`},Ae$2=`cooee_ai`,Ye$1=()=>{if(document.referrer)return document.referrer.replace(location.origin,``)},Je=()=>{let r$1;try{r$1=new Ar.URLBuilder(location.href);}catch{return {}}let t={};be$1.forEach(f=>{let c=r$1.getQueryParam(f);c&&(t[f]=c);});let i={};return Object.keys(br$2).forEach(f=>{let c=r$1.getQueryParam(br$2[f]);c&&(i[f]=c);}),r(r({},i),t)};function He$1(r,t){if(!r)return ``;let i=t?t.objective.toLowerCase().toString():`cooee_widget`,f=t?t.shortID:``,c=new URL(r,location.origin);return c.searchParams.set(`utm_source`,Ae$2),c.searchParams.set(`utm_medium`,`onsite_widget`),c.searchParams.set(`utm_campaign`,i),c.searchParams.set(`utm_content`,f),c.toString()}var Ve$1=(r,t)=>{let i=new URL(r);return t.shortID&&i.searchParams.set(`ceevid`,t.shortID+``),i.toString()},We$1=()=>new URLSearchParams(location.search).get(`ceevid`);
21
21
 
22
22
  function u$1(r){return typeof r==`function`}function R(r){let t=r(o=>{Error.call(o),o.stack=new Error().stack;});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var G$1=R(r=>function(t){r(this),this.message=t?`${t.length} errors occurred during unsubscription:
23
23
  ${t.map((o,n)=>`${n+1}) ${o.toString()}`).join(`
24
- `)}`:``,this.name=`UnsubscriptionError`,this.errors=t;});function P(r,e){if(r){let t=r.indexOf(e);0<=t&&r.splice(t,1);}}var v=class r{constructor(e){this.initialTeardown=e,this.closed=false,this._parentage=null,this._finalizers=null;}unsubscribe(){let e;if(!this.closed){this.closed=true;let{_parentage:t}=this;if(t)if(this._parentage=null,Array.isArray(t))for(let i of t)i.remove(this);else t.remove(this);let{initialTeardown:o}=this;if(u$1(o))try{o();}catch(i){e=i instanceof G$1?i.errors:[i];}let{_finalizers:n}=this;if(n){this._finalizers=null;for(let i of n)try{Pr(i);}catch(s){e=e??[],s instanceof G$1?e=[...e,...s.errors]:e.push(s);}}if(e)throw new G$1(e)}}add(e){var t;if(e&&e!==this)if(this.closed)Pr(e);else {if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this);}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e);}}_hasParent(e){let{_parentage:t}=this;return t===e||Array.isArray(t)&&t.includes(e)}_addParent(e){let{_parentage:t}=this;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e;}_removeParent(e){let{_parentage:t}=this;t===e?this._parentage=null:Array.isArray(t)&&P(t,e);}remove(e){let{_finalizers:t}=this;t&&P(t,e),e instanceof r&&e._removeParent(this);}};v.EMPTY=(()=>{let r=new v;return r.closed=true,r})();var br$1=v.EMPTY;function K$1(r){return r instanceof v||r&&`closed`in r&&u$1(r.remove)&&u$1(r.add)&&u$1(r.unsubscribe)}function Pr(r){u$1(r)?r():r.unsubscribe();}var w={Promise:void 0};var L$1={setTimeout(r,e,...t){return setTimeout(r,e,...t)},clearTimeout(r){return (clearTimeout)(r)},delegate:void 0};function H$2(r){L$1.setTimeout(()=>{throw r});}function V$2(){}function M$2(r){r();}var j$1=class j extends v{constructor(e){super(),this.isStopped=false,e?(this.destination=e,K$1(e)&&e.add(this)):this.destination=se;}static create(e,t,o){return new O(e,t,o)}next(e){this.isStopped?_r():this._next(e);}error(e){this.isStopped?_r():(this.isStopped=true,this._error(e));}complete(){this.isStopped?_r():(this.isStopped=true,this._complete());}unsubscribe(){this.closed||(this.isStopped=true,super.unsubscribe(),this.destination=null);}_next(e){this.destination.next(e);}_error(e){try{this.destination.error(e);}finally{this.unsubscribe();}}_complete(){try{this.destination.complete();}finally{this.unsubscribe();}}};var wr$1=class wr{constructor(e){this.partialObserver=e;}next(e){let{partialObserver:t}=this;if(t.next)try{t.next(e);}catch(o){J(o);}}error(e){let{partialObserver:t}=this;if(t.error)try{t.error(e);}catch(o){J(o);}else J(e);}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete();}catch(t){J(t);}}},O=class extends j$1{constructor(e,t,o){super();let n;if(u$1(e)||!e)n={next:e??void 0,error:t??void 0,complete:o??void 0};else {n=e;}this.destination=new wr$1(n);}};function J(r){H$2(r);}function ie$1(r){throw r}function _r(r,e){}var se={closed:true,next:V$2,error:ie$1,complete:V$2};var k$1=typeof Symbol==`function`&&Symbol.observable||`@@observable`;function T(r){return r}function Rr(r){return r.length===0?T:r.length===1?r[0]:function(t){return r.reduce((o,n)=>n(o),t)}}var m=(()=>{class r{constructor(t){t&&(this._subscribe=t);}lift(t){let o=new r;return o.source=this,o.operator=t,o}subscribe(t,o,n){let i=ce$1(t)?t:new O(t,o,n);return M$2(()=>{let{operator:s,source:c}=this;i.add(s?s.call(i,c):c?this._subscribe(i):this._trySubscribe(i));}),i}_trySubscribe(t){try{return this._subscribe(t)}catch(o){t.error(o);}}forEach(t,o){return o=Lr(o),new o((n,i)=>{let s=new O({next:c=>{try{t(c);}catch(f){i(f),s.unsubscribe();}},error:i,complete:n});this.subscribe(s);})}_subscribe(t){var o;return (o=this.source)===null||o===void 0?void 0:o.subscribe(t)}[k$1](){return this}pipe(...t){return Rr(t)(this)}toPromise(t){return t=Lr(t),new t((o,n)=>{let i;this.subscribe(s=>i=s,s=>n(s),()=>o(i));})}}return r.create=e=>new r(e),r})();function Lr(r){var e;return (e=r??w.Promise)!==null&&e!==void 0?e:Promise}function fe$1(r){return r&&u$1(r.next)&&u$1(r.error)&&u$1(r.complete)}function ce$1(r){return r&&r instanceof j$1||fe$1(r)&&K$1(r)}var Mr=R(r=>function(){r(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`;});var U=(()=>{class r extends m{constructor(){super(),this.closed=false,this.currentObservers=null,this.observers=[],this.isStopped=false,this.hasError=false,this.thrownError=null;}lift(t){let o=new Q$1(this,this);return o.operator=t,o}_throwIfClosed(){if(this.closed)throw new Mr}next(t){M$2(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let o of this.currentObservers)o.next(t);}});}error(t){M$2(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=true,this.thrownError=t;let{observers:o}=this;for(;o.length;)o.shift().error(t);}});}complete(){M$2(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=true;let{observers:t}=this;for(;t.length;)t.shift().complete();}});}unsubscribe(){this.isStopped=this.closed=true,this.observers=this.currentObservers=null;}get observed(){var t;return ((t=this.observers)===null||t===void 0?void 0:t.length)>0}_trySubscribe(t){return this._throwIfClosed(),super._trySubscribe(t)}_subscribe(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)}_innerSubscribe(t){let{hasError:o,isStopped:n,observers:i}=this;return o||n?br$1:(this.currentObservers=null,i.push(t),new v(()=>{this.currentObservers=null,P(i,t);}))}_checkFinalizedStatuses(t){let{hasError:o,thrownError:n,isStopped:i}=this;o?t.error(n):i&&t.complete();}asObservable(){let t=new m;return t.source=this,t}}return r.create=(e,t)=>new Q$1(e,t),r})(),Q$1=class Q extends U{constructor(e,t){super(),this.destination=e,this.source=t;}next(e){var t,o;(o=(t=this.destination)===null||t===void 0?void 0:t.next)===null||o===void 0||o.call(t,e);}error(e){var t,o;(o=(t=this.destination)===null||t===void 0?void 0:t.error)===null||o===void 0||o.call(t,e);}complete(){var e,t;(t=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||t===void 0||t.call(e);}_subscribe(e){var t,o;return (o=(t=this.source)===null||t===void 0?void 0:t.subscribe(e))!==null&&o!==void 0?o:br$1}};var Sr=class extends U{constructor(e){super(),this._value=e;}get value(){return this.getValue()}_subscribe(e){let t=super._subscribe(e);return !t.closed&&e.next(this._value),t}getValue(){let{hasError:e,thrownError:t,_value:o}=this;if(e)throw t;return this._throwIfClosed(),o}next(e){super.next(this._value=e);}};var Y={now(){return (Y.delegate||Date).now()},delegate:void 0};var gr$1=class gr extends U{constructor(e=Infinity,t=Infinity,o=Y){super(),this._bufferSize=e,this._windowTime=t,this._timestampProvider=o,this._buffer=[],this._infiniteTimeWindow=true,this._infiniteTimeWindow=t===Infinity,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,t);}next(e){let{isStopped:t,_buffer:o,_infiniteTimeWindow:n,_timestampProvider:i,_windowTime:s}=this;t||(o.push(e),!n&&o.push(i.now()+s)),this._trimBuffer(),super.next(e);}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let t=this._innerSubscribe(e),{_infiniteTimeWindow:o,_buffer:n}=this,i=n.slice();for(let s=0;s<i.length&&!e.closed;s+=o?1:2)e.next(i[s]);return this._checkFinalizedStatuses(e),t}_trimBuffer(){let{_bufferSize:e,_timestampProvider:t,_buffer:o,_infiniteTimeWindow:n}=this,i=(n?1:2)*e;if(e<Infinity&&i<o.length&&o.splice(0,o.length-i),!n){let s=t.now(),c=0;for(let f=1;f<o.length&&o[f]<=s;f+=2)c=f;c&&o.splice(0,c+1);}}};var kr=R(r=>function(){r(this),this.name=`EmptyError`,this.message=`no elements in sequence`;});function le$1(r,e){return new Promise((o,n)=>{let i=new O({next:s=>{o(s),i.unsubscribe();},error:n,complete:()=>{n(new kr);}});r.subscribe(i);})}function ue(r){return u$1(r?.lift)}function p$1(r){return e=>{if(ue(e))return e.lift(function(t){try{return r(t,this)}catch(o){this.error(o);}});throw new TypeError(`Unable to lift unknown Observable type`)}}function a$1(r,e,t,o,n){return new Er$1(r,e,t,o,n)}var Er$1=class Er extends j$1{constructor(e,t,o,n,i,s){super(e),this.onFinalize=i,this.shouldUnsubscribe=s,this._next=t?function(c){try{t(c);}catch(f){e.error(f);}}:super._next,this._error=n?function(c){try{n(c);}catch(f){e.error(f);}finally{this.unsubscribe();}}:super._error,this._complete=o?function(){try{o();}catch(c){e.error(c);}finally{this.unsubscribe();}}:super._complete;}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:t}=this;super.unsubscribe(),!t&&((e=this.onFinalize)===null||e===void 0||e.call(this));}}};function q$1(r,e){return p$1((t,o)=>{let n=0;t.subscribe(a$1(o,i=>{o.next(r.call(e,i,n++));}));})}function Dr(r,e,t,o){function n(i){return i instanceof t?i:new t(function(s){s(i);})}return new(t||(t=Promise))(function(i,s){function c(b){try{l(o.next(b));}catch(y){s(y);}}function f(b){try{l(o.throw(b));}catch(y){s(y);}}function l(b){b.done?i(b.value):n(b.value).then(c,f);}l((o=o.apply(r,[])).next());})}function Ur(r){var e=typeof Symbol==`function`&&Symbol.iterator,t=e&&r[e],o=0;if(t)return t.call(r);if(r&&typeof r.length==`number`)return {next:function(){return r&&o>=r.length&&(r=void 0),{value:r&&r[o++],done:!r}}};throw new TypeError(e?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function F(r){return this instanceof F?(this.v=r,this):new F(r)}function Wr$1(r,e,t){if(!Symbol.asyncIterator)throw new TypeError(`Symbol.asyncIterator is not defined.`);var o=t.apply(r,e||[]),n,i=[];return n=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),c(`next`),c(`throw`),c(`return`,s),n[Symbol.asyncIterator]=function(){return this},n;function s(d){return function(x){return Promise.resolve(x).then(d,y)}}function c(d,x){o[d]&&(n[d]=function(S){return new Promise(function(B,g){i.push([d,S,B,g])>1||f(d,S);})},x&&(n[d]=x(n[d])));}function f(d,x){try{l(o[d](x));}catch(S){E(i[0][3],S);}}function l(d){d.value instanceof F?Promise.resolve(d.value.v).then(b,y):E(i[0][2],d);}function b(d){f(`next`,d);}function y(d){f(`throw`,d);}function E(d,x){d(x),i.shift(),i.length&&f(i[0][0],i[0][1]);}}function zr$1(r){if(!Symbol.asyncIterator)throw new TypeError(`Symbol.asyncIterator is not defined.`);var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Ur==`function`?Ur(r):r[Symbol.iterator](),t={},o(`next`),o(`throw`),o(`return`),t[Symbol.asyncIterator]=function(){return this},t);function o(i){t[i]=r[i]&&function(s){return new Promise(function(c,f){s=r[i](s),n(c,f,s.done,s.value);})};}function n(i,s,c,f){Promise.resolve(f).then(function(l){i({value:l,done:c});},s);}}var D$1=r=>r&&typeof r.length==`number`&&typeof r!=`function`;function X$1(r){return u$1(r?.then)}function Z$1(r){return u$1(r[k$1])}function rr$1(r){return Symbol.asyncIterator&&u$1(r?.[Symbol.asyncIterator])}function er$1(r){return new TypeError(`You provided ${r!==null&&typeof r==`object`?`an invalid object`:`'${r}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function pe$1(){return typeof Symbol!=`function`||!Symbol.iterator?`@@iterator`:Symbol.iterator}var tr$1=pe$1();function or$1(r){return u$1(r?.[tr$1])}function nr$1(r){return Wr$1(this,arguments,function*(){let t=r.getReader();try{for(;;){let{value:o,done:n}=yield F(t.read());if(n)return yield F(void 0);yield yield F(o);}}finally{t.releaseLock();}})}function ir$1(r){return u$1(r?.getReader)}function h(r){if(r instanceof m)return r;if(r!=null){if(Z$1(r))return ae(r);if(D$1(r))return me$1(r);if(X$1(r))return de$1(r);if(rr$1(r))return Vr$1(r);if(or$1(r))return he$1(r);if(ir$1(r))return xe(r)}throw er$1(r)}function ae(r){return new m(e=>{let t=r[k$1]();if(u$1(t.subscribe))return t.subscribe(e);throw new TypeError(`Provided object does not correctly implement Symbol.observable`)})}function me$1(r){return new m(e=>{for(let t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete();})}function de$1(r){return new m(e=>{r.then(t=>{e.closed||(e.next(t),e.complete());},t=>e.error(t)).then(null,H$2);})}function he$1(r){return new m(e=>{for(let t of r)if(e.next(t),e.closed)return;e.complete();})}function Vr$1(r){return new m(e=>{be(r,e).catch(t=>e.error(t));})}function xe(r){return Vr$1(nr$1(r))}function be(r,e){var t,o,n,i;return Dr(this,void 0,void 0,function*(){try{for(t=zr$1(r);o=yield t.next(),!o.done;){let s=o.value;if(e.next(s),e.closed)return}}catch(s){n={error:s};}finally{try{o&&!o.done&&(i=t.return)&&(yield i.call(t));}finally{if(n)throw n.error}}e.complete();})}function ye$1(r){return new m(e=>{h(r()).subscribe(e);})}function _$1(r,e,t,o=0,n=false){let i=e.schedule(function(){t(),n?r.add(this.schedule(null,o)):this.unsubscribe();},o);if(r.add(i),!n)return i}function Yr$1(r,e,t,o,n,i,s,c){let f=[],l=0,b=0,y=false,E=()=>{y&&!f.length&&!l&&e.complete();},d=S=>l<o?x(S):f.push(S),x=S=>{l++;let B=false;h(t(S,b++)).subscribe(a$1(e,g=>{e.next(g);},()=>{B=true;},void 0,()=>{if(B)try{for(l--;f.length&&l<o;){let g=f.shift();s?_$1(e,s,()=>x(g)):x(g);}E();}catch(g){e.error(g);}}));};return r.subscribe(a$1(e,d,()=>{y=true,E();})),()=>{}}function N$1(r,e,t=Infinity){return u$1(e)?N$1((o,n)=>q$1((i,s)=>e(o,i,n,s))(h(r(o,n))),t):(typeof e==`number`&&(t=e),p$1((o,n)=>Yr$1(o,n,r,t)))}function sr$1(r=Infinity){return N$1(T,r)}var fr$1=new m(r=>r.complete());function cr$1(r){return r&&u$1(r.schedule)}function qr$1(r){return r[r.length-1]}function I(r){return cr$1(qr$1(r))?r.pop():void 0}function Nr(r,e){return typeof qr$1(r)==`number`?r.pop():e}function lr$1(r,e=0){return p$1((t,o)=>{t.subscribe(a$1(o,n=>_$1(o,r,()=>o.next(n),e),()=>_$1(o,r,()=>o.complete(),e),n=>_$1(o,r,()=>o.error(n),e)));})}function ur$1(r,e=0){return p$1((t,o)=>{o.add(r.schedule(()=>t.subscribe(o),e));})}function $r$1(r,e){return h(r).pipe(ur$1(e),lr$1(e))}function Br$1(r,e){return h(r).pipe(ur$1(e),lr$1(e))}function Gr$1(r,e){return new m(t=>{let o=0;return e.schedule(function(){o===r.length?t.complete():(t.next(r[o++]),t.closed||this.schedule());})})}function Kr$1(r,e){return new m(t=>{let o;return _$1(t,e,()=>{o=r[tr$1](),_$1(t,e,()=>{let n,i;try{({value:n,done:i}=o.next());}catch(s){t.error(s);return}i?t.complete():t.next(n);},0,true);}),()=>u$1(o?.return)&&o.return()})}function pr$1(r,e){if(!r)throw new Error(`Iterable cannot be null`);return new m(t=>{_$1(t,e,()=>{let o=r[Symbol.asyncIterator]();_$1(t,e,()=>{o.next().then(n=>{n.done?t.complete():t.next(n.value);});},0,true);});})}function Hr$1(r,e){return pr$1(nr$1(r),e)}function Jr$1(r,e){if(r!=null){if(Z$1(r))return $r$1(r,e);if(D$1(r))return Gr$1(r,e);if(X$1(r))return Br$1(r,e);if(rr$1(r))return pr$1(r,e);if(or$1(r))return Kr$1(r,e);if(ir$1(r))return Hr$1(r,e)}throw er$1(r)}function W$1(r,e){return e?Jr$1(r,e):h(r)}function ve(...r){let e=I(r),t=Nr(r,Infinity),o=r;return o.length?o.length===1?h(o[0]):sr$1(t)(W$1(o,e)):fr$1}function Nn$1(r){return r<=0?()=>fr$1:p$1((e,t)=>{let o=0;e.subscribe(a$1(t,n=>{++o<=r&&(t.next(n),r<=o&&t.complete());}));})}function Qr$1(){return sr$1(1)}function Or(...r){return Qr$1()(W$1(r,I(r)))}function _e$1(...r){let e=I(r);return p$1((t,o)=>{(e?Or(r,t,e):Or(r,t)).subscribe(o);})}function ii$1(r,e){return p$1((t,o)=>{let n=null,i=0,s=!1,c=()=>s&&!n&&o.complete();t.subscribe(a$1(o,f=>{n?.unsubscribe();let l=0,b=i++;h(r(f,b)).subscribe(n=a$1(o,y=>o.next(e?e(f,y,b,l++):y),()=>{n=null,c();}));},()=>{s=!0,c();}));})}function pi$1(r){return p$1((e,t)=>{h(r).subscribe(a$1(t,()=>t.complete(),V$2)),!t.closed&&e.subscribe(t);})}function bi$1(r,e,t){let o=u$1(r)||e||t?{next:r,error:e,complete:t}:r;return o?p$1((n,i)=>{var s;(s=o.subscribe)===null||s===void 0||s.call(o);let c=!0;n.subscribe(a$1(i,f=>{var l;(l=o.next)===null||l===void 0||l.call(o,f),i.next(f);},()=>{var f;c=!1,(f=o.complete)===null||f===void 0||f.call(o),i.complete();},f=>{var l;c=!1,(l=o.error)===null||l===void 0||l.call(o,f),i.error(f);},()=>{var f,l;c&&((f=o.unsubscribe)===null||f===void 0||f.call(o)),(l=o.finalize)===null||l===void 0||l.call(o);}));}):T}var ar$1=class ar extends v{constructor(e,t){super();}schedule(e,t=0){return this}};var $={setInterval(r,e,...t){let{delegate:o}=$;return o?.setInterval?o.setInterval(r,e,...t):setInterval(r,e,...t)},clearInterval(r){return (clearInterval)(r)},delegate:void 0};var mr$1=class mr extends ar$1{constructor(e,t){super(e,t),this.scheduler=e,this.work=t,this.pending=false;}schedule(e,t=0){var o;if(this.closed)return this;this.state=e;let n=this.id,i=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(i,n,t)),this.pending=true,this.delay=t,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(i,this.id,t),this}requestAsyncId(e,t,o=0){return $.setInterval(e.flush.bind(e,this),o)}recycleAsyncId(e,t,o=0){if(o!=null&&this.delay===o&&this.pending===false)return t;t!=null&&$.clearInterval(t);}execute(e,t){if(this.closed)return new Error(`executing a cancelled action`);this.pending=false;let o=this._execute(e,t);if(o)return o;this.pending===false&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null));}_execute(e,t){let o=false,n;try{this.work(e);}catch(i){o=true,n=i||new Error(`Scheduled action threw falsy error`);}if(o)return this.unsubscribe(),n}unsubscribe(){if(!this.closed){let{id:e,scheduler:t}=this,{actions:o}=t;this.work=this.state=this.scheduler=null,this.pending=false,P(o,this),e!=null&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null,super.unsubscribe();}}};var z=class r{constructor(e,t=r.now){this.schedulerActionCtor=e,this.now=t;}schedule(e,t=0,o){return new this.schedulerActionCtor(this,e).schedule(o,t)}};z.now=Y.now;var dr$1=class dr extends z{constructor(e,t=z.now){super(e,t),this.actions=[],this._active=false;}flush(e){let{actions:t}=this;if(this._active){t.push(e);return}let o;this._active=true;do if(o=e.execute(e.state,e.delay))break;while(e=t.shift());if(this._active=false,o){for(;e=t.shift();)e.unsubscribe();throw o}}};var C$2=new dr$1(mr$1),Xr$1=C$2;function Zr$1(r,e){return p$1((t,o)=>{let{leading:n=!0,trailing:i=!1}=e??{},s=!1,c=null,f=null,l=!1,b=()=>{f?.unsubscribe(),f=null,i&&(d(),l&&o.complete());},y=()=>{f=null,l&&o.complete();},E=x=>f=h(r(x)).subscribe(a$1(o,b,y)),d=()=>{if(s){s=!1;let x=c;c=null,o.next(x),!l&&E(x);}};t.subscribe(a$1(o,x=>{s=!0,c=x,!(f&&!f.closed)&&(n?d():E(x));},()=>{l=!0,!(i&&s&&f&&!f.closed)&&o.complete();}));})}function re$1(r){return r instanceof Date&&!isNaN(r)}function hr$1(r=0,e,t=Xr$1){let o=-1;return e!=null&&(cr$1(e)?t=e:o=e),new m(n=>{let i=re$1(r)?+r-t.now():r;i<0&&(i=0);let s=0;return t.schedule(function(){n.closed||(n.next(s++),0<=o?this.schedule(void 0,o):n.complete());},i)})}function we$1(r,e=C$2,t){let o=hr$1(r,e);return Zr$1(()=>o,t)}function Se$1(...r){return W$1(r,I(r))}var{isArray:ge}=Array;function Ee$1(r,e){return ge(e)?r(...e):r(e)}function xr(r){return q$1(e=>Ee$1(r,e))}var Oe$1=[`addListener`,`removeListener`],Te=[`addEventListener`,`removeEventListener`],Ie$1=[`on`,`off`];function Tr(r,e,t,o){if(u$1(t)&&(o=t,t=void 0),o)return Tr(r,e,t).pipe(xr(o));let[n,i]=je$1(r)?Te.map(s=>c=>r[s](e,c,t)):Pe(r)?Oe$1.map(ee$1(r,e)):Ae$1(r)?Ie$1.map(ee$1(r,e)):[];if(!n&&D$1(r))return N$1(s=>Tr(s,e,t))(h(r));if(!n)throw new TypeError(`Invalid event target`);return new m(s=>{let c=(...f)=>s.next(1<f.length?f:f[0]);return n(c),()=>i(c)})}function ee$1(r,e){return t=>o=>r[t](e,o)}function Pe(r){return u$1(r.addListener)&&u$1(r.removeListener)}function Ae$1(r){return u$1(r.on)&&u$1(r.off)}function je$1(r){return u$1(r.addEventListener)&&u$1(r.removeEventListener)}function te(r,e,t){return t?te(r,e).pipe(xr(t)):new m(o=>{let n=(...s)=>o.next(s.length===1?s[0]:s),i=r(n);return u$1(e)?()=>e(n,i):void 0})}function Ir(r,e){return p$1((t,o)=>{let n=0;t.subscribe(a$1(o,i=>r.call(e,i,n++)&&o.next(i)));})}function oe$1(r){return p$1((e,t)=>{let o=!1,n=null,i=null,s=!1,c=()=>{if(i?.unsubscribe(),i=null,o){o=!1;let l=n;n=null,t.next(l);}s&&t.complete();},f=()=>{i=null,s&&t.complete();};e.subscribe(a$1(t,l=>{o=!0,n=l,i||h(r(l)).subscribe(i=a$1(t,c,f));},()=>{s=!0,(!o||!i||i.closed)&&t.complete();}));})}function vs$1(r,e=C$2){return oe$1(()=>hr$1(r,e))}function Fe(r,e=C$2){return p$1((t,o)=>{let n=null,i=null,s=null,c=()=>{if(n){n.unsubscribe(),n=null;let l=i;i=null,o.next(l);}};function f(){let l=s+r,b=e.now();if(b<l){n=this.schedule(void 0,l-b),o.add(n);return}c();}t.subscribe(a$1(o,l=>{i=l,s=e.now(),n||(n=e.schedule(f,r),o.add(n));},()=>{c(),o.complete();},void 0,()=>{i=n=null;}));})}function Ps$1(r,e=T){return r=r??Ce,p$1((t,o)=>{let n,i=!0;t.subscribe(a$1(o,s=>{let c=e(s);(i||!r(n,c))&&(i=!1,n=c,o.next(s));}));})}function Ce(r,e){return r===e}function Fs$1(r){return Ir((e,t)=>r<=t)}
24
+ `)}`:``,this.name=`UnsubscriptionError`,this.errors=t;});function P(r,e){if(r){let t=r.indexOf(e);0<=t&&r.splice(t,1);}}var v=class r{constructor(e){this.initialTeardown=e,this.closed=false,this._parentage=null,this._finalizers=null;}unsubscribe(){let e;if(!this.closed){this.closed=true;let{_parentage:t}=this;if(t)if(this._parentage=null,Array.isArray(t))for(let i of t)i.remove(this);else t.remove(this);let{initialTeardown:o}=this;if(u$1(o))try{o();}catch(i){e=i instanceof G$1?i.errors:[i];}let{_finalizers:n}=this;if(n){this._finalizers=null;for(let i of n)try{Pr(i);}catch(s){e=e??[],s instanceof G$1?e=[...e,...s.errors]:e.push(s);}}if(e)throw new G$1(e)}}add(e){var t;if(e&&e!==this)if(this.closed)Pr(e);else {if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this);}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e);}}_hasParent(e){let{_parentage:t}=this;return t===e||Array.isArray(t)&&t.includes(e)}_addParent(e){let{_parentage:t}=this;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e;}_removeParent(e){let{_parentage:t}=this;t===e?this._parentage=null:Array.isArray(t)&&P(t,e);}remove(e){let{_finalizers:t}=this;t&&P(t,e),e instanceof r&&e._removeParent(this);}};v.EMPTY=(()=>{let r=new v;return r.closed=true,r})();var br$1=v.EMPTY;function K$1(r){return r instanceof v||r&&`closed`in r&&u$1(r.remove)&&u$1(r.add)&&u$1(r.unsubscribe)}function Pr(r){u$1(r)?r():r.unsubscribe();}var w={Promise:void 0};var L$1={setTimeout(r,e,...t){return setTimeout(r,e,...t)},clearTimeout(r){return (clearTimeout)(r)},delegate:void 0};function H$2(r){L$1.setTimeout(()=>{throw r});}function V$2(){}function M$2(r){r();}var j$1=class j extends v{constructor(e){super(),this.isStopped=false,e?(this.destination=e,K$1(e)&&e.add(this)):this.destination=se;}static create(e,t,o){return new O(e,t,o)}next(e){this.isStopped?_r():this._next(e);}error(e){this.isStopped?_r():(this.isStopped=true,this._error(e));}complete(){this.isStopped?_r():(this.isStopped=true,this._complete());}unsubscribe(){this.closed||(this.isStopped=true,super.unsubscribe(),this.destination=null);}_next(e){this.destination.next(e);}_error(e){try{this.destination.error(e);}finally{this.unsubscribe();}}_complete(){try{this.destination.complete();}finally{this.unsubscribe();}}};var wr$1=class wr{constructor(e){this.partialObserver=e;}next(e){let{partialObserver:t}=this;if(t.next)try{t.next(e);}catch(o){J(o);}}error(e){let{partialObserver:t}=this;if(t.error)try{t.error(e);}catch(o){J(o);}else J(e);}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete();}catch(t){J(t);}}},O=class extends j$1{constructor(e,t,o){super();let n;if(u$1(e)||!e)n={next:e??void 0,error:t??void 0,complete:o??void 0};else {n=e;}this.destination=new wr$1(n);}};function J(r){H$2(r);}function ie$1(r){throw r}function _r(r,e){}var se={closed:true,next:V$2,error:ie$1,complete:V$2};var k$1=typeof Symbol==`function`&&Symbol.observable||`@@observable`;function T(r){return r}function Rr(r){return r.length===0?T:r.length===1?r[0]:function(t){return r.reduce((o,n)=>n(o),t)}}var m=(()=>{class r{constructor(t){t&&(this._subscribe=t);}lift(t){let o=new r;return o.source=this,o.operator=t,o}subscribe(t,o,n){let i=ce$1(t)?t:new O(t,o,n);return M$2(()=>{let{operator:s,source:c}=this;i.add(s?s.call(i,c):c?this._subscribe(i):this._trySubscribe(i));}),i}_trySubscribe(t){try{return this._subscribe(t)}catch(o){t.error(o);}}forEach(t,o){return o=Lr(o),new o((n,i)=>{let s=new O({next:c=>{try{t(c);}catch(f){i(f),s.unsubscribe();}},error:i,complete:n});this.subscribe(s);})}_subscribe(t){var o;return (o=this.source)===null||o===void 0?void 0:o.subscribe(t)}[k$1](){return this}pipe(...t){return Rr(t)(this)}toPromise(t){return t=Lr(t),new t((o,n)=>{let i;this.subscribe(s=>i=s,s=>n(s),()=>o(i));})}}return r.create=e=>new r(e),r})();function Lr(r){var e;return (e=r??w.Promise)!==null&&e!==void 0?e:Promise}function fe$1(r){return r&&u$1(r.next)&&u$1(r.error)&&u$1(r.complete)}function ce$1(r){return r&&r instanceof j$1||fe$1(r)&&K$1(r)}var Mr=R(r=>function(){r(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`;});var U=(()=>{class r extends m{constructor(){super(),this.closed=false,this.currentObservers=null,this.observers=[],this.isStopped=false,this.hasError=false,this.thrownError=null;}lift(t){let o=new Q$1(this,this);return o.operator=t,o}_throwIfClosed(){if(this.closed)throw new Mr}next(t){M$2(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let o of this.currentObservers)o.next(t);}});}error(t){M$2(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=true,this.thrownError=t;let{observers:o}=this;for(;o.length;)o.shift().error(t);}});}complete(){M$2(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=true;let{observers:t}=this;for(;t.length;)t.shift().complete();}});}unsubscribe(){this.isStopped=this.closed=true,this.observers=this.currentObservers=null;}get observed(){var t;return ((t=this.observers)===null||t===void 0?void 0:t.length)>0}_trySubscribe(t){return this._throwIfClosed(),super._trySubscribe(t)}_subscribe(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)}_innerSubscribe(t){let{hasError:o,isStopped:n,observers:i}=this;return o||n?br$1:(this.currentObservers=null,i.push(t),new v(()=>{this.currentObservers=null,P(i,t);}))}_checkFinalizedStatuses(t){let{hasError:o,thrownError:n,isStopped:i}=this;o?t.error(n):i&&t.complete();}asObservable(){let t=new m;return t.source=this,t}}return r.create=(e,t)=>new Q$1(e,t),r})(),Q$1=class Q extends U{constructor(e,t){super(),this.destination=e,this.source=t;}next(e){var t,o;(o=(t=this.destination)===null||t===void 0?void 0:t.next)===null||o===void 0||o.call(t,e);}error(e){var t,o;(o=(t=this.destination)===null||t===void 0?void 0:t.error)===null||o===void 0||o.call(t,e);}complete(){var e,t;(t=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||t===void 0||t.call(e);}_subscribe(e){var t,o;return (o=(t=this.source)===null||t===void 0?void 0:t.subscribe(e))!==null&&o!==void 0?o:br$1}};var Sr=class extends U{constructor(e){super(),this._value=e;}get value(){return this.getValue()}_subscribe(e){let t=super._subscribe(e);return !t.closed&&e.next(this._value),t}getValue(){let{hasError:e,thrownError:t,_value:o}=this;if(e)throw t;return this._throwIfClosed(),o}next(e){super.next(this._value=e);}};var Y={now(){return (Y.delegate||Date).now()},delegate:void 0};var gr$1=class gr extends U{constructor(e=Infinity,t=Infinity,o=Y){super(),this._bufferSize=e,this._windowTime=t,this._timestampProvider=o,this._buffer=[],this._infiniteTimeWindow=true,this._infiniteTimeWindow=t===Infinity,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,t);}next(e){let{isStopped:t,_buffer:o,_infiniteTimeWindow:n,_timestampProvider:i,_windowTime:s}=this;t||(o.push(e),!n&&o.push(i.now()+s)),this._trimBuffer(),super.next(e);}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let t=this._innerSubscribe(e),{_infiniteTimeWindow:o,_buffer:n}=this,i=n.slice();for(let s=0;s<i.length&&!e.closed;s+=o?1:2)e.next(i[s]);return this._checkFinalizedStatuses(e),t}_trimBuffer(){let{_bufferSize:e,_timestampProvider:t,_buffer:o,_infiniteTimeWindow:n}=this,i=(n?1:2)*e;if(e<Infinity&&i<o.length&&o.splice(0,o.length-i),!n){let s=t.now(),c=0;for(let f=1;f<o.length&&o[f]<=s;f+=2)c=f;c&&o.splice(0,c+1);}}};var kr=R(r=>function(){r(this),this.name=`EmptyError`,this.message=`no elements in sequence`;});function le$1(r,e){return new Promise((o,n)=>{let i=new O({next:s=>{o(s),i.unsubscribe();},error:n,complete:()=>{n(new kr);}});r.subscribe(i);})}function ue(r){return u$1(r?.lift)}function p$1(r){return e=>{if(ue(e))return e.lift(function(t){try{return r(t,this)}catch(o){this.error(o);}});throw new TypeError(`Unable to lift unknown Observable type`)}}function a$1(r,e,t,o,n){return new Er(r,e,t,o,n)}var Er=class extends j$1{constructor(e,t,o,n,i,s){super(e),this.onFinalize=i,this.shouldUnsubscribe=s,this._next=t?function(c){try{t(c);}catch(f){e.error(f);}}:super._next,this._error=n?function(c){try{n(c);}catch(f){e.error(f);}finally{this.unsubscribe();}}:super._error,this._complete=o?function(){try{o();}catch(c){e.error(c);}finally{this.unsubscribe();}}:super._complete;}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:t}=this;super.unsubscribe(),!t&&((e=this.onFinalize)===null||e===void 0||e.call(this));}}};function q$1(r,e){return p$1((t,o)=>{let n=0;t.subscribe(a$1(o,i=>{o.next(r.call(e,i,n++));}));})}function Dr(r,e,t,o){function n(i){return i instanceof t?i:new t(function(s){s(i);})}return new(t||(t=Promise))(function(i,s){function c(b){try{l(o.next(b));}catch(y){s(y);}}function f(b){try{l(o.throw(b));}catch(y){s(y);}}function l(b){b.done?i(b.value):n(b.value).then(c,f);}l((o=o.apply(r,[])).next());})}function Ur(r){var e=typeof Symbol==`function`&&Symbol.iterator,t=e&&r[e],o=0;if(t)return t.call(r);if(r&&typeof r.length==`number`)return {next:function(){return r&&o>=r.length&&(r=void 0),{value:r&&r[o++],done:!r}}};throw new TypeError(e?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function F(r){return this instanceof F?(this.v=r,this):new F(r)}function Wr$1(r,e,t){if(!Symbol.asyncIterator)throw new TypeError(`Symbol.asyncIterator is not defined.`);var o=t.apply(r,e||[]),n,i=[];return n=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),c(`next`),c(`throw`),c(`return`,s),n[Symbol.asyncIterator]=function(){return this},n;function s(d){return function(x){return Promise.resolve(x).then(d,y)}}function c(d,x){o[d]&&(n[d]=function(S){return new Promise(function(B,g){i.push([d,S,B,g])>1||f(d,S);})},x&&(n[d]=x(n[d])));}function f(d,x){try{l(o[d](x));}catch(S){E(i[0][3],S);}}function l(d){d.value instanceof F?Promise.resolve(d.value.v).then(b,y):E(i[0][2],d);}function b(d){f(`next`,d);}function y(d){f(`throw`,d);}function E(d,x){d(x),i.shift(),i.length&&f(i[0][0],i[0][1]);}}function zr$1(r){if(!Symbol.asyncIterator)throw new TypeError(`Symbol.asyncIterator is not defined.`);var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Ur==`function`?Ur(r):r[Symbol.iterator](),t={},o(`next`),o(`throw`),o(`return`),t[Symbol.asyncIterator]=function(){return this},t);function o(i){t[i]=r[i]&&function(s){return new Promise(function(c,f){s=r[i](s),n(c,f,s.done,s.value);})};}function n(i,s,c,f){Promise.resolve(f).then(function(l){i({value:l,done:c});},s);}}var D$1=r=>r&&typeof r.length==`number`&&typeof r!=`function`;function X$1(r){return u$1(r?.then)}function Z$1(r){return u$1(r[k$1])}function rr$1(r){return Symbol.asyncIterator&&u$1(r?.[Symbol.asyncIterator])}function er$1(r){return new TypeError(`You provided ${r!==null&&typeof r==`object`?`an invalid object`:`'${r}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function pe$1(){return typeof Symbol!=`function`||!Symbol.iterator?`@@iterator`:Symbol.iterator}var tr$1=pe$1();function or$1(r){return u$1(r?.[tr$1])}function nr$1(r){return Wr$1(this,arguments,function*(){let t=r.getReader();try{for(;;){let{value:o,done:n}=yield F(t.read());if(n)return yield F(void 0);yield yield F(o);}}finally{t.releaseLock();}})}function ir$1(r){return u$1(r?.getReader)}function h$1(r){if(r instanceof m)return r;if(r!=null){if(Z$1(r))return ae(r);if(D$1(r))return me$1(r);if(X$1(r))return de$1(r);if(rr$1(r))return Vr$1(r);if(or$1(r))return he$1(r);if(ir$1(r))return xe(r)}throw er$1(r)}function ae(r){return new m(e=>{let t=r[k$1]();if(u$1(t.subscribe))return t.subscribe(e);throw new TypeError(`Provided object does not correctly implement Symbol.observable`)})}function me$1(r){return new m(e=>{for(let t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete();})}function de$1(r){return new m(e=>{r.then(t=>{e.closed||(e.next(t),e.complete());},t=>e.error(t)).then(null,H$2);})}function he$1(r){return new m(e=>{for(let t of r)if(e.next(t),e.closed)return;e.complete();})}function Vr$1(r){return new m(e=>{be(r,e).catch(t=>e.error(t));})}function xe(r){return Vr$1(nr$1(r))}function be(r,e){var t,o,n,i;return Dr(this,void 0,void 0,function*(){try{for(t=zr$1(r);o=yield t.next(),!o.done;){let s=o.value;if(e.next(s),e.closed)return}}catch(s){n={error:s};}finally{try{o&&!o.done&&(i=t.return)&&(yield i.call(t));}finally{if(n)throw n.error}}e.complete();})}function ye$1(r){return new m(e=>{h$1(r()).subscribe(e);})}function _$1(r,e,t,o=0,n=false){let i=e.schedule(function(){t(),n?r.add(this.schedule(null,o)):this.unsubscribe();},o);if(r.add(i),!n)return i}function Yr$1(r,e,t,o,n,i,s,c){let f=[],l=0,b=0,y=false,E=()=>{y&&!f.length&&!l&&e.complete();},d=S=>l<o?x(S):f.push(S),x=S=>{l++;let B=false;h$1(t(S,b++)).subscribe(a$1(e,g=>{e.next(g);},()=>{B=true;},void 0,()=>{if(B)try{for(l--;f.length&&l<o;){let g=f.shift();s?_$1(e,s,()=>x(g)):x(g);}E();}catch(g){e.error(g);}}));};return r.subscribe(a$1(e,d,()=>{y=true,E();})),()=>{}}function N$1(r,e,t=Infinity){return u$1(e)?N$1((o,n)=>q$1((i,s)=>e(o,i,n,s))(h$1(r(o,n))),t):(typeof e==`number`&&(t=e),p$1((o,n)=>Yr$1(o,n,r,t)))}function sr$1(r=Infinity){return N$1(T,r)}var fr$1=new m(r=>r.complete());function cr$1(r){return r&&u$1(r.schedule)}function qr$1(r){return r[r.length-1]}function I(r){return cr$1(qr$1(r))?r.pop():void 0}function Nr(r,e){return typeof qr$1(r)==`number`?r.pop():e}function lr$1(r,e=0){return p$1((t,o)=>{t.subscribe(a$1(o,n=>_$1(o,r,()=>o.next(n),e),()=>_$1(o,r,()=>o.complete(),e),n=>_$1(o,r,()=>o.error(n),e)));})}function ur$1(r,e=0){return p$1((t,o)=>{o.add(r.schedule(()=>t.subscribe(o),e));})}function $r$1(r,e){return h$1(r).pipe(ur$1(e),lr$1(e))}function Br$1(r,e){return h$1(r).pipe(ur$1(e),lr$1(e))}function Gr$1(r,e){return new m(t=>{let o=0;return e.schedule(function(){o===r.length?t.complete():(t.next(r[o++]),t.closed||this.schedule());})})}function Kr$1(r,e){return new m(t=>{let o;return _$1(t,e,()=>{o=r[tr$1](),_$1(t,e,()=>{let n,i;try{({value:n,done:i}=o.next());}catch(s){t.error(s);return}i?t.complete():t.next(n);},0,true);}),()=>u$1(o?.return)&&o.return()})}function pr$1(r,e){if(!r)throw new Error(`Iterable cannot be null`);return new m(t=>{_$1(t,e,()=>{let o=r[Symbol.asyncIterator]();_$1(t,e,()=>{o.next().then(n=>{n.done?t.complete():t.next(n.value);});},0,true);});})}function Hr$1(r,e){return pr$1(nr$1(r),e)}function Jr$1(r,e){if(r!=null){if(Z$1(r))return $r$1(r,e);if(D$1(r))return Gr$1(r,e);if(X$1(r))return Br$1(r,e);if(rr$1(r))return pr$1(r,e);if(or$1(r))return Kr$1(r,e);if(ir$1(r))return Hr$1(r,e)}throw er$1(r)}function W$1(r,e){return e?Jr$1(r,e):h$1(r)}function ve(...r){let e=I(r),t=Nr(r,Infinity),o=r;return o.length?o.length===1?h$1(o[0]):sr$1(t)(W$1(o,e)):fr$1}function Nn$1(r){return r<=0?()=>fr$1:p$1((e,t)=>{let o=0;e.subscribe(a$1(t,n=>{++o<=r&&(t.next(n),r<=o&&t.complete());}));})}function Qr$1(){return sr$1(1)}function Or(...r){return Qr$1()(W$1(r,I(r)))}function _e$1(...r){let e=I(r);return p$1((t,o)=>{(e?Or(r,t,e):Or(r,t)).subscribe(o);})}function ii$1(r,e){return p$1((t,o)=>{let n=null,i=0,s=!1,c=()=>s&&!n&&o.complete();t.subscribe(a$1(o,f=>{n?.unsubscribe();let l=0,b=i++;h$1(r(f,b)).subscribe(n=a$1(o,y=>o.next(e?e(f,y,b,l++):y),()=>{n=null,c();}));},()=>{s=!0,c();}));})}function pi$1(r){return p$1((e,t)=>{h$1(r).subscribe(a$1(t,()=>t.complete(),V$2)),!t.closed&&e.subscribe(t);})}function bi$1(r,e,t){let o=u$1(r)||e||t?{next:r,error:e,complete:t}:r;return o?p$1((n,i)=>{var s;(s=o.subscribe)===null||s===void 0||s.call(o);let c=!0;n.subscribe(a$1(i,f=>{var l;(l=o.next)===null||l===void 0||l.call(o,f),i.next(f);},()=>{var f;c=!1,(f=o.complete)===null||f===void 0||f.call(o),i.complete();},f=>{var l;c=!1,(l=o.error)===null||l===void 0||l.call(o,f),i.error(f);},()=>{var f,l;c&&((f=o.unsubscribe)===null||f===void 0||f.call(o)),(l=o.finalize)===null||l===void 0||l.call(o);}));}):T}var ar$1=class ar extends v{constructor(e,t){super();}schedule(e,t=0){return this}};var $={setInterval(r,e,...t){let{delegate:o}=$;return o?.setInterval?o.setInterval(r,e,...t):setInterval(r,e,...t)},clearInterval(r){return (clearInterval)(r)},delegate:void 0};var mr$1=class mr extends ar$1{constructor(e,t){super(e,t),this.scheduler=e,this.work=t,this.pending=false;}schedule(e,t=0){var o;if(this.closed)return this;this.state=e;let n=this.id,i=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(i,n,t)),this.pending=true,this.delay=t,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(i,this.id,t),this}requestAsyncId(e,t,o=0){return $.setInterval(e.flush.bind(e,this),o)}recycleAsyncId(e,t,o=0){if(o!=null&&this.delay===o&&this.pending===false)return t;t!=null&&$.clearInterval(t);}execute(e,t){if(this.closed)return new Error(`executing a cancelled action`);this.pending=false;let o=this._execute(e,t);if(o)return o;this.pending===false&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null));}_execute(e,t){let o=false,n;try{this.work(e);}catch(i){o=true,n=i||new Error(`Scheduled action threw falsy error`);}if(o)return this.unsubscribe(),n}unsubscribe(){if(!this.closed){let{id:e,scheduler:t}=this,{actions:o}=t;this.work=this.state=this.scheduler=null,this.pending=false,P(o,this),e!=null&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null,super.unsubscribe();}}};var z=class r{constructor(e,t=r.now){this.schedulerActionCtor=e,this.now=t;}schedule(e,t=0,o){return new this.schedulerActionCtor(this,e).schedule(o,t)}};z.now=Y.now;var dr$1=class dr extends z{constructor(e,t=z.now){super(e,t),this.actions=[],this._active=false;}flush(e){let{actions:t}=this;if(this._active){t.push(e);return}let o;this._active=true;do if(o=e.execute(e.state,e.delay))break;while(e=t.shift());if(this._active=false,o){for(;e=t.shift();)e.unsubscribe();throw o}}};var C$2=new dr$1(mr$1),Xr$1=C$2;function Zr$1(r,e){return p$1((t,o)=>{let{leading:n=!0,trailing:i=!1}=e??{},s=!1,c=null,f=null,l=!1,b=()=>{f?.unsubscribe(),f=null,i&&(d(),l&&o.complete());},y=()=>{f=null,l&&o.complete();},E=x=>f=h$1(r(x)).subscribe(a$1(o,b,y)),d=()=>{if(s){s=!1;let x=c;c=null,o.next(x),!l&&E(x);}};t.subscribe(a$1(o,x=>{s=!0,c=x,!(f&&!f.closed)&&(n?d():E(x));},()=>{l=!0,!(i&&s&&f&&!f.closed)&&o.complete();}));})}function re$1(r){return r instanceof Date&&!isNaN(r)}function hr$1(r=0,e,t=Xr$1){let o=-1;return e!=null&&(cr$1(e)?t=e:o=e),new m(n=>{let i=re$1(r)?+r-t.now():r;i<0&&(i=0);let s=0;return t.schedule(function(){n.closed||(n.next(s++),0<=o?this.schedule(void 0,o):n.complete());},i)})}function we$1(r,e=C$2,t){let o=hr$1(r,e);return Zr$1(()=>o,t)}function Se$1(...r){return W$1(r,I(r))}var{isArray:ge}=Array;function Ee$1(r,e){return ge(e)?r(...e):r(e)}function xr(r){return q$1(e=>Ee$1(r,e))}var Oe$1=[`addListener`,`removeListener`],Te=[`addEventListener`,`removeEventListener`],Ie=[`on`,`off`];function Tr(r,e,t,o){if(u$1(t)&&(o=t,t=void 0),o)return Tr(r,e,t).pipe(xr(o));let[n,i]=je$1(r)?Te.map(s=>c=>r[s](e,c,t)):Pe$1(r)?Oe$1.map(ee$1(r,e)):Ae$1(r)?Ie.map(ee$1(r,e)):[];if(!n&&D$1(r))return N$1(s=>Tr(s,e,t))(h$1(r));if(!n)throw new TypeError(`Invalid event target`);return new m(s=>{let c=(...f)=>s.next(1<f.length?f:f[0]);return n(c),()=>i(c)})}function ee$1(r,e){return t=>o=>r[t](e,o)}function Pe$1(r){return u$1(r.addListener)&&u$1(r.removeListener)}function Ae$1(r){return u$1(r.on)&&u$1(r.off)}function je$1(r){return u$1(r.addEventListener)&&u$1(r.removeEventListener)}function te(r,e,t){return t?te(r,e).pipe(xr(t)):new m(o=>{let n=(...s)=>o.next(s.length===1?s[0]:s),i=r(n);return u$1(e)?()=>e(n,i):void 0})}function Ir(r,e){return p$1((t,o)=>{let n=0;t.subscribe(a$1(o,i=>r.call(e,i,n++)&&o.next(i)));})}function oe$1(r){return p$1((e,t)=>{let o=!1,n=null,i=null,s=!1,c=()=>{if(i?.unsubscribe(),i=null,o){o=!1;let l=n;n=null,t.next(l);}s&&t.complete();},f=()=>{i=null,s&&t.complete();};e.subscribe(a$1(t,l=>{o=!0,n=l,i||h$1(r(l)).subscribe(i=a$1(t,c,f));},()=>{s=!0,(!o||!i||i.closed)&&t.complete();}));})}function vs$1(r,e=C$2){return oe$1(()=>hr$1(r,e))}function Fe$1(r,e=C$2){return p$1((t,o)=>{let n=null,i=null,s=null,c=()=>{if(n){n.unsubscribe(),n=null;let l=i;i=null,o.next(l);}};function f(){let l=s+r,b=e.now();if(b<l){n=this.schedule(void 0,l-b),o.add(n);return}c();}t.subscribe(a$1(o,l=>{i=l,s=e.now(),n||(n=e.schedule(f,r),o.add(n));},()=>{c(),o.complete();},void 0,()=>{i=n=null;}));})}function Ps$1(r,e=T){return r=r??Ce,p$1((t,o)=>{let n,i=!0;t.subscribe(a$1(o,s=>{let c=e(s);(i||!r(n,c))&&(i=!1,n=c,o.next(s));}));})}function Ce(r,e){return r===e}function Fs$1(r){return Ir((e,t)=>r<=t)}
25
25
 
26
26
  function M$1(){return window.CooeeSDK?.uaParser.getDevice().type===`mobile`}function S$1(e,i){Object.assign(e.style,i);}function H$1(e,i,t){if(i){if(!t){e.style.removeProperty(i);return}e.style.setProperty(i,t,`important`);}}function C$1(e){if(!e)return false;if(e.tagName.toLowerCase()===`cart-drawer`&&e.hasAttribute(`open`))return true;let t=e.getBoundingClientRect(),n=(window.innerHeight||document.documentElement.clientHeight)+.5,r=(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 false;let u=Math.max(0,Math.min(t.right,r)-Math.max(t.left,0))*Math.max(0,Math.min(t.bottom,n)-Math.max(t.top,0)),c=t.width*t.height;if(!(c>0&&u/c>=.1))return false;let p=t.top<=n&&t.bottom>=0,g=t.left<=r&&t.right>=0,m=p&&g,l=o.transform.match(/matrix\(([^)]+)\)/),s=0,a=0;if(l){let d=l[1].split(`, `).map(parseFloat);s=d[4],a=d[5];}let y=s+t.left>r||s+t.right<0||a+t.top>n||a+t.bottom<0;return m||!y}var V$1=()=>typeof navigator<`u`&&`share`in navigator,A=e=>new Promise((i,t)=>{let n=new Image;n.onload=()=>{i({width:n.width,height:n.height});},n.onerror=t,n.src=e,n.style.display=`none`;});
27
27
 
28
- var Be=class{constructor(e,t){this._startTime=e;this._triggerData=t;}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let e=this.triggerData.shortID??this.triggerData.id.slice(-6);return e===`test`&&(e=`test-`+this.startTime.getTime().toString()),`cooee-wrapper-`+e}get selectedItems(){return this.triggerData.items.filter(e=>e.selected.value)}get shouldGiveFBTDiscount(){let e=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=e:e===this.triggerData.items.length}onClose(e){this.closeCallback=e;}closeInApp(e,t){t??={};let o=r({eventName:e,duration:(new Date().getTime()-this.startTime.getTime())/1e3},t);this.stopIntervals(),this.closeCallback&&this.closeCallback(o);}addInputField(e,t){this.inputFields.push({id:e,type:t,isValid:false});}updateValidation(e,t){this.inputFields.forEach(i=>{if(i.id===e){i.isValid=t;return}});}hasManipulatedProductQuantity(){let e=this.triggerData.manipulation.productQuantity;return e?.enabled&&e.min!=null&&e.max!=null}getManipulatedQuantity(e){let{min:t=1,max:i=100}=this.triggerData.manipulation.productQuantity;if(t>i)return Y$1.error(`Invalid range: min should be less than or equal to max.`),e;if(e>=t&&e<=i)return e;let o=e%100;return o<t?t:o>i?i:o}stopIntervals(){this.intervals.forEach(e=>clearInterval(e));}};var re=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new h$2(e.bg)),e.br&&(this.br=new a$2(e.br)),e.shd&&(this.shd=new g$2(e.shd)),e.spc&&(this.spc=new b$2(e.spc)),this.trf=new f$1(e.trf),this.clc=e.clc,this.w=e.w,this.h=e.h,this.x=e.x,this.y=e.y,this.a=e.a;}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return B[this.t]}get click(){return this.clc}},B=(C=>(C[C.IMAGE=1]=`IMAGE`,C[C.TEXT=2]=`TEXT`,C[C.BUTTON=3]=`BUTTON`,C[C.FLEXBOX=4]=`FLEXBOX`,C[C.MULTI_COLUMN=5]=`MULTI_COLUMN`,C[C.CHECKBOX=6]=`CHECKBOX`,C[C.PRODUCTS=11]=`PRODUCTS`,C[C.PRODUCT=12]=`PRODUCT`,C[C.PRODUCT_IMAGE=13]=`PRODUCT_IMAGE`,C[C.PRODUCT_TITLE=14]=`PRODUCT_TITLE`,C[C.PRODUCT_VARIATIONS=15]=`PRODUCT_VARIATIONS`,C[C.PRODUCT_VARIATIONS_SELLING_PLANS=16]=`PRODUCT_VARIATIONS_SELLING_PLANS`,C[C.PRODUCT_BUTTON=18]=`PRODUCT_BUTTON`,C[C.PRODUCT_RATING=19]=`PRODUCT_RATING`,C[C.EMAIL_INPUT=51]=`EMAIL_INPUT`,C[C.PHONE_INPUT=52]=`PHONE_INPUT`,C[C.COUNTDOWN_TIMER=61]=`COUNTDOWN_TIMER`,C[C.CAROUSEL=62]=`CAROUSEL`,C[C.SHAPE=100]=`SHAPE`,C))(B||{});var Gt=class extends re{constructor(e){super(e);}};var it=class extends re{src;constructor(e){super(e),this.src=e.src;}};var Br=(o=>(o[o.START=0]=`START`,o[o.CENTER=1]=`CENTER`,o[o.END=2]=`END`,o[o.JUSTIFY=3]=`JUSTIFY`,o))(Br||{});var Vr=class{name;fonts;constructor(e){e=e??{},e.name&&(e.name=e.name!==`Arial`?e.name:``),this.name=e.name,this.fonts=e.fonts?.map(t=>new oo(t));}},oo=class{style;url;constructor(e){e=e??{},this.style=e.style,this.url=e.url;}getFontDescriptor(){return {style:this.style===2||this.style===4?`italic`:`normal`,weight:this.style===4||this.style===3?`700`:`400`}}getURL(){return `url('${this.url}') format('truetype')`}};var H=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(e){this.update(e);}get alignment(){return Br[this.ta]}get letterSpacing(){return this.ls?this.ls+`px`:`normal`}update(e){e=e??{},e.lh&&(this.lh=e.lh),e.tdc&&(this.tdc=new n$1(e.tdc)),this.td=e.td,this.fs=e.s??e.fs??60,this.tc=new n$1(e.tc),this.ta=e.ta??1,this.fw=e.fw??400,this.ls=e.ls??0,this.tc.h??=`#000000`,this.fam=new Vr(e.fam??e.fmly);}resize(e){this.s*=e,this.ls*=e;}};var Ve=class extends re{typo;constructor(e){super(e);let t=r(r({},e.f),e.typo);e.alg&&(t.ta=e.alg),e.c&&(t.tc=e.c),this.typo=new H(t);}get color(){return this.typography.tc}get typography(){return this.typo}};var yt=class extends Ve{prs;constructor(e){super(e),this.prs=e.prs;}get parts(){return this.prs}};var Et=class{dd;hh;mm;ss;date;constructor(e){e??={},this.dd=e.dd??0,this.hh=e.hh??0,this.mm=e.mm??0,this.ss=e.ss??0,this.date=e.date?new Date(e.date):void 0;}start(e,t){let i=new Date;e===2?(i.setSeconds(i.getSeconds()+this.ss),i.setMinutes(i.getMinutes()+this.mm),i.setHours(i.getHours()+this.hh),i.setDate(i.getDate()+this.dd)):i=this.date??new Date;let o=window.setInterval(()=>{let n=new Date().getTime(),s=i.getTime()-n;if(s<1){clearInterval(o);return}t({days:Math.floor(s/(1e3*60*60*24)),hours:Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),minutes:Math.floor(s%(1e3*60*60)/(1e3*60)),seconds:Math.floor(s%(1e3*60)/1e3)});},1e3);return o}};var Wr=class extends Ve{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new Et(e.timer),this.show=e.show??{day:true,hour:true,minute:true,second:true},this.horizontal=e.horizontal,this.lblPos=e.lblPos;}};var Hr=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new n$1(e.c??{});}get text(){return this.txt}get color(){return this.c}};var We=class extends Ve{ph;constructor(e){super(e),this.ph=new Hr(e.ph);}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var $r=class extends We{constructor(e){e??={},super(e);}};var qr=class extends We{};var Gr=class extends We{};var jr=class extends it{};var ce=(function(r){return r[r.NONE=0]=`NONE`,r[r.STATIC=1]=`STATIC`,r[r.UNIQUE_FLAT=2]=`UNIQUE_FLAT`,r[r.UNIQUE_FLAT_ITEMS=3]=`UNIQUE_FLAT_ITEMS`,r[r.UNIQUE_FIXED_ITEMS=4]=`UNIQUE_FIXED_ITEMS`,r[r.UNIQUE_CHEAPEST_ITEM_FREE=5]=`UNIQUE_CHEAPEST_ITEM_FREE`,r[r.BXGY=6]=`BXGY`,r})(ce||{});var Re=class r{static of(e,t){return t!==void 0?new Array(e).fill(t):Array.from({length:e},(i,o)=>o)}static remove(e,t){let i=e.indexOf(t);return i===-1?false:(e.splice(i,1),true)}static swap(e,t,i){[e[t],e[i]]=[e[i],e[t]];}static sum(e,t){return e.reduce((i,o)=>i+Math.max(t?t(o):+o,0),0)}static unique(e,t){return e.filter((i,o,n)=>n.findIndex(s=>s[t]===i[t])===o)}static shuffle(e){let t=e.length;for(;t!=0;){let i=Math.floor(Math.random()*t);t--,r.swap(e,t,i);}}};var Rn=(()=>{class r{static toTitle(t){return t?this.titleCase(t.toLowerCase().split(/[_-]+/).join(` `)):``}static toSlug(t){return t?t.toLowerCase().replace(/[_-]+/,` `).replace(/[^\w ]+/g,``).replace(/ +/g,`-`):``}static toCamelCase(t){return t.toLowerCase().split(` `).map((i,o)=>o===0?i:i.charAt(0).toUpperCase()+i.slice(1)).join(``)}static format(t,...i){return t?.replace(/{(\d+)}/g,(o,n)=>{let s=i[n];return s!==void 0?s:o})}static chop(t,i){if(!(!t||!i))return t.length<=i?t:t.substring(0,i)}static titleCase=t=>t.replace(/(^|\s)\S/g,i=>i.toUpperCase())}return r})();var zr=class{applyDiscountOnMinimum;constructor(e){this.applyDiscountOnMinimum=e.applyDiscountOnMinimum;}};var Kr=class{modifications;constructor(e={}){e.modifications?.length?this.modifications=e.modifications.map(t=>new Xr(t)):e.experiments?.length&&(this.modifications=e.experiments.map(t=>new Xr(t)));}};var Xr=class{cssSelector;type;display;bg;typo;br;text;image;moveTo;constructor(e={}){this.cssSelector=e.cssSelector??``,this.type=e.type??`OTHER`,this.display=e.display,e.bg&&(this.bg=new n$1(e.bg)),e.typo&&(this.typo=new H(e.typo)),e.br&&(this.br=new a$2(e.br)),this.text=e.text,this.image=e.image,this.moveTo=e.moveTo;}get style(){let e={};return this.br?.r&&(e.borderRadius=this.br.r+`px`),this.br?.w&&(e.borderWidth=this.br.w+`px`),this.br?.s&&(e.borderStyle=w$2[this.br.s]?.toLowerCase()),this.br?.c?.h&&(e.borderColor=this.br.color?.rgba),this.bg?.h&&(e.backgroundColor=this.bg.rgba),this.type===`TEXT`&&this.typo&&(this.typo.fs&&(e.fontSize=this.typo.fs+`px`),this.typo.lh&&(e.lineHeight=this.typo.lh),this.typo.fw&&(e.fontWeight=this.typo.fw),this.typo.ta&&(e.textAlign=this.typo.alignment),this.typo.tc.h&&(e.color=this.typo.tc.rgba),this.typo.ls&&(e.letterSpacing=this.typo.letterSpacing),this.typo.td&&(e.textDecoration=this.typo.td??`none`)),e}toString(){return `Experiment(cssSelector=${this.cssSelector})`}};function jt(){return !!window.Shopify}function Yr(){if(jt())return window.Shopify.shop?.split(`.`)?.[0]}function _n(r){let i=(r.includes(`://`)?new URL(r).pathname:r).match(/\/products\/([^/]+?)(?:\.html)?$/);return i?i[1]:null}function St(r){return (window.Shopify?.routes?.root??`/`)+r.substring(1)}function Jr(r){return St(r+`?from=cooee`)}var E=class r{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 r),this.CURRENT}async getNormalisedCart(e){return da(e)}getCooeeCart(){return no()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.items_subtotal_price=e.items_subtotal_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,this.discount_codes=e.discount_codes,this.total_discount=e.total_discount,Be$3().currencyCode=this.currency,Y$1.verbose(`Updated ShopifyCart`,this),this}toString(){return `ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}};async function da(r){let e=E.getCurrent();await ga(e,r);let t=kn(e);return r&&await fe$4.set(`cart`,t),t}function no(){return kn(E.getCurrent())}function kn(r){return {amount:r.total_price/100,originalAmount:r.original_total_price/100,itemsSubtotalPrice:r.items_subtotal_price/100,currency:r.currency,itemCount:r.item_count,items:ua(r.items),token:r.token}}function ua(r){if(!r)return Y$1.error(`No item received to be sent`),[];Array.isArray(r)||(r=[r]);let e=[];for(let t of r){if(!t.id||!t.title){Y$1.warn(`Invalid item received`,t);continue}let i={name:t.title,quantity:+t.quantity||1,mID:t.product_id?.toString(),vID:t.id.toString(),price:+t.price/100||0,finalPrice:+t.final_price/100||0,properties:t.properties,key:t.key},o=t.selling_plan_allocation?.selling_plan;if(!o){e.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:o.fixed_selling_plan,id:o.id,name:o.name,recurringDeliveries:o.recurring_deliveries}},e.push(i);}return e}async function ga(r,e){if(!e&&r.token){Y$1.verbose(`Not fetching cart`);return}Y$1.verbose(`Fetching cart`);let t=Jr(`/cart.js`);try{let i=(await zn$1(t)).data;r.update(i);}catch(i){Y$1.error(`Unable to fetch the cart`,i);}}var Qr=class{id;mID;handle;title;imageURL;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.handle=e.handle,this.title=e.title,this.imageURL=e.imageURL;}};var so=class{enabled;constructor(e){this.enabled=e.enabled;}},ao=class extends so{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max;}},Zr=class{productQuantity;constructor(e){e??={},this.productQuantity=new ao(e.productQuantity);}};var ei=class extends re{o;constructor(e){super(e),this.o=e.o??5,this.w=this.w??1080,this.h=this.h??1920;}getOrigin(){return this.o}};var ti=class{en;ex;constructor(e){e=e??{},this.en=e.en,this.ex=e.ex;}getEnterAnimation(){switch(this.en){case 2:return [{transform:`translateY(-100%)`},{transform:`translateY(0%)`}];case 3:return [{transform:`translateY(100%)`},{transform:`translateY(0%)`}];case 4:return [{transform:`translateX(-100%)`},{transform:`translateX(0%)`}];case 5:return [{transform:`translateX(100%)`},{transform:`translateX(0%)`}];case 6:return [{transform:`translate(-100%, -100%)`},{transform:`translate(0%, 0%)`}];case 7:return [{transform:`translate(100%, -100%)`},{transform:`translate(0%, 0%)`}];case 8:return [{transform:`translate(-100%, 100%)`},{transform:`translate(0%, 0%)`}];case 9:return [{transform:`translate(100%, 100%)`},{transform:`translate(0%, 0%)`}];case 10:return [{transform:`scale(0.1)`},{transform:`scale(1)`}];default:return []}}getExitAnimation(){switch(this.ex){case 2:return [{transform:`translateY(0%)`},{transform:`translateY(-100%)`}];case 3:return [{transform:`translateY(0%)`},{transform:`translateY(100%)`}];case 4:return [{transform:`translateX(0%)`},{transform:`translateX(-100%)`}];case 5:return [{transform:`translateX(0%)`},{transform:`translateX(100%)`}];case 6:return [{transform:`translate(0%, 0%)`},{transform:`translate(-100%, -100%)`}];case 7:return [{transform:`translate(0%, 0%)`},{transform:`translate(100%, -100%)`}];case 8:return [{transform:`translate(0%, 0%)`},{transform:`translate(-100%, 100%)`}];case 9:return [{transform:`translate(0%, 0%)`},{transform:`translate(100%, 100%)`}];case 10:return [{transform:`scale(1)`},{transform:`scale(0)`}];default:return []}}};var ri=15,Kt=class extends re{gvt;max;cover;anim;embedded;constructor(e){e=e??{},super(e),this.gvt=e.gvt??5,this.max=e.max,this.cover=e.cover??true,this.anim=new ti(e.anim),this.spc||(this.spc=new b$2({pl:ri,pr:ri,pt:ri,pb:ri}));}};var ii=class extends Kt{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new ei(e.cont),this.mob=new Kt(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(t=>{t.t===1?this.elems.push(new it(t)):t.t===2?this.elems.push(new yt(t)):t.t===3?this.elems.push(new yt(t)):t.t===100?this.elems.push(new Gt(t)):t.t===51?this.elems.push(new qr(t)):t.t===52?this.elems.push(new Gr(t)):t.t===61?this.elems.push(new Wr(t)):t.t===15||t.t===16?this.elems.push(new $r(t)):t.t===13&&this.elems.push(new jr(t));});}getStylesForWrapper(){if(this.cover)return {};let e;return this.gvt===1?e={top:0,left:0}:this.gvt===2?e={top:0,left:`50%`,transform:`translateX(-50%)`}:this.gvt===3?e={top:0,right:0}:this.gvt===6?e={top:`50%`,right:0,transform:`translateY(-50%)`}:this.gvt===9?e={bottom:0,right:0}:this.gvt===8?e={bottom:0,left:`50%`,transform:`translateX(-50%)`}:this.gvt===7?e={bottom:0,left:0}:this.gvt===4?e={top:`50%`,left:0,transform:`translateY(-50%)`}:e={top:`50%`,left:`50%`,transform:`translateX(-50%) translateY(-50%)`},e.overflow=`visible`,e}getFlexStylesForContainer(){let e={display:`flex`,flexDirection:`row`},t,i;return this.gvt===1?(t=`flex-start`,i=`flex-start`):this.gvt===2?(t=`center`,i=`flex-start`):this.gvt===3?(t=`flex-end`,i=`flex-start`):this.gvt===4?(t=`flex-start`,i=`center`):this.gvt===6?(t=`flex-end`,i=`center`):this.gvt===7?(t=`flex-start`,i=`flex-end`):this.gvt===8?(t=`center`,i=`flex-end`):this.gvt===9?(t=`flex-end`,i=`flex-end`):(t=`center`,i=`center`),e.alignItems=i,e.justifyContent=t,e.overflow=`visible`,e}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim;}};var It=class{gap;dir;wrap;jc;ai;scroll;constructor(e){e??={},this.gap=e.gap??0,this.dir=e.dir??`row`,this.wrap=e.wrap??`nowrap`,this.jc=e.jc??`flex-start`,this.ai=e.ai??`flex-start`,this.scroll=e.scroll;}};var oi=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(e){e??={},this.of=e.of,this.disp=e.disp,this.pos=e.pos,this.top=e.top,this.bottom=e.bottom,this.left=e.left,this.right=e.right,this.zIndex=e.zIndex;}};var ni=class{w;h;maxW;maxH;minW;minH;constructor(e){e??={},this.w=e.w??`100%`,this.h=e.h??`auto`,this.maxW=e.maxW,this.maxH=e.maxH,this.minW=e.minW,this.minH=e.minH;}};var si=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new b$2(e.spc),e.size&&(this.size=new ni(e.size)),e.bg&&(this.bg=new h$2(e.bg)),e.br&&(this.br=new a$2(e.br)),e.typo&&(this.typo=new H(e.typo)),e.lout&&(this.lout=new oi(e.lout)),e.flex&&(this.flex=new It(e.flex));}},Tt=class{sm;lg;constructor(e){e??={},this.sm=new si(e.sm),this.lg=new si(e.lg);}};var q=class{t;style;hide;when;clc;l;constructor(e,t){t??={},this.t=e,this.style=new Tt(t.style),this.hide=t.hide,this.l=t.l,t.when?.op&&(this.when=t.when),t.clc&&(this.clc=t.clc);}get stringType(){return B[this.t]}};var G=class extends q{text;constructor(e,t){e?.style?.lg?.typo?.s&&delete e.style.lg.typo.s,e?.style?.sm?.typo?.s&&delete e.style.sm.typo.s,super(t??2,e),e??={},this.text=e.text;}};var ot=class extends G{constructor(e,t){super(e,t??3);}};var xt=class extends q{value;constructor(e){super(6,e),e??={},this.value=e.value;}};var Dt=class extends G{showChips;optionsConfig;constructor(e=15,t){super(t,e),t??={},this.showChips=t.showChips??false,this.optionsConfig=t.optionsConfig??{};}};var ai=class extends q{c;iconSize;showSingleStar;fullStar;halfStart;constructor(e){super(19,e),e??={},this.c=new n$1(e.c),this.iconSize=e.iconSize??24,this.showSingleStar=e.showSingleStar??false,this.fullStar=e.fullStar,this.halfStart=e.halfStart;}};var An=x$2(Et$3());var ci=class extends q{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e);}update(e){e??={},this.slide=ie.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new C$4(e.conf),this.allowedTypes=e.allowedTypes;}};var li=class extends G{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new Et(e.timer),this.show=e.show??{days:true,hours:true,minutes:true,seconds:true},this.horizontal=e.horizontal,this.lblPos=e.lblPos;}};var He=class extends q{elems;constructor(e){super(4,e),this.update(e);}update(e){e??={},this.elems??=[],e.elems?.forEach(t=>{let i=ie.getParsedElement(t);i&&this.elems.push(i);});}};var nt=class extends q{src;sm;lg;constructor(e,t){super(t??1,e),e&&this.update(e);}update(e){this.src=e.src,this.sm=e.sm,this.lg=e.lg;}};var ie=class r{static getParsedElements(e){let t=[];return e?.forEach(i=>{let o=r.getParsedElement(i);o&&t.push(o);}),t}static getParsedElement(e){switch(e.t){case 2:return new G(e);case 3:return new ot(e);case 6:return new xt(e);case 11:return new mi(e);case 12:return new $e(e);case 61:return new li(e);case 4:return new He(e);case 1:return new nt(e);case 13:return new nt(e,13);case 14:return new G(e,14);case 15:case 16:return new Dt(e.t,e);case 18:return new ot(e,18);case 62:return new ci(e);case 19:return new ai(e);default:An.default.error(`Unknown element type`,e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return `center`;case 2:return `flex-end`;case 0:return `flex-start`;default:return `flex-start`}}};var $e=class extends q{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(e){if(e??={},super(12,e),this.show=e.show,this.elems=ie.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new xt(e.cBox)),this.elems.push(new nt(e.img,13));let t=new G(e.title,14);t.hide=!e.show?.title,t.text=`{{ product.name }}`,this.elems.push(t);let i=new G(e.price);i.text=`{{ product.price }}`,i.hide=!e.show?.price;let o=new G(e.compareAt);o.text=`{{ product.compare_price }}`,o.hide=!e.show?.price,e.compareAt||(o.style=new Tt(i.style),o.style.lg.typo=new H(s(r({},o.style.lg.typo),{td:`line-through`})),o.style.sm.typo=new H(s(r({},o.style.sm.typo),{td:`line-through`})));let n=new He({style:{lg:{spc:{mb:10},flex:{dir:`row`,gap:10,ai:`center`,jc:ie.parseAlignmentToJustifyContent(i.style.lg.typo?.ta)}}}});n.elems.push(o),n.elems.push(i),this.elems.push(n);let s$1=new Dt(15,e.variantDD);if(s$1.hide=!e.show?.variantDD,this.elems.push(s$1),e.btn){let c=new ot(e.btn,18);c.hide=!e.show?.btn,this.elems.push(c);}}e.symbol&&(this.symbol=new G(e.symbol));}};var mi=class extends q{conf;prod;constructor(e){super(11,e),e??={},this.conf=new co(e.conf),this.prod=new $e(e.prod);}};var pi=class extends C$4{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems;}},co=class{lg;sm;constructor(e){e??={},this.lg=new pi(e.lg),this.sm=new pi(e.sm);}};var di=class extends He{constructor(e){super(e);}};var Pt=class{cont;elems=[];constructor(e){e=e??{},this.cont=new di(e.cont),e.elems?.forEach(t=>{this.addRawElement(t);});}addRawElement(e){let t=ie.getParsedElement(e);return t&&this.elems.push(t),t}};function ui(r,e){return fa(r,e,0,5)}function fa(r,e,t=0,i=50){if(e){if(t>i){console.warn(`Maximum recursion depth reached in findFirstElementOfType`);return}for(let o of e){if(o.t===r)return o;let n=`elems`in o?o.elems:[];if(n?.length>0){let s=ui(r,n);if(s)return s}}}}var lo=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(e){this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.delay=e.delay??0,this.redirectBehaviour=e.redirectBehaviour,this.onsiteDeliveryType=e.onsiteDeliveryType,this.objective=e.objective;}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===Ue.EXCLUSION}isABTesting(){return this.contentType===Ue.ABTESTING}isSingleContent(){return this.contentType===Ue.SINGLE}},Xt=class{videoConfig;savingsBarConfig;collectionFilterConfig;afterDeleteJS;afterRenderJS;innerCSS;outerCSS;constructor(e){this.update(e);}update(e){e??={},e.videoConfig&&(this.videoConfig=new ue$2(e.videoConfig)),e.savingsBarConfig&&(this.savingsBarConfig=new Ne$2(e.savingsBarConfig)),e.collectionFilterConfig&&(this.collectionFilterConfig=new Ie$2(e.collectionFilterConfig)),this.afterDeleteJS=e.afterDeleteJS,this.afterRenderJS=e.afterRenderJS,this.innerCSS=e.innerCSS,this.outerCSS=e.outerCSS;}},j=class extends lo{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=T$1({});constructor(e){if(super(e),this.id=e.id,this.currency=Be$3().currencyCode??`USD`,this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new Pt(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.entryAnimation=e.entryAnimation??`NONE`,this.embeddedItems=e.embeddedItems?.map(t=>new et(t)),this.items=e.items?.map(t=>new ot$2(t))??[],this.nonMutableItems=e.items?.map(t=>new ot$2(t))??[],this.collections=e.collections?.map(t=>new Qr(t))??[],this.discount=e.discount,this.placement=e.placement,e.customerData?.name){let t=e.customerData.name.split(` `);this.customerData={name:e.customerData.name,full_name:e.customerData.name,first_name:t[0],last_name:t[1]};}this.ian=e.ian?this.processPopup(e.ian):void 0,this.promotionType=e.promotionType,this.manipulation=new Zr(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,this.stickyATCConfig=e.stickyATCConfig,e.experimentConfig&&(this.experimentConfig=new Kr(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new xe$1(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new zr(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new ot$2(e.bundleFrom)),e.content&&(this.content=new Xt(e.content));}shouldDelay(){return this.delay>0}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===ke$1.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Ge$1.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Ge$1.PAGE_EMBED}isProgressBar(){return this.objective===ke$1.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===ke$1.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===ke$1.CART_RECOVERY}isProductPromotion(){return this.objective===ke$1.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===xe$2.COLLECTION}isBYOB(){return this.objective===ke$1.BYOB}isStickyATC(){return this.objective===ke$1.STICKY_ATC}isShoppableVideo(){return this.objective===ke$1.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===ke$1.SAVINGS_BAR}isCollectionFilter(){return this.objective===ke$1.COLLECTION_FILTER}processPopup(e){let t=this.items[0],i={},o={};if(t){let c=t.selectedOrFirstVariant.value;i=s(r(r({name:t.name,id:t.mID,link:t.link,vID:c.mID,image:t.variantImage},xn(`price`,c.price.d)),xn(`comparePrice`,c.price.cmp)),{quantity:t.quantity}),o={quantity:c.quantity};}let n={productCount:E.getCurrent().item_count},s$2=qe$1(JSON.stringify(e),{product:i,variant:o,cart:n,discount:this.discount,customer:this.customerData},new Be(new Date,this));return t&&(s$2=s$2.replace(new RegExp(`https://cdn.global.letscooee.com/images/placeholders/product.png`,`gi`),t.variantImage??t.firstImageURL)),new ii(JSON.parse(s$2))}calculateDiscountData(e,t){let i=Re.sum(e,s=>s.selectedOrFirstVariant.value.price.d),n={actualPrice:i,totalComparePrice:Re.sum(e,s=>{let c=s.selectedOrFirstVariant.value.price;return c.cmp??c.d}),discountAmount:0,discountPercentage:0,discountedPrice:i};if(!e?.length||!t||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(n);return}if(ce.BXGY===this.discount.type&&this.discount.values?.length)n.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,n.discountPercentage,true),n.discountAmount=n.actualPrice-Re.sum(e,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([ce.STATIC,ce.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)n.discountPercentage=this.discount.values[0],n.discountAmount=n.actualPrice*n.discountPercentage/100,this.updateEffectivePrice(e,n.discountPercentage);else if(ce.UNIQUE_FLAT_ITEMS===this.discount.type&&this.discount.values?.length)this.discount.ruleType===`fixed_amount`?(n.discountAmount=this.discount.values[0],n.discountPercentage=n.actualPrice>0?n.discountAmount*100/n.actualPrice:0):(n.discountPercentage=this.discount.values[0],n.discountAmount=n.actualPrice*n.discountPercentage/100),this.updateEffectivePrice(e,n.discountPercentage);else if(this.discount.type===ce.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)n.discountAmount=n.actualPrice-this.discount.values[0],n.discountPercentage=n.discountAmount/n.actualPrice*100,this.updateEffectivePrice(e,n.discountPercentage);else if(this.discount.type===ce.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((c,m)=>m.selectedOrFirstVariant.value.price.d-c.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.effectivePrice.value=0,n.discountAmount=s.selectedOrFirstVariant.value.price.d,n.discountPercentage=n.discountAmount/n.actualPrice*100;}n.discountedPrice=n.actualPrice-n.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(n);}getPrivateAttributesForLineItem(){return he$3.get().skipItemAttribute?{}:{_via:`Cooee`,_letscooee_campaign:this.shortID,_letscooee_content:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return he$3.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(ui(62,this.widget?.elems))return true;let t=ui(11,this.widget?.elems);return t?t.conf.lg.disp===2||t.conf.sm.disp===2:false}toString(){let e;return this.onsiteDeliveryType===Ge$1.POPUP?e=`Popup`:e=Rn.toTitle(this.objective),`${e}(id=${this.shortID})`}getCartMagicVariables(){let e=E.getCurrent(),t=Re.sum(e.items??[],i=>i.discounts?.reduce((o,n)=>o+(n.amount??0),0)??0);return r(r(r(r({productCount:e.item_count,product_count:e.item_count},xn(`amount`,e.total_price/100)),xn(`originalAmount`,e.original_total_price/100)),xn(`total_line_items_discount`,t/100)),xn(`total_discount`,e.total_discount/100))}shouldGetVariationImmediately(){return this.hasMultiplePlacement&&!this.alwaysHaveVariations()}shouldSkipVariation(){return this.isSingleContent()||this.alwaysHaveVariations()?true:!!this.variation}alwaysHaveVariations(){return this.isProgressBar()||this.isSavingsBar()}updateEffectivePrice(e,t,i=false){let o=Be$3().currentItem;e.forEach(n=>{let s=n.selectedOrFirstVariant.value,c=s.price;if(i&&n.mID===o.mID)s.effectivePrice.value=c.d;else {let m=c.d*t/100;s.effectivePrice.value=c.d-m;}});}formatCurrencyAndNumber(e){if(!e)return {};let t={discountPercentage:Nn$2(e.discountPercentage??0),discountCode:this.discount?.code};return [`actualPrice`,`discountAmount`,`discountedPrice`,`totalComparePrice`].map(i=>{Object.assign(t,xn(i,e[i]));}),t}};var va=`/api/2026-01/graphql.json?from=cooee`,On={"Content-Type":`application/json`};async function Rt(r,e,t,i){let o=he$3.get().storefrontToken;if(!o)throw new Error(`Storefront token not set for the store`);let n=new Headers(On);n.append(`X-Shopify-Storefront-Access-Token`,o);let s=JSON.stringify({query:r,variables:e});try{return await zn$1(va,{method:`POST`,headers:n,body:s})}catch(c){throw ke$2(c,t,{engagementTrigger:i}),c}}function st(r,e){return Ca(Jr(r),e)}async function Ca(r,e){return zn$1(r,{body:JSON.stringify(e),method:`POST`,headers:On})}var gi=class{isLocked=false;queue=[];async acquire(){if(this.isLocked)await new Promise(e=>this.queue.push(e));else {this.isLocked=true;return}}release(){if(this.queue.length>0){let e=this.queue.shift();e&&e();}else this.isLocked=false;}},fi=class r{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(e,t){if(e=`__cooee_${e}_lock__`,`locks`in navigator&&!ya())try{return await ba(e,t,this.LOCK_TIMEOUT)}catch(s){Y$1.verbose(`Web Locks API failed, falling back to localStorage: ${s}`);}let i=false,o=0,n=Math.random().toString(36).substring(2,10);for(;o++<this.MAX_RETRIES&&(Y$1.verbose(`Lock retry ${o} for ${e}`),i=await this.acquire(e,n,o),!i);)await this.sleep(r.RETRY_INTERVAL*o+Math.random()*100);try{return await t()}finally{this.release(e,n);}}static async acquire(e,t,i){let o=Date.now(),n=localStorage.getItem(e),s=n?JSON.parse(n):null;if(s&&o<=s.expiry)return false;let c={owner:t,expiry:o+r.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(c)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||`{}`).owner===t?(Y$1.verbose(`${t}: Lock acquired for ${e} after ${i} attempts!`),true):(Y$1.verbose(`${t}: Race lost. Another tab acquired the lock.`),false)}static release(e,t){let i=localStorage.getItem(e);if(!i)return;let o=JSON.parse(i);o.owner===t?(localStorage.removeItem(e),Y$1.verbose(`${t}: Lock released`)):Y$1.verbose(`${t}: Cannot release lock. Current owner: ${o.owner}`);}static sleep(e){return new Promise(t=>setTimeout(t,e))}};async function ba(r,e,t){return new Promise((i,o)=>{let n=setTimeout(()=>{o(new Error(`Web Locks API timeout after ${t}ms`));},t);navigator.locks.request(r,async()=>{try{let s=await e();return clearTimeout(n),i(s),s}catch(s){throw clearTimeout(n),o(s),s}}).catch(s=>{clearTimeout(n),o(s);});})}function ya(){let r=navigator.userAgent||``;return /Safari/.test(r)&&!/Chrome/.test(r)&&!/Chromium/.test(r)||/iPhone|iPad|iPod/i.test(r)&&(/(FBAV|FBAN|Instagram|Twitter|Line|WhatsApp)/i.test(r)||!window.safari?.pushNotificaTion)||/Macintosh/.test(r)&&/Safari/.test(r)&&!/Chrome/.test(r)&&!/Chromium/.test(r)&&!window.safari?.pushNotification?true:Ea()}function Ea(){try{return window.safari?.pushNotification?window.safari.pushNotification.toString()===`[object SafariRemoteNotification]`:!window.indexedDB||!window.localStorage}catch{return true}}var mo=new gi,Sa=`
28
+ var Fe=class{constructor(e,t){this._startTime=e;this._triggerData=t;}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let e=this.triggerData.shortID??this.triggerData.id.slice(-6);return e===`test`&&(e=`test-`+this.startTime.getTime().toString()),`cooee-wrapper-`+e}get selectedItems(){return this.triggerData.items.filter(e=>e.selected.value)}get shouldGiveFBTDiscount(){let e=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=e:e===this.triggerData.items.length}onClose(e){this.closeCallback=e;}closeInApp(e,t){t??={};let o=r({eventName:e,duration:(new Date().getTime()-this.startTime.getTime())/1e3},t);this.stopIntervals(),this.closeCallback&&this.closeCallback(o);}addInputField(e,t){this.inputFields.push({id:e,type:t,isValid:false});}updateValidation(e,t){this.inputFields.forEach(i=>{if(i.id===e){i.isValid=t;return}});}hasManipulatedProductQuantity(){let e=this.triggerData.manipulation.productQuantity;return e?.enabled&&e.min!=null&&e.max!=null}getManipulatedQuantity(e){let{min:t=1,max:i=100}=this.triggerData.manipulation.productQuantity;if(t>i)return Y$1.error(`Invalid range: min should be less than or equal to max.`),e;if(e>=t&&e<=i)return e;let o=e%100;return o<t?t:o>i?i:o}stopIntervals(){this.intervals.forEach(e=>clearInterval(e));}};var re=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(e){this.t=e.t,e.bg&&(this.bg=new h$3(e.bg)),e.br&&(this.br=new a$2(e.br)),e.shd&&(this.shd=new g$2(e.shd)),e.spc&&(this.spc=new b$2(e.spc)),this.trf=new f(e.trf),this.clc=e.clc,this.w=e.w,this.h=e.h,this.x=e.x,this.y=e.y,this.a=e.a;}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return B[this.t]}get click(){return this.clc}},B=(b=>(b[b.IMAGE=1]=`IMAGE`,b[b.TEXT=2]=`TEXT`,b[b.BUTTON=3]=`BUTTON`,b[b.FLEXBOX=4]=`FLEXBOX`,b[b.MULTI_COLUMN=5]=`MULTI_COLUMN`,b[b.CHECKBOX=6]=`CHECKBOX`,b[b.PRODUCTS=11]=`PRODUCTS`,b[b.PRODUCT=12]=`PRODUCT`,b[b.PRODUCT_IMAGE=13]=`PRODUCT_IMAGE`,b[b.PRODUCT_TITLE=14]=`PRODUCT_TITLE`,b[b.PRODUCT_VARIATIONS=15]=`PRODUCT_VARIATIONS`,b[b.PRODUCT_VARIATIONS_SELLING_PLANS=16]=`PRODUCT_VARIATIONS_SELLING_PLANS`,b[b.PRODUCT_BUTTON=18]=`PRODUCT_BUTTON`,b[b.PRODUCT_RATING=19]=`PRODUCT_RATING`,b[b.EMAIL_INPUT=51]=`EMAIL_INPUT`,b[b.PHONE_INPUT=52]=`PHONE_INPUT`,b[b.COUNTDOWN_TIMER=61]=`COUNTDOWN_TIMER`,b[b.CAROUSEL=62]=`CAROUSEL`,b[b.SHAPE=100]=`SHAPE`,b))(B||{});var qt=class extends re{constructor(e){super(e);}};var rt=class extends re{src;constructor(e){super(e),this.src=e.src;}};var Fr=(o=>(o[o.START=0]=`START`,o[o.CENTER=1]=`CENTER`,o[o.END=2]=`END`,o[o.JUSTIFY=3]=`JUSTIFY`,o))(Fr||{});var Br=class{name;fonts;constructor(e){e=e??{},e.name&&(e.name=e.name!==`Arial`?e.name:``),this.name=e.name,this.fonts=e.fonts?.map(t=>new oo(t));}},oo=class{style;url;constructor(e){e=e??{},this.style=e.style,this.url=e.url;}getFontDescriptor(){return {style:this.style===2||this.style===4?`italic`:`normal`,weight:this.style===4||this.style===3?`700`:`400`}}getURL(){return `url('${this.url}') format('truetype')`}};var H=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(e){this.update(e);}get alignment(){return Fr[this.ta]}get letterSpacing(){return this.ls?this.ls+`px`:`normal`}update(e){e=e??{},e.lh&&(this.lh=e.lh),e.tdc&&(this.tdc=new n$1(e.tdc)),this.td=e.td,this.fs=e.s??e.fs??60,this.tc=new n$1(e.tc),this.ta=e.ta??1,this.fw=e.fw??400,this.ls=e.ls??0,this.tc.h??=`#000000`,this.fam=new Br(e.fam??e.fmly);}resize(e){this.s*=e,this.ls*=e;}};var Be=class extends re{typo;constructor(e){super(e);let t=r(r({},e.f),e.typo);e.alg&&(t.ta=e.alg),e.c&&(t.tc=e.c),this.typo=new H(t);}get color(){return this.typography.tc}get typography(){return this.typo}};var Ct=class extends Be{prs;constructor(e){super(e),this.prs=e.prs;}get parts(){return this.prs}};var yt=class{dd;hh;mm;ss;date;constructor(e){e??={},this.dd=e.dd??0,this.hh=e.hh??0,this.mm=e.mm??0,this.ss=e.ss??0,this.date=e.date?new Date(e.date):void 0;}start(e,t){let i=new Date;e===2?(i.setSeconds(i.getSeconds()+this.ss),i.setMinutes(i.getMinutes()+this.mm),i.setHours(i.getHours()+this.hh),i.setDate(i.getDate()+this.dd)):i=this.date??new Date;let o=window.setInterval(()=>{let n=new Date().getTime(),s=i.getTime()-n;if(s<1){clearInterval(o);return}t({days:Math.floor(s/(1e3*60*60*24)),hours:Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),minutes:Math.floor(s%(1e3*60*60)/(1e3*60)),seconds:Math.floor(s%(1e3*60)/1e3)});},1e3);return o}};var Vr=class extends Be{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e),this.gap=e.gap,this.timerType=e.type,this.timer=new yt(e.timer),this.show=e.show??{day:true,hour:true,minute:true,second:true},this.horizontal=e.horizontal,this.lblPos=e.lblPos;}};var Wr=class{txt;c;constructor(e){e??={},this.txt=e.txt,this.c=new n$1(e.c??{});}get text(){return this.txt}get color(){return this.c}};var Ve=class extends Be{ph;constructor(e){super(e),this.ph=new Wr(e.ph);}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var Hr=class extends Ve{constructor(e){e??={},super(e);}};var $r=class extends Ve{};var qr=class extends Ve{};var Gr=class extends rt{};var ce=(function(r){return r[r.NONE=0]=`NONE`,r[r.STATIC=1]=`STATIC`,r[r.UNIQUE_FLAT=2]=`UNIQUE_FLAT`,r[r.UNIQUE_FLAT_ITEMS=3]=`UNIQUE_FLAT_ITEMS`,r[r.UNIQUE_FIXED_ITEMS=4]=`UNIQUE_FIXED_ITEMS`,r[r.UNIQUE_CHEAPEST_ITEM_FREE=5]=`UNIQUE_CHEAPEST_ITEM_FREE`,r[r.BXGY=6]=`BXGY`,r})(ce||{});var Pe=class r{static of(e,t){return t!==void 0?new Array(e).fill(t):Array.from({length:e},(i,o)=>o)}static remove(e,t){let i=e.indexOf(t);return i===-1?false:(e.splice(i,1),true)}static swap(e,t,i){[e[t],e[i]]=[e[i],e[t]];}static sum(e,t){return e.reduce((i,o)=>i+Math.max(t?t(o):+o,0),0)}static unique(e,t){return e.filter((i,o,n)=>n.findIndex(s=>s[t]===i[t])===o)}static shuffle(e){let t=e.length;for(;t!=0;){let i=Math.floor(Math.random()*t);t--,r.swap(e,t,i);}}};var _n=(()=>{class r{static toTitle(t){return t?this.titleCase(t.toLowerCase().split(/[_-]+/).join(` `)):``}static toSlug(t){return t?t.toLowerCase().replace(/[_-]+/,` `).replace(/[^\w ]+/g,``).replace(/ +/g,`-`):``}static toCamelCase(t){return t.toLowerCase().split(` `).map((i,o)=>o===0?i:i.charAt(0).toUpperCase()+i.slice(1)).join(``)}static format(t,...i){return t?.replace(/{(\d+)}/g,(o,n)=>{let s=i[n];return s!==void 0?s:o})}static chop(t,i){if(!(!t||!i))return t.length<=i?t:t.substring(0,i)}static titleCase=t=>t.replace(/(^|\s)\S/g,i=>i.toUpperCase())}return r})();var jr=class{applyDiscountOnMinimum;constructor(e){this.applyDiscountOnMinimum=e.applyDiscountOnMinimum;}};var zr=class{modifications;constructor(e={}){e.modifications?.length?this.modifications=e.modifications.map(t=>new Kr(t)):e.experiments?.length&&(this.modifications=e.experiments.map(t=>new Kr(t)));}};var Kr=class{cssSelector;type;display;bg;typo;br;text;image;moveTo;constructor(e={}){this.cssSelector=e.cssSelector??``,this.type=e.type??`OTHER`,this.display=e.display,e.bg&&(this.bg=new n$1(e.bg)),e.typo&&(this.typo=new H(e.typo)),e.br&&(this.br=new a$2(e.br)),this.text=e.text,this.image=e.image,this.moveTo=e.moveTo;}get style(){let e={};return this.br?.r&&(e.borderRadius=this.br.r+`px`),this.br?.w&&(e.borderWidth=this.br.w+`px`),this.br?.s&&(e.borderStyle=w$2[this.br.s]?.toLowerCase()),this.br?.c?.h&&(e.borderColor=this.br.color?.rgba),this.bg?.h&&(e.backgroundColor=this.bg.rgba),this.type===`TEXT`&&this.typo&&(this.typo.fs&&(e.fontSize=this.typo.fs+`px`),this.typo.lh&&(e.lineHeight=this.typo.lh),this.typo.fw&&(e.fontWeight=this.typo.fw),this.typo.ta&&(e.textAlign=this.typo.alignment),this.typo.tc.h&&(e.color=this.typo.tc.rgba),this.typo.ls&&(e.letterSpacing=this.typo.letterSpacing),this.typo.td&&(e.textDecoration=this.typo.td??`none`)),e}toString(){return `Experiment(cssSelector=${this.cssSelector})`}};function Gt(){return !!window.Shopify}function Xr(){if(Gt())return window.Shopify.shop?.split(`.`)?.[0]}function kn(r){let i=(r.includes(`://`)?new URL(r).pathname:r).match(/\/products\/([^/]+?)(?:\.html)?$/);return i?i[1]:null}function Et(r){return (window.Shopify?.routes?.root??`/`)+r.substring(1)}function Yr(r){return Et(r+`?from=cooee`)}var E=class r{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 r),this.CURRENT}async getNormalisedCart(e){return ua(e)}getCooeeCart(){return no()}update(e){return this.token=e.token,this.items=e.items,this.total_price=e.total_price,this.original_total_price=e.original_total_price,this.items_subtotal_price=e.items_subtotal_price,this.currency=e.currency,this.item_count=e.item_count,this.attributes=e.attributes,this.cart_level_discount_applications=e.cart_level_discount_applications,this.discount_codes=e.discount_codes,this.total_discount=e.total_discount,Be$3().currencyCode=this.currency,Y$1.verbose(`Updated ShopifyCart`,this),this}toString(){return `ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}};async function ua(r){let e=E.getCurrent();await fa(e,r);let t=An(e);return r&&await fe$4.set(`cart`,t),t}function no(){return An(E.getCurrent())}function An(r){return {amount:r.total_price/100,originalAmount:r.original_total_price/100,itemsSubtotalPrice:r.items_subtotal_price/100,currency:r.currency,itemCount:r.item_count,items:ga(r.items),token:r.token}}function ga(r){if(!r)return Y$1.error(`No item received to be sent`),[];Array.isArray(r)||(r=[r]);let e=[];for(let t of r){if(!t.id||!t.title){Y$1.warn(`Invalid item received`,t);continue}let i={name:t.title,quantity:+t.quantity||1,mID:t.product_id?.toString(),vID:t.id.toString(),price:+t.price/100||0,finalPrice:+t.final_price/100||0,properties:t.properties,key:t.key},o=t.selling_plan_allocation?.selling_plan;if(!o){e.push(i);continue}i.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:o.fixed_selling_plan,id:o.id,name:o.name,recurringDeliveries:o.recurring_deliveries}},e.push(i);}return e}async function fa(r,e){if(!e&&r.token){Y$1.verbose(`Not fetching cart`);return}Y$1.verbose(`Fetching cart`);let t=Yr(`/cart.js`);try{let i=(await jn$1(t)).data;r.update(i);}catch(i){Y$1.error(`Unable to fetch the cart`,i);}}var Jr=class{id;mID;handle;title;imageURL;constructor(e){e??={},this.id=e.id,this.mID=e.mID,this.handle=e.handle,this.title=e.title,this.imageURL=e.imageURL;}};var so=class{enabled;constructor(e){this.enabled=e.enabled;}},ao=class extends so{max;min;constructor(e){e??={},super(e),this.min=e.min,this.max=e.max;}},Qr=class{productQuantity;constructor(e){e??={},this.productQuantity=new ao(e.productQuantity);}};var Zr=class extends re{o;constructor(e){super(e),this.o=e.o??5,this.w=this.w??1080,this.h=this.h??1920;}getOrigin(){return this.o}};var ei=class{en;ex;constructor(e){e=e??{},this.en=e.en,this.ex=e.ex;}getEnterAnimation(){switch(this.en){case 2:return [{transform:`translateY(-100%)`},{transform:`translateY(0%)`}];case 3:return [{transform:`translateY(100%)`},{transform:`translateY(0%)`}];case 4:return [{transform:`translateX(-100%)`},{transform:`translateX(0%)`}];case 5:return [{transform:`translateX(100%)`},{transform:`translateX(0%)`}];case 6:return [{transform:`translate(-100%, -100%)`},{transform:`translate(0%, 0%)`}];case 7:return [{transform:`translate(100%, -100%)`},{transform:`translate(0%, 0%)`}];case 8:return [{transform:`translate(-100%, 100%)`},{transform:`translate(0%, 0%)`}];case 9:return [{transform:`translate(100%, 100%)`},{transform:`translate(0%, 0%)`}];case 10:return [{transform:`scale(0.1)`},{transform:`scale(1)`}];default:return []}}getExitAnimation(){switch(this.ex){case 2:return [{transform:`translateY(0%)`},{transform:`translateY(-100%)`}];case 3:return [{transform:`translateY(0%)`},{transform:`translateY(100%)`}];case 4:return [{transform:`translateX(0%)`},{transform:`translateX(-100%)`}];case 5:return [{transform:`translateX(0%)`},{transform:`translateX(100%)`}];case 6:return [{transform:`translate(0%, 0%)`},{transform:`translate(-100%, -100%)`}];case 7:return [{transform:`translate(0%, 0%)`},{transform:`translate(100%, -100%)`}];case 8:return [{transform:`translate(0%, 0%)`},{transform:`translate(-100%, 100%)`}];case 9:return [{transform:`translate(0%, 0%)`},{transform:`translate(100%, 100%)`}];case 10:return [{transform:`scale(1)`},{transform:`scale(0)`}];default:return []}}};var ti=15,zt=class extends re{gvt;max;cover;anim;embedded;constructor(e){e=e??{},super(e),this.gvt=e.gvt??5,this.max=e.max,this.cover=e.cover??true,this.anim=new ei(e.anim),this.spc||(this.spc=new b$2({pl:ti,pr:ti,pt:ti,pb:ti}));}};var ri=class extends zt{cont;elems=[];mob;constructor(e){e=e??{},super(e),this.cont=new Zr(e.cont),this.mob=new zt(e.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),e.elems.forEach(t=>{t.t===1?this.elems.push(new rt(t)):t.t===2?this.elems.push(new Ct(t)):t.t===3?this.elems.push(new Ct(t)):t.t===100?this.elems.push(new qt(t)):t.t===51?this.elems.push(new $r(t)):t.t===52?this.elems.push(new qr(t)):t.t===61?this.elems.push(new Vr(t)):t.t===15||t.t===16?this.elems.push(new Hr(t)):t.t===13&&this.elems.push(new Gr(t));});}getStylesForWrapper(){if(this.cover)return {};let e;return this.gvt===1?e={top:0,left:0}:this.gvt===2?e={top:0,left:`50%`,transform:`translateX(-50%)`}:this.gvt===3?e={top:0,right:0}:this.gvt===6?e={top:`50%`,right:0,transform:`translateY(-50%)`}:this.gvt===9?e={bottom:0,right:0}:this.gvt===8?e={bottom:0,left:`50%`,transform:`translateX(-50%)`}:this.gvt===7?e={bottom:0,left:0}:this.gvt===4?e={top:`50%`,left:0,transform:`translateY(-50%)`}:e={top:`50%`,left:`50%`,transform:`translateX(-50%) translateY(-50%)`},e.overflow=`visible`,e}getFlexStylesForContainer(){let e={display:`flex`,flexDirection:`row`},t,i;return this.gvt===1?(t=`flex-start`,i=`flex-start`):this.gvt===2?(t=`center`,i=`flex-start`):this.gvt===3?(t=`flex-end`,i=`flex-start`):this.gvt===4?(t=`flex-start`,i=`center`):this.gvt===6?(t=`flex-end`,i=`center`):this.gvt===7?(t=`flex-start`,i=`flex-end`):this.gvt===8?(t=`center`,i=`flex-end`):this.gvt===9?(t=`flex-end`,i=`flex-end`):(t=`center`,i=`center`),e.alignItems=i,e.justifyContent=t,e.overflow=`visible`,e}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim;}};var St=class{gap;dir;wrap;jc;ai;scroll;constructor(e){e??={},this.gap=e.gap??0,this.dir=e.dir??`row`,this.wrap=e.wrap??`nowrap`,this.jc=e.jc??`flex-start`,this.ai=e.ai??`flex-start`,this.scroll=e.scroll;}};var ii=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(e){e??={},this.of=e.of,this.disp=e.disp,this.pos=e.pos,this.top=e.top,this.bottom=e.bottom,this.left=e.left,this.right=e.right,this.zIndex=e.zIndex;}};var oi=class{w;h;maxW;maxH;minW;minH;constructor(e){e??={},this.w=e.w??`100%`,this.h=e.h??`auto`,this.maxW=e.maxW,this.maxH=e.maxH,this.minW=e.minW,this.minH=e.minH;}};var ni=class{size;bg;br;spc;typo;lout;flex;constructor(e){e??={},this.spc=new b$2(e.spc),e.size&&(this.size=new oi(e.size)),e.bg&&(this.bg=new h$3(e.bg)),e.br&&(this.br=new a$2(e.br)),e.typo&&(this.typo=new H(e.typo)),e.lout&&(this.lout=new ii(e.lout)),e.flex&&(this.flex=new St(e.flex));}},It=class{sm;lg;constructor(e){e??={},this.sm=new ni(e.sm),this.lg=new ni(e.lg);}};var q=class{t;style;hide;when;clc;l;constructor(e,t){t??={},this.t=e,this.style=new It(t.style),this.hide=t.hide,this.l=t.l,t.when?.op&&(this.when=t.when),t.clc&&(this.clc=t.clc);}get stringType(){return B[this.t]}};var G=class extends q{text;constructor(e,t){e?.style?.lg?.typo?.s&&delete e.style.lg.typo.s,e?.style?.sm?.typo?.s&&delete e.style.sm.typo.s,super(t??2,e),e??={},this.text=e.text;}};var it=class extends G{constructor(e,t){super(e,t??3);}};var Tt=class extends q{value;constructor(e){super(6,e),e??={},this.value=e.value;}};var xt=class extends G{showChips;optionsConfig;constructor(e=15,t){super(t,e),t??={},this.showChips=t.showChips??false,this.optionsConfig=t.optionsConfig??{};}};var si=class extends q{c;iconSize;showSingleStar;fullStar;halfStart;constructor(e){super(19,e),e??={},this.c=new n$1(e.c),this.iconSize=e.iconSize??24,this.showSingleStar=e.showSingleStar??false,this.fullStar=e.fullStar,this.halfStart=e.halfStart;}};var On=x$2(yt$1());var ai=class extends q{conf;slide;formData;values;allowedTypes;constructor(e){super(62,e),e&&this.update(e);}update(e){e??={},this.slide=ie.getParsedElement(e.slide),this.formData=e.formData,this.values=e.values,this.conf=new C$4(e.conf),this.allowedTypes=e.allowedTypes;}};var ci=class extends G{gap;timer;timerType;horizontal;lblPos;show;constructor(e){e??={},super(e,61),this.gap=e.gap,this.timerType=e.type,this.timer=new yt(e.timer),this.show=e.show??{days:true,hours:true,minutes:true,seconds:true},this.horizontal=e.horizontal,this.lblPos=e.lblPos;}};var We=class extends q{elems;constructor(e){super(4,e),this.update(e);}update(e){e??={},this.elems??=[],e.elems?.forEach(t=>{let i=ie.getParsedElement(t);i&&this.elems.push(i);});}};var ot=class extends q{src;sm;lg;constructor(e,t){super(t??1,e),e&&this.update(e);}update(e){this.src=e.src,this.sm=e.sm,this.lg=e.lg;}};var ie=class r{static getParsedElements(e){let t=[];return e?.forEach(i=>{let o=r.getParsedElement(i);o&&t.push(o);}),t}static getParsedElement(e){switch(e.t){case 2:return new G(e);case 3:return new it(e);case 6:return new Tt(e);case 11:return new li(e);case 12:return new He(e);case 61:return new ci(e);case 4:return new We(e);case 1:return new ot(e);case 13:return new ot(e,13);case 14:return new G(e,14);case 15:case 16:return new xt(e.t,e);case 18:return new it(e,18);case 62:return new ai(e);case 19:return new si(e);default:On.default.error(`Unknown element type`,e.t);return}}static parseAlignmentToJustifyContent(e){switch(e){case 1:return `center`;case 2:return `flex-end`;case 0:return `flex-start`;default:return `flex-start`}}};var He=class extends q{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(e){if(e??={},super(12,e),this.show=e.show,this.elems=ie.getParsedElements(e.elems),this.noLinks=e.noLinks,!this.elems.length){e.cBox&&this.elems.push(new Tt(e.cBox)),this.elems.push(new ot(e.img,13));let t=new G(e.title,14);t.hide=!e.show?.title,t.text=`{{ product.name }}`,this.elems.push(t);let i=new G(e.price);i.text=`{{ product.price }}`,i.hide=!e.show?.price;let o=new G(e.compareAt);o.text=`{{ product.compare_price }}`,o.hide=!e.show?.price,e.compareAt||(o.style=new It(i.style),o.style.lg.typo=new H(s(r({},o.style.lg.typo),{td:`line-through`})),o.style.sm.typo=new H(s(r({},o.style.sm.typo),{td:`line-through`})));let n=new We({style:{lg:{spc:{mb:10},flex:{dir:`row`,gap:10,ai:`center`,jc:ie.parseAlignmentToJustifyContent(i.style.lg.typo?.ta)}}}});n.elems.push(o),n.elems.push(i),this.elems.push(n);let s$1=new xt(15,e.variantDD);if(s$1.hide=!e.show?.variantDD,this.elems.push(s$1),e.btn){let c=new it(e.btn,18);c.hide=!e.show?.btn,this.elems.push(c);}}e.symbol&&(this.symbol=new G(e.symbol));}};var li=class extends q{conf;prod;constructor(e){super(11,e),e??={},this.conf=new co(e.conf),this.prod=new He(e.prod);}};var mi=class extends C$4{disp;maxItems;constructor(e){e??={},super(e),this.disp=e.disp,this.maxItems=e.maxItems;}},co=class{lg;sm;constructor(e){e??={},this.lg=new mi(e.lg),this.sm=new mi(e.sm);}};var pi=class extends We{constructor(e){super(e);}};var Dt=class{cont;elems=[];constructor(e){e=e??{},this.cont=new pi(e.cont),e.elems?.forEach(t=>{this.addRawElement(t);});}addRawElement(e){let t=ie.getParsedElement(e);return t&&this.elems.push(t),t}};function di(r,e){return ha(r,e,0,5)}function ha(r,e,t=0,i=50){if(e){if(t>i){console.warn(`Maximum recursion depth reached in findFirstElementOfType`);return}for(let o of e){if(o.t===r)return o;let n=`elems`in o?o.elems:[];if(n?.length>0){let s=di(r,n);if(s)return s}}}}var lo=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(e){this.shortID=e.shortID,this.contentType=e.contentType,this.engagementID=e.engagementID,this.delay=e.delay??0,this.redirectBehaviour=e.redirectBehaviour,this.onsiteDeliveryType=e.onsiteDeliveryType,this.objective=e.objective;}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===Ue.EXCLUSION}isABTesting(){return this.contentType===Ue.ABTESTING}isSingleContent(){return this.contentType===Ue.SINGLE}},Kt=class{videoConfig;savingsBarConfig;collectionFilterConfig;afterDeleteJS;afterRenderJS;innerCSS;outerCSS;constructor(e){this.update(e);}update(e){e??={},e.videoConfig&&(this.videoConfig=new ue$2(e.videoConfig)),e.savingsBarConfig&&(this.savingsBarConfig=new Ne$1(e.savingsBarConfig)),e.collectionFilterConfig&&(this.collectionFilterConfig=new Ie$1(e.collectionFilterConfig)),this.afterDeleteJS=e.afterDeleteJS,this.afterRenderJS=e.afterRenderJS,this.innerCSS=e.innerCSS,this.outerCSS=e.outerCSS;}},j=class extends lo{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=T$1({});constructor(e){if(super(e),this.id=e.id,this.currency=Be$3().currencyCode??`USD`,this.contentID=e.contentID,this.variation=e.variation,e.widget&&(this.widget=new Dt(e.widget)),this.previewType=e.previewType,this.occurred=e.occurred??new Date,this.props=e.props,this.entryAnimation=e.entryAnimation??`NONE`,this.embeddedItems=e.embeddedItems?.map(t=>new et(t)),this.items=e.items?.map(t=>new ot$2(t))??[],this.nonMutableItems=e.items?.map(t=>new ot$2(t))??[],this.collections=e.collections?.map(t=>new Jr(t))??[],this.discount=e.discount,this.placement=e.placement,e.customerData?.name){let t=e.customerData.name.split(` `);this.customerData={name:e.customerData.name,full_name:e.customerData.name,first_name:t[0],last_name:t[1]};}this.ian=e.ian?this.processPopup(e.ian):void 0,this.promotionType=e.promotionType,this.manipulation=new Qr(e.manipulation),this.contentSource=e.contentSource,this.klaviyoFormID=e.klaviyoFormID,this.hasMultiplePlacement=e.hasMultiplePlacement,this.skipSubscribedItems=e.skipSubscribedItems,this.stickyATCConfig=e.stickyATCConfig,e.experimentConfig&&(this.experimentConfig=new zr(e.experimentConfig)),e.progressBarConfig&&(this.progressBarConfig=new xe$1(e.progressBarConfig)),e.bundleConfig&&(this.bundleConfig=new jr(e.bundleConfig)),e.bundleFrom&&(this.bundleFrom=new ot$2(e.bundleFrom)),e.content&&(this.content=new Kt(e.content));}shouldDelay(){return this.delay>0}getDelaySeconds(){let e=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-e}isBundle(){return this.objective===ke$1.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Ge$1.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Ge$1.PAGE_EMBED}isProgressBar(){return this.objective===ke$1.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===ke$1.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===ke$1.CART_RECOVERY}isProductPromotion(){return this.objective===ke$1.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===xe$2.COLLECTION}isBYOB(){return this.objective===ke$1.BYOB}isStickyATC(){return this.objective===ke$1.STICKY_ATC}isShoppableVideo(){return this.objective===ke$1.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===ke$1.SAVINGS_BAR}isCollectionFilter(){return this.objective===ke$1.COLLECTION_FILTER}processPopup(e){let t=this.items[0],i={},o={};if(t){let c=t.selectedOrFirstVariant.value;i=s(r(r({name:t.name,id:t.mID,link:t.link,vID:c.mID,image:t.variantImage},An$1(`price`,c.price.d)),An$1(`comparePrice`,c.price.cmp)),{quantity:t.quantity}),o={quantity:c.quantity};}let n={productCount:E.getCurrent().item_count},s$2=qe$1(JSON.stringify(e),{product:i,variant:o,cart:n,discount:this.discount,customer:this.customerData},new Fe(new Date,this));return t&&(s$2=s$2.replace(new RegExp(`https://cdn.global.letscooee.com/images/placeholders/product.png`,`gi`),t.variantImage??t.firstImageURL)),new ri(JSON.parse(s$2))}calculateDiscountData(e,t){let i=Pe.sum(e,s=>s.selectedOrFirstVariant.value.price.d),n={actualPrice:i,totalComparePrice:Pe.sum(e,s=>{let c=s.selectedOrFirstVariant.value.price;return c.cmp??c.d}),discountAmount:0,discountPercentage:0,discountedPrice:i};if(!e?.length||!t||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(n);return}if(ce.BXGY===this.discount.type&&this.discount.values?.length)n.discountPercentage=this.discount.values[0],this.updateEffectivePrice(e,n.discountPercentage,true),n.discountAmount=n.actualPrice-Pe.sum(e,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([ce.STATIC,ce.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)n.discountPercentage=this.discount.values[0],n.discountAmount=n.actualPrice*n.discountPercentage/100,this.updateEffectivePrice(e,n.discountPercentage);else if(ce.UNIQUE_FLAT_ITEMS===this.discount.type&&this.discount.values?.length)this.discount.ruleType===`fixed_amount`?(n.discountAmount=this.discount.values[0],n.discountPercentage=n.actualPrice>0?n.discountAmount*100/n.actualPrice:0):(n.discountPercentage=this.discount.values[0],n.discountAmount=n.actualPrice*n.discountPercentage/100),this.updateEffectivePrice(e,n.discountPercentage);else if(this.discount.type===ce.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)n.discountAmount=n.actualPrice-this.discount.values[0],n.discountPercentage=n.discountAmount/n.actualPrice*100,this.updateEffectivePrice(e,n.discountPercentage);else if(this.discount.type===ce.UNIQUE_CHEAPEST_ITEM_FREE){e.sort((c,m)=>m.selectedOrFirstVariant.value.price.d-c.selectedOrFirstVariant.value.price.d);let s=e[e.length-1];s.selectedOrFirstVariant.value.effectivePrice.value=0,n.discountAmount=s.selectedOrFirstVariant.value.price.d,n.discountPercentage=n.discountAmount/n.actualPrice*100;}n.discountedPrice=n.actualPrice-n.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(n);}getPrivateAttributesForLineItem(){return he$3.get().skipItemAttribute?{}:{_via:`Cooee`,_letscooee_campaign:this.shortID,_letscooee_content:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return he$3.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(di(62,this.widget?.elems))return true;let t=di(11,this.widget?.elems);return t?t.conf.lg.disp===2||t.conf.sm.disp===2:false}toString(){let e;return this.onsiteDeliveryType===Ge$1.POPUP?e=`Popup`:e=_n.toTitle(this.objective),`${e}(id=${this.shortID})`}getCartMagicVariables(){let e=E.getCurrent(),t=Pe.sum(e.items??[],i=>i.discounts?.reduce((o,n)=>o+(n.amount??0),0)??0);return r(r(r(r({productCount:e.item_count,product_count:e.item_count},An$1(`amount`,e.total_price/100)),An$1(`originalAmount`,e.original_total_price/100)),An$1(`total_line_items_discount`,t/100)),An$1(`total_discount`,e.total_discount/100))}shouldGetVariationImmediately(){return this.hasMultiplePlacement&&!this.alwaysHaveVariations()}shouldSkipVariation(){return this.isSingleContent()||this.alwaysHaveVariations()?true:!!this.variation}alwaysHaveVariations(){return this.isProgressBar()||this.isSavingsBar()}updateEffectivePrice(e,t,i=false){let o=Be$3().currentItem;e.forEach(n=>{let s=n.selectedOrFirstVariant.value,c=s.price;if(i&&n.mID===o.mID)s.effectivePrice.value=c.d;else {let m=c.d*t/100;s.effectivePrice.value=c.d-m;}});}formatCurrencyAndNumber(e){if(!e)return {};let t={discountPercentage:xn(e.discountPercentage??0),discountCode:this.discount?.code};return [`actualPrice`,`discountAmount`,`discountedPrice`,`totalComparePrice`].map(i=>{Object.assign(t,An$1(i,e[i]));}),t}};var ba=`/api/2026-01/graphql.json?from=cooee`,Ln={"Content-Type":`application/json`};async function Pt(r,e,t,i){let o=he$3.get().storefrontToken;if(!o)throw new Error(`Storefront token not set for the store`);let n=new Headers(Ln);n.append(`X-Shopify-Storefront-Access-Token`,o);let s=JSON.stringify({query:r,variables:e});try{return await jn$1(ba,{method:`POST`,headers:n,body:s})}catch(c){throw ke$2(c,t,{engagementTrigger:i}),c}}function nt(r,e){return Ca(Yr(r),e)}async function Ca(r,e){return jn$1(r,{body:JSON.stringify(e),method:`POST`,headers:Ln})}var ui=class{isLocked=false;queue=[];async acquire(){if(this.isLocked)await new Promise(e=>this.queue.push(e));else {this.isLocked=true;return}}release(){if(this.queue.length>0){let e=this.queue.shift();e&&e();}else this.isLocked=false;}},gi=class r{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(e,t){if(e=`__cooee_${e}_lock__`,`locks`in navigator&&!Ea())try{return await ya(e,t,this.LOCK_TIMEOUT)}catch(s){Y$1.verbose(`Web Locks API failed, falling back to localStorage: ${s}`);}let i=false,o=0,n=Math.random().toString(36).substring(2,10);for(;o++<this.MAX_RETRIES&&(Y$1.verbose(`Lock retry ${o} for ${e}`),i=await this.acquire(e,n,o),!i);)await this.sleep(r.RETRY_INTERVAL*o+Math.random()*100);try{return await t()}finally{this.release(e,n);}}static async acquire(e,t,i){let o=Date.now(),n=localStorage.getItem(e),s=n?JSON.parse(n):null;if(s&&o<=s.expiry)return false;let c={owner:t,expiry:o+r.LOCK_TIMEOUT};return localStorage.setItem(e,JSON.stringify(c)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(e)||`{}`).owner===t?(Y$1.verbose(`${t}: Lock acquired for ${e} after ${i} attempts!`),true):(Y$1.verbose(`${t}: Race lost. Another tab acquired the lock.`),false)}static release(e,t){let i=localStorage.getItem(e);if(!i)return;let o=JSON.parse(i);o.owner===t?(localStorage.removeItem(e),Y$1.verbose(`${t}: Lock released`)):Y$1.verbose(`${t}: Cannot release lock. Current owner: ${o.owner}`);}static sleep(e){return new Promise(t=>setTimeout(t,e))}};async function ya(r,e,t){return new Promise((i,o)=>{let n=setTimeout(()=>{o(new Error(`Web Locks API timeout after ${t}ms`));},t);navigator.locks.request(r,async()=>{try{let s=await e();return clearTimeout(n),i(s),s}catch(s){throw clearTimeout(n),o(s),s}}).catch(s=>{clearTimeout(n),o(s);});})}function Ea(){let r=navigator.userAgent||``;return /Safari/.test(r)&&!/Chrome/.test(r)&&!/Chromium/.test(r)||/iPhone|iPad|iPod/i.test(r)&&(/(FBAV|FBAN|Instagram|Twitter|Line|WhatsApp)/i.test(r)||!window.safari?.pushNotificaTion)||/Macintosh/.test(r)&&/Safari/.test(r)&&!/Chrome/.test(r)&&!/Chromium/.test(r)&&!window.safari?.pushNotification?true:Sa()}function Sa(){try{return window.safari?.pushNotification?window.safari.pushNotification.toString()===`[object SafariRemoteNotification]`:!window.indexedDB||!window.localStorage}catch{return true}}var mo=new ui,Ia=`
29
29
  mutation cartMetafieldsSet($metafields: [CartMetafieldsSetInput!]!) {
30
30
  cartMetafieldsSet(metafields: $metafields) {
31
31
  metafields {
@@ -39,7 +39,7 @@ var Be=class{constructor(e,t){this._startTime=e;this._triggerData=t;}intervals=[
39
39
  }
40
40
  }
41
41
  }
42
- `;function Ln(){Ta().catch(r=>{Y$1.error(`Fail to add attributes in cart`,r);});}async function Ia(){let e=await(await fetch(window.Shopify.routes.root+`browsing_context_suggestions.json?country[enabled]=true&country[exclude]=${window.Shopify.country}&language[enabled]=true&language[exclude]=${window.Shopify.language}`)).json(),t=he$3.get().storefrontToken,i=new Headers;i.append(`x-shopify-storefront-access-token`,t),i.append(`Content-Type`,`application/json`),await Rt(Sa,{metafields:[{key:`currentCountry`,ownerId:`gid://shopify/Cart/${E.getCurrent().token}`,type:`single_line_text_field`,value:e.detected_values.country.handle}]},`add-cart-metafields-set`);}function po(){E.getCurrent().token?Ia().catch(r=>{Y$1.error(`Fail to update cart metafields`,r);}):setTimeout(po,500);}async function Ta(){await mo.acquire();let r=E.getCurrent(),e=await Nr$2();if(r.attributes?.letscooee_did===e.letscooee_did&&r.attributes?.letscooee_sn===e.letscooee_sn){Y$1.verbose(`Not calling Shopify update.js API.`,`Current attributes:`,r.attributes),mo.release();return}try{let t=await st(`/cart/update.js`,{attributes:e});Y$1.verbose(`Updated cart attributes`,JSON.stringify(t.data)),r.update(t.data);}catch(t){Y$1.error(`Failed to add cart attributes`,t);}mo.release();}var xa=r=>r,Nn=r=>r.filter(e=>e.removedNodes&&e.removedNodes.length>0);function Mn(r,e={childList:true,subtree:true},t=500,i=xa){return te(o=>{let n=new MutationObserver(s=>o(s));return n.observe(r,e),n},(o,n)=>n.disconnect()).pipe(q$1(o=>i(o)),Ir(o=>o.length>0),Fe(t))}var $n=x$2(Et$3());var Fn=new U,Bn=new U;function Vn(){return Bn.asObservable()}function hi(){Fn.next();}Fn.pipe(Fe(100)).subscribe(ka.bind(void 0));function Wn(){hi(),Da(),Pa();}function Da(){let r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener(`load`,function(){Hn(this._url).catch(e=>Y$1.error(`Unable to process cart change in XMLHttpRequest`,e));}),r.apply(this,arguments)},Y$1.verbose(`Securely overwritten window.XMLHttpRequest.send method`);}function Pa(){let r=window.fetch;try{window.fetch=async function(e,t){return r(e,t).then(i=>{let o=``;try{o=typeof e==`string`||e instanceof URL?e.toString():e?.url??i?.url??``;}catch{}return Hn(o).catch(n=>Y$1.error(`Unable to process cart change in fetch`,n)),i})},Y$1.verbose(`Securely overwritten window.fetch method`);}catch(e){console.warn(`Fail to override fetch.`,`Cooee won't be able to track "Add To Cart" and "Remove From Cart" KPI.`),Y$1.error(e);}}async function Hn(r){Ra(r)&&hi();}function Ra(r){return /\/cart\/(add|change|update|clear)/.test(r)}function _a(r$1,e){let t=r$1?.items,i=e.items,o=[],n=[];if(Y$1.verbose(`Comparing cart change with old count ${t?.length} to new count ${i.length}`),i?.forEach(s$3=>{let c=t?.find(m=>m.vID===s$3.vID);if(c){if(c.quantity!==s$3.quantity){let m=c.quantity<s$3.quantity,b=Math.abs(c.quantity-s$3.quantity),w=s(r({},s$3),{quantity:b});m?o.push(w):n.push(w);}t&&An$1(t,c);}else o.push(s$3);}),t)for(let s of t)n.push(s);Y$1.verbose(`Cart delta: added: ${o.length}, removed: ${n.length}`),o.length&&Un(`Add To Cart`,{items:o}),n.length&&r$1.token===e.token&&Un(`Remove From Cart`,{items:n}),(n.length||o.length)&&Bn.next({itemsAdded:o,itemsRemoved:n,cart:e});}function Un(r,e){K(new Ir$1(r,e));}async function ka(){_a(await fe$4.get(`cart`,{}),await E.getCurrent().getNormalisedCart(true));}var V=class r{static cartDrawerToggle$=new Sr({open:false,firstOpen:false});static DEFAULT_SELECTOR=`cart-drawer`;static _instance;inShadow=false;cartDrawerElement;cartDrawerShadowElement;configWebsite=he$3.get().website??{};currentState=false;mutationSubscription;mutationObserver;firstOpen=true;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=[r.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:true,passive:true});}get element(){return this.cartDrawerElement}static get(){return r._instance||(r._instance=new r),r._instance}static initialize(){r.get();}isOpen(){if(window.cooeeIsCartDrawerVisible)return window.cooeeIsCartDrawerVisible();if(this.cartDrawerElement?.id===`rebuy-cart`)return !!window.Rebuy?.SmartCart?.visible;let e=this.inShadow?this.isPresent():C$1(this.cartDrawerElement);return Y$1.info(`Cart drawer is currently ${e?`open`:`close`}`),e}open(){if(this.isOpen()){Y$1.log(`Drawer is already open`);return}document.dispatchEvent(new CustomEvent(`letscooee:outbound:open-cart`));let e=document.querySelector(this.iconSelector);if(!e){Y$1.verbose(`No clickable cart icon found with selector`,this.iconSelector);return}e.click();}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===r.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id===`mini-cart`}refreshUI(e,t=true){if(window.cooeeUpdateCartDrawer)try{window.cooeeUpdateCartDrawer(e);}catch(i){ke$2(i,`execute-cooeeUpdateCartDrawer`);}else if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove(`is-empty`),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let i=e.items[0].id,o=e.items[0].quantity,n=e.items[0].price;window.cartGiftUpdate(i,n,o,``,`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:true,detail:{}}));else if(this.element?.id===`quick-cart`){let i=document.querySelector(`a[href="/cart"]`);i&&i.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?E.getCurrent().getNormalisedCart(true).then(()=>{window.refreshCart(E.getCurrent());}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():window.CartJS?.getCart?window.CartJS?.getCart():window.updateCartItemJS?window.updateCartItemJS(1,e?.items?.[0]?.id+``):(Y$1.info(`No method found to update the cart drawer. Blindly firing some events to try`),document.dispatchEvent(new CustomEvent(`cart:refresh`,{bubbles:true})));document.dispatchEvent(new CustomEvent(`letscooee:outbound:refresh-ui`,{detail:{responseJSON:e,currentCart:E.getCurrent()}})),t&&hi();}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let t=e.split(`:shadow`);t.length===1?(this.selector=t[0],await this.findCartDrawer()):(this.inShadow=true,this.shadowParentElementSelector=t[0]?.trim(),this.selector=t[1]?.trim(),await this.findCartDrawerWithShadow());}async findCartDrawer(){if(!jt())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await On$1(e),!this.cartDrawerElement){$n.default.warn(`Max attempts exhausted to find cart drawer`);return}Y$1.verbose(`Found`,this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers();}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let t=(await On$1(this.shadowParentElementSelector))?.shadowRoot;t?.mode===`open`&&(this.cartDrawerShadowElement=t,this.createMutationObservers());}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||this.watchForCartToggle();}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,t=new U;this.mutationObserver=new MutationObserver(()=>{t.next();}),this.mutationObserver.observe(e,{attributes:true,subtree:true,childList:this.inShadow}),this.mutationSubscription=t.pipe(we$1(800,void 0,{leading:false,trailing:true})).subscribe(()=>{let i=this.isOpen();this.currentState!==i&&(this.currentState=i,r.cartDrawerToggle$.next({open:i,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=false));});}isPresent(){if(!this.selector||!this.cartDrawerShadowElement)return false;let e=this.cartDrawerShadowElement.querySelector(this.selector);return e?C$1(e):false}async updateBubble(){let e=(await E.getCurrent().getNormalisedCart(true)).itemCount,t=document.querySelector(`.cart-link__bubble`);t&&(t.innerText=e+``);}manualCartIconClicked(e){!e.target.closest(this.iconSelector)||!e.isTrusted||window.CooeeSDK.events.push([`Open Cart`]);}};var uo=new Map,wi=async r=>{for(let n of r.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(n,r);}catch(s){Y$1.error(s);}if(r.isCartEmbed()&&!r.isSubscriptionUpsell()){let s=(await E.getCurrent().getNormalisedCart()).items.map(c=>c.mID);r.items=r.items.filter(c=>!s.includes(c.mID));}if(r.items=qn(r),he$3.get().currencyCount<=1)return r.items;if(r.isShoppableVideo())return await Aa(r.content.videoConfig,r),r.items;let e=r.items.length,t=r.items.map(n=>Gn(n,r)),o=(await Promise.all(t)).filter(n=>n!=null);if(e&&!o.length){let n=`Failed to fetch any product from Ajax API`;throw fe(new Ir$1(`CE Campaign Failed`,{reason:n,currency:r.currency},r)),new Error(n)}return qn(r,o)},qn=(r,e=r.items)=>{if(!r.isCartRecovery())return e;let t=E.getCurrent().items,i=[];for(let o of e)for(let n of o.vars){if(!n.isAvailable)continue;let s=t.find(b=>b.variant_id.toString()===n.mID);if(!s)continue;let c=new ot$2(o);c.name=s.title;let m=new nt$1(n);m.name=s.variant_title,m.price.d=s.discounted_price/100,c.variants=[m],i.push(c);}return i},Aa=async(r,e)=>{await Promise.all(r.videos.map(async t=>{t.items=await Promise.all(t.items.map(async i=>{return await Gn(i,e)||i}));}));},Gn=async(r,e)=>{if(uo.has(r.mID))return uo.get(r.mID);let t,i=`/products/${r.slug}.js`;try{t=(await zn$1(i)).data;}catch(o){return o instanceof ie$4&&o.response?.status===404||ke$2(o,`fetch-shopify-product`,{extra:{item:r,path:i},engagementTrigger:e}),null}return t?Oa(r,t):(Y$1.error(`Item not found after AJAX call for:`,r),null)},Oa=(r,e)=>{if(!r||!e)return r;r.name=e.title,r.tags=e.tags,r.slug=e.handle;let t=r.selectedOrFirstVariant.value;return r.vars.map(i=>{let o=e.variants.find(n=>n.id===+i.mID);o!=null&&(i.name=o.title,i.isAvailable=o.available,i.price.d=o.price?o.price/100:o.price,i.price.effective=i.price.d,i.price.cmp=o.compare_at_price?o.compare_at_price/100:o.compare_at_price,+t.mID===o.id&&(t.effectivePrice.value=i.price.d));}),uo.set(r.mID,r),r};var Yt=r=>{let e=r instanceof ot$2?r.selectedOrFirstVariant.value.mID:r.vID,t=r instanceof ot$2?r.selectedOrFirstVariant.value.name:r.vName;return {product_id:r.mID,product_name:r.name,variant_id:e,variant_name:t}};var vi=class{constructor(e){this.scalingFactor=e;}getLayoutStyles(e){if(!e)return {display:`block`};let t={display:e.disp};return e.of&&(t.objectFit=e.of),e.pos===`absolute`&&(t.width=`auto !important`,t.position=`absolute`,t.right=e.right+`px`,t.left=e.left+`px`,t.top=e.top+`px`,t.bottom=e.bottom+`px`),t}getSizeStyles(e){let t={};return e?.w&&(t.width=e.w),e?.h&&(t.height=e.h),e?.maxW&&(t.maxWidth=e.maxW),e?.maxH&&(t.maxHeight=e.maxH),e?.minW&&(t.minWidth=e.minW),e?.minH&&(t.minHeight=e.minH),t}getBorderStyles(e){if(!e)return {};let t={};return e.radius&&e.radius>0&&(t.borderRadius=this.getSizePx(e.radius)),e.width&&e.width>0&&(t.borderWidth=this.getSizePx(e.width),t.borderStyle=e.style?.toLowerCase(),e.color?this.getColourStyles(e.color,`border-color`,t):t.borderColor=`black`),t}getFlexStyles(e){return e?{gap:e.gap+`px`,flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai,width:`100%`}:{}}getSpaceStyles(e){let t={};return e?(t.paddingTop=this.getSizePx(e.pt),t.paddingBottom=this.getSizePx(e.pb),t.paddingLeft=this.getSizePx(e.pl),t.paddingRight=this.getSizePx(e.pr),t.marginTop=this.getSizePx(e.mt),t.marginBottom=this.getSizePx(e.mb),t.marginLeft=e.cent?`auto`:this.getSizePx(e.ml),t.marginRight=e.cent?`auto`:this.getSizePx(e.mr),t):(t.margin=`0 !important`,t.padding=`unset`,t)}getBackgroundStyles(e){if(!e)return {};let t={};if(e.glossy){let i=`backdrop-filter`,o=`-webkit-`+i,n=`blur(${e.glossy.radius}px)`;if(!CSS.supports(o,n)&&!CSS.supports(i,n))return {background:e.glossy.fallback.rgba};if(t[o]=n,t[i]=n,e.glossy.color)return this.getColourStyles(e.glossy.color,`background`,t)}else if(e.solid){if(e.solid.grad)return this.getGradientStyles(e.solid.grad,`background`,t);if(e.solid.hex)return {backgroundColor:e.solid.rgba}}else if(e.img){if(!e.img.src)return {};let i=(e.img.a??0)/100;t.background=`linear-gradient(rgba(0, 0, 0, ${i}), rgba(0, 0, 0, ${i})),url("${e.img.src}") no-repeat center`,t.backgroundSize=`cover`,e.img.a&&(t[`-webkit-backdrop-filter`]=`opacity(${e.img.a})`,t.backdropFilter=`opacity(${e.img.a})`);}return t}getGradientStyles(e,t,i){if(i??={},e.type===`LINEAR`){let o=`linear-gradient(${e.ang}deg, ${e.c1}, ${e.c2}`;e.c3&&(o+=`, ${e.c3}`),o+=`)`,i[t]=o;}return i}getColourStyles(e,t=`color`,i){return i??={},e?e.grad?this.getGradientStyles(e.grad,t,i):(e.hex&&(i[t]=e.rgba),i):i}getSizePx(e){return this.getScaledSize(e)+`px`}getScaledSize(e){return (e??0)*this.scalingFactor}};var os=x$2(Et$3());var go=class{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content;}};function Ci(){let r$2=location.pathname===`/`?location.pathname:location.pathname.replace(/\/+$/,``);return new go(r({origin:location.origin,path:r$2,qs:location.search,referrer:Ye$1(),name:Be$3().pageName},Je$1()))}function jn(){let r=Be$3(),e=new URLSearchParams(location.search),t=e.get(`cooee-preview`),i=e.get(`cooee-exp-preview`);if(t){let n=t.split(`,`).map(s=>s.trim()).filter(s=>Number.isInteger(+s));n.length&&(r.previewIDs=n);}if(i){let n=i.split(`,`).map(s=>s.trim()).filter(s=>Number.isInteger(+s));n.length&&(r.previewIDs??=[],r.previewIDs.push(...n),r.activeExperiments=true);}let o=e.get(`cooee-variant`)?.trim();o&&(r.previewVariant=o);}function bi(){let r$3=Be$3();return s(r(s(r({},r$3.customContext),{page:Ci(),locale:r$3.locale,currentItem:r$3.currentItem,previewIDs:r$3.previewIDs,previewVariant:r$3.previewVariant,engagementIDs:Na(),cart:no()}),La()),{host:window.location.host})}function La(){let r=window.CooeeSDK.uaParser.getResult();return {os:r.os,device:r.device,browser:r.browser}}function Na(){let r=document.querySelectorAll(`.letscooee-engagement`),e=[];return r.forEach(t=>{let i=t.dataset.engagementId;i&&+i&&e.push(i);}),e}var Ma=`keepalive`in new Request(``),ye=new Headers;Va();async function qe(){let[r$4]=await Promise.all([zn()]);return r(r({},bi()),r$4)}function _t(r){le$1(le).then(()=>Ua(r??{}));}function Ua(r){Qn(`/v1/user/update`,r).then(()=>{Y$1.verbose(`Updated user profile`);}).catch(e=>{Y$1.error(`Error saving user profile`,e);});}function Kn(r){return me(`/v1/event/generate-discount`,r)}function Xn(r){le$1(le).then(()=>Fa({props:r}));}function Fa(r){Qn(`/v1/device/update`,r).then(()=>{Y$1.verbose(`Updated device properties`);}).catch(async e=>{Y$1.error(`Error saving device property`,e);});}function Yn(r){r&&ye.set(`cooee-device-id`,r);}function Jn(r){r&&ye.set(`cooee-first-seen`,r.toUTCString());}function me(r,e){return Zn(`POST`,r,e)}function Qn(r,e){return Zn(`PUT`,r,e)}function Zn(r,e,t){if(!jt())return Y$1.log(`Rejecting ${r} ${e} as this is not e-commerce app`),Promise.reject();if(e.startsWith(`http`)||(e=te$3.apiURL+e),t&&!Ma&&e.includes(fo))return Ba(e,ye,t);let i={method:r,headers:ye,keepalive:false};return t&&(i.body=JSON.stringify(t)),zn$1(e,i)}function Ba(r,e,t){return new Promise((i,o)=>{let n=new XMLHttpRequest;n.open(`POST`,r,true),e.forEach((s,c)=>{n.setRequestHeader(c,s);}),n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE)if(n.status>=200&&n.status<300)try{if(n.getResponseHeader(`Content-Type`)?.includes(`application/json`))i({data:JSON.parse(n.responseText),headers:e,request:n,status:n.status,statusText:n.statusText});else o(new Error(`Content-Type of response header is not json`));}catch(s){o(s);}else o(new Error(`Received status - ${n.status}(${n.statusText})`));},n.onerror=()=>{o(new Error(`Network error occurred during the request.`));},n.send(JSON.stringify(t));})}function Va(){ye.set(`Content-Type`,`application/json; charset=utf-8`),ye.set(`cooee-sdk`,Hr$3),ye.set(`cooee-sdk-code`,Yr$3.toString()),ye.set(`cooee-sdk-version`,Q$4),ye.set(`cooee-shop-name`,Yr()??``);let r=localStorage.getItem(`cooeeDebugTill`);(r&&new Date(+r)>new Date)&&ye.set(`cooee-sdk-debug`,`true`);}var Wa=`
42
+ `;function Nn(){xa().catch(r=>{Y$1.error(`Fail to add attributes in cart`,r);});}async function Ta(){let e=await(await fetch(window.Shopify.routes.root+`browsing_context_suggestions.json?country[enabled]=true&country[exclude]=${window.Shopify.country}&language[enabled]=true&language[exclude]=${window.Shopify.language}`)).json(),t=he$3.get().storefrontToken,i=new Headers;i.append(`x-shopify-storefront-access-token`,t),i.append(`Content-Type`,`application/json`),await Pt(Ia,{metafields:[{key:`currentCountry`,ownerId:`gid://shopify/Cart/${E.getCurrent().token}`,type:`single_line_text_field`,value:e.detected_values.country.handle}]},`add-cart-metafields-set`);}function po(){E.getCurrent().token?Ta().catch(r=>{Y$1.error(`Fail to update cart metafields`,r);}):setTimeout(po,500);}async function xa(){await mo.acquire();let r=E.getCurrent(),e=await xr$1();if(r.attributes?.letscooee_did===e.letscooee_did&&r.attributes?.letscooee_sn===e.letscooee_sn){Y$1.verbose(`Not calling Shopify update.js API.`,`Current attributes:`,r.attributes),mo.release();return}try{let t=await nt(`/cart/update.js`,{attributes:e});Y$1.verbose(`Updated cart attributes`,JSON.stringify(t.data)),r.update(t.data);}catch(t){Y$1.error(`Failed to add cart attributes`,t);}mo.release();}var Da=r=>r,Mn=r=>r.filter(e=>e.removedNodes&&e.removedNodes.length>0);function Un(r,e={childList:true,subtree:true},t=500,i=Da){return te(o=>{let n=new MutationObserver(s=>o(s));return n.observe(r,e),n},(o,n)=>n.disconnect()).pipe(q$1(o=>i(o)),Ir(o=>o.length>0),Fe$1(t))}var qn=x$2(yt$1());var Bn=new U,Vn=new U;function Wn(){return Vn.asObservable()}function fi(){Bn.next();}Bn.pipe(Fe$1(100)).subscribe(Aa.bind(void 0));function Hn(){fi(),Pa(),Ra();}function Pa(){let r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener(`load`,function(){$n(this._url).catch(e=>Y$1.error(`Unable to process cart change in XMLHttpRequest`,e));}),r.apply(this,arguments)},Y$1.verbose(`Securely overwritten window.XMLHttpRequest.send method`);}function Ra(){let r=window.fetch;try{window.fetch=async function(e,t){return r(e,t).then(i=>{let o=``;try{o=typeof e==`string`||e instanceof URL?e.toString():e?.url??i?.url??``;}catch{}return $n(o).catch(n=>Y$1.error(`Unable to process cart change in fetch`,n)),i})},Y$1.verbose(`Securely overwritten window.fetch method`);}catch(e){console.warn(`Fail to override fetch.`,`Cooee won't be able to track "Add To Cart" and "Remove From Cart" KPI.`),Y$1.error(e);}}async function $n(r){_a(r)&&fi();}function _a(r){return /\/cart\/(add|change|update|clear)/.test(r)}function ka(r$1,e){let t=r$1?.items,i=e.items,o=[],n=[];if(Y$1.verbose(`Comparing cart change with old count ${t?.length} to new count ${i.length}`),i?.forEach(s$3=>{let c=t?.find(m=>m.vID===s$3.vID);if(c){if(c.quantity!==s$3.quantity){let m=c.quantity<s$3.quantity,C=Math.abs(c.quantity-s$3.quantity),w=s(r({},s$3),{quantity:C});m?o.push(w):n.push(w);}t&&Cn(t,c);}else o.push(s$3);}),t)for(let s of t)n.push(s);Y$1.verbose(`Cart delta: added: ${o.length}, removed: ${n.length}`),o.length&&Fn(`Add To Cart`,{items:o}),n.length&&r$1.token===e.token&&Fn(`Remove From Cart`,{items:n}),(n.length||o.length)&&Vn.next({itemsAdded:o,itemsRemoved:n,cart:e});}function Fn(r,e){K(new Ir$1(r,e));}async function Aa(){ka(await fe$4.get(`cart`,{}),await E.getCurrent().getNormalisedCart(true));}var V=class r{static cartDrawerToggle$=new Sr({open:false,firstOpen:false});static DEFAULT_SELECTOR=`cart-drawer`;static _instance;inShadow=false;cartDrawerElement;cartDrawerShadowElement;configWebsite=he$3.get().website??{};currentState=false;mutationSubscription;mutationObserver;firstOpen=true;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=[r.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:true,passive:true});}get element(){return this.cartDrawerElement}static get(){return r._instance||(r._instance=new r),r._instance}static initialize(){r.get();}isOpen(){if(window.cooeeIsCartDrawerVisible)return window.cooeeIsCartDrawerVisible();if(this.cartDrawerElement?.id===`rebuy-cart`)return !!window.Rebuy?.SmartCart?.visible;let e=this.inShadow?this.isPresent():C$1(this.cartDrawerElement);return Y$1.info(`Cart drawer is currently ${e?`open`:`close`}`),e}open(){if(this.isOpen()){Y$1.log(`Drawer is already open`);return}document.dispatchEvent(new CustomEvent(`letscooee:outbound:open-cart`));let e=document.querySelector(this.iconSelector);if(!e){Y$1.verbose(`No clickable cart icon found with selector`,this.iconSelector);return}e.click();}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===r.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id===`mini-cart`}refreshUI(e,t=true){if(window.cooeeUpdateCartDrawer)try{window.cooeeUpdateCartDrawer(e);}catch(i){ke$2(i,`execute-cooeeUpdateCartDrawer`);}else if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:e}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&e)this.element.classList.remove(`is-empty`),this.element.renderContents?.(e);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!e?.items?.[0])return;let i=e.items[0].id,o=e.items[0].quantity,n=e.items[0].price;window.cartGiftUpdate(i,n,o,``,`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:true,detail:{}}));else if(this.element?.id===`quick-cart`){let i=document.querySelector(`a[href="/cart"]`);i&&i.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?E.getCurrent().getNormalisedCart(true).then(()=>{window.refreshCart(E.getCurrent());}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():window.CartJS?.getCart?window.CartJS?.getCart():window.updateCartItemJS?window.updateCartItemJS(1,e?.items?.[0]?.id+``):(Y$1.info(`No method found to update the cart drawer. Blindly firing some events to try`),document.dispatchEvent(new CustomEvent(`cart:refresh`,{bubbles:true})));document.dispatchEvent(new CustomEvent(`letscooee:outbound:refresh-ui`,{detail:{responseJSON:e,currentCart:E.getCurrent()}})),t&&fi();}async initialize(){let e=this.configWebsite.cartDrawerSelector;if(!e){await this.findCartDrawer();return}let t=e.split(`:shadow`);t.length===1?(this.selector=t[0],await this.findCartDrawer()):(this.inShadow=true,this.shadowParentElementSelector=t[0]?.trim(),this.selector=t[1]?.trim(),await this.findCartDrawerWithShadow());}async findCartDrawer(){if(!Gt())return;let e=this.selector||this.cartSelector;if(this.cartDrawerElement=await Ln$1(e),!this.cartDrawerElement){qn.default.warn(`Max attempts exhausted to find cart drawer`);return}Y$1.verbose(`Found`,this.cartDrawerElement,`from selector: ${e}`),this.createMutationObservers();}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let t=(await Ln$1(this.shadowParentElementSelector))?.shadowRoot;t?.mode===`open`&&(this.cartDrawerShadowElement=t,this.createMutationObservers());}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||this.watchForCartToggle();}watchForCartToggle(){let e=this.cartDrawerElement||this.cartDrawerShadowElement,t=new U;this.mutationObserver=new MutationObserver(()=>{t.next();}),this.mutationObserver.observe(e,{attributes:true,subtree:true,childList:this.inShadow}),this.mutationSubscription=t.pipe(we$1(800,void 0,{leading:false,trailing:true})).subscribe(()=>{let i=this.isOpen();this.currentState!==i&&(this.currentState=i,r.cartDrawerToggle$.next({open:i,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=false));});}isPresent(){if(!this.selector||!this.cartDrawerShadowElement)return false;let e=this.cartDrawerShadowElement.querySelector(this.selector);return e?C$1(e):false}async updateBubble(){let e=(await E.getCurrent().getNormalisedCart(true)).itemCount,t=document.querySelector(`.cart-link__bubble`);t&&(t.innerText=e+``);}manualCartIconClicked(e){!e.target.closest(this.iconSelector)||!e.isTrusted||window.CooeeSDK.events.push([`Open Cart`]);}};var uo=new Map,hi=async r=>{for(let n of r.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(n,r);}catch(s){Y$1.error(s);}if(r.isCartEmbed()&&!r.isSubscriptionUpsell()){let s=(await E.getCurrent().getNormalisedCart()).items.map(c=>c.mID);r.items=r.items.filter(c=>!s.includes(c.mID));}if(r.items=Gn(r),he$3.get().currencyCount<=1)return r.items;if(r.isShoppableVideo())return await Oa(r.content.videoConfig,r),r.items;let e=r.items.length,t=r.items.map(n=>jn(n,r)),o=(await Promise.all(t)).filter(n=>n!=null);if(e&&!o.length){let n=`Failed to fetch any product from Ajax API`;throw fe(new Ir$1(`CE Campaign Failed`,{reason:n,currency:r.currency},r)),new Error(n)}return Gn(r,o)},Gn=(r,e=r.items)=>{if(!r.isCartRecovery())return e;let t=E.getCurrent().items,i=[];for(let o of e)for(let n of o.vars){if(!n.isAvailable)continue;let s=t.find(C=>C.variant_id.toString()===n.mID);if(!s)continue;let c=new ot$2(o);c.name=s.title;let m=new nt$1(n);m.name=s.variant_title,m.price.d=s.discounted_price/100,c.variants=[m],i.push(c);}return i},Oa=async(r,e)=>{await Promise.all(r.videos.map(async t=>{t.items=await Promise.all(t.items.map(async i=>{return await jn(i,e)||i}));}));},jn=async(r,e)=>{if(uo.has(r.mID))return uo.get(r.mID);let t,i=`/products/${r.slug}.js`;try{t=(await jn$1(i)).data;}catch(o){return o instanceof oe$5&&o.response?.status===404||ke$2(o,`fetch-shopify-product`,{extra:{item:r,path:i},engagementTrigger:e}),null}return t?La(r,t):(Y$1.error(`Item not found after AJAX call for:`,r),null)},La=(r,e)=>{if(!r||!e)return r;r.name=e.title,r.tags=e.tags,r.slug=e.handle;let t=r.selectedOrFirstVariant.value;return r.vars.map(i=>{let o=e.variants.find(n=>n.id===+i.mID);o!=null&&(i.name=o.title,i.isAvailable=o.available,i.price.d=o.price?o.price/100:o.price,i.price.effective=i.price.d,i.price.cmp=o.compare_at_price?o.compare_at_price/100:o.compare_at_price,+t.mID===o.id&&(t.effectivePrice.value=i.price.d));}),uo.set(r.mID,r),r};var Xt=r=>{let e=r instanceof ot$2?r.selectedOrFirstVariant.value.mID:r.vID,t=r instanceof ot$2?r.selectedOrFirstVariant.value.name:r.vName;return {product_id:r.mID,product_name:r.name,variant_id:e,variant_name:t}};var wi=class{constructor(e){this.scalingFactor=e;}getLayoutStyles(e){if(!e)return {display:`block`};let t={display:e.disp};return e.of&&(t.objectFit=e.of),e.pos===`absolute`&&(t.width=`auto !important`,t.position=`absolute`,t.right=e.right+`px`,t.left=e.left+`px`,t.top=e.top+`px`,t.bottom=e.bottom+`px`),t}getSizeStyles(e){let t={};return e?.w&&(t.width=e.w),e?.h&&(t.height=e.h),e?.maxW&&(t.maxWidth=e.maxW),e?.maxH&&(t.maxHeight=e.maxH),e?.minW&&(t.minWidth=e.minW),e?.minH&&(t.minHeight=e.minH),t}getBorderStyles(e){if(!e)return {};let t={};return e.radius&&e.radius>0&&(t.borderRadius=this.getSizePx(e.radius)),e.width&&e.width>0&&(t.borderWidth=this.getSizePx(e.width),t.borderStyle=e.style?.toLowerCase(),e.color?this.getColourStyles(e.color,`border-color`,t):t.borderColor=`black`),t}getFlexStyles(e){return e?{gap:e.gap+`px`,flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai,width:`100%`}:{}}getSpaceStyles(e){let t={};return e?(t.paddingTop=this.getSizePx(e.pt),t.paddingBottom=this.getSizePx(e.pb),t.paddingLeft=this.getSizePx(e.pl),t.paddingRight=this.getSizePx(e.pr),t.marginTop=this.getSizePx(e.mt),t.marginBottom=this.getSizePx(e.mb),t.marginLeft=e.cent?`auto`:this.getSizePx(e.ml),t.marginRight=e.cent?`auto`:this.getSizePx(e.mr),t):(t.margin=`0 !important`,t.padding=`unset`,t)}getBackgroundStyles(e){if(!e)return {};let t={};if(e.glossy){let i=`backdrop-filter`,o=`-webkit-`+i,n=`blur(${e.glossy.radius}px)`;if(!CSS.supports(o,n)&&!CSS.supports(i,n))return {background:e.glossy.fallback.rgba};if(t[o]=n,t[i]=n,e.glossy.color)return this.getColourStyles(e.glossy.color,`background`,t)}else if(e.solid){if(e.solid.grad)return this.getGradientStyles(e.solid.grad,`background`,t);if(e.solid.hex)return {backgroundColor:e.solid.rgba}}else if(e.img){if(!e.img.src)return {};let i=(e.img.a??0)/100;t.background=`linear-gradient(rgba(0, 0, 0, ${i}), rgba(0, 0, 0, ${i})),url("${e.img.src}") no-repeat center`,t.backgroundSize=`cover`,e.img.a&&(t[`-webkit-backdrop-filter`]=`opacity(${e.img.a})`,t.backdropFilter=`opacity(${e.img.a})`);}return t}getGradientStyles(e,t,i){if(i??={},e.type===`LINEAR`){let o=`linear-gradient(${e.ang}deg, ${e.c1}, ${e.c2}`;e.c3&&(o+=`, ${e.c3}`),o+=`)`,i[t]=o;}return i}getColourStyles(e,t=`color`,i){return i??={},e?e.grad?this.getGradientStyles(e.grad,t,i):(e.hex&&(i[t]=e.rgba),i):i}getSizePx(e){return this.getScaledSize(e)+`px`}getScaledSize(e){return (e??0)*this.scalingFactor}};var ns=x$2(yt$1());var go=class{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(e){this.name=e.name,this.path=e.path,this.qs=e.qs,this.referrer=e.referrer,this.utmSource=e.utmSource||e.utm_source,this.utmMedium=e.utmMedium||e.utm_medium,this.utmCampaign=e.utmCampaign||e.utm_campaign,this.utmId=e.utmId||e.utm_id,this.utmTerm=e.utmTerm||e.utm_term,this.utmContent=e.utmContent||e.utm_content;}};function vi(){let r$2=location.pathname===`/`?location.pathname:location.pathname.replace(/\/+$/,``);return new go(r({origin:location.origin,path:r$2,qs:location.search,referrer:Ye$1(),name:Be$3().pageName},Je()))}function zn(){let r=Be$3(),e=new URLSearchParams(location.search),t=e.get(`cooee-preview`),i=e.get(`cooee-exp-preview`);if(t){let n=t.split(`,`).map(s=>s.trim()).filter(s=>Number.isInteger(+s));n.length&&(r.previewIDs=n);}if(i){let n=i.split(`,`).map(s=>s.trim()).filter(s=>Number.isInteger(+s));n.length&&(r.previewIDs??=[],r.previewIDs.push(...n),r.activeExperiments=true);}let o=e.get(`cooee-variant`)?.trim();o&&(r.previewVariant=o);}function bi(){let r$3=Be$3();return s(r(s(r({},r$3.customContext),{page:vi(),locale:r$3.locale,currentItem:r$3.currentItem,previewIDs:r$3.previewIDs,previewVariant:r$3.previewVariant,engagementIDs:Ma(),cart:no()}),Na()),{host:window.location.host})}function Na(){let r=window.CooeeSDK.uaParser.getResult();return {os:r.os,device:r.device,browser:r.browser}}function Ma(){let r=document.querySelectorAll(`.letscooee-engagement`),e=[];return r.forEach(t=>{let i=t.dataset.engagementId;i&&+i&&e.push(i);}),e}var Ua=`keepalive`in new Request(``),fo=new Headers,Ci={type:Gr$3,code:Hr$3,version:Q$4,shopName:Xr()??``};Wa();async function $e(){let[r$4]=await Promise.all([Kn()]);return r(r({},bi()),r$4)}function Rt(r){le$1(le).then(()=>Fa(r??{}));}function Fa(r){Zn(`/v1/user/update`,r).then(()=>{Y$1.verbose(`Updated user profile`);}).catch(e=>{Y$1.error(`Error saving user profile`,e);});}function Xn(r){return me(`/v1/event/generate-discount`,r)}function Yn(r){le$1(le).then(()=>Ba({props:r}));}function Ba(r){Zn(`/v1/device/update`,r).then(()=>{Y$1.verbose(`Updated device properties`);}).catch(async e=>{Y$1.error(`Error saving device property`,e);});}function Jn(r){r&&(Ci.deviceId=r);}function Qn(r){r&&(Ci.firstSeen=r.toUTCString());}function me(r,e){return es(`POST`,r,e)}function Zn(r,e){return es(`PUT`,r,e)}function es(r$5,e,t){if(!Gt())return Y$1.log(`Rejecting ${r$5} ${e} as this is not e-commerce app`),Promise.reject();e.startsWith(`http`)||(e=ee$4.apiURL+e);let i=t?s(r({},t),{sdkMeta:Ci}):void 0;if(i&&!Ua&&e.includes(ho))return Va(e,fo,i);let o={method:r$5,headers:fo,keepalive:false};return i&&(o.body=JSON.stringify(i)),jn$1(e,o)}function Va(r,e,t){return new Promise((i,o)=>{let n=new XMLHttpRequest;n.open(`POST`,r,true),e.forEach((s,c)=>{n.setRequestHeader(c,s);}),n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE)if(n.status>=200&&n.status<300)try{if(n.getResponseHeader(`Content-Type`)?.includes(`application/json`))i({data:JSON.parse(n.responseText),headers:e,request:n,status:n.status,statusText:n.statusText});else o(new Error(`Content-Type of response header is not json`));}catch(s){o(s);}else o(new Error(`Received status - ${n.status}(${n.statusText})`));},n.onerror=()=>{o(new Error(`Network error occurred during the request.`));},n.send(JSON.stringify(t));})}function Wa(){fo.set(`Content-Type`,`text/plain; charset=utf-8`);let r=localStorage.getItem(`cooeeDebugTill`);(r&&new Date(+r)>new Date)&&(Ci.debug=true);}var Ha=`
43
43
  mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
44
44
  cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
45
45
  cart {
@@ -51,7 +51,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
51
51
  }
52
52
  }
53
53
  }
54
- `,Ge=class{static navigate(e,t,i){let o=`${location.origin}/discount/${e}`;switch(Y$1.log(`Applying discount code ${e}`,t,i),t){case Me$1.CART_PAGE:location.href=`${o}?redirect=/cart`;break;case Me$1.CART_DRAWER:location.href=`${o}?redirect=${location.pathname}#open-cart-drawer=1`;break;case Me$1.SHOPIFY_CHECKOUT:location.href=`${o}?redirect=/checkout`;break;case Me$1.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${o}?redirect=/cart#initiate-checkout=1`);break;default:location.href=`${o}?redirect=${i||location.pathname}`;}}static navigateWithoutDiscount(e,t){let i=V.get();switch(e){case Me$1.CART_PAGE:location.href=`/cart`;break;case Me$1.SHOPIFY_CHECKOUT:location.href=`/checkout`;break;case Me$1.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`/cart#initiate-checkout=1`);break;case Me$1.CART_DRAWER:i.open();break}t&&i.refreshUI(t);}static async applyWithStorefront(e){let t={cartId:`gid://shopify/Cart/${E.getCurrent().token}`,discountCodes:e};Y$1.verbose(`Applying ${e.length} coupons on cart`),await Rt(Wa,t,`storefront-apply-discount`);}static checkThirdPartyMethods(e){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.handleFloCheckoutBtn?window.handleFloCheckoutBtn():window.openRzpCheckout?window.openRzpCheckout():location.href=e;}};var es=x$2(Te$1());var Ha=`
54
+ `,qe=class{static navigate(e,t,i){let o=`${location.origin}/discount/${e}`;switch(Y$1.log(`Applying discount code ${e}`,t,i),t){case Me$1.CART_PAGE:location.href=`${o}?redirect=/cart`;break;case Me$1.CART_DRAWER:location.href=`${o}?redirect=${location.pathname}#open-cart-drawer=1`;break;case Me$1.SHOPIFY_CHECKOUT:location.href=`${o}?redirect=/checkout`;break;case Me$1.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${o}?redirect=/cart#initiate-checkout=1`);break;default:location.href=`${o}?redirect=${i||location.pathname}`;}}static navigateWithoutDiscount(e,t){let i=V.get();switch(e){case Me$1.CART_PAGE:location.href=`/cart`;break;case Me$1.SHOPIFY_CHECKOUT:location.href=`/checkout`;break;case Me$1.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`/cart#initiate-checkout=1`);break;case Me$1.CART_DRAWER:i.open();break}t&&i.refreshUI(t);}static async applyWithStorefront(e){let t={cartId:`gid://shopify/Cart/${E.getCurrent().token}`,discountCodes:e};Y$1.verbose(`Applying ${e.length} coupons on cart`),await Pt(Ha,t,`storefront-apply-discount`);}static checkThirdPartyMethods(e){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.handleFloCheckoutBtn?window.handleFloCheckoutBtn():window.openRzpCheckout?window.openRzpCheckout():location.href=e;}};var ts=x$2(Te$1());var $a=`
55
55
  mutation cartCreate($input: CartInput) {
56
56
  cartCreate(input: $input) {
57
57
  cart {
@@ -64,25 +64,25 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
64
64
  }
65
65
  }
66
66
  }
67
- `;function ts(r){let e=V.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections==`function`)try{return {sections_url:window.location.pathname,sections:window.cooeeGetCartSections()}}catch(t){ke$2(t,`execute-cooeeGetCartSections`,{engagementTrigger:r});}else {if(e.isMiniCart())return {sections:[`mini-cart`]};if(e.isShopifyDefaultDrawer())return {sections:e.element.getSectionsToRender?.().map((t=>t.section??t.id))}}return {}}async function rs(r$5,e){if(!pe$4.hasKeys(r$5)){Y$1.warn(`No update fields provided`);return}let t=ts(e),i=r(r({},r$5),t);try{let o=await st(`/cart/update.js`,i);return Y$1.log(`Updated cart`,r$5),E.getCurrent().update(o.data),o.data}catch(o){ke$2(o,`cart-update`),Ln$1(`Failed to update item in cart`);}}var yi=class{async addToCart(e,t){if(!e.length)return;let i=e.map(s=>{let{vID:c,vName:m,quantity:b}=this.getVariantDetails(s),w=t.getPrivateAttributesForLineItem();if(pe$4.hasKeys(window.CooeeSDK.customItemProperties)){let O={name:m},U={templateSuffix:s.templateSuffix},y=es.render(JSON.stringify(window.CooeeSDK.customItemProperties),{variant:O,product:U});w=r(r({},JSON.parse(y)),w);}return {id:c?+c:+s.mID,quantity:b,properties:w}}),o=ts(t),n=r({items:i},o);try{let s=await st(`/cart/add.js`,n);return Y$1.log(`Added ${e.length} items to Cart`),Ln$1(`Product added to your cart`),s.data}catch(s){ke$2(s,`cart-item-add`,{engagementTrigger:t});let c=[`Failed to add product in cart.`];if(s instanceof ie$4&&s.is40x()&&s.responseText){let m=s.responseText;m.description&&c.push(`Reason: ${m.description}`);}c.push(`Please try again later.`),Ln$1(c.join(` `));}}async copyDiscountCode(e){if(e)try{await navigator.clipboard.writeText(e),Y$1.log(`Code-${e} copied`),Ln$1(`Discount code copied`);}catch(t){Y$1.error(`Failed to copy code`,t);}}getProductURL(e){if(!e?.link)return;let t=_n(e.link);if(t)return St(`/products/`+t)}async upgradeToSubscription(e,t){if(!e){Y$1.warn(`Trying to upgrade to subscription with no item`);return}let i=await E.getCurrent().getNormalisedCart(),o=e.selectedOrFirstVariant.value,n=i.items.findIndex(m=>m.vID===o.mID),s=o.selectedSellingPlan.value,c={line:n+1,selling_plan:s?.mID||null,properties:t.getPrivateAttributesForLineItem()};try{let m=await st(`/cart/change.js`,c);return Y$1.log(`Upgraded ${e} selling plan`),Ln$1(`Line item updated`),E.getCurrent().update(m.data),m.data}catch(m){ke$2(m,`cart-switch-subscription`,{engagementTrigger:t}),Ln$1(`Failed to update subscription`);}}async createNewCart(e,t,i){if(!e?.vID){Y$1.error(`No variant ID found to perform Buy now`,e);return}let o=t?[t]:[];return (await Rt(Ha,{input:{lines:[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:i.getKVFormatPrivateAttributesForLineItem()}],discountCodes:o,attributes:await Pn(`Buy Now`)}},`storefront-create-cart`)).data.data?.cartCreate?.cart?.checkoutUrl}async process(e){let t=e.clickAction,i=e.items,o=e.triggerData,n;if(t.at){let s=t;Y$1.log(`Performing ${JSON.stringify(s)} action`);let c={};if(s.at===He$3.GO_TO_PRODUCT)n=this.getProductURL(i[0]);else if(s.at===He$3.ADD_TO_CART)i?.length&&await this.addToCart(i,o);else if(s.at===He$3.COPY_COUPON_CODE)await this.copyDiscountCode(o.discount?.code),c.discountCode=o.discount?.code;else if(s.at===He$3.OPEN_CART)V.get().open();else if(s.at===He$3.GO_TO_COLLECTION){let m=e.collections;if(!m?.length)return;n=St(`/collections/`+m[0].handle);}c.products=i.map(Yt),c.redirectTo=n,Jt(s.at,c);}t.applyDiscount&&o.discount?.code?Ge.navigate(o.discount.code,o.redirectBehaviour,n):n&&(location.pathname=n);}getVariantDetails(e){let t,i,o;if(e instanceof et)t=e.vID,i=e.vName,o=e.quantity??1;else {if(!e.vars?.length)return {};t=e.selectedOrFirstVariant.value.mID,i=e.selectedOrFirstVariant.value.name,o=1;}return {vID:t,quantity:o,vName:i}}};async function is(r$6,e){if(!pe$4.hasKeys(e)){Y$1.warn(`No update fields provided`);return}let t=r({id:r$6.key},e);try{let i=await st(`/cart/change.js`,t);Y$1.log(`Updated line-item`,r$6),E.getCurrent().update(i.data);}catch(i){ke$2(i,`cart-item-update`);}}var _e=class{constructor(e){this.triggerContext=e;}async execute(e){let t=Be$3().currentItem,i=e.clickAction;if(!i)return;let o=e.item,n=this.triggerContext,s=new yi,c=n.triggerData.redirectBehaviour,m=!!n.triggerData.discount?.type&&!!i?.applyDiscount,b={selectedVariants:n.triggerData.nonMutableItems.map(v=>({itemMID:v.mID,mID:v.selectedOrFirstVariant.value.mID,variantID:v.selectedOrFirstVariant.value.mID})),eID:n.triggerData.engagementID,cID:n.triggerData.contentID},w=``,O=[],U=[];if(o?U=[o.toEmbed()]:e.embeddedItem&&(U=[e.embeddedItem]),i.at===He$3.ADD_BUNDLE){let v=n.selectedItems;if(U=e.embeddedItems??v.map(L=>L.toEmbed()),n.shouldGiveFBTDiscount||e.embeddedItems?.length){let L;e.embeddedItems?L=e.embeddedItems.map(C=>({itemMID:C.mID,mID:C.vID,variantID:C.vID,quantity:C.quantity})):L=v.map(C=>({itemMID:C.mID,mID:C.selectedOrFirstVariant.value.mID,variantID:C.selectedOrFirstVariant.value.mID}));let A=n.triggerData.bundleFrom;n.triggerData.isBundleOnCartDrawer()&&A&&(L.push({itemMID:A.mID,mID:A.selectedOrFirstVariant.value.mID,isPrimary:true}),U.unshift(A.toEmbed())),b.selectedVariants=L,n.triggerData.isBundleOnPDP()&&b.selectedVariants.forEach(C=>{C.mID===t.vID&&(C.isPrimary=true);});}else b=void 0;O=e.embeddedItems??v;}else if(i.at===He$3.INITIATE_CHECKOUT){let v=await E.getCurrent().getNormalisedCart();U=v.items,b.selectedVariants=v.items.map(L=>({itemMID:L.mID,mID:L.vID}));}else if(i.at===He$3.ADD_TO_CART)O=o?[o]:[e.embeddedItem];else if(i.at===He$3.QUICK_VIEW){window.cooeeShowQuickItem(this.triggerContext,o),this.sendTriggerClicked(U,{from:`button`},e.video);return}else if(i.at===He$3.GO_TO_PRODUCT)w=o?St(`/products/`+o.slug):e.embeddedItem?.link;else if(i.at===He$3.GO_TO_URL){let v=Rn$1(i.gu?.u);window.CooeeSDK.allowExternalURL?v&&(w=v.href):v&&(w=v.pathname+v.search+v.hash);}else if(i.at===He$3.UPGRADE_TO_SUBSCRIPTION){let v=await s.upgradeToSubscription(o,n.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),V.get().refreshUI(v);}else if(i.at===He$3.GO_TO_COLLECTION){let v=this.triggerContext.triggerData.collections?.[0];v&&(w=`collections/`+v.handle);}if(this.sendTriggerClicked(U,{from:`button`},e.video),Y$1.verbose({redirectPath:w,redirectBehaviour:c,hasDiscount:m}),!m&&w){Jt(i.at,{redirectTo:w}),location.href=w;return}let y,P=false;try{y=await this.getOrGenerateDiscountCode(b),Y$1.verbose(`Discount code (if any) to apply`,y);}catch(v){if(!this.triggerContext.triggerData.isBYOB()){os.default.error(`Unable to get a discount code`,v);return}}if(y&&i.at===He$3.COPY_COUPON_CODE)await s.copyDiscountCode(y);else if(i.at===He$3.BUY_NOW){let v=await s.createNewCart(t,y,n.triggerData);v&&(Jt(i.at,{products:[Yt(t)],redirectTo:v}),location.href=v);return}try{y&&await Ge.applyWithStorefront([y]);}catch(v){Y$1.error(v),P=true;}let x;if(O?.length&&(x=await s.addToCart(O,n.triggerData)),Jt(i.at,{products:O.map(Yt),redirectTo:w,discountCode:y}),P&&y){Ge.navigate(y,c,w);return}if(w){location.href=w;return}Ge.navigateWithoutDiscount(c,x);}sendTriggerClicked(e,t,i){let o=new Ir$1(`CE Trigger Clicked`,t,this.triggerContext.triggerData);o.items=e,o.setVideos(i),fe(o);}async getOrGenerateDiscountCode(e){let t=this.triggerContext.triggerData.discount;if(!t?.type)return;let i=``;if(t.type===ce.STATIC){if(!t.code)throw to(`No discount code found`,`warning`,{triggerContext:this.triggerContext}),new Error(`No discount code found`);return t.code}if(e){if(i=await $a(e,this.triggerContext),!i)throw Y$1.error(`No discount code found`,e),new Error(`Discount code not found or generated`);return i}}};function Jt(r$7,e){document.dispatchEvent(new CustomEvent(`letscooee:outbound:cta-executed`,{detail:r({action:He$3[r$7]},e)}));}async function $a(r,e){try{return (await Kn(r)).data.code}catch(t){throw Ln$1(`Failed to generate a discount code`),ke$2(t,`backend-generate-discount`,{triggerContext:e}),t}}var _=class extends g$1{stylesConverter=new vi(1);mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=M$1()?`sm`:`lg`,this.clickExecutor=new _e(this.props.triggerContext);}getCompiledStyles(){return this.putStyleAccordingToDevice(),r(r(s(r(r(r(r(r(r({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:`border-box`,outline:`none`}),this.getComponentStyles()),this.props.style)}matchWhenCondition(e){if(!e?.op)return true;let{lhs:t,rhs:i}=e;switch(e.op){case `eq`:return t===i;case `gt`:return +t>+i;case `gte`:return +t>=+i;case `lt`:return +t<+i;case `lte`:return +t<=+i;case `ne`:return t!==i;case `null`:return t==null;case `empty`:return t.trim()===``;case `in`:return new RegExp(`\\b${i}\\b`).test(t);case `nin`:return !new RegExp(`\\b${i}\\b`).test(t);default:return Y$1.error(`Invalid operator found for when condition - ${e.op}`),false}}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,M$1()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=r(r({},this.mediaStyle),e.style.sm));}sendTriggerClicked(e,t){this.clickExecutor.sendTriggerClicked(e,t);}async onClick(e,t){e.stopPropagation(),t.clickAction||(t.clickAction=this.props.element.clc),t.clickAction?.at&&await this.clickExecutor.execute(t);}};var qa=0;function f(r,e,t,i,o,n){e||(e={});var s,c,m=e;if(`ref`in m)for(c in m={},e)c==`ref`?s=e[c]:m[c]=e[c];var b={type:r,props:m,key:t,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--qa,__i:-1,__u:0,__source:o,__self:n};if(typeof r==`function`&&(s=r.defaultProps))for(c in s)m[c]===void 0&&(m[c]=s[c]);return h$1.vnode&&h$1.vnode(b),b}var oe=class extends _{componentDidMount(){this.setState(()=>({text:this.props.element.text})),W$2(this.onChange.bind(this));}componentWillReceiveProps(e){this.props.element=e.element,this.onChange();}render(){let e=this.getCompiledStyles(),t=this.state.text;return t||(e.display=`none`,t=``),f(`div`,{style:e,onClick:this.customOnClick.bind(this),className:`lc-text`,children:f(`span`,{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:t}})})}customOnClick(){this.props.onClick&&this.props.onClick(`title`);}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,t={bundle:e.discountData.value,customer:e.customerData,cart:e.getCartMagicVariables()},o=new G(Ve$2(this.props.element,t,this.props.triggerContext));if(!this.matchWhenCondition(o.when)){this.setState(()=>({text:``}));return}this.setState(()=>({text:o.text}));}getTypoStyles(){let e={},t=this.mediaStyle.typo??new H;return e.letterSpacing=t.letterSpacing,e.fontSize=t.fs+`px`,e.lineHeight=t.lh,e.fontFamily=t.fam.name||`inherit`,e.textAlign=t.alignment,e.fontWeight=t.fw,e.textDecoration=t.td??`none`,this.stylesConverter.getColourStyles(t.tc,`color`,e),e}getComponentStyles(){return r({},this.getTypoStyles())}getSpanStyle(){return {overflow:`hidden`,display:`-webkit-box`,webkitBoxOrient:`vertical`,webkitLineClamp:2,color:`inherit`,fontSize:`inherit`,fontWeight:`inherit`,fontFamily:`inherit`}}};var at=class extends oe{render(){return f(`div`,{style:this.getCompiledStyles(),className:`lc-button`,onClick:e=>this.onClick(e,{item:this.props.item}),children:f(`span`,{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return s(r({},super.getComponentStyles()),{cursor:`pointer`})}};var ho=class extends g$1{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos===`end`?f(`div`,{style:r(r({},this.getElementStyle()),this.props.styles),children:[f(`span`,{children:this.props.time}),f(`span`,{style:this.getTimeLabelStyle(),children:this.props.label})]}):f(`div`,{style:r(r({},this.getElementStyle()),this.props.styles),children:[f(`span`,{style:this.getTimeLabelStyle(),children:this.props.label}),f(`span`,{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return {fontSize:`0.5em`,alignContent:`center`}}getElementStyle(){let e={display:`flex`,flexDirection:`column`,placeContent:`center center`,textAlign:`center`};return this.props.element.horizontal&&(e.gridTemplateColumns=`repeat(2, minmax(0, 1fr))`),e}},Qt=class extends oe{labels={Days:`00`,Hours:`00`,Minutes:`00`,Seconds:`00`};componentWillMount(){super.componentWillMount(),this.setState(()=>r({},this.labels)),this.processAndStartTimer();}render(){return f(`div`,{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>f(ho,{styles:this.getCompiledStyles(),label:e,time:this.state[e],element:this.props.element}))})}getLabelsParentStyle(){return {display:`grid`,justifyContent:`center`,gridTemplateColumns:`repeat(4, auto)`,gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return {display:`grid`,placeContent:`center center`}}getComponentStyles(){return r(r({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,e=>{this.labels.Days=String(e.days).padStart(2,`0`),this.labels.Hours=String(e.hours).padStart(2,`0`),this.labels.Minutes=String(e.minutes).padStart(2,`0`),this.labels.Seconds=String(e.seconds).padStart(2,`0`),this.setState(()=>r({},this.labels));});}};function Ei(r,e){if(!r)return;let t={loop:e.loop,slidesPerView:e.maxInRow,spaceBetween:e.gap+`px`,pagination:{type:e.pagination.type,el:r.querySelector(`.swiper-pagination`),clickable:true,renderBullet:(o,n)=>`
67
+ `;function rs(r){let e=V.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections==`function`)try{return {sections_url:window.location.pathname,sections:window.cooeeGetCartSections()}}catch(t){ke$2(t,`execute-cooeeGetCartSections`,{engagementTrigger:r});}else {if(e.isMiniCart())return {sections:[`mini-cart`]};if(e.isShopifyDefaultDrawer())return {sections:e.element.getSectionsToRender?.().map((t=>t.section??t.id))}}return {}}async function is(r$6,e){if(!pe$4.hasKeys(r$6)){Y$1.warn(`No update fields provided`);return}let t=rs(e),i=r(r({},r$6),t);try{let o=await nt(`/cart/update.js`,i);return Y$1.log(`Updated cart`,r$6),E.getCurrent().update(o.data),o.data}catch(o){ke$2(o,`cart-update`),Nn$2(`Failed to update item in cart`);}}var yi=class{async addToCart(e,t){if(!e.length)return;let i=e.map(s=>{let{vID:c,vName:m,quantity:C}=this.getVariantDetails(s),w=t.getPrivateAttributesForLineItem();if(pe$4.hasKeys(window.CooeeSDK.customItemProperties)){let O={name:m},F={templateSuffix:s.templateSuffix},y=ts.render(JSON.stringify(window.CooeeSDK.customItemProperties),{variant:O,product:F});w=r(r({},JSON.parse(y)),w);}return {id:c?+c:+s.mID,quantity:C,properties:w}}),o=rs(t),n=r({items:i},o);try{let s=await nt(`/cart/add.js`,n);return Y$1.log(`Added ${e.length} items to Cart`),Nn$2(`Product added to your cart`),s.data}catch(s){ke$2(s,`cart-item-add`,{engagementTrigger:t});let c=[`Failed to add product in cart.`];if(s instanceof oe$5&&s.is40x()&&s.responseText){let m=s.responseText;m.description&&c.push(`Reason: ${m.description}`);}c.push(`Please try again later.`),Nn$2(c.join(` `));}}async copyDiscountCode(e){if(e)try{await navigator.clipboard.writeText(e),Y$1.log(`Code-${e} copied`),Nn$2(`Discount code copied`);}catch(t){Y$1.error(`Failed to copy code`,t);}}getProductURL(e){if(!e?.link)return;let t=kn(e.link);if(t)return Et(`/products/`+t)}async upgradeToSubscription(e,t){if(!e){Y$1.warn(`Trying to upgrade to subscription with no item`);return}let i=await E.getCurrent().getNormalisedCart(),o=e.selectedOrFirstVariant.value,n=i.items.findIndex(m=>m.vID===o.mID),s=o.selectedSellingPlan.value,c={line:n+1,selling_plan:s?.mID||null,properties:t.getPrivateAttributesForLineItem()};try{let m=await nt(`/cart/change.js`,c);return Y$1.log(`Upgraded ${e} selling plan`),Nn$2(`Line item updated`),E.getCurrent().update(m.data),m.data}catch(m){ke$2(m,`cart-switch-subscription`,{engagementTrigger:t}),Nn$2(`Failed to update subscription`);}}async createNewCart(e,t,i){if(!e?.vID){Y$1.error(`No variant ID found to perform Buy now`,e);return}let o=t?[t]:[];return (await Pt($a,{input:{lines:[{merchandiseId:`gid://shopify/ProductVariant/${e.vID}`,quantity:1,attributes:i.getKVFormatPrivateAttributesForLineItem()}],discountCodes:o,attributes:await On$1(`Buy Now`)}},`storefront-create-cart`)).data.data?.cartCreate?.cart?.checkoutUrl}async process(e){let t=e.clickAction,i=e.items,o=e.triggerData,n;if(t.at){let s=t;Y$1.log(`Performing ${JSON.stringify(s)} action`);let c={};if(s.at===He$3.GO_TO_PRODUCT)n=this.getProductURL(i[0]);else if(s.at===He$3.ADD_TO_CART)i?.length&&await this.addToCart(i,o);else if(s.at===He$3.COPY_COUPON_CODE)await this.copyDiscountCode(o.discount?.code),c.discountCode=o.discount?.code;else if(s.at===He$3.OPEN_CART)V.get().open();else if(s.at===He$3.GO_TO_COLLECTION){let m=e.collections;if(!m?.length)return;n=Et(`/collections/`+m[0].handle);}c.products=i.map(Xt),c.redirectTo=n,Yt(s.at,c);}t.applyDiscount&&o.discount?.code?qe.navigate(o.discount.code,o.redirectBehaviour,n):n&&(location.pathname=n);}getVariantDetails(e){let t,i,o;if(e instanceof et)t=e.vID,i=e.vName,o=e.quantity??1;else {if(!e.vars?.length)return {};t=e.selectedOrFirstVariant.value.mID,i=e.selectedOrFirstVariant.value.name,o=1;}return {vID:t,quantity:o,vName:i}}};async function os(r$7,e){if(!pe$4.hasKeys(e)){Y$1.warn(`No update fields provided`);return}let t=r({id:r$7.key},e);try{let i=await nt(`/cart/change.js`,t);Y$1.log(`Updated line-item`,r$7),E.getCurrent().update(i.data);}catch(i){ke$2(i,`cart-item-update`);}}var Re=class{constructor(e){this.triggerContext=e;}async execute(e){let t=Be$3().currentItem,i=e.clickAction;if(!i)return;let o=e.item,n=this.triggerContext,s=new yi,c=n.triggerData.redirectBehaviour,m=!!n.triggerData.discount?.type&&!!i?.applyDiscount,C={selectedVariants:n.triggerData.nonMutableItems.map(v=>({itemMID:v.mID,mID:v.selectedOrFirstVariant.value.mID,variantID:v.selectedOrFirstVariant.value.mID})),eID:n.triggerData.engagementID,cID:n.triggerData.contentID},w=``,O=[],F=[];if(o?F=[o.toEmbed()]:e.embeddedItem&&(F=[e.embeddedItem]),i.at===He$3.ADD_BUNDLE){let v=n.selectedItems;if(F=e.embeddedItems??v.map(L=>L.toEmbed()),n.shouldGiveFBTDiscount||e.embeddedItems?.length){let L;e.embeddedItems?L=e.embeddedItems.map(b=>({itemMID:b.mID,mID:b.vID,variantID:b.vID,quantity:b.quantity})):L=v.map(b=>({itemMID:b.mID,mID:b.selectedOrFirstVariant.value.mID,variantID:b.selectedOrFirstVariant.value.mID}));let A=n.triggerData.bundleFrom;n.triggerData.isBundleOnCartDrawer()&&A&&(L.push({itemMID:A.mID,mID:A.selectedOrFirstVariant.value.mID,isPrimary:true}),F.unshift(A.toEmbed())),C.selectedVariants=L,n.triggerData.isBundleOnPDP()&&C.selectedVariants.forEach(b=>{b.mID===t.vID&&(b.isPrimary=true);});}else C=void 0;O=e.embeddedItems??v;}else if(i.at===He$3.INITIATE_CHECKOUT){let v=await E.getCurrent().getNormalisedCart();F=v.items,C.selectedVariants=v.items.map(L=>({itemMID:L.mID,mID:L.vID}));}else if(i.at===He$3.ADD_TO_CART)O=o?[o]:[e.embeddedItem];else if(i.at===He$3.QUICK_VIEW){window.cooeeShowQuickItem(this.triggerContext,o),this.sendTriggerClicked(F,{from:`button`},e.video);return}else if(i.at===He$3.GO_TO_PRODUCT)w=o?Et(`/products/`+o.slug):e.embeddedItem?.link;else if(i.at===He$3.GO_TO_URL){let v=Dn(i.gu?.u);window.CooeeSDK.allowExternalURL?v&&(w=v.href):v&&(w=v.pathname+v.search+v.hash);}else if(i.at===He$3.UPGRADE_TO_SUBSCRIPTION){let v=await s.upgradeToSubscription(o,n.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),V.get().refreshUI(v);}else if(i.at===He$3.GO_TO_COLLECTION){let v=this.triggerContext.triggerData.collections?.[0];v&&(w=`collections/`+v.handle);}if(this.sendTriggerClicked(F,{from:`button`},e.video),Y$1.verbose({redirectPath:w,redirectBehaviour:c,hasDiscount:m}),!m&&w){Yt(i.at,{redirectTo:w}),location.href=w;return}let y,P=false;try{y=await this.getOrGenerateDiscountCode(C),Y$1.verbose(`Discount code (if any) to apply`,y);}catch(v){if(!this.triggerContext.triggerData.isBYOB()){ns.default.error(`Unable to get a discount code`,v);return}}if(y&&i.at===He$3.COPY_COUPON_CODE)await s.copyDiscountCode(y);else if(i.at===He$3.BUY_NOW){let v=await s.createNewCart(t,y,n.triggerData);v&&(Yt(i.at,{products:[Xt(t)],redirectTo:v}),location.href=v);return}try{y&&await qe.applyWithStorefront([y]);}catch(v){Y$1.error(v),P=true;}let x;if(O?.length&&(x=await s.addToCart(O,n.triggerData)),Yt(i.at,{products:O.map(Xt),redirectTo:w,discountCode:y}),P&&y){qe.navigate(y,c,w);return}if(w){location.href=w;return}qe.navigateWithoutDiscount(c,x);}sendTriggerClicked(e,t,i){let o=new Ir$1(`CE Trigger Clicked`,t,this.triggerContext.triggerData);o.items=e,o.setVideos(i),fe(o);}async getOrGenerateDiscountCode(e){let t=this.triggerContext.triggerData.discount;if(!t?.type)return;let i=``;if(t.type===ce.STATIC){if(!t.code)throw Zn$1(`No discount code found`,`warning`,{triggerContext:this.triggerContext}),new Error(`No discount code found`);return t.code}if(e){if(i=await qa(e,this.triggerContext),!i)throw Y$1.error(`No discount code found`,e),new Error(`Discount code not found or generated`);return i}}};function Yt(r$8,e){document.dispatchEvent(new CustomEvent(`letscooee:outbound:cta-executed`,{detail:r({action:He$3[r$8]},e)}));}async function qa(r,e){try{return (await Xn(r)).data.code}catch(t){throw Nn$2(`Failed to generate a discount code`),ke$2(t,`backend-generate-discount`,{triggerContext:e}),t}}var _=class extends g$1{stylesConverter=new wi(1);mediaStyle={};deviceTypeKey;clickExecutor;componentWillMount(){this.deviceTypeKey=M$1()?`sm`:`lg`,this.clickExecutor=new Re(this.props.triggerContext);}getCompiledStyles(){return this.putStyleAccordingToDevice(),r(r(s(r(r(r(r(r(r({},this.stylesConverter.getFlexStyles(this.mediaStyle.flex)),this.stylesConverter.getBackgroundStyles(this.mediaStyle.bg)),this.stylesConverter.getBorderStyles(this.mediaStyle.br)),this.stylesConverter.getSizeStyles(this.mediaStyle.size)),this.stylesConverter.getSpaceStyles(this.mediaStyle.spc)),this.stylesConverter.getLayoutStyles(this.mediaStyle.lout)),{boxSizing:`border-box`,outline:`none`}),this.getComponentStyles()),this.props.style)}matchWhenCondition(e){if(!e?.op)return true;let{lhs:t,rhs:i}=e;switch(e.op){case `eq`:return t===i;case `gt`:return +t>+i;case `gte`:return +t>=+i;case `lt`:return +t<+i;case `lte`:return +t<=+i;case `ne`:return t!==i;case `null`:return t==null;case `empty`:return t.trim()===``;case `in`:return new RegExp(`\\b${i}\\b`).test(t);case `nin`:return !new RegExp(`\\b${i}\\b`).test(t);default:return Y$1.error(`Invalid operator found for when condition - ${e.op}`),false}}putStyleAccordingToDevice(){let e=this.props.element;this.mediaStyle=e.style.lg,M$1()&&e.style.sm&&Object.keys(e.style.sm).length&&(this.mediaStyle=r(r({},this.mediaStyle),e.style.sm));}sendTriggerClicked(e,t){this.clickExecutor.sendTriggerClicked(e,t);}async onClick(e,t){e.stopPropagation(),t.clickAction||(t.clickAction=this.props.element.clc),t.clickAction?.at&&await this.clickExecutor.execute(t);}};var Ga=0;function h(r,e,t,i,o,n){e||(e={});var s,c,m=e;if(`ref`in m)for(c in m={},e)c==`ref`?s=e[c]:m[c]=e[c];var C={type:r,props:m,key:t,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ga,__i:-1,__u:0,__source:o,__self:n};if(typeof r==`function`&&(s=r.defaultProps))for(c in s)m[c]===void 0&&(m[c]=s[c]);return h$2.vnode&&h$2.vnode(C),C}var oe=class extends _{componentDidMount(){this.setState(()=>({text:this.props.element.text})),W$2(this.onChange.bind(this));}componentWillReceiveProps(e){this.props.element=e.element,this.onChange();}render(){let e=this.getCompiledStyles(),t=this.state.text;return t||(e.display=`none`,t=``),h(`div`,{style:e,onClick:this.customOnClick.bind(this),className:`lc-text`,children:h(`span`,{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:t}})})}customOnClick(){this.props.onClick&&this.props.onClick(`title`);}onChange(){if(this.props.element.text==null)return;let e=this.props.triggerContext.triggerData,t={bundle:e.discountData.value,customer:e.customerData,cart:e.getCartMagicVariables()},o=new G(Ve$2(this.props.element,t,this.props.triggerContext));if(!this.matchWhenCondition(o.when)){this.setState(()=>({text:``}));return}this.setState(()=>({text:o.text}));}getTypoStyles(){let e={},t=this.mediaStyle.typo??new H;return e.letterSpacing=t.letterSpacing,e.fontSize=t.fs+`px`,e.lineHeight=t.lh,e.fontFamily=t.fam.name||`inherit`,e.textAlign=t.alignment,e.fontWeight=t.fw,e.textDecoration=t.td??`none`,this.stylesConverter.getColourStyles(t.tc,`color`,e),e}getComponentStyles(){return r({},this.getTypoStyles())}getSpanStyle(){return {overflow:`hidden`,display:`-webkit-box`,webkitBoxOrient:`vertical`,webkitLineClamp:2,color:`inherit`,fontSize:`inherit`,fontWeight:`inherit`,fontFamily:`inherit`}}};var st=class extends oe{render(){return h(`div`,{style:this.getCompiledStyles(),className:`lc-button`,onClick:e=>this.onClick(e,{item:this.props.item}),children:h(`span`,{style:this.getSpanStyle(),dangerouslySetInnerHTML:{__html:this.state.text}})})}getComponentStyles(){return s(r({},super.getComponentStyles()),{cursor:`pointer`})}};var wo=class extends g$1{render(){if(this.props.element.show[this.props.label.toLowerCase()])return this.props.element.lblPos===`end`?h(`div`,{style:r(r({},this.getElementStyle()),this.props.styles),children:[h(`span`,{children:this.props.time}),h(`span`,{style:this.getTimeLabelStyle(),children:this.props.label})]}):h(`div`,{style:r(r({},this.getElementStyle()),this.props.styles),children:[h(`span`,{style:this.getTimeLabelStyle(),children:this.props.label}),h(`span`,{children:this.props.time})]})}getDesign(){}getTimeLabelStyle(){return {fontSize:`0.5em`,alignContent:`center`}}getElementStyle(){let e={display:`flex`,flexDirection:`column`,placeContent:`center center`,textAlign:`center`};return this.props.element.horizontal&&(e.gridTemplateColumns=`repeat(2, minmax(0, 1fr))`),e}},Jt=class extends oe{labels={Days:`00`,Hours:`00`,Minutes:`00`,Seconds:`00`};componentWillMount(){super.componentWillMount(),this.setState(()=>r({},this.labels)),this.processAndStartTimer();}render(){return h(`div`,{style:this.getLabelsParentStyle(),children:Object.keys(this.labels).map(e=>h(wo,{styles:this.getCompiledStyles(),label:e,time:this.state[e],element:this.props.element}))})}getLabelsParentStyle(){return {display:`grid`,justifyContent:`center`,gridTemplateColumns:`repeat(4, auto)`,gap:this.stylesConverter.getSizePx(this.props.element.gap)}}getDisplayStyles(){return {display:`grid`,placeContent:`center center`}}getComponentStyles(){return r(r({},super.getComponentStyles()),this.getDisplayStyles())}processAndStartTimer(){this.props.element.timer.start(this.props.element.timerType,e=>{this.labels.Days=String(e.days).padStart(2,`0`),this.labels.Hours=String(e.hours).padStart(2,`0`),this.labels.Minutes=String(e.minutes).padStart(2,`0`),this.labels.Seconds=String(e.seconds).padStart(2,`0`),this.setState(()=>r({},this.labels));});}};function Ei(r,e){if(!r)return;let t={loop:e.loop,slidesPerView:e.maxInRow,spaceBetween:e.gap+`px`,pagination:{type:e.pagination.type,el:r.querySelector(`.swiper-pagination`),clickable:true,renderBullet:(o,n)=>`
68
68
  <span class="${n}"
69
69
  style="background-color: ${e.pagination.color?.rgba};"></span>
70
70
  `,renderProgressbar:o=>`
71
71
  <span class="${o}"
72
72
  style="background-color: ${e.pagination.color?.rgba};">
73
73
  </span>
74
- `},navigation:{nextEl:r.querySelector(`.swiper-button-next`),prevEl:r.querySelector(`.swiper-button-prev`)},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:false,pauseOnMouseEnter:false}:false,autoHeight:true};e.marquee&&t.autoplay&&typeof t.autoplay==`object`&&(t.speed=e.speed,t.autoplay.pauseOnMouseEnter=true,r.style.setProperty(`--swiper-wrapper-transition-timing-function`,`linear`));let i=new window.CooeeSDK.Swiper(r,t);return r.style.setProperty(`--swiper-navigation-size`,`${e.navigation.size}px`),i}function Si(r,e,t){let i={color:r.navigation.color?.rgba};return r.pagination.enabled&&(i.transform=`translateY(-25%)`),f(`div`,{class:`swiper-container`,ref:e,style:`max-width: 100%`,children:[f(`div`,{class:`swiper-wrapper`,children:t()}),r.navigation.enabled&&f(`div`,{class:`swiper-button-next`,style:i,children:f(`span`,{})}),r.navigation.enabled&&f(`div`,{class:`swiper-button-prev`,style:i,children:f(`span`,{})}),r.pagination.enabled&&f(`div`,{className:`swiper-pagination`,style:{bottom:0,top:`unset`,position:`relative`,color:r.pagination.color?.rgba}})]})}var Zt=class extends _{componentDidMount(){W$2(()=>{this.setState(()=>({checked:this.props.item.selected.value}));});}render(){return f(`div`,{style:this.getCompiledStyles(),className:`lc-checkbox`,children:f(`input`,{type:`checkbox`,checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:`auto`}})})}onChange(e){let{checked:t}=e.target;this.props.item.selected.value=t;}getTypoStyles(){let e={},t=this.mediaStyle.typo??new H;return e.textAlign=t.alignment,e.justifyContent=t.alignment,e}getComponentStyles(){return s(r({},this.getTypoStyles()),{display:`flex`})}};var ke=class extends _{constructor(e,t){super(e,t);}render(){let e=this.props.element[this.deviceTypeKey],t=e?.src||this.props.element.src||this.props.element.lg?.src;return f(`img`,{onClick:this.customOnClick.bind(this),className:`lc-image`,alt:e?.name||`Image`,onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:t,style:this.getCompiledStyles()})}customOnClick(e){this.props.element.clc?.at===He$3.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick(`image`);}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!==`absolute`)return {};let t={zIndex:e.zIndex,cursor:this.props.element.clc?.at?`pointer`:`auto`};return this.mediaStyle.size?.w&&(t.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(t.height=this.mediaStyle.size.h),t}handleMouseEnter(e){let t=this.props.element[this.deviceTypeKey]?.secondarySrc;t&&(e.currentTarget.src=t);}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src;}};var Ae=class extends _{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return f(`div`,{style:this.getCompiledStyles(),class:`lc-flexbox`,children:f(je,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new It,t={display:`flex`,gap:e.gap+`px`,flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai};return e.wrap===`nowrap`&&e.scroll&&(e.dir===`column`?t[`overflow-y`]=`auto`:t[`overflow-x`]=`auto`),t}};var er=class extends Ae{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return f(`div`,{style:this.getCompiledStyles(),class:`lc-flexbox`,children:f(kt,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var tr=class extends _{render(){return f(`select`,{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??``,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:`lc-dropdown`,children:this.createSelectItems()})}componentDidMount(){W$2(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:false}));});}getTypoStyles(){let e={},t=this.mediaStyle.typo??new H;return e.letterSpacing=t.letterSpacing,e.fontSize=t.fs+`px`,e.lineHeight=t.lh,e.fontFamily=`inherit`,e.textAlign=t.alignment,e.fontWeight=t.fw,this.stylesConverter.getColourStyles(t.tc,`color`,e),e.boxShadow=`none`,e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility=`hidden`),r(r({},e),this.getTypoStyles())}createSelectItems(){let e=[],t=this.props.selectedVariant;if(!t.sellingPlans?.length)return [];this.props.triggerContext.triggerData.skipSubscribedItems?t.selectedSellingPlan.value||(t.sellingPlans[0].isSelected=true,t.changeSellingPlan(t.sellingPlans[0])):e.push(f(`option`,{value:``,selected:!t.selectedSellingPlan,children:`One time purchase`}));for(let i of t.sellingPlans??[])e.push(f(`option`,{value:i.mID,selected:i.isSelected,children:i.name}));return e}onChange(e){let t=e.target.value;t?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(i=>i.mID===t):this.props.selectedVariant.selectedSellingPlan.value=void 0;}};var Ga=new RegExp(`fill="#[a-zA-Z0-9]+"`),rr=class extends _{constructor(){super();}render(){let e=this.getCompiledStyles(),t=this.getRating();return t||(e.display=`none`,t=``),f(`div`,{style:e,className:`lc-star-rating`,dangerouslySetInnerHTML:{__html:t}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},t=qe$1(this.props.element.fullStar,{svg:e},this.props.triggerContext),i=qe$1(this.props.element.halfStart,{svg:e},this.props.triggerContext),o=this.props.review;if(!o?.rating)return ``;let n=``;if(this.props.element.showSingleStar)n=t;else {let s=5,c=`${o.rating}`.split(`.`);for(let m=0;m<+c[0];m++)n+=t,s--;c[1]&&(n+=i,s--);for(let m=0;m<s;m++)n+=t.replace(Ga,`fill="#f1f1f1"`);}return n}getComponentStyles(){return {display:`flex`,alignItems:`center`}}};var ir=class extends _{render(){return f(`select`,{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:`lc-dropdown`,children:this.createSelectItems()})}componentDidMount(){W$2(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:false}));});}getTypoStyles(){let e={},t=this.mediaStyle.typo??new H;return e.letterSpacing=t.letterSpacing,e.fontSize=t.fs+`px`,e.lineHeight=t.lh,e.fontFamily=`inherit`,e.textAlign=t.alignment,e.fontWeight=t.fw,this.stylesConverter.getColourStyles(t.tc,`color`,e),e.boxShadow=`none`,e}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name===`Default Title`&&(e.visibility=`hidden`),r(r({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let t of this.props.item.vars)e.push(f(`option`,{value:t.mID,disabled:!t.isAvailable,children:t.name}));return e}onChange(e){let t=e.target.value,i=this.props.item.vars.find(o=>o.mID===t);this.props.item.setSelectedVariant(i);}};var ns=()=>{let r=window.ShopifyAnalytics?.meta??{},e=r.selectedVariantId;if(e)return e;if(r.product?.variants?.length>0)return r.product.variants[0].id},wo=r=>{if(!r)return;let e;try{e=new URL(r);}catch{return}if(e.hostname!==`cdn.shopify.com`)return r;let t=e.pathname.split(`.`);return t.length!==2?r:(e.pathname=t[0]+`_large.`+t[1],e.toString())};var kt=class extends _{constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let t=e;return t.l===`Star Rating`&&!this.props.item.reviews?.rating?void 0:f(er,{element:t,triggerContext:this.props.triggerContext,elements:t.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?f(Zt,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let t=e,i=this.props.item,o=wo(i.variantImage??i.firstImageURL),n=wo(i.variantSecondaryImage??i.secondaryImageURL);t.lg=t.sm={src:o,name:i.name,secondarySrc:n};let s=f(ke,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:f(`a`,{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:`block`},children:s})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let t=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name===`Default Title`?void 0:t.showChips?f(`cooee-product-options-picker`,{item:this.props.item}):f(ir,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?f(tr,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?f(rr,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?f(at,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):f(je,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.attachListener(),this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return {}}renderProductTitle(e){let t=f(oe,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?t:f(`a`,{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:`block`,textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:t})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e});}onMouseEnter(){this.setState(()=>({decoration:`underline`}));}onMouseLeave(){this.setState(()=>({decoration:`unset`}));}attachListener(){document.addEventListener(`letscooee:variant-change`,e=>{let t=e;if(!t.detail||this.props.item.mID!==t.detail.productID)return;let i=t.detail.variantID;this.props.item.setSelectedVariantByID(i);});}};var ct=class extends _{productElement;constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}render(){if(this.productElement=new $e(Ve$2(this.props.element,this.getProductData(),this.props.triggerContext)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return f(`div`,{style:r({},this.getCompiledStyles()),class:`lc-single-product`,children:f(kt,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return {flexShrink:0}}getProductData(){if(!this.props.item)return {};let e=this.props.item,t=e.selectedOrFirstVariant.value,i=e.getTemplateVariables();i.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let o=this.props.triggerContext.triggerData.discount?.type===ce.BXGY;return !t.hasEffectivePrice()&&o&&(i.product=s(r(r({},i.product),xn(`effective_price`,t.effectivePrice.value)),{price:``})),i.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(t.quantity):t.quantity,{product:i.product,variant:i.variant,svg:{color:`{{ svg.color }}`,size:`{{ svg.size }}`}}}};var or=class extends _{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,t){super(e,t),this.configuration=M$1()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+`px`;}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&Vi$1().then(()=>{this.swiperInstance=Ei(this.swiperRef,this.props.element.conf[this.deviceTypeKey]);});}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy();}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let t;if(this.configuration.disp===2){let i=n=>{this.swiperRef=n;},o=()=>e?.map(n=>f(`div`,{class:`swiper-slide`,children:this.getProductFragment(n)}));t=f(`div`,{style:s(r({},this.getCompiledStyles()),{display:`block`}),class:`lc-product-swiper-list`,children:Si(this.configuration,i,o)});}else t=f(`div`,{style:this.getCompiledStyles(),class:`lc-product-list`,children:e?.map((i,o)=>this.getProductFragment(i,o!==e.length-1))});return t}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),t={display:e?`flex`:`grid`,justifyContent:`safe `+(this.mediaStyle.flex?.jc??`center`),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??`row`};if(t.flexDirection===`row`){if(e)t.maxWidth=`100%`,t.overflowY=`auto`;else if(this.configuration.disp===1){let i=this.props.triggerContext.triggerData,o=i.items.length,n;i.isBundle()?n=this.props.element.prod.symbol?.hide!==true?o*2-1:o:n=this.props.element.conf[this.deviceTypeKey].maxInRow,t.gridTemplateColumns=`repeat(${n}, auto)`;}}return t}getProductFragment(e,t=false){return f(j$2,{children:[f(ct,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&t&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&f(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:f(oe,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var nr=class extends _{swiperRef=null;swiperInstance=null;constructor(e,t){super(e,t);}componentDidMount(){Vi$1().then(()=>{this.swiperInstance=Ei(this.swiperRef,this.props.element.conf);});}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy();}render(){let e=this.props.element,t=o=>{this.swiperRef=o;},i=()=>{let o=e.values?.map(c=>f(`div`,{class:`swiper-slide`,onClick:m=>this.onClick(m,{clickAction:this.getClickAction(c)}),children:this.renderElement(c)}));if(!o?.length)return [];let n=e.conf,s=o.length;if(n.marquee&&s<=Number(n.maxInRow)){let c=Number(n.maxInRow)-s+1;for(let m=0;m<c;m++)o.push(o[m%s]);}return o};return Si(e.conf,t,i)}getComponentStyles(){return {}}renderElement(e){let t=this.valueAddedSlide(this.props.element.slide,e);switch(t?.t){case 1:return f(ke,{element:t,triggerContext:this.props.triggerContext});case 4:return f(Ae,{elements:t.elems,element:t,triggerContext:this.props.triggerContext});default:Y$1.warn(`Unknown slide type for carousal`);}}valueAddedSlide(e,t){let i=Ve$2(e,{form:t},this.props.triggerContext);return ie.getParsedElement(i)}getClickAction(e){return Ve$2(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var je=class extends _{constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`})),W$2(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}));});}renderElement(e){if(!e.hide){if(e.t===4){let t=e;return f(Ae,{element:t,triggerContext:this.props.triggerContext,elements:t.elems})}if(e.t===61)return f(Qt,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?f(at,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return f(oe,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return f(ke,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return f(or,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return f(ct,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return f(nr,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return {}}};var sr=class extends _{clickAction;isClickable;constructor(e,t){super(e,t),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===He$3.GO_TO_URL&&!!Rn$1(this.clickAction.gu?.u)||this.clickAction?.at===He$3.OPEN_CART||this.clickAction?.at===He$3.INITIATE_CHECKOUT;}componentDidMount(){W$2(()=>{let e=this.props.triggerContext.triggerData,t=this.props.triggerContext.selectedItems;e.calculateDiscountData(t,this.props.triggerContext.shouldGiveFBTDiscount);});}render(){return f(j$2,{children:[f(`div`,{style:this.getCompiledStyles(),class:`lc-container`,onClick:e=>{this.onClick(e,{clickAction:this.clickAction});},children:f(je,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id===`preview`&&f(`div`,{class:`letscooee-preview-badge`,children:[`#`,this.props.triggerContext.triggerData.shortID,` preview`]})]})}getComponentStyles(){let e={position:`relative`,overflow:`hidden`,display:`block`};return this.isClickable&&(e.cursor=`pointer`),e}};var X=class r$8{constructor(e){this.engagementTrigger=e;this.triggerContext=new Be(new Date,this.engagementTrigger);}static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;triggerContext;observers=[];renderedCount=0;scrollSubscription;isExclusionWithBVariation;isProcessing=false;renderSilently(){this.acquireProcessingLock()||this.render().finally(()=>this.releaseProcessingLock()).catch(e=>{ke$2(e,`render-widget`,{triggerContext:this.triggerContext});});}destroy(){Y$1.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),r$8.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),xi$1(this.engagementTrigger.content?.afterDeleteJS);}matches(e){return this.engagementTrigger.shortID===e.shortID}async render(){if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e);}if(this.rootContainer=await this.getWidgetContainer(true),!this.rootContainer){Y$1.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),await this.getVariationIfRequired(),await this.runChoresBeforeRender(),this.attachScroll(),this.checkAndSendEvent(),this.triggerContext.renderer=this,xi$1(this.engagementTrigger.content?.afterRenderJS);}async updateAndReRender(e){if(!this.acquireProcessingLock())try{this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render();}finally{this.releaseProcessingLock();}}async update(e){this.engagementTrigger.variation=e.variation;}async rerenderIfDeleted(){if(!this.rootContainer?.isConnected&&!this.acquireProcessingLock()){Y$1.info(`${this.engagementTrigger} deleted. Will be re-rendered`);try{this.preDestroy(),await this.render();}finally{this.releaseProcessingLock();}}}updateAngularWidget(){return this.widgetElement?.isConnected?(this.widgetElement.update(),true):false}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect();});}acquireProcessingLock(){return this.isProcessing?(Y$1.verbose(`Lock could not be acquired for ${this.engagementTrigger}`),true):(Y$1.verbose(`Acquiring rendering lock for ${this.engagementTrigger}`),this.isProcessing=true,false)}releaseProcessingLock(){Y$1.verbose(`Releasing rendering lock for ${this.engagementTrigger}`),this.isProcessing=false;}afterRootContainerCreated(){}isAllOkToRender(){return !!this.engagementTrigger.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){Y$1.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e);}handleVariationResponse(e){if(!e)return;let t=this.engagementTrigger;Y$1.log(`${t} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(t.items=e.items.map(i=>new ot$2(i)),t.nonMutableItems=e.items.map(i=>new ot$2(i))),e.bundleFrom&&(t.bundleFrom=new ot$2(e.bundleFrom)),e.discount&&(t.discount=e.discount),e.placement&&(t.placement=e.placement),e.props&&pe$4.hasKeys(e.props)&&(t.props=r(r({},t.props),e.props)),e.content&&(t.content=new Xt(e.content)),t.widget=new Pt(e.widget),t.contentID=e.contentID,t.variation=e.variation,t.placement=e.placement,t.manipulation=e.manipulation,t.entryAnimation=e.entryAnimation??`NONE`,this.isExclusionWithBVariation=t.isExclusionTesting()&&t.variation===`b`,this.isExclusionWithBVariation&&(this.rootContainer.style.height=`0.5px`);}addToRendered(){this.renderedCount++,Y$1.info(`${this.engagementTrigger} rendered \u2705 ${Vn$1(this.renderedCount)} time`);}removeFromRendered(){this instanceof pe?lt.delete(this):At.delete(this);}async getVariation(){Y$1.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id===`preview`};try{return (await ss(e)).data}catch(t){if(t instanceof ie$4&&t.response?.status===400)return;ke$2(t,`get-variation`,{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){Y$1.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,t={root:null,rootMargin:`${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(i=>{let o=new IntersectionObserver((n,s)=>{n.forEach(async c=>{if(c.isIntersecting){Y$1.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);i(await this.getVariation()),s.unobserve(this.rootContainer);}});},t);o.observe(this.rootContainer),this.observers.push(o);})}attachScroll(){this.scrollSubscription=Tr(window,`scroll`).pipe(Fe(r$8.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent();});}checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(r$8.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let i={};this.triggerContext.triggerData.items?.length&&(i.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let n=new Ir$1(this.isExclusionWithBVariation?`CE Campaign Holdout`:`CE Trigger Displayed`,i,this.engagementTrigger);n.name===`CE Campaign Holdout`&&(n.trigger.holdout=true),fe(n),r$8.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe();}generateParentElementID(){return `letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let t=this.widgetElement=document.createElement(e);return t.cart=E.getCurrent(),t.triggerContext=this.triggerContext,t.engagementTrigger=this.engagementTrigger,t.setAttribute(`engagement`,this.engagementTrigger.shortID),this.rootContainer.appendChild(t),this.addToRendered(),this.injectOuterCSSOnly(),t}getParentElement(e,t=document){let i=t.getElementById(e);if(i)return i;let o=this.engagementTrigger.objective.toLowerCase().replaceAll(`_`,`-`),n=this.engagementTrigger.shortID;return i=document.createElement(`div`),i.id=e,i.className=`letscooee letscooee-engagement engagement-${n} lc-${o}`,i.dataset.engagementId=n,this.engagementTrigger.id===`preview`&&(i.className+=` letscooee-preview`),i.style.display=`block`,i.style.minHeight=`0.5px`,i.style.minWidth=`0.5px`,i}async startRendering(){let e=this.rootContainer,t=this.triggerContext.triggerData.hasSwiperElement();t&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:`open`}),Mi$1(e)),this.injectCampaignCSS(t,e);let i=this.engagementTrigger.widget;ze$1(pe$3(sr,{element:i.cont,triggerContext:this.triggerContext,elements:i.elems}),e),this.addToRendered();}injectCampaignCSS(e,t){let i=this.engagementTrigger.content?.outerCSS?.trim()??``,o=this.engagementTrigger.content?.innerCSS?.trim()??``;if(!i&&!o)return;let n=this.rootContainer.id;if(e){Ce$1(o,t),this.injectOuterCSSOnly();return}Ce$1(`#${n} { ${i+`
75
- ${o}`} }`);}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let t=this.rootContainer.id;Ce$1(`#${t} { ${e} }`);}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return false;let t=window.innerHeight||document.documentElement.clientHeight,s=(Math.min(e.bottom,t)-Math.max(e.top,0))*e.width/(e.width*e.height)*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let t=await this.createParentElementWithPlacement(e);if(t)return t;let i=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(i)}async createParentElementWithPlacement(e){let t=this.engagementTrigger.placement;if(!t?.selector)return Y$1.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let i=t.selector,o;if(i.includes(`:shadow`)){let m=i.split(`:shadow`);o=(await On$1(m[0].trim()))?.shadowRoot,i=m[1].trim(),o&&Mi$1(o,false);}Y$1.verbose(`${this.engagementTrigger} attempt to render "${t.position}" "${i}"`);let n=await On$1(i,3,o??document);if(!n)return Y$1.warn(`${this.engagementTrigger} no placement found with ${i}`),null;let s=this.generateParentElementID(),c=this.getParentElement(s);if(!e)return c;switch(t.position){case Ve$3.BEFORE1:case Ve$3.BEFORE:n.parentElement?.insertBefore(c,n);break;case Ve$3.INSIDE_FIRST1:case Ve$3.INSIDE_FIRST:n.insertBefore(c,n.firstChild);break;case Ve$3.INSIDE_LAST1:case Ve$3.INSIDE_LAST:n.appendChild(c);break;case Ve$3.AFTER1:case Ve$3.AFTER:default:n.parentElement?.insertBefore(c,n.nextSibling);}return c}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){Y$1.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}Y$1.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await wi(this.engagementTrigger);}catch(t){Y$1.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,t);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){Y$1.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,await this.startRendering();}updateItems(e,t){let i=this.getItemDiff(e,t),o=this.getItemDiff(t,e);t.push(...i);for(let n of o)Re.remove(t,n);}getItemDiff(e,t){return e.filter(i=>!t.some(o=>o.selectedOrFirstVariant.value.mID===i.selectedOrFirstVariant.value.mID))}};var pe=class extends X{constructor(e){super(e);}rerenderAfterCartOpened(){this.rerenderIfDeleted(),this.checkAndSendEvent();}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}checkAndSendEvent(){if(!V.get().isOpen()&&Be$3().pageName!==`cart`){Y$1.log(`Do not send display event as neither the cart drawer nor the cart page is open.`);return}return super.checkAndSendEvent()}};var Ii=class r{constructor(e,t){this.engagementTrigger=e;this.element=t;this.cartItems=E.getCurrent().items;}cartItems;static renderCartUpsell(e){let t=e.placement;if(!t?.selector){Y$1.warn(`No placement available for ${e.objective}`,e.shortID);return}let i=Array.from(document.querySelectorAll(t.selector));if(!i?.length){Y$1.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let o of i)new r(e,o).render();}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let t=this.engagementTrigger.items.find(w=>w.mID===e.product_id.toString());if(!t)return;let i=t.vars.find(w=>w.mID===e.id.toString());if(!i)return;let o=new nt$1(i),n=e.selling_plan_allocation?.selling_plan;if(n)for(let w of o.sellingPlans??[])w.mID===n.id.toString()&&(w.isSelected=true,o.changeSellingPlan(w));let s=new ot$2(t);s.vars=[o],s.selectedOrFirstVariant.value=o;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${t.mID}`;this.element.classList.add(c);let m=new j(this.engagementTrigger);m.placement.selector=`.${c}`,m.items=[s];let b=new pe(m);b.renderSilently(),this.watchForCartItemDeletion(b,c);}watchForCartItemDeletion(e,t){let i=new MutationObserver(o=>{o.forEach(n=>{n.removedNodes.forEach(s=>{s===this.element&&(Y$1.verbose(`${t} has been removed`),e.destroy(),i.disconnect());});});});i.observe(this.element.parentElement,{childList:true,subtree:true});}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(t=>{if(!(e.includes(t.url)||e.includes(t.variant_id))&&(!e.includes(t.product_title)||t.variant_title&&!e.includes(t.variant_title)))return false;let i=t.selling_plan_allocation?.selling_plan?.name;return !(i&&!e.includes(i))})}};var Ti=class extends X{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-collection-filter`);}};var xi=class extends pe{constructor(e){super(e);}async update(e){await super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),await this.checkMilestoneTryCatch(),this.updateAngularWidget();}isAllOkToRender(){return !!this.engagementTrigger.progressBarConfig}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget(`cooee-progressbar`),await this.checkMilestoneTryCatch();}async checkMilestoneTryCatch(){try{await this.checkMilestone();}catch(e){ke$2(e,`apply-milestones`,{engagementTrigger:this.engagementTrigger});}}async checkMilestone(){let e=await E.getCurrent().getNormalisedCart(),t=this.engagementTrigger.progressBarConfig,i=[],o=[],n=[],s,c,m=[...t.milestones];for(let v of m){if(v.rewardType!==Fe$1.FREE_AUTO_GIFT)continue;if(v.isUIOnly&&!v.allowATC){Y$1.verbose(`Skipping milestone ${v.label} as it is UI only and does not allow ATC`);continue}let L=v.items[0],A=v.reached,C=e.items.find(Qe=>(Qe.vID===L.vID||Qe.mID===L.mID)&&Qe.properties._letscooee_campaign===this.engagementTrigger.shortID);A&&(s=v,c=C),C&&i.push(C),!A&&C&&t.removeIneligibleItem?(Y$1.verbose(`Removing free gift ${C.vID} from cart`),n.push(C)):A&&!C&&(Y$1.verbose(`Adding free gift ${L.vID} to cart`),o.push(L));}t.restrictToLatestFreebie&&s&&(c?(i=i.filter(v=>v.vID!==c.vID),o=[]):o=[s.items[0]],n.push(...i));let b={},w={};n.length&&n.forEach(v=>w[v.key??v.vID]=0),o.length&&o.forEach(v=>w[v.vID]=1);let O=t.coupons,U=[];if(O?.length){U=O.map(A=>A.couponCode);let v=E.getCurrent().discount_codes?.map(A=>A.code)??[];U.every(A=>v.some(C=>C===A))||(b.discount=U.join(`,`));}if(pe$4.hasKeys(w)&&(b.updates=w),!pe$4.hasKeys(b))return;let y=await rs(b,this.engagementTrigger),P=y?.items,x=[];for(let v of o){let L=P?.find(A=>U?.length?A.id+``===v.vID&&A.discounts?.some(C=>U.includes(C.title)):A.id+``===v.vID);L&&x.push(L);}if(!x.length){V.get().refreshUI(y,false);return}try{await Promise.all(x.map(v=>is(v,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})));}catch(v){ke$2(v,`add-private-attribute`,{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:x}});}finally{V.get().refreshUI(y,false);}}};var ar=class extends pe{constructor(e){super(e);}async update(e){await super.update(e),this.engagementTrigger.content.update(e.content),this.updateAngularWidget();}isAllOkToRender(){return !!this.engagementTrigger.content}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget(`cooee-savings-bar`);}};var Di=class extends X{constructor(e){super(e);}isAllOkToRender(){return !!this.engagementTrigger.content?.videoConfig}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e,t=this.engagementTrigger.content.videoConfig;t.template===`FLOATING_POPUP`?e=`cooee-video-popup`:t.template===`STORY`?e=`cooee-video-stories`:e=`cooee-video-playlist`,this.createAngularWidget(e);}};var Pi=class extends X{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-sticky-atc`);}};var Ri=class extends X{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener(`letscooee:inbound:cta:add-bundle`,this.inboundCTAListener.bind(this),false);}async inboundCTAListener(e){let t=this.engagementTrigger,i=`Engagement(id: ${t.engagementID}, shortID: ${t.shortID})`,o=e.detail;if(!pe$4.hasKeys(o)){Y$1.error(`No detail received for ${i}`);return}Y$1.log(`Detail received for BYOB`,o);let n=o.campaignID??o.campaignId??o.campaign_id;if(n!==t.shortID&&n!==t.engagementID){Y$1.warn(`Current ${i} is not BYOB. Received: ${n}`);return}let s=o.items;if(!s?.length)return;let c=s.map(m=>new et({mID:m.product_id,vID:m.variant_id,quantity:m.quantity||1}));await new _e(this.triggerContext).execute({embeddedItems:c,clickAction:{at:He$3.ADD_BUNDLE,applyDiscount:true}});}};var vo=false,Co=false,_i=null,ki=null,as=false,lt=new Set,At=new Set;function cs(){as||(as=true,vt$2(()=>{Mn(document.body,{childList:true,subtree:true},500,Nn).subscribe(()=>{At.forEach(r=>r.rerenderIfDeleted()),lt.forEach(r=>r.rerenderIfDeleted());});}));}function cr(r){if(r.length>0&&ds(),cs(),vo){Y$1.verbose(`Cart widget processing in progress, queuing latest triggers`),_i=r;return}vo=true;try{ja(r);}finally{if(vo=false,_i){let e=_i;_i=null,Y$1.verbose(`Processing queued cart triggers`),cr(e);}}}function lr(r){if(r.length>0&&ds(),cs(),Co){Y$1.verbose(`Page widget processing in progress, queuing latest triggers`),ki=r;return}Co=true;try{za(r);}finally{if(Co=false,ki){let e=ki;ki=null,Y$1.verbose(`Processing queued page triggers`),lr(e);}}}function ls(){lt.forEach(r=>r.rerenderAfterCartOpened());}function ja(r){ps(lt,r);for(let e of r){Y$1.info(`${e} received as cart embed`);let t=ms(lt,e);if(t&&!e.isSubscriptionUpsell()){t.updateAndReRender(e).catch(o=>{ke$2(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$1.verbose(`${e} is new`);let i;if(e.isProgressBar())i=new xi(e);else if(e.isSubscriptionUpsell()){Ii.renderCartUpsell(e);continue}else e.isSavingsBar()?i=new ar(e):i=new pe(e);lt.add(i),i.renderSilently();}}function za(r){ps(At,r);for(let e of r){Y$1.info(`${e} received as page embed`);let t=ms(At,e);if(t){t.updateAndReRender(e).catch(o=>{ke$2(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$1.verbose(`${e} is new`);let i;e.isShoppableVideo()?i=new Di(e):e.isBYOB()?i=new Ri(e):e.isStickyATC()?i=new Pi(e):e.isSavingsBar()?i=new ar(e):e.isCollectionFilter()?i=new Ti(e):i=new X(e),At.add(i),i.renderSilently();}}function ms(r,e){for(let t of r)if(t.matches(e))return t}function ps(r,e){let t=new Set(e.map(i=>i.shortID));for(let i of r)t.has(i.engagementTrigger.shortID)||i.destroy();}function ds(){import('./widgets-aIQ74dpG-ac52Zxc7.js').then(function (n) { return n.ad; }).then(({loadAngularWidgets:r})=>{r();});}var Ai=class extends oe$5{static storeName=`app`;static{this.storage=ge$3(this.storeName);}};var Ka=` daum[ /]| deusu/|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|24x7|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\bperl\\b|\\btime/|\\||^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\W|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^azure|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|agent\\b|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|fetcher|firephp|functionize|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node\\b|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/`,Xa=/bot|crawl|http|lighthouse|scan|search|spider/i,mr;function Ya(){if(mr instanceof RegExp)return mr;try{mr=new RegExp(Ka,`i`);}catch{mr=Xa;}return mr}function us(r){return !!r&&Ya().test(r)}var Ja=`2.0.4`,ko=500,gs=`user-agent`,Ut=``,fs=`?`,Fi=`function`,Xe=`undefined`,Ft=`object`,Ao=`string`,Q=`browser`,Oe=`cpu`,Ie=`device`,he=`engine`,de=`os`,Nt=`result`,u=`name`,l=`type`,d=`vendor`,g=`version`,Z=`architecture`,br=`major`,p=`model`,vr=`console`,S=`mobile`,k=`tablet`,W=`smarttv`,Ee=`wearable`,Oi=`xr`,Cr=`embedded`,pr=`inapp`,No=`brands`,pt=`formFactors`,Mo=`fullVersionList`,Mt=`platform`,Uo=`platformVersion`,Wi=`bitness`,Ye=`sec-ch-ua`,Qa=Ye+`-full-version-list`,Za=Ye+`-arch`,ec=Ye+`-`+Wi,tc=Ye+`-form-factors`,rc=Ye+`-`+S,ic=Ye+`-`+p,Rs=Ye+`-`+Mt,oc=Rs+`-version`,_s=[No,Mo,S,p,Mt,Uo,Z,pt,Wi],Li=`Amazon`,Ot=`Apple`,hs=`ASUS`,ws=`BlackBerry`,mt=`Google`,vs=`Huawei`,bo=`Lenovo`,Cs=`Honor`,Ni=`LG`,yo=`Microsoft`,Eo=`Motorola`,So=`Nvidia`,bs=`OnePlus`,Io=`OPPO`,dr=`Samsung`,ys=`Sharp`,ur=`Sony`,To=`Xiaomi`,xo=`Zebra`,Es=`Chrome`,Ss=`Chromium`,ze=`Chromecast`,Ui=`Edge`,gr=`Firefox`,fr=`Opera`,Do=`Facebook`,Is=`Sogou`,Lt=`Mobile `,hr=` Browser`,Oo=`Windows`,ee=typeof window!==Xe&&window.navigator?window.navigator:void 0,Ke=ee&&ee.userAgentData?ee.userAgentData:void 0,sc=function(r,e){var t={},i=e;if(!Bi(e)){i={};for(var o in e)for(var n in e[o])i[n]=e[o][n].concat(i[n]?i[n]:[]);}for(var s in r)t[s]=i[s]&&i[s].length%2===0?i[s].concat(r[s]):r[s];return t},Hi=function(r){for(var e={},t=0;t<r.length;t++)e[r[t].toUpperCase()]=r[t];return e},Lo=function(r,e){if(typeof r===Ft&&r.length>0){for(var t in r)if(Le(e)==Le(r[t]))return true;return false}return Vt(r)?Le(e)==Le(r):false},Bi=function(r,e){for(var t in r)return /^(browser|cpu|device|engine|os)$/.test(t)||(e?Bi(r[t]):false)},Vt=function(r){return typeof r===Ao},Po=function(r){if(r){for(var e=[],t=Bt(/\\?\"/g,r).split(`,`),i=0;i<t.length;i++)if(t[i].indexOf(`;`)>-1){var o=Vi(t[i]).split(`;v=`);e[i]={brand:o[0],version:o[1]};}else e[i]=Vi(t[i]);return e}},Le=function(r){return Vt(r)?r.toLowerCase():r},Ro=function(r){return Vt(r)?Bt(/[^\d\.]/g,r).split(`.`)[0]:void 0},Ne=function(r){for(var e in r){var t=r[e];typeof t==Ft&&t.length==2?this[t[0]]=t[1]:this[t]=void 0;}return this},Bt=function(r,e){return Vt(e)?e.replace(r,Ut):e},wr=function(r){return Bt(/\\?\"/g,r)},Vi=function(r,e){if(Vt(r))return r=Bt(/^\s\s*/,r),typeof e===Xe?r:r.substring(0,ko)},_o=function(r,e){if(!(!r||!e))for(var t=0,i,o,n,s,c,m;t<e.length&&!c;){var b=e[t],w=e[t+1];for(i=o=0;i<b.length&&!c&&b[i];)if(c=b[i++].exec(r),c)for(n=0;n<w.length;n++)m=c[++o],s=w[n],typeof s===Ft&&s.length>0?s.length===2?typeof s[1]==Fi?this[s[0]]=s[1].call(this,m):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===Fi&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=m?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=m?s[1].call(this,m,s[2]):void 0:s.length==3?this[s[0]]=m?m.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=m?s[3].call(this,m.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=m?s[3].apply(this,[m.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=m||void 0;t+=2;}},Se=function(r,e){for(var t in e)if(typeof e[t]===Ft&&e[t].length>0){for(var i=0;i<e[t].length;i++)if(Lo(e[t][i],r))return t===fs?void 0:t}else if(Lo(e[t],r))return t===fs?void 0:t;return e.hasOwnProperty(`*`)?e[`*`]:r},Ts={ME:`4.90`,"NT 3.51":`3.51`,"NT 4.0":`4.0`,2e3:[`5.0`,`5.01`],XP:[`5.1`,`5.2`],Vista:`6.0`,7:`6.1`,8:`6.2`,"8.1":`6.3`,10:[`6.4`,`10.0`],NT:``},xs={embedded:`Automotive`,mobile:`Mobile`,tablet:[`Tablet`,`EInk`],smarttv:`TV`,wearable:`Watch`,xr:[`VR`,`XR`],"?":[`Desktop`,`Unknown`],"*":void 0},ac={Chrome:`Google Chrome`,Edge:`Microsoft Edge`,"Edge WebView2":`Microsoft Edge WebView2`,"Chrome WebView":`Android WebView`,"Chrome Headless":`HeadlessChrome`,"Huawei Browser":`HuaweiBrowser`,"MIUI Browser":`Miui Browser`,"Opera Mobi":`OperaMobile`,Yandex:`YaBrowser`},Ds={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[g,[u,Lt+`Chrome`]],[/webview.+edge\/([\w\.]+)/i],[g,[u,Ui+` WebView`]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[g,[u,`Edge`]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,g],[/opios[\/ ]+([\w\.]+)/i],[g,[u,fr+` Mini`]],[/\bop(?:rg)?x\/([\w\.]+)/i],[g,[u,fr+` GX`]],[/\bopr\/([\w\.]+)/i],[g,[u,fr]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[g,[u,`Baidu`]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[g,[u,`Maxthon`]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[u,g],[/quark(?:pc)?\/([-\w\.]+)/i],[g,[u,`Quark`]],[/\bddg\/([\w\.]+)/i],[g,[u,`DuckDuckGo`]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[g,[u,`UCBrowser`]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[g,[u,`WeChat`]],[/konqueror\/([\w\.]+)/i],[g,[u,`Konqueror`]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[g,[u,`IE`]],[/ya(?:search)?browser\/([\w\.]+)/i],[g,[u,`Yandex`]],[/slbrowser\/([\w\.]+)/i],[g,[u,`Smart `+bo+hr]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,`$1 Secure`+hr],g],[/\bfocus\/([\w\.]+)/i],[g,[u,gr+` Focus`]],[/\bopt\/([\w\.]+)/i],[g,[u,fr+` Touch`]],[/coc_coc\w+\/([\w\.]+)/i],[g,[u,`Coc Coc`]],[/dolfin\/([\w\.]+)/i],[g,[u,`Dolphin`]],[/coast\/([\w\.]+)/i],[g,[u,fr+` Coast`]],[/miuibrowser\/([\w\.]+)/i],[g,[u,`MIUI`+hr]],[/fxios\/([\w\.-]+)/i],[g,[u,Lt+gr]],[/\bqihoobrowser\/?([\w\.]*)/i],[g,[u,`360`]],[/\b(qq)\/([\w\.]+)/i],[[u,/(.+)/,`$1Browser`],g],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[u,/(.+)/,`$1`+hr],g],[/samsungbrowser\/([\w\.]+)/i],[g,[u,dr+` Internet`]],[/metasr[\/ ]?([\d\.]+)/i],[g,[u,Is+` Explorer`]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,Is+` Mobile`],g],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[u,g],[/(lbbrowser|rekonq)/i],[u],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[g,u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,Do],g,[l,pr]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[u,g,[l,pr]],[/\bgsa\/([\w\.]+) .*safari\//i],[g,[u,`GSA`],[l,pr]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[g,[u,`TikTok`],[l,pr]],[/\[(linkedin)app\]/i],[u,[l,pr]],[/(chromium)[\/ ]([-\w\.]+)/i],[u,g],[/headlesschrome(?:\/([\w\.]+)| )/i],[g,[u,Es+` Headless`]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[g,[u,Ui+` WebView2`]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,Es+` WebView`],g],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[g,[u,`Android`+hr]],[/chrome\/([\w\.]+) mobile/i],[g,[u,Lt+`Chrome`]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,g],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[g,[u,Lt+`Safari`]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[u,Lt+`Safari`]],[/version\/([\w\.\,]+) .*(safari)/i],[g,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[g,`1`]],[/(webkit|khtml)\/([\w\.]+)/i],[u,g],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[u,Lt+gr],g],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,`Netscape`],g],[/(wolvic|librewolf)\/([\w\.]+)/i],[u,g],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[g,[u,gr+` Reality`]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[u,[g,/_/g,`.`]],[/(cobalt)\/([\w\.]+)/i],[u,[g,/[^\d\.]+./,Ut]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Z,`amd64`]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Z,`ia32`]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Z,`arm64`]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Z,`armhf`]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Z,`arm`]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[Z,/ower/,Ut,Le]],[/ sun4\w[;\)]/i],[[Z,`sparc`]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[Z,Le]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[p,[d,dr],[l,k]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[p,[d,dr],[l,S]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[p,[d,Ot],[l,S]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[p,[d,Ot],[l,k]],[/(macintosh);/i],[p,[d,Ot]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[p,[d,ys],[l,S]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[p,[d,Cs],[l,k]],[/honor([-\w ]+)[;\)]/i],[p,[d,Cs],[l,S]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[p,[d,vs],[l,k]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[p,[d,vs],[l,S]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[p,/_/g,` `],[d,To],[l,k]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[p,/_/g,` `],[d,To],[l,S]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[p,[d,bs],[l,S]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[p,[d,Io],[l,S]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[p,[d,Se,{OnePlus:[`203`,`304`,`403`,`404`,`413`,`415`],"*":Io}],[l,k]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[p,[d,`BLU`],[l,S]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[p,[d,`Vivo`],[l,S]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[p,[d,`Realme`],[l,S]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[p,[d,bo],[l,k]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[p,[d,bo],[l,S]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[p,[d,Eo],[l,S]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[p,[d,Eo],[l,k]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[p,[d,Ni],[l,k]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[p,[d,Ni],[l,S]],[/(nokia) (t[12][01])/i],[d,p,[l,k]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[p,/_/g,` `],[l,S],[d,`Nokia`]],[/(pixel (c|tablet))\b/i],[p,[d,mt],[l,k]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[p,[d,mt],[l,S]],[/(google) (pixelbook( go)?)/i],[d,p],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[p,[d,ur],[l,S]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[p,`Xperia Tablet`],[d,ur],[l,k]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[p,[d,Li],[l,k]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[p,/(.+)/g,`Fire Phone $1`],[d,Li],[l,S]],[/(playbook);[-\w\),; ]+(rim)/i],[p,d,[l,k]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[p,[d,ws],[l,S]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[p,[d,hs],[l,k]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[p,[d,hs],[l,S]],[/(nexus 9)/i],[p,[d,`HTC`],[l,k]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[p,/_/g,` `],[l,S]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[p,[d,`TCL`],[l,k]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[p,[d,`TCL`],[l,S]],[/(itel) ((\w+))/i],[[d,Le],p,[l,Se,{tablet:[`p10001l`,`w7001`],"*":`mobile`}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[p,[d,`Acer`],[l,k]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[p,[d,`Meizu`],[l,S]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[p,[d,`Ulefone`],[l,S]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[p,[d,`Energizer`],[l,S]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[p,[d,`Cat`],[l,S]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[p,[d,`Smartfren`],[l,S]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[p,[d,`Nothing`],[l,S]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[p,[d,`Archos`],[l,k]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[p,[d,`Archos`],[l,S]],[/; (n159v)/i],[p,[d,`HMD`],[l,S]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[d,p,[l,k]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[d,p,[l,S]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[d,p,[l,k]],[/(surface duo)/i],[p,[d,yo],[l,k]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[p,[d,`Fairphone`],[l,S]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[p,[d,So],[l,k]],[/(sprint) (\w+)/i],[d,p,[l,S]],[/(kin\.[onetw]{3})/i],[[p,/\./g,` `],[d,yo],[l,S]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[p,[d,xo],[l,k]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[p,[d,xo],[l,S]],[/smart-tv.+(samsung)/i],[d,[l,W]],[/hbbtv.+maple;(\d+)/i],[[p,/^/,`SmartTV`],[d,dr],[l,W]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[d,p,[l,W]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,Ni],[l,W]],[/(apple) ?tv/i],[d,[p,Ot+` TV`],[l,W]],[/crkey.*devicetype\/chromecast/i],[[p,ze+` Third Generation`],[d,mt],[l,W]],[/crkey.*devicetype\/([^/]*)/i],[[p,/^/,`Chromecast `],[d,mt],[l,W]],[/fuchsia.*crkey/i],[[p,ze+` Nest Hub`],[d,mt],[l,W]],[/crkey/i],[[p,ze],[d,mt],[l,W]],[/(portaltv)/i],[p,[d,Do],[l,W]],[/droid.+aft(\w+)( bui|\))/i],[p,[d,Li],[l,W]],[/(shield \w+ tv)/i],[p,[d,So],[l,W]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[p,[d,ys],[l,W]],[/(bravia[\w ]+)( bui|\))/i],[p,[d,ur],[l,W]],[/(mi(tv|box)-?\w+) bui/i],[p,[d,To],[l,W]],[/Hbbtv.*(technisat) (.*);/i],[d,p,[l,W]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[d,/.+\/(\w+)/,`$1`,Se,{LG:`lge`}],[p,Vi],[l,W]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[p,[l,W]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[l,W]],[/(playstation \w+)/i],[p,[d,ur],[l,vr]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[p,[d,yo],[l,vr]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[d,p,[l,vr]],[/droid.+; (shield)( bui|\))/i],[p,[d,So],[l,vr]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[p,[d,dr],[l,Ee]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[d,p,[l,Ee]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[p,[d,Io],[l,Ee]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[p,[d,Ot],[l,Ee]],[/(opwwe\d{3})/i],[p,[d,bs],[l,Ee]],[/(moto 360)/i],[p,[d,Eo],[l,Ee]],[/(smartwatch 3)/i],[p,[d,ur],[l,Ee]],[/(g watch r)/i],[p,[d,Ni],[l,Ee]],[/droid.+; (wt63?0{2,3})\)/i],[p,[d,xo],[l,Ee]],[/droid.+; (glass) \d/i],[p,[d,mt],[l,Oi]],[/(pico) (4|neo3(?: link|pro)?)/i],[d,p,[l,Oi]],[/(quest( \d| pro)?s?).+vr/i],[p,[d,Do],[l,Oi]],[/mobile vr; rv.+firefox/i],[[l,Oi]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[l,Cr]],[/(aeobc)\b/i],[p,[d,Li],[l,Cr]],[/(homepod).+mac os/i],[p,[d,Ot],[l,Cr]],[/windows iot/i],[[l,Cr]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[p,[l,Se,{mobile:`Mobile`,xr:`VR`,"*":k}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,k]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,S]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[p,[d,`Generic`]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[g,[u,Ui+`HTML`]],[/(arkweb)\/([\w\.]+)/i],[u,g],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[g,[u,`Blink`]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[u,g],[/ladybird\//i],[[u,`LibWeb`]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[g,u]],os:[[/(windows nt) (6\.[23]); arm/i],[[u,/N/,`R`],[g,Se,Ts]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[u,g],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[g,/(;|\))/g,``,Se,Ts],[u,Oo]],[/(windows ce)\/?([\d\.]*)/i],[u,g],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[g,/_/g,`.`],[u,`iOS`]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[u,`macOS`],[g,/_/g,`.`]],[/android ([\d\.]+).*crkey/i],[g,[u,ze+` Android`]],[/fuchsia.*crkey\/([\d\.]+)/i],[g,[u,ze+` Fuchsia`]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[g,[u,ze+` SmartSpeaker`]],[/linux.*crkey\/([\d\.]+)/i],[g,[u,ze+` Linux`]],[/crkey\/([\d\.]+)/i],[g,[u,ze]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[g,u],[/(ubuntu) ([\w\.]+) like android/i],[[u,/(.+)/,`$1 Touch`],g],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[u,g],[/\(bb(10);/i],[g,[u,ws]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[g,[u,`Symbian`]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[g,[u,gr+` OS`]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[g,[u,`webOS`]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[g,Se,{25:`120`,24:`108`,23:`94`,22:`87`,6:`79`,5:`68`,4:`53`,3:`38`,2:`538`,1:`537`,"*":`TV`}],[u,`webOS`]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[g,[u,`watchOS`]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,`Chrome OS`],g],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[u,g],[/(sunos) ?([\d\.]*)/i],[[u,`Solaris`],g],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,g]]},Mi=(function(){var r={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return Ne.call(r.init,[[Q,[u,g,br,l]],[Oe,[Z]],[Ie,[l,p,d]],[he,[u,g]],[de,[u,g]]]),Ne.call(r.isIgnore,[[Q,[g,br]],[he,[g]],[de,[g]]]),Ne.call(r.isIgnoreRgx,[[Q,/ ?browser$/i],[de,/ ?os$/i]]),Ne.call(r.toString,[[Q,[u,g]],[Oe,[Z]],[Ie,[d,p]],[he,[u,g]],[de,[u,g]]]),r})(),cc=function(r,e){var t=Mi.init[e],i=Mi.isIgnore[e]||0,o=Mi.isIgnoreRgx[e]||0,n=Mi.toString[e]||0;function s(){Ne.call(this,t);}return s.prototype.getItem=function(){return r},s.prototype.withClientHints=function(){return Ke?Ke.getHighEntropyValues(_s).then(function(c){return r.setCH(new ks(c,false)).parseCH().get()}):r.parseCH().get()},s.prototype.withFeatureCheck=function(){return r.detectFeature().get()},e!=Nt&&(s.prototype.is=function(c){var m=false;for(var b in this)if(this.hasOwnProperty(b)&&!Lo(i,b)&&Le(o?Bt(o,this[b]):this[b])==Le(o?Bt(o,c):c)){if(m=true,c!=Xe)break}else if(c==Xe&&m){m=!m;break}return m},s.prototype.toString=function(){var c=Ut;for(var m in n)typeof this[n[m]]!==Xe&&(c+=(c?` `:Ut)+this[n[m]]);return c||Xe}),Ke||(s.prototype.then=function(c){var m=this,b=function(){for(var O in m)m.hasOwnProperty(O)&&(this[O]=m[O]);};b.prototype={is:s.prototype.is,toString:s.prototype.toString};var w=new b;return c(w),w}),new s};function ks(r,e){if(r=r||{},Ne.call(this,_s),e)Ne.call(this,[[No,Po(r[Ye])],[Mo,Po(r[Qa])],[S,/\?1/.test(r[rc])],[p,wr(r[ic])],[Mt,wr(r[Rs])],[Uo,wr(r[oc])],[Z,wr(r[Za])],[pt,Po(r[tc])],[Wi,wr(r[ec])]]);else for(var t in r)this.hasOwnProperty(t)&&typeof r[t]!==Xe&&(this[t]=r[t]);}function Ps(r,e,t,i){return this.get=function(o){return o?this.data.hasOwnProperty(o)?this.data[o]:void 0:this.data},this.set=function(o,n){return this.data[o]=n,this},this.setCH=function(o){return this.uaCH=o,this},this.detectFeature=function(){if(ee&&ee.userAgent==this.ua)switch(this.itemType){case Q:ee.brave&&typeof ee.brave.isBrave==Fi&&this.set(u,`Brave`);break;case Ie:!this.get(l)&&Ke&&Ke[S]&&this.set(l,S),this.get(p)==`Macintosh`&&ee&&typeof ee.standalone!==Xe&&ee.maxTouchPoints&&ee.maxTouchPoints>2&&this.set(p,`iPad`).set(l,k);break;case de:!this.get(u)&&Ke&&Ke[Mt]&&this.set(u,Ke[Mt]);break;case Nt:var o=this.data,n=function(s){return o[s].getItem().detectFeature().get()};this.set(Q,n(Q)).set(Oe,n(Oe)).set(Ie,n(Ie)).set(he,n(he)).set(de,n(de));}return this},this.parseUA=function(){return this.itemType!=Nt&&_o.call(this.data,this.ua,this.rgxMap),this.itemType==Q&&this.set(br,Ro(this.get(g))),this},this.parseCH=function(){var o=this.uaCH,n=this.rgxMap;switch(this.itemType){case Q:case he:var s=o[Mo]||o[No],c;if(s)for(var m in s){var b=s[m].brand||s[m],w=s[m].version;this.itemType==Q&&!/not.a.brand/i.test(b)&&(!c||/Chrom/.test(c)&&b!=Ss||c==Ui&&/WebView2/.test(b))&&(b=Se(b,ac),c=this.get(u),c&&!/Chrom/.test(c)&&/Chrom/.test(b)||this.set(u,b).set(g,w).set(br,Ro(w)),c=b),this.itemType==he&&b==Ss&&this.set(g,w);}break;case Oe:var O=o[Z];O&&(O&&o[Wi]==`64`&&(O+=`64`),_o.call(this.data,O+`;`,n));break;case Ie:if(o[S]&&this.set(l,S),o[p]&&(this.set(p,o[p]),!this.get(l)||!this.get(d))){var U={};_o.call(U,`droid 9; `+o[p]+`)`,n),!this.get(l)&&U.type&&this.set(l,U.type),!this.get(d)&&U.vendor&&this.set(d,U.vendor);}if(o[pt]){var y;if(typeof o[pt]!=`string`)for(var P=0;!y&&P<o[pt].length;)y=Se(o[pt][P++],xs);else y=Se(o[pt],xs);this.set(l,y);}break;case de:var x=o[Mt];if(x){var v=o[Uo];x==Oo&&(v=parseInt(Ro(v),10)>=13?`11`:`10`),this.set(u,x).set(g,v);}this.get(u)==Oo&&o[p]==`Xbox`&&this.set(u,`Xbox`).set(g,void 0);break;case Nt:var L=this.data,A=function(C){return L[C].getItem().setCH(o).parseCH().get()};this.set(Q,A(Q)).set(Oe,A(Oe)).set(Ie,A(Ie)).set(he,A(he)).set(de,A(de));}return this},Ne.call(this,[[`itemType`,r],[`ua`,e],[`uaCH`,i],[`rgxMap`,t],[`data`,cc(this,r)]]),this}function we(r,e,t){if(typeof r===Ft?(Bi(r,true)?(typeof e===Ft&&(t=e),e=r):(t=r,e=void 0),r=void 0):typeof r===Ao&&!Bi(e,true)&&(t=e,e=void 0),t&&typeof t.append===Fi){var i={};t.forEach(function(m,b){i[b]=m;}),t=i;}if(!(this instanceof we))return new we(r,e,t).getResult();var o=typeof r===Ao?r:t&&t[gs]?t[gs]:ee&&ee.userAgent?ee.userAgent:Ut,n=new ks(t,true),s=e?sc(Ds,e):Ds,c=function(m){return m==Nt?function(){return new Ps(m,o,s,n).set(`ua`,o).set(Q,this.getBrowser()).set(Oe,this.getCPU()).set(Ie,this.getDevice()).set(he,this.getEngine()).set(de,this.getOS()).get()}:function(){return new Ps(m,o,s[m],n).parseUA().get()}};return Ne.call(this,[[`getBrowser`,c(Q)],[`getCPU`,c(Oe)],[`getDevice`,c(Ie)],[`getEngine`,c(he)],[`getOS`,c(de)],[`getResult`,c(Nt)],[`getUA`,function(){return o}],[`setUA`,function(m){return Vt(m)&&(o=m.length>ko?Vi(m,ko):m),this}]]).setUA(o),this}we.VERSION=Ja;we.BROWSER=Hi([u,g,br,l]);we.CPU=Hi([Z]);we.DEVICE=Hi([p,d,l,vr,S,W,k,Ee,Cr]);we.ENGINE=we.OS=Hi([u,g]);var $i=class{modifications=[];constructor(){Ce$1(`.lc-hide {display: none !important;height: 0 !important;}
74
+ `},navigation:{nextEl:r.querySelector(`.swiper-button-next`),prevEl:r.querySelector(`.swiper-button-prev`)},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:false,pauseOnMouseEnter:false}:false,autoHeight:true};e.marquee&&t.autoplay&&typeof t.autoplay==`object`&&(t.speed=e.speed,t.autoplay.pauseOnMouseEnter=true,r.style.setProperty(`--swiper-wrapper-transition-timing-function`,`linear`));let i=new window.CooeeSDK.Swiper(r,t);return r.style.setProperty(`--swiper-navigation-size`,`${e.navigation.size}px`),i}function Si(r,e,t){let i={color:r.navigation.color?.rgba};return r.pagination.enabled&&(i.transform=`translateY(-25%)`),h(`div`,{class:`swiper-container`,ref:e,style:`max-width: 100%`,children:[h(`div`,{class:`swiper-wrapper`,children:t()}),r.navigation.enabled&&h(`div`,{class:`swiper-button-next`,style:i,children:h(`span`,{})}),r.navigation.enabled&&h(`div`,{class:`swiper-button-prev`,style:i,children:h(`span`,{})}),r.pagination.enabled&&h(`div`,{className:`swiper-pagination`,style:{bottom:0,top:`unset`,position:`relative`,color:r.pagination.color?.rgba}})]})}var Qt=class extends _{componentDidMount(){W$2(()=>{this.setState(()=>({checked:this.props.item.selected.value}));});}render(){return h(`div`,{style:this.getCompiledStyles(),className:`lc-checkbox`,children:h(`input`,{type:`checkbox`,checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:`auto`}})})}onChange(e){let{checked:t}=e.target;this.props.item.selected.value=t;}getTypoStyles(){let e={},t=this.mediaStyle.typo??new H;return e.textAlign=t.alignment,e.justifyContent=t.alignment,e}getComponentStyles(){return s(r({},this.getTypoStyles()),{display:`flex`})}};var _e=class extends _{constructor(e,t){super(e,t);}render(){let e=this.props.element[this.deviceTypeKey],t=e?.src||this.props.element.src||this.props.element.lg?.src;return h(`img`,{onClick:this.customOnClick.bind(this),className:`lc-image`,alt:e?.name||`Image`,onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:t,style:this.getCompiledStyles()})}customOnClick(e){this.props.element.clc?.at===He$3.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick(`image`);}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!==`absolute`)return {};let t={zIndex:e.zIndex,cursor:this.props.element.clc?.at?`pointer`:`auto`};return this.mediaStyle.size?.w&&(t.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(t.height=this.mediaStyle.size.h),t}handleMouseEnter(e){let t=this.props.element[this.deviceTypeKey]?.secondarySrc;t&&(e.currentTarget.src=t);}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src;}};var ke=class extends _{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return h(`div`,{style:this.getCompiledStyles(),class:`lc-flexbox`,children:h(Ge,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new St,t={display:`flex`,gap:e.gap+`px`,flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai};return e.wrap===`nowrap`&&e.scroll&&(e.dir===`column`?t[`overflow-y`]=`auto`:t[`overflow-x`]=`auto`),t}};var Zt=class extends ke{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return h(`div`,{style:this.getCompiledStyles(),class:`lc-flexbox`,children:h(_t,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var er=class extends _{render(){return h(`select`,{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??``,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:`lc-dropdown`,children:this.createSelectItems()})}componentDidMount(){W$2(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:false}));});}getTypoStyles(){let e={},t=this.mediaStyle.typo??new H;return e.letterSpacing=t.letterSpacing,e.fontSize=t.fs+`px`,e.lineHeight=t.lh,e.fontFamily=`inherit`,e.textAlign=t.alignment,e.fontWeight=t.fw,this.stylesConverter.getColourStyles(t.tc,`color`,e),e.boxShadow=`none`,e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility=`hidden`),r(r({},e),this.getTypoStyles())}createSelectItems(){let e=[],t=this.props.selectedVariant;if(!t.sellingPlans?.length)return [];this.props.triggerContext.triggerData.skipSubscribedItems?t.selectedSellingPlan.value||(t.sellingPlans[0].isSelected=true,t.changeSellingPlan(t.sellingPlans[0])):e.push(h(`option`,{value:``,selected:!t.selectedSellingPlan,children:`One time purchase`}));for(let i of t.sellingPlans??[])e.push(h(`option`,{value:i.mID,selected:i.isSelected,children:i.name}));return e}onChange(e){let t=e.target.value;t?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(i=>i.mID===t):this.props.selectedVariant.selectedSellingPlan.value=void 0;}};var ja=new RegExp(`fill="#[a-zA-Z0-9]+"`),tr=class extends _{constructor(){super();}render(){let e=this.getCompiledStyles(),t=this.getRating();return t||(e.display=`none`,t=``),h(`div`,{style:e,className:`lc-star-rating`,dangerouslySetInnerHTML:{__html:t}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},t=qe$1(this.props.element.fullStar,{svg:e},this.props.triggerContext),i=qe$1(this.props.element.halfStart,{svg:e},this.props.triggerContext),o=this.props.review;if(!o?.rating)return ``;let n=``;if(this.props.element.showSingleStar)n=t;else {let s=5,c=`${o.rating}`.split(`.`);for(let m=0;m<+c[0];m++)n+=t,s--;c[1]&&(n+=i,s--);for(let m=0;m<s;m++)n+=t.replace(ja,`fill="#f1f1f1"`);}return n}getComponentStyles(){return {display:`flex`,alignItems:`center`}}};var rr=class extends _{render(){return h(`select`,{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:`lc-dropdown`,children:this.createSelectItems()})}componentDidMount(){W$2(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:false}));});}getTypoStyles(){let e={},t=this.mediaStyle.typo??new H;return e.letterSpacing=t.letterSpacing,e.fontSize=t.fs+`px`,e.lineHeight=t.lh,e.fontFamily=`inherit`,e.textAlign=t.alignment,e.fontWeight=t.fw,this.stylesConverter.getColourStyles(t.tc,`color`,e),e.boxShadow=`none`,e}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name===`Default Title`&&(e.visibility=`hidden`),r(r({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let t of this.props.item.vars)e.push(h(`option`,{value:t.mID,disabled:!t.isAvailable,children:t.name}));return e}onChange(e){let t=e.target.value,i=this.props.item.vars.find(o=>o.mID===t);this.props.item.setSelectedVariant(i);}};var ss=()=>{let r=window.ShopifyAnalytics?.meta??{},e=r.selectedVariantId;if(e)return e;if(r.product?.variants?.length>0)return r.product.variants[0].id},vo=r=>{if(!r)return;let e;try{e=new URL(r);}catch{return}if(e.hostname!==`cdn.shopify.com`)return r;let t=e.pathname.split(`.`);return t.length!==2?r:(e.pathname=t[0]+`_large.`+t[1],e.toString())};var _t=class extends _{constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let t=e;return t.l===`Star Rating`&&!this.props.item.reviews?.rating?void 0:h(Zt,{element:t,triggerContext:this.props.triggerContext,elements:t.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?h(Qt,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let t=e,i=this.props.item,o=vo(i.variantImage??i.firstImageURL),n=vo(i.variantSecondaryImage??i.secondaryImageURL);t.lg=t.sm={src:o,name:i.name,secondarySrc:n};let s=h(_e,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:h(`a`,{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:`block`},children:s})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let t=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name===`Default Title`?void 0:t.showChips?h(`cooee-product-options-picker`,{item:this.props.item}):h(rr,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?h(er,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?h(tr,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?h(st,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):h(Ge,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.attachListener(),this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return {}}renderProductTitle(e){let t=h(oe,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?t:h(`a`,{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:`block`,textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:t})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e});}onMouseEnter(){this.setState(()=>({decoration:`underline`}));}onMouseLeave(){this.setState(()=>({decoration:`unset`}));}attachListener(){document.addEventListener(`letscooee:variant-change`,e=>{let t=e;if(!t.detail||this.props.item.mID!==t.detail.productID)return;let i=t.detail.variantID;this.props.item.setSelectedVariantByID(i);});}};var at=class extends _{productElement;constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}render(){if(this.productElement=new He(Ve$2(this.props.element,this.getProductData(),this.props.triggerContext)),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return h(`div`,{style:r({},this.getCompiledStyles()),class:`lc-single-product`,children:h(_t,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return {flexShrink:0}}getProductData(){if(!this.props.item)return {};let e=this.props.item,t=e.selectedOrFirstVariant.value,i=e.getTemplateVariables();i.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let o=this.props.triggerContext.triggerData.discount?.type===ce.BXGY;return !t.hasEffectivePrice()&&o&&(i.product=s(r(r({},i.product),An$1(`effective_price`,t.effectivePrice.value)),{price:``})),i.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(t.quantity):t.quantity,{product:i.product,variant:i.variant,svg:{color:`{{ svg.color }}`,size:`{{ svg.size }}`}}}};var ir=class extends _{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,t){super(e,t),this.configuration=M$1()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+`px`;}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&Vi$1().then(()=>{this.swiperInstance=Ei(this.swiperRef,this.props.element.conf[this.deviceTypeKey]);});}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy();}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let t;if(this.configuration.disp===2){let i=n=>{this.swiperRef=n;},o=()=>e?.map(n=>h(`div`,{class:`swiper-slide`,children:this.getProductFragment(n)}));t=h(`div`,{style:s(r({},this.getCompiledStyles()),{display:`block`}),class:`lc-product-swiper-list`,children:Si(this.configuration,i,o)});}else t=h(`div`,{style:this.getCompiledStyles(),class:`lc-product-list`,children:e?.map((i,o)=>this.getProductFragment(i,o!==e.length-1))});return t}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),t={display:e?`flex`:`grid`,justifyContent:`safe `+(this.mediaStyle.flex?.jc??`center`),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??`row`};if(t.flexDirection===`row`){if(e)t.maxWidth=`100%`,t.overflowY=`auto`;else if(this.configuration.disp===1){let i=this.props.triggerContext.triggerData,o=i.items.length,n;i.isBundle()?n=this.props.element.prod.symbol?.hide!==true?o*2-1:o:n=this.props.element.conf[this.deviceTypeKey].maxInRow,t.gridTemplateColumns=`repeat(${n}, auto)`;}}return t}getProductFragment(e,t=false){return h(j$2,{children:[h(at,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&t&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&h(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:h(oe,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var or=class extends _{swiperRef=null;swiperInstance=null;constructor(e,t){super(e,t);}componentDidMount(){Vi$1().then(()=>{this.swiperInstance=Ei(this.swiperRef,this.props.element.conf);});}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy();}render(){let e=this.props.element,t=o=>{this.swiperRef=o;},i=()=>{let o=e.values?.map(c=>h(`div`,{class:`swiper-slide`,onClick:m=>this.onClick(m,{clickAction:this.getClickAction(c)}),children:this.renderElement(c)}));if(!o?.length)return [];let n=e.conf,s=o.length;if(n.marquee&&s<=Number(n.maxInRow)){let c=Number(n.maxInRow)-s+1;for(let m=0;m<c;m++)o.push(o[m%s]);}return o};return Si(e.conf,t,i)}getComponentStyles(){return {}}renderElement(e){let t=this.valueAddedSlide(this.props.element.slide,e);switch(t?.t){case 1:return h(_e,{element:t,triggerContext:this.props.triggerContext});case 4:return h(ke,{elements:t.elems,element:t,triggerContext:this.props.triggerContext});default:Y$1.warn(`Unknown slide type for carousal`);}}valueAddedSlide(e,t){let i=Ve$2(e,{form:t},this.props.triggerContext);return ie.getParsedElement(i)}getClickAction(e){return Ve$2(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var Ge=class extends _{constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`})),W$2(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}));});}renderElement(e){if(!e.hide){if(e.t===4){let t=e;return h(ke,{element:t,triggerContext:this.props.triggerContext,elements:t.elems})}if(e.t===61)return h(Jt,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?h(st,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return h(oe,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return h(_e,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return h(ir,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return h(at,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return h(or,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return {}}};var nr=class extends _{clickAction;isClickable;constructor(e,t){super(e,t),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===He$3.GO_TO_URL&&!!Dn(this.clickAction.gu?.u)||this.clickAction?.at===He$3.OPEN_CART||this.clickAction?.at===He$3.INITIATE_CHECKOUT;}componentDidMount(){W$2(()=>{let e=this.props.triggerContext.triggerData,t=this.props.triggerContext.selectedItems;e.calculateDiscountData(t,this.props.triggerContext.shouldGiveFBTDiscount);});}render(){return h(j$2,{children:[h(`div`,{style:this.getCompiledStyles(),class:`lc-container`,onClick:e=>{this.onClick(e,{clickAction:this.clickAction});},children:h(Ge,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id===`preview`&&h(`div`,{class:`letscooee-preview-badge`,children:[`#`,this.props.triggerContext.triggerData.shortID,` preview`]})]})}getComponentStyles(){let e={position:`relative`,overflow:`hidden`,display:`block`};return this.isClickable&&(e.cursor=`pointer`),e}};var X=class r$9{constructor(e){this.engagementTrigger=e;this.triggerContext=new Fe(new Date,this.engagementTrigger);}static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;triggerContext;observers=[];renderedCount=0;scrollSubscription;isExclusionWithBVariation;isProcessing=false;renderSilently(){this.acquireProcessingLock()||this.render().finally(()=>this.releaseProcessingLock()).catch(e=>{ke$2(e,`render-widget`,{triggerContext:this.triggerContext});});}destroy(){Y$1.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),r$9.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),xi$1(this.engagementTrigger.content?.afterDeleteJS);}matches(e){return this.engagementTrigger.shortID===e.shortID}async render(){if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e);}if(this.rootContainer=await this.getWidgetContainer(true),!this.rootContainer){Y$1.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),await this.getVariationIfRequired(),await this.runChoresBeforeRender(),this.attachScroll(),this.checkAndSendEvent(),this.triggerContext.renderer=this,xi$1(this.engagementTrigger.content?.afterRenderJS);}async updateAndReRender(e){if(!this.acquireProcessingLock())try{this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render();}finally{this.releaseProcessingLock();}}async update(e){this.engagementTrigger.variation=e.variation;}async rerenderIfDeleted(){if(!this.rootContainer?.isConnected&&!this.acquireProcessingLock()){Y$1.info(`${this.engagementTrigger} deleted. Will be re-rendered`);try{this.preDestroy(),await this.render();}finally{this.releaseProcessingLock();}}}updateAngularWidget(){return this.widgetElement?.isConnected?(this.widgetElement.update(),true):false}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect();});}acquireProcessingLock(){return this.isProcessing?(Y$1.verbose(`Lock could not be acquired for ${this.engagementTrigger}`),true):(Y$1.verbose(`Acquiring rendering lock for ${this.engagementTrigger}`),this.isProcessing=true,false)}releaseProcessingLock(){Y$1.verbose(`Releasing rendering lock for ${this.engagementTrigger}`),this.isProcessing=false;}afterRootContainerCreated(){}isAllOkToRender(){return !!this.engagementTrigger.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){Y$1.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e);}handleVariationResponse(e){if(!e)return;let t=this.engagementTrigger;Y$1.log(`${t} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(t.items=e.items.map(i=>new ot$2(i)),t.nonMutableItems=e.items.map(i=>new ot$2(i))),e.bundleFrom&&(t.bundleFrom=new ot$2(e.bundleFrom)),e.discount&&(t.discount=e.discount),e.placement&&(t.placement=e.placement),e.props&&pe$4.hasKeys(e.props)&&(t.props=r(r({},t.props),e.props)),e.content&&(t.content=new Kt(e.content)),t.widget=new Dt(e.widget),t.contentID=e.contentID,t.variation=e.variation,t.placement=e.placement,t.manipulation=e.manipulation,t.entryAnimation=e.entryAnimation??`NONE`,this.isExclusionWithBVariation=t.isExclusionTesting()&&t.variation===`b`,this.isExclusionWithBVariation&&(this.rootContainer.style.height=`0.5px`);}addToRendered(){this.renderedCount++,Y$1.info(`${this.engagementTrigger} rendered \u2705 ${Mn$1(this.renderedCount)} time`);}removeFromRendered(){this instanceof pe?ct.delete(this):kt.delete(this);}async getVariation(){Y$1.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id===`preview`};try{return (await as(e)).data}catch(t){if(t instanceof oe$5&&t.response?.status===400)return;ke$2(t,`get-variation`,{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){Y$1.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,t={root:null,rootMargin:`${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(i=>{let o=new IntersectionObserver((n,s)=>{n.forEach(async c=>{if(c.isIntersecting){Y$1.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);i(await this.getVariation()),s.unobserve(this.rootContainer);}});},t);o.observe(this.rootContainer),this.observers.push(o);})}attachScroll(){this.scrollSubscription=Tr(window,`scroll`).pipe(Fe$1(r$9.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent();});}checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(r$9.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let i={};this.triggerContext.triggerData.items?.length&&(i.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let n=new Ir$1(this.isExclusionWithBVariation?`CE Campaign Holdout`:`CE Trigger Displayed`,i,this.engagementTrigger);n.name===`CE Campaign Holdout`&&(n.trigger.holdout=true),fe(n),r$9.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe();}generateParentElementID(){return `letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let t=this.widgetElement=document.createElement(e);return t.cart=E.getCurrent(),t.triggerContext=this.triggerContext,t.engagementTrigger=this.engagementTrigger,t.setAttribute(`engagement`,this.engagementTrigger.shortID),this.rootContainer.appendChild(t),this.addToRendered(),this.injectOuterCSSOnly(),t}getParentElement(e,t=document){let i=t.getElementById(e);if(i)return i;let o=this.engagementTrigger.objective.toLowerCase().replaceAll(`_`,`-`),n=this.engagementTrigger.shortID;return i=document.createElement(`div`),i.id=e,i.className=`letscooee letscooee-engagement engagement-${n} lc-${o}`,i.dataset.engagementId=n,this.engagementTrigger.id===`preview`&&(i.className+=` letscooee-preview`),i.style.display=`block`,i.style.minHeight=`0.5px`,i.style.minWidth=`0.5px`,i}async startRendering(){let e=this.rootContainer,t=this.triggerContext.triggerData.hasSwiperElement();t&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:`open`}),Mi$1(e)),this.injectCampaignCSS(t,e);let i=this.engagementTrigger.widget;ze$1(pe$3(nr,{element:i.cont,triggerContext:this.triggerContext,elements:i.elems}),e),this.addToRendered();}injectCampaignCSS(e,t){let i=this.engagementTrigger.content?.outerCSS?.trim()??``,o=this.engagementTrigger.content?.innerCSS?.trim()??``;if(!i&&!o)return;let n=this.rootContainer.id;if(e){Ce$1(o,t),this.injectOuterCSSOnly();return}Ce$1(`#${n} { ${i+`
75
+ ${o}`} }`);}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let t=this.rootContainer.id;Ce$1(`#${t} { ${e} }`);}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return false;let t=window.innerHeight||document.documentElement.clientHeight,s=(Math.min(e.bottom,t)-Math.max(e.top,0))*e.width/(e.width*e.height)*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let t=await this.createParentElementWithPlacement(e);if(t)return t;let i=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(i)}async createParentElementWithPlacement(e){let t=this.engagementTrigger.placement;if(!t?.selector)return Y$1.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let i=t.selector,o;if(i.includes(`:shadow`)){let m=i.split(`:shadow`);o=(await Ln$1(m[0].trim()))?.shadowRoot,i=m[1].trim(),o&&Mi$1(o,false);}Y$1.verbose(`${this.engagementTrigger} attempt to render "${t.position}" "${i}"`);let n=await Ln$1(i,3,o??document);if(!n)return Y$1.warn(`${this.engagementTrigger} no placement found with ${i}`),null;let s=this.generateParentElementID(),c=this.getParentElement(s);if(!e)return c;switch(t.position){case Ve$3.BEFORE1:case Ve$3.BEFORE:n.parentElement?.insertBefore(c,n);break;case Ve$3.INSIDE_FIRST1:case Ve$3.INSIDE_FIRST:n.insertBefore(c,n.firstChild);break;case Ve$3.INSIDE_LAST1:case Ve$3.INSIDE_LAST:n.appendChild(c);break;case Ve$3.AFTER1:case Ve$3.AFTER:default:n.parentElement?.insertBefore(c,n.nextSibling);}return c}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){Y$1.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}Y$1.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await hi(this.engagementTrigger);}catch(t){Y$1.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,t);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){Y$1.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,await this.startRendering();}updateItems(e,t){let i=this.getItemDiff(e,t),o=this.getItemDiff(t,e);t.push(...i);for(let n of o)Pe.remove(t,n);}getItemDiff(e,t){return e.filter(i=>!t.some(o=>o.selectedOrFirstVariant.value.mID===i.selectedOrFirstVariant.value.mID))}};var pe=class extends X{constructor(e){super(e);}rerenderAfterCartOpened(){this.rerenderIfDeleted(),this.checkAndSendEvent();}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}checkAndSendEvent(){if(!V.get().isOpen()&&Be$3().pageName!==`cart`){Y$1.log(`Do not send display event as neither the cart drawer nor the cart page is open.`);return}return super.checkAndSendEvent()}};var Ii=class r{constructor(e,t){this.engagementTrigger=e;this.element=t;this.cartItems=E.getCurrent().items;}cartItems;static renderCartUpsell(e){let t=e.placement;if(!t?.selector){Y$1.warn(`No placement available for ${e.objective}`,e.shortID);return}let i=Array.from(document.querySelectorAll(t.selector));if(!i?.length){Y$1.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let o of i)new r(e,o).render();}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let t=this.engagementTrigger.items.find(w=>w.mID===e.product_id.toString());if(!t)return;let i=t.vars.find(w=>w.mID===e.id.toString());if(!i)return;let o=new nt$1(i),n=e.selling_plan_allocation?.selling_plan;if(n)for(let w of o.sellingPlans??[])w.mID===n.id.toString()&&(w.isSelected=true,o.changeSellingPlan(w));let s=new ot$2(t);s.vars=[o],s.selectedOrFirstVariant.value=o;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${t.mID}`;this.element.classList.add(c);let m=new j(this.engagementTrigger);m.placement.selector=`.${c}`,m.items=[s];let C=new pe(m);C.renderSilently(),this.watchForCartItemDeletion(C,c);}watchForCartItemDeletion(e,t){let i=new MutationObserver(o=>{o.forEach(n=>{n.removedNodes.forEach(s=>{s===this.element&&(Y$1.verbose(`${t} has been removed`),e.destroy(),i.disconnect());});});});i.observe(this.element.parentElement,{childList:true,subtree:true});}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(t=>{if(!(e.includes(t.url)||e.includes(t.variant_id))&&(!e.includes(t.product_title)||t.variant_title&&!e.includes(t.variant_title)))return false;let i=t.selling_plan_allocation?.selling_plan?.name;return !(i&&!e.includes(i))})}};var Ti=class extends X{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-collection-filter`);}};var xi=class extends pe{constructor(e){super(e);}async update(e){await super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),await this.checkMilestoneTryCatch(),this.updateAngularWidget();}isAllOkToRender(){return !!this.engagementTrigger.progressBarConfig}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget(`cooee-progressbar`),await this.checkMilestoneTryCatch();}async checkMilestoneTryCatch(){try{await this.checkMilestone();}catch(e){ke$2(e,`apply-milestones`,{engagementTrigger:this.engagementTrigger});}}async checkMilestone(){let e=await E.getCurrent().getNormalisedCart(),t=this.engagementTrigger.progressBarConfig,i=[],o=[],n=[],s,c,m=[...t.milestones];for(let v of m){if(v.rewardType!==Fe$2.FREE_AUTO_GIFT)continue;if(v.isUIOnly&&!v.allowATC){Y$1.verbose(`Skipping milestone ${v.label} as it is UI only and does not allow ATC`);continue}let L=v.items[0],A=v.reached,b=e.items.find(Je=>(Je.vID===L.vID||Je.mID===L.mID)&&Je.properties._letscooee_campaign===this.engagementTrigger.shortID);A&&(s=v,c=b),b&&i.push(b),!A&&b&&t.removeIneligibleItem?(Y$1.verbose(`Removing free gift ${b.vID} from cart`),n.push(b)):A&&!b&&(Y$1.verbose(`Adding free gift ${L.vID} to cart`),o.push(L));}t.restrictToLatestFreebie&&s&&(c?(i=i.filter(v=>v.vID!==c.vID),o=[]):o=[s.items[0]],n.push(...i));let C={},w={};n.length&&n.forEach(v=>w[v.key??v.vID]=0),o.length&&o.forEach(v=>w[v.vID]=1);let O=t.coupons,F=[];if(O?.length){F=O.map(A=>A.couponCode);let v=E.getCurrent().discount_codes?.map(A=>A.code)??[];F.every(A=>v.some(b=>b===A))||(C.discount=F.join(`,`));}if(pe$4.hasKeys(w)&&(C.updates=w),!pe$4.hasKeys(C))return;let y=await is(C,this.engagementTrigger),P=y?.items,x=[];for(let v of o){let L=P?.find(A=>F?.length?A.id+``===v.vID&&A.discounts?.some(b=>F.includes(b.title)):A.id+``===v.vID);L&&x.push(L);}if(!x.length){V.get().refreshUI(y,false);return}try{await Promise.all(x.map(v=>os(v,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})));}catch(v){ke$2(v,`add-private-attribute`,{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:x}});}finally{V.get().refreshUI(y,false);}}};var sr=class extends pe{constructor(e){super(e);}async update(e){await super.update(e),this.engagementTrigger.content.update(e.content),this.updateAngularWidget();}isAllOkToRender(){return !!this.engagementTrigger.content}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget(`cooee-savings-bar`);}};var Di=class extends X{constructor(e){super(e);}isAllOkToRender(){return !!this.engagementTrigger.content?.videoConfig}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e,t=this.engagementTrigger.content.videoConfig;t.template===`FLOATING_POPUP`?e=`cooee-video-popup`:t.template===`STORY`?e=`cooee-video-stories`:e=`cooee-video-playlist`,this.createAngularWidget(e);}};var Pi=class extends X{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-sticky-atc`);}};var Ri=class extends X{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener(`letscooee:inbound:cta:add-bundle`,this.inboundCTAListener.bind(this),false);}async inboundCTAListener(e){let t=this.engagementTrigger,i=`Engagement(id: ${t.engagementID}, shortID: ${t.shortID})`,o=e.detail;if(!pe$4.hasKeys(o)){Y$1.error(`No detail received for ${i}`);return}Y$1.log(`Detail received for BYOB`,o);let n=o.campaignID??o.campaignId??o.campaign_id;if(n!==t.shortID&&n!==t.engagementID){Y$1.warn(`Current ${i} is not BYOB. Received: ${n}`);return}let s=o.items;if(!s?.length)return;let c=s.map(m=>new et({mID:m.product_id,vID:m.variant_id,quantity:m.quantity||1}));await new Re(this.triggerContext).execute({embeddedItems:c,clickAction:{at:He$3.ADD_BUNDLE,applyDiscount:true}});}};var bo=false,Co=false,_i=null,ki=null,cs=false,ct=new Set,kt=new Set;function ls(){cs||(cs=true,ht$2(()=>{Un(document.body,{childList:true,subtree:true},500,Mn).subscribe(()=>{kt.forEach(r=>r.rerenderIfDeleted()),ct.forEach(r=>r.rerenderIfDeleted());});}));}function ar(r){if(r.length>0&&us(),ls(),bo){Y$1.verbose(`Cart widget processing in progress, queuing latest triggers`),_i=r;return}bo=true;try{za(r);}finally{if(bo=false,_i){let e=_i;_i=null,Y$1.verbose(`Processing queued cart triggers`),ar(e);}}}function cr(r){if(r.length>0&&us(),ls(),Co){Y$1.verbose(`Page widget processing in progress, queuing latest triggers`),ki=r;return}Co=true;try{Ka(r);}finally{if(Co=false,ki){let e=ki;ki=null,Y$1.verbose(`Processing queued page triggers`),cr(e);}}}function ms(){ct.forEach(r=>r.rerenderAfterCartOpened());}function za(r){ds(ct,r);for(let e of r){Y$1.info(`${e} received as cart embed`);let t=ps(ct,e);if(t&&!e.isSubscriptionUpsell()){t.updateAndReRender(e).catch(o=>{ke$2(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$1.verbose(`${e} is new`);let i;if(e.isProgressBar())i=new xi(e);else if(e.isSubscriptionUpsell()){Ii.renderCartUpsell(e);continue}else e.isSavingsBar()?i=new sr(e):i=new pe(e);ct.add(i),i.renderSilently();}}function Ka(r){ds(kt,r);for(let e of r){Y$1.info(`${e} received as page embed`);let t=ps(kt,e);if(t){t.updateAndReRender(e).catch(o=>{ke$2(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$1.verbose(`${e} is new`);let i;e.isShoppableVideo()?i=new Di(e):e.isBYOB()?i=new Ri(e):e.isStickyATC()?i=new Pi(e):e.isSavingsBar()?i=new sr(e):e.isCollectionFilter()?i=new Ti(e):i=new X(e),kt.add(i),i.renderSilently();}}function ps(r,e){for(let t of r)if(t.matches(e))return t}function ds(r,e){let t=new Set(e.map(i=>i.shortID));for(let i of r)t.has(i.engagementTrigger.shortID)||i.destroy();}function us(){import('./widgets-D_OSh97N-Bpf2Pdkf.js').then(function (n) { return n.ad; }).then(({loadAngularWidgets:r})=>{r();});}var Ai=class extends ne$2{static storeName=`app`;static{this.storage=ge$3(this.storeName);}};var Xa=` daum[ /]| deusu/|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?:lib))http|(?<![hg]m)score|(?<!cam)scan|24x7|@[a-z][\\w-]+\\.|\\(\\)|\\.com\\b|\\bperl\\b|\\btime/|\\||^[\\w \\.\\-\\(?:\\):%]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\W|^\\w*search\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^azure|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^email|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^igetter/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d\\s[\\w\\.-]+$|^mozilla/\\d\\.\\d\\s\\(compatible;?(?:\\s\\w+\\/\\d+\\.\\d+)?\\)$|^navermailapp|^netsurf|^offline|^openai/|^owler|^php|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|agent\\b|analyzer|archive|ask jeeves/teoma|audit|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check\\b|checker|chrome-lighthouse|chromeframe|classifier|cloudflare|convertify|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|exaleadcloudview|feed|fetcher|firephp|functionize|grab|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|infrawatch|insight|inspect|iplabel|java(?!;)|library|linkcheck|mail\\.ru/|manager|measure|neustar wpm|node\\b|nutch|offbyone|onetrust|optimize|pageburst|pagespeed|parser|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|retriever|rexx;|rigor|rss\\b|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|supercleaner|synapse|synthetic|tools|torrent|transcoder|url|validator|virtuoso|wappalyzer|webglance|webkit2png|whatcms/|xtate/`,Ya=/bot|crawl|http|lighthouse|scan|search|spider/i,lr;function Ja(){if(lr instanceof RegExp)return lr;try{lr=new RegExp(Xa,`i`);}catch{lr=Ya;}return lr}function gs(r){return !!r&&Ja().test(r)}var Qa=`2.0.4`,Ao=500,fs=`user-agent`,Mt=``,hs=`?`,Fi=`function`,Ke=`undefined`,Ut=`object`,Oo=`string`,Q=`browser`,Ae=`cpu`,Se=`device`,he=`engine`,de=`os`,Lt=`result`,u=`name`,l=`type`,d=`vendor`,g=`version`,Z=`architecture`,br=`major`,p=`model`,wr=`console`,S=`mobile`,k=`tablet`,W=`smarttv`,ye=`wearable`,Oi=`xr`,vr=`embedded`,mr=`inapp`,Mo=`brands`,mt=`formFactors`,Uo=`fullVersionList`,Nt=`platform`,Fo=`platformVersion`,Wi=`bitness`,Xe=`sec-ch-ua`,Za=Xe+`-full-version-list`,ec=Xe+`-arch`,tc=Xe+`-`+Wi,rc=Xe+`-form-factors`,ic=Xe+`-`+S,oc=Xe+`-`+p,_s=Xe+`-`+Nt,nc=_s+`-version`,ks=[Mo,Uo,S,p,Nt,Fo,Z,mt,Wi],Li=`Amazon`,At=`Apple`,ws=`ASUS`,vs=`BlackBerry`,lt=`Google`,bs=`Huawei`,yo=`Lenovo`,Cs=`Honor`,Ni=`LG`,Eo=`Microsoft`,So=`Motorola`,Io=`Nvidia`,ys=`OnePlus`,To=`OPPO`,pr=`Samsung`,Es=`Sharp`,dr=`Sony`,xo=`Xiaomi`,Do=`Zebra`,Ss=`Chrome`,Is=`Chromium`,je=`Chromecast`,Ui=`Edge`,ur=`Firefox`,gr=`Opera`,Po=`Facebook`,Ts=`Sogou`,Ot=`Mobile `,fr=` Browser`,Lo=`Windows`,ee=typeof window!==Ke&&window.navigator?window.navigator:void 0,ze=ee&&ee.userAgentData?ee.userAgentData:void 0,ac=function(r,e){var t={},i=e;if(!Bi(e)){i={};for(var o in e)for(var n in e[o])i[n]=e[o][n].concat(i[n]?i[n]:[]);}for(var s in r)t[s]=i[s]&&i[s].length%2===0?i[s].concat(r[s]):r[s];return t},Hi=function(r){for(var e={},t=0;t<r.length;t++)e[r[t].toUpperCase()]=r[t];return e},No=function(r,e){if(typeof r===Ut&&r.length>0){for(var t in r)if(Oe(e)==Oe(r[t]))return true;return false}return Bt(r)?Oe(e)==Oe(r):false},Bi=function(r,e){for(var t in r)return /^(browser|cpu|device|engine|os)$/.test(t)||(e?Bi(r[t]):false)},Bt=function(r){return typeof r===Oo},Ro=function(r){if(r){for(var e=[],t=Ft(/\\?\"/g,r).split(`,`),i=0;i<t.length;i++)if(t[i].indexOf(`;`)>-1){var o=Vi(t[i]).split(`;v=`);e[i]={brand:o[0],version:o[1]};}else e[i]=Vi(t[i]);return e}},Oe=function(r){return Bt(r)?r.toLowerCase():r},_o=function(r){return Bt(r)?Ft(/[^\d\.]/g,r).split(`.`)[0]:void 0},Le=function(r){for(var e in r){var t=r[e];typeof t==Ut&&t.length==2?this[t[0]]=t[1]:this[t]=void 0;}return this},Ft=function(r,e){return Bt(e)?e.replace(r,Mt):e},hr=function(r){return Ft(/\\?\"/g,r)},Vi=function(r,e){if(Bt(r))return r=Ft(/^\s\s*/,r),typeof e===Ke?r:r.substring(0,Ao)},ko=function(r,e){if(!(!r||!e))for(var t=0,i,o,n,s,c,m;t<e.length&&!c;){var C=e[t],w=e[t+1];for(i=o=0;i<C.length&&!c&&C[i];)if(c=C[i++].exec(r),c)for(n=0;n<w.length;n++)m=c[++o],s=w[n],typeof s===Ut&&s.length>0?s.length===2?typeof s[1]==Fi?this[s[0]]=s[1].call(this,m):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===Fi&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=m?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=m?s[1].call(this,m,s[2]):void 0:s.length==3?this[s[0]]=m?m.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=m?s[3].call(this,m.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=m?s[3].apply(this,[m.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=m||void 0;t+=2;}},Ee=function(r,e){for(var t in e)if(typeof e[t]===Ut&&e[t].length>0){for(var i=0;i<e[t].length;i++)if(No(e[t][i],r))return t===hs?void 0:t}else if(No(e[t],r))return t===hs?void 0:t;return e.hasOwnProperty(`*`)?e[`*`]:r},xs={ME:`4.90`,"NT 3.51":`3.51`,"NT 4.0":`4.0`,2e3:[`5.0`,`5.01`],XP:[`5.1`,`5.2`],Vista:`6.0`,7:`6.1`,8:`6.2`,"8.1":`6.3`,10:[`6.4`,`10.0`],NT:``},Ds={embedded:`Automotive`,mobile:`Mobile`,tablet:[`Tablet`,`EInk`],smarttv:`TV`,wearable:`Watch`,xr:[`VR`,`XR`],"?":[`Desktop`,`Unknown`],"*":void 0},cc={Chrome:`Google Chrome`,Edge:`Microsoft Edge`,"Edge WebView2":`Microsoft Edge WebView2`,"Chrome WebView":`Android WebView`,"Chrome Headless":`HeadlessChrome`,"Huawei Browser":`HuaweiBrowser`,"MIUI Browser":`Miui Browser`,"Opera Mobi":`OperaMobile`,Yandex:`YaBrowser`},Ps={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[g,[u,Ot+`Chrome`]],[/webview.+edge\/([\w\.]+)/i],[g,[u,Ui+` WebView`]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[g,[u,`Edge`]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,g],[/opios[\/ ]+([\w\.]+)/i],[g,[u,gr+` Mini`]],[/\bop(?:rg)?x\/([\w\.]+)/i],[g,[u,gr+` GX`]],[/\bopr\/([\w\.]+)/i],[g,[u,gr]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[g,[u,`Baidu`]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[g,[u,`Maxthon`]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[u,g],[/quark(?:pc)?\/([-\w\.]+)/i],[g,[u,`Quark`]],[/\bddg\/([\w\.]+)/i],[g,[u,`DuckDuckGo`]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[g,[u,`UCBrowser`]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[g,[u,`WeChat`]],[/konqueror\/([\w\.]+)/i],[g,[u,`Konqueror`]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[g,[u,`IE`]],[/ya(?:search)?browser\/([\w\.]+)/i],[g,[u,`Yandex`]],[/slbrowser\/([\w\.]+)/i],[g,[u,`Smart `+yo+fr]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,`$1 Secure`+fr],g],[/\bfocus\/([\w\.]+)/i],[g,[u,ur+` Focus`]],[/\bopt\/([\w\.]+)/i],[g,[u,gr+` Touch`]],[/coc_coc\w+\/([\w\.]+)/i],[g,[u,`Coc Coc`]],[/dolfin\/([\w\.]+)/i],[g,[u,`Dolphin`]],[/coast\/([\w\.]+)/i],[g,[u,gr+` Coast`]],[/miuibrowser\/([\w\.]+)/i],[g,[u,`MIUI`+fr]],[/fxios\/([\w\.-]+)/i],[g,[u,Ot+ur]],[/\bqihoobrowser\/?([\w\.]*)/i],[g,[u,`360`]],[/\b(qq)\/([\w\.]+)/i],[[u,/(.+)/,`$1Browser`],g],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[u,/(.+)/,`$1`+fr],g],[/samsungbrowser\/([\w\.]+)/i],[g,[u,pr+` Internet`]],[/metasr[\/ ]?([\d\.]+)/i],[g,[u,Ts+` Explorer`]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,Ts+` Mobile`],g],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[u,g],[/(lbbrowser|rekonq)/i],[u],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[g,u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,Po],g,[l,mr]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[u,g,[l,mr]],[/\bgsa\/([\w\.]+) .*safari\//i],[g,[u,`GSA`],[l,mr]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[g,[u,`TikTok`],[l,mr]],[/\[(linkedin)app\]/i],[u,[l,mr]],[/(chromium)[\/ ]([-\w\.]+)/i],[u,g],[/headlesschrome(?:\/([\w\.]+)| )/i],[g,[u,Ss+` Headless`]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[g,[u,Ui+` WebView2`]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,Ss+` WebView`],g],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[g,[u,`Android`+fr]],[/chrome\/([\w\.]+) mobile/i],[g,[u,Ot+`Chrome`]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,g],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[g,[u,Ot+`Safari`]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[u,Ot+`Safari`]],[/version\/([\w\.\,]+) .*(safari)/i],[g,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[g,`1`]],[/(webkit|khtml)\/([\w\.]+)/i],[u,g],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[u,Ot+ur],g],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,`Netscape`],g],[/(wolvic|librewolf)\/([\w\.]+)/i],[u,g],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[g,[u,ur+` Reality`]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[u,[g,/_/g,`.`]],[/(cobalt)\/([\w\.]+)/i],[u,[g,/[^\d\.]+./,Mt]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Z,`amd64`]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Z,`ia32`]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Z,`arm64`]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Z,`armhf`]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Z,`arm`]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[Z,/ower/,Mt,Oe]],[/ sun4\w[;\)]/i],[[Z,`sparc`]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[Z,Oe]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[p,[d,pr],[l,k]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[p,[d,pr],[l,S]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[p,[d,At],[l,S]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[p,[d,At],[l,k]],[/(macintosh);/i],[p,[d,At]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[p,[d,Es],[l,S]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[p,[d,Cs],[l,k]],[/honor([-\w ]+)[;\)]/i],[p,[d,Cs],[l,S]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[p,[d,bs],[l,k]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[p,[d,bs],[l,S]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[p,/_/g,` `],[d,xo],[l,k]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[p,/_/g,` `],[d,xo],[l,S]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[p,[d,ys],[l,S]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[p,[d,To],[l,S]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[p,[d,Ee,{OnePlus:[`203`,`304`,`403`,`404`,`413`,`415`],"*":To}],[l,k]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[p,[d,`BLU`],[l,S]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[p,[d,`Vivo`],[l,S]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[p,[d,`Realme`],[l,S]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[p,[d,yo],[l,k]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[p,[d,yo],[l,S]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[p,[d,So],[l,S]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[p,[d,So],[l,k]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[p,[d,Ni],[l,k]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[p,[d,Ni],[l,S]],[/(nokia) (t[12][01])/i],[d,p,[l,k]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[p,/_/g,` `],[l,S],[d,`Nokia`]],[/(pixel (c|tablet))\b/i],[p,[d,lt],[l,k]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[p,[d,lt],[l,S]],[/(google) (pixelbook( go)?)/i],[d,p],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[p,[d,dr],[l,S]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[p,`Xperia Tablet`],[d,dr],[l,k]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[p,[d,Li],[l,k]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[p,/(.+)/g,`Fire Phone $1`],[d,Li],[l,S]],[/(playbook);[-\w\),; ]+(rim)/i],[p,d,[l,k]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[p,[d,vs],[l,S]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[p,[d,ws],[l,k]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[p,[d,ws],[l,S]],[/(nexus 9)/i],[p,[d,`HTC`],[l,k]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[p,/_/g,` `],[l,S]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[p,[d,`TCL`],[l,k]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[p,[d,`TCL`],[l,S]],[/(itel) ((\w+))/i],[[d,Oe],p,[l,Ee,{tablet:[`p10001l`,`w7001`],"*":`mobile`}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[p,[d,`Acer`],[l,k]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[p,[d,`Meizu`],[l,S]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[p,[d,`Ulefone`],[l,S]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[p,[d,`Energizer`],[l,S]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[p,[d,`Cat`],[l,S]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[p,[d,`Smartfren`],[l,S]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[p,[d,`Nothing`],[l,S]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[p,[d,`Archos`],[l,k]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[p,[d,`Archos`],[l,S]],[/; (n159v)/i],[p,[d,`HMD`],[l,S]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[d,p,[l,k]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[d,p,[l,S]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[d,p,[l,k]],[/(surface duo)/i],[p,[d,Eo],[l,k]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[p,[d,`Fairphone`],[l,S]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[p,[d,Io],[l,k]],[/(sprint) (\w+)/i],[d,p,[l,S]],[/(kin\.[onetw]{3})/i],[[p,/\./g,` `],[d,Eo],[l,S]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[p,[d,Do],[l,k]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[p,[d,Do],[l,S]],[/smart-tv.+(samsung)/i],[d,[l,W]],[/hbbtv.+maple;(\d+)/i],[[p,/^/,`SmartTV`],[d,pr],[l,W]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[d,p,[l,W]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,Ni],[l,W]],[/(apple) ?tv/i],[d,[p,At+` TV`],[l,W]],[/crkey.*devicetype\/chromecast/i],[[p,je+` Third Generation`],[d,lt],[l,W]],[/crkey.*devicetype\/([^/]*)/i],[[p,/^/,`Chromecast `],[d,lt],[l,W]],[/fuchsia.*crkey/i],[[p,je+` Nest Hub`],[d,lt],[l,W]],[/crkey/i],[[p,je],[d,lt],[l,W]],[/(portaltv)/i],[p,[d,Po],[l,W]],[/droid.+aft(\w+)( bui|\))/i],[p,[d,Li],[l,W]],[/(shield \w+ tv)/i],[p,[d,Io],[l,W]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[p,[d,Es],[l,W]],[/(bravia[\w ]+)( bui|\))/i],[p,[d,dr],[l,W]],[/(mi(tv|box)-?\w+) bui/i],[p,[d,xo],[l,W]],[/Hbbtv.*(technisat) (.*);/i],[d,p,[l,W]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[d,/.+\/(\w+)/,`$1`,Ee,{LG:`lge`}],[p,Vi],[l,W]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[p,[l,W]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[l,W]],[/(playstation \w+)/i],[p,[d,dr],[l,wr]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[p,[d,Eo],[l,wr]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[d,p,[l,wr]],[/droid.+; (shield)( bui|\))/i],[p,[d,Io],[l,wr]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[p,[d,pr],[l,ye]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[d,p,[l,ye]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[p,[d,To],[l,ye]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[p,[d,At],[l,ye]],[/(opwwe\d{3})/i],[p,[d,ys],[l,ye]],[/(moto 360)/i],[p,[d,So],[l,ye]],[/(smartwatch 3)/i],[p,[d,dr],[l,ye]],[/(g watch r)/i],[p,[d,Ni],[l,ye]],[/droid.+; (wt63?0{2,3})\)/i],[p,[d,Do],[l,ye]],[/droid.+; (glass) \d/i],[p,[d,lt],[l,Oi]],[/(pico) (4|neo3(?: link|pro)?)/i],[d,p,[l,Oi]],[/(quest( \d| pro)?s?).+vr/i],[p,[d,Po],[l,Oi]],[/mobile vr; rv.+firefox/i],[[l,Oi]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[l,vr]],[/(aeobc)\b/i],[p,[d,Li],[l,vr]],[/(homepod).+mac os/i],[p,[d,At],[l,vr]],[/windows iot/i],[[l,vr]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[p,[l,Ee,{mobile:`Mobile`,xr:`VR`,"*":k}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,k]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,S]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[p,[d,`Generic`]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[g,[u,Ui+`HTML`]],[/(arkweb)\/([\w\.]+)/i],[u,g],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[g,[u,`Blink`]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[u,g],[/ladybird\//i],[[u,`LibWeb`]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[g,u]],os:[[/(windows nt) (6\.[23]); arm/i],[[u,/N/,`R`],[g,Ee,xs]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[u,g],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[g,/(;|\))/g,``,Ee,xs],[u,Lo]],[/(windows ce)\/?([\d\.]*)/i],[u,g],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[g,/_/g,`.`],[u,`iOS`]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[u,`macOS`],[g,/_/g,`.`]],[/android ([\d\.]+).*crkey/i],[g,[u,je+` Android`]],[/fuchsia.*crkey\/([\d\.]+)/i],[g,[u,je+` Fuchsia`]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[g,[u,je+` SmartSpeaker`]],[/linux.*crkey\/([\d\.]+)/i],[g,[u,je+` Linux`]],[/crkey\/([\d\.]+)/i],[g,[u,je]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[g,u],[/(ubuntu) ([\w\.]+) like android/i],[[u,/(.+)/,`$1 Touch`],g],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[u,g],[/\(bb(10);/i],[g,[u,vs]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[g,[u,`Symbian`]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[g,[u,ur+` OS`]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[g,[u,`webOS`]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[g,Ee,{25:`120`,24:`108`,23:`94`,22:`87`,6:`79`,5:`68`,4:`53`,3:`38`,2:`538`,1:`537`,"*":`TV`}],[u,`webOS`]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[g,[u,`watchOS`]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,`Chrome OS`],g],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[u,g],[/(sunos) ?([\d\.]*)/i],[[u,`Solaris`],g],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,g]]},Mi=(function(){var r={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return Le.call(r.init,[[Q,[u,g,br,l]],[Ae,[Z]],[Se,[l,p,d]],[he,[u,g]],[de,[u,g]]]),Le.call(r.isIgnore,[[Q,[g,br]],[he,[g]],[de,[g]]]),Le.call(r.isIgnoreRgx,[[Q,/ ?browser$/i],[de,/ ?os$/i]]),Le.call(r.toString,[[Q,[u,g]],[Ae,[Z]],[Se,[d,p]],[he,[u,g]],[de,[u,g]]]),r})(),lc=function(r,e){var t=Mi.init[e],i=Mi.isIgnore[e]||0,o=Mi.isIgnoreRgx[e]||0,n=Mi.toString[e]||0;function s(){Le.call(this,t);}return s.prototype.getItem=function(){return r},s.prototype.withClientHints=function(){return ze?ze.getHighEntropyValues(ks).then(function(c){return r.setCH(new As(c,false)).parseCH().get()}):r.parseCH().get()},s.prototype.withFeatureCheck=function(){return r.detectFeature().get()},e!=Lt&&(s.prototype.is=function(c){var m=false;for(var C in this)if(this.hasOwnProperty(C)&&!No(i,C)&&Oe(o?Ft(o,this[C]):this[C])==Oe(o?Ft(o,c):c)){if(m=true,c!=Ke)break}else if(c==Ke&&m){m=!m;break}return m},s.prototype.toString=function(){var c=Mt;for(var m in n)typeof this[n[m]]!==Ke&&(c+=(c?` `:Mt)+this[n[m]]);return c||Ke}),ze||(s.prototype.then=function(c){var m=this,C=function(){for(var O in m)m.hasOwnProperty(O)&&(this[O]=m[O]);};C.prototype={is:s.prototype.is,toString:s.prototype.toString};var w=new C;return c(w),w}),new s};function As(r,e){if(r=r||{},Le.call(this,ks),e)Le.call(this,[[Mo,Ro(r[Xe])],[Uo,Ro(r[Za])],[S,/\?1/.test(r[ic])],[p,hr(r[oc])],[Nt,hr(r[_s])],[Fo,hr(r[nc])],[Z,hr(r[ec])],[mt,Ro(r[rc])],[Wi,hr(r[tc])]]);else for(var t in r)this.hasOwnProperty(t)&&typeof r[t]!==Ke&&(this[t]=r[t]);}function Rs(r,e,t,i){return this.get=function(o){return o?this.data.hasOwnProperty(o)?this.data[o]:void 0:this.data},this.set=function(o,n){return this.data[o]=n,this},this.setCH=function(o){return this.uaCH=o,this},this.detectFeature=function(){if(ee&&ee.userAgent==this.ua)switch(this.itemType){case Q:ee.brave&&typeof ee.brave.isBrave==Fi&&this.set(u,`Brave`);break;case Se:!this.get(l)&&ze&&ze[S]&&this.set(l,S),this.get(p)==`Macintosh`&&ee&&typeof ee.standalone!==Ke&&ee.maxTouchPoints&&ee.maxTouchPoints>2&&this.set(p,`iPad`).set(l,k);break;case de:!this.get(u)&&ze&&ze[Nt]&&this.set(u,ze[Nt]);break;case Lt:var o=this.data,n=function(s){return o[s].getItem().detectFeature().get()};this.set(Q,n(Q)).set(Ae,n(Ae)).set(Se,n(Se)).set(he,n(he)).set(de,n(de));}return this},this.parseUA=function(){return this.itemType!=Lt&&ko.call(this.data,this.ua,this.rgxMap),this.itemType==Q&&this.set(br,_o(this.get(g))),this},this.parseCH=function(){var o=this.uaCH,n=this.rgxMap;switch(this.itemType){case Q:case he:var s=o[Uo]||o[Mo],c;if(s)for(var m in s){var C=s[m].brand||s[m],w=s[m].version;this.itemType==Q&&!/not.a.brand/i.test(C)&&(!c||/Chrom/.test(c)&&C!=Is||c==Ui&&/WebView2/.test(C))&&(C=Ee(C,cc),c=this.get(u),c&&!/Chrom/.test(c)&&/Chrom/.test(C)||this.set(u,C).set(g,w).set(br,_o(w)),c=C),this.itemType==he&&C==Is&&this.set(g,w);}break;case Ae:var O=o[Z];O&&(O&&o[Wi]==`64`&&(O+=`64`),ko.call(this.data,O+`;`,n));break;case Se:if(o[S]&&this.set(l,S),o[p]&&(this.set(p,o[p]),!this.get(l)||!this.get(d))){var F={};ko.call(F,`droid 9; `+o[p]+`)`,n),!this.get(l)&&F.type&&this.set(l,F.type),!this.get(d)&&F.vendor&&this.set(d,F.vendor);}if(o[mt]){var y;if(typeof o[mt]!=`string`)for(var P=0;!y&&P<o[mt].length;)y=Ee(o[mt][P++],Ds);else y=Ee(o[mt],Ds);this.set(l,y);}break;case de:var x=o[Nt];if(x){var v=o[Fo];x==Lo&&(v=parseInt(_o(v),10)>=13?`11`:`10`),this.set(u,x).set(g,v);}this.get(u)==Lo&&o[p]==`Xbox`&&this.set(u,`Xbox`).set(g,void 0);break;case Lt:var L=this.data,A=function(b){return L[b].getItem().setCH(o).parseCH().get()};this.set(Q,A(Q)).set(Ae,A(Ae)).set(Se,A(Se)).set(he,A(he)).set(de,A(de));}return this},Le.call(this,[[`itemType`,r],[`ua`,e],[`uaCH`,i],[`rgxMap`,t],[`data`,lc(this,r)]]),this}function we(r,e,t){if(typeof r===Ut?(Bi(r,true)?(typeof e===Ut&&(t=e),e=r):(t=r,e=void 0),r=void 0):typeof r===Oo&&!Bi(e,true)&&(t=e,e=void 0),t&&typeof t.append===Fi){var i={};t.forEach(function(m,C){i[C]=m;}),t=i;}if(!(this instanceof we))return new we(r,e,t).getResult();var o=typeof r===Oo?r:t&&t[fs]?t[fs]:ee&&ee.userAgent?ee.userAgent:Mt,n=new As(t,true),s=e?ac(Ps,e):Ps,c=function(m){return m==Lt?function(){return new Rs(m,o,s,n).set(`ua`,o).set(Q,this.getBrowser()).set(Ae,this.getCPU()).set(Se,this.getDevice()).set(he,this.getEngine()).set(de,this.getOS()).get()}:function(){return new Rs(m,o,s[m],n).parseUA().get()}};return Le.call(this,[[`getBrowser`,c(Q)],[`getCPU`,c(Ae)],[`getDevice`,c(Se)],[`getEngine`,c(he)],[`getOS`,c(de)],[`getResult`,c(Lt)],[`getUA`,function(){return o}],[`setUA`,function(m){return Bt(m)&&(o=m.length>Ao?Vi(m,Ao):m),this}]]).setUA(o),this}we.VERSION=Qa;we.BROWSER=Hi([u,g,br,l]);we.CPU=Hi([Z]);we.DEVICE=Hi([p,d,l,wr,S,W,k,ye,vr]);we.ENGINE=we.OS=Hi([u,g]);var $i=class{modifications=[];constructor(){Ce$1(`.lc-hide {display: none !important;height: 0 !important;}
76
76
  .lc-display-block {display: block !important;}
77
- .lc-display-inline {display: inline !important;}`,document.body);}execute(e){for(let t of e){if(!t.experimentConfig)continue;this.executeExperiment(t)&&this.trackExperimentRan(t);}if(document.querySelector(`#lc-hide-body`)?.remove(),!document.body){to(`No body element found`,`error`);return}this.setupMutationObserver();}executeExperiment(e){let t=e.experimentConfig?.modifications;if(!t?.length)return Y$1.log(`Nothing to experiment`,e.toString()),true;let i=false;for(let o of t){if(!o.cssSelector){Y$1.verbose(`No CSS Selector available`,e?.toString());continue}this.modifications.push(o);let n=Array.from(document.querySelectorAll(o.cssSelector));n?.length&&(this.executeSingleModification(o,n),i=true);}return i}executeSingleModification(e,t){if(t?.length)for(let i of t)Object.assign(i.style,e.style),e.display===`HIDE`?i.classList.add(`lc-hide`):e.display===`BLOCK`?i.classList.add(`lc-display-block`):e.display===`INLINE`&&i.classList.add(`lc-display-inline`),e.type===`TEXT`&&e.text?i.innerHTML=e.text:e.type===`IMAGE`&&this.updateImage(e,i),e.moveTo?.selector&&this.changePlacement(e,i).catch(console.error);}async changePlacement(e,t){let i=await On$1(e.moveTo.selector);if(i)switch(e.moveTo.position){case Ve$3.BEFORE1:t.nextElementSibling!==i&&i.parentElement?.insertBefore(t,i);break;case Ve$3.INSIDE_FIRST1:i.firstChild!==t&&i.insertBefore(t,i.firstChild);break;case Ve$3.INSIDE_LAST1:i.lastChild!==t&&i.appendChild(t);break;case Ve$3.AFTER1:default:t.previousElementSibling!==i&&i.parentElement?.insertBefore(t,i.nextSibling);}}trackExperimentRan(e){if(e.id===`preview`){Y$1.warn(`Skipping experiment attribution as its preview`,e.toString());return}As({name:`CE Experiment Start`,experiment:new mt$1(e)}).catch(t=>{Y$1.error(`Fail to track experiment`,t);});}setupMutationObserver(){new MutationObserver(t=>{t.forEach(i=>{i.addedNodes.forEach(o=>{o instanceof HTMLElement&&this.modifications.forEach(n=>{if(o.matches&&o.matches(n.cssSelector))Y$1.verbose(`1. Re-applying experiment`,n.toString()),this.executeSingleModification(n,[o]);else if(o.querySelectorAll){let s=Array.from(o.querySelectorAll(n.cssSelector));if(!s.length)return;Y$1.verbose(`2. Re-applying experiment`,n.toString()),this.executeSingleModification(n,s);}});});});}).observe(document.body,{childList:true,subtree:true});}updateImage(e,t){let i=e.image?.lg?.src,o=e.image?.sm?.src;!i&&!o||(t instanceof HTMLPictureElement?this.updatePictureElement({desktop:i,mobile:o},t):this.updateImageElement({desktop:i,mobile:o},t));}updateImageElement(e,t){M$1()&&e.mobile?(t.setAttribute(`src`,e.mobile),t.removeAttribute(`srcset`)):e.desktop&&(t.setAttribute(`src`,e.desktop),t.removeAttribute(`srcset`));}updatePictureElement(e,t){if(t.innerHTML=``,e.mobile){let o=document.createElement(`source`);o.srcset=e.mobile,o.media=`(max-width: 767px)`,t.append(o);}if(e.desktop){let o=document.createElement(`source`);o.srcset=e.desktop,o.media=`(min-width: 768px)`,t.append(o);}let i=document.createElement(`img`);i.src=e.desktop??e.mobile??``,t.append(i);}};async function As(r$9){let e=await qe();await me(`/v1/event/experiment`,r(r({},r$9),e));}function qi(){lc().catch(r=>ke$2(r,`fetch-experiments`));}async function lc(){Be$3().activeExperiments&&(await le$1(le),await mc());}async function mc(){Y$1.info(`Fetch experiments after ⏰`,tn()+` of SDK load`);me(`/v1/engagement/experiments`,r({},await qe())).then(async t=>{Y$1.info(`Experiments fetched ${Qr$3(t.timeTakenMs)}`);let i=t.data.experiments.map(o=>new j(o));new $i().execute(i);}).catch(t=>{Y$1.error(`Error sending experiment getter`,t);});}function Os(){let r=he$3.get();!r.gaMeasurementID||!r.gaEnabled||dc();}async function pc(){let r=await fe$4.get(`gacid`),e=await uc();if(r!==e)return await fe$4.set(`gacid`,e),e}async function dc(){let r=await pc();r&&Xn({gaClientID:r});}async function uc(){let e=he$3.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(t=>{window.gtag(`get`,e,`client_id`,i=>{t(i);});})}async function Ls(r){Y$1.verbose(`Received app configuration`,r),r.currencyCount=r.currencies?.length;let e=D.globalRef.config.update(r);Os(),V.initialize(),e.website&&(Ui$1(e.website.commonJS),Ce$1(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(Fe(10)).subscribe(async({open:t})=>{Y$1.info(`Cart drawer is now`,t?`open`:`closed`),t&&(ls(),await gc());});}function Ns(r){D.globalRef.apiURLs=r;}async function gc(){let r=await E.getCurrent().getNormalisedCart(),e={value:r.amount,currency:r.currency};K(new Ir$1(`View Cart`,{items:r.items,amount:e,drawer:true}));}var Gi=class{runtimeData=Be$3();meddle(){let e=D.globalRef;e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods();}exposeMethods(){let e=D.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{Wt();},e.loadExperiments=()=>{qi();},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=D.previewWidget.bind(D),e.previewPopup=D.previewPopup.bind(D),e.executeCTA=(t,i)=>{new _e(t).execute(i);},e.sendEvent=t=>{K(t);};}overwritePush(e,t){Mn$1(e,`push`,t);}meddleEvents(){this.overwritePush(D.globalRef.events,(...e)=>{this.processEvent(e[0]);}),D.globalRef.events.forEach(this.processEvent.bind(this));}meddleProfile(){this.overwritePush(D.globalRef.profile,(...e)=>{this.processProfile(e[0]);}),D.globalRef.profile.forEach(this.processProfile.bind(this));}processEvent(e){e&&(qr$3.includes(e[0])?D.sendEvent(e[0],e[1],r({occurred:this.runtimeData.jsLoadTime},e[2])):D.sendEvent(e[0],e[1],e[2]));}processProfile(e){e&&D.updateProfile(e);}meddlePage(){this.overwritePush(D.globalRef.page,(...e)=>{this.processPage(e[0]);}),D.globalRef.page.forEach(this.processPage.bind(this));}processPage(e){e.appID&&D.authenticate(e),e.currentItem&&fc(e.currentItem),e.currency&&(Be$3().currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&D.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&E.getCurrent().update(e.cart),e.configurations&&Ls(e.configurations),e.apiURLs&&Ns(e.apiURLs),e.customContext&&(this.runtimeData.customContext=r(r({},this.runtimeData.customContext),e.customContext));}async testCartUpdate(){if(Be$3().pageName!==`product`){window.alert(`This feature is only available on a product page`);return}let e=ns();if(e||(e=Be$3().currentItem?.vID),!e){window.alert(`Could not find a variant to test. Please try a different product page`);return}let t=new j({id:`preview`,shortID:`1`,redirectBehaviour:Me$1.CART_DRAWER});await new _e(new Be(new Date,t)).execute({clickAction:{at:He$3.ADD_TO_CART},embeddedItem:new et({vID:e})});}};function fc(r){let e=Be$3();if(e.currentItem&&e.currentItem.vID!==r.vID){let t=new CustomEvent(`letscooee:variant-change`,{detail:{variantID:r.vID,productID:r.mID}});document.dispatchEvent(t);}e.currentItem=new et(r);}var Ht=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=`cooee`.concat(`-`);static getString(e,t){return this.getItem(e)||t}static setString(e,t){this.setItem(e,t);}static remove(e){this.removeItem(e);}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,t){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),t);}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e));}};var hc=1e3,wc=10,Fo=0,Bo=new Date;function Vo(r){Ht.remove(`sleid`),Bo=r??new Date;}function Ms(){if(window.scrollY){let r=Bs();Us(r)&&Fs(r);}vt$2(()=>{vc();});}function vc(){Tr(window,`scroll`).pipe(Fe(hc),q$1(()=>{let r=Bs();if(r>100){Y$1.warn(`Received scroll percent is more than 100`,r);return}if(Us(r))return r})).subscribe(r=>{Fs(r);});}function Us(r){return Math.abs(Fo-r)>=wc||Fo!==r&&r===100}function Fs(r){if(r==null)return;let e={percent:r,timeMS:new Date().getTime()-Bo.getTime()};Fo=r;let i=new Ir$1(`CE Scroll`,e,null,Ht.getString(`sleid`,``));K(i),Ht.setString(`sleid`,i.id.toHexString()),Bo=new Date(i.occurred);}function Bs(){let r=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/r*100)}function Vs(){document.onvisibilitychange=()=>{document.visibilityState===`visible`?Cc():document.visibilityState===`hidden`&&bc();};}async function Cc(){}async function bc(){let r=await yc();if(r===0){Y$1.info(`Not sending duration as user was inactive on website`);return}Hs(r);}async function yc(){let r=Be$3();return r.inInactive?0:(r.inInactive=true,r.lastEnterInactive=new Date,Math.max(r.lastEnterInactive.getTime()-r.lastEnterActive.getTime(),0))}function Ws(){let r=Be$3();return r.inInactive?(r.inInactive=false,r.lastEnterActive=new Date,Math.max((r.lastEnterActive.getTime()-r.lastEnterInactive.getTime())/1e3,0)):0}function $s(){Ec();}function Ec(){let r=window.fetch;try{window.fetch=async function(e,t){try{await Sc(e,t);}catch(i){ke$2(i,`modify-graphql-request`,{extra:{body:JSON.stringify(t?.body)}});}return r(e,t)};}catch(e){console.warn(`Fail to override fetch.`,`Cooee won't be able to track "Buy Now Clicked" KPI.`),Y$1.error(e);}Y$1.verbose(`Securely overwritten window.fetch method for graphql query`);}async function Sc(r,e){let t=typeof r==`string`?r:r instanceof Request?r.url:``;if(!(t.includes(`graphql.json`)&&e?.method===`POST`)||!e.body)return;let i;if(typeof e.body==`string`)try{i=JSON.parse(e.body);}catch{return}else i=e.body;i?.variables?.input&&(Y$1.verbose(`Intercepted fetch request of:`,t),i?.query.includes(`cartCreate`)&&(e.body=await Ic(i),Tc()));}async function Ic(r){let e=r.variables.input.attributes??[],t=await Pn(`Buy Now`);return r.variables.input.attributes=[...e,...t],JSON.stringify(r)}function Tc(){let r=Be$3().currentItem;if(!r)return;K(new Ir$1(`Buy Now Clicked`,{items:[r]}));}var $t=class{constructor(e,t){this.selectors=e;this.eventName=t;this.selectorString=e.join(`,`);}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let t=e.currentTarget;K(new Ir$1(this.eventName,{class:t.className||void 0,tagName:t.tagName||void 0,id:t.id||void 0})),this.removeClickListener(this.clickListenerCallback);};listenSilently(){this.listen().catch(e=>Y$1.error(e));}async listen(){this.elements=await xr$1(this.selectorString),this.elements.forEach(e=>{e.addEventListener(`click`,this.clickListenerCallback);});}removeClickListener(e){this.elements?.forEach(t=>{t.removeEventListener(`click`,e);});}};var ji=class r extends $t{static selectors=[`.product__thumbnail-list-inner > button`,`product-gallery-navigation > button`,`.product-media--thumb-container`,`.product-images-inner > img`,`.m-product-media`,`.swiper-button-control`,`.media__thumb`,`.slick-arrow`,`.productView-img-container.product-single__media`,`.product-gallery__thumbnail_item_inner`];constructor(){super(r.selectors,`Item Thumbnail Clicked`);}static getInstance(){return this.INSTANCE||(this.INSTANCE=new r),this.INSTANCE}};var zi=class r extends $t{static selectors=[`.jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup`,`reviewsio-product-ratings`,`.ruk_rating_snippet.tracked:not(.hidden)`,`a > .loox-rating`,`.yotpo-reviews-star-ratings-widget`,`.yotpo.lp-hero__reviews`,`.pr-rating > a`,`.rivyoReviewWidget`];constructor(){super(r.selectors,`Review Clicked`);}static getInstance(){return this.INSTANCE||(this.INSTANCE=new r),this.INSTANCE}};var xc=[`.gokwik-checkout button`,`button.cart__checkout-button`,`button.cart__checkout`,`button#checkout`,`button#checkout2`,`button[id*="checkout" i]`,`button[name*="checkout" i]`,`button[class*="checkout" i]`].join(`,`);function qs(){vt$2(()=>{Y$1.verbose(`Execution order:`,`document ready`),Dc();});}function Dc(){let r=window.location.hash?.substring(1);if(r)if(r.includes(`initiate-checkout`)){document.dispatchEvent(new Event(`letscooee:outbound:third-party-initiate-checkout`));let e=document.querySelector(xc);if(!e){Y$1.verbose(`No clickable cart checkout button found`);return}Y$1.verbose(`Clickable cart checkout button found`,e),e.click();}else r.includes(`open-cart-drawer`)&&V.get().open();}function js(){window.addEventListener(`kp-modal:opened`,()=>{Be$3().isGoKwikPopupOpen=true;}),window.addEventListener(`user-loggedin`,r=>{let{token:e}=r.detail;e&&_t({goKwikToken:e});}),window.gokwikSdk?Gs():window.addEventListener(`gokwikLoaded`,Gs);}function Gs(){window.gokwikSdk&&window.gokwikSdk.on(`checkout_initiated`,async()=>{let r=await E.getCurrent().getNormalisedCart();K(new Ir$1(`Checkout Started`,{via:`GoKwik`,items:r.items,cartToken:r.token,amount:{value:r.amount,currency:r.currency}}));});}var D=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(!window.cooeeSDKPreview){if(Y$1.info(`Initialising SDK`),us(navigator.userAgent)){Y$1.info(`This seems to be a bot. Disabling SDK`);return}this.initGlobalReference(e),await Ks(),this.autoAuthenticate(),new Gi().meddle(),jn(),qi(),Pc(),Vs(),Wn(),$s(),qs(),Ms(),zi.getInstance().listenSilently(),ji.getInstance().listenSilently(),js(),Rc(),Hn$1(),po(),Ai.remove(`conf`).catch(t=>{Y$1.error(`Fail to remove App Config from local storage`,t);});}}static initGlobalReference(e){window.CooeeSDK||Mn$1(window,`CooeeSDK`,{}),this.globalRef=window.CooeeSDK,Mn$1(this.globalRef,`config`,new he$3),Mn$1(this.globalRef,`runtimeData`,{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Mn$1(this.globalRef,`uaParser`,new we,true),Mn$1(this.globalRef,`cart`,E.getCurrent()),Mn$1(this.globalRef,`cartChange$`,Vn()),Mn$1(this.globalRef,`cartDrawerToggle$`,V.cartDrawerToggle$.asObservable()),Y$1.verbose(`Global reference initialised`),new le$3(()=>{this.globalRef.uaParser=new we;});}static autoAuthenticate(){let e=Yr();e&&this.authenticate({shopifyShop:e});}static authenticate(e){if(this.authenticated)return;Y$1.info(`Begin auth after ⏰`,tn(),`of SDK load`);let t=e.appID?.trim(),i=e.shopifyShop;if((Cn(t)||t.length!==24)&&Cn(i)){Y$1.warn(`Cooee App ID or Shop name is not configured`);return}this.authenticated=true,zs(e);}static sendEvent(e,t,i){let o=new Ir$1(e,t,i?.triggerData);i?.occurred&&(o.occurred=i.occurred),K(o);}static updateProfile(e){for(let t in e)if(t.toLowerCase().startsWith(`ce `))throw new Error(`User property name cannot start with 'CE '`);_t(e);}static setPageName(e){if(!e)return;let t=Be$3(),i=t.pageName;if(e===i)return;if(t.pageName=e,jr$2.some(s=>e.includes(s))){Vo();return}let o={};i&&(o.ps=i);let n=new Ir$1(`CE Screen View`,o);n.occurred=t.jsLoadTime,K(n),Vo(n.occurred);}static previewPopup(e,t){import('./renderer-CQIvegw_-BzUvQegY.js').then(({FreeformRenderer:i})=>{new i(t).render(e);});}static previewWidget(e){new X(new j(e)).renderSilently();}};function Pc(){window.CooeeSDK.cartChange$.subscribe(()=>{Wt();});}function Rc(){if(window.opener){try{window.opener.postMessage({action:`COOEE_READY_FOR_PREVIEW`},`*`);}catch(r){Y$1.error(r);}window.addEventListener(`message`,r=>{if(Y$1.verbose(`Received event`,r),!r.origin.includes(`letscooee.com`)&&!r.origin.includes(`localhost`))return;let e=r.data;typeof e==`object`&&(e.action===`POPUP_PREVIEW`?(D.previewPopup(e.engagementTrigger),r.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},r.origin)):e.action===`WIDGET_PREVIEW`&&(D.previewWidget(e.engagementTrigger),r.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},r.origin)));});}}var Ys=new U,Xs=0;Ys.pipe(Fe(50)).subscribe(async r=>{_c(await qe()).catch(t=>{ke$2(t,`load-page-widgets`,{extra:{firstLoad:r}});});});function Wt(r=false){le$1(le).then(()=>{Ys.next(r);});}async function ss(r){let e=await qe();return Object.assign(r,e),me(`/v1/engagement/get-variant`,r)}async function _c(r$10){Xs++,Xs===1?Y$1.info(`Fetch widgets (after ⏰`,tn()+` of SDK load)`):Y$1.info(`Fetch widgets`);let e=r({},r$10),t=Bn$1(`/v1/engagement/eligible`,D.globalRef.apiURLs?.engagementsURL);try{let i=await me(t,e);if(Y$1.info(`Widgets fetched ${Qr$3(i.timeTakenMs)}`),i.data.pageWidgets?.length)lr(i.data.pageWidgets.map(n=>new j(n)));if(i.data.cartWidgets?.length)cr(i.data.cartWidgets.map(n=>new j(n)));}catch(i){Y$1.error(`Error sending widget getter`,i);}}var Js=x$2(dr$2()),Ki=class r{static META_REQUIRED_FIELDS=[`ad_id`];static GOOGLE_REQUIRED_FIELDS=[`gad_source`,`gclid`];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source;}static getAdParams(){let e;try{e=new Js.URLBuilder(location.href);}catch{return {}}let t={};if(this.META_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return t={source:`META`,adID:e.getQueryParam(`ad_id`)?.trim(),campaignID:e.getQueryParam(`campaign_id`)?.trim()},new r(t);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return t={source:`GOOGLE`},new r(t)}};var Wo={d:(r,e)=>{for(var t in e)Wo.o(e,t)&&!Wo.o(r,t)&&Object.defineProperty(r,t,{enumerable:true,get:e[t]});},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e)},Ho={};Wo.d(Ho,{A:()=>kc,k:()=>$o});var yr=function(r,e,t,i){return new(t||(t=Promise))(function(o,n){function s(b){try{m(i.next(b));}catch(w){n(w);}}function c(b){try{m(i.throw(b));}catch(w){n(w);}}function m(b){var w;b.done?o(b.value):(w=b.value,w instanceof t?w:new t(function(O){O(w);})).then(s,c);}m((i=i.apply(r,[])).next());})},Er=function(r,e){var t,i,o,n,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return n={next:c(0),throw:c(1),return:c(2)},typeof Symbol==`function`&&(n[Symbol.iterator]=function(){return this}),n;function c(m){return function(b){return (function(w){if(t)throw new TypeError(`Generator is already executing.`);for(;n&&(n=0,w[0]&&(s=0)),s;)try{if(t=1,i&&(o=2&w[0]?i.return:w[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,w[1])).done)return o;switch(i=0,o&&(w=[2&w[0],o.value]),w[0]){case 0:case 1:o=w;break;case 4:return s.label++,{value:w[1],done:!1};case 5:s.label++,i=w[1],w=[0];continue;case 7:w=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!((o=o.length>0&&o[o.length-1])||w[0]!==6&&w[0]!==2)){s=0;continue}if(w[0]===3&&(!o||w[1]>o[0]&&w[1]<o[3])){s.label=w[1];break}if(w[0]===6&&s.label<o[1]){s.label=o[1],o=w;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(w);break}o[2]&&s.ops.pop(),s.trys.pop();continue}w=e.call(r,s);}catch(O){w=[6,O],i=0;}finally{t=o=0;}if(5&w[0])throw w[1];return {value:w[0]?w[1]:void 0,done:true}})([m,b])}}};function $o(){return yr(this,void 0,Promise,function(){return Er(this,function(r){switch(r.label){case 0:return [4,new Promise(function(e,t){var i=`Unknown`,o=false;function n(y){o||(o=true,e({isPrivate:y,browserName:i}));}function s(){var y=0,P=parseInt(`-1`);try{P.toFixed(P);}catch(x){y=x.message.length;}return y}function c(){return navigator.msSaveBlob!==void 0&&(function(y){try{return y===eval.toString().length}catch{return false}})(39)}function m(){var y;return yr(this,void 0,void 0,function(){var P,x;return Er(this,function(v){switch(v.label){case 0:return v.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return v.sent(),n(false),[3,3];case 2:return P=v.sent(),x=P,P instanceof Error&&(x=(y=P.message)!==null&&y!==void 0?y:P),typeof x!=`string`?(n(false),[2]):(n(!!x.includes(`unknown transient reason`)),[3,3]);case 3:return [2]}})})}function b(){var y;return yr(this,void 0,Promise,function(){return Er(this,function(P){switch(P.label){case 0:return ((y=navigator.storage)===null||y===void 0?void 0:y.getDirectory)===void 0?[3,2]:[4,m()];case 1:return P.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var x=String(Math.random());try{var v=indexedDB.open(x,1);v.onupgradeneeded=function(L){var A=L.target.result,C=function(Qe){n(Qe);};try{A.createObjectStore(`t`,{autoIncrement:!0}).put(new Blob),C(!1);}catch(Qe){(Qe.message||``).includes(`are not yet supported`)?C(!0):C(!1);}finally{A.close(),indexedDB.deleteDatabase(x);}},v.onerror=function(){return n(!1)};}catch{n(false);}})():(function(){var x=window.openDatabase,v=window.localStorage;try{x(null,null,null,null);}catch{n(true);return}try{v.setItem(`test`,`1`),v.removeItem(`test`);}catch{n(true);return}n(false);})(),P.label=3;case 3:return [2]}})})}function w(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(y,P){var x;n(Math.round(P/1048576)<2*Math.round(((x=window).performance!==void 0&&x.performance.memory!==void 0&&x.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576));},function(y){t(new Error(`detectIncognito somehow failed to query storage quota: `+y.message));});}function O(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?w():(0, window.webkitRequestFileSystem)(0,1,function(){n(false);},function(){n(true);});}function U(){return yr(this,void 0,Promise,function(){var y,P;return Er(this,function(x){switch(x.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return [3,4];x.label=1;case 1:return x.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return x.sent(),n(false),[3,4];case 3:return y=x.sent(),typeof(P=y instanceof Error&&typeof y.message==`string`?y.message:String(y))!=`string`?(n(false),[2]):(n(P.includes(`Security error`)),[2]);case 4:return n(navigator.serviceWorker===void 0),[2]}})})}(function(){return yr(this,void 0,Promise,function(){return Er(this,function(y){switch(y.label){case 0:return s()!==44?[3,2]:(i=`Safari`,[4,b()]);case 1:return y.sent(),[3,6];case 2:return s()!==51?[3,3]:(P=navigator.userAgent,i=P.match(/Chrome/)?navigator.brave!==void 0?`Brave`:P.match(/Edg/)?`Edge`:P.match(/OPR/)?`Opera`:`Chrome`:`Chromium`,O(),[3,6]);case 3:return s()!==25?[3,5]:(i=`Firefox`,[4,U()]);case 4:return y.sent(),[3,6];case 5:c()?(i=`Internet Explorer`,n(window.indexedDB===void 0)):t(new Error(`detectIncognito cannot determine the browser`)),y.label=6;case 6:return [2]}var P;})})})().catch(t);})];case 1:return [2,r.sent()]}})})}typeof window<`u`&&(window.detectIncognito=$o);var kc=$o,Qs=Ho.A;Ho.k;var Zs=x$2(Et$3()),ea=async()=>{let r={};try{return await Ac(r)}catch(e){return ke$2(e,`device-properties`),r}},Ac=async r=>{let e=window.CooeeSDK.uaParser;Oc(r),Lc(r),Nc(r),r.referrer=document.referrer,r.host=location.origin,r.path=location.pathname,r.qs=location.search,r.locale=navigator.language,r.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:Mc()},r.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(r.headless=true,oo$1({headless:true}));let t=e.getResult();return r.browser=t.browser,r.device=t.device,r.engine=t.engine,r.cpu=t.cpu,r.os=t.os,r.navigatorUA=navigator.userAgent,await Promise.all([Bc(r),Uc(r),Vc(r)]),r},Oc=r=>{let e=navigator;if(!e.deviceMemory)return;r.mem={tot:e.deviceMemory*1024};},Lc=r=>{let e=navigator,t=e.connection||e.mozConnection||e.webkitConnection;t?.effectiveType&&(r.net={type:t.effectiveType});},Nc=r=>{let e=screen.orientation?.type;e&&(r.orientation=e);},Mc=()=>{if(!document.body)return;let r=document.createElement(`div`);r.setAttribute(`style`,`height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;`),document.body.appendChild(r);let e=window.devicePixelRatio||1,t=r.offsetWidth*e;return document.body.removeChild(r),t},Uc=async r=>{try{await Fc(r);}catch(e){Y$1.error(`Unable to get location`,e);}},Fc=async r=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:`geolocation`})).state!=`granted`))return new Promise(t=>{navigator.geolocation.getCurrentPosition(i=>{r.coords=[i.coords.latitude,i.coords.longitude],t();},()=>t());})},Bc=async r=>{if(`getBattery`in navigator)try{let t=await navigator.getBattery();r.bat={l:t.level*100,c:t.charging},oo$1({"battery.level":r.bat.l,"battery.charging":r.bat.c});}catch{}},Vc=async r=>{try{(await Qs())?.isPrivate&&(r.incognito=!0,oo$1({incognito:!0}));}catch(e){Zs.default.error(`Unable to detect private/incognito window`,e);}};function ra(r){if(!ia())return;let e=Ye$2[r]?.toLowerCase();e&&(Y$1.verbose(`Sending ${e} intent to MS Clarity`),window.clarity(`set`,`Cooee Intent`,e));}function ia(){return window.clarity&&typeof window.clarity==`function`}var le=new gr$1(1),na=`App ID or Shopify shop is not set`,qo=``,Je=``,Go=``,Xi;async function zs(r){qo=r.appID,Go=r.shopifyShop;try{await Wc(),le.next(!0),le.complete();}catch(e){e?.message?.includes(na)&&ke$2(e,`initiate-session`,{extra:r}),Y$1.error(`Unable to initiate session`,e);}}async function zn(){return await sa(false),Xi}async function Ks(){let r=Date.now();await fi.request(`gen_did`,async()=>{Je=await fe$4.get(`did`),Je||(Je=new $$1().toHexString(),await fe$4.set(`did`,Je)),Y$1.info(`Device ID:`,Je),ca(Je);}),Y$1.info(`Device ID set/get done ${Qr$3(Date.now()-r)}`);}async function oa(){if(Xi)return;let[r,e,t]=await Promise.all([ve$2.get(`id`,``),fe$4.get(`sessionNumber`,1),ve$2.get(`landing`,{})]);aa(r,e,t);}async function Wc(){await sa(true);}async function sa(r){let e=false;return await $c()?(await Hc(),e=true):await qc()?(await oa(),e=true):await oa(),e?await jc():r&&Wt(),e}async function Hc(){Y$1.info(`Starting new session`),await ve$2.clear();let r=new Date,e=new $$1().toHexString(),t=await fe$4.get(`sessionNumber`,0)+1,i=Ci();await Promise.all([fe$4.set(`sessionNumber`,t),ve$2.set(`id`,e),ve$2.set(`lastUsedTime`,r.getTime()),ve$2.set(`landing`,i)]),aa(e,t,i);}async function $c(){let r=await ve$2.get(`lastUsedTime`,0);return r?(new Date().getTime()-r)/1e3>1800:true}async function qc(){return !await ve$2.get(`synced`,false)}async function Gc(){if(!qo&&!Go)throw new Error(na);let r$11=await ea(),e=bi();return s(r(r({deviceID:Je,deviceProps:r$11,appID:qo,shopifyShop:Go},Xi),e),{sdk:Hr$3,ad:Ki.getAdParams(),occurred:Kc(Be$3().jsLoadTime),properties:{},uuid:await fe$4.get(`uuid`)})}async function jc(){Y$1.info(`Ensuring session on server`),await zc();let r=Date.now(),e=await Gc();Y$1.info(`Session data generated ${Qr$3(Date.now()-r)}`);let t=Bn$1(`/v1/event/validate-session`,D.globalRef.apiURLs?.baseURL??`https://cdn.sdk-api1.letscooee.com`);try{let i=await me(t,e);if(Y$1.info(`Auth finished ${Qr$3(i.timeTakenMs)}`),await ve$2.set(`synced`,!0),i.data.deviceID&&(await fe$4.set(`did`,Je),ca(i.data.deviceID)),i.data.pageWidgets?.length)lr(i.data.pageWidgets.map(n=>new j(n)));if(i.data.cartWidgets?.length)cr(i.data.cartWidgets.map(n=>new j(n)));}catch(i){throw Y$1.error(i),i}}async function zc(){let r=await fe$4.get(`firstSeen`),e=r?new Date(r):new Date;r||await fe$4.set(`firstSeen`,e.toISOString()),Jn(e),no$1(`Visitor Info`,{first_seen:e.toISOString()});}function aa(r,e,t){oo$1({"cooee_session.number":e}),no$1(`Visitor Session`,{id:r,number:e,landing_page:t}),Y$1.info(`Session number: ${e}, id: ${r}`),Xi={sessionID:r,sessionNumber:e,landingPage:t};}function ca(r){Yn(r);no$1(`Visitor Info`,{device_id:r,[`device_id_${Math.floor(Math.random()*1e4)}`]:r}),ro({id:r});}function Kc(r){return (new Date().getTime()-r.getTime())/1e3>1800?new Date:r}var Yi=class{triggerData;render(e){e.contentSource===Be$2.KLAVIYO&&(this.triggerData=e,window.addEventListener(`klaviyoForms`,this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push([`openForm`,e.klaviyoFormID]));}handleKlaviyoEvents(e){if(e.type!==`klaviyoForms`)return;let t=e.detail;if(t.formId!==this.triggerData.klaviyoFormID){Y$1.warn(`Received invalid trigger callback`);return}switch(t.type){case `open`:fe(new Ir$1(`CE Trigger Displayed`,{form:{id:t.formId}},this.triggerData));break;case `stepSubmit`:{let i=this.getFormDetails(t);fe(new Ir$1(`CE Form Submitted`,{form:i},this.triggerData)),_t(i);break}case `close`:window.removeEventListener(`klaviyoForms`,this.handleKlaviyoEvents.bind(this)),fe(new Ir$1(`CE Trigger Closed`,{form:{id:t.formId}},this.triggerData));break}}getFormDetails(e){let t={id:e.formId},i=e.metaData;if(pe$4.hasKeys(i)){let o=[`email`,`phone_number`,`first_name`,`last_name`,`$email`,`$phone_number`,`$first_name`,`$last_name`];Object.keys(i).forEach(c=>{o.includes(c)||(t[c]=i[c]);}),t.email=i.$email??i.email,t.mobile=i.$phone_number??i.phone_number;let n=i.$first_name??i.first_name,s=i.$last_name??i.last_name;(n?.length||s?.length)&&(t.name=n+` `+s);}return t}};function la(r){if(!Xc()||!he$3.get().pixelPush)return;let t=Ye$2[r.intent]?.toLowerCase();t&&(Y$1.verbose(`Sending ${t} intent to Facebook Pixel`),window.fbq(`trackCustom`,`CooeeIntent`,{intent_value:t}));}function Xc(){return window.fbq&&typeof window.fbq==`function`}var fo=`/v1/event/track-page-unload`;function K(r){Y$1.verbose(`Waiting for auth to send event ${r.name}`),le$1(le).then(()=>fe(r));}function Hs(r){le$1(le).then(()=>{Yc(r);});}async function Yc(r){let e=Be$3().currentPageViewEvent;if(!e){Y$1.warn(`No page view event was stored previously`);return}let t={pageViewEventID:e.id,pageViewEventName:e.name,pageActiveTimeMS:r};Y$1.verbose(`Sending page unload`,t);let i=Bn$1(fo,D.globalRef.apiURLs?.eventURL);try{await me(i,t);}catch(o){throw Y$1.error(`Error sending page unload for ${e} to server`,o),o}}function fe(r){Jc(r);}async function Jc(r){if(Y$1.verbose(`Sending event: ${r.name}`,r),il(r)){Y$1.warn(`Rejecting event ${r.name}`);return}Ln();let e=await qe();Object.assign(r,e),Ws(),ve$2.set(`lastUsedTime`,new Date().getTime());let t=rl(r.name),o=Bn$1(`/v1/event/track/${t.toLowerCase().replace(/\s+/g,`-`)}`,D.globalRef.apiURLs?.eventURL);try{let n=await me(o,r);Y$1.info(`Event tracked:`,t),Qc(r)&&(Be$3().currentPageViewEvent={id:r.id,name:r.name}),Zc(r,n.data);}catch(n){throw Y$1.error(`Error sending event ${r.name} to server`,n),n}}function Qc(r){return Kr$3.includes(r.name)?r.name===`View Cart`?!r.properties.drawer:true:false}function Zc(r,e){el(r,e).catch(t=>{ke$2(t,`process-popup-response`,{extra:{event:r,response:e}});}),tl(e);}async function el(r,e){if(!e.triggerData)return;let t=new j(e.triggerData);t.occurred=r.occurred,Y$1.log(`${t} will be shown`);let i;try{i=await wi(t);}catch(n){Y$1.error(`Failed to refresh the products`,n);return}if(t.items=i,t.contentSource===Be$2.KLAVIYO){new Yi().render(t);return}new(await(import('./renderer-CQIvegw_-BzUvQegY.js'))).FreeformRenderer().renderEngagement(t).catch(n=>{ke$2(n,`render-popup`,{extra:{event:r},engagementTrigger:t});});}function tl(r){r.intent&&(ra(r.intent),la(r),Y$1.info(`Intent is ${Ye$2[r.intent]}`));}function rl(r){return r.replace(`CE `,``).replace(`Trigger`,`Campaign`).replace(`Screen`,`Page`).replace(`App `,``)}function il(r){return r.trigger?.triggerID===`test`||r.trigger?.triggerID===`preview`?(Y$1.warn(`Not sending event as this is a test trigger`),true):false}
77
+ .lc-display-inline {display: inline !important;}`,document.body);}execute(e){for(let t of e){if(!t.experimentConfig)continue;this.executeExperiment(t)&&this.trackExperimentRan(t);}if(document.querySelector(`#lc-hide-body`)?.remove(),!document.body){Zn$1(`No body element found`,`error`);return}this.setupMutationObserver();}executeExperiment(e){let t=e.experimentConfig?.modifications;if(!t?.length)return Y$1.log(`Nothing to experiment`,e.toString()),true;let i=false;for(let o of t){if(!o.cssSelector){Y$1.verbose(`No CSS Selector available`,e?.toString());continue}this.modifications.push(o);let n=Array.from(document.querySelectorAll(o.cssSelector));n?.length&&(this.executeSingleModification(o,n),i=true);}return i}executeSingleModification(e,t){if(t?.length)for(let i of t)Object.assign(i.style,e.style),e.display===`HIDE`?i.classList.add(`lc-hide`):e.display===`BLOCK`?i.classList.add(`lc-display-block`):e.display===`INLINE`&&i.classList.add(`lc-display-inline`),e.type===`TEXT`&&e.text?i.innerHTML=e.text:e.type===`IMAGE`&&this.updateImage(e,i),e.moveTo?.selector&&this.changePlacement(e,i).catch(console.error);}async changePlacement(e,t){let i=await Ln$1(e.moveTo.selector);if(i)switch(e.moveTo.position){case Ve$3.BEFORE1:t.nextElementSibling!==i&&i.parentElement?.insertBefore(t,i);break;case Ve$3.INSIDE_FIRST1:i.firstChild!==t&&i.insertBefore(t,i.firstChild);break;case Ve$3.INSIDE_LAST1:i.lastChild!==t&&i.appendChild(t);break;case Ve$3.AFTER1:default:t.previousElementSibling!==i&&i.parentElement?.insertBefore(t,i.nextSibling);}}trackExperimentRan(e){if(e.id===`preview`){Y$1.warn(`Skipping experiment attribution as its preview`,e.toString());return}Os({name:`CE Experiment Start`,experiment:new mt$1(e)}).catch(t=>{Y$1.error(`Fail to track experiment`,t);});}setupMutationObserver(){new MutationObserver(t=>{t.forEach(i=>{i.addedNodes.forEach(o=>{o instanceof HTMLElement&&this.modifications.forEach(n=>{if(o.matches&&o.matches(n.cssSelector))Y$1.verbose(`1. Re-applying experiment`,n.toString()),this.executeSingleModification(n,[o]);else if(o.querySelectorAll){let s=Array.from(o.querySelectorAll(n.cssSelector));if(!s.length)return;Y$1.verbose(`2. Re-applying experiment`,n.toString()),this.executeSingleModification(n,s);}});});});}).observe(document.body,{childList:true,subtree:true});}updateImage(e,t){let i=e.image?.lg?.src,o=e.image?.sm?.src;!i&&!o||(t instanceof HTMLPictureElement?this.updatePictureElement({desktop:i,mobile:o},t):this.updateImageElement({desktop:i,mobile:o},t));}updateImageElement(e,t){M$1()&&e.mobile?(t.setAttribute(`src`,e.mobile),t.removeAttribute(`srcset`)):e.desktop&&(t.setAttribute(`src`,e.desktop),t.removeAttribute(`srcset`));}updatePictureElement(e,t){if(t.innerHTML=``,e.mobile){let o=document.createElement(`source`);o.srcset=e.mobile,o.media=`(max-width: 767px)`,t.append(o);}if(e.desktop){let o=document.createElement(`source`);o.srcset=e.desktop,o.media=`(min-width: 768px)`,t.append(o);}let i=document.createElement(`img`);i.src=e.desktop??e.mobile??``,t.append(i);}};async function Os(r$10){let e=await $e();await me(`/v1/event/experiment`,r(r({},r$10),e));}function qi(){mc().catch(r=>ke$2(r,`fetch-experiments`));}async function mc(){Be$3().activeExperiments&&(await le$1(le),await pc());}async function pc(){Y$1.info(`Fetch experiments after ⏰`,en()+` of SDK load`);me(`/v1/engagement/experiments`,r({},await $e())).then(async t=>{Y$1.info(`Experiments fetched ${Jr$3(t.timeTakenMs)}`);let i=t.data.experiments.map(o=>new j(o));new $i().execute(i);}).catch(t=>{Y$1.error(`Error sending experiment getter`,t);});}function Ls(){let r=he$3.get();!r.gaMeasurementID||!r.gaEnabled||uc();}async function dc(){let r=await fe$4.get(`gacid`),e=await gc();if(r!==e)return await fe$4.set(`gacid`,e),e}async function uc(){let r=await dc();r&&Yn({gaClientID:r});}async function gc(){let e=he$3.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(t=>{window.gtag(`get`,e,`client_id`,i=>{t(i);});})}async function Ns(r){Y$1.verbose(`Received app configuration`,r),r.currencyCount=r.currencies?.length;let e=D.globalRef.config.update(r);Ls(),V.initialize(),e.website&&(Ui$1(e.website.commonJS),Ce$1(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(Fe$1(10)).subscribe(async({open:t})=>{Y$1.info(`Cart drawer is now`,t?`open`:`closed`),t&&(ms(),await fc());});}function Ms(r){D.globalRef.apiURLs=r;}async function fc(){let r=await E.getCurrent().getNormalisedCart(),e={value:r.amount,currency:r.currency};K(new Ir$1(`View Cart`,{items:r.items,amount:e,drawer:true}));}var Gi=class{runtimeData=Be$3();meddle(){let e=D.globalRef;e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods();}exposeMethods(){let e=D.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{Vt();},e.loadExperiments=()=>{qi();},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=D.previewWidget.bind(D),e.previewPopup=D.previewPopup.bind(D),e.executeCTA=(t,i)=>{new Re(t).execute(i);},e.sendEvent=t=>{K(t);};}overwritePush(e,t){Pn(e,`push`,t);}meddleEvents(){this.overwritePush(D.globalRef.events,(...e)=>{this.processEvent(e[0]);}),D.globalRef.events.forEach(this.processEvent.bind(this));}meddleProfile(){this.overwritePush(D.globalRef.profile,(...e)=>{this.processProfile(e[0]);}),D.globalRef.profile.forEach(this.processProfile.bind(this));}processEvent(e){e&&(zr$3.includes(e[0])?D.sendEvent(e[0],e[1],r({occurred:this.runtimeData.jsLoadTime},e[2])):D.sendEvent(e[0],e[1],e[2]));}processProfile(e){e&&D.updateProfile(e);}meddlePage(){this.overwritePush(D.globalRef.page,(...e)=>{this.processPage(e[0]);}),D.globalRef.page.forEach(this.processPage.bind(this));}processPage(e){e.appID&&D.authenticate(e),e.currentItem&&hc(e.currentItem),e.currency&&(Be$3().currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&D.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&E.getCurrent().update(e.cart),e.configurations&&Ns(e.configurations),e.apiURLs&&Ms(e.apiURLs),e.customContext&&(this.runtimeData.customContext=r(r({},this.runtimeData.customContext),e.customContext));}async testCartUpdate(){if(Be$3().pageName!==`product`){window.alert(`This feature is only available on a product page`);return}let e=ss();if(e||(e=Be$3().currentItem?.vID),!e){window.alert(`Could not find a variant to test. Please try a different product page`);return}let t=new j({id:`preview`,shortID:`1`,redirectBehaviour:Me$1.CART_DRAWER});await new Re(new Fe(new Date,t)).execute({clickAction:{at:He$3.ADD_TO_CART},embeddedItem:new et({vID:e})});}};function hc(r){let e=Be$3();if(e.currentItem&&e.currentItem.vID!==r.vID){let t=new CustomEvent(`letscooee:variant-change`,{detail:{variantID:r.vID,productID:r.mID}});document.dispatchEvent(t);}e.currentItem=new et(r);}var Wt=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=`cooee`.concat(`-`);static getString(e,t){return this.getItem(e)||t}static setString(e,t){this.setItem(e,t);}static remove(e){this.removeItem(e);}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,t){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),t);}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e));}};var wc=1e3,vc=10,Bo=0,Vo=new Date;function Wo(r){Wt.remove(`sleid`),Vo=r??new Date;}function Us(){if(window.scrollY){let r=Vs();Fs(r)&&Bs(r);}ht$2(()=>{bc();});}function bc(){Tr(window,`scroll`).pipe(Fe$1(wc),q$1(()=>{let r=Vs();if(r>100){Y$1.warn(`Received scroll percent is more than 100`,r);return}if(Fs(r))return r})).subscribe(r=>{Bs(r);});}function Fs(r){return Math.abs(Bo-r)>=vc||Bo!==r&&r===100}function Bs(r){if(r==null)return;let e={percent:r,timeMS:new Date().getTime()-Vo.getTime()};Bo=r;let i=new Ir$1(`CE Scroll`,e,null,Wt.getString(`sleid`,``));K(i),Wt.setString(`sleid`,i.id.toHexString()),Vo=new Date(i.occurred);}function Vs(){let r=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/r*100)}function Ws(){document.onvisibilitychange=()=>{document.visibilityState===`visible`?Cc():document.visibilityState===`hidden`&&yc();};}async function Cc(){}async function yc(){let r=await Ec();if(r===0){Y$1.info(`Not sending duration as user was inactive on website`);return}$s(r);}async function Ec(){let r=Be$3();return r.inInactive?0:(r.inInactive=true,r.lastEnterInactive=new Date,Math.max(r.lastEnterInactive.getTime()-r.lastEnterActive.getTime(),0))}function Hs(){let r=Be$3();return r.inInactive?(r.inInactive=false,r.lastEnterActive=new Date,Math.max((r.lastEnterActive.getTime()-r.lastEnterInactive.getTime())/1e3,0)):0}function qs(){Sc();}function Sc(){let r=window.fetch;try{window.fetch=async function(e,t){try{await Ic(e,t);}catch(i){ke$2(i,`modify-graphql-request`,{extra:{body:JSON.stringify(t?.body)}});}return r(e,t)};}catch(e){console.warn(`Fail to override fetch.`,`Cooee won't be able to track "Buy Now Clicked" KPI.`),Y$1.error(e);}Y$1.verbose(`Securely overwritten window.fetch method for graphql query`);}async function Ic(r,e){let t=typeof r==`string`?r:r instanceof Request?r.url:``;if(!(t.includes(`graphql.json`)&&e?.method===`POST`)||!e.body)return;let i;if(typeof e.body==`string`)try{i=JSON.parse(e.body);}catch{return}else i=e.body;i?.variables?.input&&(Y$1.verbose(`Intercepted fetch request of:`,t),i?.query.includes(`cartCreate`)&&(e.body=await Tc(i),xc()));}async function Tc(r){let e=r.variables.input.attributes??[],t=await On$1(`Buy Now`);return r.variables.input.attributes=[...e,...t],JSON.stringify(r)}function xc(){let r=Be$3().currentItem;if(!r)return;K(new Ir$1(`Buy Now Clicked`,{items:[r]}));}var Ht=class{constructor(e,t){this.selectors=e;this.eventName=t;this.selectorString=e.join(`,`);}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let t=e.currentTarget;K(new Ir$1(this.eventName,{class:t.className||void 0,tagName:t.tagName||void 0,id:t.id||void 0})),this.removeClickListener(this.clickListenerCallback);};listenSilently(){this.listen().catch(e=>Y$1.error(e));}async listen(){this.elements=await Ar$1(this.selectorString),this.elements.forEach(e=>{e.addEventListener(`click`,this.clickListenerCallback);});}removeClickListener(e){this.elements?.forEach(t=>{t.removeEventListener(`click`,e);});}};var ji=class r extends Ht{static selectors=[`.product__thumbnail-list-inner > button`,`product-gallery-navigation > button`,`.product-media--thumb-container`,`.product-images-inner > img`,`.m-product-media`,`.swiper-button-control`,`.media__thumb`,`.slick-arrow`,`.productView-img-container.product-single__media`,`.product-gallery__thumbnail_item_inner`];constructor(){super(r.selectors,`Item Thumbnail Clicked`);}static getInstance(){return this.INSTANCE||(this.INSTANCE=new r),this.INSTANCE}};var zi=class r extends Ht{static selectors=[`.jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup`,`reviewsio-product-ratings`,`.ruk_rating_snippet.tracked:not(.hidden)`,`a > .loox-rating`,`.yotpo-reviews-star-ratings-widget`,`.yotpo.lp-hero__reviews`,`.pr-rating > a`,`.rivyoReviewWidget`];constructor(){super(r.selectors,`Review Clicked`);}static getInstance(){return this.INSTANCE||(this.INSTANCE=new r),this.INSTANCE}};var Dc=[`.gokwik-checkout button`,`button.cart__checkout-button`,`button.cart__checkout`,`button#checkout`,`button#checkout2`,`button[id*="checkout" i]`,`button[name*="checkout" i]`,`button[class*="checkout" i]`].join(`,`);function Gs(){ht$2(()=>{Y$1.verbose(`Execution order:`,`document ready`),Pc();});}function Pc(){let r=window.location.hash?.substring(1);if(r)if(r.includes(`initiate-checkout`)){document.dispatchEvent(new Event(`letscooee:outbound:third-party-initiate-checkout`));let e=document.querySelector(Dc);if(!e){Y$1.verbose(`No clickable cart checkout button found`);return}Y$1.verbose(`Clickable cart checkout button found`,e),e.click();}else r.includes(`open-cart-drawer`)&&V.get().open();}function zs(){window.addEventListener(`kp-modal:opened`,()=>{Be$3().isGoKwikPopupOpen=true;}),window.addEventListener(`user-loggedin`,r=>{let{token:e}=r.detail;e&&Rt({goKwikToken:e});}),window.gokwikSdk?js():window.addEventListener(`gokwikLoaded`,js);}function js(){window.gokwikSdk&&window.gokwikSdk.on(`checkout_initiated`,async()=>{let r=await E.getCurrent().getNormalisedCart();K(new Ir$1(`Checkout Started`,{via:`GoKwik`,items:r.items,cartToken:r.token,amount:{value:r.amount,currency:r.currency}}));});}var D=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(!window.cooeeSDKPreview){if(Y$1.info(`Initialising SDK`),gs(navigator.userAgent)){Y$1.info(`This seems to be a bot. Disabling SDK`);return}this.initGlobalReference(e),await Xs(),this.autoAuthenticate(),new Gi().meddle(),zn(),qi(),Rc(),Ws(),Hn(),qs(),Gs(),Us(),zi.getInstance().listenSilently(),ji.getInstance().listenSilently(),zs(),_c(),Gn$1(),po(),Ai.remove(`conf`).catch(t=>{Y$1.error(`Fail to remove App Config from local storage`,t);});}}static initGlobalReference(e){window.CooeeSDK||Pn(window,`CooeeSDK`,{}),this.globalRef=window.CooeeSDK,Pn(this.globalRef,`config`,new he$3),Pn(this.globalRef,`runtimeData`,{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Pn(this.globalRef,`uaParser`,new we,true),Pn(this.globalRef,`cart`,E.getCurrent()),Pn(this.globalRef,`cartChange$`,Wn()),Pn(this.globalRef,`cartDrawerToggle$`,V.cartDrawerToggle$.asObservable()),Y$1.verbose(`Global reference initialised`),new le$3(()=>{this.globalRef.uaParser=new we;});}static autoAuthenticate(){let e=Xr();e&&this.authenticate({shopifyShop:e});}static authenticate(e){if(this.authenticated)return;Y$1.info(`Begin auth after ⏰`,en(),`of SDK load`);let t=e.appID?.trim(),i=e.shopifyShop;if((Rn(t)||t.length!==24)&&Rn(i)){Y$1.warn(`Cooee App ID or Shop name is not configured`);return}this.authenticated=true,Ks(e);}static sendEvent(e,t,i){let o=new Ir$1(e,t,i?.triggerData);i?.occurred&&(o.occurred=i.occurred),K(o);}static updateProfile(e){for(let t in e)if(t.toLowerCase().startsWith(`ce `))throw new Error(`User property name cannot start with 'CE '`);Rt(e);}static setPageName(e){if(!e)return;let t=Be$3(),i=t.pageName;if(e===i)return;if(t.pageName=e,Yr$3.some(s=>e.includes(s))){Wo();return}let o={};i&&(o.ps=i);let n=new Ir$1(`CE Screen View`,o);n.occurred=t.jsLoadTime,K(n),Wo(n.occurred);}static previewPopup(e,t){import('./renderer-BpHcv0Tu-BjlOyaqx.js').then(({FreeformRenderer:i})=>{new i(t).render(e);});}static previewWidget(e){new X(new j(e)).renderSilently();}};function Rc(){window.CooeeSDK.cartChange$.subscribe(()=>{Vt();});}function _c(){if(window.opener){try{window.opener.postMessage({action:`COOEE_READY_FOR_PREVIEW`},`*`);}catch(r){Y$1.error(r);}window.addEventListener(`message`,r=>{if(Y$1.verbose(`Received event`,r),!r.origin.includes(`letscooee.com`)&&!r.origin.includes(`localhost`))return;let e=r.data;typeof e==`object`&&(e.action===`POPUP_PREVIEW`?(D.previewPopup(e.engagementTrigger),r.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},r.origin)):e.action===`WIDGET_PREVIEW`&&(D.previewWidget(e.engagementTrigger),r.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},r.origin)));});}}var Js=new U,Ys=0;Js.pipe(Fe$1(50)).subscribe(async r=>{kc(await $e()).catch(t=>{ke$2(t,`load-page-widgets`,{extra:{firstLoad:r}});});});function Vt(r=false){le$1(le).then(()=>{Js.next(r);});}async function as(r){let e=await $e();return Object.assign(r,e),me(`/v1/engagement/get-variant`,r)}async function kc(r$11){Ys++,Ys===1?Y$1.info(`Fetch widgets (after ⏰`,en()+` of SDK load)`):Y$1.info(`Fetch widgets`);let e=r({},r$11),t=Vn$1(`/v1/engagement/eligible`,D.globalRef.apiURLs?.engagementsURL);try{let i=await me(t,e);if(Y$1.info(`Widgets fetched ${Jr$3(i.timeTakenMs)}`),i.data.pageWidgets?.length)cr(i.data.pageWidgets.map(n=>new j(n)));if(i.data.cartWidgets?.length)ar(i.data.cartWidgets.map(n=>new j(n)));}catch(i){Y$1.error(`Error sending widget getter`,i);}}var Qs=x$2(dr$2()),Ki=class r{static META_REQUIRED_FIELDS=[`ad_id`];static GOOGLE_REQUIRED_FIELDS=[`gad_source`,`gclid`];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source;}static getAdParams(){let e;try{e=new Qs.URLBuilder(location.href);}catch{return {}}let t={};if(this.META_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return t={source:`META`,adID:e.getQueryParam(`ad_id`)?.trim(),campaignID:e.getQueryParam(`campaign_id`)?.trim()},new r(t);if(this.GOOGLE_REQUIRED_FIELDS.every(n=>Array.from(e.getParams().keys()).includes(n)))return t={source:`GOOGLE`},new r(t)}};var Ho={d:(r,e)=>{for(var t in e)Ho.o(e,t)&&!Ho.o(r,t)&&Object.defineProperty(r,t,{enumerable:true,get:e[t]});},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e)},$o={};Ho.d($o,{A:()=>Ac,k:()=>qo});var Cr=function(r,e,t,i){return new(t||(t=Promise))(function(o,n){function s(C){try{m(i.next(C));}catch(w){n(w);}}function c(C){try{m(i.throw(C));}catch(w){n(w);}}function m(C){var w;C.done?o(C.value):(w=C.value,w instanceof t?w:new t(function(O){O(w);})).then(s,c);}m((i=i.apply(r,[])).next());})},yr=function(r,e){var t,i,o,n,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return n={next:c(0),throw:c(1),return:c(2)},typeof Symbol==`function`&&(n[Symbol.iterator]=function(){return this}),n;function c(m){return function(C){return (function(w){if(t)throw new TypeError(`Generator is already executing.`);for(;n&&(n=0,w[0]&&(s=0)),s;)try{if(t=1,i&&(o=2&w[0]?i.return:w[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,w[1])).done)return o;switch(i=0,o&&(w=[2&w[0],o.value]),w[0]){case 0:case 1:o=w;break;case 4:return s.label++,{value:w[1],done:!1};case 5:s.label++,i=w[1],w=[0];continue;case 7:w=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!((o=o.length>0&&o[o.length-1])||w[0]!==6&&w[0]!==2)){s=0;continue}if(w[0]===3&&(!o||w[1]>o[0]&&w[1]<o[3])){s.label=w[1];break}if(w[0]===6&&s.label<o[1]){s.label=o[1],o=w;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(w);break}o[2]&&s.ops.pop(),s.trys.pop();continue}w=e.call(r,s);}catch(O){w=[6,O],i=0;}finally{t=o=0;}if(5&w[0])throw w[1];return {value:w[0]?w[1]:void 0,done:true}})([m,C])}}};function qo(){return Cr(this,void 0,Promise,function(){return yr(this,function(r){switch(r.label){case 0:return [4,new Promise(function(e,t){var i=`Unknown`,o=false;function n(y){o||(o=true,e({isPrivate:y,browserName:i}));}function s(){var y=0,P=parseInt(`-1`);try{P.toFixed(P);}catch(x){y=x.message.length;}return y}function c(){return navigator.msSaveBlob!==void 0&&(function(y){try{return y===eval.toString().length}catch{return false}})(39)}function m(){var y;return Cr(this,void 0,void 0,function(){var P,x;return yr(this,function(v){switch(v.label){case 0:return v.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return v.sent(),n(false),[3,3];case 2:return P=v.sent(),x=P,P instanceof Error&&(x=(y=P.message)!==null&&y!==void 0?y:P),typeof x!=`string`?(n(false),[2]):(n(!!x.includes(`unknown transient reason`)),[3,3]);case 3:return [2]}})})}function C(){var y;return Cr(this,void 0,Promise,function(){return yr(this,function(P){switch(P.label){case 0:return ((y=navigator.storage)===null||y===void 0?void 0:y.getDirectory)===void 0?[3,2]:[4,m()];case 1:return P.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var x=String(Math.random());try{var v=indexedDB.open(x,1);v.onupgradeneeded=function(L){var A=L.target.result,b=function(Je){n(Je);};try{A.createObjectStore(`t`,{autoIncrement:!0}).put(new Blob),b(!1);}catch(Je){(Je.message||``).includes(`are not yet supported`)?b(!0):b(!1);}finally{A.close(),indexedDB.deleteDatabase(x);}},v.onerror=function(){return n(!1)};}catch{n(false);}})():(function(){var x=window.openDatabase,v=window.localStorage;try{x(null,null,null,null);}catch{n(true);return}try{v.setItem(`test`,`1`),v.removeItem(`test`);}catch{n(true);return}n(false);})(),P.label=3;case 3:return [2]}})})}function w(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(y,P){var x;n(Math.round(P/1048576)<2*Math.round(((x=window).performance!==void 0&&x.performance.memory!==void 0&&x.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576));},function(y){t(new Error(`detectIncognito somehow failed to query storage quota: `+y.message));});}function O(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?w():(0, window.webkitRequestFileSystem)(0,1,function(){n(false);},function(){n(true);});}function F(){return Cr(this,void 0,Promise,function(){var y,P;return yr(this,function(x){switch(x.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return [3,4];x.label=1;case 1:return x.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return x.sent(),n(false),[3,4];case 3:return y=x.sent(),typeof(P=y instanceof Error&&typeof y.message==`string`?y.message:String(y))!=`string`?(n(false),[2]):(n(P.includes(`Security error`)),[2]);case 4:return n(navigator.serviceWorker===void 0),[2]}})})}(function(){return Cr(this,void 0,Promise,function(){return yr(this,function(y){switch(y.label){case 0:return s()!==44?[3,2]:(i=`Safari`,[4,C()]);case 1:return y.sent(),[3,6];case 2:return s()!==51?[3,3]:(P=navigator.userAgent,i=P.match(/Chrome/)?navigator.brave!==void 0?`Brave`:P.match(/Edg/)?`Edge`:P.match(/OPR/)?`Opera`:`Chrome`:`Chromium`,O(),[3,6]);case 3:return s()!==25?[3,5]:(i=`Firefox`,[4,F()]);case 4:return y.sent(),[3,6];case 5:c()?(i=`Internet Explorer`,n(window.indexedDB===void 0)):t(new Error(`detectIncognito cannot determine the browser`)),y.label=6;case 6:return [2]}var P;})})})().catch(t);})];case 1:return [2,r.sent()]}})})}typeof window<`u`&&(window.detectIncognito=qo);var Ac=qo,Zs=$o.A;$o.k;var ea=x$2(yt$1()),ta=async()=>{let r={};try{return await Oc(r)}catch(e){return ke$2(e,`device-properties`),r}},Oc=async r=>{let e=window.CooeeSDK.uaParser;Lc(r),Nc(r),Mc(r),r.referrer=document.referrer,r.host=location.origin,r.path=location.pathname,r.qs=location.search,r.locale=navigator.language,r.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:Uc()},r.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(r.headless=true,ro({headless:true}));let t=e.getResult();return r.browser=t.browser,r.device=t.device,r.engine=t.engine,r.cpu=t.cpu,r.os=t.os,r.navigatorUA=navigator.userAgent,await Promise.all([Vc(r),Fc(r),Wc(r)]),r},Lc=r=>{let e=navigator;if(!e.deviceMemory)return;r.mem={tot:e.deviceMemory*1024};},Nc=r=>{let e=navigator,t=e.connection||e.mozConnection||e.webkitConnection;t?.effectiveType&&(r.net={type:t.effectiveType});},Mc=r=>{let e=screen.orientation?.type;e&&(r.orientation=e);},Uc=()=>{if(!document.body)return;let r=document.createElement(`div`);r.setAttribute(`style`,`height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;`),document.body.appendChild(r);let e=window.devicePixelRatio||1,t=r.offsetWidth*e;return document.body.removeChild(r),t},Fc=async r=>{try{await Bc(r);}catch(e){Y$1.error(`Unable to get location`,e);}},Bc=async r=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:`geolocation`})).state!=`granted`))return new Promise(t=>{navigator.geolocation.getCurrentPosition(i=>{r.coords=[i.coords.latitude,i.coords.longitude],t();},()=>t());})},Vc=async r=>{if(`getBattery`in navigator)try{let t=await navigator.getBattery();r.bat={l:t.level*100,c:t.charging},ro({"battery.level":r.bat.l,"battery.charging":r.bat.c});}catch{}},Wc=async r=>{try{(await Zs())?.isPrivate&&(r.incognito=!0,ro({incognito:!0}));}catch(e){ea.default.error(`Unable to detect private/incognito window`,e);}};function ia(r){if(!oa())return;let e=Ye$2[r]?.toLowerCase();e&&(Y$1.verbose(`Sending ${e} intent to MS Clarity`),window.clarity(`set`,`Cooee Intent`,e));}function oa(){return window.clarity&&typeof window.clarity==`function`}var le=new gr$1(1),sa=`App ID or Shopify shop is not set`,Go=``,Ye=``,jo=``,Xi;async function Ks(r){Go=r.appID,jo=r.shopifyShop;try{await Hc(),le.next(!0),le.complete();}catch(e){e?.message?.includes(sa)&&ke$2(e,`initiate-session`,{extra:r}),Y$1.error(`Unable to initiate session`,e);}}async function Kn(){return await aa(false),Xi}async function Xs(){let r=Date.now();await gi.request(`gen_did`,async()=>{Ye=await fe$4.get(`did`),Ye||(Ye=new $$1().toHexString(),await fe$4.set(`did`,Ye)),Y$1.info(`Device ID:`,Ye),la(Ye);}),Y$1.info(`Device ID set/get done ${Jr$3(Date.now()-r)}`);}async function na(){if(Xi)return;let[r,e,t]=await Promise.all([ve$2.get(`id`,``),fe$4.get(`sessionNumber`,1),ve$2.get(`landing`,{})]);ca(r,e,t);}async function Hc(){await aa(true);}async function aa(r){let e=false;return await qc()?(await $c(),e=true):await Gc()?(await na(),e=true):await na(),e?await zc():r&&Vt(),e}async function $c(){Y$1.info(`Starting new session`),await ve$2.clear();let r=new Date,e=new $$1().toHexString(),t=await fe$4.get(`sessionNumber`,0)+1,i=vi();await Promise.all([fe$4.set(`sessionNumber`,t),ve$2.set(`id`,e),ve$2.set(`lastUsedTime`,r.getTime()),ve$2.set(`landing`,i)]),ca(e,t,i);}async function qc(){let r=await ve$2.get(`lastUsedTime`,0);return r?(new Date().getTime()-r)/1e3>1800:true}async function Gc(){return !await ve$2.get(`synced`,false)}async function jc(){if(!Go&&!jo)throw new Error(sa);let r$12=await ta(),e=bi();return s(r(r({deviceID:Ye,deviceProps:r$12,appID:Go,shopifyShop:jo},Xi),e),{sdk:Gr$3,ad:Ki.getAdParams(),occurred:Xc(Be$3().jsLoadTime),properties:{},uuid:await fe$4.get(`uuid`)})}async function zc(){Y$1.info(`Ensuring session on server`),await Kc();let r=Date.now(),e=await jc();Y$1.info(`Session data generated ${Jr$3(Date.now()-r)}`);let t=Vn$1(`/v1/event/validate-session`,D.globalRef.apiURLs?.baseURL??`https://cdn.sdk-api1.letscooee.com`);try{let i=await me(t,e);if(Y$1.info(`Auth finished ${Jr$3(i.timeTakenMs)}`),await ve$2.set(`synced`,!0),i.data.deviceID&&(await fe$4.set(`did`,Ye),la(i.data.deviceID)),i.data.pageWidgets?.length)cr(i.data.pageWidgets.map(n=>new j(n)));if(i.data.cartWidgets?.length)ar(i.data.cartWidgets.map(n=>new j(n)));}catch(i){throw Y$1.error(i),i}}async function Kc(){let r=await fe$4.get(`firstSeen`),e=r?new Date(r):new Date;r||await fe$4.set(`firstSeen`,e.toISOString()),Qn(e),to(`Visitor Info`,{first_seen:e.toISOString()});}function ca(r,e,t){ro({"cooee_session.number":e}),to(`Visitor Session`,{id:r,number:e,landing_page:t}),Y$1.info(`Session number: ${e}, id: ${r}`),Xi={sessionID:r,sessionNumber:e,landingPage:t};}function la(r){Jn(r);to(`Visitor Info`,{device_id:r,[`device_id_${Math.floor(Math.random()*1e4)}`]:r}),eo({id:r});}function Xc(r){return (new Date().getTime()-r.getTime())/1e3>1800?new Date:r}var Yi=class{triggerData;render(e){e.contentSource===Be$2.KLAVIYO&&(this.triggerData=e,window.addEventListener(`klaviyoForms`,this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push([`openForm`,e.klaviyoFormID]));}handleKlaviyoEvents(e){if(e.type!==`klaviyoForms`)return;let t=e.detail;if(t.formId!==this.triggerData.klaviyoFormID){Y$1.warn(`Received invalid trigger callback`);return}switch(t.type){case `open`:fe(new Ir$1(`CE Trigger Displayed`,{form:{id:t.formId}},this.triggerData));break;case `stepSubmit`:{let i=this.getFormDetails(t);fe(new Ir$1(`CE Form Submitted`,{form:i},this.triggerData)),Rt(i);break}case `close`:window.removeEventListener(`klaviyoForms`,this.handleKlaviyoEvents.bind(this)),fe(new Ir$1(`CE Trigger Closed`,{form:{id:t.formId}},this.triggerData));break}}getFormDetails(e){let t={id:e.formId},i=e.metaData;if(pe$4.hasKeys(i)){let o=[`email`,`phone_number`,`first_name`,`last_name`,`$email`,`$phone_number`,`$first_name`,`$last_name`];Object.keys(i).forEach(c=>{o.includes(c)||(t[c]=i[c]);}),t.email=i.$email??i.email,t.mobile=i.$phone_number??i.phone_number;let n=i.$first_name??i.first_name,s=i.$last_name??i.last_name;(n?.length||s?.length)&&(t.name=n+` `+s);}return t}};function ma(r){if(!Yc()||!he$3.get().pixelPush)return;let t=Ye$2[r.intent]?.toLowerCase();t&&(Y$1.verbose(`Sending ${t} intent to Facebook Pixel`),window.fbq(`trackCustom`,`CooeeIntent`,{intent_value:t}));}function Yc(){return window.fbq&&typeof window.fbq==`function`}var ho=`/v1/event/track-page-unload`;function K(r){Y$1.verbose(`Waiting for auth to send event ${r.name}`),le$1(le).then(()=>fe(r));}function $s(r){le$1(le).then(()=>{Jc(r);});}async function Jc(r){let e=Be$3().currentPageViewEvent;if(!e){Y$1.warn(`No page view event was stored previously`);return}let t={pageViewEventID:e.id,pageViewEventName:e.name,pageActiveTimeMS:r};Y$1.verbose(`Sending page unload`,t);let i=Vn$1(ho,D.globalRef.apiURLs?.eventURL);try{await me(i,t);}catch(o){throw Y$1.error(`Error sending page unload for ${e} to server`,o),o}}function fe(r){Qc(r);}async function Qc(r){if(Y$1.verbose(`Sending event: ${r.name}`,r),ol(r)){Y$1.warn(`Rejecting event ${r.name}`);return}Nn();let e=await $e();Object.assign(r,e),Hs(),ve$2.set(`lastUsedTime`,new Date().getTime());let t=il(r.name),o=Vn$1(`/v1/event/track/${t.toLowerCase().replace(/\s+/g,`-`)}`,D.globalRef.apiURLs?.eventURL);try{let n=await me(o,r);Y$1.info(`Event tracked:`,t),Zc(r)&&(Be$3().currentPageViewEvent={id:r.id,name:r.name}),el(r,n.data);}catch(n){throw Y$1.error(`Error sending event ${r.name} to server`,n),n}}function Zc(r){return qr$3.includes(r.name)?r.name===`View Cart`?!r.properties.drawer:true:false}function el(r,e){tl(r,e).catch(t=>{ke$2(t,`process-popup-response`,{extra:{event:r,response:e}});}),rl(e);}async function tl(r,e){if(!e.triggerData)return;let t=new j(e.triggerData);t.occurred=r.occurred,Y$1.log(`${t} will be shown`);let i;try{i=await hi(t);}catch(n){Y$1.error(`Failed to refresh the products`,n);return}if(t.items=i,t.contentSource===Be$2.KLAVIYO){new Yi().render(t);return}new(await(import('./renderer-BpHcv0Tu-BjlOyaqx.js'))).FreeformRenderer().renderEngagement(t).catch(n=>{ke$2(n,`render-popup`,{extra:{event:r},engagementTrigger:t});});}function rl(r){r.intent&&(ia(r.intent),ma(r),Y$1.info(`Intent is ${Ye$2[r.intent]}`));}function il(r){return r.replace(`CE `,``).replace(`Trigger`,`Campaign`).replace(`Screen`,`Page`).replace(`App `,``)}function ol(r){return r.trigger?.triggerID===`test`||r.trigger?.triggerID===`preview`?(Y$1.warn(`Not sending event as this is a test trigger`),true):false}
78
78
 
79
79
  function a(i){return i?new Date(i).toLocaleString(`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3,hour12:false,timeZoneName:`short`}):`N/A`}function M(){let i=performance.getEntriesByType?.(`resource`);if(i)return i.find(o=>o.name.includes(`@letscooee/web-sdk`)&&o.name.includes(`main.min.js`))}function x(i){window.cooeeSDKPreview||(document.readyState===`complete`?setTimeout(()=>L(i),100):window.addEventListener(`load`,()=>{setTimeout(()=>L(i),100);}));}function L(i){try{N(i),z$3();}catch(o){console.error(`Failed to print debugging logs`,o);}}function N(i){let o=performance.getEntriesByType?.(`navigation`)?.[0],f=window.CooeeSDK?.pageLoadTime,l=M(),s=performance.timeOrigin||0,n=o?.responseEnd?s+o.responseEnd:void 0,d=s,c=o?.domContentLoadedEventEnd||0,m=o?.loadEventEnd||0,u=n&&n>0?n:f?f.getTime():0,T=n&&n>0?`HTML download complete`:`inline script execution`,S=c>0?d+c:void 0,$=m>0?d+m:void 0;Y$1.info(`⏱️ ═══════════════ Performance Timing Report ═══════════════`),Y$1.info(`📅 Absolute Timestamps (Local Time):`),Y$1.info(` Note: Inline script can execute during HTML download (incremental parsing)`),Y$1.info(``),Y$1.info(` 1. Navigation started: ${a(d)}`);let r=f?f.getTime():0;if(n&&n>0&&r?r<n?(Y$1.info(` 2. Inline script executed: ${a(r)} (during HTML parsing)`),Y$1.info(` 3. HTML download complete: ${a(n)}`)):(Y$1.info(` 2. HTML download complete: ${a(n)}`),Y$1.info(` 3. Inline script executed: ${a(r)}`)):n&&n>0?Y$1.info(` 2. HTML download complete: ${a(n)}`):r&&Y$1.info(` 2. Inline script executed: ${a(r)}`),Y$1.info(` 4. SDK module loaded: ${a(i.getTime())} (from CDN)`),S&&Y$1.info(` 5. DOMContentLoaded: ${a(S)}`),$&&Y$1.info(` 6. Page fully loaded: ${a($)}`),Y$1.info(``),Y$1.info(`⏱️ Relative Timings:`),n&&n>0&&d){let g=n-d;Y$1.info(` Shopify backend + HTML download: ${Ve$4(g)} (not Cooee SDK)`);}if(u){let g=i.getTime()-u;if(g<0){let w=r>0?r:d,b=r>0?`inline script execution`:`navigation start`,K=i.getTime()-w;Y$1.info(` SDK module load time: ${Ve$4(K)} after ${b}`),Y$1.info(` (Note: Using earlier baseline because SDK loaded before ${T})`);}else Y$1.info(` SDK module load time: ${Ve$4(g)} after ${T}`),Y$1.info(` (Baseline: ${T} at ${a(u)})`);let v=i.getTime()-d;Y$1.info(` \u{1F3AF} Total SDK load time: ${Ve$4(v)} (from navigation start to SDK ready)`);}c&&c>0&&Y$1.info(` DOMContentLoaded: ${Ve$4(c)} after navigation start`),m&&m>0&&Y$1.info(` Page fully loaded: ${Ve$4(m)} after navigation start`),C(l),Y$1.info(`⏱️ ═══════════════════════════════════════════════════════`);}function C(i){if(!i){Y$1.info(``),Y$1.info(`📦 SDK Resource Metrics: Not available`);return}Y$1.info(``),Y$1.info(`📦 SDK Resource Metrics:`),Y$1.info(` URL: ${i.name}`),Y$1.info(` Download duration: ${Ve$4(i.duration)}`);let o=i.transferSize===0;if(Y$1.info(` Served from: ${o?`💾 Cache (disk/memory)`:`🌐 Network`}`),!o){Y$1.info(` Transfer size: ${d$3(i.transferSize)}`),Y$1.info(` Encoded size: ${d$3(i.encodedBodySize)}`),Y$1.info(` Decoded size: ${d$3(i.decodedBodySize)}`);let f=(1-i.encodedBodySize/i.decodedBodySize)*100;f>0&&Y$1.info(` Compression ratio: ${f.toFixed(1)}%`);}if(i.domainLookupEnd>0){let f=i.domainLookupEnd-i.domainLookupStart,l=i.connectEnd-i.connectStart,s=i.responseStart-i.requestStart,n=i.responseEnd-i.responseStart;Y$1.info(` Timing breakdown:`),f>0&&Y$1.info(` DNS lookup: ${Ve$4(f)}`),l>0&&Y$1.info(` TCP connect: ${Ve$4(l)}`),s>0&&Y$1.info(` Request: ${Ve$4(s)}`),n>0&&Y$1.info(` Response: ${Ve$4(n)}`);}}
80
80
 
81
- var sdkDebugLogsBue3Nk8S = /*#__PURE__*/Object.freeze({
81
+ var sdkDebugLogsUu4p06Kn = /*#__PURE__*/Object.freeze({
82
82
  __proto__: null,
83
83
  printAllDebugLogs: x
84
84
  });
85
85
 
86
- performance.mark(`cooee-sdk-start`);var n=new Date;window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=true,$n$1(),Gn$1(),await D.initForMerchantWebsiteOnly(n),be$2(),performance.measure(`cooee-sdk-init`,`cooee-sdk-start`),Lr$1()&&Promise.resolve().then(function () { return sdkDebugLogsBue3Nk8S; }).then(({printAllDebugLogs:a})=>a(n)));
86
+ performance.mark(`cooee-sdk-start`);var n=new Date;window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=true,Wn$1(),$n$1(),await D.initForMerchantWebsiteOnly(n),be$2(),performance.measure(`cooee-sdk-init`,`cooee-sdk-start`),Nr$2()&&Promise.resolve().then(function () { return sdkDebugLogsUu4p06Kn; }).then(({printAllDebugLogs:a})=>a(n)));
87
87
 
88
- export { $r as $, A, Be as B, Sr as C, m as D, vs$1 as E, ve as F, Gr as G, He$1 as H, Ir$1 as I, pi$1 as J, bi$1 as K, ii$1 as L, M$1 as M, Nn$1 as N, Fs$1 as O, Ps$1 as P, Se$1 as Q, ye$1 as R, S$1 as S, Ce$1 as T, U, Ve$1 as V, Wr as W, Me$1 as X, De as Y, Vi$1 as Z, _e$1 as _, Mi$1 as a, $e$1 as a0, gr$1 as a1, He$2 as a2, qe$1 as a3, Re$1 as a4, Fe$1 as a5, We$1 as a6, Je$1 as a7, Ae$2 as a8, ge$2 as a9, V$1 as b, H$1 as c, d$2 as d, V as e, fe as f, yt as g, jr as h, it as i, j, Gt as k, le$3 as l, mt$1 as m, n$1 as n, nt$1 as o, Ve as p, qr as q, f$1 as r, Br as s, He$3 as t, ue$2 as u, vi as v, yi as w, v as x, ye$3 as y, q$1 as z };
88
+ export { $r as $, A, Be as B, Ct as C, m as D, vs$1 as E, Fe as F, Gr as G, He$1 as H, Ir$1 as I, ve as J, pi$1 as K, bi$1 as L, M$1 as M, Nn$1 as N, ii$1 as O, Fs$1 as P, Ps$1 as Q, Se$1 as R, S$1 as S, ye$1 as T, U, Ve$1 as V, Ce$1 as W, Me$1 as X, De as Y, Vi$1 as Z, _e$1 as _, Mi$1 as a, $e$1 as a0, gr$1 as a1, He$2 as a2, qe$1 as a3, Re$1 as a4, Fe$2 as a5, We$1 as a6, Je as a7, Ae$2 as a8, ge$2 as a9, V$1 as b, H$1 as c, d$2 as d, V as e, fe as f, qt as g, Vr as h, Hr as i, j, nt$1 as k, le$3 as l, mt$1 as m, n$1 as n, f as o, Fr as p, qr as q, rt as r, He$3 as s, yi as t, ue$2 as u, v, wi as w, q$1 as x, ye$3 as y, Sr as z };