@letscooee/web-sdk 13.1.10 → 13.1.12
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/{chunk-LW7ZESZN.js → chunk-6XVC72KV.js} +2 -2
- package/dist/{chunk-VOVXCOBB.js → chunk-CAFWCDWI.js} +1 -1
- package/dist/chunk-HC6OE5XR.js +4 -0
- package/dist/{chunk-Y3BMMUFH.js → chunk-ILIYCRW5.js} +1 -1
- package/dist/{chunk-2AHALCF3.js → chunk-KWG3YKM4.js} +1 -1
- package/dist/chunk-NOZTSVSX.js +8 -0
- package/dist/chunk-RF2WNRIW.js +39 -0
- package/dist/chunk-WQK746ER.js +1 -0
- package/dist/{debugger.component-G4NYQU2M.js → debugger.component-XOR6S75S.js} +1 -1
- package/dist/main.min.js +4 -4
- package/dist/renderer-TBPM7OV3.js +1 -0
- package/dist/sdk-debug-logs-XNSWT65Q.js +1 -0
- package/dist/{share-dialog.component-HDMDNACD.js → share-dialog.component-KYYLRKQ6.js} +1 -1
- package/dist/video-detail-dialog.component-E3IQ3CUB.js +2 -0
- package/dist/widget.min.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-ALW6N5YB.js +0 -1
- package/dist/chunk-DTWV2VE6.js +0 -4
- package/dist/chunk-K3NDUCRB.js +0 -39
- package/dist/chunk-PC4YRNPG.js +0 -8
- package/dist/renderer-X5CF2PGG.js +0 -1
- package/dist/sdk-debug-logs-OECRZKTM.js +0 -1
- package/dist/video-detail-dialog.component-YQZ6AMST.js +0 -2
package/dist/chunk-K3NDUCRB.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import{a as wn,b as bn,c as $s,g as Vs,i as lr,j as En,k as R,p as pr}from"./chunk-PC4YRNPG.js";import{a as J,b as Gt,c as $r,e as uo,g as Oe,h as vn}from"./chunk-U4XWPFUW.js";var Gs=uo((Ws,fo)=>{"use strict";(function(e){if(typeof Ws=="object"&&typeof fo<"u")fo.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return(function n(i,o,s){function f(g,d){if(!o[g]){if(!i[g]){var E=typeof $r=="function"&&$r;if(!d&&E)return E(g,!0);if(h)return h(g,!0);var v=new Error("Cannot find module '"+g+"'");throw v.code="MODULE_NOT_FOUND",v}var T=o[g]={exports:{}};i[g][0].call(T.exports,function(A){var B=i[g][1][A];return f(B||A)},T,T.exports,n,i,o,s)}return o[g].exports}for(var h=typeof $r=="function"&&$r,_=0;_<s.length;_++)f(s[_]);return f})({1:[function(n,i,o){(function(s){"use strict";var f=s.MutationObserver||s.WebKitMutationObserver,h;if(f){var _=0,g=new f(A),d=s.document.createTextNode("");g.observe(d,{characterData:!0}),h=function(){d.data=_=++_%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var E=new s.MessageChannel;E.port1.onmessage=A,h=function(){E.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?h=function(){var F=s.document.createElement("script");F.onreadystatechange=function(){A(),F.onreadystatechange=null,F.parentNode.removeChild(F),F=null},s.document.documentElement.appendChild(F)}:h=function(){setTimeout(A,0)};var v,T=[];function A(){v=!0;for(var F,G,D=T.length;D;){for(G=T,T=[],F=-1;++F<D;)G[F]();D=T.length}v=!1}i.exports=B;function B(F){T.push(F)===1&&!v&&h()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,i,o){"use strict";var s=n(1);function f(){}var h={},_=["REJECTED"],g=["FULFILLED"],d=["PENDING"];i.exports=E;function E(j){if(typeof j!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,j!==f&&B(this,j)}E.prototype.catch=function(j){return this.then(null,j)},E.prototype.then=function(j,K){if(typeof j!="function"&&this.state===g||typeof K!="function"&&this.state===_)return this;var X=new this.constructor(f);if(this.state!==d){var Z=this.state===g?j:K;T(X,Z,this.outcome)}else this.queue.push(new v(X,j,K));return X};function v(j,K,X){this.promise=j,typeof K=="function"&&(this.onFulfilled=K,this.callFulfilled=this.otherCallFulfilled),typeof X=="function"&&(this.onRejected=X,this.callRejected=this.otherCallRejected)}v.prototype.callFulfilled=function(j){h.resolve(this.promise,j)},v.prototype.otherCallFulfilled=function(j){T(this.promise,this.onFulfilled,j)},v.prototype.callRejected=function(j){h.reject(this.promise,j)},v.prototype.otherCallRejected=function(j){T(this.promise,this.onRejected,j)};function T(j,K,X){s(function(){var Z;try{Z=K(X)}catch(dt){return h.reject(j,dt)}Z===j?h.reject(j,new TypeError("Cannot resolve promise with itself")):h.resolve(j,Z)})}h.resolve=function(j,K){var X=F(A,K);if(X.status==="error")return h.reject(j,X.value);var Z=X.value;if(Z)B(j,Z);else{j.state=g,j.outcome=K;for(var dt=-1,at=j.queue.length;++dt<at;)j.queue[dt].callFulfilled(K)}return j},h.reject=function(j,K){j.state=_,j.outcome=K;for(var X=-1,Z=j.queue.length;++X<Z;)j.queue[X].callRejected(K);return j};function A(j){var K=j&&j.then;if(j&&(typeof j=="object"||typeof j=="function")&&typeof K=="function")return function(){K.apply(j,arguments)}}function B(j,K){var X=!1;function Z(xt){X||(X=!0,h.reject(j,xt))}function dt(xt){X||(X=!0,h.resolve(j,xt))}function at(){K(dt,Z)}var ut=F(at);ut.status==="error"&&Z(ut.value)}function F(j,K){var X={};try{X.value=j(K),X.status="success"}catch(Z){X.status="error",X.value=Z}return X}E.resolve=G;function G(j){return j instanceof this?j:h.resolve(new this(f),j)}E.reject=D;function D(j){var K=new this(f);return h.reject(K,j)}E.all=W;function W(j){var K=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var X=j.length,Z=!1;if(!X)return this.resolve([]);for(var dt=new Array(X),at=0,ut=-1,xt=new this(f);++ut<X;)Ct(j[ut],ut);return xt;function Ct(Xt,O){K.resolve(Xt).then(x,function(U){Z||(Z=!0,h.reject(xt,U))});function x(U){dt[O]=U,++at===X&&!Z&&(Z=!0,h.resolve(xt,dt))}}}E.race=it;function it(j){var K=this;if(Object.prototype.toString.call(j)!=="[object Array]")return this.reject(new TypeError("must be an array"));var X=j.length,Z=!1;if(!X)return this.resolve([]);for(var dt=-1,at=new this(f);++dt<X;)ut(j[dt]);return at;function ut(xt){K.resolve(xt).then(function(Ct){Z||(Z=!0,h.resolve(at,Ct))},function(Ct){Z||(Z=!0,h.reject(at,Ct))})}}},{1:1}],3:[function(n,i,o){(function(s){"use strict";typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u};function f(u,y){if(!(u instanceof y))throw new TypeError("Cannot call a class as a function")}function h(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var _=h();function g(){try{if(!_||!_.open)return!1;var u=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),y=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!u||y)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function d(u,y){u=u||[],y=y||{};try{return new Blob(u,y)}catch(w){if(w.name!=="TypeError")throw w;for(var p=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,b=new p,S=0;S<u.length;S+=1)b.append(u[S]);return b.getBlob(y.type)}}typeof Promise>"u"&&n(3);var E=Promise;function v(u,y){y&&u.then(function(p){y(null,p)},function(p){y(p)})}function T(u,y,p){typeof y=="function"&&u.then(y),typeof p=="function"&&u.catch(p)}function A(u){return typeof u!="string"&&(console.warn(u+" used as a key, but it is not a string."),u=String(u)),u}function B(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var F="local-forage-detect-blob-support",G=void 0,D={},W=Object.prototype.toString,it="readonly",j="readwrite";function K(u){for(var y=u.length,p=new ArrayBuffer(y),b=new Uint8Array(p),S=0;S<y;S++)b[S]=u.charCodeAt(S);return p}function X(u){return new E(function(y){var p=u.transaction(F,j),b=d([""]);p.objectStore(F).put(b,"key"),p.onabort=function(S){S.preventDefault(),S.stopPropagation(),y(!1)},p.oncomplete=function(){var S=navigator.userAgent.match(/Chrome\/(\d+)/),w=navigator.userAgent.match(/Edge\//);y(w||!S||parseInt(S[1],10)>=43)}}).catch(function(){return!1})}function Z(u){return typeof G=="boolean"?E.resolve(G):X(u).then(function(y){return G=y,G})}function dt(u){var y=D[u.name],p={};p.promise=new E(function(b,S){p.resolve=b,p.reject=S}),y.deferredOperations.push(p),y.dbReady?y.dbReady=y.dbReady.then(function(){return p.promise}):y.dbReady=p.promise}function at(u){var y=D[u.name],p=y.deferredOperations.pop();if(p)return p.resolve(),p.promise}function ut(u,y){var p=D[u.name],b=p.deferredOperations.pop();if(b)return b.reject(y),b.promise}function xt(u,y){return new E(function(p,b){if(D[u.name]=D[u.name]||Tt(),u.db)if(y)dt(u),u.db.close();else return p(u.db);var S=[u.name];y&&S.push(u.version);var w=_.open.apply(_,S);y&&(w.onupgradeneeded=function(N){var k=w.result;try{k.createObjectStore(u.storeName),N.oldVersion<=1&&k.createObjectStore(F)}catch($){if($.name==="ConstraintError")console.warn('The database "'+u.name+'" has been upgraded from version '+N.oldVersion+" to version "+N.newVersion+', but the storage "'+u.storeName+'" already exists.');else throw $}}),w.onerror=function(N){N.preventDefault(),b(w.error)},w.onsuccess=function(){var N=w.result;N.onversionchange=function(k){k.target.close()},p(N),at(u)}})}function Ct(u){return xt(u,!1)}function Xt(u){return xt(u,!0)}function O(u,y){if(!u.db)return!0;var p=!u.db.objectStoreNames.contains(u.storeName),b=u.version<u.db.version,S=u.version>u.db.version;if(b&&(u.version!==y&&console.warn('The database "'+u.name+`" can't be downgraded from version `+u.db.version+" to version "+u.version+"."),u.version=u.db.version),S||p){if(p){var w=u.db.version+1;w>u.version&&(u.version=w)}return!0}return!1}function x(u){return new E(function(y,p){var b=new FileReader;b.onerror=p,b.onloadend=function(S){var w=btoa(S.target.result||"");y({__local_forage_encoded_blob:!0,data:w,type:u.type})},b.readAsBinaryString(u)})}function U(u){var y=K(atob(u.data));return d([y],{type:u.type})}function P(u){return u&&u.__local_forage_encoded_blob}function L(u){var y=this,p=y._initReady().then(function(){var b=D[y._dbInfo.name];if(b&&b.dbReady)return b.dbReady});return T(p,u,u),p}function q(u){dt(u);for(var y=D[u.name],p=y.forages,b=0;b<p.length;b++){var S=p[b];S._dbInfo.db&&(S._dbInfo.db.close(),S._dbInfo.db=null)}return u.db=null,Ct(u).then(function(w){return u.db=w,O(u)?Xt(u):w}).then(function(w){u.db=y.db=w;for(var N=0;N<p.length;N++)p[N]._dbInfo.db=w}).catch(function(w){throw ut(u,w),w})}function tt(u,y,p,b){b===void 0&&(b=1);try{var S=u.db.transaction(u.storeName,y);p(null,S)}catch(w){if(b>0&&(!u.db||w.name==="InvalidStateError"||w.name==="NotFoundError"))return E.resolve().then(function(){if(!u.db||w.name==="NotFoundError"&&!u.db.objectStoreNames.contains(u.storeName)&&u.version<=u.db.version)return u.db&&(u.version=u.db.version+1),Xt(u)}).then(function(){return q(u).then(function(){tt(u,y,p,b-1)})}).catch(p);p(w)}}function Tt(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Rt(u){var y=this,p={db:null};if(u)for(var b in u)p[b]=u[b];var S=D[p.name];S||(S=Tt(),D[p.name]=S),S.forages.push(y),y._initReady||(y._initReady=y.ready,y.ready=L);var w=[];function N(){return E.resolve()}for(var k=0;k<S.forages.length;k++){var $=S.forages[k];$!==y&&w.push($._initReady().catch(N))}var V=S.forages.slice(0);return E.all(w).then(function(){return p.db=S.db,Ct(p)}).then(function(H){return p.db=H,O(p,y._defaultConfig.version)?Xt(p):H}).then(function(H){p.db=S.db=H,y._dbInfo=p;for(var Y=0;Y<V.length;Y++){var nt=V[Y];nt!==y&&(nt._dbInfo.db=p.db,nt._dbInfo.version=p.version)}})}function Dt(u,y){var p=this;u=A(u);var b=new E(function(S,w){p.ready().then(function(){tt(p._dbInfo,it,function(N,k){if(N)return w(N);try{var $=k.objectStore(p._dbInfo.storeName),V=$.get(u);V.onsuccess=function(){var H=V.result;H===void 0&&(H=null),P(H)&&(H=U(H)),S(H)},V.onerror=function(){w(V.error)}}catch(H){w(H)}})}).catch(w)});return v(b,y),b}function jt(u,y){var p=this,b=new E(function(S,w){p.ready().then(function(){tt(p._dbInfo,it,function(N,k){if(N)return w(N);try{var $=k.objectStore(p._dbInfo.storeName),V=$.openCursor(),H=1;V.onsuccess=function(){var Y=V.result;if(Y){var nt=Y.value;P(nt)&&(nt=U(nt));var pt=u(nt,Y.key,H++);pt!==void 0?S(pt):Y.continue()}else S()},V.onerror=function(){w(V.error)}}catch(Y){w(Y)}})}).catch(w)});return v(b,y),b}function Ht(u,y,p){var b=this;u=A(u);var S=new E(function(w,N){var k;b.ready().then(function(){return k=b._dbInfo,W.call(y)==="[object Blob]"?Z(k.db).then(function($){return $?y:x(y)}):y}).then(function($){tt(b._dbInfo,j,function(V,H){if(V)return N(V);try{var Y=H.objectStore(b._dbInfo.storeName);$===null&&($=void 0);var nt=Y.put($,u);H.oncomplete=function(){$===void 0&&($=null),w($)},H.onabort=H.onerror=function(){var pt=nt.error?nt.error:nt.transaction.error;N(pt)}}catch(pt){N(pt)}})}).catch(N)});return v(S,p),S}function Lt(u,y){var p=this;u=A(u);var b=new E(function(S,w){p.ready().then(function(){tt(p._dbInfo,j,function(N,k){if(N)return w(N);try{var $=k.objectStore(p._dbInfo.storeName),V=$.delete(u);k.oncomplete=function(){S()},k.onerror=function(){w(V.error)},k.onabort=function(){var H=V.error?V.error:V.transaction.error;w(H)}}catch(H){w(H)}})}).catch(w)});return v(b,y),b}function st(u){var y=this,p=new E(function(b,S){y.ready().then(function(){tt(y._dbInfo,j,function(w,N){if(w)return S(w);try{var k=N.objectStore(y._dbInfo.storeName),$=k.clear();N.oncomplete=function(){b()},N.onabort=N.onerror=function(){var V=$.error?$.error:$.transaction.error;S(V)}}catch(V){S(V)}})}).catch(S)});return v(p,u),p}function bt(u){var y=this,p=new E(function(b,S){y.ready().then(function(){tt(y._dbInfo,it,function(w,N){if(w)return S(w);try{var k=N.objectStore(y._dbInfo.storeName),$=k.count();$.onsuccess=function(){b($.result)},$.onerror=function(){S($.error)}}catch(V){S(V)}})}).catch(S)});return v(p,u),p}function ft(u,y){var p=this,b=new E(function(S,w){if(u<0){S(null);return}p.ready().then(function(){tt(p._dbInfo,it,function(N,k){if(N)return w(N);try{var $=k.objectStore(p._dbInfo.storeName),V=!1,H=$.openKeyCursor();H.onsuccess=function(){var Y=H.result;if(!Y){S(null);return}u===0||V?S(Y.key):(V=!0,Y.advance(u))},H.onerror=function(){w(H.error)}}catch(Y){w(Y)}})}).catch(w)});return v(b,y),b}function Et(u){var y=this,p=new E(function(b,S){y.ready().then(function(){tt(y._dbInfo,it,function(w,N){if(w)return S(w);try{var k=N.objectStore(y._dbInfo.storeName),$=k.openKeyCursor(),V=[];$.onsuccess=function(){var H=$.result;if(!H){b(V);return}V.push(H.key),H.continue()},$.onerror=function(){S($.error)}}catch(H){S(H)}})}).catch(S)});return v(p,u),p}function lt(u,y){y=B.apply(this,arguments);var p=this.config();u=typeof u!="function"&&u||{},u.name||(u.name=u.name||p.name,u.storeName=u.storeName||p.storeName);var b=this,S;if(!u.name)S=E.reject("Invalid arguments");else{var w=u.name===p.name&&b._dbInfo.db,N=w?E.resolve(b._dbInfo.db):Ct(u).then(function(k){var $=D[u.name],V=$.forages;$.db=k;for(var H=0;H<V.length;H++)V[H]._dbInfo.db=k;return k});u.storeName?S=N.then(function(k){if(k.objectStoreNames.contains(u.storeName)){var $=k.version+1;dt(u);var V=D[u.name],H=V.forages;k.close();for(var Y=0;Y<H.length;Y++){var nt=H[Y];nt._dbInfo.db=null,nt._dbInfo.version=$}var pt=new E(function(ht,Pt){var Nt=_.open(u.name,$);Nt.onerror=function(ee){var kr=Nt.result;kr.close(),Pt(ee)},Nt.onupgradeneeded=function(){var ee=Nt.result;ee.deleteObjectStore(u.storeName)},Nt.onsuccess=function(){var ee=Nt.result;ee.close(),ht(ee)}});return pt.then(function(ht){V.db=ht;for(var Pt=0;Pt<H.length;Pt++){var Nt=H[Pt];Nt._dbInfo.db=ht,at(Nt._dbInfo)}}).catch(function(ht){throw(ut(u,ht)||E.resolve()).catch(function(){}),ht})}}):S=N.then(function(k){dt(u);var $=D[u.name],V=$.forages;k.close();for(var H=0;H<V.length;H++){var Y=V[H];Y._dbInfo.db=null}var nt=new E(function(pt,ht){var Pt=_.deleteDatabase(u.name);Pt.onerror=function(){var Nt=Pt.result;Nt&&Nt.close(),ht(Pt.error)},Pt.onblocked=function(){console.warn('dropInstance blocked for database "'+u.name+'" until all open connections are closed')},Pt.onsuccess=function(){var Nt=Pt.result;Nt&&Nt.close(),pt(Nt)}});return nt.then(function(pt){$.db=pt;for(var ht=0;ht<V.length;ht++){var Pt=V[ht];at(Pt._dbInfo)}}).catch(function(pt){throw(ut(u,pt)||E.resolve()).catch(function(){}),pt})})}return v(S,y),S}var Kt={_driver:"asyncStorage",_initStorage:Rt,_support:g(),iterate:jt,getItem:Dt,setItem:Ht,removeItem:Lt,clear:st,length:bt,key:ft,keys:Et,dropInstance:lt};function l(){return typeof openDatabase=="function"}var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c="~~local_forage_type~",m=/^~~local_forage_type~([^~]+)~/,I="__lfsc__:",C=I.length,M="arbf",Q="blob",ot="si08",et="ui08",gt="uic8",_t="si16",At="si32",fe="ur16",Te="ui32",ur="fl32",le="fl64",pe=C+M.length,As=Object.prototype.toString;function Ps(u){var y=u.length*.75,p=u.length,b,S=0,w,N,k,$;u[u.length-1]==="="&&(y--,u[u.length-2]==="="&&y--);var V=new ArrayBuffer(y),H=new Uint8Array(V);for(b=0;b<p;b+=4)w=a.indexOf(u[b]),N=a.indexOf(u[b+1]),k=a.indexOf(u[b+2]),$=a.indexOf(u[b+3]),H[S++]=w<<2|N>>4,H[S++]=(N&15)<<4|k>>2,H[S++]=(k&3)<<6|$&63;return V}function no(u){var y=new Uint8Array(u),p="",b;for(b=0;b<y.length;b+=3)p+=a[y[b]>>2],p+=a[(y[b]&3)<<4|y[b+1]>>4],p+=a[(y[b+1]&15)<<2|y[b+2]>>6],p+=a[y[b+2]&63];return y.length%3===2?p=p.substring(0,p.length-1)+"=":y.length%3===1&&(p=p.substring(0,p.length-2)+"=="),p}function Mu(u,y){var p="";if(u&&(p=As.call(u)),u&&(p==="[object ArrayBuffer]"||u.buffer&&As.call(u.buffer)==="[object ArrayBuffer]")){var b,S=I;u instanceof ArrayBuffer?(b=u,S+=M):(b=u.buffer,p==="[object Int8Array]"?S+=ot:p==="[object Uint8Array]"?S+=et:p==="[object Uint8ClampedArray]"?S+=gt:p==="[object Int16Array]"?S+=_t:p==="[object Uint16Array]"?S+=fe:p==="[object Int32Array]"?S+=At:p==="[object Uint32Array]"?S+=Te:p==="[object Float32Array]"?S+=ur:p==="[object Float64Array]"?S+=le:y(new Error("Failed to get type for BinaryArray"))),y(S+no(b))}else if(p==="[object Blob]"){var w=new FileReader;w.onload=function(){var N=c+u.type+"~"+no(this.result);y(I+Q+N)},w.readAsArrayBuffer(u)}else try{y(JSON.stringify(u))}catch(N){console.error("Couldn't convert value into a JSON string: ",u),y(null,N)}}function Fu(u){if(u.substring(0,C)!==I)return JSON.parse(u);var y=u.substring(pe),p=u.substring(C,pe),b;if(p===Q&&m.test(y)){var S=y.match(m);b=S[1],y=y.substring(S[0].length)}var w=Ps(y);switch(p){case M:return w;case Q:return d([w],{type:b});case ot:return new Int8Array(w);case et:return new Uint8Array(w);case gt:return new Uint8ClampedArray(w);case _t:return new Int16Array(w);case fe:return new Uint16Array(w);case At:return new Int32Array(w);case Te:return new Uint32Array(w);case ur:return new Float32Array(w);case le:return new Float64Array(w);default:throw new Error("Unkown type: "+p)}}var io={serialize:Mu,deserialize:Fu,stringToBuffer:Ps,bufferToString:no};function Ls(u,y,p,b){u.executeSql("CREATE TABLE IF NOT EXISTS "+y.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],p,b)}function ku(u){var y=this,p={db:null};if(u)for(var b in u)p[b]=typeof u[b]!="string"?u[b].toString():u[b];var S=new E(function(w,N){try{p.db=openDatabase(p.name,String(p.version),p.description,p.size)}catch(k){return N(k)}p.db.transaction(function(k){Ls(k,p,function(){y._dbInfo=p,w()},function($,V){N(V)})},N)});return p.serializer=io,S}function Ue(u,y,p,b,S,w){u.executeSql(p,b,S,function(N,k){k.code===k.SYNTAX_ERR?N.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[y.storeName],function($,V){V.rows.length?w($,k):Ls($,y,function(){$.executeSql(p,b,S,w)},w)},w):w(N,k)},w)}function $u(u,y){var p=this;u=A(u);var b=new E(function(S,w){p.ready().then(function(){var N=p._dbInfo;N.db.transaction(function(k){Ue(k,N,"SELECT * FROM "+N.storeName+" WHERE key = ? LIMIT 1",[u],function($,V){var H=V.rows.length?V.rows.item(0).value:null;H&&(H=N.serializer.deserialize(H)),S(H)},function($,V){w(V)})})}).catch(w)});return v(b,y),b}function Vu(u,y){var p=this,b=new E(function(S,w){p.ready().then(function(){var N=p._dbInfo;N.db.transaction(function(k){Ue(k,N,"SELECT * FROM "+N.storeName,[],function($,V){for(var H=V.rows,Y=H.length,nt=0;nt<Y;nt++){var pt=H.item(nt),ht=pt.value;if(ht&&(ht=N.serializer.deserialize(ht)),ht=u(ht,pt.key,nt+1),ht!==void 0){S(ht);return}}S()},function($,V){w(V)})})}).catch(w)});return v(b,y),b}function Bs(u,y,p,b){var S=this;u=A(u);var w=new E(function(N,k){S.ready().then(function(){y===void 0&&(y=null);var $=y,V=S._dbInfo;V.serializer.serialize(y,function(H,Y){Y?k(Y):V.db.transaction(function(nt){Ue(nt,V,"INSERT OR REPLACE INTO "+V.storeName+" (key, value) VALUES (?, ?)",[u,H],function(){N($)},function(pt,ht){k(ht)})},function(nt){if(nt.code===nt.QUOTA_ERR){if(b>0){N(Bs.apply(S,[u,$,p,b-1]));return}k(nt)}})})}).catch(k)});return v(w,p),w}function ju(u,y,p){return Bs.apply(this,[u,y,p,1])}function Hu(u,y){var p=this;u=A(u);var b=new E(function(S,w){p.ready().then(function(){var N=p._dbInfo;N.db.transaction(function(k){Ue(k,N,"DELETE FROM "+N.storeName+" WHERE key = ?",[u],function(){S()},function($,V){w(V)})})}).catch(w)});return v(b,y),b}function Wu(u){var y=this,p=new E(function(b,S){y.ready().then(function(){var w=y._dbInfo;w.db.transaction(function(N){Ue(N,w,"DELETE FROM "+w.storeName,[],function(){b()},function(k,$){S($)})})}).catch(S)});return v(p,u),p}function Gu(u){var y=this,p=new E(function(b,S){y.ready().then(function(){var w=y._dbInfo;w.db.transaction(function(N){Ue(N,w,"SELECT COUNT(key) as c FROM "+w.storeName,[],function(k,$){var V=$.rows.item(0).c;b(V)},function(k,$){S($)})})}).catch(S)});return v(p,u),p}function Yu(u,y){var p=this,b=new E(function(S,w){p.ready().then(function(){var N=p._dbInfo;N.db.transaction(function(k){Ue(k,N,"SELECT key FROM "+N.storeName+" WHERE id = ? LIMIT 1",[u+1],function($,V){var H=V.rows.length?V.rows.item(0).key:null;S(H)},function($,V){w(V)})})}).catch(w)});return v(b,y),b}function qu(u){var y=this,p=new E(function(b,S){y.ready().then(function(){var w=y._dbInfo;w.db.transaction(function(N){Ue(N,w,"SELECT key FROM "+w.storeName,[],function(k,$){for(var V=[],H=0;H<$.rows.length;H++)V.push($.rows.item(H).key);b(V)},function(k,$){S($)})})}).catch(S)});return v(p,u),p}function zu(u){return new E(function(y,p){u.transaction(function(b){b.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(S,w){for(var N=[],k=0;k<w.rows.length;k++)N.push(w.rows.item(k).name);y({db:u,storeNames:N})},function(S,w){p(w)})},function(b){p(b)})})}function Ju(u,y){y=B.apply(this,arguments);var p=this.config();u=typeof u!="function"&&u||{},u.name||(u.name=u.name||p.name,u.storeName=u.storeName||p.storeName);var b=this,S;return u.name?S=new E(function(w){var N;u.name===p.name?N=b._dbInfo.db:N=openDatabase(u.name,"","",0),u.storeName?w({db:N,storeNames:[u.storeName]}):w(zu(N))}).then(function(w){return new E(function(N,k){w.db.transaction(function($){function V(pt){return new E(function(ht,Pt){$.executeSql("DROP TABLE IF EXISTS "+pt,[],function(){ht()},function(Nt,ee){Pt(ee)})})}for(var H=[],Y=0,nt=w.storeNames.length;Y<nt;Y++)H.push(V(w.storeNames[Y]));E.all(H).then(function(){N()}).catch(function(pt){k(pt)})},function($){k($)})})}):S=E.reject("Invalid arguments"),v(S,y),S}var Xu={_driver:"webSQLStorage",_initStorage:ku,_support:l(),iterate:Vu,getItem:$u,setItem:ju,removeItem:Hu,clear:Wu,length:Gu,key:Yu,keys:qu,dropInstance:Ju};function Ku(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function Us(u,y){var p=u.name+"/";return u.storeName!==y.storeName&&(p+=u.storeName+"/"),p}function Qu(){var u="_localforage_support_test";try{return localStorage.setItem(u,!0),localStorage.removeItem(u),!1}catch{return!0}}function Zu(){return!Qu()||localStorage.length>0}function tf(u){var y=this,p={};if(u)for(var b in u)p[b]=u[b];return p.keyPrefix=Us(u,y._defaultConfig),Zu()?(y._dbInfo=p,p.serializer=io,E.resolve()):E.reject()}function ef(u){var y=this,p=y.ready().then(function(){for(var b=y._dbInfo.keyPrefix,S=localStorage.length-1;S>=0;S--){var w=localStorage.key(S);w.indexOf(b)===0&&localStorage.removeItem(w)}});return v(p,u),p}function rf(u,y){var p=this;u=A(u);var b=p.ready().then(function(){var S=p._dbInfo,w=localStorage.getItem(S.keyPrefix+u);return w&&(w=S.serializer.deserialize(w)),w});return v(b,y),b}function nf(u,y){var p=this,b=p.ready().then(function(){for(var S=p._dbInfo,w=S.keyPrefix,N=w.length,k=localStorage.length,$=1,V=0;V<k;V++){var H=localStorage.key(V);if(H.indexOf(w)===0){var Y=localStorage.getItem(H);if(Y&&(Y=S.serializer.deserialize(Y)),Y=u(Y,H.substring(N),$++),Y!==void 0)return Y}}});return v(b,y),b}function of(u,y){var p=this,b=p.ready().then(function(){var S=p._dbInfo,w;try{w=localStorage.key(u)}catch{w=null}return w&&(w=w.substring(S.keyPrefix.length)),w});return v(b,y),b}function sf(u){var y=this,p=y.ready().then(function(){for(var b=y._dbInfo,S=localStorage.length,w=[],N=0;N<S;N++){var k=localStorage.key(N);k.indexOf(b.keyPrefix)===0&&w.push(k.substring(b.keyPrefix.length))}return w});return v(p,u),p}function af(u){var y=this,p=y.keys().then(function(b){return b.length});return v(p,u),p}function cf(u,y){var p=this;u=A(u);var b=p.ready().then(function(){var S=p._dbInfo;localStorage.removeItem(S.keyPrefix+u)});return v(b,y),b}function uf(u,y,p){var b=this;u=A(u);var S=b.ready().then(function(){y===void 0&&(y=null);var w=y;return new E(function(N,k){var $=b._dbInfo;$.serializer.serialize(y,function(V,H){if(H)k(H);else try{localStorage.setItem($.keyPrefix+u,V),N(w)}catch(Y){(Y.name==="QuotaExceededError"||Y.name==="NS_ERROR_DOM_QUOTA_REACHED")&&k(Y),k(Y)}})})});return v(S,p),S}function ff(u,y){if(y=B.apply(this,arguments),u=typeof u!="function"&&u||{},!u.name){var p=this.config();u.name=u.name||p.name,u.storeName=u.storeName||p.storeName}var b=this,S;return u.name?S=new E(function(w){u.storeName?w(Us(u,b._defaultConfig)):w(u.name+"/")}).then(function(w){for(var N=localStorage.length-1;N>=0;N--){var k=localStorage.key(N);k.indexOf(w)===0&&localStorage.removeItem(k)}}):S=E.reject("Invalid arguments"),v(S,y),S}var lf={_driver:"localStorageWrapper",_initStorage:tf,_support:Ku(),iterate:nf,getItem:rf,setItem:uf,removeItem:cf,clear:ef,length:af,key:of,keys:sf,dropInstance:ff},pf=function(y,p){return y===p||typeof y=="number"&&typeof p=="number"&&isNaN(y)&&isNaN(p)},hf=function(y,p){for(var b=y.length,S=0;S<b;){if(pf(y[S],p))return!0;S++}return!1},Ms=Array.isArray||function(u){return Object.prototype.toString.call(u)==="[object Array]"},Fr={},Fs={},fr={INDEXEDDB:Kt,WEBSQL:Xu,LOCALSTORAGE:lf},mf=[fr.INDEXEDDB._driver,fr.WEBSQL._driver,fr.LOCALSTORAGE._driver],_n=["dropInstance"],oo=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(_n),df={description:"",driver:mf.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function gf(u,y){u[y]=function(){var p=arguments;return u.ready().then(function(){return u[y].apply(u,p)})}}function so(){for(var u=1;u<arguments.length;u++){var y=arguments[u];if(y)for(var p in y)y.hasOwnProperty(p)&&(Ms(y[p])?arguments[0][p]=y[p].slice():arguments[0][p]=y[p])}return arguments[0]}var yf=(function(){function u(y){f(this,u);for(var p in fr)if(fr.hasOwnProperty(p)){var b=fr[p],S=b._driver;this[p]=S,Fr[S]||this.defineDriver(b)}this._defaultConfig=so({},df),this._config=so({},this._defaultConfig,y),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return u.prototype.config=function(p){if((typeof p>"u"?"undefined":s(p))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var b in p){if(b==="storeName"&&(p[b]=p[b].replace(/\W/g,"_")),b==="version"&&typeof p[b]!="number")return new Error("Database version must be a number.");this._config[b]=p[b]}return"driver"in p&&p.driver?this.setDriver(this._config.driver):!0}else return typeof p=="string"?this._config[p]:this._config},u.prototype.defineDriver=function(p,b,S){var w=new E(function(N,k){try{var $=p._driver,V=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!p._driver){k(V);return}for(var H=oo.concat("_initStorage"),Y=0,nt=H.length;Y<nt;Y++){var pt=H[Y],ht=!hf(_n,pt);if((ht||p[pt])&&typeof p[pt]!="function"){k(V);return}}var Pt=function(){for(var kr=function(wf){return function(){var bf=new Error("Method "+wf+" is not implemented by the current driver"),ks=E.reject(bf);return v(ks,arguments[arguments.length-1]),ks}},ao=0,vf=_n.length;ao<vf;ao++){var co=_n[ao];p[co]||(p[co]=kr(co))}};Pt();var Nt=function(kr){Fr[$]&&console.info("Redefining LocalForage driver: "+$),Fr[$]=p,Fs[$]=kr,N()};"_support"in p?p._support&&typeof p._support=="function"?p._support().then(Nt,k):Nt(!!p._support):Nt(!0)}catch(ee){k(ee)}});return T(w,b,S),w},u.prototype.driver=function(){return this._driver||null},u.prototype.getDriver=function(p,b,S){var w=Fr[p]?E.resolve(Fr[p]):E.reject(new Error("Driver not found."));return T(w,b,S),w},u.prototype.getSerializer=function(p){var b=E.resolve(io);return T(b,p),b},u.prototype.ready=function(p){var b=this,S=b._driverSet.then(function(){return b._ready===null&&(b._ready=b._initDriver()),b._ready});return T(S,p,p),S},u.prototype.setDriver=function(p,b,S){var w=this;Ms(p)||(p=[p]);var N=this._getSupportedDrivers(p);function k(){w._config.driver=w.driver()}function $(Y){return w._extend(Y),k(),w._ready=w._initStorage(w._config),w._ready}function V(Y){return function(){var nt=0;function pt(){for(;nt<Y.length;){var ht=Y[nt];return nt++,w._dbInfo=null,w._ready=null,w.getDriver(ht).then($).catch(pt)}k();var Pt=new Error("No available storage method found.");return w._driverSet=E.reject(Pt),w._driverSet}return pt()}}var H=this._driverSet!==null?this._driverSet.catch(function(){return E.resolve()}):E.resolve();return this._driverSet=H.then(function(){var Y=N[0];return w._dbInfo=null,w._ready=null,w.getDriver(Y).then(function(nt){w._driver=nt._driver,k(),w._wrapLibraryMethodsWithReady(),w._initDriver=V(N)})}).catch(function(){k();var Y=new Error("No available storage method found.");return w._driverSet=E.reject(Y),w._driverSet}),T(this._driverSet,b,S),this._driverSet},u.prototype.supports=function(p){return!!Fs[p]},u.prototype._extend=function(p){so(this,p)},u.prototype._getSupportedDrivers=function(p){for(var b=[],S=0,w=p.length;S<w;S++){var N=p[S];this.supports(N)&&b.push(N)}return b},u.prototype._wrapLibraryMethodsWithReady=function(){for(var p=0,b=oo.length;p<b;p++)gf(this,oo[p])},u.prototype.createInstance=function(p){return new u(p)},u})(),_f=new yf;i.exports=_f},{3:3}]},{},[4])(4)})});var $o=uo((oi,Ma)=>{"use strict";(function(e,t){typeof oi=="object"&&typeof Ma<"u"?t(oi):typeof define=="function"&&define.amd?define(["exports"],t):t((e=typeof globalThis<"u"?globalThis:e||self).Sqrl={})})(oi,function(e){"use strict";function t(O){var x,U,P=new Error(O);return x=P,U=t.prototype,Object.setPrototypeOf?Object.setPrototypeOf(x,U):x.__proto__=U,P}function r(O,x,U){var P=x.slice(0,U).split(/\n/),L=P.length,q=P[L-1].length+1;throw t(O+=" at line "+L+" col "+q+`:
|
|
2
|
-
|
|
3
|
-
`+x.split(/\n/)[L-1]+`
|
|
4
|
-
`+Array(q).join(" ")+"^")}t.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var n=new Function("return this")().Promise,i=!1;try{i=new Function("return (async function(){}).constructor")()}catch(O){if(!(O instanceof SyntaxError))throw O}function o(O,x){return Object.prototype.hasOwnProperty.call(O,x)}function s(O,x,U){for(var P in x)o(x,P)&&(x[P]==null||typeof x[P]!="object"||P!=="storage"&&P!=="prefixes"||U?O[P]=x[P]:O[P]=s({},x[P]));return O}var f=/^async +/,h=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,_=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,g=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,d=/[.*+\-?^${}()|[\]\\]/g;function E(O){return d.test(O)?O.replace(d,"\\$&"):O}function v(O,x){x.rmWhitespace&&(O=O.replace(/[\r\n]+/g,`
|
|
5
|
-
`).replace(/^\s+|\s+$/gm,"")),h.lastIndex=0,_.lastIndex=0,g.lastIndex=0;var U=x.prefixes,P=[U.h,U.b,U.i,U.r,U.c,U.e].reduce(function(Lt,st){return Lt&&st?Lt+"|"+E(st):st?E(st):Lt},""),L=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+E(x.tags[1])+")","g"),q=new RegExp("([^]*?)"+E(x.tags[0])+"(-|_)?\\s*("+P+")?\\s*","g"),tt=0,Tt=!1;function Rt(Lt,st){var bt,ft={f:[]},Et=0,lt="c";function Kt(Q){var ot=O.slice(tt,Q),et=ot.trim();if(lt==="f")et==="safe"?ft.raw=!0:x.async&&f.test(et)?(et=et.replace(f,""),ft.f.push([et,"",!0])):ft.f.push([et,""]);else if(lt==="fp")ft.f[ft.f.length-1][1]+=et;else if(lt==="err"){if(et){var gt=ot.search(/\S/);r("invalid syntax",O,tt+gt)}}else ft[lt]=et;tt=Q+1}for(st==="h"||st==="b"||st==="c"?lt="n":st==="r"&&(ft.raw=!0,st="i"),L.lastIndex=tt;(bt=L.exec(O))!==null;){var l=bt[1],a=bt[2],c=bt[3],m=bt[4],I=bt[5],C=bt.index;if(l)l==="("?(Et===0&&(lt==="n"?(Kt(C),lt="p"):lt==="f"&&(Kt(C),lt="fp")),Et++):l===")"?--Et===0&<!=="c"&&(Kt(C),lt="err"):Et===0&&l==="|"?(Kt(C),lt="f"):l==="=>"&&(Kt(C),tt+=1,lt="res");else if(a)if(a==="/*"){var M=O.indexOf("*/",L.lastIndex);M===-1&&r("unclosed comment",O,bt.index),L.lastIndex=M+2}else a==="'"?(_.lastIndex=bt.index,_.exec(O)?L.lastIndex=_.lastIndex:r("unclosed string",O,bt.index)):a==='"'?(g.lastIndex=bt.index,g.exec(O)?L.lastIndex=g.lastIndex:r("unclosed string",O,bt.index)):a==="`"&&(h.lastIndex=bt.index,h.exec(O)?L.lastIndex=h.lastIndex:r("unclosed string",O,bt.index));else if(c)return Kt(C),tt=C+bt[0].length,q.lastIndex=tt,Tt=I,m&&st==="h"&&(st="s"),ft.t=st,ft}return r("unclosed tag",O,Lt),ft}var Dt=(function Lt(st,bt){st.b=[],st.d=[];var ft,Et=!1,lt=[];function Kt(gt,_t){gt&&(gt=(function(At,fe,Te,ur){var le,pe;return typeof fe.autoTrim=="string"?le=pe=fe.autoTrim:Array.isArray(fe.autoTrim)&&(le=fe.autoTrim[1],pe=fe.autoTrim[0]),(Te||Te===!1)&&(le=Te),(ur||ur===!1)&&(pe=ur),le==="slurp"&&pe==="slurp"?At.trim():(le==="_"||le==="slurp"?At=String.prototype.trimLeft?At.trimLeft():At.replace(/^[\s\uFEFF\xA0]+/,""):le!=="-"&&le!=="nl"||(At=At.replace(/^(?:\n|\r|\r\n)/,"")),pe==="_"||pe==="slurp"?At=String.prototype.trimRight?At.trimRight():At.replace(/[\s\uFEFF\xA0]+$/,""):pe!=="-"&&pe!=="nl"||(At=At.replace(/(?:\n|\r|\r\n)$/,"")),At)})(gt,x,Tt,_t))&&(gt=gt.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),lt.push(gt))}for(;(ft=q.exec(O))!==null;){var l,a=ft[1],c=ft[2],m=ft[3]||"";for(var I in U)if(U[I]===m){l=I;break}Kt(a,c),tt=ft.index+ft[0].length,l||r("unrecognized tag type: "+m,O,tt);var C=Rt(ft.index,l),M=C.t;if(M==="h"){var Q=C.n||"";x.async&&f.test(Q)&&(C.a=!0,C.n=Q.replace(f,"")),C=Lt(C),lt.push(C)}else if(M==="c"){if(st.n===C.n)return Et?(Et.d=lt,st.b.push(Et)):st.d=lt,st;r("Helper start and end don't match",O,ft.index+ft[0].length)}else if(M==="b"){Et?(Et.d=lt,st.b.push(Et)):st.d=lt;var ot=C.n||"";x.async&&f.test(ot)&&(C.a=!0,C.n=ot.replace(f,"")),Et=C,lt=[]}else if(M==="s"){var et=C.n||"";x.async&&f.test(et)&&(C.a=!0,C.n=et.replace(f,"")),lt.push(C)}else lt.push(C)}if(!bt)throw t('unclosed helper "'+st.n+'"');return Kt(O.slice(tt,O.length),!1),st.d=lt,st})({f:[]},!0);if(x.plugins)for(var jt=0;jt<x.plugins.length;jt++){var Ht=x.plugins[jt];Ht.processAST&&(Dt.d=Ht.processAST(Dt.d,x))}return Dt.d}function T(O,x){var U=v(O,x),P="var tR='';"+(x.useWith?"with("+x.varName+"||{}){":"")+D(U,x)+"if(cb){cb(null,tR)} return tR"+(x.useWith?"}":"");if(x.plugins)for(var L=0;L<x.plugins.length;L++){var q=x.plugins[L];q.processFnString&&(P=q.processFnString(P,x))}return P}function A(O,x){for(var U=0;U<x.length;U++){var P=x[U][0],L=x[U][1];O=(x[U][2]?"await ":"")+"c.l('F','"+P+"')("+O,L&&(O+=","+L),O+=")"}return O}function B(O,x,U,P,L,q){var tt="{exec:"+(L?"async ":"")+G(U,x,O)+",params:["+P+"]";return q&&(tt+=",name:'"+q+"'"),L&&(tt+=",async:true"),tt+="}"}function F(O,x){for(var U="[",P=0;P<O.length;P++){var L=O[P];U+=B(x,L.res||"",L.d,L.p||"",L.a,L.n),P<O.length&&(U+=",")}return U+="]"}function G(O,x,U){return"function("+x+"){var tR='';"+D(O,U)+"return tR}"}function D(O,x){for(var U=0,P=O.length,L="";U<P;U++){var q=O[U];if(typeof q=="string")L+="tR+='"+q+"';";else{var tt=q.t,Tt=q.c||"",Rt=q.f,Dt=q.n||"",jt=q.p||"",Ht=q.res||"",Lt=q.b,st=!!q.a;if(tt==="i"){x.defaultFilter&&(Tt="c.l('F','"+x.defaultFilter+"')("+Tt+")");var bt=A(Tt,Rt);!q.raw&&x.autoEscape&&(bt="c.l('F','e')("+bt+")"),L+="tR+="+bt+";"}else if(tt==="h")if(x.storage.nativeHelpers.get(Dt))L+=x.storage.nativeHelpers.get(Dt)(q,x);else{var ft=(st?"await ":"")+"c.l('H','"+Dt+"')("+B(x,Ht,q.d,jt,st);ft+=Lt?","+F(Lt,x):",[]",L+="tR+="+A(ft+=",c)",Rt)+";"}else tt==="s"?L+="tR+="+A((st?"await ":"")+"c.l('H','"+Dt+"')({params:["+jt+"]},[],c)",Rt)+";":tt==="e"&&(L+=Tt+`
|
|
6
|
-
`)}}return L}var W=(function(){function O(x){this.cache=x}return O.prototype.define=function(x,U){this.cache[x]=U},O.prototype.get=function(x){return this.cache[x]},O.prototype.remove=function(x){delete this.cache[x]},O.prototype.reset=function(){this.cache={}},O.prototype.load=function(x){s(this.cache,x,!0)},O})();function it(O,x,U,P){if(x&&x.length>0)throw t((P?"Native":"")+"Helper '"+O+"' doesn't accept blocks");if(U&&U.length>0)throw t((P?"Native":"")+"Helper '"+O+"' doesn't accept filters")}var j={"&":"&","<":"<",">":">",'"':""","'":"'"};function K(O){return j[O]}var X=new W({}),Z=new W({each:function(O,x){var U="",P=O.params[0];if(it("each",x,!1),O.async)return new Promise(function(q){(function tt(Tt,Rt,Dt,jt,Ht){Dt(Tt[Rt],Rt).then(function(Lt){jt+=Lt,Rt===Tt.length-1?Ht(jt):tt(Tt,Rt+1,Dt,jt,Ht)})})(P,0,O.exec,U,q)});for(var L=0;L<P.length;L++)U+=O.exec(P[L],L);return U},foreach:function(O,x){var U=O.params[0];if(it("foreach",x,!1),O.async)return new Promise(function(q){(function tt(Tt,Rt,Dt,jt,Ht,Lt){jt(Rt[Dt],Tt[Rt[Dt]]).then(function(st){Ht+=st,Dt===Rt.length-1?Lt(Ht):tt(Tt,Rt,Dt+1,jt,Ht,Lt)})})(U,Object.keys(U),0,O.exec,"",q)});var P="";for(var L in U)o(U,L)&&(P+=O.exec(L,U[L]));return P},include:function(O,x,U){it("include",x,!1);var P=U.storage.templates.get(O.params[0]);if(!P)throw t('Could not fetch template "'+O.params[0]+'"');return P(O.params[1],U)},extends:function(O,x,U){var P=O.params[1]||{};P.content=O.exec();for(var L=0;L<x.length;L++){var q=x[L];P[q.name]=q.exec()}var tt=U.storage.templates.get(O.params[0]);if(!tt)throw t('Could not fetch template "'+O.params[0]+'"');return tt(P,U)},useScope:function(O,x){return it("useScope",x,!1),O.exec(O.params[0])}}),dt=new W({if:function(O,x){it("if",!1,O.f,!0);var U="if("+O.p+"){"+D(O.d,x)+"}";if(O.b)for(var P=0;P<O.b.length;P++){var L=O.b[P];L.n==="else"?U+="else{"+D(L.d,x)+"}":L.n==="elif"&&(U+="else if("+L.p+"){"+D(L.d,x)+"}")}return U},try:function(O,x){if(it("try",!1,O.f,!0),!O.b||O.b.length!==1||O.b[0].n!=="catch")throw t("native helper 'try' only accepts 1 block, 'catch'");var U="try{"+D(O.d,x)+"}",P=O.b[0];return U+="catch"+(P.res?"("+P.res+")":"")+"{"+D(P.d,x)+"}"},block:function(O,x){return it("block",O.b,O.f,!0),"if(!"+x.varName+"["+O.p+"]){tR+=("+G(O.d,"",x)+")()}else{tR+="+x.varName+"["+O.p+"]}"}}),at=new W({e:function(O){var x=String(O);return/[&<>"']/.test(x)?x.replace(/[&<>"']/g,K):x}}),ut={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(O,x){if(O==="H"){var U=this.storage.helpers.get(x);if(U)return U;throw t("Can't find helper '"+x+"'")}if(O==="F"){var P=this.storage.filters.get(x);if(P)return P;throw t("Can't find filter '"+x+"'")}},async:!1,storage:{helpers:Z,nativeHelpers:dt,filters:at,templates:X},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function xt(O,x){var U={};return s(U,ut),x&&s(U,x),O&&s(U,O),U.l.bind(U),U}function Ct(O,x){var U,P=xt(x||{}),L=Function;if(P.async){if(!i)throw t("This environment doesn't support async/await");L=i}if(P.varName&&(U=P.varName,/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(U)===!1))throw t("options.varName must be a valid JS identifier");try{return new L(P.varName,"c","cb",T(O,P))}catch(q){throw q instanceof SyntaxError?t(`Bad template syntax
|
|
7
|
-
|
|
8
|
-
`+q.message+`
|
|
9
|
-
`+Array(q.message.length+1).join("=")+`
|
|
10
|
-
`+T(O,P)):q}}function Xt(O,x){var U;return x.cache&&x.name&&x.storage.templates.get(x.name)?x.storage.templates.get(x.name):(U=typeof O=="function"?O:Ct(O,x),x.cache&&x.name&&x.storage.templates.define(x.name,U),U)}ut.l.bind(ut),e.compile=Ct,e.compileScope=D,e.compileScopeIntoFunction=G,e.compileToString=T,e.defaultConfig=ut,e.filters=at,e.getConfig=xt,e.helpers=Z,e.nativeHelpers=dt,e.parse=v,e.render=function(O,x,U,P){var L=xt(U||{});if(!L.async)return Xt(O,L)(x,L);if(!P){if(typeof n=="function")return new n(function(q,tt){try{q(Xt(O,L)(x,L))}catch(Tt){tt(Tt)}});throw t("Please provide a callback function, this env doesn't support Promises")}try{Xt(O,L)(x,L,P)}catch(q){return P(q)}},e.templates=X,Object.defineProperty(e,"__esModule",{value:!0})})});var Ss=uo(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.URLBuilder=void 0;var Ep=(function(){function e(t){try{this.base=new URL(t),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return e.prototype.appendQueryParam=function(t,r){this.params.append(t,r?r.toString():"")},e.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},e.prototype.deleteQueryParam=function(t){this.params.delete(t)},e.prototype.getBase=function(){return this.base},e.prototype.getPath=function(){return this.base.pathname},e.prototype.getHostname=function(){return this.base.hostname},e.prototype.getParams=function(){return this.params},e.prototype.getQueryParam=function(t){if(!this.params)return"";var r=this.params.get(t);return!r||r==="undefined"||r==="null"?void 0:r},e.prototype.getQueryString=function(){return this.params.toString()},e.prototype.setPath=function(t){return this.base.pathname=t,this},e.prototype.setQueryParam=function(t,r){return this.params.set(t,r?r.toString():""),this},e.prototype.setQueryString=function(t){if(t)return t[0]==="?"&&(t=t.slice(1)),this.params=new URLSearchParams(t),this},e.prototype.toString=function(){var t=this.params.toString();return t===""?this.base.search="":this.base.search="?"+t,this.base.toString()},e})();Ji.URLBuilder=Ep});function St(){return window.CooeeSDK.runtimeData}function vh(){return pr(Date.now()-St().sdkLoadTime.getTime())}var Sn=class{constructor(t,r){this._startTime=t;this._triggerData=r}intervals=[];selectedEmbeddedItems;renderer;closeCallback;inputFields=[];get startTime(){return this._startTime}get triggerData(){return this._triggerData}get inputs(){return this.inputFields}get rootClassName(){let t=this.triggerData.shortID??this.triggerData.id.slice(-6);return t==="test"&&(t="test-"+this.startTime.getTime().toString()),"cooee-wrapper-"+t}get selectedItems(){return this.triggerData.items.filter(t=>t.selected.value)}get shouldGiveFBTDiscount(){let t=this.selectedItems.length;return this.triggerData.bundleConfig?.applyDiscountOnMinimum?this.triggerData.bundleConfig.applyDiscountOnMinimum<=t:t===this.triggerData.items.length}onClose(t){this.closeCallback=t}closeInApp(t,r){r??={};let n=(new Date().getTime()-this.startTime.getTime())/1e3,i=J({eventName:t,duration:n},r);this.stopIntervals(),this.closeCallback&&this.closeCallback(i)}addInputField(t,r){this.inputFields.push({id:t,type:r,isValid:!1})}updateValidation(t,r){this.inputFields.forEach(n=>{if(n.id===t){n.isValid=r;return}})}hasManipulatedProductQuantity(){let t=this.triggerData.manipulation.productQuantity;return t?.enabled&&t.min!=null&&t.max!=null}getManipulatedQuantity(t){let{min:r=1,max:n=100}=this.triggerData.manipulation.productQuantity;if(r>n)return R.error("Invalid range: min should be less than or equal to max."),t;if(t>=r&&t<=n)return t;let i=t%100;return i<r?r:i>n?n:i}stopIntervals(){this.intervals.forEach(t=>clearInterval(t))}};var js=5,Ef=500,ye=class extends Error{request;response;status;requestBody;responseText;constructor(t){super(t),this.name="FetchError",Object.setPrototypeOf(this,new.target.prototype)}is40x(){return!!this.response&&this.response.status>=400&&this.response.status<500}};async function Ne(e,t){let r=Date.now(),n;try{n=await Sf(e,t)}catch{}let i=n?new Request(n.url,{method:t?.method||"GET"}):new Request(e,t);if(!n||!n.ok){let _="Failed to fetch";n?.statusText&&(_+=`: ${n.statusText}`);let g=new ye(_);throw g.request=i,g.response=n?.clone(),g.status=n?.status,g.requestBody=t?.body,g.responseText=await Hs(n),g}let o,s=(n.headers.get("content-type")||"").toLowerCase(),f=n.headers.get("content-length"),h=t?.method?.toUpperCase()||"GET";if(n.status===204||n.status===205||h==="HEAD"||f==="0")o=void 0;else if(s.includes("application/json")||s.includes("application/problem+json")||s.includes("text/javascript"))try{o=await n.clone().json()}catch(_){let g=new ye(`Failed to parse JSON response: ${_?.message}`);throw g.request=i,g.response=n.clone(),g.status=n.status,g.requestBody=t?.body,g.responseText=await Hs(n),g}else s.includes("text/")||s.includes("image/svg+xml")?o=await n.text():o=await n.arrayBuffer();return{data:o,status:n.status,statusText:n.statusText,headers:n.headers,timeTakenMs:Date.now()-r,options:t,request:i}}async function Sf(e,t){let r=null,n;for(let i=0;i<=js;i++){try{let o=new Headers(t?.headers);(e.includes("letscooee.com")||e.includes("localhost"))&&o.set("Cooee-Retry-Attempt",i.toString());let s=Gt(J({},t),{headers:o});if(n=await fetch(e,s),n.ok||n.status>=400&&n.status<500)return n;r=new Error(`Server error: ${n.status} ${n.statusText}`)}catch(o){r=o instanceof Error?o:new Error(String(o))}if(i<js){let o=Math.pow(2,i)*Ef;R.info(`Request to ${e} failed. Retrying in ${o}ms...`),await new Promise(s=>setTimeout(s,o))}}if(n&&!n.ok)return n;throw r||new Error("Request failed after retries")}async function Hs(e){if(e){try{return e=e.clone(),await e.json()}catch{}try{return await e.text()}catch{}}}var _e=class{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}static parseToAny(t){try{return JSON.parse(t.toString())}catch{}return t.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(t.toString()):t}static async sleep(t){return new Promise(r=>setTimeout(r,t))}static hasKeys(t){return t?Object.keys(t).length>=1:!1}static convertObjectToArray(t,r){return r.reduce((n,i)=>(t.hasOwnProperty(i)&&t[i]!=null&&n.push({[i]:t[i]}),n),[])}static removeNullUndefinedKeys(t){return Object.keys(t).reduce((r,n)=>(t[n]!==null&&t[n]!==void 0&&(r[n]=t[n]),r),{})}static stringify(t){return JSON.stringify(t,function(r,n){return n===void 0?null:n})}};var Wt=class{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;widgetCustomisation;currency;static get(){return window.CooeeSDK.config}update(t){return t??={},this.gaEnabled=t.gaEnabled,this.gaMeasurementID=t.gaMeasurementID,this.pixelPush=t.pixelPush,this.website=t.website??{},this.currencyCount=t.currencyCount??0,this.money=t.money,this.currency=t.currency,this.storefrontToken=t.storefrontToken,this.skipItemAttribute=t.skipItemAttribute,this.widgetCustomisation=t.widgetCustomisation,this}};var lo=Oe(Gs());function In(e){return lo.default.createInstance({name:"lc",storeName:e,driver:lo.default.LOCALSTORAGE})}var hr=class{static storage;static async get(t,r){return await this.storage?.getItem(t)??r}static set(t,r){return this.storage?.setItem(t,r)}static remove(t){return this.storage?.removeItem(t)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var Vr=class Vr extends hr{};vn(Vr,"storeName","ses"),Vr.storage=In(Vr.storeName);var Yt=Vr;var jr=class jr extends hr{};vn(jr,"storeName","usr"),jr.storage=In(jr.storeName);var Bt=jr;var xn=class{static format(t,r){let n=/{{\s*(\w+)\s*}}/;return r.replace(n,(i,o)=>{switch(o){case"amount":return this.formatWithDelimiters(t,2);case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount_with_apostrophe_separator":return this.formatWithDelimiters(t,2,"'",".");case"amount_no_decimals_with_space_separator":return this.formatWithDelimiters(t,0," ");case"amount_with_space_separator":return this.formatWithDelimiters(t,2," ",",");case"amount_with_period_and_space_separator":return this.formatWithDelimiters(t,2," ",".");default:return i}})}static formatWithDelimiters(t,r=2,n=",",i="."){if(isNaN(t)||t==null)return"0";let s=(t/100).toFixed(r).split("."),f=s[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+n),h=s[1]?i+s[1]:"";return f+h}};function Ys(e){try{return new URL(e)}catch{return}}function Jh(e){return!e||e==="null"||e==="undefined"}function qs(e,t){let r=e.indexOf(t);return r===-1?!1:(e.splice(r,1),!0)}function Qt(e,t,r){return{[e]:po(t,r),[e+"_wo_currency"]:t}}function po(e,t){if(e==0&&t)return"Free";let r=St(),n=Wt.get(),i=r.shopCurrencyCode||n.currency,o=r.currencyCode;o||R.warn("Currency code is not set in RuntimeData");let s=n.money?.format??r.moneyFormat,f;if(s&&i===o)f=xn.format(e*100,s);else{let h;try{h=new Intl.NumberFormat(Js(),{style:"currency",currency:o||i,minimumFractionDigits:0,maximumFractionDigits:2})}catch(_){return vt(_,"format-currency",{extra:{currentCurrency:o,shopCurrency:i}}),""}f=h.format(e),f=f.replace("\u20B9","Rs. "),n.money?.showCurrency&&o!=="INR"&&(f=f.concat(` ${o}`))}return f}function zs(e){let t=Js();try{return new Intl.NumberFormat(t,{notation:"compact"}).format(e)}catch(r){return vt(r,"format-number",{extra:{lang:t,value:e}}),e.toString()}}function Js(){let e="en";return typeof navigator<"u"&&(navigator.languages!==void 0&&navigator.languages.length>0?e=navigator.languages[0]:navigator.language&&(e=navigator.language)),e=e.split(";")[0],e=e.split("-")[0],e||"en"}var Tn;function Xs(){if(Tn)return Tn;try{return Tn=Intl.DateTimeFormat().resolvedOptions().timeZone,Tn}catch{return""}}function Xh(e){document.readyState!=="loading"?e():document.addEventListener("DOMContentLoaded",e)}function Re(e){let t=document.createElement("span");t.id="snackbar",t.innerText=e,document.body.appendChild(t),t.className="show",setTimeout(()=>{t.classList.remove("show"),document.body.removeChild(t)},5e3)}async function If(e,t=7,r=document){let n=1,i=document.querySelectorAll("nonexistent-tag");for(;n<=t;){let o=Math.min(50*2**n,1e3);if(n>1&&await _e.sleep(o),i=r.querySelectorAll(e),i.length)return R.verbose(`Attempt ${n}: ${i.length} elements found with ${e}`),i;R.verbose(`Attempt ${n}: Elements not found with ${e}. Will retry after ${o}ms.`),n++}return R.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${e}.`),i}async function ho(e,t=10,r=document){return(await If(e,t,r)).item(0)}async function mo(e){let[t,r,n]=await Promise.all([Bt.get("did"),Yt.get("id",""),Bt.get("sessionNumber",1)]),i={letscooee_did:t,letscooee_sid:r,letscooee_sn:`${n}`,__letscooee_time:new Date().toLocaleString()};return e&&(i.__letscooee_via=e),i}async function Ks(e){let t=await mo(e);return Object.entries(t).map(([r,n])=>({key:r,value:n.toString()}))}function Kh(e,t,r,n=!1){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:n,value:r})}function Qh(e){if(e%100>=11&&e%100<=13)return e+"th";switch(e%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd";default:return e+"th"}}var Cn={},Nn,Rn,Zs,ta,Qs;async function ea(){if(!Rn)return Qs??=xf(),Qs}async function xf(){let{BrowserClient:e,Scope:t,defaultStackParser:r,getDefaultIntegrations:n,makeFetchTransport:i}=await import("./esm-EYV26LOR.js");ta=t;let o=n({}).filter(s=>!["BrowserApiErrors","Breadcrumbs","GlobalHandlers"].includes(s.name));Rn=new e({dsn:"https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520",transport:i,stackParser:r,integrations:o,environment:lr.mode,release:`web-sdk@${bn}`,debug:lr.debug,sampleRate:.5}),Rn.init()}function vt(e,t,r){R.error(`${t}:`,e),ea().then(()=>{let n=ia(r);if(n.setTag("operation",t),e instanceof ye){Tf(n,e,t);return}n.captureException(e)})}function ra(e,t,r){ea().then(()=>{ia(r).captureMessage(e,t??"error")})}function Tf(e,t,r){if(Of(e,t),t.response){let n=t.response,i=t.responseText;e.setTag("error.message",t.message),n.status!=null&&e.setTag("http.status_code",n.status),n.statusText&&e.setTag("http.status_text",n.statusText),i&&typeof i=="object"&&"error"in i&&(e.setTag("http.error_code",i.error.code),e.setTag("http.error_message",i.error.message)),e.setExtras({responseText:t.responseText,statusText:n.statusText,responseType:n.type,redirected:n.redirected,responseUrl:n.url,originalError:t.message}),e.captureMessage(`${r} failed with ${n.status}`,"error");return}if(t.request){e.captureMessage(`No response was received for ${r}`,"error");return}}function Of(e,t){let r=t.request;if(!r)return;e.setExtras({body:t.requestBody,headers:r.headers,method:r.method,url:r.url});let n=r.headers?.get("Cooee-Retry-Attempt");n!==null&&e.setTag("retry.attempt",n)}function na(e){Zs=e}function Dn(e,t){Cn[e]=J(J({},Cn[e]),t)}function mr(e){Nn=J(J({},Nn),e)}function ia(e){e??={};let{extra:t,tags:r}=e,n=new ta;if(n.setClient(Rn),n.setUser(Zs),e.triggerContext&&!e.engagementTrigger&&(e.engagementTrigger=e.triggerContext.triggerData),e.engagementTrigger){let i=e.engagementTrigger;n.setTags({"engagement.id":i.engagementID,"engagement.short_id":i.shortID,"engagement.objective":i.objective,"engagement.delivery_type":i.onsiteDeliveryType,"engagement.content_id":i.contentID,"engagement.variation":i.variation,"engagement.currency":i.currency})}return t&&n.setExtras(t),r&&n.setTags(r),Nn&&n.setTags(Nn),Object.keys(Cn).forEach(i=>{n.setContext(i,Cn[i])}),n.setTag("language",navigator.language),n.setTag("timezone",Xs()),Cf(n),n}function Cf(e){window.Shopify&&(e.setTag("shopify.shop",window.Shopify.shop),e.setTag("shopify.currency",window.Shopify.currency?.active),e.setTag("shopify.locale",window.Shopify.locale),e.setTag("theme.schema_name",window.Shopify.theme?.schema_name),e.setTag("theme.schema_version",window.Shopify.theme?.schema_version))}var Ye=class{s;g;i;constructor(t){t.s&&(this.s=new It(t.s)),t.g&&(this.g=new Hr(t.g)),this.i=t.i}get solid(){return this.s}get glossy(){return this.g}get img(){return this.i}};var Wr="a-f\\d",Nf=`#?[${Wr}]{3}[${Wr}]?`,Rf=`#?[${Wr}]{6}([${Wr}]{2})?`,Df=new RegExp(`[^#${Wr}]`,"gi"),Af=new RegExp(`^${Nf}$|^${Rf}$`,"i");function go(e,t={}){if(typeof e!="string"||Df.test(e)||!Af.test(e))throw new TypeError("Expected a valid hex string");e=e.replace(/^#/,"");let r=1;e.length===8&&(r=Number.parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)),e.length===4&&(r=Number.parseInt(e.slice(3,4).repeat(2),16)/255,e=e.slice(0,3)),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);let n=Number.parseInt(e,16),i=n>>16,o=n>>8&255,s=n&255,f=typeof t.alpha=="number"?t.alpha:r;if(t.format==="array")return[i,o,s,f];if(t.format==="css"){let h=f===1?"":` / ${Number((f*100).toFixed(2))}%`;return`rgb(${i} ${o} ${s}${h})`}return{red:i,green:o,blue:s,alpha:f}}var It=class{h;a=100;g;constructor(t){t??={},this.h=t.h,this.a=t.a,this.g=t.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return go(this.hex,{format:"css",alpha:this.getAlpha()})}catch(t){return console.error("Invalid hex",t),"#000000"}}getAlpha(){return(this.a??100)/100}};var De=class{s;r;w;c;constructor(t){this.s=t.s,this.r=t.r,this.w=t.w,t.c&&(this.c=new It(t.c))}get radius(){return this.r}get width(){return this.w}get color(){return this.c}get style(){return An[this.s??1]}},An=(r=>(r[r.SOLID=1]="SOLID",r[r.DASHED=2]="DASHED",r))(An||{});var Hr=class e{static DEFAULT_FALLBACK=new It({h:"#000000",a:50});r;c;fb;constructor(t){this.r=t.r,t.c&&(this.c=new It(t.c)),t.fb&&(this.fb=new It(t.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??e.DEFAULT_FALLBACK}};var Gr=class{blur;spr;clr;x;y;constructor(t){t=t??{},this.blur=t.blur??0,this.spr=t.spr??0,this.x=t.x??0,this.y=t.y??0,this.clr=new It(t.clr)}getStyle(t){return`${this.x*t}px ${this.y*t}px ${this.blur*t}px ${this.spr*t}px ${this.clr.rgba}`}};var Ae=class{pl;pr;pt;pb;ml;mr;mt;mb;cent;constructor(t){t=t??{},this.pl=t.pl??0,this.pr=t.pr??0,this.pt=t.pt??0,this.pb=t.pb??0,this.ml=t.ml??0,this.mr=t.mr??0,this.mt=t.mt??0,this.mb=t.mb??0,this.cent=t.cent??!1}getHorizontal(){return this.pl+this.pr}getVertical(){return this.pt+this.pb}getPaddingCSS(){return`${this.pt}px ${this.pr}px ${this.pb}px ${this.pl}px`}};var Yr=class{rot;constructor(t){t?.rot&&(this.rot=t.rot)}get rotate(){return this.rot}};var Zt=class{t;bg;br;clc;shd;spc;trf;a;w;h;x;y;constructor(t){this.t=t.t,t.bg&&(this.bg=new Ye(t.bg)),t.br&&(this.br=new De(t.br)),t.shd&&(this.shd=new Gr(t.shd)),t.spc&&(this.spc=new Ae(t.spc)),this.trf=new Yr(t.trf),this.clc=t.clc,this.w=t.w,this.h=t.h,this.x=t.x,this.y=t.y,this.a=t.a}get alpha(){return this.a??100}get type(){return this.t}get typeAsString(){return kt[this.t]}get click(){return this.clc}},kt=(D=>(D[D.IMAGE=1]="IMAGE",D[D.TEXT=2]="TEXT",D[D.BUTTON=3]="BUTTON",D[D.FLEXBOX=4]="FLEXBOX",D[D.MULTI_COLUMN=5]="MULTI_COLUMN",D[D.CHECKBOX=6]="CHECKBOX",D[D.PRODUCTS=11]="PRODUCTS",D[D.PRODUCT=12]="PRODUCT",D[D.PRODUCT_IMAGE=13]="PRODUCT_IMAGE",D[D.PRODUCT_TITLE=14]="PRODUCT_TITLE",D[D.PRODUCT_VARIATIONS=15]="PRODUCT_VARIATIONS",D[D.PRODUCT_VARIATIONS_SELLING_PLANS=16]="PRODUCT_VARIATIONS_SELLING_PLANS",D[D.PRODUCT_BUTTON=18]="PRODUCT_BUTTON",D[D.PRODUCT_RATING=19]="PRODUCT_RATING",D[D.EMAIL_INPUT=51]="EMAIL_INPUT",D[D.PHONE_INPUT=52]="PHONE_INPUT",D[D.COUNTDOWN_TIMER=61]="COUNTDOWN_TIMER",D[D.CAROUSEL=62]="CAROUSEL",D[D.SHAPE=100]="SHAPE",D))(kt||{});var qr=class extends Zt{constructor(t){super(t)}};var qe=class extends Zt{src;constructor(t){super(t),this.src=t.src}};var Pn=(i=>(i[i.START=0]="START",i[i.CENTER=1]="CENTER",i[i.END=2]="END",i[i.JUSTIFY=3]="JUSTIFY",i))(Pn||{});var Ln=class{name;fonts;constructor(t){t=t??{},t.name&&(t.name=t.name!=="Arial"?t.name:""),this.name=t.name,this.fonts=t.fonts?.map(r=>new yo(r))}},yo=class{style;url;constructor(t){t=t??{},this.style=t.style,this.url=t.url}getFontDescriptor(){return{style:this.style===2||this.style===4?"italic":"normal",weight:this.style===4||this.style===3?"700":"400"}}getURL(){return`url('${this.url}') format('truetype')`}};var he=class{fw;fs;fam;fmly;lh=1.2;ls;s;tc;ta;td;tdc;constructor(t){this.update(t)}get alignment(){return Pn[this.ta]}get letterSpacing(){return this.ls?this.ls+"px":"normal"}update(t){t=t??{},t.lh&&(this.lh=t.lh),t.tdc&&(this.tdc=new It(t.tdc)),this.td=t.td,this.fs=t.s??t.fs??60,this.tc=new It(t.tc),this.ta=t.ta??1,this.fw=t.fw??400,this.ls=t.ls??0,this.tc.h??="#000000",this.fam=new Ln(t.fam??t.fmly)}resize(t){this.s*=t,this.ls*=t}};var Me=class extends Zt{typo;constructor(t){super(t);let r=J(J({},t.f),t.typo);t.alg&&(r.ta=t.alg),t.c&&(r.tc=t.c),this.typo=new he(r)}get color(){return this.typography.tc}get typography(){return this.typo}};var dr=class extends Me{prs;constructor(t){super(t),this.prs=t.prs}get parts(){return this.prs}};var gr=class{dd;hh;mm;ss;date;constructor(t){t??={},this.dd=t.dd??0,this.hh=t.hh??0,this.mm=t.mm??0,this.ss=t.ss??0,this.date=t.date?new Date(t.date):void 0}start(t,r){let n=new Date;t===2?(n.setSeconds(n.getSeconds()+this.ss),n.setMinutes(n.getMinutes()+this.mm),n.setHours(n.getHours()+this.hh),n.setDate(n.getDate()+this.dd)):n=this.date??new Date;let i=window.setInterval(()=>{let o=new Date().getTime(),s=n.getTime()-o;if(s<1){clearInterval(i);return}let f=Math.floor(s/(1e3*60*60*24)),h=Math.floor(s%(1e3*60*60*24)/(1e3*60*60)),_=Math.floor(s%(1e3*60*60)/(1e3*60)),g=Math.floor(s%(1e3*60)/1e3);r({days:f,hours:h,minutes:_,seconds:g})},1e3);return i}};var Bn=class extends Me{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t),this.gap=t.gap,this.timerType=t.type,this.timer=new gr(t.timer),this.show=t.show??{day:!0,hour:!0,minute:!0,second:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}};var Un=class{txt;c;constructor(t){t??={},this.txt=t.txt,this.c=new It(t.c??{})}get text(){return this.txt}get color(){return this.c}};var Fe=class extends Me{ph;constructor(t){super(t),this.ph=new Un(t.ph)}get placeholderText(){return this.ph.text}get placeholderColor(){return this.ph.color.rgba}};var Mn=class extends Fe{constructor(t){t??={},super(t)}};var Fn=class extends Fe{};var kn=class extends Fe{};var $n=class extends qe{};var ve=(function(e){return e[e.NONE=0]="NONE",e[e.STATIC=1]="STATIC",e[e.UNIQUE_FLAT=2]="UNIQUE_FLAT",e[e.UNIQUE_FLAT_ITEMS=3]="UNIQUE_FLAT_ITEMS",e[e.UNIQUE_FIXED_ITEMS=4]="UNIQUE_FIXED_ITEMS",e[e.UNIQUE_CHEAPEST_ITEM_FREE=5]="UNIQUE_CHEAPEST_ITEM_FREE",e[e.BXGY=6]="BXGY",e})(ve||{});var zr=(function(e){return e[e.SINGLE=1]="SINGLE",e[e.EXCLUSION=2]="EXCLUSION",e[e.ABTESTING=3]="ABTESTING",e})(zr||{});var _o=(function(e){return e[e.NONE=0]="NONE",e[e.ITEM=1]="ITEM",e[e.COLLECTION=2]="COLLECTION",e})(_o||{});var Pf=(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})(Pf||{}),we=(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})(we||{});var Ut=(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})(Ut||{}),Jr=(function(e){return e.POPUP="POPUP",e.PAGE_EMBED="PAGE_EMBED",e.CART_EMBED="CART_EMBED",e.ANNOUNCEMENT_BAR="ANNOUNCEMENT_BAR",e})(Jr||{}),re=(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})(re||{}),Xr=(function(e){return e.COOEE="COOEE",e.KLAVIYO="KLAVIYO",e})(Xr||{}),vo=(function(e){return e.ICONS="ICONS",e.TILES="TILES",e})(vo||{}),Lf=(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})(Lf||{});var ze=class e{static of(t,r){return r!==void 0?new Array(t).fill(r):Array.from({length:t},(n,i)=>i)}static remove(t,r){let n=t.indexOf(r);return n===-1?!1:(t.splice(n,1),!0)}static swap(t,r,n){[t[r],t[n]]=[t[n],t[r]]}static sum(t,r){return t.reduce((n,i)=>n+Math.max(r?r(i):+i,0),0)}static unique(t,r){return t.filter((n,i,o)=>o.findIndex(s=>s[r]===n[r])===i)}static shuffle(t){let r=t.length;for(;r!=0;){let n=Math.floor(Math.random()*r);r--,e.swap(t,r,n)}}};var oa=(()=>{class e{static toTitle(r){return r?this.titleCase(r.toLowerCase().split(/[_-]+/).join(" ")):""}static toSlug(r){return r?r.toLowerCase().replace(/[_-]+/," ").replace(/[^\w ]+/g,"").replace(/ +/g,"-"):""}static toCamelCase(r){return r.toLowerCase().split(" ").map((n,i)=>i===0?n:n.charAt(0).toUpperCase()+n.slice(1)).join("")}static format(r,...n){return r?.replace(/{(\d+)}/g,(i,o)=>{let s=n[o];return s!==void 0?s:i})}static chop(r,n){if(!(!r||!n))return r.length<=n?r:r.substring(0,n)}static titleCase=r=>r.replace(/(^|\s)\S/g,n=>n.toUpperCase())}return e})();var Vn=class{applyDiscountOnMinimum;constructor(t){this.applyDiscountOnMinimum=t.applyDiscountOnMinimum}};var jn=class{modifications;constructor(t={}){t.modifications?.length?this.modifications=t.modifications.map(r=>new Hn(r)):t.experiments?.length&&(this.modifications=t.experiments.map(r=>new Hn(r)))}};var Hn=class{cssSelector;type;display;bg;typo;br;text;image;moveTo;constructor(t={}){this.cssSelector=t.cssSelector??"",this.type=t.type??"OTHER",this.display=t.display,t.bg&&(this.bg=new It(t.bg)),t.typo&&(this.typo=new he(t.typo)),t.br&&(this.br=new De(t.br)),this.text=t.text,this.image=t.image,this.moveTo=t.moveTo}get style(){let t={};return this.br?.r&&(t.borderRadius=this.br.r+"px"),this.br?.w&&(t.borderWidth=this.br.w+"px"),this.br?.s&&(t.borderStyle=An[this.br.s]?.toLowerCase()),this.br?.c?.h&&(t.borderColor=this.br.color?.rgba),this.bg?.h&&(t.backgroundColor=this.bg.rgba),this.type==="TEXT"&&this.typo&&(this.typo.fs&&(t.fontSize=this.typo.fs+"px"),this.typo.lh&&(t.lineHeight=this.typo.lh),this.typo.fw&&(t.fontWeight=this.typo.fw),this.typo.ta&&(t.textAlign=this.typo.alignment),this.typo.tc.h&&(t.color=this.typo.tc.rgba),this.typo.ls&&(t.letterSpacing=this.typo.letterSpacing),this.typo.td&&(t.textDecoration=this.typo.td??"none")),t}toString(){return`Experiment(cssSelector=${this.cssSelector})`}};var be=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 wo=class{minValue;rewardType;label;reachingText;reachedText;discount;items;isUIOnly;allowATC;reached;calculatedAlignment;constructor(t){this.reached=t.reached??!1,this.calculatedAlignment=t.calculatedAlignment,this.minValue=t.minValue,this.rewardType=t.rewardType,this.label=t.label,this.reachingText=t.reachingText,this.reachedText=t.reachedText,this.discount=t.discount,this.items=t.items?.map(r=>new be(r)),this.isUIOnly=t.isUIOnly,this.allowATC=t.allowATC}};var Wn=class{layout;milestones;totalProgress;coupons;reachedAmountOrCount;onlyLatestGift;noConfetti;removeIneligibleItem;restrictToLatestFreebie;rewardBasis;constructor(t){this.layout=t.layout??vo.ICONS,this.onlyLatestGift=t.onlyLatestGift,this.noConfetti=t.noConfetti,this.removeIneligibleItem=t.removeIneligibleItem??!0,this.restrictToLatestFreebie=t.restrictToLatestFreebie,this.rewardBasis=t.rewardBasis??"CART_AMOUNT",this.update(t)}update(t){t=t??{},this.milestones=t.milestones?.map(r=>new wo(r))??[],this.totalProgress=t.totalProgress??0,this.coupons=t.coupons,this.reachedAmountOrCount=t.reachedAmountOrCount}};var Gn=class{animateNumber;animationDuration;text;iconURL;animation;totalSavings;constructor(t={}){this.animateNumber=t.animateNumber??!0,this.animation=t.animation??"SLOT_MACHINE",this.animationDuration=t.animationDuration??1e3,this.text=t.text??"You are saving {{ cart.total_savings }} on this order",this.iconURL=t.iconURL,this.totalSavings=t.totalSavings??0}};var Jn,mt,fa,So,Je,sa,la,pa,ha,Io,bo,Eo,Bf,Kr={},ma=[],Uf=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Xn=Array.isArray;function Pe(e,t){for(var r in t)e[r]=t[r];return e}function xo(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Mf(e,t,r){var n,i,o,s={};for(o in t)o=="key"?n=t[o]:o=="ref"?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Jn.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return qn(e,s,n,i,null)}function qn(e,t,r,n,i){var o={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++fa,__i:-1,__u:0};return i==null&&mt.vnode!=null&&mt.vnode(o),o}function Kn(e){return e.children}function yr(e,t){this.props=e,this.context=t}function _r(e,t){if(t==null)return e.__?_r(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?_r(e):null}function da(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return da(e)}}function aa(e){(!e.__d&&(e.__d=!0)&&Je.push(e)&&!zn.__r++||sa!=mt.debounceRendering)&&((sa=mt.debounceRendering)||la)(zn)}function zn(){for(var e,t,r,n,i,o,s,f=1;Je.length;)Je.length>f&&Je.sort(pa),e=Je.shift(),f=Je.length,e.__d&&(r=void 0,i=(n=(t=e).__v).__e,o=[],s=[],t.__P&&((r=Pe({},n)).__v=n.__v+1,mt.vnode&&mt.vnode(r),To(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[i]:null,o,i??_r(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,_a(o,r,s),r.__e!=i&&da(r)));zn.__r=0}function ga(e,t,r,n,i,o,s,f,h,_,g){var d,E,v,T,A,B,F=n&&n.__k||ma,G=t.length;for(h=Ff(r,t,F,h,G),d=0;d<G;d++)(v=r.__k[d])!=null&&(E=v.__i==-1?Kr:F[v.__i]||Kr,v.__i=d,B=To(e,v,E,i,o,s,f,h,_,g),T=v.__e,v.ref&&E.ref!=v.ref&&(E.ref&&Oo(E.ref,null,v),g.push(v.ref,v.__c||T,v)),A==null&&T!=null&&(A=T),4&v.__u||E.__k===v.__k?h=ya(v,h,e):typeof v.type=="function"&&B!==void 0?h=B:T&&(h=T.nextSibling),v.__u&=-7);return r.__e=A,h}function Ff(e,t,r,n,i){var o,s,f,h,_,g=r.length,d=g,E=0;for(e.__k=new Array(i),o=0;o<i;o++)(s=t[o])!=null&&typeof s!="boolean"&&typeof s!="function"?(h=o+E,(s=e.__k[o]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?qn(null,s,null,null,null):Xn(s)?qn(Kn,{children:s},null,null,null):s.constructor==null&&s.__b>0?qn(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,f=null,(_=s.__i=kf(s,r,h,d))!=-1&&(d--,(f=r[_])&&(f.__u|=2)),f==null||f.__v==null?(_==-1&&(i>g?E--:i<g&&E++),typeof s.type!="function"&&(s.__u|=4)):_!=h&&(_==h-1?E--:_==h+1?E++:(_>h?E--:E++,s.__u|=4))):e.__k[o]=null;if(d)for(o=0;o<g;o++)(f=r[o])!=null&&(2&f.__u)==0&&(f.__e==n&&(n=_r(f)),wa(f,f));return n}function ya(e,t,r){var n,i;if(typeof e.type=="function"){for(n=e.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=e,t=ya(n[i],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=_r(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function kf(e,t,r,n){var i,o,s=e.key,f=e.type,h=t[r];if(h===null&&e.key==null||h&&s==h.key&&f==h.type&&(2&h.__u)==0)return r;if(n>(h!=null&&(2&h.__u)==0?1:0))for(i=r-1,o=r+1;i>=0||o<t.length;){if(i>=0){if((h=t[i])&&(2&h.__u)==0&&s==h.key&&f==h.type)return i;i--}if(o<t.length){if((h=t[o])&&(2&h.__u)==0&&s==h.key&&f==h.type)return o;o++}}return-1}function ca(e,t,r){t[0]=="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||Uf.test(t)?r:r+"px"}function Yn(e,t,r,n,i){var o,s;t:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||ca(e.style,t,"");if(r)for(t in r)n&&r[t]==n[t]||ca(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(ha,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=r,r?n?r.u=n.u:(r.u=Io,e.addEventListener(t,o?Eo:bo,o)):e.removeEventListener(t,o?Eo:bo,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r??"";break t}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function ua(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.t==null)t.t=Io++;else if(t.t<r.u)return;return r(mt.event?mt.event(t):t)}}}function To(e,t,r,n,i,o,s,f,h,_){var g,d,E,v,T,A,B,F,G,D,W,it,j,K,X,Z,dt,at=t.type;if(t.constructor!=null)return null;128&r.__u&&(h=!!(32&r.__u),o=[f=t.__e=r.__e]),(g=mt.__b)&&g(t);t:if(typeof at=="function")try{if(F=t.props,G="prototype"in at&&at.prototype.render,D=(g=at.contextType)&&n[g.__c],W=g?D?D.props.value:g.__:n,r.__c?B=(d=t.__c=r.__c).__=d.__E:(G?t.__c=d=new at(F,W):(t.__c=d=new yr(F,W),d.constructor=at,d.render=Vf),D&&D.sub(d),d.props=F,d.state||(d.state={}),d.context=W,d.__n=n,E=d.__d=!0,d.__h=[],d._sb=[]),G&&d.__s==null&&(d.__s=d.state),G&&at.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Pe({},d.__s)),Pe(d.__s,at.getDerivedStateFromProps(F,d.__s))),v=d.props,T=d.state,d.__v=t,E)G&&at.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),G&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(G&&at.getDerivedStateFromProps==null&&F!==v&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(F,W),!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(F,d.__s,W)===!1||t.__v==r.__v){for(t.__v!=r.__v&&(d.props=F,d.state=d.__s,d.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(ut){ut&&(ut.__=t)}),it=0;it<d._sb.length;it++)d.__h.push(d._sb[it]);d._sb=[],d.__h.length&&s.push(d);break t}d.componentWillUpdate!=null&&d.componentWillUpdate(F,d.__s,W),G&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(v,T,A)})}if(d.context=W,d.props=F,d.__P=e,d.__e=!1,j=mt.__r,K=0,G){for(d.state=d.__s,d.__d=!1,j&&j(t),g=d.render(d.props,d.state,d.context),X=0;X<d._sb.length;X++)d.__h.push(d._sb[X]);d._sb=[]}else do d.__d=!1,j&&j(t),g=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++K<25);d.state=d.__s,d.getChildContext!=null&&(n=Pe(Pe({},n),d.getChildContext())),G&&!E&&d.getSnapshotBeforeUpdate!=null&&(A=d.getSnapshotBeforeUpdate(v,T)),Z=g,g!=null&&g.type===Kn&&g.key==null&&(Z=va(g.props.children)),f=ga(e,Xn(Z)?Z:[Z],t,r,n,i,o,s,f,h,_),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),B&&(d.__E=d.__=null)}catch(ut){if(t.__v=null,h||o!=null)if(ut.then){for(t.__u|=h?160:128;f&&f.nodeType==8&&f.nextSibling;)f=f.nextSibling;o[o.indexOf(f)]=null,t.__e=f}else for(dt=o.length;dt--;)xo(o[dt]);else t.__e=r.__e,t.__k=r.__k;mt.__e(ut,t,r)}else o==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):f=t.__e=$f(r.__e,t,r,n,i,o,s,h,_);return(g=mt.diffed)&&g(t),128&t.__u?void 0:f}function _a(e,t,r){for(var n=0;n<r.length;n++)Oo(r[n],r[++n],r[++n]);mt.__c&&mt.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){mt.__e(o,i.__v)}})}function va(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:Xn(e)?e.map(va):Pe({},e)}function $f(e,t,r,n,i,o,s,f,h){var _,g,d,E,v,T,A,B=r.props,F=t.props,G=t.type;if(G=="svg"?i="http://www.w3.org/2000/svg":G=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(_=0;_<o.length;_++)if((v=o[_])&&"setAttribute"in v==!!G&&(G?v.localName==G:v.nodeType==3)){e=v,o[_]=null;break}}if(e==null){if(G==null)return document.createTextNode(F);e=document.createElementNS(i,G,F.is&&F),f&&(mt.__m&&mt.__m(t,o),f=!1),o=null}if(G==null)B===F||f&&e.data==F||(e.data=F);else{if(o=o&&Jn.call(e.childNodes),B=r.props||Kr,!f&&o!=null)for(B={},_=0;_<e.attributes.length;_++)B[(v=e.attributes[_]).name]=v.value;for(_ in B)if(v=B[_],_!="children"){if(_=="dangerouslySetInnerHTML")d=v;else if(!(_ in F)){if(_=="value"&&"defaultValue"in F||_=="checked"&&"defaultChecked"in F)continue;Yn(e,_,null,v,i)}}for(_ in F)v=F[_],_=="children"?E=v:_=="dangerouslySetInnerHTML"?g=v:_=="value"?T=v:_=="checked"?A=v:f&&typeof v!="function"||B[_]===v||Yn(e,_,v,B[_],i);if(g)f||d&&(g.__html==d.__html||g.__html==e.innerHTML)||(e.innerHTML=g.__html),t.__k=[];else if(d&&(e.innerHTML=""),ga(t.type=="template"?e.content:e,Xn(E)?E:[E],t,r,n,G=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:r.__k&&_r(r,0),f,h),o!=null)for(_=o.length;_--;)xo(o[_]);f||(_="value",G=="progress"&&T==null?e.removeAttribute("value"):T!=null&&(T!==e[_]||G=="progress"&&!T||G=="option"&&T!=B[_])&&Yn(e,_,T,B[_],i),_="checked",A!=null&&A!=e[_]&&Yn(e,_,A,B[_],i))}return e}function Oo(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(i){mt.__e(i,r)}}function wa(e,t,r){var n,i;if(mt.unmount&&mt.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||Oo(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){mt.__e(o,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&wa(n[i],t,r||typeof e.type!="function");r||xo(e.__e),e.__c=e.__=e.__e=void 0}function Vf(e,t,r){return this.constructor(e,r)}function Pd(e,t,r){var n,i,o,s;t==document&&(t=document.documentElement),mt.__&&mt.__(e,t),i=(n=typeof r=="function")?null:r&&r.__k||t.__k,o=[],s=[],To(t,e=(!n&&r||t).__k=Mf(Kn,null,[e]),i||Kr,Kr,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?Jn.call(t.childNodes):null,o,!n&&r?r:i?i.__e:t.firstChild,n,s),_a(o,e,s)}Jn=ma.slice,mt={__e:function(e,t,r,n){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),s=i.__d),s)return i.__E=i}catch(f){e=f}throw e}},fa=0,So=function(e){return e!=null&&e.constructor==null},yr.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Pe({},this.state),typeof e=="function"&&(e=e(Pe({},r),this.props)),e&&Pe(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),aa(this))},yr.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),aa(this))},yr.prototype.render=Kn,Je=[],la=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,pa=function(e,t){return e.__v.__b-t.__v.__b},zn.__r=0,ha=/(PointerCapture)$|Capture$/i,Io=0,bo=ua(!1),Eo=ua(!0),Bf=0;var No,te,Co,ba,Ea=0,Ra=[],Mt=mt,Sa=Mt.__b,Ia=Mt.__r,xa=Mt.diffed,Ta=Mt.__c,Oa=Mt.unmount,Ca=Mt.__;function jf(e,t){Mt.__h&&Mt.__h(te,e,Ea||t),Ea=0;var r=te.__H||(te.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Do(e,t){var r=jf(No++,7);return Gf(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Hf(){for(var e;e=Ra.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Qn),e.__H.__h.forEach(Ro),e.__H.__h=[]}catch(t){e.__H.__h=[],Mt.__e(t,e.__v)}}Mt.__b=function(e){te=null,Sa&&Sa(e)},Mt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ca&&Ca(e,t)},Mt.__r=function(e){Ia&&Ia(e),No=0;var t=(te=e.__c).__H;t&&(Co===te?(t.__h=[],te.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(Qn),t.__h.forEach(Ro),t.__h=[],No=0)),Co=te},Mt.diffed=function(e){xa&&xa(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ra.push(t)!==1&&ba===Mt.requestAnimationFrame||((ba=Mt.requestAnimationFrame)||Wf)(Hf)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Co=te=null},Mt.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Qn),r.__h=r.__h.filter(function(n){return!n.__||Ro(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Mt.__e(n,r.__v)}}),Ta&&Ta(e,t)},Mt.unmount=function(e){Oa&&Oa(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Qn(n)}catch(i){t=i}}),r.__H=void 0,t&&Mt.__e(t,r.__v))};var Na=typeof requestAnimationFrame=="function";function Wf(e){var t,r=function(){clearTimeout(n),Na&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,35);Na&&(t=requestAnimationFrame(r))}function Qn(e){var t=te,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),te=t}function Ro(e){var t=te;e.__c=e.__(),te=t}function Gf(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}var Yf=Symbol.for("preact-signals");function Po(){if(vr>1)vr--;else{for(var e,t=!1;Qr!==void 0;){var r=Qr;for(Qr=void 0,Ao++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Aa(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(Ao=0,vr--,t)throw e}}var wt=void 0;var Qr=void 0,vr=0,Ao=0,Zn=0;function Da(e){if(wt!==void 0){var t=e.n;if(t===void 0||t.t!==wt)return t={i:0,S:e,p:wt.s,n:void 0,t:wt,e:void 0,x:void 0,r:t},wt.s!==void 0&&(wt.s.n=t),wt.s=t,e.n=t,32&wt.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=wt.s,t.n=void 0,wt.s.n=t,wt.s=t),t}}function Ft(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}Ft.prototype.brand=Yf;Ft.prototype.h=function(){return!0};Ft.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)};Ft.prototype.U=function(e){if(this.t!==void 0){var t=e.e,r=e.x;t!==void 0&&(t.x=r,e.e=void 0),r!==void 0&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r)}};Ft.prototype.subscribe=function(e){var t=this;return tn(function(){var r=t.value,n=wt;wt=void 0;try{e(r)}finally{wt=n}})};Ft.prototype.valueOf=function(){return this.value};Ft.prototype.toString=function(){return this.value+""};Ft.prototype.toJSON=function(){return this.value};Ft.prototype.peek=function(){var e=wt;wt=void 0;try{return this.value}finally{wt=e}};Object.defineProperty(Ft.prototype,"value",{get:function(){var e=Da(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Ao>100)throw new Error("Cycle detected");this.v=e,this.i++,Zn++,vr++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Po()}}}});function ne(e){return new Ft(e)}function Aa(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Pa(e){for(var t=e.s;t!==void 0;t=t.n){var r=t.S.n;if(r!==void 0&&(t.r=r),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function La(e){for(var t=e.s,r=void 0;t!==void 0;){var n=t.p;t.i===-1?(t.S.U(t),n!==void 0&&(n.n=t.n),t.n!==void 0&&(t.n.p=n)):r=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=n}e.s=r}function wr(e){Ft.call(this,void 0),this.x=e,this.s=void 0,this.g=Zn-1,this.f=4}(wr.prototype=new Ft).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Zn))return!0;if(this.g=Zn,this.f|=1,this.i>0&&!Aa(this))return this.f&=-2,!0;var e=wt;try{Pa(this),wt=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return wt=e,La(this),this.f&=-2,!0};wr.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)}Ft.prototype.S.call(this,e)};wr.prototype.U=function(e){if(this.t!==void 0&&(Ft.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)}};wr.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(wr.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Da(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Lo(e){return new wr(e)}function Ba(e){var t=e.u;if(e.u=void 0,typeof t=="function"){vr++;var r=wt;wt=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,Bo(e),n}finally{wt=r,Po()}}}function Bo(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Ba(e)}function qf(e){if(wt!==this)throw new Error("Out-of-order effect");La(this),wt=e,this.f&=-2,8&this.f&&Bo(this),Po()}function Zr(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Zr.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()}};Zr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Ba(this),Pa(this),vr++;var e=wt;return wt=this,qf.bind(this,e)};Zr.prototype.N=function(){2&this.f||(this.f|=2,this.o=Qr,Qr=this)};Zr.prototype.d=function(){this.f|=8,1&this.f||Bo(this)};function tn(e){var t=new Zr(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}var Mo,Uo;function br(e,t){mt[e]=t.bind(null,mt[e]||function(){})}function ti(e){Uo&&Uo(),Uo=e&&e.S()}function Ua(e){var t=this,r=e.data,n=Jf(r);n.value=r;var i=Do(function(){for(var o=t.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return t.__$u.c=function(){var s,f=t.__$u.S(),h=i.value;f(),So(h)||((s=t.base)==null?void 0:s.nodeType)!==3?(t.__$f|=1,t.setState({})):t.base.data=h},Lo(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return i.value}Ua.displayName="_st";Object.defineProperties(Ft.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Ua},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});br("__b",function(e,t){if(typeof t.type=="string"){var r,n=t.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof Ft&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});br("__r",function(e,t){ti();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=(function(i){var o;return tn(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o})())),Mo=n,ti(r),e(t)});br("__e",function(e,t,r,n){ti(),Mo=void 0,e(t,r,n)});br("diffed",function(e,t){ti(),Mo=void 0;var r;if(typeof t.type=="string"&&(r=t.__e)){var n=t.__np,i=t.props;if(n){var o=r.U;if(o)for(var s in o){var f=o[s];f!==void 0&&!(s in n)&&(f.d(),o[s]=void 0)}else r.U=o={};for(var h in n){var _=o[h],g=n[h];_===void 0?(_=zf(r,h,g,i),o[h]=_):_.o(g,i)}}}e(t)});function zf(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=ne(r);return{o:function(s,f){o.value=s,n=f},d:tn(function(){var s=o.value.value;n[t]!==s&&(n[t]=s,i?e[t]=s:s?e.setAttribute(t,s):e.removeAttribute(t))})}}br("unmount",function(e,t){if(typeof t.type=="string"){var r=t.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var s=t.__c;if(s){var f=s.__$u;f&&(s.__$u=void 0,f.d())}}e(t)});br("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});yr.prototype.shouldComponentUpdate=function(e,t){var r=this.__$u,n=r&&r.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!=="__source"&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Jf(e){return Do(function(){return ne(e)},[])}var ei=class{url;alt;constructor(t){t.alt&&(this.alt=t.alt),this.url=t.url}};var ri=class{d;cmp;effective;constructor(t={}){this.d=t.d,this.cmp=t.cmp,this.effective=this.d}};var Fo=class{id;mID;name;groupID;groupName;isSelected;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.name=t.name,this.groupID=t.groupID,this.groupName=t.groupName,this.isSelected=t.isSelected??!1}},Er=class{mID;name;imgs;link;price;sku;isAvailable;quantity;sellingPlans;selectedOptions;selectedSellingPlan;effectivePrice;constructor(t){t=t??{},this.mID=t.mID,this.name=t.name,this.imgs=t.imgs?.map(r=>new ei(r))??[],this.link=t.link,this.price=new ri(t.price),this.sku=t.sku,this.isAvailable=t.isAvailable,this.quantity=t.quantity,this.selectedOptions=t.selectedOptions??[],this.effectivePrice=ne(this.price.effective),t.sellingPlans?.length&&(this.selectedSellingPlan=ne(void 0)),this.sellingPlans=t.sellingPlans?.map(r=>{let n=new Fo(r);return n.isSelected&&(this.selectedSellingPlan.value=n),n})}getOneImage(){return this.imgs[0]?.url}changeSellingPlan(t){this.selectedSellingPlan.value=t}hasEffectivePrice(){return this.effectivePrice.value!==this.price.d}};function ko(e,t){for(let r of e){let n=t.get(r.attr),i=Array.isArray(n),o=typeof n=="string",s=typeof n=="number"&&typeof r.value=="number",f=Array.isArray(r.value),h=!0;switch(r.op){case"contains":{h=(i||o)&&n.includes(r.value);break}case"notContains":{h=(i||o)&&!n.includes(r.value);break}case"eq":{h=n===r.value;break}case"ne":{h=n!==r.value;break}case"gt":{h=s&&n>r.value;break}case"gte":{h=s&&n>=r.value;break}case"lt":{h=s&&n<r.value;break}case"lte":{h=s&&n<=r.value;break}case"in":{h=f&&r.value.includes(n);break}case"nin":{h=f&&!r.value.includes(n);break}case"between":{h=s&&f&&r.value.length===2&&n>=r.value[0]&&n<=r.value[1];break}case"all":{h=i&&f&&r.value.every(_=>n.includes(_));break}default:{h=!1;break}}if(!h)return!1}return!0}var ie=class{id;mID;name;options;imgs;vars;desc;link;slug;quantity;category;meta;reviews;tags;templateSuffix;selectedOrFirstVariant;selected=ne(!0);_showAddToCartButton;constructor(t){this.update(t),this.selectedOrFirstVariant=ne(this.selectedVariant),this._showAddToCartButton=this.evaluateShowATCFlag()}get firstImageURL(){return this.imgs?.[0]?.url}get secondaryImageURL(){return this.imgs?.[1]?.url}get getVariantImages(){return this.selectedOrFirstVariant.value.imgs}get variantImage(){return this.getVariantImages[0]?.url}get variantSecondaryImage(){return this.getVariantImages[1]?.url}get showAddToCartButton(){return this._showAddToCartButton}set variants(t){this.vars=t,this.selectedOrFirstVariant.value=this.selectedVariant}get selectedVariant(){return this.vars.find(t=>t.isAvailable)??this.vars[0]}hasVariants(){return this.vars?.length>1}setSelectedVariant(t){this.selectedOrFirstVariant.value=t}setSelectedVariantByID(t){if(!t)return;let r=this.vars.find(n=>n.mID===t.toString());r&&this.setSelectedVariant(r)}update(t){return this.id=t.id??this.id,this.mID=t.mID??this.mID,this.name=t.name??this.name,this.imgs=t.imgs??this.imgs,this.desc=t.desc??this.desc,this.link=t.link??this.link,this.slug=t.slug??this.slug,this.quantity=t.quantity??this.quantity,this.meta=t.meta??this.meta,this.category=t.category??this.category,this.reviews=t.reviews??this.reviews,this.options=t.options??this.options,this.tags=t.tags??this.tags,this.templateSuffix=t.templateSuffix??this.templateSuffix,t.vars&&(this.vars=t.vars.map(r=>new Er(r))),this}toEmbed(t){return t=t??this.selectedOrFirstVariant.value,new be({id:this.id,mID:this.mID,vID:t.mID,vName:t.name,name:this.name,link:this.link,slug:this.slug,price:t.price.d,imageURL:t.getOneImage()??this.imgs?.[0].url})}getTemplateVariables(){let t=this.selectedOrFirstVariant.value,r=t.price,n=this.name,i=this.category,o=this.variantImage??this.firstImageURL,s=this.meta,f=this.tags?.join(",")??"",h=this.reviews?.rating,_=this.reviews?.totalReviews,g=r.cmp&&r.cmp>r.d,d=Gt(J({name:n},Qt("price",r.d,!0)),{image_url:o,meta:s,category:i,rating:h,reviews:_,tags:f});if(t.hasEffectivePrice()){let v=Qt("effective_price",t.effectivePrice.value,!0);Object.assign(d,v)}if(g){let v=r.cmp-r.d,T={discount_percent:(v/r.cmp*100).toFixed(0)};Object.assign(d,T),Object.assign(d,Qt("compare_price",r.cmp)),Object.assign(d,Qt("discount_price",v))}let E={name:t.name,quantity:t.quantity};return{product:d,variant:E}}evaluateShowATCFlag(){let t=Wt.get().widgetCustomisation?.atcButton?.showWhen;if(!t?.predicates?.length)return!0;let r=t.predicates,n=this.getValueMap(r);return t.op==="or"?r.some(i=>ko([i],n)):ko(r,n)}getValueMap(t){let r=new Map;for(let n of t){let i=n.attr.split(".");switch(i[1]){case"tags":{r.set(n.attr,this.tags);break}case"type":case"category":{r.set(n.attr,this.category);break}case"meta":case"metafield":{let s=i[2];if(!s)continue;r.set(n.attr,this.meta?.[s]);break}}}return r}};var ni=class{id;alt;shortID;sources;items;durationMS;thumbnail;card;bestSource;highSource;goodSource;lowSource;m3u8Source;constructor(t={}){if(this.id=t.id,this.alt=t.alt,this.shortID=t.shortID,this.sources=t.sources?.sort((r,n)=>n.height-r.height),this.durationMS=t.durationMS,this.thumbnail=t.thumbnail,this.items=t.items?t.items.map(r=>new ie(r)):[],this.card=t.card,this.sources){let r=[];for(let n of this.sources)n.format==="mp4"?r.push(n):n.format==="m3u8"&&!this.m3u8Source&&(this.m3u8Source=n);r.length>0&&(this.bestSource=r[0],this.highSource=r.length>1?r[1]:r[0],this.lowSource=r.length>2?r[r.length-1]:r[0])}}};var ii=class{videos;source;template;heading;autoPlay;showMuteButton;footerContent;detailPopup;playlistConfig;itemDetailConfig;constructor(t={}){this.videos=t.videos?.map(r=>new ni(r))??[],this.source=t.source,this.template=t.template,this.detailPopup=t.detailPopup??{template:"VIDEO_ONLY_VIEW"},this.heading=t.heading,this.showMuteButton=t.showMuteButton,this.autoPlay=t.autoPlay??"ON",this.footerContent=t.footerContent??"FIRST_ITEM",this.playlistConfig={videoSwiper:t.playlistConfig?.videoSwiper??void 0,itemCardClickBehavior:t.playlistConfig?.itemCardClickBehavior??"OPEN_VIDEO_DETAIL"},this.itemDetailConfig={template:t.itemDetailConfig?.template??"CLASSIC"}}showItems(){return this.footerContent==="FIRST_ITEM"||this.footerContent==="ITEM_SWIPER"}};var qt=Oe($o());qt.filters.define("default",function(e){return typeof e>"u"||e==null?"":Kf(e)});+qt.filters.define("max",(e,t)=>{let r=Number(e),n=Number(t);return isNaN(r)||isNaN(n)?e:r>n?t:e});qt.filters.define("min",(e,t)=>{let r=Number(e),n=Number(t);return isNaN(r)||isNaN(n)?e:r<n?t:e});qt.filters.define("fallback",(e,t)=>e==null||e===""?t:e);qt.filters.define("manipulate_quantity",(e,t,r)=>{if(t??=1,r??=100,t>r)return R.error("Invalid range: min should be less than or equal to max."),e;if(e>=t&&e<=r)return e;let n=e%r;return n<t?t:n});qt.filters.define("apply_discount_perc",(e,t,r=1/0)=>{if(e=+e,isNaN(e))return R.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(t<0||t>100)return R.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let n=e*t/100;return e-Math.min(r,n)});qt.filters.define("apply_discount_fixed",(e,t)=>(e=+e,isNaN(e)?(R.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,e-t)));qt.filters.define("currency",e=>(e=+e,isNaN(e)?(R.error("Need value as a number for `currency` filter"),NaN):po(e)));qt.filters.define("split",(e,t,r)=>{if(typeof e!="string")return R.error("Need value as a string for `split` filter"),"";if(t==null)return R.error("Need delimiter for `split` filter"),"";if(r==null||isNaN(Number(r)))return R.error("Need a valid index for `split` filter"),"";let n=e.split(String(t)),i=Number(r),o=i<0?n.length+i:i;return n[o].trim()??""});qt.defaultConfig.defaultFilter="default";qt.defaultConfig.useWith=!0;qt.defaultConfig.autoEscape=!1;var Xf={'"':""","\\":"\","\n":"\\n"," ":"\\t"};function Kf(e){return String(e).replace(/["\\\n\t]/g,t=>Xf[t])}function Qf(e){if(!e)return"";let t=/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g;return e.replace(t,(r,n,i,o)=>`{{ ${(i||o||"").trim()} }}`)}var Vo=(e,t,r)=>{t=J({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},t);try{return qt.render(Qf(e),t)}catch(n){throw vt(n,"squirrelly-render",{extra:{template:e,values:t},triggerContext:r}),n}},vg=(e,t,r)=>{let n=JSON.stringify(e),i=Vo(n,t,r);try{return JSON.parse(i)}catch(o){throw vt(o,"variable-replacement",{extra:{before:e,after:i},triggerContext:r}),o}};function en(){return!!window.Shopify}function Fa(){if(en())return window.Shopify.shop?.split(".")?.[0]}function ka(e){let n=(e.includes("://")?new URL(e).pathname:e).match(/\/products\/([^/]+?)(?:\.html)?$/);return n?n[1]:null}function Sr(e){return(window.Shopify?.routes?.root??"/")+e.substring(1)}function si(e){return Sr(e+"?from=cooee")}var yt=class e{static CURRENT;token;items=[];total_price=0;original_total_price=0;items_subtotal_price=0;currency;item_count=0;attributes;cart_level_discount_applications;discount_codes;total_discount=0;constructor(){}static getCurrent(){return this.CURRENT||(this.CURRENT=new e),this.CURRENT}async getNormalisedCart(t){return Zf(t)}getCooeeCart(){return jo()}update(t){return this.token=t.token,this.items=t.items,this.total_price=t.total_price,this.original_total_price=t.original_total_price,this.items_subtotal_price=t.items_subtotal_price,this.currency=t.currency,this.item_count=t.item_count,this.attributes=t.attributes,this.cart_level_discount_applications=t.cart_level_discount_applications,this.discount_codes=t.discount_codes,this.total_discount=t.total_discount,St().currencyCode=this.currency,R.verbose("Updated ShopifyCart",this),this}toString(){return`ShopifyCart(token: ${this.token}, itemCount: ${this.item_count})`}};async function Zf(e){let t=yt.getCurrent();await el(t,e);let r=$a(t);return e&&await Bt.set("cart",r),r}function jo(){return $a(yt.getCurrent())}function $a(e){return{amount:e.total_price/100,originalAmount:e.original_total_price/100,itemsSubtotalPrice:e.items_subtotal_price/100,currency:e.currency,itemCount:e.item_count,items:tl(e.items),token:e.token}}function tl(e){if(!e)return R.error("No item received to be sent"),[];Array.isArray(e)||(e=[e]);let t=[];for(let r of e){if(!r.id||!r.title){R.warn("Invalid item received",r);continue}let n={name:r.title,quantity:+r.quantity||1,mID:r.product_id?.toString(),vID:r.id.toString(),price:+r.price/100||0,finalPrice:+r.final_price/100||0,properties:r.properties,key:r.key},i=r.selling_plan_allocation?.selling_plan;if(!i){t.push(n);continue}n.sellingPlanAllocation={sellingPlan:{fixedSellingPlan:i.fixed_selling_plan,id:i.id,name:i.name,recurringDeliveries:i.recurring_deliveries}},t.push(n)}return t}async function el(e,t){if(!t&&e.token){R.verbose("Not fetching cart");return}R.verbose("Fetching cart");let r=si("/cart.js");try{let n=(await Ne(r)).data;e.update(n)}catch(n){R.error("Unable to fetch the cart",n)}}var ai=class{id;mID;handle;title;imageURL;constructor(t){t??={},this.id=t.id,this.mID=t.mID,this.handle=t.handle,this.title=t.title,this.imageURL=t.imageURL}};var Ho=class{enabled;constructor(t){this.enabled=t.enabled}},Wo=class extends Ho{max;min;constructor(t){t??={},super(t),this.min=t.min,this.max=t.max}},ci=class{productQuantity;constructor(t){t??={},this.productQuantity=new Wo(t.productQuantity)}};var ui=class extends Zt{o;constructor(t){super(t),this.o=t.o??5,this.w=this.w??1080,this.h=this.h??1920}getOrigin(){return this.o}};var fi=class{en;ex;constructor(t){t=t??{},this.en=t.en,this.ex=t.ex}getEnterAnimation(){switch(this.en){case 2:return[{transform:"translateY(-100%)"},{transform:"translateY(0%)"}];case 3:return[{transform:"translateY(100%)"},{transform:"translateY(0%)"}];case 4:return[{transform:"translateX(-100%)"},{transform:"translateX(0%)"}];case 5:return[{transform:"translateX(100%)"},{transform:"translateX(0%)"}];case 6:return[{transform:"translate(-100%, -100%)"},{transform:"translate(0%, 0%)"}];case 7:return[{transform:"translate(100%, -100%)"},{transform:"translate(0%, 0%)"}];case 8:return[{transform:"translate(-100%, 100%)"},{transform:"translate(0%, 0%)"}];case 9:return[{transform:"translate(100%, 100%)"},{transform:"translate(0%, 0%)"}];case 10:return[{transform:"scale(0.1)"},{transform:"scale(1)"}];default:return[]}}getExitAnimation(){switch(this.ex){case 2:return[{transform:"translateY(0%)"},{transform:"translateY(-100%)"}];case 3:return[{transform:"translateY(0%)"},{transform:"translateY(100%)"}];case 4:return[{transform:"translateX(0%)"},{transform:"translateX(-100%)"}];case 5:return[{transform:"translateX(0%)"},{transform:"translateX(100%)"}];case 6:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, -100%)"}];case 7:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, -100%)"}];case 8:return[{transform:"translate(0%, 0%)"},{transform:"translate(-100%, 100%)"}];case 9:return[{transform:"translate(0%, 0%)"},{transform:"translate(100%, 100%)"}];case 10:return[{transform:"scale(1)"},{transform:"scale(0)"}];default:return[]}}};var li=15,rn=class extends Zt{gvt;max;cover;anim;embedded;constructor(t){t=t??{},super(t),this.gvt=t.gvt??5,this.max=t.max,this.cover=t.cover??!0,this.anim=new fi(t.anim),this.spc||(this.spc=new Ae({pl:li,pr:li,pt:li,pb:li}))}};var pi=class extends rn{cont;elems=[];mob;constructor(t){t=t??{},super(t),this.cont=new ui(t.cont),this.mob=new rn(t.mob),this.bg||(this.bg=this.cont.bg,delete this.cont.bg),t.elems.forEach(r=>{r.t===1?this.elems.push(new qe(r)):r.t===2?this.elems.push(new dr(r)):r.t===3?this.elems.push(new dr(r)):r.t===100?this.elems.push(new qr(r)):r.t===51?this.elems.push(new Fn(r)):r.t===52?this.elems.push(new kn(r)):r.t===61?this.elems.push(new Bn(r)):r.t===15||r.t===16?this.elems.push(new Mn(r)):r.t===13&&this.elems.push(new $n(r))})}getStylesForWrapper(){if(this.cover)return{};let t;return this.gvt===1?t={top:0,left:0}:this.gvt===2?t={top:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===3?t={top:0,right:0}:this.gvt===6?t={top:"50%",right:0,transform:"translateY(-50%)"}:this.gvt===9?t={bottom:0,right:0}:this.gvt===8?t={bottom:0,left:"50%",transform:"translateX(-50%)"}:this.gvt===7?t={bottom:0,left:0}:this.gvt===4?t={top:"50%",left:0,transform:"translateY(-50%)"}:t={top:"50%",left:"50%",transform:"translateX(-50%) translateY(-50%)"},t.overflow="visible",t}getFlexStylesForContainer(){let t={display:"flex",flexDirection:"row"},r,n;return this.gvt===1?(r="flex-start",n="flex-start"):this.gvt===2?(r="center",n="flex-start"):this.gvt===3?(r="flex-end",n="flex-start"):this.gvt===4?(r="flex-start",n="center"):this.gvt===6?(r="flex-end",n="center"):this.gvt===7?(r="flex-start",n="flex-end"):this.gvt===8?(r="center",n="flex-end"):this.gvt===9?(r="flex-end",n="flex-end"):(r="center",n="center"),t.alignItems=n,t.justifyContent=r,t.overflow="visible",t}overrideForMobileView(){this.max=this.mob.max??this.max,this.cover=this.mob.cover??this.cover,this.gvt=this.mob.gvt??this.gvt,this.bg=this.mob.bg??this.bg,this.spc=this.mob.spc??this.spc,this.anim=this.mob.anim??this.anim}};var hi=class{gap;dir;wrap;jc;ai;scroll;constructor(t){t??={},this.gap=t.gap??0,this.dir=t.dir??"row",this.wrap=t.wrap??"nowrap",this.jc=t.jc??"flex-start",this.ai=t.ai??"flex-start",this.scroll=t.scroll}};var mi=class{of;disp;pos;top;bottom;left;right;zIndex;constructor(t){t??={},this.of=t.of,this.disp=t.disp,this.pos=t.pos,this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right,this.zIndex=t.zIndex}};var di=class{w;h;maxW;maxH;minW;minH;constructor(t){t??={},this.w=t.w??"100%",this.h=t.h??"auto",this.maxW=t.maxW,this.maxH=t.maxH,this.minW=t.minW,this.minH=t.minH}};var gi=class{size;bg;br;spc;typo;lout;flex;constructor(t){t??={},this.spc=new Ae(t.spc),t.size&&(this.size=new di(t.size)),t.bg&&(this.bg=new Ye(t.bg)),t.br&&(this.br=new De(t.br)),t.typo&&(this.typo=new he(t.typo)),t.lout&&(this.lout=new mi(t.lout)),t.flex&&(this.flex=new hi(t.flex))}},Ir=class{sm;lg;constructor(t){t??={},this.sm=new gi(t.sm),this.lg=new gi(t.lg)}};var $t=class{t;style;hide;when;clc;l;constructor(t,r){r??={},this.t=t,this.style=new Ir(r.style),this.hide=r.hide,this.l=r.l,r.when?.op&&(this.when=r.when),r.clc&&(this.clc=r.clc)}get stringType(){return kt[this.t]}};var zt=class extends $t{text;constructor(t,r){t?.style?.lg?.typo?.s&&delete t.style.lg.typo.s,t?.style?.sm?.typo?.s&&delete t.style.sm.typo.s,super(r??2,t),t??={},this.text=t.text}};var Xe=class extends zt{constructor(t,r){super(t,r??3)}};var xr=class extends $t{value;constructor(t){super(6,t),t??={},this.value=t.value}};var Tr=class extends zt{showChips;optionsConfig;constructor(t=15,r){super(r,t),r??={},this.showChips=r.showChips??!1,this.optionsConfig=r.optionsConfig??{}}};var yi=class extends $t{c;iconSize;showSingleStar;fullStar;halfStart;constructor(t){super(19,t),t??={},this.c=new It(t.c),this.iconSize=t.iconSize??24,this.showSingleStar=t.showSingleStar??!1,this.fullStar=t.fullStar,this.halfStart=t.halfStart}};var Va=Oe(En());var Go=class{enabled;type;color;constructor(t){t??={},this.enabled=t.enabled,this.type=t.type,this.color=new It(t.color)}},Yo=class{size;enabled;color;constructor(t){t??={},this.enabled=t.enabled,this.size=t.size,this.color=new It(t.color)}},qo=class{enabled;delay;constructor(t={}){this.enabled=t.enabled,t.delay&&(this.delay=t.delay>100?t.delay:t.delay*1e3)}},Or=class{navigation;pagination;autoplay;loop;maxInRow;gap;maxInRowSm;gapSm;speed;marquee;constructor(t){t??={},this.navigation=new Yo(t.navigation),this.pagination=new Go(t.pagination),this.autoplay=new qo(t.autoplay),this.loop=t.loop??!1,this.maxInRow=t.maxInRow??4,this.gap=t.gap??0,this.maxInRowSm=t.maxInRowSm??this.maxInRow,this.gapSm=t.gapSm??this.gap,t.speed&&(this.speed=t.speed*1e3),this.marquee=t.marquee}};var _i=class extends $t{conf;slide;formData;values;allowedTypes;constructor(t){super(62,t),t&&this.update(t)}update(t){t??={},this.slide=me.getParsedElement(t.slide),this.formData=t.formData,this.values=t.values,this.conf=new Or(t.conf),this.allowedTypes=t.allowedTypes}};var vi=class extends zt{gap;timer;timerType;horizontal;lblPos;show;constructor(t){t??={},super(t,61),this.gap=t.gap,this.timerType=t.type,this.timer=new gr(t.timer),this.show=t.show??{days:!0,hours:!0,minutes:!0,seconds:!0},this.horizontal=t.horizontal,this.lblPos=t.lblPos}};var ke=class extends $t{elems;constructor(t){super(4,t),this.update(t)}update(t){t??={},this.elems??=[],t.elems?.forEach(r=>{let n=me.getParsedElement(r);n&&this.elems.push(n)})}};var Ke=class extends $t{src;sm;lg;constructor(t,r){super(r??1,t),t&&this.update(t)}update(t){this.src=t.src,this.sm=t.sm,this.lg=t.lg}};var me=class e{static getParsedElements(t){let r=[];return t?.forEach(n=>{let i=e.getParsedElement(n);i&&r.push(i)}),r}static getParsedElement(t){switch(t.t){case 2:return new zt(t);case 3:return new Xe(t);case 6:return new xr(t);case 11:return new wi(t);case 12:return new Cr(t);case 61:return new vi(t);case 4:return new ke(t);case 1:return new Ke(t);case 13:return new Ke(t,13);case 14:return new zt(t,14);case 15:case 16:return new Tr(t.t,t);case 18:return new Xe(t,18);case 62:return new _i(t);case 19:return new yi(t);default:Va.default.error("Unknown element type",t.t);return}}static parseAlignmentToJustifyContent(t){switch(t){case 1:return"center";case 2:return"flex-end";case 0:return"flex-start";default:return"flex-start"}}};var Cr=class extends $t{img;title;desc;price;compareAt;btn;variantDD;show;symbol;cBox;elems;noLinks;constructor(t){if(t??={},super(12,t),this.show=t.show,this.elems=me.getParsedElements(t.elems),this.noLinks=t.noLinks,!this.elems.length){t.cBox&&this.elems.push(new xr(t.cBox)),this.elems.push(new Ke(t.img,13));let r=new zt(t.title,14);r.hide=!t.show?.title,r.text="{{ product.name }}",this.elems.push(r);let n=new zt(t.price);n.text="{{ product.price }}",n.hide=!t.show?.price;let i=new zt(t.compareAt);i.text="{{ product.compare_price }}",i.hide=!t.show?.price,t.compareAt||(i.style=new Ir(n.style),i.style.lg.typo=new he(Gt(J({},i.style.lg.typo),{td:"line-through"})),i.style.sm.typo=new he(Gt(J({},i.style.sm.typo),{td:"line-through"})));let o=new ke({style:{lg:{spc:{mb:10},flex:{dir:"row",gap:10,ai:"center",jc:me.parseAlignmentToJustifyContent(n.style.lg.typo?.ta)}}}});o.elems.push(i),o.elems.push(n),this.elems.push(o);let s=new Tr(15,t.variantDD);if(s.hide=!t.show?.variantDD,this.elems.push(s),t.btn){let f=new Xe(t.btn,18);f.hide=!t.show?.btn,this.elems.push(f)}}t.symbol&&(this.symbol=new zt(t.symbol))}};var wi=class extends $t{conf;prod;constructor(t){super(11,t),t??={},this.conf=new zo(t.conf),this.prod=new Cr(t.prod)}};var bi=class extends Or{disp;maxItems;constructor(t){t??={},super(t),this.disp=t.disp,this.maxItems=t.maxItems}},zo=class{lg;sm;constructor(t){t??={},this.lg=new bi(t.lg),this.sm=new bi(t.sm)}};var Ei=class extends ke{constructor(t){super(t)}};var Si=class{cont;elems=[];constructor(t){t=t??{},this.cont=new Ei(t.cont),t.elems?.forEach(r=>{this.addRawElement(r)})}addRawElement(t){let r=me.getParsedElement(t);return r&&this.elems.push(r),r}};function Ii(e,t){return rl(e,t,0,5)}function rl(e,t,r=0,n=50){if(t){if(r>n){console.warn("Maximum recursion depth reached in findFirstElementOfType");return}for(let i of t){if(i.t===e)return i;let o="elems"in i?i.elems:[];if(o?.length>0){let s=Ii(e,o);if(s)return s}}}}var xi=class{title;subtitle;template;refreshPage;options;constructor(t={}){this.template=t.template??"IMAGE",this.refreshPage=t.refreshPage??!1,this.options=t.options??[],this.title=t.title,this.subtitle=t.subtitle}};var Jo=class{engagementID;shortID;contentType;delay;onsiteDeliveryType;objective;redirectBehaviour;constructor(t){this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.delay=t.delay??0,this.redirectBehaviour=t.redirectBehaviour,this.onsiteDeliveryType=t.onsiteDeliveryType,this.objective=t.objective}isAnySplit(){return this.isABTesting()||this.isExclusionTesting()}isExclusionTesting(){return this.contentType===zr.EXCLUSION}isABTesting(){return this.contentType===zr.ABTESTING}isSingleContent(){return this.contentType===zr.SINGLE}},Xo=class{videoConfig;savingsBarConfig;collectionFilterConfig;afterDeleteJS;afterRenderJS;innerCSS;outerCSS;constructor(t){this.update(t)}update(t){t??={},t.videoConfig&&(this.videoConfig=new ii(t.videoConfig)),t.savingsBarConfig&&(this.savingsBarConfig=new Gn(t.savingsBarConfig)),t.collectionFilterConfig&&(this.collectionFilterConfig=new xi(t.collectionFilterConfig)),this.afterDeleteJS=t.afterDeleteJS,this.afterRenderJS=t.afterRenderJS,this.innerCSS=t.innerCSS,this.outerCSS=t.outerCSS}},Ti=class extends Jo{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=ne({});constructor(t){if(super(t),this.id=t.id,this.currency=St().currencyCode??"USD",this.contentID=t.contentID,this.variation=t.variation,t.widget&&(this.widget=new Si(t.widget)),this.previewType=t.previewType,this.occurred=t.occurred??new Date,this.props=t.props,this.entryAnimation=t.entryAnimation??"NONE",this.embeddedItems=t.embeddedItems?.map(r=>new be(r)),this.items=t.items?.map(r=>new ie(r))??[],this.nonMutableItems=t.items?.map(r=>new ie(r))??[],this.collections=t.collections?.map(r=>new ai(r))??[],this.discount=t.discount,this.placement=t.placement,t.customerData?.name){let r=t.customerData.name.split(" ");this.customerData={name:t.customerData.name,full_name:t.customerData.name,first_name:r[0],last_name:r[1]}}this.ian=t.ian?this.processPopup(t.ian):void 0,this.promotionType=t.promotionType,this.manipulation=new ci(t.manipulation),this.contentSource=t.contentSource,this.klaviyoFormID=t.klaviyoFormID,this.hasMultiplePlacement=t.hasMultiplePlacement,this.skipSubscribedItems=t.skipSubscribedItems,this.stickyATCConfig=t.stickyATCConfig,t.experimentConfig&&(this.experimentConfig=new jn(t.experimentConfig)),t.progressBarConfig&&(this.progressBarConfig=new Wn(t.progressBarConfig)),t.bundleConfig&&(this.bundleConfig=new Vn(t.bundleConfig)),t.bundleFrom&&(this.bundleFrom=new ie(t.bundleFrom)),t.content&&(this.content=new Xo(t.content))}shouldDelay(){return this.delay>0}getDelaySeconds(){let t=new Date().getTime()-this.occurred.getTime();return this.delay*1e3-t}isBundle(){return this.objective===re.BUNDLE_AND_UPSELL}isCartEmbed(){return this.onsiteDeliveryType===Jr.CART_EMBED}isPageEmbed(){return this.onsiteDeliveryType===Jr.PAGE_EMBED}isProgressBar(){return this.objective===re.PROGRESS_BAR}isSubscriptionUpsell(){return this.objective===re.SUBSCRIPTION_UPSELL}isCartRecovery(){return this.objective===re.CART_RECOVERY}isProductPromotion(){return this.objective===re.PRODUCT_PROMOTION}isProductPromoted(){return this.isProductPromotion()||this.isBundle()||this.isCartRecovery()}isCollectionPromoted(){return this.isProductPromotion()&&this.collections.length>0&&this.promotionType===_o.COLLECTION}isBYOB(){return this.objective===re.BYOB}isStickyATC(){return this.objective===re.STICKY_ATC}isShoppableVideo(){return this.objective===re.SHOPPABLE_VIDEO}isSavingsBar(){return this.objective===re.SAVINGS_BAR}isCollectionFilter(){return this.objective===re.COLLECTION_FILTER}processPopup(t){let r=this.items[0],n={},i={};if(r){let f=r.selectedOrFirstVariant.value;n=Gt(J(J({name:r.name,id:r.mID,link:r.link,vID:f.mID,image:r.variantImage},Qt("price",f.price.d)),Qt("comparePrice",f.price.cmp)),{quantity:r.quantity}),i={quantity:f.quantity}}let o={productCount:yt.getCurrent().item_count},s=Vo(JSON.stringify(t),{product:n,variant:i,cart:o,discount:this.discount,customer:this.customerData},new Sn(new Date,this));return r&&(s=s.replace(new RegExp("https://cdn.global.letscooee.com/images/placeholders/product.png","gi"),r.variantImage??r.firstImageURL)),new pi(JSON.parse(s))}calculateDiscountData(t,r){let n=ze.sum(t,s=>s.selectedOrFirstVariant.value.price.d),i=ze.sum(t,s=>{let f=s.selectedOrFirstVariant.value.price;return f.cmp??f.d}),o={actualPrice:n,totalComparePrice:i,discountAmount:0,discountPercentage:0,discountedPrice:n};if(!t?.length||!r||!this.discount?.type){this.discountData.value=this.formatCurrencyAndNumber(o);return}if(ve.BXGY===this.discount.type&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],this.updateEffectivePrice(t,o.discountPercentage,!0),o.discountAmount=o.actualPrice-ze.sum(t,s=>s.selectedOrFirstVariant.value.effectivePrice.value);else if([ve.STATIC,ve.UNIQUE_FLAT].includes(this.discount.type)&&this.discount.values?.length)o.discountPercentage=this.discount.values[0],o.discountAmount=o.actualPrice*o.discountPercentage/100,this.updateEffectivePrice(t,o.discountPercentage);else if(ve.UNIQUE_FLAT_ITEMS===this.discount.type&&this.discount.values?.length)this.discount.ruleType==="fixed_amount"?(o.discountAmount=this.discount.values[0],o.discountPercentage=o.actualPrice>0?o.discountAmount*100/o.actualPrice:0):(o.discountPercentage=this.discount.values[0],o.discountAmount=o.actualPrice*o.discountPercentage/100),this.updateEffectivePrice(t,o.discountPercentage);else if(this.discount.type===ve.UNIQUE_FIXED_ITEMS&&this.discount.values?.length)o.discountAmount=o.actualPrice-this.discount.values[0],o.discountPercentage=o.discountAmount/o.actualPrice*100,this.updateEffectivePrice(t,o.discountPercentage);else if(this.discount.type===ve.UNIQUE_CHEAPEST_ITEM_FREE){t.sort((f,h)=>h.selectedOrFirstVariant.value.price.d-f.selectedOrFirstVariant.value.price.d);let s=t[t.length-1];s.selectedOrFirstVariant.value.effectivePrice.value=0,o.discountAmount=s.selectedOrFirstVariant.value.price.d,o.discountPercentage=o.discountAmount/o.actualPrice*100}o.discountedPrice=o.actualPrice-o.discountAmount,this.discountData.value=this.formatCurrencyAndNumber(o)}getPrivateAttributesForLineItem(){return Wt.get().skipItemAttribute?{}:{_via:"Cooee",_letscooee_campaign:this.shortID,_letscooee_content:this.contentID}}getKVFormatPrivateAttributesForLineItem(){return Wt.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(Ii(62,this.widget?.elems))return!0;let r=Ii(11,this.widget?.elems);return r?r.conf.lg.disp===2||r.conf.sm.disp===2:!1}toString(){let t;return this.onsiteDeliveryType===Jr.POPUP?t="Popup":t=oa.toTitle(this.objective),`${t}(id=${this.shortID})`}getCartMagicVariables(){let t=yt.getCurrent(),r=ze.sum(t.items??[],n=>n.discounts?.reduce((i,o)=>i+(o.amount??0),0)??0);return J(J(J(J({productCount:t.item_count,product_count:t.item_count},Qt("amount",t.total_price/100)),Qt("originalAmount",t.original_total_price/100)),Qt("total_line_items_discount",r/100)),Qt("total_discount",t.total_discount/100))}shouldGetVariationImmediately(){return this.hasMultiplePlacement&&!this.alwaysHaveVariations()}shouldSkipVariation(){return this.isSingleContent()||this.alwaysHaveVariations()?!0:!!this.variation}alwaysHaveVariations(){return this.isProgressBar()||this.isSavingsBar()}updateEffectivePrice(t,r,n=!1){let i=St().currentItem;t.forEach(o=>{let s=o.selectedOrFirstVariant.value,f=s.price;if(n&&o.mID===i.mID)s.effectivePrice.value=f.d;else{let h=f.d*r/100;s.effectivePrice.value=f.d-h}})}formatCurrencyAndNumber(t){if(!t)return{};let r={discountPercentage:zs(t.discountPercentage??0),discountCode:this.discount?.code};return["actualPrice","discountAmount","discountedPrice","totalComparePrice"].map(n=>{Object.assign(r,Qt(n,t[n]))}),r}};var Oi=class{triggerID;nudgeID;engagementID;contentID;shortID;contentType;variation;props;objective;onsiteDeliveryType;holdout;constructor(t){t=t||{},this.triggerID=t.id||t.triggerID,this.nudgeID=t.nudgeID,this.shortID=t.shortID,this.contentType=t.contentType,this.engagementID=t.engagementID,this.contentID=t.contentID,this.variation=t.variation,this.props=t.props,this.objective=t.objective,this.onsiteDeliveryType=t.onsiteDeliveryType,this.holdout=t.holdout}};function nl(e,t){return t={exports:{}},e(t,t.exports),t.exports}var il=cl,ol=fl,sl=hl,Se=[],se=[],al=typeof Uint8Array<"u"?Uint8Array:Array,Ko="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Qe=0,ja=Ko.length;Qe<ja;++Qe)Se[Qe]=Ko[Qe],se[Ko.charCodeAt(Qe)]=Qe;var Qe,ja;se[45]=62;se[95]=63;function ic(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function cl(e){var t=ic(e),r=t[0],n=t[1];return(r+n)*3/4-n}function ul(e,t,r){return(t+r)*3/4-r}function fl(e){var t,r=ic(e),n=r[0],i=r[1],o=new al(ul(e,n,i)),s=0,f=i>0?n-4:n,h;for(h=0;h<f;h+=4)t=se[e.charCodeAt(h)]<<18|se[e.charCodeAt(h+1)]<<12|se[e.charCodeAt(h+2)]<<6|se[e.charCodeAt(h+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return i===2&&(t=se[e.charCodeAt(h)]<<2|se[e.charCodeAt(h+1)]>>4,o[s++]=t&255),i===1&&(t=se[e.charCodeAt(h)]<<10|se[e.charCodeAt(h+1)]<<4|se[e.charCodeAt(h+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function ll(e){return Se[e>>18&63]+Se[e>>12&63]+Se[e>>6&63]+Se[e&63]}function pl(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(ll(n));return i.join("")}function hl(e){for(var t,r=e.length,n=r%3,i=[],o=16383,s=0,f=r-n;s<f;s+=o)i.push(pl(e,s,s+o>f?f:s+o));return n===1?(t=e[r-1],i.push(Se[t>>2]+Se[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Se[t>>10]+Se[t>>4&63]+Se[t<<2&63]+"=")),i.join("")}var Qo={byteLength:il,toByteArray:ol,fromByteArray:sl};var ml=function(t,r,n,i,o){var s,f,h=o*8-i-1,_=(1<<h)-1,g=_>>1,d=-7,E=n?o-1:0,v=n?-1:1,T=t[r+E];for(E+=v,s=T&(1<<-d)-1,T>>=-d,d+=h;d>0;s=s*256+t[r+E],E+=v,d-=8);for(f=s&(1<<-d)-1,s>>=-d,d+=i;d>0;f=f*256+t[r+E],E+=v,d-=8);if(s===0)s=1-g;else{if(s===_)return f?NaN:(T?-1:1)*(1/0);f=f+Math.pow(2,i),s=s-g}return(T?-1:1)*f*Math.pow(2,s-i)},dl=function(t,r,n,i,o,s){var f,h,_,g=s*8-o-1,d=(1<<g)-1,E=d>>1,v=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=i?0:s-1,A=i?1:-1,B=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(h=isNaN(r)?1:0,f=d):(f=Math.floor(Math.log(r)/Math.LN2),r*(_=Math.pow(2,-f))<1&&(f--,_*=2),f+E>=1?r+=v/_:r+=v*Math.pow(2,1-E),r*_>=2&&(f++,_/=2),f+E>=d?(h=0,f=d):f+E>=1?(h=(r*_-1)*Math.pow(2,o),f=f+E):(h=r*Math.pow(2,E-1)*Math.pow(2,o),f=0));o>=8;t[n+T]=h&255,T+=A,h/=256,o-=8);for(f=f<<o|h,g+=o;g>0;t[n+T]=f&255,T+=A,f/=256,g-=8);t[n+T-A]|=B*128},Nr={read:ml,write:dl},Ri=nl(function(e,t){var r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=F,t.INSPECT_MAX_BYTES=50;var n=2147483647;t.kMaxLength=n,s.TYPED_ARRAY_SUPPORT=i(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var l=new Uint8Array(1),a={foo:function(){return 42}};return Object.setPrototypeOf(a,Uint8Array.prototype),Object.setPrototypeOf(l,a),l.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(l){if(l>n)throw new RangeError('The value "'+l+'" is invalid for option "size"');var a=new Uint8Array(l);return Object.setPrototypeOf(a,s.prototype),a}function s(l,a,c){if(typeof l=="number"){if(typeof a=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(l)}return f(l,a,c)}s.poolSize=8192;function f(l,a,c){if(typeof l=="string")return d(l,a);if(ArrayBuffer.isView(l))return v(l);if(l==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(l));if(Et(l,ArrayBuffer)||l&&Et(l.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Et(l,SharedArrayBuffer)||l&&Et(l.buffer,SharedArrayBuffer)))return T(l,a,c);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var m=l.valueOf&&l.valueOf();if(m!=null&&m!==l)return s.from(m,a,c);var I=A(l);if(I)return I;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return s.from(l[Symbol.toPrimitive]("string"),a,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(l))}s.from=function(l,a,c){return f(l,a,c)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function h(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function _(l,a,c){return h(l),l<=0?o(l):a!==void 0?typeof c=="string"?o(l).fill(a,c):o(l).fill(a):o(l)}s.alloc=function(l,a,c){return _(l,a,c)};function g(l){return h(l),o(l<0?0:B(l)|0)}s.allocUnsafe=function(l){return g(l)},s.allocUnsafeSlow=function(l){return g(l)};function d(l,a){if((typeof a!="string"||a==="")&&(a="utf8"),!s.isEncoding(a))throw new TypeError("Unknown encoding: "+a);var c=G(l,a)|0,m=o(c),I=m.write(l,a);return I!==c&&(m=m.slice(0,I)),m}function E(l){for(var a=l.length<0?0:B(l.length)|0,c=o(a),m=0;m<a;m+=1)c[m]=l[m]&255;return c}function v(l){if(Et(l,Uint8Array)){var a=new Uint8Array(l);return T(a.buffer,a.byteOffset,a.byteLength)}return E(l)}function T(l,a,c){if(a<0||l.byteLength<a)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<a+(c||0))throw new RangeError('"length" is outside of buffer bounds');var m;return a===void 0&&c===void 0?m=new Uint8Array(l):c===void 0?m=new Uint8Array(l,a):m=new Uint8Array(l,a,c),Object.setPrototypeOf(m,s.prototype),m}function A(l){if(s.isBuffer(l)){var a=B(l.length)|0,c=o(a);return c.length===0||l.copy(c,0,0,a),c}if(l.length!==void 0)return typeof l.length!="number"||lt(l.length)?o(0):E(l);if(l.type==="Buffer"&&Array.isArray(l.data))return E(l.data)}function B(l){if(l>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return l|0}function F(l){return+l!=l&&(l=0),s.alloc(+l)}s.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==s.prototype},s.compare=function(a,c){if(Et(a,Uint8Array)&&(a=s.from(a,a.offset,a.byteLength)),Et(c,Uint8Array)&&(c=s.from(c,c.offset,c.byteLength)),!s.isBuffer(a)||!s.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===c)return 0;for(var m=a.length,I=c.length,C=0,M=Math.min(m,I);C<M;++C)if(a[C]!==c[C]){m=a[C],I=c[C];break}return m<I?-1:I<m?1:0},s.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(a,c){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(a.length===0)return s.alloc(0);var m;if(c===void 0)for(c=0,m=0;m<a.length;++m)c+=a[m].length;var I=s.allocUnsafe(c),C=0;for(m=0;m<a.length;++m){var M=a[m];if(Et(M,Uint8Array))C+M.length>I.length?s.from(M).copy(I,C):Uint8Array.prototype.set.call(I,M,C);else if(s.isBuffer(M))M.copy(I,C);else throw new TypeError('"list" argument must be an Array of Buffers');C+=M.length}return I};function G(l,a){if(s.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||Et(l,ArrayBuffer))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(l));var c=l.length,m=arguments.length>2&&arguments[2]===!0;if(!m&&c===0)return 0;for(var I=!1;;)switch(a){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return Ht(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return bt(l).length;default:if(I)return m?-1:Ht(l).length;a=(""+a).toLowerCase(),I=!0}}s.byteLength=G;function D(l,a,c){var m=!1;if((a===void 0||a<0)&&(a=0),a>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,a>>>=0,c<=a))return"";for(l||(l="utf8");;)switch(l){case"hex":return U(this,a,c);case"utf8":case"utf-8":return xt(this,a,c);case"ascii":return O(this,a,c);case"latin1":case"binary":return x(this,a,c);case"base64":return ut(this,a,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,a,c);default:if(m)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),m=!0}}s.prototype._isBuffer=!0;function W(l,a,c){var m=l[a];l[a]=l[c],l[c]=m}s.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var c=0;c<a;c+=2)W(this,c,c+1);return this},s.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var c=0;c<a;c+=4)W(this,c,c+3),W(this,c+1,c+2);return this},s.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var c=0;c<a;c+=8)W(this,c,c+7),W(this,c+1,c+6),W(this,c+2,c+5),W(this,c+3,c+4);return this},s.prototype.toString=function(){var a=this.length;return a===0?"":arguments.length===0?xt(this,0,a):D.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(a){if(!s.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:s.compare(this,a)===0},s.prototype.inspect=function(){var a="",c=t.INSPECT_MAX_BYTES;return a=this.toString("hex",0,c).replace(/(.{2})/g,"$1 ").trim(),this.length>c&&(a+=" ... "),"<Buffer "+a+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(a,c,m,I,C){if(Et(a,Uint8Array)&&(a=s.from(a,a.offset,a.byteLength)),!s.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(a));if(c===void 0&&(c=0),m===void 0&&(m=a?a.length:0),I===void 0&&(I=0),C===void 0&&(C=this.length),c<0||m>a.length||I<0||C>this.length)throw new RangeError("out of range index");if(I>=C&&c>=m)return 0;if(I>=C)return-1;if(c>=m)return 1;if(c>>>=0,m>>>=0,I>>>=0,C>>>=0,this===a)return 0;for(var M=C-I,Q=m-c,ot=Math.min(M,Q),et=this.slice(I,C),gt=a.slice(c,m),_t=0;_t<ot;++_t)if(et[_t]!==gt[_t]){M=et[_t],Q=gt[_t];break}return M<Q?-1:Q<M?1:0};function it(l,a,c,m,I){if(l.length===0)return-1;if(typeof c=="string"?(m=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,lt(c)&&(c=I?0:l.length-1),c<0&&(c=l.length+c),c>=l.length){if(I)return-1;c=l.length-1}else if(c<0)if(I)c=0;else return-1;if(typeof a=="string"&&(a=s.from(a,m)),s.isBuffer(a))return a.length===0?-1:j(l,a,c,m,I);if(typeof a=="number")return a=a&255,typeof Uint8Array.prototype.indexOf=="function"?I?Uint8Array.prototype.indexOf.call(l,a,c):Uint8Array.prototype.lastIndexOf.call(l,a,c):j(l,[a],c,m,I);throw new TypeError("val must be string, number or Buffer")}function j(l,a,c,m,I){var C=1,M=l.length,Q=a.length;if(m!==void 0&&(m=String(m).toLowerCase(),m==="ucs2"||m==="ucs-2"||m==="utf16le"||m==="utf-16le")){if(l.length<2||a.length<2)return-1;C=2,M/=2,Q/=2,c/=2}function ot(fe,Te){return C===1?fe[Te]:fe.readUInt16BE(Te*C)}var et;if(I){var gt=-1;for(et=c;et<M;et++)if(ot(l,et)===ot(a,gt===-1?0:et-gt)){if(gt===-1&&(gt=et),et-gt+1===Q)return gt*C}else gt!==-1&&(et-=et-gt),gt=-1}else for(c+Q>M&&(c=M-Q),et=c;et>=0;et--){for(var _t=!0,At=0;At<Q;At++)if(ot(l,et+At)!==ot(a,At)){_t=!1;break}if(_t)return et}return-1}s.prototype.includes=function(a,c,m){return this.indexOf(a,c,m)!==-1},s.prototype.indexOf=function(a,c,m){return it(this,a,c,m,!0)},s.prototype.lastIndexOf=function(a,c,m){return it(this,a,c,m,!1)};function K(l,a,c,m){c=Number(c)||0;var I=l.length-c;m?(m=Number(m),m>I&&(m=I)):m=I;var C=a.length;m>C/2&&(m=C/2);for(var M=0;M<m;++M){var Q=parseInt(a.substr(M*2,2),16);if(lt(Q))return M;l[c+M]=Q}return M}function X(l,a,c,m){return ft(Ht(a,l.length-c),l,c,m)}function Z(l,a,c,m){return ft(Lt(a),l,c,m)}function dt(l,a,c,m){return ft(bt(a),l,c,m)}function at(l,a,c,m){return ft(st(a,l.length-c),l,c,m)}s.prototype.write=function(a,c,m,I){if(c===void 0)I="utf8",m=this.length,c=0;else if(m===void 0&&typeof c=="string")I=c,m=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(m)?(m=m>>>0,I===void 0&&(I="utf8")):(I=m,m=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var C=this.length-c;if((m===void 0||m>C)&&(m=C),a.length>0&&(m<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");I||(I="utf8");for(var M=!1;;)switch(I){case"hex":return K(this,a,c,m);case"utf8":case"utf-8":return X(this,a,c,m);case"ascii":case"latin1":case"binary":return Z(this,a,c,m);case"base64":return dt(this,a,c,m);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return at(this,a,c,m);default:if(M)throw new TypeError("Unknown encoding: "+I);I=(""+I).toLowerCase(),M=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ut(l,a,c){return a===0&&c===l.length?Qo.fromByteArray(l):Qo.fromByteArray(l.slice(a,c))}function xt(l,a,c){c=Math.min(l.length,c);for(var m=[],I=a;I<c;){var C=l[I],M=null,Q=C>239?4:C>223?3:C>191?2:1;if(I+Q<=c){var ot,et,gt,_t;switch(Q){case 1:C<128&&(M=C);break;case 2:ot=l[I+1],(ot&192)===128&&(_t=(C&31)<<6|ot&63,_t>127&&(M=_t));break;case 3:ot=l[I+1],et=l[I+2],(ot&192)===128&&(et&192)===128&&(_t=(C&15)<<12|(ot&63)<<6|et&63,_t>2047&&(_t<55296||_t>57343)&&(M=_t));break;case 4:ot=l[I+1],et=l[I+2],gt=l[I+3],(ot&192)===128&&(et&192)===128&&(gt&192)===128&&(_t=(C&15)<<18|(ot&63)<<12|(et&63)<<6|gt&63,_t>65535&&_t<1114112&&(M=_t))}}M===null?(M=65533,Q=1):M>65535&&(M-=65536,m.push(M>>>10&1023|55296),M=56320|M&1023),m.push(M),I+=Q}return Xt(m)}var Ct=4096;function Xt(l){var a=l.length;if(a<=Ct)return String.fromCharCode.apply(String,l);for(var c="",m=0;m<a;)c+=String.fromCharCode.apply(String,l.slice(m,m+=Ct));return c}function O(l,a,c){var m="";c=Math.min(l.length,c);for(var I=a;I<c;++I)m+=String.fromCharCode(l[I]&127);return m}function x(l,a,c){var m="";c=Math.min(l.length,c);for(var I=a;I<c;++I)m+=String.fromCharCode(l[I]);return m}function U(l,a,c){var m=l.length;(!a||a<0)&&(a=0),(!c||c<0||c>m)&&(c=m);for(var I="",C=a;C<c;++C)I+=Kt[l[C]];return I}function P(l,a,c){for(var m=l.slice(a,c),I="",C=0;C<m.length-1;C+=2)I+=String.fromCharCode(m[C]+m[C+1]*256);return I}s.prototype.slice=function(a,c){var m=this.length;a=~~a,c=c===void 0?m:~~c,a<0?(a+=m,a<0&&(a=0)):a>m&&(a=m),c<0?(c+=m,c<0&&(c=0)):c>m&&(c=m),c<a&&(c=a);var I=this.subarray(a,c);return Object.setPrototypeOf(I,s.prototype),I};function L(l,a,c){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+a>c)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(a,c,m){a=a>>>0,c=c>>>0,m||L(a,c,this.length);for(var I=this[a],C=1,M=0;++M<c&&(C*=256);)I+=this[a+M]*C;return I},s.prototype.readUintBE=s.prototype.readUIntBE=function(a,c,m){a=a>>>0,c=c>>>0,m||L(a,c,this.length);for(var I=this[a+--c],C=1;c>0&&(C*=256);)I+=this[a+--c]*C;return I},s.prototype.readUint8=s.prototype.readUInt8=function(a,c){return a=a>>>0,c||L(a,1,this.length),this[a]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(a,c){return a=a>>>0,c||L(a,2,this.length),this[a]|this[a+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(a,c){return a=a>>>0,c||L(a,2,this.length),this[a]<<8|this[a+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(a,c){return a=a>>>0,c||L(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(a,c){return a=a>>>0,c||L(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},s.prototype.readIntLE=function(a,c,m){a=a>>>0,c=c>>>0,m||L(a,c,this.length);for(var I=this[a],C=1,M=0;++M<c&&(C*=256);)I+=this[a+M]*C;return C*=128,I>=C&&(I-=Math.pow(2,8*c)),I},s.prototype.readIntBE=function(a,c,m){a=a>>>0,c=c>>>0,m||L(a,c,this.length);for(var I=c,C=1,M=this[a+--I];I>0&&(C*=256);)M+=this[a+--I]*C;return C*=128,M>=C&&(M-=Math.pow(2,8*c)),M},s.prototype.readInt8=function(a,c){return a=a>>>0,c||L(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},s.prototype.readInt16LE=function(a,c){a=a>>>0,c||L(a,2,this.length);var m=this[a]|this[a+1]<<8;return m&32768?m|4294901760:m},s.prototype.readInt16BE=function(a,c){a=a>>>0,c||L(a,2,this.length);var m=this[a+1]|this[a]<<8;return m&32768?m|4294901760:m},s.prototype.readInt32LE=function(a,c){return a=a>>>0,c||L(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},s.prototype.readInt32BE=function(a,c){return a=a>>>0,c||L(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},s.prototype.readFloatLE=function(a,c){return a=a>>>0,c||L(a,4,this.length),Nr.read(this,a,!0,23,4)},s.prototype.readFloatBE=function(a,c){return a=a>>>0,c||L(a,4,this.length),Nr.read(this,a,!1,23,4)},s.prototype.readDoubleLE=function(a,c){return a=a>>>0,c||L(a,8,this.length),Nr.read(this,a,!0,52,8)},s.prototype.readDoubleBE=function(a,c){return a=a>>>0,c||L(a,8,this.length),Nr.read(this,a,!1,52,8)};function q(l,a,c,m,I,C){if(!s.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(a>I||a<C)throw new RangeError('"value" argument is out of bounds');if(c+m>l.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(a,c,m,I){if(a=+a,c=c>>>0,m=m>>>0,!I){var C=Math.pow(2,8*m)-1;q(this,a,c,m,C,0)}var M=1,Q=0;for(this[c]=a&255;++Q<m&&(M*=256);)this[c+Q]=a/M&255;return c+m},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(a,c,m,I){if(a=+a,c=c>>>0,m=m>>>0,!I){var C=Math.pow(2,8*m)-1;q(this,a,c,m,C,0)}var M=m-1,Q=1;for(this[c+M]=a&255;--M>=0&&(Q*=256);)this[c+M]=a/Q&255;return c+m},s.prototype.writeUint8=s.prototype.writeUInt8=function(a,c,m){return a=+a,c=c>>>0,m||q(this,a,c,1,255,0),this[c]=a&255,c+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(a,c,m){return a=+a,c=c>>>0,m||q(this,a,c,2,65535,0),this[c]=a&255,this[c+1]=a>>>8,c+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(a,c,m){return a=+a,c=c>>>0,m||q(this,a,c,2,65535,0),this[c]=a>>>8,this[c+1]=a&255,c+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(a,c,m){return a=+a,c=c>>>0,m||q(this,a,c,4,4294967295,0),this[c+3]=a>>>24,this[c+2]=a>>>16,this[c+1]=a>>>8,this[c]=a&255,c+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(a,c,m){return a=+a,c=c>>>0,m||q(this,a,c,4,4294967295,0),this[c]=a>>>24,this[c+1]=a>>>16,this[c+2]=a>>>8,this[c+3]=a&255,c+4},s.prototype.writeIntLE=function(a,c,m,I){if(a=+a,c=c>>>0,!I){var C=Math.pow(2,8*m-1);q(this,a,c,m,C-1,-C)}var M=0,Q=1,ot=0;for(this[c]=a&255;++M<m&&(Q*=256);)a<0&&ot===0&&this[c+M-1]!==0&&(ot=1),this[c+M]=(a/Q>>0)-ot&255;return c+m},s.prototype.writeIntBE=function(a,c,m,I){if(a=+a,c=c>>>0,!I){var C=Math.pow(2,8*m-1);q(this,a,c,m,C-1,-C)}var M=m-1,Q=1,ot=0;for(this[c+M]=a&255;--M>=0&&(Q*=256);)a<0&&ot===0&&this[c+M+1]!==0&&(ot=1),this[c+M]=(a/Q>>0)-ot&255;return c+m},s.prototype.writeInt8=function(a,c,m){return a=+a,c=c>>>0,m||q(this,a,c,1,127,-128),a<0&&(a=255+a+1),this[c]=a&255,c+1},s.prototype.writeInt16LE=function(a,c,m){return a=+a,c=c>>>0,m||q(this,a,c,2,32767,-32768),this[c]=a&255,this[c+1]=a>>>8,c+2},s.prototype.writeInt16BE=function(a,c,m){return a=+a,c=c>>>0,m||q(this,a,c,2,32767,-32768),this[c]=a>>>8,this[c+1]=a&255,c+2},s.prototype.writeInt32LE=function(a,c,m){return a=+a,c=c>>>0,m||q(this,a,c,4,2147483647,-2147483648),this[c]=a&255,this[c+1]=a>>>8,this[c+2]=a>>>16,this[c+3]=a>>>24,c+4},s.prototype.writeInt32BE=function(a,c,m){return a=+a,c=c>>>0,m||q(this,a,c,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[c]=a>>>24,this[c+1]=a>>>16,this[c+2]=a>>>8,this[c+3]=a&255,c+4};function tt(l,a,c,m,I,C){if(c+m>l.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function Tt(l,a,c,m,I){return a=+a,c=c>>>0,I||tt(l,a,c,4),Nr.write(l,a,c,m,23,4),c+4}s.prototype.writeFloatLE=function(a,c,m){return Tt(this,a,c,!0,m)},s.prototype.writeFloatBE=function(a,c,m){return Tt(this,a,c,!1,m)};function Rt(l,a,c,m,I){return a=+a,c=c>>>0,I||tt(l,a,c,8),Nr.write(l,a,c,m,52,8),c+8}s.prototype.writeDoubleLE=function(a,c,m){return Rt(this,a,c,!0,m)},s.prototype.writeDoubleBE=function(a,c,m){return Rt(this,a,c,!1,m)},s.prototype.copy=function(a,c,m,I){if(!s.isBuffer(a))throw new TypeError("argument should be a Buffer");if(m||(m=0),!I&&I!==0&&(I=this.length),c>=a.length&&(c=a.length),c||(c=0),I>0&&I<m&&(I=m),I===m||a.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(m<0||m>=this.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("sourceEnd out of bounds");I>this.length&&(I=this.length),a.length-c<I-m&&(I=a.length-c+m);var C=I-m;return this===a&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,m,I):Uint8Array.prototype.set.call(a,this.subarray(m,I),c),C},s.prototype.fill=function(a,c,m,I){if(typeof a=="string"){if(typeof c=="string"?(I=c,c=0,m=this.length):typeof m=="string"&&(I=m,m=this.length),I!==void 0&&typeof I!="string")throw new TypeError("encoding must be a string");if(typeof I=="string"&&!s.isEncoding(I))throw new TypeError("Unknown encoding: "+I);if(a.length===1){var C=a.charCodeAt(0);(I==="utf8"&&C<128||I==="latin1")&&(a=C)}}else typeof a=="number"?a=a&255:typeof a=="boolean"&&(a=Number(a));if(c<0||this.length<c||this.length<m)throw new RangeError("Out of range index");if(m<=c)return this;c=c>>>0,m=m===void 0?this.length:m>>>0,a||(a=0);var M;if(typeof a=="number")for(M=c;M<m;++M)this[M]=a;else{var Q=s.isBuffer(a)?a:s.from(a,I),ot=Q.length;if(ot===0)throw new TypeError('The value "'+a+'" is invalid for argument "value"');for(M=0;M<m-c;++M)this[M+c]=Q[M%ot]}return this};var Dt=/[^+/0-9A-Za-z-_]/g;function jt(l){if(l=l.split("=")[0],l=l.trim().replace(Dt,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function Ht(l,a){a=a||1/0;for(var c,m=l.length,I=null,C=[],M=0;M<m;++M){if(c=l.charCodeAt(M),c>55295&&c<57344){if(!I){if(c>56319){(a-=3)>-1&&C.push(239,191,189);continue}else if(M+1===m){(a-=3)>-1&&C.push(239,191,189);continue}I=c;continue}if(c<56320){(a-=3)>-1&&C.push(239,191,189),I=c;continue}c=(I-55296<<10|c-56320)+65536}else I&&(a-=3)>-1&&C.push(239,191,189);if(I=null,c<128){if((a-=1)<0)break;C.push(c)}else if(c<2048){if((a-=2)<0)break;C.push(c>>6|192,c&63|128)}else if(c<65536){if((a-=3)<0)break;C.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((a-=4)<0)break;C.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return C}function Lt(l){for(var a=[],c=0;c<l.length;++c)a.push(l.charCodeAt(c)&255);return a}function st(l,a){for(var c,m,I,C=[],M=0;M<l.length&&!((a-=2)<0);++M)c=l.charCodeAt(M),m=c>>8,I=c%256,C.push(I),C.push(m);return C}function bt(l){return Qo.toByteArray(jt(l))}function ft(l,a,c,m){for(var I=0;I<m&&!(I+c>=a.length||I>=l.length);++I)a[I+c]=l[I];return I}function Et(l,a){return l instanceof a||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===a.name}function lt(l){return l!==l}var Kt=(function(){for(var l="0123456789abcdef",a=new Array(256),c=0;c<16;++c)for(var m=c*16,I=0;I<16;++I)a[m+I]=l[c]+l[I];return a})()}),ct=Ri.Buffer;Ri.SlowBuffer;Ri.INSPECT_MAX_BYTES;Ri.kMaxLength;var ns=function(t,r){return ns=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},ns(t,r)};function Di(e,t){ns(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var tr=(function(e){Di(t,e);function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return Object.defineProperty(t.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),t})(Error),Ot=(function(e){Di(t,e);function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return Object.defineProperty(t.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),t})(TypeError);function Ci(e){return e&&e.Math==Math&&e}function oc(){return Ci(typeof globalThis=="object"&&globalThis)||Ci(typeof window=="object"&&window)||Ci(typeof self=="object"&&self)||Ci(typeof global=="object"&&global)||Function("return this")()}function gl(){var e=oc();return typeof e.navigator=="object"&&e.navigator.product==="ReactNative"}var yl=function(t){var r=gl()?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(r);for(var n=ct.alloc(t),i=0;i<t;++i)n[i]=Math.floor(Math.random()*256);return n},_l=function(){{if(typeof window<"u"){var e=window.crypto||window.msCrypto;if(e&&e.getRandomValues)return function(t){return e.getRandomValues(ct.alloc(t))}}return typeof global<"u"&&global.crypto&&global.crypto.getRandomValues?function(t){return global.crypto.getRandomValues(ct.alloc(t))}:yl}},sc=_l();function vl(e){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e))}function os(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}function wl(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function bl(e){return an(e)&&Object.prototype.toString.call(e)==="[object Date]"}function an(e){return typeof e=="object"&&e!==null}function Ai(e,t){var r=!1;function n(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return r||(console.warn(t),r=!0),e.apply(this,i)}return n}function Ni(e){if(ArrayBuffer.isView(e))return ct.from(e.buffer,e.byteOffset,e.byteLength);if(vl(e))return ct.from(e);throw new Ot("Must use either Buffer or TypedArray")}var El=/^(?:[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,ac=function(e){return typeof e=="string"&&El.test(e)},is=function(e){if(!ac(e))throw new Ot('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var t=e.replace(/-/g,"");return ct.from(t,"hex")},Ha=function(e,t){return t===void 0&&(t=!0),t?e.toString("hex",0,4)+"-"+e.toString("hex",4,6)+"-"+e.toString("hex",6,8)+"-"+e.toString("hex",8,10)+"-"+e.toString("hex",10,16):e.toString("hex")};var h0=Math.pow(2,63)-1,m0=-Math.pow(2,63),Sl=Math.pow(2,53),Il=-Math.pow(2,53);var cc=4;var er=(function(){function e(t,r){if(!(this instanceof e))return new e(t,r);if(t!=null&&typeof t!="string"&&!ArrayBuffer.isView(t)&&!(t instanceof ArrayBuffer)&&!Array.isArray(t))throw new Ot("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=r??e.BSON_BINARY_SUBTYPE_DEFAULT,t==null?(this.buffer=ct.alloc(e.BUFFER_SIZE),this.position=0):(typeof t=="string"?this.buffer=ct.from(t,"binary"):Array.isArray(t)?this.buffer=ct.from(t):this.buffer=Ni(t),this.position=this.buffer.byteLength)}return e.prototype.put=function(t){if(typeof t=="string"&&t.length!==1)throw new Ot("only accepts single character String");if(typeof t!="number"&&t.length!==1)throw new Ot("only accepts single character Uint8Array or Array");var r;if(typeof t=="string"?r=t.charCodeAt(0):typeof t=="number"?r=t:r=t[0],r<0||r>255)throw new Ot("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=ct.alloc(e.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},e.prototype.write=function(t,r){if(r=typeof r=="number"?r:this.position,this.buffer.length<r+t.length){var n=ct.alloc(this.buffer.length+t.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(t)?(this.buffer.set(Ni(t),r),this.position=r+t.byteLength>this.position?r+t.length:this.position):typeof t=="string"&&(this.buffer.write(t,r,t.length,"binary"),this.position=r+t.length>this.position?r+t.length:this.position)},e.prototype.read=function(t,r){return r=r&&r>0?r:this.position,this.buffer.slice(t,t+r)},e.prototype.value=function(t){return t=!!t,t&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},e.prototype.length=function(){return this.position},e.prototype.toJSON=function(){return this.buffer.toString("base64")},e.prototype.toString=function(t){return this.buffer.toString(t)},e.prototype.toExtendedJSON=function(t){t=t||{};var r=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return t.legacy?{$binary:r,$type:n.length===1?"0"+n:n}:{$binary:{base64:r,subType:n.length===1?"0"+n:n}}},e.prototype.toUUID=function(){if(this.sub_type===e.SUBTYPE_UUID)return new Wa(this.buffer.slice(0,this.position));throw new tr('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(e.SUBTYPE_UUID,'" is currently supported.'))},e.fromExtendedJSON=function(t,r){r=r||{};var n,i;if("$binary"in t?r.legacy&&typeof t.$binary=="string"&&"$type"in t?(i=t.$type?parseInt(t.$type,16):0,n=ct.from(t.$binary,"base64")):typeof t.$binary!="string"&&(i=t.$binary.subType?parseInt(t.$binary.subType,16):0,n=ct.from(t.$binary.base64,"base64")):"$uuid"in t&&(i=4,n=is(t.$uuid)),!n)throw new Ot("Unexpected Binary Extended JSON format ".concat(JSON.stringify(t)));return i===cc?new Wa(n):new e(n,i)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.value(!0);return'new Binary(Buffer.from("'.concat(t.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BUFFER_SIZE=256,e.SUBTYPE_DEFAULT=0,e.SUBTYPE_FUNCTION=1,e.SUBTYPE_BYTE_ARRAY=2,e.SUBTYPE_UUID_OLD=3,e.SUBTYPE_UUID=4,e.SUBTYPE_MD5=5,e.SUBTYPE_ENCRYPTED=6,e.SUBTYPE_COLUMN=7,e.SUBTYPE_USER_DEFINED=128,e})();Object.defineProperty(er.prototype,"_bsontype",{value:"Binary"});var Zo=16,Wa=(function(e){Di(t,e);function t(r){var n=this,i,o;if(r==null)i=t.generate();else if(r instanceof t)i=ct.from(r.buffer),o=r.__id;else if(ArrayBuffer.isView(r)&&r.byteLength===Zo)i=Ni(r);else if(typeof r=="string")i=is(r);else throw new Ot("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");return n=e.call(this,i,cc)||this,n.__id=o,n}return Object.defineProperty(t.prototype,"id",{get:function(){return this.buffer},set:function(r){this.buffer=r,t.cacheHexString&&(this.__id=Ha(r))},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(r){if(r===void 0&&(r=!0),t.cacheHexString&&this.__id)return this.__id;var n=Ha(this.id,r);return t.cacheHexString&&(this.__id=n),n},t.prototype.toString=function(r){return r?this.id.toString(r):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(r){if(!r)return!1;if(r instanceof t)return r.id.equals(this.id);try{return new t(r).id.equals(this.id)}catch{return!1}},t.prototype.toBinary=function(){return new er(this.id,er.SUBTYPE_UUID)},t.generate=function(){var r=sc(Zo);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,ct.from(r)},t.isValid=function(r){return r?r instanceof t?!0:typeof r=="string"?ac(r):os(r)?r.length!==Zo?!1:(r[6]&240)===64&&(r[8]&128)===128:!1:!1},t.createFromHexString=function(r){var n=is(r);return new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},t})(er),Pi=(function(){function e(t,r){if(!(this instanceof e))return new e(t,r);this.code=t,this.scope=r}return e.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},e.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},e.fromExtendedJSON=function(t){return new e(t.$code,t.$scope)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.toJSON();return'new Code("'.concat(String(t.code),'"').concat(t.scope?", ".concat(JSON.stringify(t.scope)):"",")")},e})();Object.defineProperty(Pi.prototype,"_bsontype",{value:"Code"});function xl(e){return an(e)&&e.$id!=null&&typeof e.$ref=="string"&&(e.$db==null||typeof e.$db=="string")}var on=(function(){function e(t,r,n,i){if(!(this instanceof e))return new e(t,r,n,i);var o=t.split(".");o.length===2&&(n=o.shift(),t=o.shift()),this.collection=t,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(e.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(t.$db=this.db),t},e.prototype.toExtendedJSON=function(t){t=t||{};var r={$ref:this.collection,$id:this.oid};return t.legacy||(this.db&&(r.$db=this.db),r=Object.assign(r,this.fields)),r},e.fromExtendedJSON=function(t){var r=Object.assign({},t);return delete r.$ref,delete r.$id,delete r.$db,new e(t.$ref,t.$id,t.$db,r)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.oid===void 0||this.oid.toString===void 0?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(t),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},e})();Object.defineProperty(on.prototype,"_bsontype",{value:"DBRef"});var oe=void 0;try{oe=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 Ga=65536,Tl=1<<24,Dr=Ga*Ga,uc=Dr*Dr,Ya=uc/2,qa={},za={},z=(function(){function e(t,r,n){if(t===void 0&&(t=0),!(this instanceof e))return new e(t,r,n);typeof t=="bigint"?Object.assign(this,e.fromBigInt(t,!!r)):typeof t=="string"?Object.assign(this,e.fromString(t,!!r)):(this.low=t|0,this.high=r|0,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return e.fromBits=function(t,r,n){return new e(t,r,n)},e.fromInt=function(t,r){var n,i,o;return r?(t>>>=0,(o=0<=t&&t<256)&&(i=za[t],i)?i:(n=e.fromBits(t,(t|0)<0?-1:0,!0),o&&(za[t]=n),n)):(t|=0,(o=-128<=t&&t<128)&&(i=qa[t],i)?i:(n=e.fromBits(t,t<0?-1:0,!1),o&&(qa[t]=n),n))},e.fromNumber=function(t,r){if(isNaN(t))return r?e.UZERO:e.ZERO;if(r){if(t<0)return e.UZERO;if(t>=uc)return e.MAX_UNSIGNED_VALUE}else{if(t<=-Ya)return e.MIN_VALUE;if(t+1>=Ya)return e.MAX_VALUE}return t<0?e.fromNumber(-t,r).neg():e.fromBits(t%Dr|0,t/Dr|0,r)},e.fromBigInt=function(t,r){return e.fromString(t.toString(),r)},e.fromString=function(t,r,n){if(t.length===0)throw Error("empty string");if(t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return e.ZERO;if(typeof r=="number"?(n=r,r=!1):r=!!r,n=n||10,n<2||36<n)throw RangeError("radix");var i;if((i=t.indexOf("-"))>0)throw Error("interior hyphen");if(i===0)return e.fromString(t.substring(1),r,n).neg();for(var o=e.fromNumber(Math.pow(n,8)),s=e.ZERO,f=0;f<t.length;f+=8){var h=Math.min(8,t.length-f),_=parseInt(t.substring(f,f+h),n);if(h<8){var g=e.fromNumber(Math.pow(n,h));s=s.mul(g).add(e.fromNumber(_))}else s=s.mul(o),s=s.add(e.fromNumber(_))}return s.unsigned=r,s},e.fromBytes=function(t,r,n){return n?e.fromBytesLE(t,r):e.fromBytesBE(t,r)},e.fromBytesLE=function(t,r){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)},e.fromBytesBE=function(t,r){return new e(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)},e.isLong=function(t){return an(t)&&t.__isLong__===!0},e.fromValue=function(t,r){return typeof t=="number"?e.fromNumber(t,r):typeof t=="string"?e.fromString(t,r):e.fromBits(t.low,t.high,typeof r=="boolean"?r:t.unsigned)},e.prototype.add=function(t){e.isLong(t)||(t=e.fromValue(t));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,o=this.low&65535,s=t.high>>>16,f=t.high&65535,h=t.low>>>16,_=t.low&65535,g=0,d=0,E=0,v=0;return v+=o+_,E+=v>>>16,v&=65535,E+=i+h,d+=E>>>16,E&=65535,d+=n+f,g+=d>>>16,d&=65535,g+=r+s,g&=65535,e.fromBits(E<<16|v,g<<16|d,this.unsigned)},e.prototype.and=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low&t.low,this.high&t.high,this.unsigned)},e.prototype.compare=function(t){if(e.isLong(t)||(t=e.fromValue(t)),this.eq(t))return 0;var r=this.isNegative(),n=t.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},e.prototype.comp=function(t){return this.compare(t)},e.prototype.divide=function(t){if(e.isLong(t)||(t=e.fromValue(t)),t.isZero())throw Error("division by zero");if(oe){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?oe.div_u:oe.div_s)(this.low,this.high,t.low,t.high);return e.fromBits(r,oe.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var n,i,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return e.UZERO;if(t.gt(this.shru(1)))return e.UONE;o=e.UZERO}else{if(this.eq(e.MIN_VALUE)){if(t.eq(e.ONE)||t.eq(e.NEG_ONE))return e.MIN_VALUE;if(t.eq(e.MIN_VALUE))return e.ONE;var s=this.shr(1);return n=s.div(t).shl(1),n.eq(e.ZERO)?t.isNegative()?e.ONE:e.NEG_ONE:(i=this.sub(t.mul(n)),o=n.add(i.div(t)),o)}else if(t.eq(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=e.ZERO}for(i=this;i.gte(t);){n=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var f=Math.ceil(Math.log(n)/Math.LN2),h=f<=48?1:Math.pow(2,f-48),_=e.fromNumber(n),g=_.mul(t);g.isNegative()||g.gt(i);)n-=h,_=e.fromNumber(n,this.unsigned),g=_.mul(t);_.isZero()&&(_=e.ONE),o=o.add(_),i=i.sub(g)}return o},e.prototype.div=function(t){return this.divide(t)},e.prototype.equals=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low},e.prototype.eq=function(t){return this.equals(t)},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(e.MIN_VALUE)?64:this.neg().getNumBitsAbs();var t=this.high!==0?this.high:this.low,r;for(r=31;r>0&&(t&1<<r)===0;r--);return this.high!==0?r+33:r+1},e.prototype.greaterThan=function(t){return this.comp(t)>0},e.prototype.gt=function(t){return this.greaterThan(t)},e.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},e.prototype.gte=function(t){return this.greaterThanOrEqual(t)},e.prototype.ge=function(t){return this.greaterThanOrEqual(t)},e.prototype.isEven=function(){return(this.low&1)===0},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isOdd=function(){return(this.low&1)===1},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isZero=function(){return this.high===0&&this.low===0},e.prototype.lessThan=function(t){return this.comp(t)<0},e.prototype.lt=function(t){return this.lessThan(t)},e.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},e.prototype.lte=function(t){return this.lessThanOrEqual(t)},e.prototype.modulo=function(t){if(e.isLong(t)||(t=e.fromValue(t)),oe){var r=(this.unsigned?oe.rem_u:oe.rem_s)(this.low,this.high,t.low,t.high);return e.fromBits(r,oe.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},e.prototype.mod=function(t){return this.modulo(t)},e.prototype.rem=function(t){return this.modulo(t)},e.prototype.multiply=function(t){if(this.isZero())return e.ZERO;if(e.isLong(t)||(t=e.fromValue(t)),oe){var r=oe.mul(this.low,this.high,t.low,t.high);return e.fromBits(r,oe.get_high(),this.unsigned)}if(t.isZero())return e.ZERO;if(this.eq(e.MIN_VALUE))return t.isOdd()?e.MIN_VALUE:e.ZERO;if(t.eq(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(e.TWO_PWR_24)&&t.lt(e.TWO_PWR_24))return e.fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,o=this.low>>>16,s=this.low&65535,f=t.high>>>16,h=t.high&65535,_=t.low>>>16,g=t.low&65535,d=0,E=0,v=0,T=0;return T+=s*g,v+=T>>>16,T&=65535,v+=o*g,E+=v>>>16,v&=65535,v+=s*_,E+=v>>>16,v&=65535,E+=i*g,d+=E>>>16,E&=65535,E+=o*_,d+=E>>>16,E&=65535,E+=s*h,d+=E>>>16,E&=65535,d+=n*g+i*_+o*h+s*f,d&=65535,e.fromBits(v<<16|T,d<<16|E,this.unsigned)},e.prototype.mul=function(t){return this.multiply(t)},e.prototype.negate=function(){return!this.unsigned&&this.eq(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=function(){return this.negate()},e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.notEquals=function(t){return!this.equals(t)},e.prototype.neq=function(t){return this.notEquals(t)},e.prototype.ne=function(t){return this.notEquals(t)},e.prototype.or=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low|t.low,this.high|t.high,this.unsigned)},e.prototype.shiftLeft=function(t){return e.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?e.fromBits(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):e.fromBits(0,this.low<<t-32,this.unsigned)},e.prototype.shl=function(t){return this.shiftLeft(t)},e.prototype.shiftRight=function(t){return e.isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?e.fromBits(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):e.fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=function(t){return this.shiftRight(t)},e.prototype.shiftRightUnsigned=function(t){if(e.isLong(t)&&(t=t.toInt()),t&=63,t===0)return this;var r=this.high;if(t<32){var n=this.low;return e.fromBits(n>>>t|r<<32-t,r>>>t,this.unsigned)}else return t===32?e.fromBits(r,0,this.unsigned):e.fromBits(r>>>t-32,0,this.unsigned)},e.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},e.prototype.shru=function(t){return this.shiftRightUnsigned(t)},e.prototype.subtract=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.add(t.neg())},e.prototype.sub=function(t){return this.subtract(t)},e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*Dr+(this.low>>>0):this.high*Dr+(this.low>>>0)},e.prototype.toBigInt=function(){return BigInt(this.toString())},e.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},e.prototype.toBytesLE=function(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]},e.prototype.toBytesBE=function(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]},e.prototype.toSigned=function(){return this.unsigned?e.fromBits(this.low,this.high,!1):this},e.prototype.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(e.MIN_VALUE)){var r=e.fromNumber(t),n=this.div(r),i=n.mul(r).sub(this);return n.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var o=e.fromNumber(Math.pow(t,6),this.unsigned),s=this,f="";;){var h=s.div(o),_=s.sub(h.mul(o)).toInt()>>>0,g=_.toString(t);if(s=h,s.isZero())return g+f;for(;g.length<6;)g="0"+g;f=""+g+f}},e.prototype.toUnsigned=function(){return this.unsigned?this:e.fromBits(this.low,this.high,!0)},e.prototype.xor=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low^t.low,this.high^t.high,this.unsigned)},e.prototype.eqz=function(){return this.isZero()},e.prototype.le=function(t){return this.lessThanOrEqual(t)},e.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},e.fromExtendedJSON=function(t,r){var n=e.fromString(t.$numberLong);return r&&r.relaxed?n.toNumber():n},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},e.TWO_PWR_24=e.fromInt(Tl),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e})();Object.defineProperty(z.prototype,"__isLong__",{value:!0});Object.defineProperty(z.prototype,"_bsontype",{value:"Long"});var Ol=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Cl=/^(\+|-)?(Infinity|inf)$/i,Nl=/^(\+|-)?NaN$/i,nn=6111,ts=-6176,Ja=6176,Rl=34,es=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Xa=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ka=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Dl=/^([-+])?(\d+)?$/,Al=31,Qa=16383,Pl=30,Ll=31;function Za(e){return!isNaN(parseInt(e,10))}function Bl(e){var t=z.fromNumber(1e9),r=z.fromNumber(0);if(!e.parts[0]&&!e.parts[1]&&!e.parts[2]&&!e.parts[3])return{quotient:e,rem:r};for(var n=0;n<=3;n++)r=r.shiftLeft(32),r=r.add(new z(e.parts[n],0)),e.parts[n]=r.div(t).low,r=r.modulo(t);return{quotient:e,rem:r}}function Ul(e,t){if(!e&&!t)return{high:z.fromNumber(0),low:z.fromNumber(0)};var r=e.shiftRightUnsigned(32),n=new z(e.getLowBits(),0),i=t.shiftRightUnsigned(32),o=new z(t.getLowBits(),0),s=r.multiply(i),f=r.multiply(o),h=n.multiply(i),_=n.multiply(o);return s=s.add(f.shiftRightUnsigned(32)),f=new z(f.getLowBits(),0).add(h).add(_.shiftRightUnsigned(32)),s=s.add(f.shiftRightUnsigned(32)),_=f.shiftLeft(32).add(new z(_.getLowBits(),0)),{high:s,low:_}}function Ml(e,t){var r=e.high>>>0,n=t.high>>>0;if(r<n)return!0;if(r===n){var i=e.low>>>0,o=t.low>>>0;if(i<o)return!0}return!1}function Rr(e,t){throw new Ot('"'.concat(e,'" is not a valid Decimal128 string - ').concat(t))}var ss=(function(){function e(t){if(!(this instanceof e))return new e(t);if(typeof t=="string")this.bytes=e.fromString(t).bytes;else if(os(t)){if(t.byteLength!==16)throw new Ot("Decimal128 must take a Buffer of 16 bytes");this.bytes=t}else throw new Ot("Decimal128 must take a Buffer or string")}return e.fromString=function(t){var r=!1,n=!1,i=!1,o=0,s=0,f=0,h=0,_=0,g=[0],d=0,E=0,v=0,T=0,A=0,B=0,F=new z(0,0),G=new z(0,0),D=0,W=0;if(t.length>=7e3)throw new Ot(""+t+" not a valid Decimal128 string");var it=t.match(Ol),j=t.match(Cl),K=t.match(Nl);if(!it&&!j&&!K||t.length===0)throw new Ot(""+t+" not a valid Decimal128 string");if(it){var X=it[2],Z=it[4],dt=it[5],at=it[6];Z&&at===void 0&&Rr(t,"missing exponent power"),Z&&X===void 0&&Rr(t,"missing exponent base"),Z===void 0&&(dt||at)&&Rr(t,"missing e before exponent")}if((t[W]==="+"||t[W]==="-")&&(r=t[W++]==="-"),!Za(t[W])&&t[W]!=="."){if(t[W]==="i"||t[W]==="I")return new e(ct.from(r?Xa:Ka));if(t[W]==="N")return new e(ct.from(es))}for(;Za(t[W])||t[W]===".";){if(t[W]==="."){n&&Rr(t,"contains multiple periods"),n=!0,W=W+1;continue}d<34&&(t[W]!=="0"||i)&&(i||(_=s),i=!0,g[E++]=parseInt(t[W],10),d=d+1),i&&(f=f+1),n&&(h=h+1),s=s+1,W=W+1}if(n&&!s)throw new Ot(""+t+" not a valid Decimal128 string");if(t[W]==="e"||t[W]==="E"){var ut=t.substr(++W).match(Dl);if(!ut||!ut[2])return new e(ct.from(es));A=parseInt(ut[0],10),W=W+ut[0].length}if(t[W])return new e(ct.from(es));if(v=0,!d)v=0,T=0,g[0]=0,f=1,d=1,o=0;else if(T=d-1,o=f,o!==1)for(;g[_+o-1]===0;)o=o-1;for(A<=h&&h-A>16384?A=ts:A=A-h;A>nn;){if(T=T+1,T-v>Rl){var xt=g.join("");if(xt.match(/^0+$/)){A=nn;break}Rr(t,"overflow")}A=A-1}for(;A<ts||d<f;){if(T===0&&o<d){A=ts,o=0;break}if(d<f?f=f-1:T=T-1,A<nn)A=A+1;else{var xt=g.join("");if(xt.match(/^0+$/)){A=nn;break}Rr(t,"overflow")}}if(T-v+1<o){var Ct=s;n&&(_=_+1,Ct=Ct+1),r&&(_=_+1,Ct=Ct+1);var Xt=parseInt(t[_+T+1],10),O=0;if(Xt>=5&&(O=1,Xt===5)){for(O=g[T]%2===1?1:0,B=_+T+2;B<Ct;B++)if(parseInt(t[B],10)){O=1;break}}if(O){for(var x=T;x>=0;x--)if(++g[x]>9&&(g[x]=0,x===0))if(A<nn)A=A+1,g[x]=1;else return new e(ct.from(r?Xa:Ka))}}if(F=z.fromNumber(0),G=z.fromNumber(0),o===0)F=z.fromNumber(0),G=z.fromNumber(0);else if(T-v<17){var x=v;for(G=z.fromNumber(g[x++]),F=new z(0,0);x<=T;x++)G=G.multiply(z.fromNumber(10)),G=G.add(z.fromNumber(g[x]))}else{var x=v;for(F=z.fromNumber(g[x++]);x<=T-17;x++)F=F.multiply(z.fromNumber(10)),F=F.add(z.fromNumber(g[x]));for(G=z.fromNumber(g[x++]);x<=T;x++)G=G.multiply(z.fromNumber(10)),G=G.add(z.fromNumber(g[x]))}var U=Ul(F,z.fromString("100000000000000000"));U.low=U.low.add(G),Ml(U.low,G)&&(U.high=U.high.add(z.fromNumber(1))),D=A+Ja;var P={low:z.fromNumber(0),high:z.fromNumber(0)};U.high.shiftRightUnsigned(49).and(z.fromNumber(1)).equals(z.fromNumber(1))?(P.high=P.high.or(z.fromNumber(3).shiftLeft(61)),P.high=P.high.or(z.fromNumber(D).and(z.fromNumber(16383).shiftLeft(47))),P.high=P.high.or(U.high.and(z.fromNumber(0x7fffffffffff)))):(P.high=P.high.or(z.fromNumber(D&16383).shiftLeft(49)),P.high=P.high.or(U.high.and(z.fromNumber(562949953421311)))),P.low=U.low,r&&(P.high=P.high.or(z.fromString("9223372036854775808")));var L=ct.alloc(16);return W=0,L[W++]=P.low.low&255,L[W++]=P.low.low>>8&255,L[W++]=P.low.low>>16&255,L[W++]=P.low.low>>24&255,L[W++]=P.low.high&255,L[W++]=P.low.high>>8&255,L[W++]=P.low.high>>16&255,L[W++]=P.low.high>>24&255,L[W++]=P.high.low&255,L[W++]=P.high.low>>8&255,L[W++]=P.high.low>>16&255,L[W++]=P.high.low>>24&255,L[W++]=P.high.high&255,L[W++]=P.high.high>>8&255,L[W++]=P.high.high>>16&255,L[W++]=P.high.high>>24&255,new e(L)},e.prototype.toString=function(){for(var t,r=0,n=new Array(36),i=0;i<n.length;i++)n[i]=0;var o=0,s=!1,f,h={parts:[0,0,0,0]},_,g,d=[];o=0;var E=this.bytes,v=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,T=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,A=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24,B=E[o++]|E[o++]<<8|E[o++]<<16|E[o++]<<24;o=0;var F={low:new z(v,T),high:new z(A,B)};F.high.lessThan(z.ZERO)&&d.push("-");var G=B>>26&Al;if(G>>3===3){if(G===Pl)return d.join("")+"Infinity";if(G===Ll)return"NaN";t=B>>15&Qa,f=8+(B>>14&1)}else f=B>>14&7,t=B>>17&Qa;var D=t-Ja;if(h.parts[0]=(B&16383)+((f&15)<<14),h.parts[1]=A,h.parts[2]=T,h.parts[3]=v,h.parts[0]===0&&h.parts[1]===0&&h.parts[2]===0&&h.parts[3]===0)s=!0;else for(g=3;g>=0;g--){var W=0,it=Bl(h);if(h=it.quotient,W=it.rem.low,!!W)for(_=8;_>=0;_--)n[g*9+_]=W%10,W=Math.floor(W/10)}if(s)r=1,n[o]=0;else for(r=36;!n[o];)r=r-1,o=o+1;var j=r-1+D;if(j>=34||j<=-7||D>0){if(r>34)return d.push("".concat(0)),D>0?d.push("E+".concat(D)):D<0&&d.push("E".concat(D)),d.join("");d.push("".concat(n[o++])),r=r-1,r&&d.push(".");for(var i=0;i<r;i++)d.push("".concat(n[o++]));d.push("E"),j>0?d.push("+".concat(j)):d.push("".concat(j))}else if(D>=0)for(var i=0;i<r;i++)d.push("".concat(n[o++]));else{var K=r+D;if(K>0)for(var i=0;i<K;i++)d.push("".concat(n[o++]));else d.push("0");for(d.push(".");K++<0;)d.push("0");for(var i=0;i<r-Math.max(K-1,0);i++)d.push("".concat(n[o++]))}return d.join("")},e.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},e.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},e.fromExtendedJSON=function(t){return e.fromString(t.$numberDecimal)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},e})();Object.defineProperty(ss.prototype,"_bsontype",{value:"Decimal128"});var Li=(function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t}return e.prototype.valueOf=function(){return this.value},e.prototype.toJSON=function(){return this.value},e.prototype.toString=function(t){return this.value.toString(t)},e.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},e.fromExtendedJSON=function(t,r){var n=parseFloat(t.$numberDouble);return r&&r.relaxed?n:new e(n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var t=this.toExtendedJSON();return"new Double(".concat(t.$numberDouble,")")},e})();Object.defineProperty(Li.prototype,"_bsontype",{value:"Double"});var Bi=(function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t|0}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(t){return this.value.toString(t)},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},e.fromExtendedJSON=function(t,r){return r&&r.relaxed?parseInt(t.$numberInt,10):new e(t.$numberInt)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},e})();Object.defineProperty(Bi.prototype,"_bsontype",{value:"Int32"});var as=(function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$maxKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MaxKey()"},e})();Object.defineProperty(as.prototype,"_bsontype",{value:"MaxKey"});var cs=(function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$minKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MinKey()"},e})();Object.defineProperty(cs.prototype,"_bsontype",{value:"MinKey"});var Fl=new RegExp("^[0-9a-fA-F]{24}$"),Ze=null,Ee=Symbol("id"),Vt=(function(){function e(t){if(!(this instanceof e))return new e(t);var r;if(typeof t=="object"&&t&&"id"in t){if(typeof t.id!="string"&&!ArrayBuffer.isView(t.id))throw new Ot("Argument passed in must have an id that is of type string or Buffer");"toHexString"in t&&typeof t.toHexString=="function"?r=ct.from(t.toHexString(),"hex"):r=t.id}else r=t;if(r==null||typeof r=="number")this[Ee]=e.generate(typeof r=="number"?r:void 0);else if(ArrayBuffer.isView(r)&&r.byteLength===12)this[Ee]=r instanceof ct?r:Ni(r);else if(typeof r=="string")if(r.length===12){var n=ct.from(r);if(n.byteLength===12)this[Ee]=n;else throw new Ot("Argument passed in must be a string of 12 bytes")}else if(r.length===24&&Fl.test(r))this[Ee]=ct.from(r,"hex");else throw new Ot("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");else throw new Ot("Argument passed in does not match the accepted types");e.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(e.prototype,"id",{get:function(){return this[Ee]},set:function(t){this[Ee]=t,e.cacheHexString&&(this.__id=t.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(){if(e.cacheHexString&&this.__id)return this.__id;var t=this.id.toString("hex");return e.cacheHexString&&!this.__id&&(this.__id=t),t},e.getInc=function(){return e.index=(e.index+1)%16777215},e.generate=function(t){typeof t!="number"&&(t=Math.floor(Date.now()/1e3));var r=e.getInc(),n=ct.alloc(12);return n.writeUInt32BE(t,0),Ze===null&&(Ze=sc(5)),n[4]=Ze[0],n[5]=Ze[1],n[6]=Ze[2],n[7]=Ze[3],n[8]=Ze[4],n[11]=r&255,n[10]=r>>8&255,n[9]=r>>16&255,n},e.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(t==null)return!1;if(t instanceof e)return this[Ee][11]===t[Ee][11]&&this[Ee].equals(t[Ee]);if(typeof t=="string"&&e.isValid(t)&&t.length===12&&os(this.id))return t===ct.prototype.toString.call(this.id,"latin1");if(typeof t=="string"&&e.isValid(t)&&t.length===24)return t.toLowerCase()===this.toHexString();if(typeof t=="string"&&e.isValid(t)&&t.length===12)return ct.from(t).equals(this.id);if(typeof t=="object"&&"toHexString"in t&&typeof t.toHexString=="function"){var r=t.toHexString(),n=this.toHexString().toLowerCase();return typeof r=="string"&&r.toLowerCase()===n}return!1},e.prototype.getTimestamp=function(){var t=new Date,r=this.id.readUInt32BE(0);return t.setTime(Math.floor(r)*1e3),t},e.createPk=function(){return new e},e.createFromTime=function(t){var r=ct.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(t,0),new e(r)},e.createFromHexString=function(t){if(typeof t>"u"||t!=null&&t.length!==24)throw new Ot("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new e(ct.from(t,"hex"))},e.isValid=function(t){if(t==null)return!1;try{return new e(t),!0}catch{return!1}},e.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},e.fromExtendedJSON=function(t){return new e(t.$oid)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},e.index=Math.floor(Math.random()*16777215),e})();Object.defineProperty(Vt.prototype,"generate",{value:Ai(function(e){return Vt.generate(e)},"Please use the static `ObjectId.generate(time)` instead")});Object.defineProperty(Vt.prototype,"getInc",{value:Ai(function(){return Vt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Vt.prototype,"get_inc",{value:Ai(function(){return Vt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Vt,"get_inc",{value:Ai(function(){return Vt.getInc()},"Please use the static `ObjectId.getInc()` instead")});Object.defineProperty(Vt.prototype,"_bsontype",{value:"ObjectID"});function kl(e){return e.split("").sort().join("")}var sn=(function(){function e(t,r){if(!(this instanceof e))return new e(t,r);if(this.pattern=t,this.options=kl(r??""),this.pattern.indexOf("\0")!==-1)throw new tr("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(this.options.indexOf("\0")!==-1)throw new tr("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var n=0;n<this.options.length;n++)if(!(this.options[n]==="i"||this.options[n]==="m"||this.options[n]==="x"||this.options[n]==="l"||this.options[n]==="s"||this.options[n]==="u"))throw new tr("The regular expression option [".concat(this.options[n],"] is not supported"))}return e.parseOptions=function(t){return t?t.split("").sort().join(""):""},e.prototype.toExtendedJSON=function(t){return t=t||{},t.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},e.fromExtendedJSON=function(t){if("$regex"in t)if(typeof t.$regex!="string"){if(t.$regex._bsontype==="BSONRegExp")return t}else return new e(t.$regex,e.parseOptions(t.$options));if("$regularExpression"in t)return new e(t.$regularExpression.pattern,e.parseOptions(t.$regularExpression.options));throw new Ot("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(t)))},e})();Object.defineProperty(sn.prototype,"_bsontype",{value:"BSONRegExp"});var us=(function(){function e(t){if(!(this instanceof e))return new e(t);this.value=t}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(){return this.value},e.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(){return{$symbol:this.value}},e.fromExtendedJSON=function(t){return new e(t.$symbol)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e})();Object.defineProperty(us.prototype,"_bsontype",{value:"Symbol"});var $l=z,fc=(function(e){Di(t,e);function t(r,n){var i=this;return i instanceof t?(z.isLong(r)?i=e.call(this,r.low,r.high,!0)||this:an(r)&&typeof r.t<"u"&&typeof r.i<"u"?i=e.call(this,r.i,r.t,!0)||this:i=e.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new t(r,n)}return t.prototype.toJSON=function(){return{$timestamp:this.toString()}},t.fromInt=function(r){return new t(z.fromInt(r,!0))},t.fromNumber=function(r){return new t(z.fromNumber(r,!0))},t.fromBits=function(r,n){return new t(r,n)},t.fromString=function(r,n){return new t(z.fromString(r,!0,n))},t.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},t.fromExtendedJSON=function(r){return new t(r.$timestamp)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},t.MAX_VALUE=z.MAX_UNSIGNED_VALUE,t})($l);function Vl(e){return an(e)&&Reflect.has(e,"_bsontype")&&typeof e._bsontype=="string"}var lc=2147483647,pc=-2147483648,hc=9223372036854776e3,mc=-9223372036854776e3,jl={$oid:Vt,$binary:er,$uuid:er,$symbol:us,$numberInt:Bi,$numberDecimal:ss,$numberDouble:Li,$numberLong:z,$minKey:cs,$maxKey:as,$regex:sn,$regularExpression:sn,$timestamp:fc};function dc(e,t){if(t===void 0&&(t={}),typeof e=="number"){if(t.relaxed||t.legacy)return e;if(Math.floor(e)===e){if(e>=pc&&e<=lc)return new Bi(e);if(e>=mc&&e<=hc)return z.fromNumber(e)}return new Li(e)}if(e==null||typeof e!="object")return e;if(e.$undefined)return null;for(var r=Object.keys(e).filter(function(d){return d.startsWith("$")&&e[d]!=null}),n=0;n<r.length;n++){var i=jl[r[n]];if(i)return i.fromExtendedJSON(e,t)}if(e.$date!=null){var o=e.$date,s=new Date;return t.legacy?typeof o=="number"?s.setTime(o):typeof o=="string"&&s.setTime(Date.parse(o)):typeof o=="string"?s.setTime(Date.parse(o)):z.isLong(o)?s.setTime(o.toNumber()):typeof o=="number"&&t.relaxed&&s.setTime(o),s}if(e.$code!=null){var f=Object.assign({},e);return e.$scope&&(f.$scope=dc(e.$scope)),Pi.fromExtendedJSON(e)}if(xl(e)||e.$dbPointer){var h=e.$ref?e:e.$dbPointer;if(h instanceof on)return h;var _=Object.keys(h).filter(function(d){return d.startsWith("$")}),g=!0;if(_.forEach(function(d){["$ref","$id","$db"].indexOf(d)===-1&&(g=!1)}),g)return on.fromExtendedJSON(h)}return e}function Hl(e,t){return e.map(function(r,n){t.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return $e(r,t)}finally{t.seenObjects.pop()}})}function tc(e){var t=e.toISOString();return e.getUTCMilliseconds()!==0?t:t.slice(0,-5)+"Z"}function $e(e,t){if((typeof e=="object"||typeof e=="function")&&e!==null){var r=t.seenObjects.findIndex(function(F){return F.obj===e});if(r!==-1){var n=t.seenObjects.map(function(F){return F.propertyName}),i=n.slice(0,r).map(function(F){return"".concat(F," -> ")}).join(""),o=n[r],s=" -> "+n.slice(r+1,n.length-1).map(function(F){return"".concat(F," -> ")}).join(""),f=n[n.length-1],h=" ".repeat(i.length+o.length/2),_="-".repeat(s.length+(o.length+f.length)/2-1);throw new Ot(`Converting circular structure to EJSON:
|
|
11
|
-
`+" ".concat(i).concat(o).concat(s).concat(f,`
|
|
12
|
-
`)+" ".concat(h,"\\").concat(_,"/"))}t.seenObjects[t.seenObjects.length-1].obj=e}if(Array.isArray(e))return Hl(e,t);if(e===void 0)return null;if(e instanceof Date||bl(e)){var g=e.getTime(),d=g>-1&&g<2534023188e5;return t.legacy?t.relaxed&&d?{$date:e.getTime()}:{$date:tc(e)}:t.relaxed&&d?{$date:tc(e)}:{$date:{$numberLong:e.getTime().toString()}}}if(typeof e=="number"&&(!t.relaxed||!isFinite(e))){if(Math.floor(e)===e){var E=e>=pc&&e<=lc,v=e>=mc&&e<=hc;if(E)return{$numberInt:e.toString()};if(v)return{$numberLong:e.toString()}}return{$numberDouble:e.toString()}}if(e instanceof RegExp||wl(e)){var T=e.flags;if(T===void 0){var A=e.toString().match(/[gimuy]*$/);A&&(T=A[0])}var B=new sn(e.source,T);return B.toExtendedJSON(t)}return e!=null&&typeof e=="object"?Gl(e,t):e}var Wl={Binary:function(e){return new er(e.value(),e.sub_type)},Code:function(e){return new Pi(e.code,e.scope)},DBRef:function(e){return new on(e.collection||e.namespace,e.oid,e.db,e.fields)},Decimal128:function(e){return new ss(e.bytes)},Double:function(e){return new Li(e.value)},Int32:function(e){return new Bi(e.value)},Long:function(e){return z.fromBits(e.low!=null?e.low:e.low_,e.low!=null?e.high:e.high_,e.low!=null?e.unsigned:e.unsigned_)},MaxKey:function(){return new as},MinKey:function(){return new cs},ObjectID:function(e){return new Vt(e)},ObjectId:function(e){return new Vt(e)},BSONRegExp:function(e){return new sn(e.pattern,e.options)},Symbol:function(e){return new us(e.value)},Timestamp:function(e){return fc.fromBits(e.low,e.high)}};function Gl(e,t){if(e==null||typeof e!="object")throw new tr("not an object instance");var r=e._bsontype;if(typeof r>"u"){var n={};for(var i in e){t.seenObjects.push({propertyName:i,obj:null});try{var o=$e(e[i],t);i==="__proto__"?Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):n[i]=o}finally{t.seenObjects.pop()}}return n}else if(Vl(e)){var s=e;if(typeof s.toExtendedJSON!="function"){var f=Wl[e._bsontype];if(!f)throw new Ot("Unrecognized or invalid _bsontype: "+e._bsontype);s=f(s)}return r==="Code"&&s.scope?s=new Pi(s.code,$e(s.scope,t)):r==="DBRef"&&s.oid&&(s=new on($e(s.collection,t),$e(s.oid,t),$e(s.db,t),$e(s.fields,t))),s.toExtendedJSON(t)}else throw new tr("_bsontype must be a string, but was: "+typeof r)}var ec;(function(e){function t(o,s){var f=Object.assign({},{relaxed:!0,legacy:!1},s);return typeof f.relaxed=="boolean"&&(f.strict=!f.relaxed),typeof f.strict=="boolean"&&(f.relaxed=!f.strict),JSON.parse(o,function(h,_){if(h.indexOf("\0")!==-1)throw new tr("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(h)));return dc(_,f)})}e.parse=t;function r(o,s,f,h){f!=null&&typeof f=="object"&&(h=f,f=0),s!=null&&typeof s=="object"&&!Array.isArray(s)&&(h=s,s=void 0,f=0);var _=Object.assign({relaxed:!0,legacy:!1},h,{seenObjects:[{propertyName:"(root)",obj:null}]}),g=$e(o,_);return JSON.stringify(g,s,f)}e.stringify=r;function n(o,s){return s=s||{},JSON.parse(r(o,s))}e.serialize=n;function i(o,s){return s=s||{},t(JSON.stringify(o),s)}e.deserialize=i})(ec||(ec={}));var rc,nc=oc();nc.Map?rc=nc.Map:rc=(function(){function e(t){t===void 0&&(t=[]),this._keys=[],this._values={};for(var r=0;r<t.length;r++)if(t[r]!=null){var n=t[r],i=n[0],o=n[1];this._keys.push(i),this._values[i]={v:o,i:this._keys.length-1}}}return e.prototype.clear=function(){this._keys=[],this._values={}},e.prototype.delete=function(t){var r=this._values[t];return r==null?!1:(delete this._values[t],this._keys.splice(r.i,1),!0)},e.prototype.entries=function(){var t=this,r=0;return{next:function(){var n=t._keys[r++];return{value:n!==void 0?[n,t._values[n].v]:void 0,done:n===void 0}}}},e.prototype.forEach=function(t,r){r=r||this;for(var n=0;n<this._keys.length;n++){var i=this._keys[n];t.call(r,this._values[i].v,i,r)}},e.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},e.prototype.has=function(t){return this._values[t]!=null},e.prototype.keys=function(){var t=this,r=0;return{next:function(){var n=t._keys[r++];return{value:n!==void 0?n:void 0,done:n===void 0}}}},e.prototype.set=function(t,r){return this._values[t]?(this._values[t].v=r,this):(this._keys.push(t),this._values[t]={v:r,i:this._keys.length-1},this)},e.prototype.values=function(){var t=this,r=0;return{next:function(){var n=t._keys[r++];return{value:n!==void 0?t._values[n].v:void 0,done:n===void 0}}}},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),e})();var d0=z.fromNumber(Sl),g0=z.fromNumber(Il);var rs=new Uint8Array(8),y0=new DataView(rs.buffer,rs.byteOffset,rs.byteLength);var Yl=1024*1024*17,_0=ct.alloc(Yl);var ae=class{constructor(t,r={},n,i){this.name=t;this.properties=r;this.id=i?new Vt(i):new Vt,this.occurred=new Date,n&&(this.trigger=new Oi(n)),this.newEvent=!i}trigger;items;videos;id;newEvent;cart;currentItem;deviceProps;landingPage;occurred;page;sessionID;sessionNumber;locale;setVideos(t){t&&(this.videos=[t.id],this.properties.current??={videoID:t.id})}};function S0(){return window.CooeeSDK?.uaParser.getDevice().type==="mobile"}function I0(e,t){Object.assign(e.style,t)}function x0(e,t,r){if(t){if(!r){e.style.removeProperty(t);return}e.style.setProperty(t,r,"important")}}function fs(e){if(!e)return!1;if(e.tagName.toLowerCase()==="cart-drawer"&&e.hasAttribute("open"))return!0;let r=e.getBoundingClientRect(),n=(window.innerHeight||document.documentElement.clientHeight)+.5,i=(window.innerWidth||document.documentElement.clientWidth)+.5,o=getComputedStyle(e);if(o.display==="none"||o.visibility==="hidden"||parseFloat(o.opacity)===0||e.hidden||!(e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0))return!1;let _=Math.max(0,Math.min(r.right,i)-Math.max(r.left,0)),g=Math.max(0,Math.min(r.bottom,n)-Math.max(r.top,0)),d=_*g,E=r.width*r.height;if(!(E>0&&d/E>=.1))return!1;let T=r.top<=n&&r.bottom>=0,A=r.left<=i&&r.right>=0,B=T&&A,F=o.transform.match(/matrix\(([^)]+)\)/),G=0,D=0;if(F){let it=F[1].split(", ").map(parseFloat);G=it[4],D=it[5]}let W=G+r.left>i||G+r.right<0||D+r.top>n||D+r.bottom<0;return B||!W}var T0=e=>new Promise((t,r)=>{let n=new Image;n.onload=()=>{t({width:n.width,height:n.height})},n.onerror=r,n.src=e,n.style.display="none"});var Du=Oe(En());function rt(e){return typeof e=="function"}function Ar(e){let r=e(n=>{Error.call(n),n.stack=new Error().stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Ui=Ar(e=>function(r){e(this),this.message=r?`${r.length} errors occurred during unsubscription:
|
|
13
|
-
${r.map((n,i)=>`${i+1}) ${n.toString()}`).join(`
|
|
14
|
-
`)}`:"",this.name="UnsubscriptionError",this.errors=r});function rr(e,t){if(e){let r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ce=class e{constructor(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let t;if(!this.closed){this.closed=!0;let{_parentage:r}=this;if(r)if(this._parentage=null,Array.isArray(r))for(let o of r)o.remove(this);else r.remove(this);let{initialTeardown:n}=this;if(rt(n))try{n()}catch(o){t=o instanceof Ui?o.errors:[o]}let{_finalizers:i}=this;if(i){this._finalizers=null;for(let o of i)try{gc(o)}catch(s){t=t??[],s instanceof Ui?t=[...t,...s.errors]:t.push(s)}}if(t)throw new Ui(t)}}add(t){var r;if(t&&t!==this)if(this.closed)gc(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}}_hasParent(t){let{_parentage:r}=this;return r===t||Array.isArray(r)&&r.includes(t)}_addParent(t){let{_parentage:r}=this;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t}_removeParent(t){let{_parentage:r}=this;r===t?this._parentage=null:Array.isArray(r)&&rr(r,t)}remove(t){let{_finalizers:r}=this;r&&rr(r,t),t instanceof e&&t._removeParent(this)}};ce.EMPTY=(()=>{let e=new ce;return e.closed=!0,e})();var ls=ce.EMPTY;function Mi(e){return e instanceof ce||e&&"closed"in e&&rt(e.remove)&&rt(e.add)&&rt(e.unsubscribe)}function gc(e){rt(e)?e():e.unsubscribe()}var de={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Pr={setTimeout(e,t,...r){let{delegate:n}=Pr;return n?.setTimeout?n.setTimeout(e,t,...r):setTimeout(e,t,...r)},clearTimeout(e){let{delegate:t}=Pr;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function Fi(e){Pr.setTimeout(()=>{let{onUnhandledError:t}=de;if(t)t(e);else throw e})}function ps(){}var yc=hs("C",void 0,void 0);function _c(e){return hs("E",void 0,e)}function vc(e){return hs("N",e,void 0)}function hs(e,t,r){return{kind:e,value:t,error:r}}var nr=null;function Lr(e){if(de.useDeprecatedSynchronousErrorHandling){let t=!nr;if(t&&(nr={errorThrown:!1,error:null}),e(),t){let{errorThrown:r,error:n}=nr;if(nr=null,r)throw n}}else e()}function wc(e){de.useDeprecatedSynchronousErrorHandling&&nr&&(nr.errorThrown=!0,nr.error=e)}var ir=class extends ce{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,Mi(t)&&t.add(this)):this.destination=Jl}static create(t,r,n){return new Ve(t,r,n)}next(t){this.isStopped?ds(vc(t),this):this._next(t)}error(t){this.isStopped?ds(_c(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?ds(yc,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},ql=Function.prototype.bind;function ms(e,t){return ql.call(e,t)}var gs=class{constructor(t){this.partialObserver=t}next(t){let{partialObserver:r}=this;if(r.next)try{r.next(t)}catch(n){ki(n)}}error(t){let{partialObserver:r}=this;if(r.error)try{r.error(t)}catch(n){ki(n)}else ki(t)}complete(){let{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(r){ki(r)}}},Ve=class extends ir{constructor(t,r,n){super();let i;if(rt(t)||!t)i={next:t??void 0,error:r??void 0,complete:n??void 0};else{let o;this&&de.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=()=>this.unsubscribe(),i={next:t.next&&ms(t.next,o),error:t.error&&ms(t.error,o),complete:t.complete&&ms(t.complete,o)}):i=t}this.destination=new gs(i)}};function ki(e){de.useDeprecatedSynchronousErrorHandling?wc(e):Fi(e)}function zl(e){throw e}function ds(e,t){let{onStoppedNotification:r}=de;r&&Pr.setTimeout(()=>r(e,t))}var Jl={closed:!0,next:ps,error:zl,complete:ps};var Br=typeof Symbol=="function"&&Symbol.observable||"@@observable";function bc(e){return e}function Ec(e){return e.length===0?bc:e.length===1?e[0]:function(r){return e.reduce((n,i)=>i(n),r)}}var Jt=(()=>{class e{constructor(r){r&&(this._subscribe=r)}lift(r){let n=new e;return n.source=this,n.operator=r,n}subscribe(r,n,i){let o=Kl(r)?r:new Ve(r,n,i);return Lr(()=>{let{operator:s,source:f}=this;o.add(s?s.call(o,f):f?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(r){try{return this._subscribe(r)}catch(n){r.error(n)}}forEach(r,n){return n=Sc(n),new n((i,o)=>{let s=new Ve({next:f=>{try{r(f)}catch(h){o(h),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)}[Br](){return this}pipe(...r){return Ec(r)(this)}toPromise(r){return r=Sc(r),new r((n,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>n(o))})}}return e.create=t=>new e(t),e})();function Sc(e){var t;return(t=e??de.Promise)!==null&&t!==void 0?t:Promise}function Xl(e){return e&&rt(e.next)&&rt(e.error)&&rt(e.complete)}function Kl(e){return e&&e instanceof ir||Xl(e)&&Mi(e)}function Ql(e){return rt(e?.lift)}function Ie(e){return t=>{if(Ql(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function ue(e,t,r,n,i){return new ys(e,t,r,n,i)}var ys=class extends ir{constructor(t,r,n,i,o,s){super(t),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=r?function(f){try{r(f)}catch(h){t.error(h)}}:super._next,this._error=i?function(f){try{i(f)}catch(h){t.error(h)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(f){t.error(f)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:r}=this;super.unsubscribe(),!r&&((t=this.onFinalize)===null||t===void 0||t.call(this))}}};var Ic=Ar(e=>function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var ge=(()=>{class e extends Jt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(r){let n=new $i(this,this);return n.operator=r,n}_throwIfClosed(){if(this.closed)throw new Ic}next(r){Lr(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(r)}})}error(r){Lr(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=r;let{observers:n}=this;for(;n.length;)n.shift().error(r)}})}complete(){Lr(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:r}=this;for(;r.length;)r.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0}_trySubscribe(r){return this._throwIfClosed(),super._trySubscribe(r)}_subscribe(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)}_innerSubscribe(r){let{hasError:n,isStopped:i,observers:o}=this;return n||i?ls:(this.currentObservers=null,o.push(r),new ce(()=>{this.currentObservers=null,rr(o,r)}))}_checkFinalizedStatuses(r){let{hasError:n,thrownError:i,isStopped:o}=this;n?r.error(i):o&&r.complete()}asObservable(){let r=new Jt;return r.source=this,r}}return e.create=(t,r)=>new $i(t,r),e})(),$i=class extends ge{constructor(t,r){super(),this.destination=t,this.source=r}next(t){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.next)===null||n===void 0||n.call(r,t)}error(t){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.error)===null||n===void 0||n.call(r,t)}complete(){var t,r;(r=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||r===void 0||r.call(t)}_subscribe(t){var r,n;return(n=(r=this.source)===null||r===void 0?void 0:r.subscribe(t))!==null&&n!==void 0?n:ls}};var cn=class extends ge{constructor(t){super(),this._value=t}get value(){return this.getValue()}_subscribe(t){let r=super._subscribe(t);return!r.closed&&t.next(this._value),r}getValue(){let{hasError:t,thrownError:r,_value:n}=this;if(t)throw r;return this._throwIfClosed(),n}next(t){super.next(this._value=t)}};var un={now(){return(un.delegate||Date).now()},delegate:void 0};var fn=class extends ge{constructor(t=1/0,r=1/0,n=un){super(),this._bufferSize=t,this._windowTime=r,this._timestampProvider=n,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=r===1/0,this._bufferSize=Math.max(1,t),this._windowTime=Math.max(1,r)}next(t){let{isStopped:r,_buffer:n,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;r||(n.push(t),!i&&n.push(o.now()+s)),this._trimBuffer(),super.next(t)}_subscribe(t){this._throwIfClosed(),this._trimBuffer();let r=this._innerSubscribe(t),{_infiniteTimeWindow:n,_buffer:i}=this,o=i.slice();for(let s=0;s<o.length&&!t.closed;s+=n?1:2)t.next(o[s]);return this._checkFinalizedStatuses(t),r}_trimBuffer(){let{_bufferSize:t,_timestampProvider:r,_buffer:n,_infiniteTimeWindow:i}=this,o=(i?1:2)*t;if(t<1/0&&o<n.length&&n.splice(0,n.length-o),!i){let s=r.now(),f=0;for(let h=1;h<n.length&&n[h]<=s;h+=2)f=h;f&&n.splice(0,f+1)}}};var Vi=class extends ce{constructor(t,r){super()}schedule(t,r=0){return this}};var ln={setInterval(e,t,...r){let{delegate:n}=ln;return n?.setInterval?n.setInterval(e,t,...r):setInterval(e,t,...r)},clearInterval(e){let{delegate:t}=ln;return(t?.clearInterval||clearInterval)(e)},delegate:void 0};var ji=class extends Vi{constructor(t,r){super(t,r),this.scheduler=t,this.work=r,this.pending=!1}schedule(t,r=0){var n;if(this.closed)return this;this.state=t;let i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,r)),this.pending=!0,this.delay=r,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(o,this.id,r),this}requestAsyncId(t,r,n=0){return ln.setInterval(t.flush.bind(t,this),n)}recycleAsyncId(t,r,n=0){if(n!=null&&this.delay===n&&this.pending===!1)return r;r!=null&&ln.clearInterval(r)}execute(t,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let n=this._execute(t,r);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,r){let n=!1,i;try{this.work(t)}catch(o){n=!0,i=o||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){let{id:t,scheduler:r}=this,{actions:n}=r;this.work=this.state=this.scheduler=null,this.pending=!1,rr(n,this),t!=null&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,super.unsubscribe()}}};var Ur=class e{constructor(t,r=e.now){this.schedulerActionCtor=t,this.now=r}schedule(t,r=0,n){return new this.schedulerActionCtor(this,t).schedule(n,r)}};Ur.now=un.now;var Hi=class extends Ur{constructor(t,r=Ur.now){super(t,r),this.actions=[],this._active=!1}flush(t){let{actions:r}=this;if(this._active){r.push(t);return}let n;this._active=!0;do if(n=t.execute(t.state,t.delay))break;while(t=r.shift());if(this._active=!1,n){for(;t=r.shift();)t.unsubscribe();throw n}}};var pn=new Hi(ji),xc=pn;function Tc(e){return e&&rt(e.schedule)}function Cc(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function f(g){try{_(n.next(g))}catch(d){s(d)}}function h(g){try{_(n.throw(g))}catch(d){s(d)}}function _(g){g.done?o(g.value):i(g.value).then(f,h)}_((n=n.apply(e,t||[])).next())})}function Oc(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function or(e){return this instanceof or?(this.v=e,this):new or(e)}function Nc(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),f("next"),f("throw"),f("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(v){return function(T){return Promise.resolve(T).then(v,d)}}function f(v,T){n[v]&&(i[v]=function(A){return new Promise(function(B,F){o.push([v,A,B,F])>1||h(v,A)})},T&&(i[v]=T(i[v])))}function h(v,T){try{_(n[v](T))}catch(A){E(o[0][3],A)}}function _(v){v.value instanceof or?Promise.resolve(v.value.v).then(g,d):E(o[0][2],v)}function g(v){h("next",v)}function d(v){h("throw",v)}function E(v,T){v(T),o.shift(),o.length&&h(o[0][0],o[0][1])}}function Rc(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Oc=="function"?Oc(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(f,h){s=e[o](s),i(f,h,s.done,s.value)})}}function i(o,s,f,h){Promise.resolve(h).then(function(_){o({value:_,done:f})},s)}}var Wi=e=>e&&typeof e.length=="number"&&typeof e!="function";function Dc(e){return rt(e?.then)}function Ac(e){return rt(e[Br])}function Pc(e){return Symbol.asyncIterator&&rt(e?.[Symbol.asyncIterator])}function Lc(e){return new TypeError(`You provided ${e!==null&&typeof e=="object"?"an invalid object":`'${e}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function Zl(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Bc=Zl();function Uc(e){return rt(e?.[Bc])}function Mc(e){return Nc(this,arguments,function*(){let r=e.getReader();try{for(;;){let{value:n,done:i}=yield or(r.read());if(i)return yield or(void 0);yield yield or(n)}}finally{r.releaseLock()}})}function Fc(e){return rt(e?.getReader)}function je(e){if(e instanceof Jt)return e;if(e!=null){if(Ac(e))return tp(e);if(Wi(e))return ep(e);if(Dc(e))return rp(e);if(Pc(e))return kc(e);if(Uc(e))return np(e);if(Fc(e))return ip(e)}throw Lc(e)}function tp(e){return new Jt(t=>{let r=e[Br]();if(rt(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ep(e){return new Jt(t=>{for(let r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function rp(e){return new Jt(t=>{e.then(r=>{t.closed||(t.next(r),t.complete())},r=>t.error(r)).then(null,Fi)})}function np(e){return new Jt(t=>{for(let r of e)if(t.next(r),t.closed)return;t.complete()})}function kc(e){return new Jt(t=>{op(e,t).catch(r=>t.error(r))})}function ip(e){return kc(Mc(e))}function op(e,t){var r,n,i,o;return Cc(this,void 0,void 0,function*(){try{for(r=Rc(e);n=yield r.next(),!n.done;){let s=n.value;if(t.next(s),t.closed)return}}catch(s){i={error:s}}finally{try{n&&!n.done&&(o=r.return)&&(yield o.call(r))}finally{if(i)throw i.error}}t.complete()})}function $c(e,t,r,n=0,i=!1){let o=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!i)return o}var Vc=Ar(e=>function(){e(this),this.name="EmptyError",this.message="no elements in sequence"});function sr(e,t){let r=typeof t=="object";return new Promise((n,i)=>{let o=new Ve({next:s=>{n(s),o.unsubscribe()},error:i,complete:()=>{r?n(t.defaultValue):i(new Vc)}});e.subscribe(o)})}function jc(e){return e instanceof Date&&!isNaN(e)}function hn(e,t){return Ie((r,n)=>{let i=0;r.subscribe(ue(n,o=>{n.next(e.call(t,o,i++))}))})}var{isArray:sp}=Array;function ap(e,t){return sp(t)?e(...t):e(t)}function Gi(e){return hn(t=>ap(e,t))}function Hc(e,t,r,n,i,o,s,f){let h=[],_=0,g=0,d=!1,E=()=>{d&&!h.length&&!_&&t.complete()},v=A=>_<n?T(A):h.push(A),T=A=>{o&&t.next(A),_++;let B=!1;je(r(A,g++)).subscribe(ue(t,F=>{i?.(F),o?v(F):t.next(F)},()=>{B=!0},void 0,()=>{if(B)try{for(_--;h.length&&_<n;){let F=h.shift();s?$c(t,s,()=>T(F)):T(F)}E()}catch(F){t.error(F)}}))};return e.subscribe(ue(t,v,()=>{d=!0,E()})),()=>{f?.()}}function _s(e,t,r=1/0){return rt(t)?_s((n,i)=>hn((o,s)=>t(n,o,i,s))(je(e(n,i))),r):(typeof t=="number"&&(r=t),Ie((n,i)=>Hc(n,i,e,r)))}var cp=["addListener","removeListener"],up=["addEventListener","removeEventListener"],fp=["on","off"];function vs(e,t,r,n){if(rt(r)&&(n=r,r=void 0),n)return vs(e,t,r).pipe(Gi(n));let[i,o]=hp(e)?up.map(s=>f=>e[s](t,f,r)):lp(e)?cp.map(Wc(e,t)):pp(e)?fp.map(Wc(e,t)):[];if(!i&&Wi(e))return _s(s=>vs(s,t,r))(je(e));if(!i)throw new TypeError("Invalid event target");return new Jt(s=>{let f=(...h)=>s.next(1<h.length?h:h[0]);return i(f),()=>o(f)})}function Wc(e,t){return r=>n=>e[r](t,n)}function lp(e){return rt(e.addListener)&&rt(e.removeListener)}function pp(e){return rt(e.on)&&rt(e.off)}function hp(e){return rt(e.addEventListener)&&rt(e.removeEventListener)}function Gc(e,t,r){return r?Gc(e,t).pipe(Gi(r)):new Jt(n=>{let i=(...s)=>n.next(s.length===1?s[0]:s),o=e(i);return rt(t)?()=>t(i,o):void 0})}function Yc(e=0,t,r=xc){let n=-1;return t!=null&&(Tc(t)?r=t:n=t),new Jt(i=>{let o=jc(e)?+e-r.now():e;o<0&&(o=0);let s=0;return r.schedule(function(){i.closed||(i.next(s++),0<=n?this.schedule(void 0,n):i.complete())},o)})}function mp(e,t){return Ie((r,n)=>{let i=0;r.subscribe(ue(n,o=>e.call(t,o,i++)&&n.next(o)))})}function ws(e,t=pn){return Ie((r,n)=>{let i=null,o=null,s=null,f=()=>{if(i){i.unsubscribe(),i=null;let _=o;o=null,n.next(_)}};function h(){let _=s+e,g=t.now();if(g<_){i=this.schedule(void 0,_-g),n.add(i);return}f()}r.subscribe(ue(n,_=>{o=_,s=t.now(),i||(i=t.schedule(h,e),n.add(i))},()=>{f(),n.complete()},void 0,()=>{o=i=null}))})}function qc(e,t){return Ie((r,n)=>{let{leading:i=!0,trailing:o=!1}=t??{},s=!1,f=null,h=null,_=!1,g=()=>{h?.unsubscribe(),h=null,o&&(v(),_&&n.complete())},d=()=>{h=null,_&&n.complete()},E=T=>h=je(e(T)).subscribe(ue(n,g,d)),v=()=>{if(s){s=!1;let T=f;f=null,n.next(T),!_&&E(T)}};r.subscribe(ue(n,T=>{s=!0,f=T,!(h&&!h.closed)&&(i?v():E(T))},()=>{_=!0,!(o&&s&&h&&!h.closed)&&n.complete()}))})}function bs(e,t=pn,r){let n=Yc(e,t);return qc(()=>n,r)}var ar=(n=>(n[n.LOW=1]="LOW",n[n.MEDIUM=2]="MEDIUM",n[n.HIGH=3]="HIGH",n))(ar||{});var dp="2024-10",gp=`/api/${dp}/graphql.json`,zc={"Content-Type":"application/json"};async function Yi(e,t,r,n){let i=Wt.get().storefrontToken;if(!i)throw new Error("Storefront token not set for the store");let o=new Headers(zc);o.append("X-Shopify-Storefront-Access-Token",i);let s=JSON.stringify({query:e,variables:t});try{return await Ne(gp,{method:"POST",headers:o,body:s})}catch(f){throw vt(f,r,{engagementTrigger:n}),f}}function cr(e,t){return yp(si(e),t)}async function yp(e,t){let r={body:JSON.stringify(t),method:"POST",headers:zc};return Ne(e,r)}var qi=class{isLocked=!1;queue=[];async acquire(){if(this.isLocked)await new Promise(t=>this.queue.push(t));else{this.isLocked=!0;return}}release(){if(this.queue.length>0){let t=this.queue.shift();t&&t()}else this.isLocked=!1}},zi=class e{static LOCK_TIMEOUT=1e4;static RETRY_INTERVAL=200;static MAX_RETRIES=50;static async request(t,r){if(t=`__cooee_${t}_lock__`,"locks"in navigator&&!vp())try{return await _p(t,r,this.LOCK_TIMEOUT)}catch(s){R.verbose(`Web Locks API failed, falling back to localStorage: ${s}`)}let n=!1,i=0,o=Math.random().toString(36).substring(2,10);for(;i++<this.MAX_RETRIES&&(R.verbose(`Lock retry ${i} for ${t}`),n=await this.acquire(t,o,i),!n);)await this.sleep(e.RETRY_INTERVAL*i+Math.random()*100);try{return await r()}finally{this.release(t,o)}}static async acquire(t,r,n){let i=Date.now(),o=localStorage.getItem(t),s=o?JSON.parse(o):null;if(s&&i<=s.expiry)return!1;let f={owner:r,expiry:i+e.LOCK_TIMEOUT};return localStorage.setItem(t,JSON.stringify(f)),await this.sleep(150+Math.random()*100),JSON.parse(localStorage.getItem(t)||"{}").owner===r?(R.verbose(`${r}: Lock acquired for ${t} after ${n} attempts!`),!0):(R.verbose(`${r}: Race lost. Another tab acquired the lock.`),!1)}static release(t,r){let n=localStorage.getItem(t);if(!n)return;let i=JSON.parse(n);i.owner===r?(localStorage.removeItem(t),R.verbose(`${r}: Lock released`)):R.verbose(`${r}: Cannot release lock. Current owner: ${i.owner}`)}static sleep(t){return new Promise(r=>setTimeout(r,t))}};async function _p(e,t,r){return new Promise((n,i)=>{let o=setTimeout(()=>{i(new Error(`Web Locks API timeout after ${r}ms`))},r);navigator.locks.request(e,async()=>{try{let s=await t();return clearTimeout(o),n(s),s}catch(s){throw clearTimeout(o),i(s),s}}).catch(s=>{clearTimeout(o),i(s)})})}function vp(){let e=navigator.userAgent||"";return/Safari/.test(e)&&!/Chrome/.test(e)&&!/Chromium/.test(e)||/iPhone|iPad|iPod/i.test(e)&&(/(FBAV|FBAN|Instagram|Twitter|Line|WhatsApp)/i.test(e)||!window.safari?.pushNotificaTion)||/Macintosh/.test(e)&&/Safari/.test(e)&&!/Chrome/.test(e)&&!/Chromium/.test(e)&&!window.safari?.pushNotification?!0:wp()}function wp(){try{return window.safari?.pushNotification?window.safari.pushNotification.toString()==="[object SafariRemoteNotification]":!window.indexedDB||!window.localStorage}catch{return!0}}var Es=new qi;function Jc(){bp().catch(e=>{R.error("Fail to add attributes in cart",e)})}async function bp(){await Es.acquire();let e=yt.getCurrent(),t=await mo();if(e.attributes?.letscooee_did===t.letscooee_did&&e.attributes?.letscooee_sn===t.letscooee_sn){R.verbose("Not calling Shopify update.js API.","Current attributes:",e.attributes),Es.release();return}try{let r=await cr("/cart/update.js",{attributes:t});R.verbose("Updated cart attributes",JSON.stringify(r.data)),e.update(r.data)}catch(r){R.error("Failed to add cart attributes",r)}Es.release()}var Xc=Oe(Ss()),Xi=class e{static META_REQUIRED_FIELDS=["ad_id"];static GOOGLE_REQUIRED_FIELDS=["gad_source","gclid"];source;adID;campaignID;adName;campaignName;constructor(t){this.adID=t.adID,this.campaignID=t.campaignID,this.source=t.source}static getAdParams(){let t;try{t=new Xc.URLBuilder(location.href)}catch{return{}}let r={};if(this.META_REQUIRED_FIELDS.every(o=>Array.from(t.getParams().keys()).includes(o)))return r={source:"META",adID:t.getQueryParam("ad_id")?.trim(),campaignID:t.getQueryParam("campaign_id")?.trim()},new e(r);if(this.GOOGLE_REQUIRED_FIELDS.every(o=>Array.from(t.getParams().keys()).includes(o)))return r={source:"GOOGLE"},new e(r)}};var Qc=Oe(Ss());var Sp=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"],Kc={utm_source:"tw_source",utm_campaign:"tw_campaign"};var Zc=()=>{if(document.referrer)return document.referrer.replace(location.origin,"")},tu=()=>{let e;try{e=new Qc.URLBuilder(location.href)}catch{return{}}let t={};Sp.forEach(n=>{let i=e.getQueryParam(n);i&&(t[n]=i)});let r={};return Object.keys(Kc).forEach(n=>{let i=e.getQueryParam(Kc[n]);i&&(r[n]=i)}),J(J({},r),t)};var Is=class{origin;path;qs;name;referrer;utmSource;utmMedium;utmCampaign;utmId;utmTerm;utmContent;constructor(t){this.name=t.name,this.path=t.path,this.qs=t.qs,this.referrer=t.referrer,this.utmSource=t.utmSource||t.utm_source,this.utmMedium=t.utmMedium||t.utm_medium,this.utmCampaign=t.utmCampaign||t.utm_campaign,this.utmId=t.utmId||t.utm_id,this.utmTerm=t.utmTerm||t.utm_term,this.utmContent=t.utmContent||t.utm_content}};function Ki(){let e=location.pathname==="/"?location.pathname:location.pathname.replace(/\/+$/,"");return new Is(J({origin:location.origin,path:e,qs:location.search,referrer:Zc(),name:St().pageName},tu()))}function rE(){let e=St(),t=new URLSearchParams(location.search),r=t.get("cooee-preview");if(r){let i=r.split(",").map(o=>o.trim()).filter(o=>Number.isInteger(+o));i.length&&(e.previewIDs=i)}let n=t.get("cooee-variant")?.trim();n&&(e.previewVariant=n)}function Qi(){let e=St();return Gt(J(Gt(J({},e.customContext),{page:Ki(),locale:e.locale,currentItem:e.currentItem,previewIDs:e.previewIDs,previewVariant:e.previewVariant,engagementIDs:xp(),cart:jo()}),Ip()),{host:window.location.host})}function Ip(){let e=window.CooeeSDK.uaParser.getResult();return{os:e.os,device:e.device,browser:e.browser}}function xp(){let e=document.querySelectorAll(".letscooee-engagement"),t=[];return e.forEach(r=>{let n=r.dataset.engagementId;n&&+n&&t.push(n)}),t}var Tp="keepalive"in new Request(""),xe=new Headers;Rp();async function ru(){let[e]=await Promise.all([eu()]);return J(J({},Qi()),e)}function nu(e){sr(He).then(()=>Op(e??{}))}function Op(e){au("/v1/user/update",e).then(()=>{R.verbose("Updated user profile")}).catch(t=>{R.error("Error saving user profile",t)})}function iu(e){return Mr("/v1/event/generate-discount",e)}function SE(e){sr(He).then(()=>Cp({props:e}))}function Cp(e){au("/v1/device/update",e).then(()=>{R.verbose("Updated device properties")}).catch(async t=>{R.error("Error saving device property",t)})}function ou(e){e&&xe.set("cooee-device-id",e)}function su(e){e&&xe.set("cooee-first-seen",e.toUTCString())}function Mr(e,t){return cu("POST",e,t)}function au(e,t){return cu("PUT",e,t)}function cu(e,t,r){if(!en()&&!St().flags?.allowEvents)return R.log(`Rejecting ${e} ${t} as this is not e-commerce app`),Promise.reject();if(t.startsWith("http")||(t=lr.apiURL+t),r&&!Tp&&t.includes(xs))return Np(t,xe,r);let n={method:e,headers:xe,keepalive:!1};return r&&(n.body=JSON.stringify(r)),Ne(t,n)}function Np(e,t,r){return new Promise((n,i)=>{let o=new XMLHttpRequest;o.open("POST",e,!0),t.forEach((s,f)=>{o.setRequestHeader(f,s)}),o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE)if(o.status>=200&&o.status<300)try{if(o.getResponseHeader("Content-Type")?.includes("application/json")){let f=JSON.parse(o.responseText);n({data:f,headers:t,request:o,status:o.status,statusText:o.statusText})}else i(new Error("Content-Type of response header is not json"))}catch(s){i(s)}else i(new Error(`Received status - ${o.status}(${o.statusText})`))},o.onerror=()=>{i(new Error("Network error occurred during the request."))},o.send(JSON.stringify(r))})}function Rp(){xe.set("Content-Type","application/json; charset=utf-8"),xe.set("cooee-sdk",wn),xe.set("cooee-sdk-code",$s.toString()),xe.set("cooee-sdk-version",bn),xe.set("cooee-shop-name",Fa()??"");let e=localStorage.getItem("cooeeDebugTill");(lr.debug||e&&new Date(e)>new Date)&&xe.set("cooee-sdk-debug","true")}var Ts={d:(e,t)=>{for(var r in t)Ts.o(t,r)&&!Ts.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},Os={};Ts.d(Os,{A:()=>Dp,k:()=>Cs});var mn=function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(_){try{h(n.next(_))}catch(g){o(g)}}function f(_){try{h(n.throw(_))}catch(g){o(g)}}function h(_){var g;_.done?i(_.value):(g=_.value,g instanceof r?g:new r(function(d){d(g)})).then(s,f)}h((n=n.apply(e,t||[])).next())})},dn=function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function f(h){return function(_){return(function(g){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,g[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&g[0]?n.return:g[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,g[1])).done)return i;switch(n=0,i&&(g=[2&g[0],i.value]),g[0]){case 0:case 1:i=g;break;case 4:return s.label++,{value:g[1],done:!1};case 5:s.label++,n=g[1],g=[0];continue;case 7:g=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||g[0]!==6&&g[0]!==2)){s=0;continue}if(g[0]===3&&(!i||g[1]>i[0]&&g[1]<i[3])){s.label=g[1];break}if(g[0]===6&&s.label<i[1]){s.label=i[1],i=g;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(g);break}i[2]&&s.ops.pop(),s.trys.pop();continue}g=t.call(e,s)}catch(d){g=[6,d],n=0}finally{r=i=0}if(5&g[0])throw g[1];return{value:g[0]?g[1]:void 0,done:!0}})([h,_])}}};function Cs(){return mn(this,void 0,Promise,function(){return dn(this,function(e){switch(e.label){case 0:return[4,new Promise(function(t,r){var n="Unknown",i=!1;function o(v){i||(i=!0,t({isPrivate:v,browserName:n}))}function s(){var v=0,T=parseInt("-1");try{T.toFixed(T)}catch(A){v=A.message.length}return v}function f(){return navigator.msSaveBlob!==void 0&&(function(v){try{return v===eval.toString().length}catch{return!1}})(39)}function h(){var v;return mn(this,void 0,void 0,function(){var T,A;return dn(this,function(B){switch(B.label){case 0:return B.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return B.sent(),o(!1),[3,3];case 2:return T=B.sent(),A=T,T instanceof Error&&(A=(v=T.message)!==null&&v!==void 0?v:T),typeof A!="string"?(o(!1),[2]):(o(!!A.includes("unknown transient reason")),[3,3]);case 3:return[2]}})})}function _(){var v;return mn(this,void 0,Promise,function(){return dn(this,function(T){switch(T.label){case 0:return((v=navigator.storage)===null||v===void 0?void 0:v.getDirectory)===void 0?[3,2]:[4,h()];case 1:return T.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var A=String(Math.random());try{var B=indexedDB.open(A,1);B.onupgradeneeded=function(F){var G=F.target.result,D=function(W){o(W)};try{G.createObjectStore("t",{autoIncrement:!0}).put(new Blob),D(!1)}catch(W){(W.message||"").includes("are not yet supported")?D(!0):D(!1)}finally{G.close(),indexedDB.deleteDatabase(A)}},B.onerror=function(){return o(!1)}}catch{o(!1)}})():(function(){var A=window.openDatabase,B=window.localStorage;try{A(null,null,null,null)}catch{return void o(!0)}try{B.setItem("test","1"),B.removeItem("test")}catch{return void o(!0)}o(!1)})(),T.label=3;case 3:return[2]}})})}function g(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(v,T){var A;o(Math.round(T/1048576)<2*Math.round(((A=window).performance!==void 0&&A.performance.memory!==void 0&&A.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576))},function(v){r(new Error("detectIncognito somehow failed to query storage quota: "+v.message))})}function d(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?g():(0,window.webkitRequestFileSystem)(0,1,function(){o(!1)},function(){o(!0)})}function E(){return mn(this,void 0,Promise,function(){var v,T;return dn(this,function(A){switch(A.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return[3,4];A.label=1;case 1:return A.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return A.sent(),o(!1),[3,4];case 3:return v=A.sent(),typeof(T=v instanceof Error&&typeof v.message=="string"?v.message:String(v))!="string"?(o(!1),[2]):(o(T.includes("Security error")),[2]);case 4:return o(navigator.serviceWorker===void 0),[2]}})})}(function(){return mn(this,void 0,Promise,function(){return dn(this,function(v){switch(v.label){case 0:return s()!==44?[3,2]:(n="Safari",[4,_()]);case 1:return v.sent(),[3,6];case 2:return s()!==51?[3,3]:(T=navigator.userAgent,n=T.match(/Chrome/)?navigator.brave!==void 0?"Brave":T.match(/Edg/)?"Edge":T.match(/OPR/)?"Opera":"Chrome":"Chromium",d(),[3,6]);case 3:return s()!==25?[3,5]:(n="Firefox",[4,E()]);case 4:return v.sent(),[3,6];case 5:f()?(n="Internet Explorer",o(window.indexedDB===void 0)):r(new Error("detectIncognito cannot determine the browser")),v.label=6;case 6:return[2]}var T})})})().catch(r)})];case 1:return[2,e.sent()]}})})}typeof window<"u"&&(window.detectIncognito=Cs);var Dp=Cs,uu=Os.A,TE=Os.k;var fu=Oe(En()),lu=async()=>{let e={};try{return await Ap(e)}catch(t){return vt(t,"device-properties"),e}},Ap=async e=>{let t=window.CooeeSDK.uaParser;Pp(e),Lp(e),Bp(e),e.referrer=document.referrer,e.host=location.origin,e.path=location.pathname,e.qs=location.search,e.locale=navigator.language,e.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:Up()},e.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(e.headless=!0,mr({headless:!0}));let r=t.getResult();return e.browser=r.browser,e.device=r.device,e.engine=r.engine,e.cpu=r.cpu,e.os=r.os,e.navigatorUA=navigator.userAgent,await Promise.all([kp(e),Mp(e),$p(e)]),e},Pp=e=>{let t=navigator;if(!t.deviceMemory)return;let r=t.deviceMemory;e.mem={tot:r*1024}},Lp=e=>{let t=navigator,r=t.connection||t.mozConnection||t.webkitConnection;r?.effectiveType&&(e.net={type:r.effectiveType})},Bp=e=>{let t=screen.orientation?.type;t&&(e.orientation=t)},Up=()=>{if(!document.body)return;let e=document.createElement("div");e.setAttribute("style","height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"),document.body.appendChild(e);let t=window.devicePixelRatio||1,r=e.offsetWidth*t;return document.body.removeChild(e),r},Mp=async e=>{try{await Fp(e)}catch(t){R.error("Unable to get location",t)}},Fp=async e=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:"geolocation"})).state!="granted"))return new Promise(r=>{navigator.geolocation.getCurrentPosition(n=>{e.coords=[n.coords.latitude,n.coords.longitude],r()},()=>r())})},kp=async e=>{if("getBattery"in navigator)try{let r=await navigator.getBattery();e.bat={l:r.level*100,c:r.charging},mr({"battery.level":e.bat.l,"battery.charging":e.bat.c})}catch{}},$p=async e=>{try{(await uu())?.isPrivate&&(e.incognito=!0,mr({incognito:!0}))}catch(t){fu.default.error("Unable to detect private/incognito window",t)}};function pu(e){mu()}function hu(e){if(!mu())return;let t=ar[e]?.toLowerCase();t&&(R.verbose(`Sending ${t} intent to MS Clarity`),window.clarity("set","Cooee Intent",t))}function mu(){return window.clarity&&typeof window.clarity=="function"}var He=new fn(1),gu="App ID or Shopify shop is not set",Ns="",We="",Rs="",Zi;function tS(e){Ns=e.appID,Rs=e.shopifyShop,Vp().then(async()=>{He.next(!0),He.complete()}).catch(t=>{t?.message?.includes(gu)&&vt(t,"initiate-session",{extra:e}),R.error("Unable to initiate session",t)})}async function eu(){return await yu(),Zi}async function eS(){let e=Date.now();await zi.request("gen_did",async()=>{We=await Bt.get("did"),We||(We=new Vt().toHexString(),await Bt.set("did",We)),R.info("Device ID:",We),vu(We)}),R.info(`Device ID set/get done in \u23F0 ${pr(Date.now()-e)}`)}async function du(){if(Zi)return;let[e,t,r]=await Promise.all([Yt.get("id",""),Bt.get("sessionNumber",1),Yt.get("landing",{})]);_u(e,t,r)}async function Vp(){await yu()}async function yu(){let e=!1;await Hp()?(await jp(),e=!0):await Wp()?(await du(),e=!0):await du(),e&&await Yp()}async function jp(){R.info("Starting new session"),await Yt.clear();let e=new Date,t=new Vt().toHexString(),r=await Bt.get("sessionNumber",0)+1,n=Ki();await Promise.all([Bt.set("sessionNumber",r),Yt.set("id",t),Yt.set("lastUsedTime",e.getTime()),Yt.set("landing",n)]),_u(t,r,n)}async function Hp(){let e=await Yt.get("lastUsedTime",0);return e?(new Date().getTime()-e)/1e3>1800:!0}async function Wp(){return!await Yt.get("synced",!1)}async function Gp(){if(!Ns&&!Rs)throw new Error(gu);let e=await lu(),t=Qi();return Gt(J(J({deviceID:We,deviceProps:e,appID:Ns,shopifyShop:Rs},Zi),t),{sdk:wn,ad:Xi.getAdParams(),occurred:zp(St().jsLoadTime),properties:{},uuid:await Bt.get("uuid")})}async function Yp(){R.info("Ensuring session on server"),await qp();let e=Date.now(),t=await Gp();R.info(`Session data fetched in \u23F0 ${pr(Date.now()-e)}`);try{let r=await Mr("/v1/event/validate-session",t);R.info(`Auth finished in \u23F0 ${pr(r.timeTakenMs)}`),await Yt.set("synced",!0),r.data.deviceID&&(await Bt.set("did",We),vu(r.data.deviceID))}catch(r){throw R.error(r),r}}async function qp(){let e=await Bt.get("firstSeen"),t=e?new Date(e):new Date;e||await Bt.set("firstSeen",t.toISOString()),su(t),Dn("Visitor Info",{first_seen:t.toISOString()})}function _u(e,t,r){mr({"cooee_session.number":t}),Dn("Visitor Session",{id:e,number:t,landing_page:r}),R.info(`Session number: ${t}, id: ${e}`),Zi={sessionID:e,sessionNumber:t,landingPage:r}}function vu(e){pu(e),ou(e);let t=`device_id_${Math.floor(Math.random()*1e4)}`;Dn("Visitor Info",{device_id:e,[t]:e}),na({id:e})}function zp(e){return(new Date().getTime()-e.getTime())/1e3>1800?new Date:e}function aS(){document.onvisibilitychange=()=>{document.visibilityState==="visible"?Jp():document.visibilityState==="hidden"&&Xp()}}async function Jp(){}async function Xp(){let e=await Kp();if(e===0){R.info("Not sending duration as user was inactive on website");return}bu(e)}async function Kp(){let e=St();return e.inInactive?0:(e.inInactive=!0,e.lastEnterInactive=new Date,Math.max(e.lastEnterInactive.getTime()-e.lastEnterActive.getTime(),0))}function wu(){let e=St();return e.inInactive?(e.inInactive=!1,e.lastEnterActive=new Date,Math.max((e.lastEnterActive.getTime()-e.lastEnterInactive.getTime())/1e3,0)):0}var to=class{triggerData;render(t){t.contentSource===Xr.KLAVIYO&&(this.triggerData=t,window.addEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),window._klOnsite=window._klOnsite||[],window._klOnsite.push(["openForm",t.klaviyoFormID]))}handleKlaviyoEvents(t){if(t.type!=="klaviyoForms")return;let r=t.detail;if(r.formId!==this.triggerData.klaviyoFormID){R.warn("Received invalid trigger callback");return}switch(r.type){case"open":Le(new ae("CE Trigger Displayed",{form:{id:r.formId}},this.triggerData));break;case"stepSubmit":{let n=this.getFormDetails(r);Le(new ae("CE Form Submitted",{form:n},this.triggerData)),nu(n);break}case"close":window.removeEventListener("klaviyoForms",this.handleKlaviyoEvents.bind(this)),Le(new ae("CE Trigger Closed",{form:{id:r.formId}},this.triggerData));break}}getFormDetails(t){let r={id:t.formId},n=t.metaData;if(_e.hasKeys(n)){let i=["email","phone_number","first_name","last_name","$email","$phone_number","$first_name","$last_name"];Object.keys(n).forEach(f=>{i.includes(f)||(r[f]=n[f])}),r.email=n.$email??n.email,r.mobile=n.$phone_number??n.phone_number;let o=n.$first_name??n.first_name,s=n.$last_name??n.last_name;(o?.length||s?.length)&&(r.name=o+" "+s)}return r}};function Eu(e){if(!Qp()||!Wt.get().pixelPush)return;let r=ar[e.intent]?.toLowerCase();r&&(R.verbose(`Sending ${r} intent to Facebook Pixel`),window.fbq("trackCustom","CooeeIntent",{intent_value:r}))}function Qp(){return window.fbq&&typeof window.fbq=="function"}var Ds=new Map,Iu=async e=>{for(let o of e.items)if(window.cooeeManipulateProduct)try{window.cooeeManipulateProduct(o,e)}catch(s){R.error(s)}if(e.isCartEmbed()&&!e.isSubscriptionUpsell()){let s=(await yt.getCurrent().getNormalisedCart()).items.map(f=>f.mID);e.items=e.items.filter(f=>!s.includes(f.mID))}if(e.items=Su(e),Wt.get().currencyCount<=1)return e.items;if(e.isShoppableVideo())return await Zp(e.content.videoConfig,e),e.items;let t=e.items.length,r=e.items.map(o=>xu(o,e)),i=(await Promise.all(r)).filter(o=>o!=null);if(t&&!i.length){let o="Failed to fetch any product from Ajax API",s=new ae("CE Campaign Failed",{reason:o,currency:e.currency},e);throw Le(s),new Error(o)}return Su(e,i)},Su=(e,t=e.items)=>{if(!e.isCartRecovery())return t;let r=yt.getCurrent().items,n=[];for(let i of t)for(let o of i.vars){if(!o.isAvailable)continue;let s=r.find(_=>_.variant_id.toString()===o.mID);if(!s)continue;let f=new ie(i);f.name=s.title;let h=new Er(o);h.name=s.variant_title,h.price.d=s.discounted_price/100,f.variants=[h],n.push(f)}return n},Zp=async(e,t)=>{await Promise.all(e.videos.map(async r=>{r.items=await Promise.all(r.items.map(async n=>{let i=await xu(n,t);return i||n}))}))},xu=async(e,t)=>{if(Ds.has(e.mID))return Ds.get(e.mID);let r,n=`/products/${e.slug}.js`;try{r=(await Ne(n)).data}catch(i){return i instanceof ye&&i.response?.status===404||vt(i,"fetch-shopify-product",{extra:{item:e,path:n},engagementTrigger:t}),null}return r?th(e,r):(R.error("Item not found after AJAX call for:",e),null)},th=(e,t)=>{if(!e||!t)return e;e.name=t.title,e.tags=t.tags,e.slug=t.handle;let r=e.selectedOrFirstVariant.value;return e.vars.map(n=>{let i=t.variants.find(o=>o.id===+n.mID);i!=null&&(n.name=i.title,n.isAvailable=i.available,n.price.d=i.price?i.price/100:i.price,n.price.effective=n.price.d,n.price.cmp=i.compare_at_price?i.compare_at_price/100:i.compare_at_price,+r.mID===i.id&&(r.effectivePrice.value=n.price.d))}),Ds.set(e.mID,e),e};var gn=e=>{let t=e instanceof ie?e.selectedOrFirstVariant.value.mID:e.vID,r=e instanceof ie?e.selectedOrFirstVariant.value.name:e.vName;return{product_id:e.mID,product_name:e.name,variant_id:t,variant_name:r}};var xs="/v1/event/track-page-unload";function Tu(e){R.verbose(`Waiting for auth to send event ${e.name}`),sr(He).then(()=>Le(e))}function bu(e){sr(He).then(()=>{eh(e)})}async function eh(e){let t=St().currentPageViewEvent;if(!t){R.warn("No page view event was stored previously");return}let r={pageViewEventID:t.id,pageViewEventName:t.name,pageActiveTimeMS:e};R.verbose("Sending page unload",r);try{await Mr(xs,r)}catch(n){throw R.error(`Error sending page unload for ${t} to server`,n),n}}function Le(e){rh(e)}async function rh(e){if(R.verbose(`Sending event: ${e.name}`,e),ch(e)){R.warn(`Rejecting event ${e.name}`);return}Jc();let t=await ru();Object.assign(e,t),wu(),Yt.set("lastUsedTime",new Date().getTime());let r=ah(e.name),n=r.toLowerCase().replace(/\s+/g,"-");try{let i=await Mr(`/v1/event/track/${n}`,e);R.info("Event tracked:",r),nh(e)&&(St().currentPageViewEvent={id:e.id,name:e.name}),ih(e,i.data)}catch(i){throw R.error(`Error sending event ${e.name} to server`,i),i}}function nh(e){return Vs.includes(e.name)?e.name==="View Cart"?!e.properties.drawer:!0:!1}function ih(e,t){oh(e,t).catch(r=>{vt(r,"process-popup-response",{extra:{event:e,response:t}})}),sh(t)}async function oh(e,t){if(!t.triggerData)return;let r=new Ti(t.triggerData);r.occurred=e.occurred,R.log(`${r} will be shown`);let n;try{n=await Iu(r)}catch(o){R.error("Failed to refresh the products",o);return}if(r.items=n,r.contentSource===Xr.KLAVIYO){new to().render(r);return}let i=await import("./renderer-X5CF2PGG.js");new i.FreeformRenderer().renderEngagement(r).catch(o=>{vt(o,"render-popup",{extra:{event:e},engagementTrigger:r})})}function sh(e){e.intent&&(hu(e.intent),Eu(e),R.info(`Intent is ${ar[e.intent]}`))}function ah(e){return e.replace("CE ","").replace("Trigger","Campaign").replace("Screen","Page").replace("App ","")}function ch(e){return e.trigger?.triggerID==="test"||e.trigger?.triggerID==="preview"?(R.warn("Not sending event as this is a test trigger"),!0):!1}var Cu=new ge,Nu=new ge;function aI(){return Nu.asObservable()}function eo(){Cu.next()}Cu.pipe(ws(100)).subscribe(hh.bind(void 0));function cI(){eo(),uh(),fh()}function uh(){let e=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){Ru(this._url).catch(t=>R.error("Unable to process cart change in XMLHttpRequest",t))}),e.apply(this,arguments)},R.verbose("Securely overwritten window.XMLHttpRequest.send method")}function fh(){let e=window.fetch;try{window.fetch=async function(t,r){return e(t,r).then(n=>{let i="";try{i=typeof t=="string"||t instanceof URL?t.toString():t?.url??n?.url??""}catch{}return Ru(i).catch(o=>R.error("Unable to process cart change in fetch",o)),n})},R.verbose("Securely overwritten window.fetch method")}catch(t){console.warn("Fail to override fetch.",`Cooee won't be able to track "Add To Cart" and "Remove From Cart" KPI.`),R.error(t)}}async function Ru(e){lh(e)&&eo()}function lh(e){return/\/cart\/(add|change|update|clear)/.test(e)}function ph(e,t){let r=e?.items,n=t.items,i=[],o=[];if(R.verbose(`Comparing cart change with old count ${r?.length} to new count ${n.length}`),n?.forEach(s=>{let f=r?.find(h=>h.vID===s.vID);if(f){if(f.quantity!==s.quantity){let h=f.quantity<s.quantity,_=Math.abs(f.quantity-s.quantity),g=Gt(J({},s),{quantity:_});h?i.push(g):o.push(g)}r&&qs(r,f)}else i.push(s)}),r)for(let s of r)o.push(s);R.verbose(`Cart delta: added: ${i.length}, removed: ${o.length}`),i.length&&Ou("Add To Cart",{items:i}),o.length&&e.token===t.token&&Ou("Remove From Cart",{items:o}),(o.length||i.length)&&Nu.next({itemsAdded:i,itemsRemoved:o,cart:t})}function Ou(e,t){let r=new ae(e,t);Tu(r)}async function hh(){let e=await Bt.get("cart",{}),t=await yt.getCurrent().getNormalisedCart(!0);ph(e,t)}var Be=class e{static cartDrawerToggle$=new cn({open:!1,firstOpen:!1});static DEFAULT_SELECTOR="cart-drawer";static _instance;inShadow=!1;cartDrawerElement;cartDrawerShadowElement;configWebsite=Wt.get().website??{};currentState=!1;mutationSubscription;mutationObserver;firstOpen=!0;selector;shadowParentElementSelector;clickEventListener;refreshUIEventListener;iconSelector=['button[drawer-to-open="cart-drawer"]','a[href="/cart"]',".header__icon--cart","#cart-icon-bubble",".cart-icon-bubble",".cart-count",'a[onclick*="handleFloCartBtn"]'].join(",");cartSelector=[e.DEFAULT_SELECTOR,"#halo-cart-sidebar",'[role="dialog"][class*="cart" i]','[id*="section-cart" i]',"#sidebar-cart","#rebuy-cart","#mini-cart","#flo-cart-wrapper","#drawer-cart","#UpcartPopupBackDrop",'[id$="CartDrawer" i]'].join(",");constructor(){this.initialize(),this.refreshUIEventListener=this.updateBubble.bind(this),this.clickEventListener=this.manualCartIconClicked.bind(this),document.addEventListener("letscooee:outbound:refresh-ui",this.refreshUIEventListener),document.addEventListener("click",this.clickEventListener,{capture:!0,passive:!0})}get element(){return this.cartDrawerElement}static get(){return e._instance||(e._instance=new e),e._instance}static initialize(){e.get()}isOpen(){if(window.cooeeIsCartDrawerVisible)return window.cooeeIsCartDrawerVisible();if(this.cartDrawerElement?.id==="rebuy-cart")return!!window.Rebuy?.SmartCart?.visible;let t=this.inShadow?this.isPresent():fs(this.cartDrawerElement);return R.info(`Cart drawer is currently ${t?"open":"close"}`),t}open(){if(this.isOpen()){R.log("Drawer is already open");return}document.dispatchEvent(new CustomEvent("letscooee:outbound:open-cart"));let t=document.querySelector(this.iconSelector);if(!t){R.verbose("No clickable cart icon found with selector",this.iconSelector);return}t.click()}isShopifyDefaultDrawer(){return this.element?.tagName.toLowerCase()===e.DEFAULT_SELECTOR}isMiniCart(){return this.isShopifyDefaultDrawer()&&this.element?.id==="mini-cart"}refreshUI(t,r=!0){if(window.cooeeUpdateCartDrawer)try{window.cooeeUpdateCartDrawer(t)}catch(n){vt(n,"execute-cooeeUpdateCartDrawer")}else if(this.isMiniCart()&&this.element?._rerenderCart)this.element._rerenderCart({detail:{cart:t}});else if(window.MinimogTheme?.Cart?.renderNewCart)window.MinimogTheme.Cart.renderNewCart();else if(this.isShopifyDefaultDrawer()&&this.element?.renderContents&&t)this.element.classList.remove("is-empty"),this.element.renderContents?.(t);else if(this.element?.onCartDrawerUpdate)this.element.onCartDrawerUpdate();else if(window.cartGiftUpdate){if(!t?.items?.[0])return;let n=t.items[0].id,i=t.items[0].quantity,o=t.items[0].price;window.cartGiftUpdate(n,o,i,"","ADD_TO_CART")}else if(window.icartCartActivityEvent)window.icartCartActivityEvent();else if(window.theme?.CartDrawer&&typeof window.theme?.CartDrawer=="function")window.theme?.CartDrawer.init?new window.theme.CartDrawer().init():new window.theme.CartDrawer;else if(window.Hs_CartDrawer?.updateSlideCart)window.Hs_CartDrawer.updateSlideCart();else if(window.theme?.fetch_side_cart)window.theme.fetch_side_cart();else if(window.theme?.Cart?.updateCart)window.theme.Cart.updateCart();else if(window.cartUpdate)window.cartUpdate();else if(this.element?._onCartRefresh)this.element._onCartRefresh();else if(window.cart?.getCart)window.cart.getCart();else if(this.element?.tagName?.toLowerCase()==="cart-drawer-component")document.dispatchEvent(new CustomEvent("action:cart:updateCartandShowCart"));else if(this.element?.id==="sidebar-cart")document.body.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{}}));else if(this.element?.id==="quick-cart"){let n=document.querySelector('a[href="/cart"]');n&&n.click()}else window.Shopify?.KT_onItemAdded?window.Shopify.KT_onItemAdded():window.sideCart?.updateCart?window.sideCart.updateCart():window.SLIDECART_UPDATE?(window.SLIDECART_UPDATE(),window.SLIDECART_OPEN?.()):window.refreshCart?yt.getCurrent().getNormalisedCart(!0).then(()=>{window.refreshCart(yt.getCurrent())}):window.OPEN_CART?window.OPEN_CART():window.updateCart?window.updateCart():window.sjRefreshCart?window.sjRefreshCart():window.CartJS?.getCart?window.CartJS?.getCart():window.updateCartItemJS?window.updateCartItemJS(1,t?.items?.[0]?.id+""):(R.info("No method found to update the cart drawer. Blindly firing some events to try"),document.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})));document.dispatchEvent(new CustomEvent("letscooee:outbound:refresh-ui",{detail:{responseJSON:t,currentCart:yt.getCurrent()}})),r&&eo()}async initialize(){let t=this.configWebsite.cartDrawerSelector;if(!t){await this.findCartDrawer();return}let r=t.split(":shadow");r.length===1?(this.selector=r[0],await this.findCartDrawer()):(this.inShadow=!0,this.shadowParentElementSelector=r[0]?.trim(),this.selector=r[1]?.trim(),await this.findCartDrawerWithShadow())}async findCartDrawer(){if(!en())return;let t=this.selector||this.cartSelector;if(this.cartDrawerElement=await ho(t),!this.cartDrawerElement){Du.default.warn("Max attempts exhausted to find cart drawer");return}R.verbose("Found",this.cartDrawerElement,`from selector: ${t}`),this.createMutationObservers()}async findCartDrawerWithShadow(){if(!this.shadowParentElementSelector)return;let r=(await ho(this.shadowParentElementSelector))?.shadowRoot;r?.mode==="open"&&(this.cartDrawerShadowElement=r,this.createMutationObservers())}createMutationObservers(){!this.cartDrawerElement&&!this.cartDrawerShadowElement||this.watchForCartToggle()}watchForCartToggle(){let t=this.cartDrawerElement||this.cartDrawerShadowElement,r=new ge;this.mutationObserver=new MutationObserver(()=>{r.next()}),this.mutationObserver.observe(t,{attributes:!0,subtree:!0,childList:this.inShadow}),this.mutationSubscription=r.pipe(bs(800,void 0,{leading:!1,trailing:!0})).subscribe(()=>{let n=this.isOpen();this.currentState!==n&&(this.currentState=n,e.cartDrawerToggle$.next({open:n,firstOpen:this.firstOpen}),this.firstOpen&&(this.firstOpen=!1))})}isPresent(){if(!this.selector||!this.cartDrawerShadowElement)return!1;let t=this.cartDrawerShadowElement.querySelector(this.selector);return t?fs(t):!1}async updateBubble(){let t=(await yt.getCurrent().getNormalisedCart(!0)).itemCount,r=document.querySelector(".cart-link__bubble");r&&(r.innerText=t+"")}manualCartIconClicked(t){!t.target.closest(this.iconSelector)||!t.isTrusted||window.CooeeSDK.events.push(["Open Cart"])}};var Au=class{constructor(t){this.scalingFactor=t}getLayoutStyles(t){if(!t)return{display:"block"};let r={display:t.disp};return t.of&&(r.objectFit=t.of),t.pos==="absolute"&&(r.width="auto !important",r.position="absolute",r.right=t.right+"px",r.left=t.left+"px",r.top=t.top+"px",r.bottom=t.bottom+"px"),r}getSizeStyles(t){let r={};return t?.w&&(r.width=t.w),t?.h&&(r.height=t.h),t?.maxW&&(r.maxWidth=t.maxW),t?.maxH&&(r.maxHeight=t.maxH),t?.minW&&(r.minWidth=t.minW),t?.minH&&(r.minHeight=t.minH),r}getBorderStyles(t){if(!t)return{};let r={};return t.radius&&t.radius>0&&(r.borderRadius=this.getSizePx(t.radius)),t.width&&t.width>0&&(r.borderWidth=this.getSizePx(t.width),r.borderStyle=t.style?.toLowerCase(),t.color?this.getColourStyles(t.color,"border-color",r):r.borderColor="black"),r}getFlexStyles(t){return t?{gap:t.gap+"px",flexWrap:t.wrap,flexDirection:t.dir,justifyContent:t.jc,alignItems:t.ai,width:"100%"}:{}}getSpaceStyles(t){let r={};return t?(r.paddingTop=this.getSizePx(t.pt),r.paddingBottom=this.getSizePx(t.pb),r.paddingLeft=this.getSizePx(t.pl),r.paddingRight=this.getSizePx(t.pr),r.marginTop=this.getSizePx(t.mt),r.marginBottom=this.getSizePx(t.mb),r.marginLeft=t.cent?"auto":this.getSizePx(t.ml),r.marginRight=t.cent?"auto":this.getSizePx(t.mr),r):(r.margin="0 !important",r.padding="unset",r)}getBackgroundStyles(t){if(!t)return{};let r={};if(t.glossy){let n="backdrop-filter",i="-webkit-"+n,o=`blur(${t.glossy.radius}px)`;if(!CSS.supports(i,o)&&!CSS.supports(n,o))return{background:t.glossy.fallback.rgba};if(r[i]=o,r[n]=o,t.glossy.color)return this.getColourStyles(t.glossy.color,"background",r)}else if(t.solid){if(t.solid.grad)return this.getGradientStyles(t.solid.grad,"background",r);if(t.solid.hex)return{backgroundColor:t.solid.rgba}}else if(t.img){if(!t.img.src)return{};let n=(t.img.a??0)/100;r.background=`linear-gradient(rgba(0, 0, 0, ${n}), rgba(0, 0, 0, ${n})),url("${t.img.src}") no-repeat center`,r.backgroundSize="cover",t.img.a&&(r["-webkit-backdrop-filter"]=`opacity(${t.img.a})`,r.backdropFilter=`opacity(${t.img.a})`)}return r}getGradientStyles(t,r,n){if(n??={},t.type==="LINEAR"){let i=`linear-gradient(${t.ang}deg, ${t.c1}, ${t.c2}`;t.c3&&(i+=`, ${t.c3}`),i+=")",n[r]=i}return n}getColourStyles(t,r="color",n){return n??={},t?t.grad?this.getGradientStyles(t.grad,r,n):(t.hex&&(n[r]=t.rgba),n):n}getSizePx(t){return this.getScaledSize(t)+"px"}getScaledSize(t){return(t??0)*this.scalingFactor}};var Uu=Oe(En());var mh=`
|
|
15
|
-
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
|
|
16
|
-
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
17
|
-
cart {
|
|
18
|
-
id
|
|
19
|
-
}
|
|
20
|
-
userErrors {
|
|
21
|
-
field
|
|
22
|
-
message
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
`,Ge=class{static navigate(t,r,n){let i=`${location.origin}/discount/${t}`;switch(R.log(`Applying discount code ${t}`,r,n),r){case we.CART_PAGE:location.href=`${i}?redirect=/cart`;break;case we.CART_DRAWER:location.href=`${i}?redirect=${location.pathname}#open-cart-drawer=1`;break;case we.SHOPIFY_CHECKOUT:location.href=`${i}?redirect=/checkout`;break;case we.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods(`${i}?redirect=/cart#initiate-checkout=1`);break;default:location.href=`${i}?redirect=${n||location.pathname}`}}static navigateWithoutDiscount(t,r){let n=Be.get();switch(t){case we.CART_PAGE:location.href="/cart";break;case we.SHOPIFY_CHECKOUT:location.href="/checkout";break;case we.THIRD_PARTY_CHECKOUT:this.checkThirdPartyMethods("/cart#initiate-checkout=1");break;case we.CART_DRAWER:{n.open();break}}r&&n.refreshUI(r)}static async applyWithStorefront(t){let r={cartId:`gid://shopify/Cart/${yt.getCurrent().token}`,discountCodes:t};R.verbose(`Applying ${t.length} coupons on cart`),await Yi(mh,r,"storefront-apply-discount")}static checkThirdPartyMethods(t){window.triggerGokwikCustomCheckout?window.triggerGokwikCustomCheckout():window.shiprocketCheckoutEvents?.buyCart?window.shiprocketCheckoutEvents.buyCart():window.openCheckout?window.openCheckout():window.handleFloCheckoutBtn?window.handleFloCheckoutBtn():window.openRzpCheckout?window.openRzpCheckout():location.href=t}};var Pu=Oe($o());var dh=`
|
|
27
|
-
mutation cartCreate($input: CartInput) {
|
|
28
|
-
cartCreate(input: $input) {
|
|
29
|
-
cart {
|
|
30
|
-
id
|
|
31
|
-
checkoutUrl
|
|
32
|
-
}
|
|
33
|
-
userErrors {
|
|
34
|
-
field
|
|
35
|
-
message
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
`;function Lu(e){let t=Be.get();if(window.cooeeGetCartSections&&typeof window.cooeeGetCartSections=="function")try{return{sections_url:window.location.pathname,sections:window.cooeeGetCartSections()}}catch(r){vt(r,"execute-cooeeGetCartSections",{engagementTrigger:e})}else{if(t.isMiniCart())return{sections:["mini-cart"]};if(t.isShopifyDefaultDrawer())return{sections:t.element.getSectionsToRender?.().map((r=>r.section??r.id))}}return{}}async function GI(e,t){if(!_e.hasKeys(e)){R.warn("No update fields provided");return}let r=Lu(t),n=J(J({},e),r);try{let i=await cr("/cart/update.js",n);return R.log("Updated cart",e),yt.getCurrent().update(i.data),i.data}catch(i){vt(i,"cart-update"),Re("Failed to update item in cart")}}var ro=class{async addToCart(t,r){if(!t.length)return;let n=t.map(s=>{let{vID:f,vName:h,quantity:_}=this.getVariantDetails(s),g=r.getPrivateAttributesForLineItem();if(_e.hasKeys(window.CooeeSDK.customItemProperties)){let d={name:h},E={templateSuffix:s.templateSuffix},v=Pu.render(JSON.stringify(window.CooeeSDK.customItemProperties),{variant:d,product:E});g=J(J({},JSON.parse(v)),g)}return{id:f?+f:+s.mID,quantity:_,properties:g}}),i=Lu(r),o=J({items:n},i);try{let s=await cr("/cart/add.js",o);return R.log(`Added ${t.length} items to Cart`),Re("Product added to your cart"),s.data}catch(s){vt(s,"cart-item-add",{engagementTrigger:r});let f=["Failed to add product in cart."];if(s instanceof ye&&s.is40x()&&s.responseText){let h=s.responseText;h.description&&f.push(`Reason: ${h.description}`)}f.push("Please try again later."),Re(f.join(" "))}}async copyDiscountCode(t){if(t)try{await navigator.clipboard.writeText(t),R.log(`Code-${t} copied`),Re("Discount code copied")}catch(r){R.error("Failed to copy code",r)}}getProductURL(t){if(!t?.link)return;let r=ka(t.link);if(r)return Sr("/products/"+r)}async upgradeToSubscription(t,r){if(!t){R.warn("Trying to upgrade to subscription with no item");return}let n=await yt.getCurrent().getNormalisedCart(),i=t.selectedOrFirstVariant.value,o=n.items.findIndex(h=>h.vID===i.mID),s=i.selectedSellingPlan.value,f={line:o+1,selling_plan:s?.mID||null,properties:r.getPrivateAttributesForLineItem()};try{let h=await cr("/cart/change.js",f);return R.log(`Upgraded ${t} selling plan`),Re("Line item updated"),yt.getCurrent().update(h.data),h.data}catch(h){vt(h,"cart-switch-subscription",{engagementTrigger:r}),Re("Failed to update subscription")}}async createNewCart(t,r,n){if(!t?.vID){R.error("No variant ID found to perform Buy now",t);return}let i=r?[r]:[],o=[{merchandiseId:`gid://shopify/ProductVariant/${t.vID}`,quantity:1,attributes:n.getKVFormatPrivateAttributesForLineItem()}],s=await Ks("Buy Now");return(await Yi(dh,{input:{lines:o,discountCodes:i,attributes:s}},"storefront-create-cart")).data.data?.cartCreate?.cart?.checkoutUrl}async process(t){let r=t.clickAction,n=t.items,i=t.triggerData,o;if(r.at){let s=r;R.log(`Performing ${JSON.stringify(s)} action`);let f={};if(s.at===Ut.GO_TO_PRODUCT)o=this.getProductURL(n[0]);else if(s.at===Ut.ADD_TO_CART)n?.length&&await this.addToCart(n,i);else if(s.at===Ut.COPY_COUPON_CODE)await this.copyDiscountCode(i.discount?.code),f.discountCode=i.discount?.code;else if(s.at===Ut.OPEN_CART)Be.get().open();else if(s.at===Ut.GO_TO_COLLECTION){let h=t.collections;if(!h?.length)return;o=Sr("/collections/"+h[0].handle)}f.products=n.map(gn),f.redirectTo=o,yn(s.at,f)}r.applyDiscount&&i.discount?.code?Ge.navigate(i.discount.code,i.redirectBehaviour,o):o&&(location.pathname=o)}getVariantDetails(t){let r,n,i;if(t instanceof be)r=t.vID,n=t.vName,i=t.quantity??1;else{if(!t.vars?.length)return{};r=t.selectedOrFirstVariant.value.mID,n=t.selectedOrFirstVariant.value.name,i=1}return{vID:r,quantity:i,vName:n}}};async function YI(e,t){if(!_e.hasKeys(t)){R.warn("No update fields provided");return}let r=J({id:e.key},t);try{let n=await cr("/cart/change.js",r);R.log("Updated line-item",e),yt.getCurrent().update(n.data)}catch(n){vt(n,"cart-item-update")}}var Bu=class{constructor(t){this.triggerContext=t}async execute(t){let r=St().currentItem,n=t.clickAction;if(!n)return;let i=t.item,o=this.triggerContext,s=new ro,f=o.triggerData.redirectBehaviour,h=!!o.triggerData.discount?.type&&!!n?.applyDiscount,_={selectedVariants:o.triggerData.nonMutableItems.map(B=>({itemMID:B.mID,mID:B.selectedOrFirstVariant.value.mID,variantID:B.selectedOrFirstVariant.value.mID})),eID:o.triggerData.engagementID,cID:o.triggerData.contentID},g="",d=[],E=[];if(i?E=[i.toEmbed()]:t.embeddedItem&&(E=[t.embeddedItem]),n.at===Ut.ADD_BUNDLE){let B=o.selectedItems;if(E=t.embeddedItems??B.map(F=>F.toEmbed()),o.shouldGiveFBTDiscount||t.embeddedItems?.length){let F;t.embeddedItems?F=t.embeddedItems.map(D=>({itemMID:D.mID,mID:D.vID,variantID:D.vID,quantity:D.quantity})):F=B.map(D=>({itemMID:D.mID,mID:D.selectedOrFirstVariant.value.mID,variantID:D.selectedOrFirstVariant.value.mID}));let G=o.triggerData.bundleFrom;o.triggerData.isBundleOnCartDrawer()&&G&&(F.push({itemMID:G.mID,mID:G.selectedOrFirstVariant.value.mID,isPrimary:!0}),E.unshift(G.toEmbed())),_.selectedVariants=F,o.triggerData.isBundleOnPDP()&&_.selectedVariants.forEach(D=>{D.mID===r.vID&&(D.isPrimary=!0)})}else _=void 0;d=t.embeddedItems??B}else if(n.at===Ut.INITIATE_CHECKOUT){let B=await yt.getCurrent().getNormalisedCart();E=B.items,_.selectedVariants=B.items.map(F=>({itemMID:F.mID,mID:F.vID}))}else if(n.at===Ut.ADD_TO_CART)d=i?[i]:[t.embeddedItem];else if(n.at===Ut.QUICK_VIEW){window.cooeeShowQuickItem(this.triggerContext,i),this.sendTriggerClicked(E,{from:"button"},t.video);return}else if(n.at===Ut.GO_TO_PRODUCT)g=i?Sr("/products/"+i.slug):t.embeddedItem?.link;else if(n.at===Ut.GO_TO_URL){let B=Ys(n.gu?.u);window.CooeeSDK.allowExternalURL?B&&(g=B.href):B&&(g=B.pathname+B.search+B.hash)}else if(n.at===Ut.UPGRADE_TO_SUBSCRIPTION){let B=await s.upgradeToSubscription(i,o.triggerData);this.triggerContext.triggerData.skipSubscribedItems&&this.triggerContext.renderer.destroy(),Be.get().refreshUI(B)}else if(n.at===Ut.GO_TO_COLLECTION){let B=this.triggerContext.triggerData.collections?.[0];B&&(g="collections/"+B.handle)}if(this.sendTriggerClicked(E,{from:"button"},t.video),R.verbose({redirectPath:g,redirectBehaviour:f,hasDiscount:h}),!h&&g){yn(n.at,{redirectTo:g}),location.href=g;return}let v,T=!1;try{v=await this.getOrGenerateDiscountCode(_),R.verbose("Discount code (if any) to apply",v)}catch(B){if(!this.triggerContext.triggerData.isBYOB()){Uu.default.error("Unable to get a discount code",B);return}}if(v&&n.at===Ut.COPY_COUPON_CODE)await s.copyDiscountCode(v);else if(n.at===Ut.BUY_NOW){let B=await s.createNewCart(r,v,o.triggerData);B&&(yn(n.at,{products:[gn(r)],redirectTo:B}),location.href=B);return}try{v&&await Ge.applyWithStorefront([v])}catch(B){R.error(B),T=!0}let A;if(d?.length&&(A=await s.addToCart(d,o.triggerData)),yn(n.at,{products:d.map(gn),redirectTo:g,discountCode:v}),T&&v){Ge.navigate(v,f,g);return}if(g){location.href=g;return}Ge.navigateWithoutDiscount(f,A)}sendTriggerClicked(t,r,n){let i=new ae("CE Trigger Clicked",r,this.triggerContext.triggerData);i.items=t,i.setVideos(n),Le(i)}async getOrGenerateDiscountCode(t){let r=this.triggerContext.triggerData.discount;if(!r?.type)return;let n="";if(r.type===ve.STATIC){if(!r.code)throw ra("No discount code found","warning",{triggerContext:this.triggerContext}),new Error("No discount code found");return r.code}if(t){if(n=await gh(t,this.triggerContext),!n)throw R.error("No discount code found",t),new Error("Discount code not found or generated");return n}}};function yn(e,t){document.dispatchEvent(new CustomEvent("letscooee:outbound:cta-executed",{detail:J({action:Ut[e]},t)}))}async function gh(e,t){try{return(await iu(e)).data.code}catch(r){throw Re("Failed to generate a discount code"),vt(r,"backend-generate-discount",{triggerContext:t}),r}}export{Wt as a,St as b,vh as c,rE as d,ve as e,Pf as f,we as g,Ut as h,Lf as i,ze as j,Yr as k,Pn as l,he as m,be as n,Sn as o,_e as p,In as q,hr as r,Bt as s,ye as t,vt as u,ra as v,Ys as w,Jh as x,Qt as y,Xh as z,Re as A,If as B,ho as C,Ks as D,Kh as E,Qh as F,mt as G,Mf as H,Kn as I,yr as J,Pd as K,tn as L,Er as M,ie as N,Vo as O,vg as P,Fa as Q,yt as R,qr as S,qe as T,Me as U,dr as V,Bn as W,Mn as X,Fn as Y,kn as Z,$n as _,hi as $,zt as aa,me as ba,Cr as ca,Si as da,Xo as ea,Ti as fa,Oi as ga,ae as ha,ge as ia,sr as ja,hn as ka,vs as la,Gc as ma,mp as na,ws as oa,He as pa,tS as qa,eS as ra,aS as sa,Iu as ta,S0 as ua,I0 as va,x0 as wa,T0 as xa,aI as ya,cI as za,Be as Aa,Au as Ba,Bu as Ca,GI as Da,ro as Ea,YI as Fa,Tu as Ga,Le as Ha,ru as Ia,nu as Ja,SE as Ka,Mr as La};
|